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

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


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Wed, 23 Jul 2025 18:54:20 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=W9kVo6Nr8Q1c3+SpiVu3s5bLNVXzy+8rSmwpY5RA3Y0=; b=MEuz7gkcfGuL+86RRiLXSu5Veff/ZI+rlVWPVFQCATu7lKvmG0Ef0lvT8ty6oje06eWEK/cue5OJmBL7d5N3KJtDVIqL6dlg3AETqzWY76LjDPQTilKVTpVR6iGqrrDPhxzG22f+x+Zt5WXCGxHGrS9IZqrKdN6GMHlkCBRHVykRSsPzUadFt0+3jZuDVT013+ELfroPHRjCwbF79AzNNc3x4I9IIyK1GDFeHzywHgrn4awHw3lQ09L+8Bbk6CaIbFbcH6VDkpzmGlQwHBY7pqmis5e6cGeljBuJxUtHTNZp+mLF4fRvWGjiUYvAFm803AxjwDi6XJ6e6Gopt06uTA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bOZ2Smh8zSzVUzps4P8+5Z/6zZmffWqYvextwjsTtul/YVoSmNYZuqtZDq+I9XUy23UTVL8fC1WZBGSX7Yo4h7SHcTWodYOQNTqqOxHj8Xy8KPH4H2LtjAW8fGzoHtIGX5av0PmKwaptAVluupUMcLJfv+GcrMQrPLvOQI4HVi2htsEtKdl4OKueqtVZg3FcaFBVSfirWyi4fkP9tKyUiASCmbq+OuiSHgU0CNW8frZigiutUh2i4uF7A35b5Q8fNAAyaivJKUIpRafsUrtt3owheaswoHtN351ABUqBIn7kOjWJ7mQliKOrOk00t/PixF3Ps9Ok6yim5CsdzJo+6w==
  • Cc: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, "Michal Orzel" <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Wed, 23 Jul 2025 22:54:52 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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>
---
 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);
+               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®.