Skip to contentSkip to conversation

x86, kvm: KVM paravirt kernels don' t check for CPUID being unavailable

tip:x86/urgent tip-bot for Alan Cox 1 participant 1 message May 14, 2012 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20120514174059.30236.1064.stgit@bluebook

#1 lore raw
Commit-ID:  c3709e6734daa4d9b37fe31592ebb0eb57bae1bb
Gitweb:     http://git.kernel.org/tip/c3709e6734daa4d9b37fe31592ebb0eb57bae1bb
Author:     Alan Cox <[email protected]>
AuthorDate: Mon, 14 May 2012 18:41:09 +0100
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Mon, 14 May 2012 10:49:32 -0700

x86, kvm: KVM paravirt kernels don't check for CPUID being unavailable

We set cpuid_level to -1 if there is no CPUID instruction (only possible on i386).

Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=12122

Cc Avi Kivity <[email protected]>
Cc Marcelo Tosatti <[email protected]>
---
 arch/x86/include/asm/kvm_para.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
arch/x86/include/asm/kvm_para.h +3 -0
index 734c376..183922e 100644
@@ -170,6 +170,9 @@ static inline int kvm_para_available(void)
 	unsigned int eax, ebx, ecx, edx;
 	char signature[13];
 
+	if (boot_cpu_data.cpuid_level < 0)
+		return 0;	/* So we don't blow up on old processors */
+
 	cpuid(KVM_CPUID_SIGNATURE, &eax, &ebx, &ecx, &edx);
 	memcpy(signature + 0, &ebx, 4);
 	memcpy(signature + 4, &ecx, 4);