[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] physdev: add pci-passthrough-enabled check to pci_device_reset



commit b9508e7033f0523aa5cf2ebec392a2d25fe83546
Author:     Mykyta Poturai <Mykyta_Poturai@xxxxxxxx>
AuthorDate: Thu Jul 24 09:44:36 2025 +0000
Commit:     Stefano Stabellini <stefano.stabellini@xxxxxxx>
CommitDate: Fri Jul 25 13:14:04 2025 -0700

    physdev: add pci-passthrough-enabled check to pci_device_reset
    
    On Arm 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.
    This change should not affect x86 behavior as pci-passthrough is always
    enabled there.
    
    Signed-off-by: Mykyta Poturai <mykyta_poturai@xxxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 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;
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.