mirror of
https://github.com/torvalds/linux.git
synced 2024-12-03 17:41:22 +00:00
PCI/P2PDMA: Allow P2PDMA on AMD Zen and newer CPUs
Allow P2PDMA if the CPU vendor is AMD and family is 0x17 (Zen) or greater. [bhelgaas: commit log, simplify #if/#else/#endif] Link: https://lore.kernel.org/r/20200729231844.4653-1-logang@deltatee.com Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Cc: Christian König <christian.koenig@amd.com> Cc: Huang Rui <ray.huang@amd.com>
This commit is contained in:
parent
b3a9e3b962
commit
dea286bb71
@ -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));
|
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 {
|
static const struct pci_p2pdma_whitelist_entry {
|
||||||
unsigned short vendor;
|
unsigned short vendor;
|
||||||
unsigned short device;
|
unsigned short device;
|
||||||
@ -280,11 +293,6 @@ static const struct pci_p2pdma_whitelist_entry {
|
|||||||
REQ_SAME_HOST_BRIDGE = 1 << 0,
|
REQ_SAME_HOST_BRIDGE = 1 << 0,
|
||||||
} flags;
|
} flags;
|
||||||
} pci_p2pdma_whitelist[] = {
|
} 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 */
|
/* Intel Xeon E5/Core i7 */
|
||||||
{PCI_VENDOR_ID_INTEL, 0x3c00, REQ_SAME_HOST_BRIDGE},
|
{PCI_VENDOR_ID_INTEL, 0x3c00, REQ_SAME_HOST_BRIDGE},
|
||||||
{PCI_VENDOR_ID_INTEL, 0x3c01, 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);
|
acs_redirects, acs_list);
|
||||||
|
|
||||||
if (map_type == PCI_P2PDMA_MAP_THRU_HOST_BRIDGE) {
|
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;
|
map_type = PCI_P2PDMA_MAP_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user