* [PATCH] nestedhvm: initialize pfec for l1 pagetable walk
@ 2012-07-13 15:51 Christoph Egger
2012-07-13 16:00 ` Christoph Egger
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Egger @ 2012-07-13 15:51 UTC (permalink / raw)
To: xen-devel@lists.xen.org; +Cc: Tim Deegan
[-- Attachment #1: Type: text/plain, Size: 392 bytes --]
Initialize pfec for l1 pagetable walk.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
CC: Tim Deegan <tim@xen.org>
--
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85689 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
[-- Attachment #2: xen_nh_p2m.diff --]
[-- Type: text/plain, Size: 2234 bytes --]
diff -r c69ef56d8afc xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c Tue Jul 03 11:44:28 2012 +0200
+++ b/xen/arch/x86/hvm/hvm.c Fri Jul 13 17:15:55 2012 +0200
@@ -1278,7 +1278,8 @@ int hvm_hap_nested_page_fault(unsigned l
* 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 -r c69ef56d8afc xen/arch/x86/mm/hap/nested_hap.c
--- a/xen/arch/x86/mm/hap/nested_hap.c Tue Jul 03 11:44:28 2012 +0200
+++ b/xen/arch/x86/mm/hap/nested_hap.c Fri Jul 13 17:15:55 2012 +0200
@@ -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, pa
* 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 v
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) {
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nestedhvm: initialize pfec for l1 pagetable walk
2012-07-13 15:51 [PATCH] nestedhvm: initialize pfec for l1 pagetable walk Christoph Egger
@ 2012-07-13 16:00 ` Christoph Egger
2012-07-19 10:19 ` Tim Deegan
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Egger @ 2012-07-13 16:00 UTC (permalink / raw)
To: xen-devel@lists.xen.org; +Cc: Tim Deegan
[-- Attachment #1: Type: text/plain, Size: 511 bytes --]
Bah. Last one missed the diff of the header file. Resent.
On 07/13/12 17:51, Christoph Egger wrote:
>
> Initialize pfec for l1 pagetable walk.
>
> Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
> CC: Tim Deegan <tim@xen.org>
>
>
--
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85689 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
[-- Attachment #2: xen_nh_p2m.diff --]
[-- Type: text/plain, Size: 2911 bytes --]
diff -r c69ef56d8afc xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c Tue Jul 03 11:44:28 2012 +0200
+++ b/xen/arch/x86/hvm/hvm.c Fri Jul 13 17:26:54 2012 +0200
@@ -1278,7 +1278,8 @@ int hvm_hap_nested_page_fault(unsigned l
* 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 -r c69ef56d8afc xen/arch/x86/mm/hap/nested_hap.c
--- a/xen/arch/x86/mm/hap/nested_hap.c Tue Jul 03 11:44:28 2012 +0200
+++ b/xen/arch/x86/mm/hap/nested_hap.c Fri Jul 13 17:26:54 2012 +0200
@@ -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, pa
* 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 v
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 -r c69ef56d8afc xen/include/asm-x86/hvm/nestedhvm.h
--- a/xen/include/asm-x86/hvm/nestedhvm.h Tue Jul 03 11:44:28 2012 +0200
+++ b/xen/include/asm-x86/hvm/nestedhvm.h Fri Jul 13 17:26:54 2012 +0200
@@ -51,7 +51,8 @@ bool_t nestedhvm_vcpu_in_guestmode(struc
#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);
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nestedhvm: initialize pfec for l1 pagetable walk
2012-07-13 16:00 ` Christoph Egger
@ 2012-07-19 10:19 ` Tim Deegan
0 siblings, 0 replies; 3+ messages in thread
From: Tim Deegan @ 2012-07-19 10:19 UTC (permalink / raw)
To: Christoph Egger; +Cc: xen-devel@lists.xen.org
At 18:00 +0200 on 13 Jul (1342202437), Christoph Egger wrote:
> >
> > Initialize pfec for l1 pagetable walk.
> >
> > Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Applied, thanks.
Tim.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-07-19 10:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-13 15:51 [PATCH] nestedhvm: initialize pfec for l1 pagetable walk Christoph Egger
2012-07-13 16:00 ` Christoph Egger
2012-07-19 10:19 ` Tim Deegan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).