Commit f69767a1 authored by Wei Huang's avatar Wei Huang Committed by Bjorn Helgaas
Browse files

PCI: Add TLP Processing Hints (TPH) support

Add support for PCIe TLP Processing Hints (TPH) support (see PCIe r6.2,
sec 6.17).

Add TPH register definitions in pci_regs.h, including the TPH Requester
capability register, TPH Requester control register, TPH Completer
capability, and the ST fields of MSI-X entry.

Introduce pcie_enable_tph() and pcie_disable_tph(), enabling drivers to
toggle TPH support and configure specific ST mode as needed. Also add a new
kernel parameter, "pci=notph", allowing users to disable TPH support across
the entire system.

Link: https://lore.kernel.org/r/20241002165954.128085-2-wei.huang2@amd.com


Co-developed-by: default avatarJing Liu <jing2.liu@intel.com>
Co-developed-by: default avatarPaul Luse <paul.e.luse@linux.intel.com>
Co-developed-by: default avatarEric Van Tassell <Eric.VanTassell@amd.com>
Signed-off-by: default avatarJing Liu <jing2.liu@intel.com>
Signed-off-by: default avatarPaul Luse <paul.e.luse@linux.intel.com>
Signed-off-by: default avatarEric Van Tassell <Eric.VanTassell@amd.com>
Signed-off-by: default avatarWei Huang <wei.huang2@amd.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarAjit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: default avatarSomnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: default avatarAndy Gospodarek <andrew.gospodarek@broadcom.com>
Reviewed-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: default avatarLukas Wunner <lukas@wunner.de>
parent 9852d85e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -4678,6 +4678,10 @@
		nomio		[S390] Do not use MIO instructions.
		norid		[S390] ignore the RID field and force use of
				one PCI domain per PCI function
		notph		[PCIE] If the PCIE_TPH kernel config parameter
				is enabled, this kernel boot option can be used
				to disable PCIe TLP Processing Hints support
				system-wide.

	pcie_aspm=	[PCIE] Forcibly enable or ignore PCIe Active State Power
			Management.
+9 −0
Original line number Diff line number Diff line
@@ -173,6 +173,15 @@ config PCI_PASID

	  If unsure, say N.

config PCIE_TPH
	bool "TLP Processing Hints"
	help
	  This option adds support for PCIe TLP Processing Hints (TPH).
	  TPH allows endpoint devices to provide optimization hints, such as
	  desired caching behavior, for requests that target memory space.
	  These hints, called Steering Tags, can empower the system hardware
	  to optimize the utilization of platform resources.

config PCI_P2PDMA
	bool "PCI peer-to-peer transfer support"
	depends on ZONE_DEVICE
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ obj-$(CONFIG_VGA_ARB) += vgaarb.o
obj-$(CONFIG_PCI_DOE)		+= doe.o
obj-$(CONFIG_PCI_DYNAMIC_OF_NODES) += of_property.o
obj-$(CONFIG_PCI_NPEM)		+= npem.o
obj-$(CONFIG_PCIE_TPH)		+= tph.o

# Endpoint library must be initialized before its users
obj-$(CONFIG_PCI_ENDPOINT)	+= endpoint/
+4 −0
Original line number Diff line number Diff line
@@ -1828,6 +1828,7 @@ int pci_save_state(struct pci_dev *dev)
	pci_save_dpc_state(dev);
	pci_save_aer_state(dev);
	pci_save_ptm_state(dev);
	pci_save_tph_state(dev);
	return pci_save_vc_state(dev);
}
EXPORT_SYMBOL(pci_save_state);
@@ -1933,6 +1934,7 @@ void pci_restore_state(struct pci_dev *dev)
	pci_restore_rebar_state(dev);
	pci_restore_dpc_state(dev);
	pci_restore_ptm_state(dev);
	pci_restore_tph_state(dev);

	pci_aer_clear_status(dev);
	pci_restore_aer_state(dev);
@@ -6896,6 +6898,8 @@ static int __init pci_setup(char *str)
				pci_no_domains();
			} else if (!strncmp(str, "noari", 5)) {
				pcie_ari_disabled = true;
			} else if (!strncmp(str, "notph", 5)) {
				pci_no_tph();
			} else if (!strncmp(str, "cbiosize=", 9)) {
				pci_cardbus_io_size = memparse(str + 9, &str);
			} else if (!strncmp(str, "cbmemsize=", 10)) {
+12 −0
Original line number Diff line number Diff line
@@ -597,6 +597,18 @@ static inline int pci_iov_bus_range(struct pci_bus *bus)

#endif /* CONFIG_PCI_IOV */

#ifdef CONFIG_PCIE_TPH
void pci_restore_tph_state(struct pci_dev *dev);
void pci_save_tph_state(struct pci_dev *dev);
void pci_no_tph(void);
void pci_tph_init(struct pci_dev *dev);
#else
static inline void pci_restore_tph_state(struct pci_dev *dev) { }
static inline void pci_save_tph_state(struct pci_dev *dev) { }
static inline void pci_no_tph(void) { }
static inline void pci_tph_init(struct pci_dev *dev) { }
#endif

#ifdef CONFIG_PCIE_PTM
void pci_ptm_init(struct pci_dev *dev);
void pci_save_ptm_state(struct pci_dev *dev);
Loading