From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH V4 1/7] KVM, pkeys: expose CPUID/CR4 to guest Date: Tue, 8 Mar 2016 08:58:14 +0100 Message-ID: <56DE8616.4030107@redhat.com> References: <1457177252-7577-1-git-send-email-huaitong.han@intel.com> <1457177252-7577-2-git-send-email-huaitong.han@intel.com> <56DBD925.1010807@linux.intel.com> <56DCBB30.7010107@redhat.com> <56DE81CB.3040505@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Xiao Guangrong , Huaitong Han , gleb@kernel.org Return-path: Received: from mail-wm0-f65.google.com ([74.125.82.65]:33455 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753489AbcCHH6U (ORCPT ); Tue, 8 Mar 2016 02:58:20 -0500 Received: by mail-wm0-f65.google.com with SMTP id n186so2560857wmn.0 for ; Mon, 07 Mar 2016 23:58:19 -0800 (PST) In-Reply-To: <56DE81CB.3040505@linux.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On 08/03/2016 08:39, Xiao Guangrong wrote: > But i noticed kernel uses the more meaningful name to update > boot_cpu_data.x86_capability[]: > $ git grep x86_capability arch/x86/ > ...... > arch/x86/kernel/cpu/centaur.c: > c->x86_capability[CPUID_C000_0001_EDX] = cpuid_edx(0xC0000001); > arch/x86/kernel/cpu/common.c: c->x86_capability[CPUID_1_ECX] = ecx; > arch/x86/kernel/cpu/common.c: c->x86_capability[CPUID_1_EDX] = edx; > arch/x86/kernel/cpu/common.c: c->x86_capability[CPUID_7_0_EBX] = ebx; > arch/x86/kernel/cpu/common.c: c->x86_capability[CPUID_6_EAX] = cpuid_eax(0x00000006); > arch/x86/kernel/cpu/common.c: c->x86_capability[CPUID_D_1_EAX] = eax; > arch/x86/kernel/cpu/common.c: c->x86_capability[CPUID_F_0_EDX] = edx; > ..... > > Why not follow it in KVM? Oh, indeed. That's fairly new (commit 39c06df4dc10, "x86/cpufeature: Cleanup get_cpu_cap()", 2015-12-07), I had not noticed it. We can change it indeed, but it's probably best to do it only for 4.7. In the meanwhile, for PKRU it's enough to use the right feature number. :) Paolo