# HG changeset patch # User gingold@virtu10 # Node ID 80137e1a97cf27e026e6eb6a51a5757e160e979a # Parent f32793cae274028d939dba4909be280c9df712a5 linux-ia64 diff -r f32793cae274 -r 80137e1a97cf linux-2.6-xen-sparse/arch/ia64/Kconfig --- a/linux-2.6-xen-sparse/arch/ia64/Kconfig Wed Aug 23 11:12:25 2006 +0200 +++ b/linux-2.6-xen-sparse/arch/ia64/Kconfig Wed Aug 23 11:17:06 2006 +0200 @@ -530,6 +530,9 @@ config XEN_REBOOT config XEN_SMPBOOT default n + +config XEN_XENCOMM + default y endif source "drivers/xen/Kconfig" diff -r f32793cae274 -r 80137e1a97cf linux-2.6-xen-sparse/arch/ia64/kernel/setup.c --- a/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c Wed Aug 23 11:12:25 2006 +0200 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c Wed Aug 23 11:17:06 2006 +0200 @@ -76,6 +76,8 @@ EXPORT_SYMBOL(__per_cpu_offset); #endif #ifdef CONFIG_XEN +unsigned long kernel_start_pa; + static int xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr) { @@ -433,6 +435,7 @@ setup_arch (char **cmdline_p) #ifdef CONFIG_XEN if (is_running_on_xen()) { + kernel_start_pa = KERNEL_START - ia64_tpa (KERNEL_START); setup_xen_features(); /* Register a call for panic conditions. */ notifier_chain_register(&panic_notifier_list, &xen_panic_block); diff -r f32793cae274 -r 80137e1a97cf linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c --- a/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c Wed Aug 23 11:12:25 2006 +0200 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/hypervisor.c Wed Aug 23 11:17:06 2006 +0200 @@ -70,7 +70,7 @@ ia64_xenmem_reservation_op(unsigned long reservation.nr_extents = nr_extents; dummy = frame_list[0];// re-install tlb entry before hypercall - tmp_ret = ____HYPERVISOR_memory_op(op, &reservation); + tmp_ret = xencomm_hypercall_memory_op(op, &reservation); if (tmp_ret < 0) { if (ret == 0) { ret = tmp_ret; @@ -371,8 +371,6 @@ int int HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count) { - __u64 va1, va2, pa1, pa2; - if (cmd == GNTTABOP_map_grant_ref) { unsigned int i; for (i = 0; i < count; i++) { @@ -380,29 +378,7 @@ HYPERVISOR_grant_table_op(unsigned int c (struct gnttab_map_grant_ref*)uop + i); } } - va1 = (__u64)uop & PAGE_MASK; - pa1 = pa2 = 0; - if ((REGION_NUMBER(va1) == 5) && - ((va1 - KERNEL_START) >= KERNEL_TR_PAGE_SIZE)) { - pa1 = ia64_tpa(va1); - if (cmd <= GNTTABOP_transfer) { - static uint32_t uop_size[GNTTABOP_transfer + 1] = { - sizeof(struct gnttab_map_grant_ref), - sizeof(struct gnttab_unmap_grant_ref), - sizeof(struct gnttab_setup_table), - sizeof(struct gnttab_dump_table), - sizeof(struct gnttab_transfer), - }; - va2 = (__u64)uop + (uop_size[cmd] * count) - 1; - va2 &= PAGE_MASK; - if (va1 != va2) { - /* maximum size of uop is 2pages */ - BUG_ON(va2 > va1 + PAGE_SIZE); - pa2 = ia64_tpa(va2); - } - } - } - return ____HYPERVISOR_grant_table_op(cmd, uop, count, pa1, pa2); + return xencomm_hypercall_grant_table_op(cmd, uop, count); } EXPORT_SYMBOL(HYPERVISOR_grant_table_op); diff -r f32793cae274 -r 80137e1a97cf linux-2.6-xen-sparse/include/asm-ia64/hypercall.h --- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Wed Aug 23 11:12:25 2006 +0200 +++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h Wed Aug 23 11:17:06 2006 +0200 @@ -33,11 +33,12 @@ #ifndef __HYPERCALL_H__ #define __HYPERCALL_H__ -#include /* memcpy() */ - #ifndef __HYPERVISOR_H__ # error "please don't include this file directly" #endif + +#include +struct xencomm_handle; /* * Assembler stubs for hyper-calls. @@ -157,16 +158,10 @@ (type)__res; \ }) -static inline int -HYPERVISOR_sched_op_compat( - int cmd, unsigned long arg) -{ - return _hypercall2(int, sched_op_compat, cmd, arg); -} - -static inline int -HYPERVISOR_sched_op( - int cmd, void *arg) + +static inline int +xencomm_arch_hypercall_sched_op( + int cmd, struct xencomm_handle *arg) { return _hypercall2(int, sched_op, cmd, arg); } @@ -181,25 +176,22 @@ HYPERVISOR_set_timer_op( } static inline int -HYPERVISOR_dom0_op( - dom0_op_t *dom0_op) -{ - dom0_op->interface_version = DOM0_INTERFACE_VERSION; +xencomm_arch_hypercall_dom0_op( + struct xencomm_handle *dom0_op) +{ return _hypercall1(int, dom0_op, dom0_op); } static inline int -HYPERVISOR_multicall( - void *call_list, int nr_calls) +xencomm_arch_hypercall_multicall( + struct xencomm_handle *call_list, int nr_calls) { return _hypercall2(int, multicall, call_list, nr_calls); } -//XXX xen/ia64 copy_from_guest() is broken. -// This is a temporal work around until it is fixed. -static inline int -____HYPERVISOR_memory_op( - unsigned int cmd, void *arg) +static inline int +xencomm_arch_hypercall_memory_op( + unsigned int cmd, struct xencomm_handle *arg) { return _hypercall2(int, memory_op, cmd, arg); } @@ -218,92 +210,71 @@ HYPERVISOR_memory_op( return ia64_xenmem_reservation_op(cmd, (struct xen_memory_reservation*)arg); default: - return ____HYPERVISOR_memory_op(cmd, arg); + return xencomm_hypercall_memory_op(cmd, arg); } /* NOTREACHED */ } static inline int -HYPERVISOR_event_channel_op( - int cmd, void *arg) -{ - int rc = _hypercall2(int, event_channel_op, cmd, arg); - if (unlikely(rc == -ENOSYS)) { - struct evtchn_op op; - op.cmd = cmd; - memcpy(&op.u, arg, sizeof(op.u)); - rc = _hypercall1(int, event_channel_op_compat, &op); - } - return rc; -} - -static inline int -HYPERVISOR_acm_op( - unsigned int cmd, void *arg) +xencomm_arch_hypercall_event_channel_op( + int cmd, struct xencomm_handle *arg) +{ + return _hypercall2(int, event_channel_op, cmd, arg); +} + +static inline int +xencomm_arch_hypercall_acm_op( + unsigned int cmd, struct xencomm_handle *arg) { return _hypercall2(int, acm_op, cmd, arg); } static inline int -HYPERVISOR_xen_version( - int cmd, void *arg) +xencomm_arch_hypercall_xen_version( + int cmd, struct xencomm_handle *arg) { return _hypercall2(int, xen_version, cmd, arg); } static inline int -HYPERVISOR_console_io( - int cmd, int count, char *str) +xencomm_arch_hypercall_console_io( + int cmd, int count, struct xencomm_handle *str) { return _hypercall3(int, console_io, cmd, count, str); } static inline int -HYPERVISOR_physdev_op( - int cmd, void *arg) -{ - int rc = _hypercall2(int, physdev_op, cmd, arg); - if (unlikely(rc == -ENOSYS)) { - struct physdev_op op; - op.cmd = cmd; - memcpy(&op.u, arg, sizeof(op.u)); - rc = _hypercall1(int, physdev_op_compat, &op); - } - return rc; -} - -//XXX __HYPERVISOR_grant_table_op is used for this hypercall constant. -static inline int -____HYPERVISOR_grant_table_op( - unsigned int cmd, void *uop, unsigned int count, - unsigned long pa1, unsigned long pa2) -{ - return _hypercall5(int, grant_table_op, cmd, uop, count, pa1, pa2); +xencomm_arch_hypercall_physdev_op( + int cmd, struct xencomm_handle *arg) +{ + return _hypercall2(int, physdev_op, cmd, arg); +} + +static inline int +xencomm_arch_hypercall_grant_table_op( + unsigned int cmd, struct xencomm_handle *uop, unsigned int count) +{ + return _hypercall3(int, grant_table_op, cmd, uop, count); } int HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count); -static inline int -HYPERVISOR_vcpu_op( - int cmd, int vcpuid, void *extra_args) -{ - return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args); -} - extern int HYPERVISOR_suspend(unsigned long srec); -static inline unsigned long -HYPERVISOR_hvm_op( +static inline int +xencomm_arch_hypercall_callback_op( + int cmd, struct xencomm_handle *arg) +{ + return _hypercall2(int, callback_op, cmd, arg); +} + +extern int HYPERVISOR_suspend(unsigned long srec); + +static inline unsigned long +xencomm_arch_hypercall_hvm_op( int cmd, void *arg) { return _hypercall2(unsigned long, hvm_op, cmd, arg); -} - -static inline int -HYPERVISOR_callback_op( - int cmd, void *arg) -{ - return _hypercall2(int, callback_op, cmd, arg); } extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs); @@ -501,4 +472,13 @@ HYPERVISOR_add_physmap(unsigned long gpf // for balloon driver #define HYPERVISOR_update_va_mapping(va, new_val, flags) (0) +/* Use xencomm to do hypercalls. */ +#define HYPERVISOR_sched_op xencomm_hypercall_sched_op +#define HYPERVISOR_event_channel_op xencomm_hypercall_event_channel_op +#define HYPERVISOR_callback_op xencomm_hypercall_callback_op +#define HYPERVISOR_multicall xencomm_hypercall_multicall +#define HYPERVISOR_xen_version xencomm_hypercall_xen_version +#define HYPERVISOR_console_io xencomm_hypercall_console_io +#define HYPERVISOR_physdev_op xencomm_hypercall_physdev_op + #endif /* __HYPERCALL_H__ */ diff -r f32793cae274 -r 80137e1a97cf linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h --- a/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h Wed Aug 23 11:12:25 2006 +0200 +++ b/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h Wed Aug 23 11:17:06 2006 +0200 @@ -70,9 +70,6 @@ HYPERVISOR_yield( { int rc = HYPERVISOR_sched_op(SCHEDOP_yield, NULL); - if (rc == -ENOSYS) - rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0); - return rc; } @@ -81,9 +78,6 @@ HYPERVISOR_block( void) { int rc = HYPERVISOR_sched_op(SCHEDOP_block, NULL); - - if (rc == -ENOSYS) - rc = HYPERVISOR_sched_op_compat(SCHEDOP_block, 0); return rc; } @@ -97,9 +91,6 @@ HYPERVISOR_shutdown( }; int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown); - - if (rc == -ENOSYS) - rc = HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason); return rc; } @@ -117,8 +108,6 @@ HYPERVISOR_poll( set_xen_guest_handle(sched_poll.ports, ports); rc = HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll); - if (rc == -ENOSYS) - rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0); return rc; }