summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/virtext.h
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2016-05-09 09:53:06 (GMT)
committerPaolo Bonzini <pbonzini@redhat.com>2016-06-15 22:04:31 (GMT)
commit682a8108872f78560c891cf30c7d08aa01dac943 (patch)
tree5c18518c9a2a3988ca78883e30201c7aac82b261 /arch/x86/include/asm/virtext.h
parent4e10b764e2cba8d8eb5e22d9d8061806ec86805c (diff)
downloadlinux-682a8108872f78560c891cf30c7d08aa01dac943.tar.xz
x86/kvm/svm: Simplify cpu_has_svm()
Use already cached CPUID information instead of querying CPUID again. No functionality change. Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Joerg Roedel <joro@8bytes.org> Cc: kvm@vger.kernel.org Cc: x86@kernel.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/include/asm/virtext.h')
-rw-r--r--arch/x86/include/asm/virtext.h8
1 files changed, 2 insertions, 6 deletions
diff --git a/arch/x86/include/asm/virtext.h b/arch/x86/include/asm/virtext.h
index cce9ee6..0116b2e 100644
--- a/arch/x86/include/asm/virtext.h
+++ b/arch/x86/include/asm/virtext.h
@@ -83,23 +83,19 @@ static inline void cpu_emergency_vmxoff(void)
*/
static inline int cpu_has_svm(const char **msg)
{
- uint32_t eax, ebx, ecx, edx;
-
if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) {
if (msg)
*msg = "not amd";
return 0;
}
- cpuid(0x80000000, &eax, &ebx, &ecx, &edx);
- if (eax < SVM_CPUID_FUNC) {
+ if (boot_cpu_data.extended_cpuid_level < SVM_CPUID_FUNC) {
if (msg)
*msg = "can't execute cpuid_8000000a";
return 0;
}
- cpuid(0x80000001, &eax, &ebx, &ecx, &edx);
- if (!(ecx & (1 << SVM_CPUID_FEATURE_SHIFT))) {
+ if (!boot_cpu_has(X86_FEATURE_SVM)) {
if (msg)
*msg = "svm not available";
return 0;