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

Re: [PATCH v2 2/2] xen/arm: smmuv3: fix xl pci-assignable-remove



On Fri, Jul 25, 2025 at 01:45:51PM -0400, Stewart Hildebrand wrote:
> 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>

Reviewed-by: Denis Mukhin <dmukhin@xxxxxxxx> 

> ---
> v1->v2:
> * use %pd in print format
> * add Bertrand's A-b
> ---
>  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 db08d3c04269..5e9e3e048e34 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);
> --
> 2.50.1
> 
> 




 


Rackspace

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