Without pci-passthrough=on Xen does not know anything about present PCI
devices due to PHYSDEVOP_pci_device_add not executing. This causes
PHYSDEVOP_pci_device_reset to fail when trying to find the device that
is being reset and return ENODEV.

Add explicit is_pci_passthrough_enabled check to return a more
meaningful EOPNOTSUPP code.

Signed-off-by: Mykyta Poturai <mykyta_potu...@epam.com>
---
 xen/drivers/pci/physdev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/drivers/pci/physdev.c b/xen/drivers/pci/physdev.c
index 0161a85e1e..78de67ec64 100644
--- a/xen/drivers/pci/physdev.c
+++ b/xen/drivers/pci/physdev.c
@@ -74,6 +74,9 @@ ret_t pci_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) 
arg)
         struct pci_dev *pdev;
         pci_sbdf_t sbdf;
 
+        if ( !is_pci_passthrough_enabled() )
+            return -EOPNOTSUPP;
+
         ret = -EFAULT;
         if ( copy_from_guest(&dev_reset, arg, 1) != 0 )
             break;
-- 
2.34.1

Reply via email to