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

[PATCH v3 11/23] AMD/IOMMU: drop stray TLB flush


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 10 Jan 2022 17:29:59 +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=JdTgtNdqoNeidLKu50UftFdDVt7PjdHN4/4c5+JQ4Cs=; b=C5b07U+O78UwGB5BZi4E2GPyT61QcORmcPpRPWfnGQS43EGgqJgvUt1sMhA2lAFn+fTrV0qf3oTzaPeIHcpE8/h9rm0fpYXLtA5m/9wteYRu884+P3peTLEdHPgHKJh0JOkvclQCM2QrWxG7qVIiq1+iaopQ6ibdvAKDKRCK21y6l5NVmqDKwHZumJwLxeZ36sdtqLQIlJePbIqhPTBiPTADMnpJnYS0PWbCmEImbICQQ1b8TOi7UJCCV/nGR7NkNMwfiles3yQHcd56iNtEGv0w3WEDLM2/4CfruORtFy79lXd9ntfjN5mqQnkSZkMcpD36QkQZdK5aCkhzTWjk/A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aokyAHPeiwfIMOhfIhtAYHfjmpm8eNFjb2hnIY87KEjJPn63TAvPoSfNe4WgEP8EusDTGROVcKtSUl5jI2oLA2SUndArmX6AObBH2k+YN7AFFnmR1VNrkbIET0FkwECEsEr/eT133NmsG8Q6+Kw6aBdoPccr/E7B9+H0wWhXLflBFRJyUSFGIjgoOp2q0COl2VuEvnr6pG7qiXqIzXb2WfJ/gcq1BRrly7k2DWIZ0wS5B4isRGuBb6T8uWB7oiff3AprXjDvOXFftY1di/d36p5UKcN4erdHyzlmiw3STHdlAy3h4+g0vEM2YLncXsSofIhGKV86XVRhNq4gcBIE7A==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 10 Jan 2022 16:30:12 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

I think this flush was overlooked when flushing was moved out of the
core (un)mapping functions. The flush the caller is required to invoke
anyway will satisfy the needs resulting from the splitting of a
superpage.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

--- a/xen/drivers/passthrough/amd/iommu_map.c
+++ b/xen/drivers/passthrough/amd/iommu_map.c
@@ -179,7 +179,7 @@ void __init iommu_dte_add_device_entry(s
  */
 static int iommu_pde_from_dfn(struct domain *d, unsigned long dfn,
                               unsigned int target, unsigned long *pt_mfn,
-                              bool map)
+                              unsigned int *flush_flags, bool map)
 {
     union amd_iommu_pte *pde, *next_table_vaddr;
     unsigned long  next_table_mfn;
@@ -240,7 +240,7 @@ static int iommu_pde_from_dfn(struct dom
             set_iommu_pde_present(pde, next_table_mfn, next_level, true,
                                   true);
 
-            amd_iommu_flush_all_pages(d);
+            *flush_flags |= IOMMU_FLUSHF_modified;
         }
 
         /* Install lower level page table for non-present entries */
@@ -312,7 +312,8 @@ int amd_iommu_map_page(struct domain *d,
         return rc;
     }
 
-    if ( iommu_pde_from_dfn(d, dfn_x(dfn), 1, &pt_mfn, true) || !pt_mfn )
+    if ( iommu_pde_from_dfn(d, dfn_x(dfn), 1, &pt_mfn, flush_flags, true) ||
+         !pt_mfn )
     {
         spin_unlock(&hd->arch.mapping_lock);
         AMD_IOMMU_ERROR("invalid IO pagetable entry dfn = %"PRI_dfn"\n",
@@ -345,7 +346,7 @@ int amd_iommu_unmap_page(struct domain *
         return 0;
     }
 
-    if ( iommu_pde_from_dfn(d, dfn_x(dfn), 1, &pt_mfn, false) )
+    if ( iommu_pde_from_dfn(d, dfn_x(dfn), 1, &pt_mfn, flush_flags, false) )
     {
         spin_unlock(&hd->arch.mapping_lock);
         AMD_IOMMU_ERROR("invalid IO pagetable entry dfn = %"PRI_dfn"\n",




 


Rackspace

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