diff options
author | Avi Kivity <avi@qumranet.com> | 2007-02-28 13:46:53 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-05-03 03:52:23 -0400 |
commit | 06465c5a3aa9948a7b00af49cd22ed8f235cdb0f (patch) | |
tree | 2a21941ae6f28445abbb3cc80dd3416cf2241b8d /include | |
parent | 46fc1477887c41c8e900f2c95485e222b9a54822 (diff) |
KVM: Handle cpuid in the kernel instead of punting to userspace
KVM used to handle cpuid by letting userspace decide what values to
return to the guest. We now handle cpuid completely in the kernel. We
still let userspace decide which values the guest will see by having
userspace set up the value table beforehand (this is necessary to allow
management software to set the cpu features to the least common denominator,
so that live migration can work).
The motivation for the change is that kvm kernel code can be impacted by
cpuid features, for example the x86 emulator.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/kvm.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index 19aeb3385188..15e23bc06e8b 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -41,7 +41,6 @@ enum kvm_exit_reason { | |||
41 | KVM_EXIT_UNKNOWN = 0, | 41 | KVM_EXIT_UNKNOWN = 0, |
42 | KVM_EXIT_EXCEPTION = 1, | 42 | KVM_EXIT_EXCEPTION = 1, |
43 | KVM_EXIT_IO = 2, | 43 | KVM_EXIT_IO = 2, |
44 | KVM_EXIT_CPUID = 3, | ||
45 | KVM_EXIT_DEBUG = 4, | 44 | KVM_EXIT_DEBUG = 4, |
46 | KVM_EXIT_HLT = 5, | 45 | KVM_EXIT_HLT = 5, |
47 | KVM_EXIT_MMIO = 6, | 46 | KVM_EXIT_MMIO = 6, |
@@ -210,6 +209,22 @@ struct kvm_dirty_log { | |||
210 | }; | 209 | }; |
211 | }; | 210 | }; |
212 | 211 | ||
212 | struct kvm_cpuid_entry { | ||
213 | __u32 function; | ||
214 | __u32 eax; | ||
215 | __u32 ebx; | ||
216 | __u32 ecx; | ||
217 | __u32 edx; | ||
218 | __u32 padding; | ||
219 | }; | ||
220 | |||
221 | /* for KVM_SET_CPUID */ | ||
222 | struct kvm_cpuid { | ||
223 | __u32 nent; | ||
224 | __u32 padding; | ||
225 | struct kvm_cpuid_entry entries[0]; | ||
226 | }; | ||
227 | |||
213 | #define KVMIO 0xAE | 228 | #define KVMIO 0xAE |
214 | 229 | ||
215 | /* | 230 | /* |
@@ -243,5 +258,6 @@ struct kvm_dirty_log { | |||
243 | #define KVM_DEBUG_GUEST _IOW(KVMIO, 9, struct kvm_debug_guest) | 258 | #define KVM_DEBUG_GUEST _IOW(KVMIO, 9, struct kvm_debug_guest) |
244 | #define KVM_GET_MSRS _IOWR(KVMIO, 13, struct kvm_msrs) | 259 | #define KVM_GET_MSRS _IOWR(KVMIO, 13, struct kvm_msrs) |
245 | #define KVM_SET_MSRS _IOW(KVMIO, 14, struct kvm_msrs) | 260 | #define KVM_SET_MSRS _IOW(KVMIO, 14, struct kvm_msrs) |
261 | #define KVM_SET_CPUID _IOW(KVMIO, 17, struct kvm_cpuid) | ||
246 | 262 | ||
247 | #endif | 263 | #endif |