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

[Xen-changelog] [xen-unstable] SVM: Plumb NPT error-code bits into nested-fault access_X arguments.



# HG changeset patch
# User Tim Deegan <tim@xxxxxxx>
# Date 1327423577 0
# Node ID a2a8089b1ffbf5757ca3191cb8f74a5f1ed7fed1
# Parent  4cd3560aec0bf8975905b1633392cdd97db195bb
SVM: Plumb NPT error-code bits into nested-fault access_X arguments.

Signed-off-by: Tim Deegan <tim@xxxxxxx>
---


diff -r 4cd3560aec0b -r a2a8089b1ffb xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Tue Jan 24 15:36:19 2012 +0000
+++ b/xen/arch/x86/hvm/hvm.c    Tue Jan 24 16:46:17 2012 +0000
@@ -1185,7 +1185,6 @@
 int hvm_hap_nested_page_fault(unsigned long gpa,
                               bool_t gla_valid,
                               unsigned long gla,
-                              bool_t access_valid,
                               bool_t access_r,
                               bool_t access_w,
                               bool_t access_x)
@@ -1234,7 +1233,7 @@
     mfn = get_gfn_type_access(p2m, gfn, &p2mt, &p2ma, p2m_guest, NULL);
 
     /* Check access permissions first, then handle faults */
-    if ( access_valid && (mfn_x(mfn) != INVALID_MFN) )
+    if ( mfn_x(mfn) != INVALID_MFN )
     {
         int violation = 0;
         /* If the access is against the permissions, then send to mem_event */
diff -r 4cd3560aec0b -r a2a8089b1ffb xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Tue Jan 24 15:36:19 2012 +0000
+++ b/xen/arch/x86/hvm/svm/svm.c        Tue Jan 24 16:46:17 2012 +0000
@@ -1143,7 +1143,7 @@
 }
 
 static void svm_do_nested_pgfault(struct vcpu *v,
-    struct cpu_user_regs *regs, paddr_t gpa)
+    struct cpu_user_regs *regs, uint32_t npfec, paddr_t gpa)
 {
     int ret;
     unsigned long gfn = gpa >> PAGE_SHIFT;
@@ -1152,7 +1152,10 @@
     p2m_access_t p2ma;
     struct p2m_domain *p2m = NULL;
 
-    ret = hvm_hap_nested_page_fault(gpa, 0, ~0ul, 0, 0, 0, 0);
+    ret = hvm_hap_nested_page_fault(gpa, 0, ~0ul, 
+                                    1, /* All NPFs count as reads */
+                                    npfec & PFEC_write_access, 
+                                    npfec & PFEC_insn_fetch);
 
     if ( tb_init_done )
     {
@@ -1181,7 +1184,7 @@
     case -1:
         ASSERT(nestedhvm_enabled(v->domain) && nestedhvm_vcpu_in_guestmode(v));
         /* inject #VMEXIT(NPF) into guest. */
-        nestedsvm_vmexit_defer(v, VMEXIT_NPF, regs->error_code, gpa);
+        nestedsvm_vmexit_defer(v, VMEXIT_NPF, npfec, gpa);
         return;
     }
 
@@ -2198,10 +2201,9 @@
 
     case VMEXIT_NPF:
         perfc_incra(svmexits, VMEXIT_NPF_PERFC);
-        regs->error_code = vmcb->exitinfo1;
         if ( cpu_has_svm_decode )
             v->arch.hvm_svm.cached_insn_len = vmcb->guest_ins_len & 0xf;
-        svm_do_nested_pgfault(v, regs, vmcb->exitinfo2);
+        svm_do_nested_pgfault(v, regs, vmcb->exitinfo1, vmcb->exitinfo2);
         v->arch.hvm_svm.cached_insn_len = 0;
         break;
 
diff -r 4cd3560aec0b -r a2a8089b1ffb xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Tue Jan 24 15:36:19 2012 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Tue Jan 24 16:46:17 2012 +0000
@@ -2106,7 +2106,6 @@
                                    qualification & EPT_GLA_VALID       ? 1 : 0,
                                    qualification & EPT_GLA_VALID
                                      ? __vmread(GUEST_LINEAR_ADDRESS) : ~0ull,
-                                   1, /* access types are as follows */
                                    qualification & EPT_READ_VIOLATION  ? 1 : 0,
                                    qualification & EPT_WRITE_VIOLATION ? 1 : 0,
                                    qualification & EPT_EXEC_VIOLATION  ? 1 : 
0) )
diff -r 4cd3560aec0b -r a2a8089b1ffb xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h     Tue Jan 24 15:36:19 2012 +0000
+++ b/xen/include/asm-x86/hvm/hvm.h     Tue Jan 24 16:46:17 2012 +0000
@@ -409,7 +409,6 @@
 
 int hvm_hap_nested_page_fault(unsigned long gpa,
                               bool_t gla_valid, unsigned long gla,
-                              bool_t access_valid, 
                               bool_t access_r,
                               bool_t access_w,
                               bool_t access_x);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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