diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2020-08-05 18:24:17 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2020-08-05 18:24:17 -0500 |
commit | 4f7adb6ee74ccb1c745eec17e5ce89cfd09cd1e9 (patch) | |
tree | 70ca15c49049fd6e778a36e28fb7f20e9f4f1921 /drivers/pci | |
parent | d697552f52f31f3b46050522c2e93f5c3aed3046 (diff) | |
parent | dea286bb71baded7d2fb4f090e3b9fd2c1ccac58 (diff) |
Merge branch 'pci/peer-to-peer'
- Allow P2PDMA on AMD Zen and newer CPUs (Logan Gunthorpe)
* pci/peer-to-peer:
PCI/P2PDMA: Allow P2PDMA on AMD Zen and newer CPUs
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/p2pdma.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c index f29a48f8fa59..64ebed129dbf 100644 --- a/drivers/pci/p2pdma.c +++ b/drivers/pci/p2pdma.c @@ -273,6 +273,19 @@ static void seq_buf_print_bus_devfn(struct seq_buf *buf, struct pci_dev *pdev) seq_buf_printf(buf, "%s;", pci_name(pdev)); } +static bool cpu_supports_p2pdma(void) +{ +#ifdef CONFIG_X86 + struct cpuinfo_x86 *c = &cpu_data(0); + + /* Any AMD CPU whose family ID is Zen or newer supports p2pdma */ + if (c->x86_vendor == X86_VENDOR_AMD && c->x86 >= 0x17) + return true; +#endif + + return false; +} + static const struct pci_p2pdma_whitelist_entry { unsigned short vendor; unsigned short device; @@ -280,11 +293,6 @@ static const struct pci_p2pdma_whitelist_entry { REQ_SAME_HOST_BRIDGE = 1 << 0, } flags; } pci_p2pdma_whitelist[] = { - /* AMD ZEN */ - {PCI_VENDOR_ID_AMD, 0x1450, 0}, - {PCI_VENDOR_ID_AMD, 0x15d0, 0}, - {PCI_VENDOR_ID_AMD, 0x1630, 0}, - /* Intel Xeon E5/Core i7 */ {PCI_VENDOR_ID_INTEL, 0x3c00, REQ_SAME_HOST_BRIDGE}, {PCI_VENDOR_ID_INTEL, 0x3c01, REQ_SAME_HOST_BRIDGE}, @@ -473,7 +481,8 @@ upstream_bridge_distance(struct pci_dev *provider, struct pci_dev *client, acs_redirects, acs_list); if (map_type == PCI_P2PDMA_MAP_THRU_HOST_BRIDGE) { - if (!host_bridge_whitelist(provider, client)) + if (!cpu_supports_p2pdma() && + !host_bridge_whitelist(provider, client)) map_type = PCI_P2PDMA_MAP_NOT_SUPPORTED; } |