]> xenbits.xensource.com Git - legacy/linux-2.6.18-xen.git/commitdiff
[IA64] Support special guest optimizations in the hypervisor
authorAlex Williamson <alex.williamson@hp.com>
Mon, 9 Jul 2007 15:24:03 +0000 (09:24 -0600)
committerAlex Williamson <alex.williamson@hp.com>
Mon, 9 Jul 2007 15:24:03 +0000 (09:24 -0600)
Add the usage of the new hypervisor call HYPERVISOR_opt_feature() for
identity mapping region 7.

Signed-off-by: Dietmar Hahn <dietmar.hahn@fujitsu-siemens.com>
arch/ia64/kernel/setup.c
arch/ia64/xen/xcom_hcall.c
include/asm-ia64/hypercall.h
include/asm-ia64/xen/xcom_hcall.h
include/xen/interface/arch-ia64.h

index d0d75bc240660b56cfe22d95144146a43e5587d9..71bf7574ca3c104eb344d481ea142e6386a8cb0b 100644 (file)
@@ -446,6 +446,8 @@ setup_arch (char **cmdline_p)
 
 #ifdef CONFIG_XEN
        if (is_running_on_xen()) {
+               struct xen_ia64_opt_feature optf;
+
                /* Must be done before any hypercall.  */
                xencomm_init();
 
@@ -454,6 +456,13 @@ setup_arch (char **cmdline_p)
                atomic_notifier_chain_register(&panic_notifier_list,
                                               &xen_panic_block);
                pm_power_off = xen_pm_power_off;
+
+               /* Enable region 7 identity map optimizations in Xen */
+               optf.cmd = XEN_IA64_OPTF_IDENT_MAP_REG7;
+               optf.on = XEN_IA64_OPTF_ON;
+               optf.pgprot = pgprot_val(PAGE_KERNEL);
+               optf.key = 0;   /* No key on linux. */
+               HYPERVISOR_opt_feature(&optf);
        }
 #endif
 
index d85aae8010229bbec200293ce0661f86468e43b8..3e9777495aa012e1369c08e22b8668e838d5e2e4 100644 (file)
@@ -397,6 +397,12 @@ xencomm_hypercall_vcpu_op(int cmd, int cpu, void *arg)
                                              xencomm_create_inline(arg));
 }
 
+long
+xencomm_hypercall_opt_feature(void *arg)
+{
+       return xencomm_arch_hypercall_opt_feature(xencomm_create_inline(arg));
+}
+
 int
 xencomm_hypercall_fpswa_revision(unsigned int *revision)
 {
index 49a8287ec8f18b4fbebdad3ad228149d3e0738d6..981ba4c476f10016500e2ed8da802d93fc6fb223 100644 (file)
@@ -229,6 +229,12 @@ xencomm_arch_hypercall_xenoprof_op(int op, struct xencomm_handle *arg)
        return _hypercall2(int, xenoprof_op, op, arg);
 }
 
+static inline long
+xencomm_arch_hypercall_opt_feature(struct xencomm_handle *arg)
+{
+       return _hypercall1(long, opt_feature, arg);
+}
+
 extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
 static inline void exit_idle(void) {}
 #define do_IRQ(irq, regs) ({                   \
@@ -427,6 +433,7 @@ HYPERVISOR_add_io_space(unsigned long phys_base,
 
 #define HYPERVISOR_suspend xencomm_hypercall_suspend
 #define HYPERVISOR_vcpu_op xencomm_hypercall_vcpu_op
+#define HYPERVISOR_opt_feature xencomm_hypercall_opt_feature
 
 /* to compile gnttab_copy_grant_page() in drivers/xen/core/gnttab.c */
 #define HYPERVISOR_mmu_update(req, count, success_count, domid) ({BUG();0;})
index 913f2761ee5650ac85d9d4b0b1b21d875b5a8fb7..a9252faa22482295a79b516e6ed0fba2498c1aa0 100644 (file)
@@ -53,6 +53,8 @@ extern int xencomm_hypercall_perfmon_op(unsigned long cmd, void* arg,
 
 extern long xencomm_hypercall_vcpu_op(int cmd, int cpu, void *arg);
 
+extern long xencomm_hypercall_opt_feature(void *arg);
+
 /* Using mini xencomm.  */
 extern int xencomm_mini_hypercall_console_io(int cmd, int count, char *str);
 
index 43c56b4c3de2d6aed43dd929ce02808e83f55b97..50062d103ab35e20bd294dad26ac2b7164ac92be 100644 (file)
@@ -558,6 +558,41 @@ struct xen_ia64_boot_param {
 #define XENCOMM_INLINE_ADDR(addr) \
   ((unsigned long)(addr) & ~XENCOMM_INLINE_MASK)
 
+#ifndef __ASSEMBLY__
+
+/*
+ * Optimization features.
+ * The hypervisor may do some special optimizations for guests. This hypercall
+ * can be used to switch on/of these special optimizations.
+ */
+#define __HYPERVISOR_opt_feature       0x700UL
+
+#define XEN_IA64_OPTF_OFF      0x0
+#define XEN_IA64_OPTF_ON       0x1
+
+/*
+ * If this feature is switched on, the hypervisor inserts the
+ * tlb entries without calling the guests traphandler.
+ * This is useful in guests using region 7 for identity mapping
+ * like the linux kernel does.
+ */
+#define XEN_IA64_OPTF_IDENT_MAP_REG7   0x1UL
+
+struct xen_ia64_opt_feature {
+       unsigned long cmd;              /* Which feature */
+       unsigned char on;               /* Switch feature on/off */
+       union {
+               struct {
+                               /* The page protection bit mask of the pte.
+                                * This will be or'ed with the pte. */
+                       unsigned long pgprot;
+                       unsigned long key;      /* A protection key for itir. */
+               };
+       };
+};
+
+#endif /* __ASSEMBLY__ */
+
 /* xen perfmon */
 #ifdef XEN
 #ifndef __ASSEMBLY__