Currently, the pci_p2pdma_whitelist array requires an exact match for both
Vendor and Device ID. Some hardware vendors support cross bridge
peer-to-peer DMA across their entire silicon lineup, so add support for
wildcard device IDs to avoid the need to continuously update this array.
Signed-off-by: Jacob Moroni <jmoroni@google.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Link: https://patch.msgid.link/20260409150123.3538444-1-jmoroni@google.com
static const struct pci_p2pdma_whitelist_entry {
unsigned short vendor;
- unsigned short device;
+ int device;
enum {
REQ_SAME_HOST_BRIDGE = 1 << 0,
} flags;
device = root->device;
for (entry = pci_p2pdma_whitelist; entry->vendor; entry++) {
- if (vendor != entry->vendor || device != entry->device)
+ if (vendor != entry->vendor)
continue;
+
+ if (entry->device != PCI_ANY_ID && device != entry->device)
+ continue;
+
if (entry->flags & REQ_SAME_HOST_BRIDGE && !same_host_bridge)
return false;