From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752498Ab3GSU7T (ORCPT ); Fri, 19 Jul 2013 16:59:19 -0400 Received: from terminus.zytor.com ([198.137.202.10]:48214 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751224Ab3GSU7S (ORCPT ); Fri, 19 Jul 2013 16:59:18 -0400 Message-ID: <51E9A896.8070408@zytor.com> Date: Fri, 19 Jul 2013 13:59:02 -0700 From: "H. Peter Anvin" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Paolo Bonzini CC: Jason Wang , gleb@redhat.com, tglx@linutronix.de, mingo@redhat.com, x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Vadim Rozenfeld , "K. Y. Srinivasan" Subject: Re: [PATCH] x86: properly handle KVM emulation of hyperv References: <1374229505-19470-1-git-send-email-jasowang@redhat.com> <51E92CAB.7020906@redhat.com> In-Reply-To: <51E92CAB.7020906@redhat.com> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/19/2013 05:10 AM, Paolo Bonzini wrote: >> + >> +static inline bool kvm_para_available(void) >> +{ >> if (boot_cpu_data.cpuid_level < 0) >> return false; /* So we don't blow up on old processors */ >> >> if (cpu_has_hypervisor) { >> - cpuid(KVM_CPUID_SIGNATURE, &eax, &ebx, &ecx, &edx); >> - memcpy(signature + 0, &ebx, 4); >> - memcpy(signature + 4, &ecx, 4); >> - memcpy(signature + 8, &edx, 4); >> - signature[12] = 0; >> - >> - if (strcmp(signature, "KVMKVMKVM") == 0) >> + if (kvm_para_available_function(KVM_CPUID_SIGNATURE) || >> + kvm_para_available_function(KVM_CPUID_SIGNATURE_NEXT)) >> return true; >> } > > Nice catch. Just one small thing, you should loop until 0x40010000, as > done in arch/x86/include/asm/xen/hypervisor.h, in case one day a third > hypervisor implements three extensions (Hyper-V, KVM and its own set). > Any way we can centralize this stuff? -hpa