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)
{
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:
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)
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:
#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 {
#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>
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:
+++ /dev/null
-/*
- * 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__ */
#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);