Revision 94a8d39a target-i386/kvm.c
b/target-i386/kvm.c | ||
---|---|---|
54 | 54 |
#define BUS_MCEERR_AO 5 |
55 | 55 |
#endif |
56 | 56 |
|
57 |
const KVMCapabilityInfo kvm_arch_required_capabilities[] = { |
|
58 |
KVM_CAP_INFO(SET_TSS_ADDR), |
|
59 |
KVM_CAP_INFO(EXT_CPUID), |
|
60 |
KVM_CAP_INFO(MP_STATE), |
|
61 |
KVM_CAP_LAST_INFO |
|
62 |
}; |
|
63 |
|
|
57 | 64 |
static bool has_msr_star; |
58 | 65 |
static bool has_msr_hsave_pa; |
59 | 66 |
static int lm_capable_kernel; |
60 | 67 |
|
61 |
#ifdef KVM_CAP_EXT_CPUID |
|
62 |
|
|
63 | 68 |
static struct kvm_cpuid2 *try_get_cpuid(KVMState *s, int max) |
64 | 69 |
{ |
65 | 70 |
struct kvm_cpuid2 *cpuid; |
... | ... | |
93 | 98 |
uint32_t ret = 0; |
94 | 99 |
uint32_t cpuid_1_edx; |
95 | 100 |
|
96 |
if (!kvm_check_extension(env->kvm_state, KVM_CAP_EXT_CPUID)) { |
|
97 |
return -1U; |
|
98 |
} |
|
99 |
|
|
100 | 101 |
max = 1; |
101 | 102 |
while ((cpuid = try_get_cpuid(env->kvm_state, max)) == NULL) { |
102 | 103 |
max *= 2; |
... | ... | |
140 | 141 |
return ret; |
141 | 142 |
} |
142 | 143 |
|
143 |
#else |
|
144 |
|
|
145 |
uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function, |
|
146 |
uint32_t index, int reg) |
|
147 |
{ |
|
148 |
return -1U; |
|
149 |
} |
|
150 |
|
|
151 |
#endif |
|
152 |
|
|
153 | 144 |
#ifdef CONFIG_KVM_PARA |
154 | 145 |
struct kvm_para_features { |
155 | 146 |
int cap; |
156 | 147 |
int feature; |
157 | 148 |
} para_features[] = { |
158 |
#ifdef KVM_CAP_CLOCKSOURCE |
|
159 | 149 |
{ KVM_CAP_CLOCKSOURCE, KVM_FEATURE_CLOCKSOURCE }, |
160 |
#endif |
|
161 |
#ifdef KVM_CAP_NOP_IO_DELAY |
|
162 | 150 |
{ KVM_CAP_NOP_IO_DELAY, KVM_FEATURE_NOP_IO_DELAY }, |
163 |
#endif |
|
164 |
#ifdef KVM_CAP_PV_MMU |
|
165 | 151 |
{ KVM_CAP_PV_MMU, KVM_FEATURE_MMU_OP }, |
166 |
#endif |
|
167 | 152 |
#ifdef KVM_CAP_ASYNC_PF |
168 | 153 |
{ KVM_CAP_ASYNC_PF, KVM_FEATURE_ASYNC_PF }, |
169 | 154 |
#endif |
... | ... | |
542 | 527 |
|
543 | 528 |
/* create vm86 tss. KVM uses vm86 mode to emulate 16-bit code |
544 | 529 |
* directly. In order to use vm86 mode, a TSS is needed. Since this |
545 |
* must be part of guest physical memory, we need to allocate it. Older |
|
546 |
* versions of KVM just assumed that it would be at the end of physical |
|
547 |
* memory but that doesn't work with more than 4GB of memory. We simply |
|
548 |
* refuse to work with those older versions of KVM. */ |
|
549 |
ret = kvm_check_extension(s, KVM_CAP_SET_TSS_ADDR); |
|
550 |
if (ret <= 0) { |
|
551 |
fprintf(stderr, "kvm does not support KVM_CAP_SET_TSS_ADDR\n"); |
|
552 |
return ret; |
|
553 |
} |
|
530 |
* must be part of guest physical memory, we need to allocate it. */ |
|
554 | 531 |
|
555 | 532 |
/* this address is 3 pages before the bios, and the bios should present |
556 | 533 |
* as unavaible memory. FIXME, need to ensure the e820 map deals with |
Also available in: Unified diff