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: Mon, 7 Mar 2016 00:20:16 +0100 Message-ID: <56DCBB30.7010107@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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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]:34638 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751510AbcCFXUY (ORCPT ); Sun, 6 Mar 2016 18:20:24 -0500 Received: by mail-wm0-f65.google.com with SMTP id p65so7967443wmp.1 for ; Sun, 06 Mar 2016 15:20:23 -0800 (PST) In-Reply-To: <56DBD925.1010807@linux.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On 06/03/2016 08:15, Xiao Guangrong wrote: >> + /* cpuid 7.0.ecx*/ >> + const u32 kvm_supported_word11_x86_features = F(PKU) | 0 /*OSPKE*/; >> + >> >> cpuid_mask(&entry->ebx, 9); >> // TSC_ADJUST is emulated >> entry->ebx |= F(TSC_ADJUST); >> - } else >> + entry->ecx &= kvm_supported_word11_x86_features; >> + cpuid_mask(&entry->ecx, 13); > > Can we use a meaningful name defined by cpuid_leafs instead of the raw > number? This is not a cpuid leaf number, it's the Linux feature word number. In other words, the "11" in kvm_supported_word11_x86_features should have matched the "13" in cpuid_mask(&entry->ecx, 13). However, looking at http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/arch/x86/include/asm/cpufeatures.h I see that all word numbers until 15 are taken, and PKE is not found anywhere. What's going on? Thanks, Paolo