x86/svm: Remove the pdpe fields from struct vmcb
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 5 Oct 2018 17:02:15 +0000 (17:02 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 17 Oct 2018 16:50:14 +0000 (17:50 +0100)
These fields have existed since the SVM code was first introduced.

The earliest reference I can find is c/s d1bd157fbc9 which is unforunately a
rebase & squash of a separate dev tree.  Looking a the commit message, I'm
guessing it was introduced by:

  > user:        twoller@xen-trw1.site
  > date:        Tue Dec 13 19:49:53 2005 -0500
  > files:       ... xen/include/asm-x86/svm_vmcb.h ...
  > description:
  > Add SVM base files to repository.

Anyway, the AMD SDM has no mention of PDPE fields in the VMCB and marks this
part of the VMCB as reserved.  The manual does explicitly say that 32bit PAE
paging may read the PDPE fields from memory rather from the CPU registers.

Chances are very good that this is a vestigial remnent of an early design.
Xen doesn't use the fields at all, except to copy them on virtual
vmentry/vmexit.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
xen/arch/x86/hvm/svm/nestedsvm.c
xen/include/asm-x86/hvm/svm/vmcb.h

index 3f4f40390157a6b1ae20363ba870d89e905ddfe8..78a1016e947018f7b63e548d2d4cef15e5732a9b 100644 (file)
@@ -636,12 +636,6 @@ static int nsvm_vmcb_prepare4vmrun(struct vcpu *v, struct cpu_user_regs *regs)
      * sysenter_eip. These are handled via VMSAVE/VMLOAD emulation.
      */
 
-    /* Page tables */
-    n2vmcb->pdpe0 = ns_vmcb->pdpe0;
-    n2vmcb->pdpe1 = ns_vmcb->pdpe1;
-    n2vmcb->pdpe2 = ns_vmcb->pdpe2;
-    n2vmcb->pdpe3 = ns_vmcb->pdpe3;
-
     /* PAT */
     if (!vcleanbit_set(np)) {
         n2vmcb->_g_pat = ns_vmcb->_g_pat;
@@ -1177,12 +1171,6 @@ nsvm_vmcb_prepare4vmexit(struct vcpu *v, struct cpu_user_regs *regs)
     /* CR2 */
     ns_vmcb->_cr2 = n2vmcb->_cr2;
 
-    /* Page tables */
-    ns_vmcb->pdpe0 = n2vmcb->pdpe0;
-    ns_vmcb->pdpe1 = n2vmcb->pdpe1;
-    ns_vmcb->pdpe2 = n2vmcb->pdpe2;
-    ns_vmcb->pdpe3 = n2vmcb->pdpe3;
-
     /* PAT */
     ns_vmcb->_g_pat = n2vmcb->_g_pat;
 
index 3a514f8de217e8668c179753c940326a1df7b7fd..48aed78292dbb6a651e60f8e8cc4165a63e232b4 100644 (file)
@@ -479,17 +479,14 @@ struct vmcb_struct {
     u64 sysenter_esp;
     u64 sysenter_eip;
     u64 _cr2;                   /* cleanbit 9 */
-    u64 pdpe0;
-    u64 pdpe1;
-    u64 pdpe2;
-    u64 pdpe3;
+    u64 res16[4];
     u64 _g_pat;                 /* cleanbit 4 */
     u64 _debugctlmsr;           /* cleanbit 10 */
     u64 _lastbranchfromip;      /* cleanbit 10 */
     u64 _lastbranchtoip;        /* cleanbit 10 */
     u64 _lastintfromip;         /* cleanbit 10 */
     u64 _lastinttoip;           /* cleanbit 10 */
-    u64 res16[301];
+    u64 res17[301];
 };
 
 struct svm_domain {