aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/svm.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2007-07-31 06:42:42 -0400
committerAvi Kivity <avi@qumranet.com>2007-10-13 04:18:22 -0400
commitbfc733a7a32612fe213a7492c385f2b03f592d7f (patch)
tree74b14d353f1bf2a5420a07dc8a9f7ce1e7b74a7d /drivers/kvm/svm.c
parent7e9d619d2aa28b71d547edfa15c66d6ab9a3a39c (diff)
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: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/svm.c')
-rw-r--r--drivers/kvm/svm.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
index 827bc2774e73..7beaff1789b1 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -359,8 +359,8 @@ err_1:
359 359
360} 360}
361 361
362static int set_msr_interception(u32 *msrpm, unsigned msr, 362static void set_msr_interception(u32 *msrpm, unsigned msr,
363 int read, int write) 363 int read, int write)
364{ 364{
365 int i; 365 int i;
366 366
@@ -375,11 +375,10 @@ static int set_msr_interception(u32 *msrpm, unsigned msr,
375 u32 mask = ((write) ? 0 : 2) | ((read) ? 0 : 1); 375 u32 mask = ((write) ? 0 : 2) | ((read) ? 0 : 1);
376 *base = (*base & ~(0x3 << msr_shift)) | 376 *base = (*base & ~(0x3 << msr_shift)) |
377 (mask << msr_shift); 377 (mask << msr_shift);
378 return 1; 378 return;
379 } 379 }
380 } 380 }
381 printk(KERN_DEBUG "%s: not found 0x%x\n", __FUNCTION__, msr); 381 BUG();
382 return 0;
383} 382}
384 383
385static __init int svm_hardware_setup(void) 384static __init int svm_hardware_setup(void)