summaryrefslogtreecommitdiff
path: root/drivers/pci/p2pdma.c
diff options
context:
space:
mode:
authorLogan Gunthorpe <logang@deltatee.com>2021-06-10 19:06:07 +0300
committerBjorn Helgaas <bhelgaas@google.com>2021-06-11 02:01:41 +0300
commitcf201bfe8cdc9ba11c4f312945b908ed24c7b7b5 (patch)
tree99303b455a08cbcdf6d8f45c8f4e1ee0886b901e /drivers/pci/p2pdma.c
parentf9c125b9eb30650356cf582003365b1ecbd7003b (diff)
downloadlinux-cf201bfe8cdc9ba11c4f312945b908ed24c7b7b5.tar.xz
PCI/P2PDMA: Warn if host bridge not in whitelist
If the host bridge is not in the whitelist print a warning in the calc_map_type_and_dist_warn() path detailing the vendor and device IDs that would need to be added to the whitelist. Suggested-by: Don Dutile <ddutile@redhat.com> Link: https://lore.kernel.org/r/20210610160609.28447-5-logang@deltatee.com Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/p2pdma.c')
-rw-r--r--drivers/pci/p2pdma.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
index abcdb2a6b1c0..c07c928e3952 100644
--- a/drivers/pci/p2pdma.c
+++ b/drivers/pci/p2pdma.c
@@ -309,7 +309,7 @@ static const struct pci_p2pdma_whitelist_entry {
};
static bool __host_bridge_whitelist(struct pci_host_bridge *host,
- bool same_host_bridge)
+ bool same_host_bridge, bool warn)
{
struct pci_dev *root = pci_get_slot(host->bus, PCI_DEVFN(0, 0));
const struct pci_p2pdma_whitelist_entry *entry;
@@ -331,6 +331,10 @@ static bool __host_bridge_whitelist(struct pci_host_bridge *host,
return true;
}
+ if (warn)
+ pci_warn(root, "Host bridge not in P2PDMA whitelist: %04x:%04x\n",
+ vendor, device);
+
return false;
}
@@ -338,16 +342,17 @@ static bool __host_bridge_whitelist(struct pci_host_bridge *host,
* If we can't find a common upstream bridge take a look at the root
* complex and compare it to a whitelist of known good hardware.
*/
-static bool host_bridge_whitelist(struct pci_dev *a, struct pci_dev *b)
+static bool host_bridge_whitelist(struct pci_dev *a, struct pci_dev *b,
+ bool warn)
{
struct pci_host_bridge *host_a = pci_find_host_bridge(a->bus);
struct pci_host_bridge *host_b = pci_find_host_bridge(b->bus);
if (host_a == host_b)
- return __host_bridge_whitelist(host_a, true);
+ return __host_bridge_whitelist(host_a, true, warn);
- if (__host_bridge_whitelist(host_a, false) &&
- __host_bridge_whitelist(host_b, false))
+ if (__host_bridge_whitelist(host_a, false, warn) &&
+ __host_bridge_whitelist(host_b, false, warn))
return true;
return false;
@@ -485,7 +490,7 @@ calc_map_type_and_dist(struct pci_dev *provider, struct pci_dev *client,
if (map_type == PCI_P2PDMA_MAP_THRU_HOST_BRIDGE) {
if (!cpu_supports_p2pdma() &&
- !host_bridge_whitelist(provider, client))
+ !host_bridge_whitelist(provider, client, acs_redirects))
map_type = PCI_P2PDMA_MAP_NOT_SUPPORTED;
}