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

[xen master] xen/arm: smmuv3: fix xl pci-assignable-remove



commit f96dfde845ee3d5ecec91497291c11c8b3e054b6
Author:     Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
AuthorDate: Fri Jul 25 13:45:51 2025 -0400
Commit:     Stefano Stabellini <stefano.stabellini@xxxxxxx>
CommitDate: Fri Jul 25 13:15:48 2025 -0700

    xen/arm: smmuv3: fix xl pci-assignable-remove
    
    When attempting to xl pci-assignable-remove a PCI device, we encounter:
    
    $ xl pci-assignable-remove 00:01.0
    (XEN) SMMUv3: <no-node>:  not attached to domain 32753
    (XEN) d[IO]: deassign (0000:00:01.0) failed (-3)
    libxl: error: libxl_pci.c:910:libxl__device_pci_assignable_remove: failed 
to de-quarantine 0000:00:01.0
    
    When a PCI device is being deassigned from domIO,
    arm_smmu_deassign_dev() should return before checking the smmu domain.
    
    Fixes: 63919fc4d1ca ("xen/arm: smmuv3: Add PCI devices support for SMMUv3")
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
    Acked-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
---
 xen/drivers/passthrough/arm/smmu-v3.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu-v3.c 
b/xen/drivers/passthrough/arm/smmu-v3.c
index db08d3c042..5e9e3e048e 100644
--- a/xen/drivers/passthrough/arm/smmu-v3.c
+++ b/xen/drivers/passthrough/arm/smmu-v3.c
@@ -2747,11 +2747,6 @@ static int arm_smmu_deassign_dev(struct domain *d, 
uint8_t devfn, struct device
        struct arm_smmu_domain *smmu_domain = to_smmu_domain(io_domain);
        struct arm_smmu_master *master = dev_iommu_priv_get(dev);
 
-       if (!smmu_domain || smmu_domain->d != d) {
-               dev_err(dev, " not attached to domain %d\n", d->domain_id);
-               return -ESRCH;
-       }
-
 #ifdef CONFIG_HAS_PCI
        if ( dev_is_pci(dev) )
        {
@@ -2767,6 +2762,11 @@ static int arm_smmu_deassign_dev(struct domain *d, 
uint8_t devfn, struct device
        }
 #endif
 
+       if (!smmu_domain || smmu_domain->d != d) {
+               dev_err(dev, " not attached to %pd\n", d);
+               return -ESRCH;
+       }
+
        spin_lock(&xen_domain->lock);
 
        arm_smmu_detach_dev(master);
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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