diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2007-06-22 05:29:50 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-07-16 05:05:49 -0400 |
commit | 6031a61c2ef4cf22b69ef5494aefa54b84a27d2f (patch) | |
tree | 2e0ccd861da726e76785a0a68a46da06951f1eb0 /drivers/kvm/svm.c | |
parent | 796fd1b23e463e98b3e2fc86ed571db06dc945bb (diff) |
KVM: SVM: Reliably detect if SVM was disabled by BIOS
This patch adds an implementation to the svm is_disabled function to
detect reliably if the BIOS disabled the SVM feature in the CPU. This
fixes the issues with kernel panics when loading the kvm-amd module on
machines where SVM is available but disabled.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/svm.c')
-rw-r--r-- | drivers/kvm/svm.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index 62ec38c7027b..a0d442883e17 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c | |||
@@ -1735,6 +1735,12 @@ static void svm_inject_page_fault(struct kvm_vcpu *vcpu, | |||
1735 | 1735 | ||
1736 | static int is_disabled(void) | 1736 | static int is_disabled(void) |
1737 | { | 1737 | { |
1738 | u64 vm_cr; | ||
1739 | |||
1740 | rdmsrl(MSR_VM_CR, vm_cr); | ||
1741 | if (vm_cr & (1 << SVM_VM_CR_SVM_DISABLE)) | ||
1742 | return 1; | ||
1743 | |||
1738 | return 0; | 1744 | return 0; |
1739 | } | 1745 | } |
1740 | 1746 | ||