Commit bfc733a7 authored by Rusty Russell's avatar Rusty Russell Committed by Avi Kivity

KVM: SVM: Make set_msr_interception more reliable

set_msr_interception() is used by svm to set up which MSRs should be
intercepted.  It can only fail if someone has changed the code to try
to intercept an MSR without updating the array of ranges.

The return value is ignored anyway: it should just BUG() if it doesn't
work.  (A build-time failure would be better, but that's tricky).
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent 7e9d619d
...@@ -359,8 +359,8 @@ static int svm_cpu_init(int cpu) ...@@ -359,8 +359,8 @@ static int svm_cpu_init(int cpu)
} }
static int set_msr_interception(u32 *msrpm, unsigned msr, static void set_msr_interception(u32 *msrpm, unsigned msr,
int read, int write) int read, int write)
{ {
int i; int i;
...@@ -375,11 +375,10 @@ static int set_msr_interception(u32 *msrpm, unsigned msr, ...@@ -375,11 +375,10 @@ static int set_msr_interception(u32 *msrpm, unsigned msr,
u32 mask = ((write) ? 0 : 2) | ((read) ? 0 : 1); u32 mask = ((write) ? 0 : 2) | ((read) ? 0 : 1);
*base = (*base & ~(0x3 << msr_shift)) | *base = (*base & ~(0x3 << msr_shift)) |
(mask << msr_shift); (mask << msr_shift);
return 1; return;
} }
} }
printk(KERN_DEBUG "%s: not found 0x%x\n", __FUNCTION__, msr); BUG();
return 0;
} }
static __init int svm_hardware_setup(void) static __init int svm_hardware_setup(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment