From: "Jan Beulich" Subject: Re: [PATCH] x86/vmx: correct the SMEP logic for HVM_CR0_GUEST_RESERVED_BITS Date: Wed, 23 Apr 2014 11:05:33 +0100 Message-ID: <5357AC8D020000780000B4D0@nat28.tlf.novell.com> References: <1398263547-31877-1-git-send-email-feng.wu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1398263547-31877-1-git-send-email-feng.wu@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: Feng Wu Cc: kevin.tian@intel.com, ian.campbell@citrix.com, andrew.cooper3@citrix.com, eddie.dong@intel.com, xen-devel@lists.xen.org, jun.nakajima@intel.com List-Id: xen-devel@lists.xenproject.org >>> On 23.04.14 at 16:32, wrote: > --- a/xen/include/asm-x86/hvm/hvm.h > +++ b/xen/include/asm-x86/hvm/hvm.h > @@ -351,6 +351,15 @@ static inline int hvm_event_pending(struct vcpu *v) > return hvm_funcs.event_pending(v); > } > > +static inline bool_t hvm_vcpu_has_smep(void) > +{ > + unsigned int ebx = 0, leaf = 0x7; Pointless initializer for ebx, and pointless variable leaf. > + hvm_cpuid(leaf, NULL, &ebx, NULL, NULL); And, as I just saw Andrew already pointed out, this needs gating on there being a (visible) leaf 7 in the first place. Jan