[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 06/28] xen/x86: Mask out unknown features from Xen's capabilities



On Tue, Mar 15, 2016 at 03:35:02PM +0000, Andrew Cooper wrote:
> If Xen doesn't know about a feature, it is unsafe for use and should be
> deliberately hidden from Xen's capabilities.
> 
> This doesn't make a practical difference yet, but will make a difference
> later when the guest featuresets are seeded from the host featureset.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Acked-by: Jan Beulich <JBeulich@xxxxxxxx>
> ---
> v2:
>  * Reduced substantially from v1, by using the autogenerated information.
> ---
>  xen/arch/x86/Makefile            |  1 +
>  xen/arch/x86/cpu/common.c        |  3 +++
>  xen/arch/x86/cpuid.c             | 20 ++++++++++++++++++++
>  xen/include/asm-x86/cpufeature.h |  4 +---
>  xen/include/asm-x86/cpuid.h      | 25 +++++++++++++++++++++++++
>  xen/tools/gen-cpuid.py           | 24 ++++++++++++++++++++++++
>  6 files changed, 74 insertions(+), 3 deletions(-)
>  create mode 100644 xen/arch/x86/cpuid.c
>  create mode 100644 xen/include/asm-x86/cpuid.h
> 
> diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
> index 1bcb08b..729065b 100644
> --- a/xen/arch/x86/Makefile
> +++ b/xen/arch/x86/Makefile
> @@ -12,6 +12,7 @@ obj-y += bitops.o
>  obj-bin-y += bzimage.init.o
>  obj-bin-y += clear_page.o
>  obj-bin-y += copy_page.o
> +obj-y += cpuid.o
>  obj-y += compat.o x86_64/compat.o
>  obj-$(CONFIG_KEXEC) += crash.o
>  obj-y += debug.o
> diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
> index 1a278b1..cd168c8 100644
> --- a/xen/arch/x86/cpu/common.c
> +++ b/xen/arch/x86/cpu/common.c
> @@ -341,6 +341,9 @@ void identify_cpu(struct cpuinfo_x86 *c)
>        * The vendor-specific functions might have changed features.  Now
>        * we do "generic changes."
>        */
> +     for (i = 0; i < FSCAPINTS; ++i) {
> +             c->x86_capability[i] &= known_features[i];
> +     }

You probably don't need those { }

>  
>       for (i = 0 ; i < NCAPINTS ; ++i)
>               c->x86_capability[i] &= ~cleared_caps[i];

Otherwise Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.