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

[PATCH RESEND 2/3][4.16?] VT-d: fix reduced page table levels support when sharing tables


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 12 Nov 2021 11:33:00 +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=2mVtm/325NPUuJOVXLoRutJprxAS49bRE2xj1DfbF2s=; b=hMr8PRMmJQsTpVdSRHW3oft5qexEVAMZ0uAceIYhobFKl4HSLiVg76NyksEgQHaLSLQHp+9Mdb8GLuZNfU4Z/ThPh9wardpT9uiyqS0DWyWBQDE2LsrddOa86BRn8qw8W/n/bxlCsjkl6ji0BbI+VFIqkw/YYy6/C/VHRirXdBJrvU/VN8uRS90Urov4mSSxzF9Y6s/Jriys7wzD33uInyn2vR9WWhDn0sg1ua07RQ5KDyOXmll4lfgdccxOi7Ep28ZYMOlCPacJwDojxKDl09zdtXphkYmWNnfWZGSNOqjSOcZIqAL/R2opfniC0ml0o62TpWvzf298Ai3ns5+GoA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GXI0I8M7ngmll7AS23W4oITOUUaGeJc7u8KuVJ9ku/7VN6+VrL4zKz+FzOf3UCswmZgyHQQhQKSPzW6zFo3ljFeBv9ttI5NLwgyS3FXAiu4ZNaAS45BGH6Md18mtSB9w4nnYay9ZjmMpsjAnUphtgC07u00Y1MABkhKvLdYDjKarhYvBgcu1myLXrYt7gL1N0VsG809OlY5QRUt/X8QmgyNcB5FFZ4ITB2xz5f3IAhj477H1M1KMS/+UGp+uBHqzrjF68S64fmVsGODG2mMYdo+JPjCGLO4asckbUW+hnKA1fKyJoGo+W5udBVcVvwbx6weGaPC4V4UqANXJ+DhCSw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Kevin Tian <kevin.tian@xxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>
  • Delivery-date: Fri, 12 Nov 2021 10:33:17 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

domain_pgd_maddr() contains logic to adjust the root address to be put
in the context entry in case 4-level page tables aren't supported by an
IOMMU. This logic may not be bypassed when sharing page tables.

Fixes: 25ccd093425c ("iommu: remove the share_p2m operation")
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>

--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -340,19 +340,21 @@ static uint64_t domain_pgd_maddr(struct
     {
         pagetable_t pgt = p2m_get_pagetable(p2m_get_hostp2m(d));
 
-        return pagetable_get_paddr(pgt);
+        pgd_maddr = pagetable_get_paddr(pgt);
     }
-
-    if ( !hd->arch.vtd.pgd_maddr )
+    else
     {
-        /* Ensure we have pagetables allocated down to leaf PTE. */
-        addr_to_dma_page_maddr(d, 0, 1);
-
         if ( !hd->arch.vtd.pgd_maddr )
-            return 0;
-    }
+        {
+            /* Ensure we have pagetables allocated down to leaf PTE. */
+            addr_to_dma_page_maddr(d, 0, 1);
 
-    pgd_maddr = hd->arch.vtd.pgd_maddr;
+            if ( !hd->arch.vtd.pgd_maddr )
+                return 0;
+        }
+
+        pgd_maddr = hd->arch.vtd.pgd_maddr;
+    }
 
     /* Skip top levels of page tables for 2- and 3-level DRHDs. */
     for ( agaw = level_to_agaw(4);




 


Rackspace

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