Add support for parsing and interpreting hypervisor feature flags. These allow the kernel to determine what features are provided by the underlying hypervisor. For example, whether page tables need to be write protected explicitly by the kernel, and whether the kernel (appears to) run in ring 0 rather than ring 1. This information allows the kernel to improve performance by avoiding unnecessary actions. Signed-off-by: Ian Pratt Signed-off-by: Christian Limpach Signed-off-by: Chris Wright --- arch/i386/mach-xen/setup-xen.c | 2 ++ drivers/Makefile | 1 + drivers/xen/Makefile | 3 +++ drivers/xen/core/Makefile | 3 +++ drivers/xen/core/features.c | 31 +++++++++++++++++++++++++++++++ include/asm-i386/hypervisor.h | 1 + include/xen/features.h | 20 ++++++++++++++++++++ 7 files changed, 61 insertions(+) diff -r 1f0f17cb7700 arch/i386/mach-xen/setup-xen.c --- a/arch/i386/mach-xen/setup-xen.c Fri Jun 16 17:57:31 2006 -0700 +++ b/arch/i386/mach-xen/setup-xen.c Fri Jun 16 18:00:23 2006 -0700 @@ -40,6 +40,8 @@ char * __init machine_specific_memory_se void __init machine_specific_arch_setup(void) { + setup_xen_features(); + #ifdef CONFIG_ACPI if (!(xen_start_info->flags & SIF_INITDOMAIN)) { printk(KERN_INFO "ACPI in unprivileged domain disabled\n"); diff -r 1f0f17cb7700 drivers/Makefile --- a/drivers/Makefile Fri Jun 16 17:57:31 2006 -0700 +++ b/drivers/Makefile Fri Jun 16 18:00:23 2006 -0700 @@ -31,6 +31,7 @@ obj-$(CONFIG_NUBUS) += nubus/ obj-$(CONFIG_NUBUS) += nubus/ obj-$(CONFIG_ATM) += atm/ obj-$(CONFIG_PPC_PMAC) += macintosh/ +obj-$(CONFIG_XEN) += xen/ obj-$(CONFIG_IDE) += ide/ obj-$(CONFIG_FC4) += fc4/ obj-$(CONFIG_SCSI) += scsi/ diff -r 1f0f17cb7700 include/asm-i386/hypervisor.h --- a/include/asm-i386/hypervisor.h Fri Jun 16 17:57:31 2006 -0700 +++ b/include/asm-i386/hypervisor.h Fri Jun 16 18:00:23 2006 -0700 @@ -40,6 +40,7 @@ #include #include +#include #include #include diff -r 1f0f17cb7700 drivers/xen/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/xen/Makefile Fri Jun 16 18:00:23 2006 -0700 @@ -0,0 +1,3 @@ + +obj-y += core/ + diff -r 1f0f17cb7700 drivers/xen/core/Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/xen/core/Makefile Fri Jun 16 18:00:23 2006 -0700 @@ -0,0 +1,3 @@ + +obj-y := features.o + diff -r 1f0f17cb7700 drivers/xen/core/features.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/drivers/xen/core/features.c Fri Jun 16 18:00:23 2006 -0700 @@ -0,0 +1,31 @@ +/****************************************************************************** + * features.c + * + * Xen feature flags. + * + * Copyright (c) 2006, Ian Campbell, XenSource Inc. + */ +#include +#include +#include +#include +#include + +u8 xen_features[XENFEAT_NR_SUBMAPS * 32] __read_mostly; +EXPORT_SYMBOL_GPL(xen_features); + +void setup_xen_features(void) +{ +#if 0 /* hypercalls come later in the series */ + struct xen_feature_info fi; + int i, j; + + for (i = 0; i < XENFEAT_NR_SUBMAPS; i++) { + fi.submap_idx = i; + if (HYPERVISOR_xen_version(XENVER_get_features, &fi) < 0) + break; + for (j=0; j<32; j++) + xen_features[i*32+j] = !!(fi.submap & 1< + +extern void setup_xen_features(void); + +extern u8 xen_features[XENFEAT_NR_SUBMAPS * 32]; + +#define xen_feature(flag) (xen_features[flag]) + +#endif /* __ASM_XEN_FEATURES_H__ */ -- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/