From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Han, Huaitong" Subject: Re: [PATCH V4 6/6] x86/hvm: pkeys, add pkeys support for cpuid handling Date: Tue, 22 Dec 2015 02:54:38 +0000 Message-ID: <1450752885.4024.4.camel@intel.com> References: <1450682504-32286-1-git-send-email-huaitong.han@intel.com> <1450682504-32286-7-git-send-email-huaitong.han@intel.com> <567823CE02000078000C1F87@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <567823CE02000078000C1F87@prv-mh.provo.novell.com> Content-Language: en-US Content-ID: <68255F4FCDF54E4FBB210D717A41DF40@intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: "JBeulich@suse.com" Cc: "Tian, Kevin" , "wei.liu2@citrix.com" , "ian.campbell@citrix.com" , "stefano.stabellini@eu.citrix.com" , "george.dunlap@eu.citrix.com" , "andrew.cooper3@citrix.com" , "ian.jackson@eu.citrix.com" , "xen-devel@lists.xen.org" , "Nakajima, Jun" , "keir@xen.org" List-Id: xen-devel@lists.xenproject.org On Mon, 2015-12-21 at 08:07 -0700, Jan Beulich wrote: > > > > On 21.12.15 at 08:21, wrote: > > @@ -4600,6 +4600,14 @@ void hvm_cpuid(unsigned int input, unsigned > > int *eax, unsigned int *ebx, > > /* Don't expose INVPCID to non-hap hvm. */ > > if ( (count == 0) && !hap_enabled(d) ) > > *ebx &= ~cpufeat_mask(X86_FEATURE_INVPCID); > > + > > + /* X86_FEATURE_PKU is not yet implemented for shadow > > paging. */ > > + if ( (count == 0) && !hap_enabled(d) ) > > + *ecx &= ~cpufeat_mask(X86_FEATURE_PKU); > > I'm still missing the xsave dependency here. Xsave dependency deletion becasue we use RDPKRU to get PKRU register value instead of XSAVE now. > > > + if ( (count == 0) && (*ecx & > > cpufeat_mask(X86_FEATURE_PKU)) ) > > + *ecx |= (v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PKE) ? > > + cpufeat_mask(X86_FEATURE_OSPKE) : 0; > > Also all (would now be 6!) count == 0 dependencies should be > combined instead of repeating that condition so many times. > > Jan >