diff options
Diffstat (limited to 'drivers/kvm')
-rw-r--r-- | drivers/kvm/kvm_svm.h | 3 | ||||
-rw-r--r-- | drivers/kvm/svm.c | 5 | ||||
-rw-r--r-- | drivers/kvm/vmx.c | 3 |
3 files changed, 7 insertions, 4 deletions
diff --git a/drivers/kvm/kvm_svm.h b/drivers/kvm/kvm_svm.h index 74cc862f4935..624f1ca48657 100644 --- a/drivers/kvm/kvm_svm.h +++ b/drivers/kvm/kvm_svm.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef __KVM_SVM_H | 1 | #ifndef __KVM_SVM_H |
2 | #define __KVM_SVM_H | 2 | #define __KVM_SVM_H |
3 | 3 | ||
4 | #include <linux/kernel.h> | ||
4 | #include <linux/types.h> | 5 | #include <linux/types.h> |
5 | #include <linux/list.h> | 6 | #include <linux/list.h> |
6 | #include <asm/msr.h> | 7 | #include <asm/msr.h> |
@@ -18,7 +19,7 @@ static const u32 host_save_msrs[] = { | |||
18 | MSR_IA32_LASTBRANCHTOIP, MSR_IA32_LASTINTFROMIP,MSR_IA32_LASTINTTOIP,*/ | 19 | MSR_IA32_LASTBRANCHTOIP, MSR_IA32_LASTINTFROMIP,MSR_IA32_LASTINTTOIP,*/ |
19 | }; | 20 | }; |
20 | 21 | ||
21 | #define NR_HOST_SAVE_MSRS (sizeof(host_save_msrs) / sizeof(*host_save_msrs)) | 22 | #define NR_HOST_SAVE_MSRS ARRAY_SIZE(host_save_msrs) |
22 | #define NUM_DB_REGS 4 | 23 | #define NUM_DB_REGS 4 |
23 | 24 | ||
24 | struct vcpu_svm { | 25 | struct vcpu_svm { |
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index 31836444bc62..72cac0488b31 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c | |||
@@ -15,6 +15,7 @@ | |||
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/kernel.h> | ||
18 | #include <linux/vmalloc.h> | 19 | #include <linux/vmalloc.h> |
19 | #include <linux/highmem.h> | 20 | #include <linux/highmem.h> |
20 | #include <linux/profile.h> | 21 | #include <linux/profile.h> |
@@ -75,7 +76,7 @@ struct svm_init_data { | |||
75 | 76 | ||
76 | static u32 msrpm_ranges[] = {0, 0xc0000000, 0xc0010000}; | 77 | static u32 msrpm_ranges[] = {0, 0xc0000000, 0xc0010000}; |
77 | 78 | ||
78 | #define NUM_MSR_MAPS (sizeof(msrpm_ranges) / sizeof(*msrpm_ranges)) | 79 | #define NUM_MSR_MAPS ARRAY_SIZE(msrpm_ranges) |
79 | #define MSRS_RANGE_SIZE 2048 | 80 | #define MSRS_RANGE_SIZE 2048 |
80 | #define MSRS_IN_RANGE (MSRS_RANGE_SIZE * 8 / 2) | 81 | #define MSRS_IN_RANGE (MSRS_RANGE_SIZE * 8 / 2) |
81 | 82 | ||
@@ -1297,7 +1298,7 @@ static int handle_exit(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
1297 | __FUNCTION__, vcpu->svm->vmcb->control.exit_int_info, | 1298 | __FUNCTION__, vcpu->svm->vmcb->control.exit_int_info, |
1298 | exit_code); | 1299 | exit_code); |
1299 | 1300 | ||
1300 | if (exit_code >= sizeof(svm_exit_handlers) / sizeof(*svm_exit_handlers) | 1301 | if (exit_code >= ARRAY_SIZE(svm_exit_handlers) |
1301 | || svm_exit_handlers[exit_code] == 0) { | 1302 | || svm_exit_handlers[exit_code] == 0) { |
1302 | kvm_run->exit_reason = KVM_EXIT_UNKNOWN; | 1303 | kvm_run->exit_reason = KVM_EXIT_UNKNOWN; |
1303 | printk(KERN_ERR "%s: 0x%x @ 0x%llx cr0 0x%lx rflags 0x%llx\n", | 1304 | printk(KERN_ERR "%s: 0x%x @ 0x%llx cr0 0x%lx rflags 0x%llx\n", |
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index e02c59807a7e..d1198e2b2b5d 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "vmx.h" | 19 | #include "vmx.h" |
20 | #include "kvm_vmx.h" | 20 | #include "kvm_vmx.h" |
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/kernel.h> | ||
22 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
23 | #include <linux/highmem.h> | 24 | #include <linux/highmem.h> |
24 | #include <linux/profile.h> | 25 | #include <linux/profile.h> |
@@ -75,7 +76,7 @@ static const u32 vmx_msr_index[] = { | |||
75 | #endif | 76 | #endif |
76 | MSR_EFER, MSR_K6_STAR, | 77 | MSR_EFER, MSR_K6_STAR, |
77 | }; | 78 | }; |
78 | #define NR_VMX_MSR (sizeof(vmx_msr_index) / sizeof(*vmx_msr_index)) | 79 | #define NR_VMX_MSR ARRAY_SIZE(vmx_msr_index) |
79 | 80 | ||
80 | static inline int is_page_fault(u32 intr_info) | 81 | static inline int is_page_fault(u32 intr_info) |
81 | { | 82 | { |