* [PATCH] nestedsvm: fix shadow-on-hap
@ 2011-05-11 12:53 Christoph Egger
2011-05-11 13:26 ` Christoph Egger
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Egger @ 2011-05-11 12:53 UTC (permalink / raw)
To: xen-devel@lists.xensource.com
[-- Attachment #1: Type: text/plain, Size: 391 bytes --]
Hi,
attached patch lets l2 guest actually run with shadow-on-hap.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
--
---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_hapshadow.diff --]
[-- Type: text/plain, Size: 1181 bytes --]
diff -r 0c60c61ff836 xen/arch/x86/hvm/svm/entry.S
--- a/xen/arch/x86/hvm/svm/entry.S Tue May 10 11:42:02 2011 +0200
+++ b/xen/arch/x86/hvm/svm/entry.S Wed May 11 14:50:40 2011 +0200
@@ -65,12 +65,16 @@ ENTRY(svm_asm_do_resume)
testl $~0,(r(dx),r(ax),1)
jnz .Lsvm_process_softirqs
+ testb $0, VCPU_nsvm_hap_enabled(r(bx))
+ jz .Lsvm_asid_handle
+
mov VCPU_nhvm_p2m(r(bx)),r(ax)
test r(ax),r(ax)
sete %al
andb VCPU_nhvm_guestmode(r(bx)),%al
jnz .Lsvm_nsvm_no_p2m
+.Lsvm_asid_handle:
call svm_asid_handle_vmrun
cmpb $0,addr_of(tb_init_done)
diff -r 0c60c61ff836 xen/arch/x86/hvm/svm/nestedsvm.c
--- a/xen/arch/x86/hvm/svm/nestedsvm.c Tue May 10 11:42:02 2011 +0200
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c Wed May 11 14:50:40 2011 +0200
@@ -546,6 +547,7 @@ static int nsvm_vmcb_prepare4vmrun(struc
/* host nested paging + guest shadow paging. */
n2vmcb->_np_enable = 1;
/* Keep h_cr3 as it is. */
+ n2vmcb->_h_cr3 = n1vmcb->_h_cr3;
/* When l1 guest does shadow paging
* we assume it intercepts page faults.
*/
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] nestedsvm: fix shadow-on-hap 2011-05-11 12:53 [PATCH] nestedsvm: fix shadow-on-hap Christoph Egger @ 2011-05-11 13:26 ` Christoph Egger 2011-05-11 16:11 ` Tim Deegan 0 siblings, 1 reply; 3+ messages in thread From: Christoph Egger @ 2011-05-11 13:26 UTC (permalink / raw) To: xen-devel [-- Attachment #1: Type: text/plain, Size: 576 bytes --] On 05/11/11 14:53, Christoph Egger wrote: > > Hi, > > attached patch lets l2 guest actually run with shadow-on-hap. > > Signed-off-by: Christoph Egger<Christoph.Egger@amd.com> > > New version. Old version missed some hunks to compile. Sorry about this. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> -- ---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_hapshadow.diff --] [-- Type: text/plain, Size: 2289 bytes --] diff -r 0c60c61ff836 xen/arch/x86/hvm/svm/entry.S --- a/xen/arch/x86/hvm/svm/entry.S Tue May 10 11:42:02 2011 +0200 +++ b/xen/arch/x86/hvm/svm/entry.S Wed May 11 15:24:00 2011 +0200 @@ -65,12 +65,16 @@ ENTRY(svm_asm_do_resume) testl $~0,(r(dx),r(ax),1) jnz .Lsvm_process_softirqs + testb $0, VCPU_nsvm_hap_enabled(r(bx)) + jz .Lsvm_asid_handle + mov VCPU_nhvm_p2m(r(bx)),r(ax) test r(ax),r(ax) sete %al andb VCPU_nhvm_guestmode(r(bx)),%al jnz .Lsvm_nsvm_no_p2m +.Lsvm_asid_handle: call svm_asid_handle_vmrun cmpb $0,addr_of(tb_init_done) diff -r 0c60c61ff836 xen/arch/x86/hvm/svm/nestedsvm.c --- a/xen/arch/x86/hvm/svm/nestedsvm.c Tue May 10 11:42:02 2011 +0200 +++ b/xen/arch/x86/hvm/svm/nestedsvm.c Wed May 11 15:24:00 2011 +0200 @@ -546,6 +547,7 @@ static int nsvm_vmcb_prepare4vmrun(struc /* host nested paging + guest shadow paging. */ n2vmcb->_np_enable = 1; /* Keep h_cr3 as it is. */ + n2vmcb->_h_cr3 = n1vmcb->_h_cr3; /* When l1 guest does shadow paging * we assume it intercepts page faults. */ diff -r 0c60c61ff836 xen/arch/x86/x86_32/asm-offsets.c --- a/xen/arch/x86/x86_32/asm-offsets.c Tue May 10 11:42:02 2011 +0200 +++ b/xen/arch/x86/x86_32/asm-offsets.c Wed May 11 15:24:00 2011 +0200 @@ -95,6 +95,7 @@ void __dummy__(void) OFFSET(VCPU_nhvm_guestmode, struct vcpu, arch.hvm_vcpu.nvcpu.nv_guestmode); OFFSET(VCPU_nhvm_p2m, struct vcpu, arch.hvm_vcpu.nvcpu.nv_p2m); + OFFSET(VCPU_nsvm_hap_enabled, struct vcpu, arch.hvm_vcpu.nvcpu.u.nsvm.ns_hap_enabled); BLANK(); OFFSET(VMCB_rax, struct vmcb_struct, rax); diff -r 0c60c61ff836 xen/arch/x86/x86_64/asm-offsets.c --- a/xen/arch/x86/x86_64/asm-offsets.c Tue May 10 11:42:02 2011 +0200 +++ b/xen/arch/x86/x86_64/asm-offsets.c Wed May 11 15:24:00 2011 +0200 @@ -117,6 +117,7 @@ void __dummy__(void) OFFSET(VCPU_nhvm_guestmode, struct vcpu, arch.hvm_vcpu.nvcpu.nv_guestmode); OFFSET(VCPU_nhvm_p2m, struct vcpu, arch.hvm_vcpu.nvcpu.nv_p2m); + OFFSET(VCPU_nsvm_hap_enabled, struct vcpu, arch.hvm_vcpu.nvcpu.u.nsvm.ns_hap_enabled); BLANK(); OFFSET(DOMAIN_is_32bit_pv, struct domain, arch.is_32bit_pv); [-- Attachment #3: Type: text/plain, Size: 138 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nestedsvm: fix shadow-on-hap 2011-05-11 13:26 ` Christoph Egger @ 2011-05-11 16:11 ` Tim Deegan 0 siblings, 0 replies; 3+ messages in thread From: Tim Deegan @ 2011-05-11 16:11 UTC (permalink / raw) To: Christoph Egger; +Cc: xen-devel@lists.xensource.com At 14:26 +0100 on 11 May (1305124015), Christoph Egger wrote: > diff -r 0c60c61ff836 xen/arch/x86/hvm/svm/entry.S > --- a/xen/arch/x86/hvm/svm/entry.S Tue May 10 11:42:02 2011 +0200 > +++ b/xen/arch/x86/hvm/svm/entry.S Wed May 11 15:24:00 2011 +0200 > @@ -65,12 +65,16 @@ ENTRY(svm_asm_do_resume) > testl $~0,(r(dx),r(ax),1) > jnz .Lsvm_process_softirqs > > + testb $0, VCPU_nsvm_hap_enabled(r(bx)) > + jz .Lsvm_asid_handle > + > mov VCPU_nhvm_p2m(r(bx)),r(ax) > test r(ax),r(ax) > sete %al > andb VCPU_nhvm_guestmode(r(bx)),%al > jnz .Lsvm_nsvm_no_p2m > > +.Lsvm_asid_handle: It would be neater to AND nsvm_hap_enabled into the no-p2m calculation rather than have another jump, but unless you feel like fixing that, this and your other 3 recent nested-SVM patches are Acked-by: Tim Deegan <Tim.Deegan@citrix.com> Tim. -- Tim Deegan <Tim.Deegan@citrix.com> Principal Software Engineer, Xen Platform Team Citrix Systems UK Ltd. (Company #02937203, SL9 0BG) ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-05-11 16:11 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-05-11 12:53 [PATCH] nestedsvm: fix shadow-on-hap Christoph Egger 2011-05-11 13:26 ` Christoph Egger 2011-05-11 16:11 ` 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).