From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: [PATCH V4 6/6] x86/hvm: pkeys, add pkeys support for cpuid handling Date: Mon, 21 Dec 2015 08:07:42 -0700 Message-ID: <567823CE02000078000C1F87@prv-mh.provo.novell.com> References: <1450682504-32286-1-git-send-email-huaitong.han@intel.com> <1450682504-32286-7-git-send-email-huaitong.han@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1450682504-32286-7-git-send-email-huaitong.han@intel.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Huaitong Han Cc: kevin.tian@intel.com, 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, jun.nakajima@intel.com, keir@xen.org List-Id: xen-devel@lists.xenproject.org >>> 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. > + 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