Home Home > GIT Browse
diff options
authorTakashi Iwai <tiwai@suse.de>2019-07-16 16:12:15 +0200
committerTakashi Iwai <tiwai@suse.de>2019-07-16 16:12:23 +0200
commit17fe5b0085b875d1fff26cdc32683cd14954b73d (patch)
parent5e5091687a4011b7fa9c463c64b1c565156954a7 (diff)
PCI: Always allow probing with driver_override (bsc#1051510).
2 files changed, 56 insertions, 0 deletions
diff --git a/patches.drivers/PCI-Always-allow-probing-with-driver_override.patch b/patches.drivers/PCI-Always-allow-probing-with-driver_override.patch
new file mode 100644
index 0000000000..0c4f93a9f0
--- /dev/null
+++ b/patches.drivers/PCI-Always-allow-probing-with-driver_override.patch
@@ -0,0 +1,55 @@
+From 2d2f4273cbe9058d1f5a518e5e880d27d7b3b30f Mon Sep 17 00:00:00 2001
+From: Alex Williamson <alex.williamson@redhat.com>
+Date: Thu, 9 May 2019 13:27:22 -0600
+Subject: [PATCH] PCI: Always allow probing with driver_override
+Git-commit: 2d2f4273cbe9058d1f5a518e5e880d27d7b3b30f
+Patch-mainline: v5.3-rc1
+References: bsc#1051510
+Commit 0e7df22401a3 ("PCI: Add sysfs sriov_drivers_autoprobe to control
+VF driver binding") introduced the sriov_drivers_autoprobe attribute
+which allows users to prevent the kernel from automatically probing a
+driver for new VFs as they are created. This allows VFs to be spawned
+without automatically binding the new device to a host driver, such as
+in cases where the user intends to use the device only with a meta
+driver like vfio-pci. However, the current implementation prevents any
+use of drivers_probe with the VF while sriov_drivers_autoprobe=0. This
+blocks the now current general practice of setting driver_override
+followed by using drivers_probe to bind a device to a specified driver.
+The kernel never automatically sets a driver_override therefore it seems
+we can assume a driver_override reflects the intent of the user. Also,
+probing a device using a driver_override match seems outside the scope
+of the 'auto' part of sriov_drivers_autoprobe. Therefore, let's allow
+driver_override matches regardless of sriov_drivers_autoprobe, which we
+can do by simply testing if a driver_override is set for a device as a
+'can probe' condition.
+Fixes: 0e7df22401a3 ("PCI: Add sysfs sriov_drivers_autoprobe to control VF driver binding")
+Link: https://lore.kernel.org/lkml/155742996741.21878.569845487290798703.stgit@gimli.home
+Link: https://lore.kernel.org/linux-pci/155672991496.20698.4279330795743262888.stgit@gimli.home/T/#u
+Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Acked-by: Takashi Iwai <tiwai@suse.de>
+ drivers/pci/pci-driver.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
+index 53874aae3873..b6a3a51801f0 100644
+--- a/drivers/pci/pci-driver.c
++++ b/drivers/pci/pci-driver.c
+@@ -399,7 +399,8 @@ void __weak pcibios_free_irq(struct pci_dev *dev)
+ static inline bool pci_device_can_probe(struct pci_dev *pdev)
+ {
+- return (!pdev->is_virtfn || pdev->physfn->sriov->drivers_autoprobe);
++ return (!pdev->is_virtfn || pdev->physfn->sriov->drivers_autoprobe ||
++ pdev->driver_override);
+ }
+ #else
+ static inline bool pci_device_can_probe(struct pci_dev *pdev)
diff --git a/series.conf b/series.conf
index 5a43d25c56..31bc2bc8f3 100644
--- a/series.conf
+++ b/series.conf
@@ -22925,6 +22925,7 @@
+ patches.drivers/PCI-Always-allow-probing-with-driver_override.patch
# powerpc/linux next