From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Feng Wu <feng.wu@intel.com>
Cc: kevin.tian@intel.com, ian.campbell@citrix.com,
eddie.dong@intel.com, xen-devel@lists.xen.org, JBeulich@suse.com,
jun.nakajima@intel.com
Subject: Re: [PATCH v2 6/7] x86/hvm: Add SMAP support to HVM guest
Date: Wed, 23 Apr 2014 11:49:25 +0100 [thread overview]
Message-ID: <53579AB5.9030809@citrix.com> (raw)
In-Reply-To: <1398263874-32227-1-git-send-email-feng.wu@intel.com>
On 23/04/14 15:37, Feng Wu wrote:
>
> /* Go back and set accessed and dirty bits only if the walk was a
> diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h
> index 74a09ef..8dbb3f0 100644
> --- a/xen/include/asm-x86/hvm/hvm.h
> +++ b/xen/include/asm-x86/hvm/hvm.h
> @@ -257,6 +257,8 @@ int hvm_girq_dest_2_vcpu_id(struct domain *d, uint8_t dest, uint8_t dest_mode);
> (hvm_paging_enabled(v) && ((v)->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PAE))
> #define hvm_smep_enabled(v) \
> (hvm_paging_enabled(v) && ((v)->arch.hvm_vcpu.guest_cr[4] & X86_CR4_SMEP))
> +#define hvm_smap_enabled(v) \
> + (hvm_paging_enabled(v) && ((v)->arch.hvm_vcpu.guest_cr[4] & X86_CR4_SMAP))
> #define hvm_nx_enabled(v) \
> (!!((v)->arch.hvm_vcpu.guest_efer & EFER_NX))
>
> @@ -360,6 +362,15 @@ static inline bool_t hvm_vcpu_has_smep(void)
> return !!(ebx & cpufeat_mask(X86_FEATURE_SMEP));
> }
>
> +static inline bool_t hvm_vcpu_has_smap(void)
> +{
> + unsigned int ebx = 0, leaf = 0x7;
> +
> + hvm_cpuid(leaf, NULL, &ebx, NULL, NULL);
Same review as the SMEP fix earlier in the series.
~Andrew
> +
> + return !!(ebx & cpufeat_mask(X86_FEATURE_SMAP));
> +}
> +
> /* These reserved bits in lower 32 remain 0 after any load of CR0 */
> #define HVM_CR0_GUEST_RESERVED_BITS \
> (~((unsigned long) \
> @@ -380,6 +391,7 @@ static inline bool_t hvm_vcpu_has_smep(void)
> X86_CR4_MCE | X86_CR4_PGE | X86_CR4_PCE | \
> X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT | \
> (hvm_vcpu_has_smep() ? X86_CR4_SMEP : 0) | \
> + (hvm_vcpu_has_smap() ? X86_CR4_SMAP : 0) | \
> (cpu_has_fsgsbase ? X86_CR4_FSGSBASE : 0) | \
> ((nestedhvm_enabled((_v)->domain) && cpu_has_vmx)\
> ? X86_CR4_VMXE : 0) | \
prev parent reply other threads:[~2014-04-23 10:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-23 14:37 [PATCH v2 6/7] x86/hvm: Add SMAP support to HVM guest Feng Wu
2014-04-23 10:49 ` Jan Beulich
2014-04-24 8:19 ` Wu, Feng
2014-04-24 8:27 ` Jan Beulich
2014-04-24 8:37 ` Wu, Feng
2014-04-23 10:49 ` Andrew Cooper [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53579AB5.9030809@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=eddie.dong@intel.com \
--cc=feng.wu@intel.com \
--cc=ian.campbell@citrix.com \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@intel.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.