ia64/xen-unstable

changeset 13297:ee395551208d

Enable compatibility mode operation for HYPERVISOR_physdev_op and
HYPERVISOR_event_channel_op.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Emmanuel Ackaouy <ack@xensource.com>
date Fri Jan 05 17:34:32 2007 +0000 (2007-01-05)
parents e4088ae584b8
children 203f982ed5d9
files xen/arch/x86/compat.c xen/arch/x86/physdev.c xen/arch/x86/x86_64/Makefile xen/arch/x86/x86_64/compat.c xen/arch/x86/x86_64/compat/entry.S xen/arch/x86/x86_64/physdev.c xen/common/compat/xlat.c xen/include/asm-x86/hypercall.h xen/include/xlat.lst
line diff
     1.1 --- a/xen/arch/x86/compat.c	Fri Jan 05 17:34:31 2007 +0000
     1.2 +++ b/xen/arch/x86/compat.c	Fri Jan 05 17:34:32 2007 +0000
     1.3 @@ -9,17 +9,23 @@
     1.4  #include <xen/guest_access.h>
     1.5  #include <xen/hypercall.h>
     1.6  
     1.7 +#ifndef COMPAT
     1.8 +typedef long ret_t;
     1.9 +#endif
    1.10 +
    1.11  /* Legacy hypercall (as of 0x00030202). */
    1.12 -long do_physdev_op_compat(XEN_GUEST_HANDLE(physdev_op_t) uop)
    1.13 +ret_t do_physdev_op_compat(XEN_GUEST_HANDLE(physdev_op_t) uop)
    1.14  {
    1.15      struct physdev_op op;
    1.16  
    1.17      if ( unlikely(copy_from_guest(&op, uop, 1) != 0) )
    1.18          return -EFAULT;
    1.19  
    1.20 -    return do_physdev_op(op.cmd, (XEN_GUEST_HANDLE(void)) { &uop.p->u });
    1.21 +    return do_physdev_op(op.cmd, guest_handle_from_ptr(&uop.p->u, void));
    1.22  }
    1.23  
    1.24 +#ifndef COMPAT
    1.25 +
    1.26  /* Legacy hypercall (as of 0x00030202). */
    1.27  long do_event_channel_op_compat(XEN_GUEST_HANDLE(evtchn_op_t) uop)
    1.28  {
    1.29 @@ -28,5 +34,7 @@ long do_event_channel_op_compat(XEN_GUES
    1.30      if ( unlikely(copy_from_guest(&op, uop, 1) != 0) )
    1.31          return -EFAULT;
    1.32  
    1.33 -    return do_event_channel_op(op.cmd, (XEN_GUEST_HANDLE(void)) {&uop.p->u });
    1.34 +    return do_event_channel_op(op.cmd, guest_handle_from_ptr(&uop.p->u, void));
    1.35  }
    1.36 +
    1.37 +#endif
     2.1 --- a/xen/arch/x86/physdev.c	Fri Jan 05 17:34:31 2007 +0000
     2.2 +++ b/xen/arch/x86/physdev.c	Fri Jan 05 17:34:32 2007 +0000
     2.3 @@ -9,9 +9,14 @@
     2.4  #include <xen/guest_access.h>
     2.5  #include <asm/current.h>
     2.6  #include <asm/smpboot.h>
     2.7 +#include <asm/hypercall.h>
     2.8  #include <public/xen.h>
     2.9  #include <public/physdev.h>
    2.10  
    2.11 +#ifndef COMPAT
    2.12 +typedef long ret_t;
    2.13 +#endif
    2.14 +
    2.15  int
    2.16  ioapic_guest_read(
    2.17      unsigned long physbase, unsigned int reg, u32 *pval);
    2.18 @@ -19,10 +24,10 @@ int
    2.19  ioapic_guest_write(
    2.20      unsigned long physbase, unsigned int reg, u32 pval);
    2.21  
    2.22 -long do_physdev_op(int cmd, XEN_GUEST_HANDLE(void) arg)
    2.23 +ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE(void) arg)
    2.24  {
    2.25      int irq;
    2.26 -    long ret;
    2.27 +    ret_t ret;
    2.28  
    2.29      switch ( cmd )
    2.30      {
    2.31 @@ -129,7 +134,11 @@ long do_physdev_op(int cmd, XEN_GUEST_HA
    2.32               (set_iobitmap.nr_ports > 65536) )
    2.33              break;
    2.34          ret = 0;
    2.35 +#ifndef COMPAT
    2.36          current->arch.iobmp       = set_iobitmap.bitmap;
    2.37 +#else
    2.38 +        guest_from_compat_handle(current->arch.iobmp, set_iobitmap.bitmap);
    2.39 +#endif
    2.40          current->arch.iobmp_limit = set_iobitmap.nr_ports;
    2.41          break;
    2.42      }
     3.1 --- a/xen/arch/x86/x86_64/Makefile	Fri Jan 05 17:34:31 2007 +0000
     3.2 +++ b/xen/arch/x86/x86_64/Makefile	Fri Jan 05 17:34:32 2007 +0000
     3.3 @@ -3,9 +3,14 @@ obj-y += gpr_switch.o
     3.4  obj-y += mm.o
     3.5  obj-y += traps.o
     3.6  
     3.7 +obj-$(CONFIG_COMPAT) += compat.o
     3.8 +obj-$(CONFIG_COMPAT) += physdev.o
     3.9 +
    3.10  ifeq ($(CONFIG_COMPAT),y)
    3.11  # extra dependencies
    3.12 +compat.o:	../compat.c
    3.13  entry.o:	compat/entry.S
    3.14  mm.o:		compat/mm.c
    3.15 +physdev.o:	../physdev.c
    3.16  traps.o:	compat/traps.c
    3.17  endif
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/xen/arch/x86/x86_64/compat.c	Fri Jan 05 17:34:32 2007 +0000
     4.3 @@ -0,0 +1,30 @@
     4.4 +/******************************************************************************
     4.5 + * compat.c
     4.6 + */
     4.7 +
     4.8 +#include <xen/config.h>
     4.9 +#include <xen/hypercall.h>
    4.10 +#include <compat/xen.h>
    4.11 +#include <compat/physdev.h>
    4.12 +
    4.13 +DEFINE_XEN_GUEST_HANDLE(physdev_op_compat_t);
    4.14 +#define physdev_op                    compat_physdev_op
    4.15 +#define physdev_op_t                  physdev_op_compat_t
    4.16 +#define do_physdev_op                 compat_physdev_op
    4.17 +#define do_physdev_op_compat(x)       compat_physdev_op_compat(_##x)
    4.18 +
    4.19 +#define COMPAT
    4.20 +#define _XEN_GUEST_HANDLE(t) XEN_GUEST_HANDLE(t)
    4.21 +typedef int ret_t;
    4.22 +
    4.23 +#include "../compat.c"
    4.24 +
    4.25 +/*
    4.26 + * Local variables:
    4.27 + * mode: C
    4.28 + * c-set-style: "BSD"
    4.29 + * c-basic-offset: 4
    4.30 + * tab-width: 4
    4.31 + * indent-tabs-mode: nil
    4.32 + * End:
    4.33 + */
     5.1 --- a/xen/arch/x86/x86_64/compat/entry.S	Fri Jan 05 17:34:31 2007 +0000
     5.2 +++ b/xen/arch/x86/x86_64/compat/entry.S	Fri Jan 05 17:34:32 2007 +0000
     5.3 @@ -283,15 +283,11 @@ CFIX14:
     5.4  #define compat_platform_op domain_crash_synchronous
     5.5  #define compat_multicall domain_crash_synchronous
     5.6  #define compat_set_timer_op domain_crash_synchronous
     5.7 -#define compat_event_channel_op_compat domain_crash_synchronous
     5.8 -#define compat_physdev_op_compat domain_crash_synchronous
     5.9  #define compat_grant_table_op domain_crash_synchronous
    5.10  #define compat_vcpu_op domain_crash_synchronous
    5.11  #define compat_acm_op domain_crash_synchronous
    5.12  #define compat_arch_sched_op domain_crash_synchronous
    5.13  #define compat_xenoprof_op domain_crash_synchronous
    5.14 -#define compat_event_channel_op domain_crash_synchronous
    5.15 -#define compat_physdev_op domain_crash_synchronous
    5.16  #define compat_sysctl domain_crash_synchronous
    5.17  #define compat_domctl domain_crash_synchronous
    5.18  
    5.19 @@ -312,7 +308,7 @@ ENTRY(compat_hypercall_table)
    5.20          .quad compat_multicall
    5.21          .quad compat_update_va_mapping
    5.22          .quad compat_set_timer_op       /* 15 */
    5.23 -        .quad compat_event_channel_op_compat
    5.24 +        .quad do_event_channel_op_compat
    5.25          .quad compat_xen_version
    5.26          .quad do_console_io
    5.27          .quad compat_physdev_op_compat
    5.28 @@ -328,7 +324,7 @@ ENTRY(compat_hypercall_table)
    5.29          .quad compat_arch_sched_op
    5.30          .quad compat_callback_op        /* 30 */
    5.31          .quad compat_xenoprof_op
    5.32 -        .quad compat_event_channel_op
    5.33 +        .quad do_event_channel_op
    5.34          .quad compat_physdev_op
    5.35          .quad compat_ni_hypercall
    5.36          .quad compat_sysctl             /* 35 */
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/xen/arch/x86/x86_64/physdev.c	Fri Jan 05 17:34:32 2007 +0000
     6.3 @@ -0,0 +1,48 @@
     6.4 +/******************************************************************************
     6.5 + * physdev.c
     6.6 + */
     6.7 +
     6.8 +#include <xen/config.h>
     6.9 +#include <xen/types.h>
    6.10 +#include <xen/guest_access.h>
    6.11 +#include <compat/xen.h>
    6.12 +#include <compat/event_channel.h>
    6.13 +#include <compat/physdev.h>
    6.14 +#include <asm/hypercall.h>
    6.15 +
    6.16 +#define do_physdev_op compat_physdev_op
    6.17 +
    6.18 +#define physdev_apic               compat_physdev_apic
    6.19 +#define physdev_apic_t             physdev_apic_compat_t
    6.20 +
    6.21 +#define physdev_eoi                compat_physdev_eoi
    6.22 +#define physdev_eoi_t              physdev_eoi_compat_t
    6.23 +
    6.24 +#define physdev_set_iobitmap       compat_physdev_set_iobitmap
    6.25 +#define physdev_set_iobitmap_t     physdev_set_iobitmap_compat_t
    6.26 +
    6.27 +#define physdev_set_iopl           compat_physdev_set_iopl
    6.28 +#define physdev_set_iopl_t         physdev_set_iopl_compat_t
    6.29 +
    6.30 +#define physdev_irq                compat_physdev_irq
    6.31 +#define physdev_irq_t              physdev_irq_compat_t
    6.32 +
    6.33 +#define physdev_irq_status_query   compat_physdev_irq_status_query
    6.34 +#define physdev_irq_status_query_t physdev_irq_status_query_compat_t
    6.35 +
    6.36 +#define COMPAT
    6.37 +#undef guest_handle_okay
    6.38 +#define guest_handle_okay          compat_handle_okay
    6.39 +typedef int ret_t;
    6.40 +
    6.41 +#include "../physdev.c"
    6.42 +
    6.43 +/*
    6.44 + * Local variables:
    6.45 + * mode: C
    6.46 + * c-set-style: "BSD"
    6.47 + * c-basic-offset: 4
    6.48 + * tab-width: 4
    6.49 + * indent-tabs-mode: nil
    6.50 + * End:
    6.51 + */
     7.1 --- a/xen/common/compat/xlat.c	Fri Jan 05 17:34:31 2007 +0000
     7.2 +++ b/xen/common/compat/xlat.c	Fri Jan 05 17:34:32 2007 +0000
     7.3 @@ -4,8 +4,8 @@
     7.4  
     7.5  #include <xen/compat.h>
     7.6  #include <xen/lib.h>
     7.7 -#include <public/xen.h>
     7.8  #include <compat/xen.h>
     7.9 +#include <compat/event_channel.h>
    7.10  
    7.11  /* In-place translation functons: */
    7.12  void xlat_start_info(struct start_info *native,
    7.13 @@ -21,6 +21,30 @@ void xlat_start_info(struct start_info *
    7.14  CHECK_dom0_vga_console_info;
    7.15  #undef dom0_vga_console_info
    7.16  
    7.17 +#define xen_evtchn_alloc_unbound evtchn_alloc_unbound
    7.18 +#define xen_evtchn_bind_interdomain evtchn_bind_interdomain
    7.19 +#define xen_evtchn_bind_ipi evtchn_bind_ipi
    7.20 +#define xen_evtchn_bind_pirq evtchn_bind_pirq
    7.21 +#define xen_evtchn_bind_vcpu evtchn_bind_vcpu
    7.22 +#define xen_evtchn_bind_virq evtchn_bind_virq
    7.23 +#define xen_evtchn_close evtchn_close
    7.24 +#define xen_evtchn_op evtchn_op
    7.25 +#define xen_evtchn_send evtchn_send
    7.26 +#define xen_evtchn_status evtchn_status
    7.27 +#define xen_evtchn_unmask evtchn_unmask
    7.28 +CHECK_evtchn_op;
    7.29 +#undef xen_evtchn_alloc_unbound
    7.30 +#undef xen_evtchn_bind_interdomain
    7.31 +#undef xen_evtchn_bind_ipi
    7.32 +#undef xen_evtchn_bind_pirq
    7.33 +#undef xen_evtchn_bind_vcpu
    7.34 +#undef xen_evtchn_bind_virq
    7.35 +#undef xen_evtchn_close
    7.36 +#undef xen_evtchn_op
    7.37 +#undef xen_evtchn_send
    7.38 +#undef xen_evtchn_status
    7.39 +#undef xen_evtchn_unmask
    7.40 +
    7.41  #define xen_mmu_update mmu_update
    7.42  CHECK_mmu_update;
    7.43  #undef xen_mmu_update
     8.1 --- a/xen/include/asm-x86/hypercall.h	Fri Jan 05 17:34:31 2007 +0000
     8.2 +++ b/xen/include/asm-x86/hypercall.h	Fri Jan 05 17:34:32 2007 +0000
     8.3 @@ -123,4 +123,13 @@ do_set_callbacks(
     8.4  
     8.5  #endif
     8.6  
     8.7 +#ifdef CONFIG_COMPAT
     8.8 +
     8.9 +extern int
    8.10 +compat_physdev_op(
    8.11 +    int cmd,
    8.12 +    XEN_GUEST_HANDLE(void) arg);
    8.13 +
    8.14 +#endif
    8.15 +
    8.16  #endif /* __ASM_X86_HYPERCALL_H__ */
     9.1 --- a/xen/include/xlat.lst	Fri Jan 05 17:34:31 2007 +0000
     9.2 +++ b/xen/include/xlat.lst	Fri Jan 05 17:34:32 2007 +0000
     9.3 @@ -6,6 +6,17 @@
     9.4  !	mmuext_op			xen.h
     9.5  !	start_info			xen.h
     9.6  ?	vcpu_time_info			xen.h
     9.7 +?	evtchn_alloc_unbound		event_channel.h
     9.8 +?	evtchn_bind_interdomain		event_channel.h
     9.9 +?	evtchn_bind_ipi			event_channel.h
    9.10 +?	evtchn_bind_pirq		event_channel.h
    9.11 +?	evtchn_bind_vcpu		event_channel.h
    9.12 +?	evtchn_bind_virq		event_channel.h
    9.13 +?	evtchn_close			event_channel.h
    9.14 +?	evtchn_op			event_channel.h
    9.15 +?	evtchn_send			event_channel.h
    9.16 +?	evtchn_status			event_channel.h
    9.17 +?	evtchn_unmask			event_channel.h
    9.18  !	add_to_physmap			memory.h
    9.19  !	foreign_memory_map		memory.h
    9.20  !	memory_exchange			memory.h