From 9df56f19a500bea90d160be1bf77e4fbcd204d3f Mon Sep 17 00:00:00 2001 From: Jason Wang Date: Thu, 25 Jul 2013 16:54:35 +0800 Subject: x86: Correctly detect hypervisor We try to handle the hypervisor compatibility mode by detecting hypervisor through a specific order. This is not robust, since hypervisors may implement each others features. This patch tries to handle this situation by always choosing the last one in the CPUID leaves. This is done by letting .detect() return a priority instead of true/false and just re-using the CPUID leaf where the signature were found as the priority (or 1 if it was found by DMI). Then we can just pick hypervisor who has the highest priority. Other sophisticated detection method could also be implemented on top. Suggested by H. Peter Anvin and Paolo Bonzini. Acked-by: K. Y. Srinivasan Cc: Haiyang Zhang Cc: Konrad Rzeszutek Wilk Cc: Jeremy Fitzhardinge Cc: Doug Covelli Cc: Borislav Petkov Cc: Dan Hecht Cc: Paul Gortmaker Cc: Marcelo Tosatti Cc: Gleb Natapov Cc: Paolo Bonzini Cc: Frederic Weisbecker Signed-off-by: Jason Wang Link: http://lkml.kernel.org/r/1374742475-2485-4-git-send-email-jasowang@redhat.com Signed-off-by: H. Peter Anvin --- arch/x86/include/asm/hypervisor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/x86/include/asm/hypervisor.h') diff --git a/arch/x86/include/asm/hypervisor.h b/arch/x86/include/asm/hypervisor.h index 2d4b5e6107cd..e42f758a0fbd 100644 --- a/arch/x86/include/asm/hypervisor.h +++ b/arch/x86/include/asm/hypervisor.h @@ -33,7 +33,7 @@ struct hypervisor_x86 { const char *name; /* Detection routine */ - bool (*detect)(void); + uint32_t (*detect)(void); /* Adjust CPU feature bits (run once per CPU) */ void (*set_cpu_features)(struct cpuinfo_x86 *); -- cgit v1.2.3