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.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index be4651abe72c..b10972ed0c9f 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1226,6 +1226,9 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata)
1226 case MSR_IA32_APICBASE: 1226 case MSR_IA32_APICBASE:
1227 data = vcpu->apic_base; 1227 data = vcpu->apic_base;
1228 break; 1228 break;
1229 case MSR_IA32_MISC_ENABLE:
1230 data = vcpu->ia32_misc_enable_msr;
1231 break;
1229#ifdef CONFIG_X86_64 1232#ifdef CONFIG_X86_64
1230 case MSR_EFER: 1233 case MSR_EFER:
1231 data = vcpu->shadow_efer; 1234 data = vcpu->shadow_efer;
@@ -1297,6 +1300,9 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data)
1297 case MSR_IA32_APICBASE: 1300 case MSR_IA32_APICBASE:
1298 vcpu->apic_base = data; 1301 vcpu->apic_base = data;
1299 break; 1302 break;
1303 case MSR_IA32_MISC_ENABLE:
1304 vcpu->ia32_misc_enable_msr = data;
1305 break;
1300 default: 1306 default:
1301 printk(KERN_ERR "kvm: unhandled wrmsr: 0x%x\n", msr); 1307 printk(KERN_ERR "kvm: unhandled wrmsr: 0x%x\n", msr);
1302 return 1; 1308 return 1;
@@ -1600,6 +1606,10 @@ static u32 msrs_to_save[] = {
1600 1606
1601static unsigned num_msrs_to_save; 1607static unsigned num_msrs_to_save;
1602 1608
1609static u32 emulated_msrs[] = {
1610 MSR_IA32_MISC_ENABLE,
1611};
1612
1603static __init void kvm_init_msr_list(void) 1613static __init void kvm_init_msr_list(void)
1604{ 1614{
1605 u32 dummy[2]; 1615 u32 dummy[2];
@@ -1925,7 +1935,7 @@ static long kvm_dev_ioctl(struct file *filp,
1925 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))
1926 goto out; 1936 goto out;
1927 n = msr_list.nmsrs; 1937 n = msr_list.nmsrs;
1928 msr_list.nmsrs = num_msrs_to_save; 1938 msr_list.nmsrs = num_msrs_to_save + ARRAY_SIZE(emulated_msrs);
1929 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))
1930 goto out; 1940 goto out;
1931 r = -E2BIG; 1941 r = -E2BIG;
@@ -1935,6 +1945,11 @@ static long kvm_dev_ioctl(struct file *filp,
1935 if (copy_to_user(user_msr_list->indices, &msrs_to_save, 1945 if (copy_to_user(user_msr_list->indices, &msrs_to_save,
1936 num_msrs_to_save * sizeof(u32))) 1946 num_msrs_to_save * sizeof(u32)))
1937 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;
1938 r = 0; 1953 r = 0;
1939 break; 1954 break;
1940 } 1955 }