All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>,
	gleb@redhat.com, tglx@linutronix.de, mingo@redhat.com,
	x86@kernel.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Vadim Rozenfeld <vrozenfe@redhat.com>,
	"K. Y. Srinivasan" <kys@microsoft.com>
Subject: Re: [PATCH] x86: properly handle KVM emulation of hyperv
Date: Fri, 19 Jul 2013 13:59:02 -0700	[thread overview]
Message-ID: <51E9A896.8070408@zytor.com> (raw)
In-Reply-To: <51E92CAB.7020906@redhat.com>

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

  reply	other threads:[~2013-07-19 20:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19 10:25 [PATCH] x86: properly handle KVM emulation of hyperv Jason Wang
2013-07-19 12:10 ` Paolo Bonzini
2013-07-19 20:59   ` H. Peter Anvin [this message]
2013-07-19 21:00     ` Paolo Bonzini
2013-07-19 21:03       ` H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51E9A896.8070408@zytor.com \
    --to=hpa@zytor.com \
    --cc=gleb@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=vrozenfe@redhat.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.