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

[PATCH 2/3] VT-d: use DMA_TLB_IVA_ADDR()


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 9 Dec 2021 16:53:17 +0100
  • 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=X1JkCI513jhv/rTO/fuBWeH3kMDCynbS33Cs/DQtrM8=; b=Ip81rRYkgEQNytOYoSTWbR9k+baOfpAT4TFahxt6OgUguOwmdWwfMMTs8ImRxl7iSlT5ddOPP4wctnC25WPuIEYoTbq3nctw5V64PGZ60lO35ErKZZ/cCLpnzs/0ztO9oFcGAHLIDaWYYw4oUtJvXNmXe7OcYKh/HD3kaJS7UnWX+YtZG8QX33Uh+hYakRyrMsJDiGaGfO+EAEfyJZyVnzVLzzp7xfKGfQt+FjSeXrZcI4dS/0SslAxNAN3oAJ2Tf6fB2m9+wAo7wD0OWHs2qcTNkf1dvD/e48NGwtxBr9Vw1a52ts4pq+HFoubcR2BeKHcXCmKa+F5P6mhwNH6B+w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YWZzrmcNsalZKJXAQYMPwSCJZ5CiYj6OPnXG7BJNZrEnMQI6jDUlk8Qb2sGdMPEyNUagJ31HBORHFpwhmSA8jCl2AhApULIWUSkxTckkAnM08uqRIeK4GmKnNi8Eos0hC/IURNDBt8aAKsply2xqMCYqwesSMIZATNkl1S7ExaqyuHe/UvMJz8NNu+bZewOcSeHY0hsbzZps7vrCVTMcz7q9P5/K1p9wtANXxeUDjmI1ZW3Wz/vKzy3/nySQByCxURbms4lfiN7sppe3yh2yu5wCD6KaK0iSH2kT8QBD+98kqxY2I0jN7dhXg6EEwOtG3dpsvgyhgvHukrulxaX91g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Kevin Tian <kevin.tian@xxxxxxxxx>
  • Delivery-date: Thu, 09 Dec 2021 15:53:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Let's use the macro in the one place it's supposed to be used, and in
favor of then unnecessary manipulations of the address in
iommu_flush_iotlb_psi(): All leaf functions then already deal correctly
with the supplied address.

There also has never been a need to require (i.e. assert for) the
passing in of 4k-aligned addresses - it'll always be the order-sized
range containing the address which gets flushed.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -546,7 +546,8 @@ int vtd_flush_iotlb_reg(struct vtd_iommu
     if ( type == DMA_TLB_PSI_FLUSH )
     {
         /* Note: always flush non-leaf currently. */
-        dmar_writeq(iommu->reg, tlb_offset, size_order | addr);
+        dmar_writeq(iommu->reg, tlb_offset,
+                    size_order | DMA_TLB_IVA_ADDR(addr));
     }
     dmar_writeq(iommu->reg, tlb_offset + 8, val);
 
@@ -606,8 +607,6 @@ static int __must_check iommu_flush_iotl
 {
     int status;
 
-    ASSERT(!(addr & (~PAGE_MASK_4K)));
-
     /* Fallback to domain selective flush if no PSI support */
     if ( !cap_pgsel_inv(iommu->cap) )
         return iommu_flush_iotlb_dsi(iommu, did, flush_non_present_entry,
@@ -618,9 +617,6 @@ static int __must_check iommu_flush_iotl
         return iommu_flush_iotlb_dsi(iommu, did, flush_non_present_entry,
                                      flush_dev_iotlb);
 
-    addr >>= PAGE_SHIFT_4K + order;
-    addr <<= PAGE_SHIFT_4K + order;
-
     /* apply platform specific errata workarounds */
     vtd_ops_preamble_quirk(iommu);
 




 


Rackspace

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