[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-3.1-testing] vmx: Never use physical addresses above 4GB for VMCS state on i386.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1200130506 0 # Node ID 44654a2afe6c099d058922c45181de826904f8ec # Parent 8a917e38a3cf71e6b6e4768805f3a36b8b8598da vmx: Never use physical addresses above 4GB for VMCS state on i386. Thsi requires special allocation of the vlapic regs page, but does let us get rid of some top-half writes to a few VMCS fields. Assert a few more facts about the VMX_BASIC_MSR. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> xen-unstable changeset: 15526:25a42f826a63 xen-unstable date: Tue Jul 10 23:37:42 2007 +0100 --- xen/arch/x86/hvm/vlapic.c | 9 ++++++++- xen/arch/x86/hvm/vmx/vmcs.c | 15 ++++++++++----- xen/arch/x86/hvm/vmx/vmx.c | 6 +----- 3 files changed, 19 insertions(+), 11 deletions(-) diff -r 8a917e38a3cf -r 44654a2afe6c xen/arch/x86/hvm/vlapic.c --- a/xen/arch/x86/hvm/vlapic.c Fri Jan 11 11:08:52 2008 +0000 +++ b/xen/arch/x86/hvm/vlapic.c Sat Jan 12 09:35:06 2008 +0000 @@ -905,12 +905,19 @@ int vlapic_init(struct vcpu *v) int vlapic_init(struct vcpu *v) { struct vlapic *vlapic = vcpu_vlapic(v); + unsigned int memflags = 0; HVM_DBG_LOG(DBG_LEVEL_VLAPIC, "%d", v->vcpu_id); vlapic->pt.source = PTSRC_lapic; - vlapic->regs_page = alloc_domheap_page(NULL); +#ifdef __i386__ + /* 32-bit VMX may be limited to 32-bit physical addresses. */ + if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL ) + memflags = MEMF_bits(32); +#endif + + vlapic->regs_page = alloc_domheap_pages(NULL, 0, memflags); if ( vlapic->regs_page == NULL ) { dprintk(XENLOG_ERR, "alloc vlapic regs error: %d/%d\n", diff -r 8a917e38a3cf -r 44654a2afe6c xen/arch/x86/hvm/vmx/vmcs.c --- a/xen/arch/x86/hvm/vmx/vmcs.c Fri Jan 11 11:08:52 2008 +0000 +++ b/xen/arch/x86/hvm/vmx/vmcs.c Sat Jan 12 09:35:06 2008 +0000 @@ -149,6 +149,14 @@ void vmx_init_vmcs_config(void) /* IA-32 SDM Vol 3B: VMCS size is never greater than 4kB. */ BUG_ON((vmx_msr_high & 0x1fff) > PAGE_SIZE); + +#ifdef __x86_64__ + /* IA-32 SDM Vol 3B: 64-bit CPUs always have VMX_BASIC_MSR[48]==0. */ + BUG_ON(vmx_msr_high & (1u<<16)); +#endif + + /* Require Write-Back (WB) memory type for VMCS accesses. */ + BUG_ON(((vmx_msr_high >> 18) & 15) == 6); } static struct vmcs_struct *vmx_alloc_vmcs(void) @@ -446,11 +454,8 @@ static void construct_vmcs(struct vcpu * if ( cpu_has_vmx_tpr_shadow ) { - uint64_t virt_page_ma = page_to_maddr(vcpu_vlapic(v)->regs_page); - __vmwrite(VIRTUAL_APIC_PAGE_ADDR, virt_page_ma); -#if defined (__i386__) - __vmwrite(VIRTUAL_APIC_PAGE_ADDR_HIGH, virt_page_ma >> 32); -#endif + __vmwrite(VIRTUAL_APIC_PAGE_ADDR, + page_to_maddr(vcpu_vlapic(v)->regs_page)); __vmwrite(TPR_THRESHOLD, 0); } diff -r 8a917e38a3cf -r 44654a2afe6c xen/arch/x86/hvm/vmx/vmx.c --- a/xen/arch/x86/hvm/vmx/vmx.c Fri Jan 11 11:08:52 2008 +0000 +++ b/xen/arch/x86/hvm/vmx/vmx.c Sat Jan 12 09:35:06 2008 +0000 @@ -2678,7 +2678,7 @@ static void vmx_free_vlapic_mapping(stru static void vmx_install_vlapic_mapping(struct vcpu *v) { - paddr_t virt_page_ma, apic_page_ma; + unsigned long virt_page_ma, apic_page_ma; if ( !cpu_has_vmx_virtualize_apic_accesses ) return; @@ -2690,10 +2690,6 @@ static void vmx_install_vlapic_mapping(s vmx_vmcs_enter(v); __vmwrite(VIRTUAL_APIC_PAGE_ADDR, virt_page_ma); __vmwrite(APIC_ACCESS_ADDR, apic_page_ma); -#if defined (__i386__) - __vmwrite(VIRTUAL_APIC_PAGE_ADDR_HIGH, virt_page_ma >> 32); - __vmwrite(APIC_ACCESS_ADDR_HIGH, apic_page_ma >> 32); -#endif vmx_vmcs_exit(v); } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |