aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/kvm_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/kvm/kvm_main.c')
-rw-r--r--drivers/kvm/kvm_main.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 67c1154960f0..b10972ed0c9f 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -272,7 +272,9 @@ static void kvm_free_physmem(struct kvm *kvm)
272 272
273static void kvm_free_vcpu(struct kvm_vcpu *vcpu) 273static void kvm_free_vcpu(struct kvm_vcpu *vcpu)
274{ 274{
275 vcpu_load(vcpu->kvm, vcpu_slot(vcpu));
275 kvm_mmu_destroy(vcpu); 276 kvm_mmu_destroy(vcpu);
277 vcpu_put(vcpu);
276 kvm_arch_ops->vcpu_free(vcpu); 278 kvm_arch_ops->vcpu_free(vcpu);
277} 279}
278 280
@@ -1224,6 +1226,9 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
1224 case MSR_IA32_APICBASE: 1226 case MSR_IA32_APICBASE:
1225 data = vcpu->apic_base; 1227 data = vcpu->apic_base;
1226 break; 1228 break;
1229 case MSR_IA32_MISC_ENABLE:
1230 data = vcpu->ia32_misc_enable_msr;
1231 break;
1227#ifdef CONFIG_X86_64 1232#ifdef CONFIG_X86_64
1228 case MSR_EFER: 1233 case MSR_EFER:
1229 data = vcpu->shadow_efer; 1234 data = vcpu->shadow_efer;
@@ -1295,6 +1300,9 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data)
1295 case MSR_IA32_APICBASE: 1300 case MSR_IA32_APICBASE:
1296 vcpu->apic_base = data; 1301 vcpu->apic_base = data;
1297 break; 1302 break;
1303 case MSR_IA32_MISC_ENABLE:
1304 vcpu->ia32_misc_enable_msr = data;
1305 break;
1298 default: 1306 default:
1299 printk(KERN_ERR "kvm: unhandled wrmsr: 0x%x\n", msr); 1307 printk(KERN_ERR "kvm: unhandled wrmsr: 0x%x\n", msr);
1300 return 1; 1308 return 1;
@@ -1598,6 +1606,10 @@ static u32 msrs_to_save[] = {
1598 1606
1599static unsigned num_msrs_to_save; 1607static unsigned num_msrs_to_save;
1600 1608
1609static u32 emulated_msrs[] = {
1610 MSR_IA32_MISC_ENABLE,
1611};
1612
1601static __init void kvm_init_msr_list(void) 1613static __init void kvm_init_msr_list(void)
1602{ 1614{
1603 u32 dummy[2]; 1615 u32 dummy[2];
@@ -1923,7 +1935,7 @@ static long kvm_dev_ioctl(struct file *filp,
1923 if (copy_from_user(&msr_list, user_msr_list, sizeof msr_list)) 1935 if (copy_from_user(&msr_list, user_msr_list, sizeof msr_list))
1924 goto out; 1936 goto out;
1925 n = msr_list.nmsrs; 1937 n = msr_list.nmsrs;
1926 msr_list.nmsrs = num_msrs_to_save; 1938 msr_list.nmsrs = num_msrs_to_save + ARRAY_SIZE(emulated_msrs);
1927 if (copy_to_user(user_msr_list, &msr_list, sizeof msr_list)) 1939 if (copy_to_user(user_msr_list, &msr_list, sizeof msr_list))
1928 goto out; 1940 goto out;
1929 r = -E2BIG; 1941 r = -E2BIG;
@@ -1933,6 +1945,11 @@ static long kvm_dev_ioctl(struct file *filp,
1933 if (copy_to_user(user_msr_list->indices, &msrs_to_save, 1945 if (copy_to_user(user_msr_list->indices, &msrs_to_save,
1934 num_msrs_to_save * sizeof(u32))) 1946 num_msrs_to_save * sizeof(u32)))
1935 goto out; 1947 goto out;
1948 if (copy_to_user(user_msr_list->indices
1949 + num_msrs_to_save * sizeof(u32),
1950 &emulated_msrs,
1951 ARRAY_SIZE(emulated_msrs) * sizeof(u32)))
1952 goto out;
1936 r = 0; 1953 r = 0;
1937 break; 1954 break;
1938 } 1955 }