[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] hvm: Clean up CPUID_0000_0001 return values.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1202380308 0 # Node ID 199f81c4b882467aac41d9d53ed69184f7c7a393 # Parent 58e5e9ae0f8dcc4abb390d46d89e49c65e62607b hvm: Clean up CPUID_0000_0001 return values. The fix to EBX.ApicID was pointed out by Andre Przywara <andre.przywara@xxxxxxx>. Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> --- xen/include/asm-x86/hvm/vmx/cpu.h | 32 -------------------------------- xen/arch/x86/hvm/hvm.c | 37 +++++++++++++++++++++++++++++++++---- xen/arch/x86/hvm/svm/svm.c | 19 ++++--------------- xen/arch/x86/hvm/vmx/realmode.c | 1 - xen/arch/x86/hvm/vmx/vmx.c | 17 +++-------------- xen/include/asm-x86/hvm/vmx/vmcs.h | 1 - 6 files changed, 40 insertions(+), 67 deletions(-) diff -r 58e5e9ae0f8d -r 199f81c4b882 xen/arch/x86/hvm/hvm.c --- a/xen/arch/x86/hvm/hvm.c Thu Feb 07 09:28:55 2008 +0000 +++ b/xen/arch/x86/hvm/hvm.c Thu Feb 07 10:31:48 2008 +0000 @@ -1400,6 +1400,7 @@ void hvm_print_line(struct vcpu *v, cons spin_unlock(&hd->pbuf_lock); } +#define bitmaskof(idx) (1U << ((idx) & 31)) void hvm_cpuid(unsigned int input, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { @@ -1413,16 +1414,44 @@ void hvm_cpuid(unsigned int input, unsig switch ( input ) { case 0x00000001: - __clear_bit(X86_FEATURE_MWAIT & 31, ecx); - + /* Clear #threads count and poke initial VLAPIC ID. */ + *ebx &= 0x0000FFFFu; + *ebx |= (current->vcpu_id * 2) << 24; + + *ecx &= (bitmaskof(X86_FEATURE_XMM3) | + bitmaskof(X86_FEATURE_SSSE3) | + bitmaskof(X86_FEATURE_CX16) | + bitmaskof(X86_FEATURE_SSE4_1) | + bitmaskof(X86_FEATURE_SSE4_2) | + bitmaskof(X86_FEATURE_POPCNT)); + + *edx &= (bitmaskof(X86_FEATURE_FPU) | + bitmaskof(X86_FEATURE_VME) | + bitmaskof(X86_FEATURE_DE) | + bitmaskof(X86_FEATURE_PSE) | + bitmaskof(X86_FEATURE_TSC) | + bitmaskof(X86_FEATURE_MSR) | + bitmaskof(X86_FEATURE_PAE) | + bitmaskof(X86_FEATURE_MCE) | + bitmaskof(X86_FEATURE_CX8) | + bitmaskof(X86_FEATURE_APIC) | + bitmaskof(X86_FEATURE_SEP) | + bitmaskof(X86_FEATURE_MTRR) | + bitmaskof(X86_FEATURE_PGE) | + bitmaskof(X86_FEATURE_MCA) | + bitmaskof(X86_FEATURE_CMOV) | + bitmaskof(X86_FEATURE_PAT) | + bitmaskof(X86_FEATURE_CLFLSH) | + bitmaskof(X86_FEATURE_MMX) | + bitmaskof(X86_FEATURE_FXSR) | + bitmaskof(X86_FEATURE_XMM) | + bitmaskof(X86_FEATURE_XMM2)); if ( vlapic_hw_disabled(vcpu_vlapic(v)) ) __clear_bit(X86_FEATURE_APIC & 31, edx); - #if CONFIG_PAGING_LEVELS >= 3 if ( !v->domain->arch.hvm_domain.params[HVM_PARAM_PAE_ENABLED] ) #endif __clear_bit(X86_FEATURE_PAE & 31, edx); - __clear_bit(X86_FEATURE_PSE36 & 31, edx); break; case 0x80000001: diff -r 58e5e9ae0f8d -r 199f81c4b882 xen/arch/x86/hvm/svm/svm.c --- a/xen/arch/x86/hvm/svm/svm.c Thu Feb 07 09:28:55 2008 +0000 +++ b/xen/arch/x86/hvm/svm/svm.c Thu Feb 07 10:31:48 2008 +0000 @@ -986,11 +986,6 @@ static void svm_do_no_device_fault(struc vmcb->cr0 &= ~X86_CR0_TS; } -/* Reserved bits ECX: [31:14], [12:4], [2:1]*/ -#define SVM_VCPU_CPUID_L1_ECX_RESERVED 0xffffdff6 -/* Reserved bits EDX: [31:29], [27], [22:20], [18], [10] */ -#define SVM_VCPU_CPUID_L1_EDX_RESERVED 0xe8740400 - #define bitmaskof(idx) (1U << ((idx) & 31)) static void svm_vmexit_do_cpuid(struct vmcb_struct *vmcb, struct cpu_user_regs *regs) @@ -1005,16 +1000,10 @@ static void svm_vmexit_do_cpuid(struct v switch ( input ) { case 0x00000001: - /* Clear out reserved bits. */ - ecx &= ~SVM_VCPU_CPUID_L1_ECX_RESERVED; - edx &= ~SVM_VCPU_CPUID_L1_EDX_RESERVED; - - /* Guest should only see one logical processor. - * See details on page 23 of AMD CPUID Specification. - */ - __clear_bit(X86_FEATURE_HT & 31, &edx); - ebx &= 0xFF00FFFF; /* clear the logical processor count when HTT=0 */ - ebx |= 0x00010000; /* set to 1 just for precaution */ + /* Mask Intel-only features. */ + ecx &= ~(bitmaskof(X86_FEATURE_SSSE3) | + bitmaskof(X86_FEATURE_SSE4_1) | + bitmaskof(X86_FEATURE_SSE4_2)); break; case 0x80000001: diff -r 58e5e9ae0f8d -r 199f81c4b882 xen/arch/x86/hvm/vmx/realmode.c --- a/xen/arch/x86/hvm/vmx/realmode.c Thu Feb 07 09:28:55 2008 +0000 +++ b/xen/arch/x86/hvm/vmx/realmode.c Thu Feb 07 10:31:48 2008 +0000 @@ -18,7 +18,6 @@ #include <asm/hvm/support.h> #include <asm/hvm/vmx/vmx.h> #include <asm/hvm/vmx/vmcs.h> -#include <asm/hvm/vmx/cpu.h> #include <asm/x86_emulate.h> struct realmode_emulate_ctxt { diff -r 58e5e9ae0f8d -r 199f81c4b882 xen/arch/x86/hvm/vmx/vmx.c --- a/xen/arch/x86/hvm/vmx/vmx.c Thu Feb 07 09:28:55 2008 +0000 +++ b/xen/arch/x86/hvm/vmx/vmx.c Thu Feb 07 10:31:48 2008 +0000 @@ -41,7 +41,6 @@ #include <asm/hvm/support.h> #include <asm/hvm/vmx/vmx.h> #include <asm/hvm/vmx/vmcs.h> -#include <asm/hvm/vmx/cpu.h> #include <public/sched.h> #include <public/hvm/ioreq.h> #include <asm/hvm/vpic.h> @@ -1267,23 +1266,13 @@ void vmx_cpuid_intercept( switch ( input ) { case 0x00000001: - *ecx &= ~VMX_VCPU_CPUID_L1_ECX_RESERVED; - *ebx &= NUM_THREADS_RESET_MASK; - *ecx &= ~(bitmaskof(X86_FEATURE_VMXE) | - bitmaskof(X86_FEATURE_EST) | - bitmaskof(X86_FEATURE_TM2) | - bitmaskof(X86_FEATURE_CID) | - bitmaskof(X86_FEATURE_PDCM) | - bitmaskof(X86_FEATURE_DSCPL)); - *edx &= ~(bitmaskof(X86_FEATURE_HT) | - bitmaskof(X86_FEATURE_ACPI) | - bitmaskof(X86_FEATURE_ACC) | - bitmaskof(X86_FEATURE_DS)); + /* Mask AMD-only features. */ + *ecx &= ~(bitmaskof(X86_FEATURE_POPCNT)); break; case 0x00000004: cpuid_count(input, count, eax, ebx, ecx, edx); - *eax &= NUM_CORES_RESET_MASK; + *eax &= 0x3FFF; /* one core */ break; case 0x00000006: diff -r 58e5e9ae0f8d -r 199f81c4b882 xen/include/asm-x86/hvm/vmx/cpu.h --- a/xen/include/asm-x86/hvm/vmx/cpu.h Thu Feb 07 09:28:55 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* - * cpu.h: Virtual CPU state - * Copyright (c) 2004, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place - Suite 330, Boston, MA 02111-1307 USA. - * - */ -#ifndef __ASM_X86_HVM_VMX_CPU_H__ -#define __ASM_X86_HVM_VMX_CPU_H__ - -#define NUM_CORES_RESET_MASK 0x00003FFF -#define NUM_THREADS_RESET_MASK 0xFF00FFFF - -#define VMX_VCPU_CPUID_L1_ECX_RESERVED_18 0x00040000 -#define VMX_VCPU_CPUID_L1_ECX_RESERVED_6 0x00000040 - -#define VMX_VCPU_CPUID_L1_ECX_RESERVED \ - ( VMX_VCPU_CPUID_L1_ECX_RESERVED_18 | \ - VMX_VCPU_CPUID_L1_ECX_RESERVED_6 ) - -#endif /* __ASM_X86_HVM_VMX_CPU_H__ */ diff -r 58e5e9ae0f8d -r 199f81c4b882 xen/include/asm-x86/hvm/vmx/vmcs.h --- a/xen/include/asm-x86/hvm/vmx/vmcs.h Thu Feb 07 09:28:55 2008 +0000 +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h Thu Feb 07 10:31:48 2008 +0000 @@ -21,7 +21,6 @@ #include <asm/config.h> #include <asm/hvm/io.h> -#include <asm/hvm/vmx/cpu.h> #include <asm/hvm/vmx/vpmu.h> extern void start_vmx(void); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |