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 /drivers/kvm/kvm.h | |
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 'drivers/kvm/kvm.h')
-rw-r--r-- | drivers/kvm/kvm.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index 59cbc5b1d905..be3a0e7ecae4 100644 --- a/drivers/kvm/kvm.h +++ b/drivers/kvm/kvm.h | |||
@@ -55,6 +55,7 @@ | |||
55 | #define KVM_NUM_MMU_PAGES 256 | 55 | #define KVM_NUM_MMU_PAGES 256 |
56 | #define KVM_MIN_FREE_MMU_PAGES 5 | 56 | #define KVM_MIN_FREE_MMU_PAGES 5 |
57 | #define KVM_REFILL_PAGES 25 | 57 | #define KVM_REFILL_PAGES 25 |
58 | #define KVM_MAX_CPUID_ENTRIES 40 | ||
58 | 59 | ||
59 | #define FX_IMAGE_SIZE 512 | 60 | #define FX_IMAGE_SIZE 512 |
60 | #define FX_IMAGE_ALIGN 16 | 61 | #define FX_IMAGE_ALIGN 16 |
@@ -286,6 +287,9 @@ struct kvm_vcpu { | |||
286 | u32 ar; | 287 | u32 ar; |
287 | } tr, es, ds, fs, gs; | 288 | } tr, es, ds, fs, gs; |
288 | } rmode; | 289 | } rmode; |
290 | |||
291 | int cpuid_nent; | ||
292 | struct kvm_cpuid_entry cpuid_entries[KVM_MAX_CPUID_ENTRIES]; | ||
289 | }; | 293 | }; |
290 | 294 | ||
291 | struct kvm_memory_slot { | 295 | struct kvm_memory_slot { |
@@ -446,6 +450,7 @@ void realmode_set_cr(struct kvm_vcpu *vcpu, int cr, unsigned long value, | |||
446 | 450 | ||
447 | struct x86_emulate_ctxt; | 451 | struct x86_emulate_ctxt; |
448 | 452 | ||
453 | void kvm_emulate_cpuid(struct kvm_vcpu *vcpu); | ||
449 | int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address); | 454 | int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address); |
450 | int emulate_clts(struct kvm_vcpu *vcpu); | 455 | int emulate_clts(struct kvm_vcpu *vcpu); |
451 | int emulator_get_dr(struct x86_emulate_ctxt* ctxt, int dr, | 456 | int emulator_get_dr(struct x86_emulate_ctxt* ctxt, int dr, |