diff mbox

[v3,1/2] x86/mm: Add information about faulted page's presence to npfec structure

Message ID 1450467596-3649-2-git-send-email-boris.ostrovsky@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Boris Ostrovsky Dec. 18, 2015, 7:39 p.m. UTC
This is provided explicitly in SVM and implicitly in VMX (when neither of
the three EPT_EFFECTIVE_* bits is set).

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Cc: kevin.tian@intel.com
Cc: jun.nakajima@intel.com
Cc: suravee.suthikulpanit@amd.com
Cc: Aravind.Gopalakrishnan@amd.com
---
 xen/arch/x86/hvm/svm/svm.c |    3 ++-
 xen/arch/x86/hvm/vmx/vmx.c |    5 ++++-
 xen/include/xen/mm.h       |    1 +
 3 files changed, 7 insertions(+), 2 deletions(-)

Comments

Tian, Kevin Dec. 20, 2015, 6:59 a.m. UTC | #1
> From: Boris Ostrovsky [mailto:boris.ostrovsky@oracle.com]
> Sent: Saturday, December 19, 2015 3:40 AM
> 
> This is provided explicitly in SVM and implicitly in VMX (when neither of
> the three EPT_EFFECTIVE_* bits is set).
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> Cc: kevin.tian@intel.com
> Cc: jun.nakajima@intel.com
> Cc: suravee.suthikulpanit@amd.com
> Cc: Aravind.Gopalakrishnan@amd.com

well, another ack here:

Acked-by: Kevin Tian <kevin.tian@intel.com>
diff mbox

Patch

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 0078100..a66d854 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1491,7 +1491,8 @@  static void svm_do_nested_pgfault(struct vcpu *v,
     struct npfec npfec = {
         .read_access = !(pfec & PFEC_insn_fetch),
         .write_access = !!(pfec & PFEC_write_access),
-        .insn_fetch = !!(pfec & PFEC_insn_fetch)
+        .insn_fetch = !!(pfec & PFEC_insn_fetch),
+        .present = !!(pfec & PFEC_page_present),
     };
 
     /* These bits are mutually exclusive */
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 2922673..7ea1882 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2746,7 +2746,10 @@  static void ept_handle_violation(unsigned long qualification, paddr_t gpa)
         .read_access = !!(qualification & EPT_READ_VIOLATION) ||
                        !!(qualification & EPT_WRITE_VIOLATION),
         .write_access = !!(qualification & EPT_WRITE_VIOLATION),
-        .insn_fetch = !!(qualification & EPT_EXEC_VIOLATION)
+        .insn_fetch = !!(qualification & EPT_EXEC_VIOLATION),
+        .present = !!(qualification & (EPT_EFFECTIVE_READ |
+                                       EPT_EFFECTIVE_WRITE |
+                                       EPT_EFFECTIVE_EXEC))
     };
 
     if ( tb_init_done )
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index 5d4b64b..a795dd6 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -159,6 +159,7 @@  struct npfec {
     unsigned int read_access:1;
     unsigned int write_access:1;
     unsigned int insn_fetch:1;
+    unsigned int present:1;
     unsigned int gla_valid:1;
     unsigned int kind:2;  /* npfec_kind_t */
 };