When "No ST mode" is enabled, endpoint devices can generate TPH headers but with all steering tags treated as zero. A steering tag of zero is interpreted as "using the default policy" by the root complex. This is essential to quantify the benefit of Steering Tags for some given workloads. Co-developed-by: Eric Van Tassell <Eric.VanTassell@xxxxxxx> Signed-off-by: Eric Van Tassell <Eric.VanTassell@xxxxxxx> Signed-off-by: Wei Huang <wei.huang2@xxxxxxx> Reviewed-by: Ajit Khaparde <ajit.khaparde@xxxxxxxxxxxx> Reviewed-by: Somnath Kotur <somnath.kotur@xxxxxxxxxxxx> Reviewed-by: Andy Gospodarek <andrew.gospodarek@xxxxxxxxxxxx> --- Documentation/admin-guide/kernel-parameters.txt | 3 +++ drivers/pci/pci.c | 2 ++ drivers/pci/pci.h | 2 ++ drivers/pci/pcie/tph.c | 12 ++++++++++++ 4 files changed, 19 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index f1384c7b59c9..ed2ee97cf7fb 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -4617,6 +4617,9 @@ nomio [S390] Do not use MIO instructions. norid [S390] ignore the RID field and force use of one PCI domain per PCI function + nostmode [PCIE] If PCIe TPH Processing Hints (TPH) is + enabled, this kernel option forces all Steering + Tags to be treated as zero (aka "No ST Mode"). pcie_aspm= [PCIE] Forcibly enable or ignore PCIe Active State Power Management. diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 1e4960994b1a..88aabac354c0 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -6870,6 +6870,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, "nostmode", 8)) { + pci_tph_set_nostmode(); } else if (!strncmp(str, "cbiosize=", 9)) { pci_cardbus_io_size = memparse(str + 9, &str); } else if (!strncmp(str, "cbmemsize=", 10)) { diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index d7c7f86e8705..54d74f5ff861 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -574,10 +574,12 @@ static inline int pci_iov_bus_range(struct pci_bus *bus) #ifdef CONFIG_PCIE_TPH void pci_restore_tph_state(struct pci_dev *dev); void pci_save_tph_state(struct pci_dev *dev); +void pci_tph_set_nostmode(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_tph_set_nostmode(void) { } static inline void pci_tph_init(struct pci_dev *dev) { } #endif diff --git a/drivers/pci/pcie/tph.c b/drivers/pci/pcie/tph.c index b228ef5b7948..f723352adcf5 100644 --- a/drivers/pci/pcie/tph.c +++ b/drivers/pci/pcie/tph.c @@ -48,6 +48,8 @@ union st_info { u64 value; }; +static bool pci_tph_nostmode; + static u16 tph_extract_tag(enum tph_mem_type mem_type, u8 req_type, union st_info *info) { @@ -433,6 +435,10 @@ int pcie_enable_tph(struct pci_dev *pdev, int mode) return -EINVAL; } + /* Honor "nostmode" kernel parameter */ + if (pci_tph_nostmode) + pdev->tph_mode = PCI_TPH_NO_ST_MODE; + /* Get req_type supported by device and its Root Port */ reg = pci_read_config_dword(pdev, pdev->tph_cap + PCI_TPH_CAP, ®); if (FIELD_GET(PCI_TPH_CAP_EXT_TPH, reg)) @@ -545,6 +551,12 @@ void pci_save_tph_state(struct pci_dev *pdev) } } +void pci_tph_set_nostmode(void) +{ + pci_tph_nostmode = true; + pr_info("PCIe TPH No ST Mode is enabled\n"); +} + void pci_tph_init(struct pci_dev *pdev) { pdev->tph_cap = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_TPH); -- 2.45.1