From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH RFC v1 2/2] hyper-v: initialize Hyper-V CPUID leafs. Date: Mon, 17 Oct 2011 11:40:38 +0200 Message-ID: <4E9BF816.3010205@redhat.com> References: <1318843022-20344-1-git-send-email-vrozenfe@redhat.com> <1318843022-20344-3-git-send-email-vrozenfe@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit To: "kvm@vger.kernel.org" , qemu-devel , Avi Kivity Return-path: Received: from mail-gy0-f174.google.com ([209.85.160.174]:33647 "EHLO mail-gy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751893Ab1JQJko (ORCPT ); Mon, 17 Oct 2011 05:40:44 -0400 Received: by gyb13 with SMTP id 13so2765439gyb.19 for ; Mon, 17 Oct 2011 02:40:44 -0700 (PDT) In-Reply-To: <1318843022-20344-3-git-send-email-vrozenfe@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 10/17/2011 11:17 AM, Vadim Rozenfeld wrote: > @@ -379,11 +380,16 @@ int kvm_arch_init_vcpu(CPUState *env) > cpuid_i = 0; > > /* Paravirtualization CPUIDs */ > - memcpy(signature, "KVMKVMKVM\0\0\0", 12); > c =&cpuid_data.entries[cpuid_i++]; > memset(c, 0, sizeof(*c)); > c->function = KVM_CPUID_SIGNATURE; > - c->eax = 0; > + if (!hyperv_enabled()) { > + memcpy(signature, "KVMKVMKVM\0\0\0", 12); > + c->eax = 0; > + } else { > + memcpy(signature, "Microsoft Hv", 12); > + c->eax = HYPERV_CPUID_MIN; > + } Even not counting that hyper-v support should IMHO not be in KVM-specific code, I still think this shouldn't remove KVM leaves completely but rather move them to 0x40000100. The KVM paravirtualization code then can similarly probe with 0x100 stride up to 0x40001000. This is what was done for Xen, and it allows to enable enlightenments independent of whether the guest is Linux or Windows. However, let's get a third opinion---Avi, what do you think? Paolo From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51781) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFjgc-0007Ad-2S for qemu-devel@nongnu.org; Mon, 17 Oct 2011 05:40:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RFjgb-00073h-2w for qemu-devel@nongnu.org; Mon, 17 Oct 2011 05:40:46 -0400 Received: from mail-yx0-f174.google.com ([209.85.213.174]:45077) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFjga-00073U-SL for qemu-devel@nongnu.org; Mon, 17 Oct 2011 05:40:45 -0400 Received: by yxp4 with SMTP id 4so3538979yxp.5 for ; Mon, 17 Oct 2011 02:40:44 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4E9BF816.3010205@redhat.com> Date: Mon, 17 Oct 2011 11:40:38 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1318843022-20344-1-git-send-email-vrozenfe@redhat.com> <1318843022-20344-3-git-send-email-vrozenfe@redhat.com> In-Reply-To: <1318843022-20344-3-git-send-email-vrozenfe@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH RFC v1 2/2] hyper-v: initialize Hyper-V CPUID leafs. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "kvm@vger.kernel.org" , qemu-devel , Avi Kivity On 10/17/2011 11:17 AM, Vadim Rozenfeld wrote: > @@ -379,11 +380,16 @@ int kvm_arch_init_vcpu(CPUState *env) > cpuid_i = 0; > > /* Paravirtualization CPUIDs */ > - memcpy(signature, "KVMKVMKVM\0\0\0", 12); > c =&cpuid_data.entries[cpuid_i++]; > memset(c, 0, sizeof(*c)); > c->function = KVM_CPUID_SIGNATURE; > - c->eax = 0; > + if (!hyperv_enabled()) { > + memcpy(signature, "KVMKVMKVM\0\0\0", 12); > + c->eax = 0; > + } else { > + memcpy(signature, "Microsoft Hv", 12); > + c->eax = HYPERV_CPUID_MIN; > + } Even not counting that hyper-v support should IMHO not be in KVM-specific code, I still think this shouldn't remove KVM leaves completely but rather move them to 0x40000100. The KVM paravirtualization code then can similarly probe with 0x100 stride up to 0x40001000. This is what was done for Xen, and it allows to enable enlightenments independent of whether the guest is Linux or Windows. However, let's get a third opinion---Avi, what do you think? Paolo