[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 04/10] x86/hvm: pkeys, add pkeys support when setting CR4
> -----Original Message----- > From: xen-devel-bounces@xxxxxxxxxxxxx [mailto:xen-devel- > bounces@xxxxxxxxxxxxx] On Behalf Of Huaitong Han > Sent: Monday, November 16, 2015 6:32 PM > To: jbeulich@xxxxxxxx; andrew.cooper3@xxxxxxxxxx; Nakajima, Jun > <jun.nakajima@xxxxxxxxx>; Dong, Eddie <eddie.dong@xxxxxxxxx>; Tian, > Kevin <kevin.tian@xxxxxxxxx>; george.dunlap@xxxxxxxxxxxxx; > ian.jackson@xxxxxxxxxxxxx; stefano.stabellini@xxxxxxxxxxxxx; > ian.campbell@xxxxxxxxxx; wei.liu2@xxxxxxxxxx; keir@xxxxxxx > Cc: Han, Huaitong <huaitong.han@xxxxxxxxx>; xen-devel@xxxxxxxxxxxxx > Subject: [Xen-devel] [PATCH 04/10] x86/hvm: pkeys, add pkeys support when > setting CR4 > > This patch adds pkeys support when setting CR4 > > Signed-off-by: Huaitong Han <huaitong.han@xxxxxxxxx> > > diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c > index 66917ff..953047f 100644 > --- a/xen/arch/x86/hvm/hvm.c > +++ b/xen/arch/x86/hvm/hvm.c > @@ -1911,6 +1911,7 @@ static unsigned long > hvm_cr4_guest_reserved_bits(const struct vcpu *v, > leaf1_edx = boot_cpu_data.x86_capability[X86_FEATURE_VME / 32]; > leaf1_ecx = boot_cpu_data.x86_capability[X86_FEATURE_PCID / 32]; > leaf7_0_ebx = boot_cpu_data.x86_capability[X86_FEATURE_FSGSBASE / > 32]; > + leaf7_0_ecx = boot_cpu_data.x86_capability[X86_FEATURE_PKU / 32]; What is the purpose of the above change? > } > > return ~(unsigned long) > @@ -1946,7 +1947,9 @@ static unsigned long > hvm_cr4_guest_reserved_bits(const struct vcpu *v, > (leaf7_0_ebx & cpufeat_mask(X86_FEATURE_SMEP) ? > X86_CR4_SMEP : 0) | > (leaf7_0_ebx & cpufeat_mask(X86_FEATURE_SMAP) ? > - X86_CR4_SMAP : 0)); > + X86_CR4_SMAP : 0) | > + (leaf7_0_ecx & cpufeat_mask(X86_FEATURE_PKU) ? > + X86_CR4_PKE : 0)); > } > > static int hvm_load_cpu_ctxt(struct domain *d, hvm_domain_context_t *h) > diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c > index c1f924e..8101a1b 100644 > --- a/xen/arch/x86/setup.c > +++ b/xen/arch/x86/setup.c > @@ -1310,6 +1310,8 @@ void __init noreturn __start_xen(unsigned long > mbi_p) > > if ( disable_pku ) > setup_clear_cpu_cap(X86_FEATURE_PKU); > + if ( cpu_has_pku ) > + set_in_cr4(X86_CR4_PKE); As mentioned in [00/10] of this series, we shouldn't set PKE in CR4 for Xen itself. Thanks, Feng > > if ( cpu_has_fsgsbase ) > set_in_cr4(X86_CR4_FSGSBASE); > -- > 2.4.3 > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@xxxxxxxxxxxxx > http://lists.xen.org/xen-devel _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |