xen-devel
[Xen-devel] RFC: Nested VMX patch series 10: vmcs switching API
To: |
"Dong, Eddie" <eddie.dong@xxxxxxxxx>, Tim Deegan <Tim.Deegan@xxxxxxxxxx>, Keir Fraser <keir@xxxxxxx> |
Subject: |
[Xen-devel] RFC: Nested VMX patch series 10: vmcs switching API |
From: |
"Dong, Eddie" <eddie.dong@xxxxxxxxx> |
Date: |
Wed, 1 Jun 2011 12:01:40 +0800 |
Accept-language: |
en-US |
Acceptlanguage: |
en-US |
Cc: |
"xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, "Dong, Eddie" <eddie.dong@xxxxxxxxx>, "He, Qing" <qing.he@xxxxxxxxx> |
Delivery-date: |
Tue, 31 May 2011 21:09:33 -0700 |
Envelope-to: |
www-data@xxxxxxxxxxxxxxxxxxx |
List-help: |
<mailto:xen-devel-request@lists.xensource.com?subject=help> |
List-id: |
Xen developer discussion <xen-devel.lists.xensource.com> |
List-post: |
<mailto:xen-devel@lists.xensource.com> |
List-subscribe: |
<http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe> |
List-unsubscribe: |
<http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe> |
References: |
<osstest-7468-mainreport@xxxxxxx> |
Sender: |
xen-devel-bounces@xxxxxxxxxxxxxxxxxxx |
Thread-index: |
AcwgAhjDwUdZ/2BOTBqtK+IA8ti/WgAC9edgAAAdViAAAA3MIAAAF9kwAAAdbWAAABYxcAAAC+egAAALN5AAAAWccAAABoAAAAAHMIA= |
Thread-topic: |
[Xen-devel] RFC: Nested VMX patch series 10: vmcs switching API |
Thx, Eddie
Signed-off-by: Qing He <qing.he@xxxxxxxxx>
Signed-off-by: Eddie Dong <eddie.dong@xxxxxxxxx>
diff -r e6ae904dc440 xen/arch/x86/hvm/vmx/vmcs.c
--- a/xen/arch/x86/hvm/vmx/vmcs.c Tue May 31 18:01:17 2011 +0800
+++ b/xen/arch/x86/hvm/vmx/vmcs.c Wed Jun 01 08:34:24 2011 +0800
@@ -669,6 +669,38 @@
}
}
+/*
+ * Switch VMCS between layer 1 & 2 guest
+ */
+void vmx_vmcs_switch(struct vcpu *v,
+ struct vmcs_struct *from,
+ struct vmcs_struct *to)
+{
+ /* no foreign access */
+ if ( unlikely(v != current) )
+ return;
+
+ if ( unlikely(current->arch.hvm_vmx.vmcs != from) )
+ return;
+
+ spin_lock(&v->arch.hvm_vmx.vmcs_lock);
+
+ __vmpclear(virt_to_maddr(from));
+ __vmptrld(virt_to_maddr(to));
+
+ v->arch.hvm_vmx.vmcs = to;
+ v->arch.hvm_vmx.launched = 0;
+ this_cpu(current_vmcs) = to;
+
+ if ( v->arch.hvm_vmx.hostenv_migrated )
+ {
+ v->arch.hvm_vmx.hostenv_migrated = 0;
+ vmx_set_host_env(v);
+ }
+
+ spin_unlock(&v->arch.hvm_vmx.vmcs_lock);
+}
+
static int construct_vmcs(struct vcpu *v)
{
struct domain *d = v->domain;
@@ -1078,6 +1110,13 @@
hvm_migrate_timers(v);
hvm_migrate_pirqs(v);
vmx_set_host_env(v);
+ /*
+ * Both n1 VMCS and n2 VMCS need to update the host environment after
+ * VCPU migration. The environment of current VMCS is updated in place,
+ * but the action of another VMCS is deferred till it is switched in.
+ */
+ v->arch.hvm_vmx.hostenv_migrated = 1;
+
hvm_asid_flush_vcpu(v);
}
diff -r e6ae904dc440 xen/include/asm-x86/hvm/vmx/vmcs.h
--- a/xen/include/asm-x86/hvm/vmx/vmcs.h Tue May 31 18:01:17 2011 +0800
+++ b/xen/include/asm-x86/hvm/vmx/vmcs.h Wed Jun 01 08:34:24 2011 +0800
@@ -123,6 +123,7 @@
struct segment_register vm86_saved_seg[x86_seg_tr + 1];
/* Remember EFLAGS while in virtual 8086 mode */
uint32_t vm86_saved_eflags;
+ int hostenv_migrated;
};
int vmx_create_vmcs(struct vcpu *v);
@@ -390,6 +391,9 @@
int vmx_write_guest_msr(u32 msr, u64 val);
int vmx_add_guest_msr(u32 msr);
int vmx_add_host_load_msr(u32 msr);
+void vmx_vmcs_switch(struct vcpu *v,
+ struct vmcs_struct *from,
+ struct vmcs_struct *to);
#endif /* ASM_X86_HVM_VMX_VMCS_H__ */
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [Xen-devel] pre-cleanup2 for nested VMX, (continued)
- [Xen-devel] pre-cleanup2 for nested VMX, Dong, Eddie
- [Xen-devel] RFC: Nested VMX patch series 01: data structure, Dong, Eddie
- [Xen-devel] RFC: Nested VMX patch series 02: wrap APIs, Dong, Eddie
- [Xen-devel] RFC: Nested VMX patch series 03: vmxon_off, Dong, Eddie
- [Xen-devel] RFC: Nested VMX patch series 05: vmptrld, Dong, Eddie
- [Xen-devel] RFC: Nested VMX patch series 04: virtual VMCS structure and APIs, Dong, Eddie
- RE: [Xen-devel] RFC: Nested VMX patch series 05: vmptrst, Dong, Eddie
- [Xen-devel] RFC: Nested VMX patch series 07: vmclear, Dong, Eddie
- [Xen-devel] RFC: Nested VMX patch series 08: vmwrite, Dong, Eddie
- RE: [Xen-devel] RFC: Nested VMX patch series 09: vmread, Dong, Eddie
- [Xen-devel] RFC: Nested VMX patch series 10: vmcs switching API,
Dong, Eddie <=
- [Xen-devel] RFC: Nested VMX patch series 11: vmresume, Dong, Eddie
- [Xen-devel] RFC: Nested VMX patch series 12: shadow vmcs control, Dong, Eddie
- [Xen-devel] RFC: Nested VMX patch series 12: real VMCS switch, Dong, Eddie
- [Xen-devel] RFC: Nested VMX patch series 14: exceptions, Dong, Eddie
- [Xen-devel] RFC: Nested VMX patch series 15: exit from n2 guest, Dong, Eddie
- RE: [Xen-devel] RFC: Nested VMX patch series 16: fpu, Dong, Eddie
- [Xen-devel] RFC: Nested VMX patch series 17: cr4, Dong, Eddie
- [Xen-devel] RFC: Nested VMX patch series 18: capability, Dong, Eddie
- [Xen-devel] RFC: Nested VMX patch series 00, Dong, Eddie
|
|
|