aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-01-26 03:56:40 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-01-26 16:50:57 -0500
commit6f00e68f210c0407dd666743ce61ae543cfd509d (patch)
tree03abbd7c7c2dbda3316e4f2db61adc20a0366062 /drivers
parentbce66ca4a2f695509e1b021311eb4de1e4fdf3e4 (diff)
[PATCH] KVM: Emulate IA32_MISC_ENABLE msr
This allows netbsd 3.1 i386 to get further along installing. Signed-off-by: Avi Kivity <avi@qumranet.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/kvm/kvm.h1
-rw-r--r--drivers/kvm/kvm_main.c17
2 files changed, 17 insertions, 1 deletions
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index 91e0c75aca8f..2db1ca4c6800 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -242,6 +242,7 @@ struct kvm_vcpu {
242 u64 pdptrs[4]; /* pae */ 242 u64 pdptrs[4]; /* pae */
243 u64 shadow_efer; 243 u64 shadow_efer;
244 u64 apic_base; 244 u64 apic_base;
245 u64 ia32_misc_enable_msr;
245 int nmsrs; 246 int nmsrs;
246 struct vmx_msr_entry *guest_msrs; 247 struct vmx_msr_entry *guest_msrs;
247 struct vmx_msr_entry *host_msrs; 248 struct vmx_msr_entry *host_msrs;
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 }