]> err.no Git - linux-2.6/commitdiff
KVM: SVM: Make set_msr_interception more reliable
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 31 Jul 2007 10:42:42 +0000 (20:42 +1000)
committerAvi Kivity <avi@qumranet.com>
Sat, 13 Oct 2007 08:18:22 +0000 (10:18 +0200)
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>
drivers/kvm/svm.c

index 827bc2774e739e229a87c17a11c50d0e309a1be0..7beaff1789b1aa67ded08f5e74bbbdc6cf804d1f 100644 (file)
@@ -359,8 +359,8 @@ err_1:
 
 }
 
-static int set_msr_interception(u32 *msrpm, unsigned msr,
-                               int read, int write)
+static void set_msr_interception(u32 *msrpm, unsigned msr,
+                                int read, int write)
 {
        int i;
 
@@ -375,11 +375,10 @@ static int set_msr_interception(u32 *msrpm, unsigned msr,
                        u32 mask = ((write) ? 0 : 2) | ((read) ? 0 : 1);
                        *base = (*base & ~(0x3 << msr_shift)) |
                                (mask << msr_shift);
-                       return 1;
+                       return;
                }
        }
-       printk(KERN_DEBUG "%s: not found 0x%x\n", __FUNCTION__, msr);
-       return 0;
+       BUG();
 }
 
 static __init int svm_hardware_setup(void)