From 0baa9b0184503da796f95f810c5e1172e9cd1d80 Mon Sep 17 00:00:00 2001 From: Kunkun Jiang Date: Tue, 8 Aug 2023 15:09:45 +0800 Subject: [PATCH] Revert "vfio-pci: Match specific devices with vendor id and device id" virt inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I7QPGW CVE: NA ------------------------------------------------------------------ This reverts commit 75fbddc88c9a563b3d883855234da4c1c366f3c7. The problem code is not completely fixed. To keep consistent with olk-5.10, roll back this patch and resubmit the bugfix. Signed-off-by: Kunkun Jiang --- drivers/crypto/hisilicon/migration/acc_vf_migration.c | 6 ------ drivers/vfio/pci/vfio_pci.c | 4 ---- include/linux/vfio.h | 3 --- 3 files changed, 13 deletions(-) diff --git a/drivers/crypto/hisilicon/migration/acc_vf_migration.c b/drivers/crypto/hisilicon/migration/acc_vf_migration.c index fdfbe4590253..cd38254c6598 100644 --- a/drivers/crypto/hisilicon/migration/acc_vf_migration.c +++ b/drivers/crypto/hisilicon/migration/acc_vf_migration.c @@ -1739,8 +1739,6 @@ static void acc_vf_remove(void *vendor_data) static struct vfio_pci_vendor_driver_ops sec_vf_mig_ops = { .owner = THIS_MODULE, .name = "hisi_sec2", - .vendor = PCI_VENDOR_ID_HUAWEI, - .device = PCI_DEVICE_ID_HUAWEI_SEC_VF, .probe = acc_vf_probe, .remove = acc_vf_remove, .device_ops = &acc_vf_device_ops_node, @@ -1749,8 +1747,6 @@ static struct vfio_pci_vendor_driver_ops sec_vf_mig_ops = { static struct vfio_pci_vendor_driver_ops hpre_vf_mig_ops = { .owner = THIS_MODULE, .name = "hisi_hpre", - .vendor = PCI_VENDOR_ID_HUAWEI, - .device = PCI_DEVICE_ID_HUAWEI_HPRE_VF, .probe = acc_vf_probe, .remove = acc_vf_remove, .device_ops = &acc_vf_device_ops_node, @@ -1759,8 +1755,6 @@ static struct vfio_pci_vendor_driver_ops hpre_vf_mig_ops = { static struct vfio_pci_vendor_driver_ops zip_vf_mig_ops = { .owner = THIS_MODULE, .name = "hisi_zip", - .vendor = PCI_VENDOR_ID_HUAWEI, - .device = PCI_DEVICE_ID_HUAWEI_ZIP_VF, .probe = acc_vf_probe, .remove = acc_vf_remove, .device_ops = &acc_vf_device_ops_node, diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 2382222b0960..6d7ae4e3b983 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c @@ -2077,10 +2077,6 @@ static int probe_vendor_drivers(struct vfio_pci_device *vdev) list_for_each_entry(driver, &vfio_pci.vendor_drivers_list, next) { void *data; - if (vdev->pdev->vendor != driver->ops->vendor || - vdev->pdev->device != driver->ops->device) - continue; - if (!try_module_get(driver->ops->owner)) continue; diff --git a/include/linux/vfio.h b/include/linux/vfio.h index e8841446a2eb..9a2217f13753 100644 --- a/include/linux/vfio.h +++ b/include/linux/vfio.h @@ -253,9 +253,6 @@ extern int vfio_pci_set_vendor_regions(void *device_data, struct vfio_pci_vendor_driver_ops { char *name; struct module *owner; - /* Used to match device */ - unsigned short vendor; - unsigned short device; void *(*probe)(struct pci_dev *pdev); void (*remove)(void *vendor_data); struct vfio_device_ops *device_ops; -- GitLab