aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Egger <Christoph.Egger@amd.com>2012-07-19 11:15:58 +0100
committerChristoph Egger <Christoph.Egger@amd.com>2012-07-19 11:15:58 +0100
commit9796e9bf1ae37ba3a55a56e2548ed969e1097996 (patch)
treee37ff7b31ab10b8d15bc5e325f9c2c0f3bd84e43
parentf114c47cceebbf8546c7dd1303433f062c82d31b (diff)
downloadxen-9796e9bf1ae37ba3a55a56e2548ed969e1097996.tar.gz
xen-9796e9bf1ae37ba3a55a56e2548ed969e1097996.tar.bz2
xen-9796e9bf1ae37ba3a55a56e2548ed969e1097996.zip
nestedhvm: initialize pfec for l1 pagetable walk
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Acked-by: Tim Deegan <tim@xen.org> Committed-by: Tim Deegan <tim@xen.org>
-rw-r--r--xen/arch/x86/hvm/hvm.c3
-rw-r--r--xen/arch/x86/mm/hap/nested_hap.c15
-rw-r--r--xen/include/asm-x86/hvm/nestedhvm.h3
3 files changed, 16 insertions, 5 deletions
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 7e6b5bbbb5..22c136b9d9 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1278,7 +1278,8 @@ int hvm_hap_nested_page_fault(unsigned long gpa,
* into l1 guest if not fixable. The algorithm is
* the same as for shadow paging.
*/
- rv = nestedhvm_hap_nested_page_fault(v, gpa);
+ rv = nestedhvm_hap_nested_page_fault(v, gpa,
+ access_r, access_w, access_x);
switch (rv) {
case NESTEDHVM_PAGEFAULT_DONE:
return 1;
diff --git a/xen/arch/x86/mm/hap/nested_hap.c b/xen/arch/x86/mm/hap/nested_hap.c
index c49ec5335d..53963e098f 100644
--- a/xen/arch/x86/mm/hap/nested_hap.c
+++ b/xen/arch/x86/mm/hap/nested_hap.c
@@ -177,13 +177,20 @@ out:
*/
static int
nestedhap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa,
- unsigned int *page_order)
+ unsigned int *page_order,
+ bool_t access_r, bool_t access_w, bool_t access_x)
{
uint32_t pfec;
unsigned long nested_cr3, gfn;
nested_cr3 = nhvm_vcpu_hostcr3(v);
+ pfec = PFEC_user_mode | PFEC_page_present;
+ if (access_w)
+ pfec |= PFEC_write_access;
+ if (access_x)
+ pfec |= PFEC_insn_fetch;
+
/* Walk the guest-supplied NPT table, just as if it were a pagetable */
gfn = paging_ga_to_gfn_cr3(v, nested_cr3, L2_gpa, &pfec, page_order);
@@ -200,7 +207,8 @@ nestedhap_walk_L1_p2m(struct vcpu *v, paddr_t L2_gpa, paddr_t *L1_gpa,
* Returns:
*/
int
-nestedhvm_hap_nested_page_fault(struct vcpu *v, paddr_t L2_gpa)
+nestedhvm_hap_nested_page_fault(struct vcpu *v, paddr_t L2_gpa,
+ bool_t access_r, bool_t access_w, bool_t access_x)
{
int rv;
paddr_t L1_gpa, L0_gpa;
@@ -212,7 +220,8 @@ nestedhvm_hap_nested_page_fault(struct vcpu *v, paddr_t L2_gpa)
nested_p2m = p2m_get_nestedp2m(v, nhvm_vcpu_hostcr3(v));
/* walk the L1 P2M table */
- rv = nestedhap_walk_L1_p2m(v, L2_gpa, &L1_gpa, &page_order_21);
+ rv = nestedhap_walk_L1_p2m(v, L2_gpa, &L1_gpa, &page_order_21,
+ access_r, access_w, access_x);
/* let caller to handle these two cases */
switch (rv) {
diff --git a/xen/include/asm-x86/hvm/nestedhvm.h b/xen/include/asm-x86/hvm/nestedhvm.h
index 7c1c16a601..22a3c54841 100644
--- a/xen/include/asm-x86/hvm/nestedhvm.h
+++ b/xen/include/asm-x86/hvm/nestedhvm.h
@@ -51,7 +51,8 @@ bool_t nestedhvm_vcpu_in_guestmode(struct vcpu *v);
#define NESTEDHVM_PAGEFAULT_INJECT 1
#define NESTEDHVM_PAGEFAULT_ERROR 2
#define NESTEDHVM_PAGEFAULT_MMIO 3
-int nestedhvm_hap_nested_page_fault(struct vcpu *v, paddr_t L2_gpa);
+int nestedhvm_hap_nested_page_fault(struct vcpu *v, paddr_t L2_gpa,
+ bool_t access_r, bool_t access_w, bool_t access_x);
/* IO permission map */
unsigned long *nestedhvm_vcpu_iomap_get(bool_t ioport_80, bool_t ioport_ed);