* [PATCH] Nested VMX: Expose unrestricted guest feature to guest
@ 2013-09-22 6:39 Yang Zhang
2013-09-29 2:10 ` Dong, Eddie
0 siblings, 1 reply; 2+ messages in thread
From: Yang Zhang @ 2013-09-22 6:39 UTC (permalink / raw)
To: xen-devel; +Cc: Yang Zhang, eddie.dong, JBeulich
From: Yang Zhang <yang.z.zhang@Intel.com>
With virtual unrestricted guest feature, L2 guest is allowed to run
with PG cleared. Also, allow PAE not set during virtual vmexit emulation.
Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
---
xen/arch/x86/hvm/hvm.c | 3 ++-
xen/arch/x86/hvm/vmx/vvmx.c | 3 +++
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 7203184..481cb71 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1732,7 +1732,8 @@ int hvm_set_cr0(unsigned long value)
{
if ( v->arch.hvm_vcpu.guest_efer & EFER_LME )
{
- if ( !(v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PAE) )
+ if ( !(v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PAE) &&
+ !nestedhvm_vmswitch_in_progress(v) )
{
HVM_DBG_LOG(DBG_LEVEL_1, "Enable paging before PAE enable");
goto gpf;
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index f385c02..d55d60c 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -1341,6 +1341,7 @@ static void virtual_vmexit(struct cpu_user_regs *regs)
nestedhvm_vcpu_exit_guestmode(v);
nvcpu->nv_vmexit_pending = 0;
+ nvcpu->nv_vmswitch_in_progress = 1;
lm_l2 = !!hvm_long_mode_enabled(v);
lm_l1 = !!(__get_vvmcs(nvcpu->nv_vvmcx, VM_EXIT_CONTROLS) &
@@ -1371,6 +1372,7 @@ static void virtual_vmexit(struct cpu_user_regs *regs)
if ( cpu_has_vmx_virtual_intr_delivery )
nvmx_update_apicv(v);
+ nvcpu->nv_vmswitch_in_progress = 0;
vmreturn(regs, VMSUCCEED);
}
@@ -1876,6 +1878,7 @@ int nvmx_msr_read_intercept(unsigned int msr, u64 *msr_content)
data = SECONDARY_EXEC_DESCRIPTOR_TABLE_EXITING |
SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
SECONDARY_EXEC_ENABLE_VPID |
+ SECONDARY_EXEC_UNRESTRICTED_GUEST |
SECONDARY_EXEC_ENABLE_EPT;
data = gen_vmx_msr(data, 0, host_data);
break;
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Nested VMX: Expose unrestricted guest feature to guest
2013-09-22 6:39 [PATCH] Nested VMX: Expose unrestricted guest feature to guest Yang Zhang
@ 2013-09-29 2:10 ` Dong, Eddie
0 siblings, 0 replies; 2+ messages in thread
From: Dong, Eddie @ 2013-09-29 2:10 UTC (permalink / raw)
To: Zhang, Yang Z, xen-devel@lists.xensource.com
Cc: Dong, Eddie, JBeulich@suse.com
Acked-by Eddie.Dong@intel.com
-----Original Message-----
From: Zhang, Yang Z
Sent: Sunday, September 22, 2013 2:39 PM
To: xen-devel@lists.xensource.com
Cc: JBeulich@suse.com; Dong, Eddie; Zhang, Yang Z
Subject: [PATCH] Nested VMX: Expose unrestricted guest feature to guest
From: Yang Zhang <yang.z.zhang@Intel.com>
With virtual unrestricted guest feature, L2 guest is allowed to run with PG cleared. Also, allow PAE not set during virtual vmexit emulation.
Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
---
xen/arch/x86/hvm/hvm.c | 3 ++-
xen/arch/x86/hvm/vmx/vvmx.c | 3 +++
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 7203184..481cb71 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1732,7 +1732,8 @@ int hvm_set_cr0(unsigned long value)
{
if ( v->arch.hvm_vcpu.guest_efer & EFER_LME )
{
- if ( !(v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PAE) )
+ if ( !(v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PAE) &&
+ !nestedhvm_vmswitch_in_progress(v) )
{
HVM_DBG_LOG(DBG_LEVEL_1, "Enable paging before PAE enable");
goto gpf;
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index f385c02..d55d60c 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -1341,6 +1341,7 @@ static void virtual_vmexit(struct cpu_user_regs *regs)
nestedhvm_vcpu_exit_guestmode(v);
nvcpu->nv_vmexit_pending = 0;
+ nvcpu->nv_vmswitch_in_progress = 1;
lm_l2 = !!hvm_long_mode_enabled(v);
lm_l1 = !!(__get_vvmcs(nvcpu->nv_vvmcx, VM_EXIT_CONTROLS) & @@ -1371,6 +1372,7 @@ static void virtual_vmexit(struct cpu_user_regs *regs)
if ( cpu_has_vmx_virtual_intr_delivery )
nvmx_update_apicv(v);
+ nvcpu->nv_vmswitch_in_progress = 0;
vmreturn(regs, VMSUCCEED);
}
@@ -1876,6 +1878,7 @@ int nvmx_msr_read_intercept(unsigned int msr, u64 *msr_content)
data = SECONDARY_EXEC_DESCRIPTOR_TABLE_EXITING |
SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES |
SECONDARY_EXEC_ENABLE_VPID |
+ SECONDARY_EXEC_UNRESTRICTED_GUEST |
SECONDARY_EXEC_ENABLE_EPT;
data = gen_vmx_msr(data, 0, host_data);
break;
--
1.7.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-09-29 2:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-22 6:39 [PATCH] Nested VMX: Expose unrestricted guest feature to guest Yang Zhang
2013-09-29 2:10 ` Dong, Eddie
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).