> On 24 Jul 2025, at 03:00, dm...@proton.me wrote:
>
> On Wed, Jul 23, 2025 at 06:54:20PM -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.hildebr...@amd.com>
>> ---
>> 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..9312bb3c72d8 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 domain %d\n", d->domain_id);
>
> Use %pd?
>
> dev_err(dev, " not attached to %pd\n", d);
Agree.
With this fixed:
Acked-by: Bertrand Marquis <bertrand.marq...@arm.com>
Cheers
Bertrand
>
>> + return -ESRCH;
>> + }
>> +
>> spin_lock(&xen_domain->lock);
>>
>> arm_smmu_detach_dev(master);
>> --
>> 2.50.1
>>
>>
>