From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Maurizio Lombardi Date: Mon, 18 Jun 2018 12:51:25 -0400 Subject: [PATCH] add pci_hw_vendor_status() Message-id: <1529326285-28560-1-git-send-email-mlombard@redhat.com> Patchwork-id: 222337 O-Subject: [RHEL8 PATCH] pci: add pci_hw_vendor_status() Bugzilla: 1590829 RH-Acked-by: Tomas Henzl RH-Acked-by: Prarit Bhargava This patch adds pci_hw_vendor_status() like in RHEL7 which should be called during the driver's probe to identify deprecated devices. BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1590829 Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=16761315 See RHEL7 commits e0dddd9a63403ec82077ed410074fc6485873d4b and 3fcddde5ddf4b190c84ce9d83d56a75137513bd7 RHEL_only. Upstream Status: RHEL only Signed-off-by: Maurizio Lombardi Signed-off-by: Herton R. Krzesinski --- drivers/pci/pci-driver.c | 29 +++++++++++++++++++++++++++++ include/linux/pci.h | 4 ++++ 2 files changed, 33 insertions(+) diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 449466f71040..f5678ed743bf 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "pci.h" #include "pcie/portdrv.h" @@ -279,6 +280,34 @@ static const struct pci_device_id *pci_match_device(struct pci_driver *drv, return found_id; } +/** + * pci_hw_vendor_status - Tell if a PCI device is supported by the HW vendor + * @ids: array of PCI device id structures to search in + * @dev: the PCI device structure to match against + * + * Used by a driver to check whether this device is in its list of unsupported + * devices. Returns the matching pci_device_id structure or %NULL if there is + * no match. + * + * Reserved for Internal Red Hat use only. + */ +const struct pci_device_id *pci_hw_vendor_status( + const struct pci_device_id *ids, + struct pci_dev *dev) +{ + char devinfo[64]; + const struct pci_device_id *ret = pci_match_id(ids, dev); + + if (ret) { + snprintf(devinfo, sizeof(devinfo), "%s %s", + dev_driver_string(&dev->dev), dev_name(&dev->dev)); + mark_hardware_deprecated(devinfo); + } + + return ret; +} +EXPORT_SYMBOL(pci_hw_vendor_status); + struct drv_dev_and_id { struct pci_driver *drv; struct pci_dev *dev; diff --git a/include/linux/pci.h b/include/linux/pci.h index 835530605c0d..1a5afb3b706f 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1406,6 +1406,10 @@ int pci_add_dynid(struct pci_driver *drv, unsigned long driver_data); const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, struct pci_dev *dev); +/* Reserved for Internal Red Hat use only */ +const struct pci_device_id *pci_hw_vendor_status( + const struct pci_device_id *ids, + struct pci_dev *dev); int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass); -- 2.26.2