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

[PATCH v2 0.9/2] VT-d: don't needlessly look up DID


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 7 Apr 2022 11:27:53 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=0IrZylJTpCAzfeSRjCQ3TVLzNp2tEk2Z4BxiHpu3jec=; b=bBg+IaoNUordQHDzpuCZ9riviFxnSczYx4wJPC4devL+OXB/v2jBoyYGJyeOHbDdA1Dn/l8gnrpVPMoACkqYXtqMbNzjbBx/NxdVN8x2ZqmT893MeAhJlENMEWQ/64UPENJhNRIQaIR0EW908kBXxjPaSim36xcoC0LZXTxzSx1iY1Rif2Z7LTyzduHYlV3skBryfJ6kXU/Jt+QZmbTN9ISXdmn6cJVhr0OqCVI4y9eZitz3i7xzzuuSbaSByAGm4eYa6YO/evteocIhDjB78VBm+6lfLW60kfC2ThSAg0ABHwxy3PoGDUlLlnFBQhizbzI3qy3WhUOaIn9Oh0tEVw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cKk6qagDZQFV3w5j38n2fD5jpJ1jicuw/eIZoPniNXGyTlIHc9RaTXRmpGmJ8rV6d8uJ5xhKEyzpXxyYG3qhZAFHchJ/41KW9uVIMiVu+sGUixXTcDYIJB70gmkY6Mrwbb0+mStvhQFfu5a/aEvKRCvzV4OvmrztVLXkqBqN02jByZi6kb8Ph7WWfM1N77fGl08zd/DX62+86IFg325Dao0zBVTFdkaCczWZTZuCxRlbScSN9gzllNCSkS/lZl7uIv5TiK8Oxh5/XlNjclJwcV+Uhx+dZ+EpdKV5mQGXjaOgh3g+48UP6XZS5iPMyCGdi4nKxi2pJ+KDTFIVYMlFGA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>
  • Delivery-date: Thu, 07 Apr 2022 09:28:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

If get_iommu_domid() in domain_context_unmap_one() fails, we better
wouldn't clear the context entry in the first place, as we're then unable
to issue the corresponding flush. However, we have no need to look up the
DID in the first place: What needs flushing is very specifically the DID
that was in the context entry before our clearing of it.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
This (an intended follow-up to XSA-399) is actually a prereq to what was
called patch 1 so far in this series.

--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1830,18 +1830,12 @@ int domain_context_unmap_one(
         return 0;
     }
 
+    iommu_domid = context_domain_id(*context);
+
     context_clear_present(*context);
     context_clear_entry(*context);
     iommu_sync_cache(context, sizeof(struct context_entry));
 
-    iommu_domid = get_iommu_did(domid, iommu, !domain->is_dying);
-    if ( iommu_domid == -1 )
-    {
-        spin_unlock(&iommu->lock);
-        unmap_vtd_domain_page(context_entries);
-        return -EINVAL;
-    }
-
     rc = iommu_flush_context_device(iommu, iommu_domid,
                                     PCI_BDF2(bus, devfn),
                                     DMA_CCMD_MASK_NOBIT, 0);




 


Rackspace

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