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

[PATCH 10/17] AMD/IOMMU: drop stray TLB flush


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 24 Aug 2021 16:22:51 +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-SenderADCheck; bh=YHr+CH5Pz0j1yX5jp8hrrxKCetSkHo6HQeq3jEu7QTM=; b=A2FVjf8y3TsRzNCJ/+hY+xGT0WisI2hYPcZolfX2inUkFDTiKcCmynYcte9pFKL9awGWS4K+VByyU7Dl42e6d2fxpxc3U7Oey6fCKxW+KfI/84XFtXhp+SffNa/Xa0gCnSoJEVpE9Gsqy+ykDy/dpYhRoxmNIxcy/RoX/P5MM3UlvYSOR7ShpcihYZ6MNVdpKJ8RRCiMgzyRWwt4E3cAED/udwJgdaE3oDlxEnsU0QU6Irf2Xjy10+JG2BBGKBdPsUufy12gq2kuebes99ouwHLlUrruAxyMz2JBlOotpj3vYvt15hjDXHfAe6dZwNHAaiW1fRF1xy+Ij2QyUcFRIw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OQF2sDF2mtee0at7lvVtM6YUPkLPfpdLAJWjd1Jj2oV/AT4KNz+ld9crXPk8GuaCZhnslGkHKZTSt9wImDRsxEro/e+cHVPKEETyAftdjLU26wNqOJH2ARqJvSmtWk2uac3YY3A18TmxnWa2WVODUYtt2mmfev3iIdSjNmDwWAXhs9i++Ci1m8iMryJcHxuq6AWfkmoCj968jcT9HiAevd+FCh3AZXB4eyEB087/N9qXpSoGO+dw4PJpUfbRAmmPL0oDWhU/4KPsj6hqKtyFqvuj7OuthRWYu70s5OuHEt8Z0hQlsLBGgjyk3OFvpApmQPS4g4VVjpDielZvLsHW4Q==
  • Authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>
  • Delivery-date: Tue, 24 Aug 2021 14:22:59 +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>

--- 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;
@@ -237,7 +237,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 */
@@ -309,7 +309,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_DEBUG("Invalid IO pagetable entry dfn = %"PRI_dfn"\n",
@@ -342,7 +343,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_DEBUG("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®.