Skip to contentSkip to conversation

x86/svm: Remove the pdpe fields from struct vmcb

PATCH In review Andrew Cooper 2 participants 2 messages Oct 17, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/svm: Remove the pdpe fields from struct vmcb

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:

Quoted 5 lines
user:        [email protected]
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.

---
CC: Boris Ostrovsky <[email protected]>
CC: Suravee Suthikulpanit <[email protected]>
CC: Brian Woods <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>

---
 xen/arch/x86/hvm/svm/nestedsvm.c   | 12 ------------
 xen/include/asm-x86/hvm/svm/vmcb.h |  7 ++-----
 2 files changed, 2 insertions(+), 17 deletions(-)
xen/arch/x86/hvm/svm/nestedsvm.c +0 -12
index 3f4f403..78a1016 100644
@@ -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;
 
xen/include/asm-x86/hvm/svm/vmcb.h +2 -5
index 3a514f8..48aed78 100644
@@ -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 {
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Andrew Cooper

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:

Quoted 5 lines
user:        [email protected]
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.

Quoted 5 lines

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.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel