[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC 06/31] xen/x86: Infrastructure to calculate guest featuresets
Guest featuresets are seeded from the host featureset, and the host featureset has calculated in the front of boot_cpu_data.x86_capability. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: Jan Beulich <JBeulich@xxxxxxxx> --- xen/arch/x86/Makefile | 1 + xen/arch/x86/cpuid.c | 23 +++++++++++++++++++++++ xen/arch/x86/setup.c | 3 +++ xen/include/asm-x86/cpuid.h | 22 ++++++++++++++++++++++ 4 files changed, 49 insertions(+) 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 122cbe9..c1f6f73 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -15,6 +15,7 @@ obj-bin-y += bzimage.init.o obj-bin-y += clear_page.o obj-bin-y += copy_page.o obj-y += compat.o +obj-y += cpuid.o obj-y += debug.o obj-y += delay.o obj-bin-y += dmi_scan.init.o diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c new file mode 100644 index 0000000..099e145 --- /dev/null +++ b/xen/arch/x86/cpuid.c @@ -0,0 +1,23 @@ +#include <xen/lib.h> +#include <xen/init.h> +#include <asm/processor.h> +#include <asm/cpuid.h> + +uint32_t __read_mostly host_featureset[XEN_NR_FEATURESET_ENTRIES]; + +void __init calculate_featuresets(void) +{ + /* Host featureset. */ + memcpy(host_featureset, boot_cpu_data.x86_capability, + sizeof(host_featureset)); +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 54995ed..d91c2fb 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -50,6 +50,7 @@ #include <asm/nmi.h> #include <asm/alternative.h> #include <asm/mc146818rtc.h> +#include <asm/cpuid.h> /* opt_nosmp: If true, secondary processors are ignored. */ static bool_t __initdata opt_nosmp; @@ -1434,6 +1435,8 @@ void __init noreturn __start_xen(unsigned long mbi_p) "Multiple initrd candidates, picking module #%u\n", initrdidx); + calculate_featuresets(); + /* * Temporarily clear SMAP in CR4 to allow user-accesses in construct_dom0(). * This saves a large number of corner cases interactions with diff --git a/xen/include/asm-x86/cpuid.h b/xen/include/asm-x86/cpuid.h new file mode 100644 index 0000000..c303c74 --- /dev/null +++ b/xen/include/asm-x86/cpuid.h @@ -0,0 +1,22 @@ +#ifndef __X86_CPUID_H__ +#define __X86_CPUID_H__ + +#include <xen/types.h> +#include <asm/cpufeature.h> +#include <public/sysctl.h> + +extern uint32_t host_featureset[XEN_NR_FEATURESET_ENTRIES]; + +void calculate_featuresets(void); + +#endif /* !__X86_CPUID_H__ */ + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |