aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Deegan <tim@xen.org>2012-01-24 16:46:17 +0000
committerTim Deegan <tim@xen.org>2012-01-24 16:46:17 +0000
commite0ef8791f11f3e97548efae1ecfb3c2bad9a115b (patch)
tree2595c670561f03bb16aca63ce52aefc646db3499
parent92e33c0719d4dd063f308f8dcdb8f9eb31580124 (diff)
downloadxen-e0ef8791f11f3e97548efae1ecfb3c2bad9a115b.tar.gz
xen-e0ef8791f11f3e97548efae1ecfb3c2bad9a115b.tar.bz2
xen-e0ef8791f11f3e97548efae1ecfb3c2bad9a115b.zip
SVM: Plumb NPT error-code bits into nested-fault access_X arguments.
Signed-off-by: Tim Deegan <tim@xen.org>
-rw-r--r--xen/arch/x86/hvm/hvm.c3
-rw-r--r--xen/arch/x86/hvm/svm/svm.c12
-rw-r--r--xen/arch/x86/hvm/vmx/vmx.c1
-rw-r--r--xen/include/asm-x86/hvm/hvm.h1
4 files changed, 8 insertions, 9 deletions
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index b163ed0f01..8847b499ec 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1185,7 +1185,6 @@ void hvm_inject_exception(unsigned int trapnr, int errcode, unsigned long cr2)
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 @@ int hvm_hap_nested_page_fault(unsigned long gpa,
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 --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index e4b41c4470..b5a5933f46 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1143,7 +1143,7 @@ struct hvm_function_table * __init start_svm(void)
}
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 @@ static void svm_do_nested_pgfault(struct vcpu *v,
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 @@ static void svm_do_nested_pgfault(struct vcpu *v,
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 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
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 --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 81e8b82ca5..d2bb64a6f2 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2106,7 +2106,6 @@ static void ept_handle_violation(unsigned long qualification, paddr_t gpa)
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 --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
index 826cb3302c..1a113f2bf9 100644
--- a/xen/include/asm-x86/hvm/hvm.h
+++ b/xen/include/asm-x86/hvm/hvm.h
@@ -409,7 +409,6 @@ int hvm_debug_op(struct vcpu *v, int32_t op);
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);