ia64/xen-unstable

changeset 7031:109a27c1c004

Another step towards building xenlinux/ia64 from -sparse
author djm@kirby.fc.hp.com
date Fri Sep 23 08:12:28 2005 -0600 (2005-09-23)
parents 7ddfb9a44972
children 60928c906666
files linux-2.6-xen-sparse/arch/ia64/xen-mkbuildtree-pre linux-2.6-xen-sparse/arch/ia64/xen/drivers/Makefile linux-2.6-xen-sparse/arch/ia64/xen/drivers/README linux-2.6-xen-sparse/arch/ia64/xen/drivers/coreMakefile linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c linux-2.6-xen-sparse/arch/ia64/xen/drivers/xenia64_init.c linux-2.6-xen-sparse/include/asm-xen/asm-ia64/hypercall.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen-mkbuildtree-pre	Thu Sep 22 18:11:04 2005 -0600
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen-mkbuildtree-pre	Fri Sep 23 08:12:28 2005 -0600
     1.3 @@ -13,3 +13,7 @@ then
     1.4  	mv include/linux include/linux.xen-x86
     1.5  fi
     1.6  cp ../xen/include/asm-ia64/asm-xsi-offsets.h include/asm-ia64/xen/
     1.7 +cp arch/ia64/xen/drivers/Makefile drivers/xen/Makefile
     1.8 +cp arch/ia64/xen/drivers/coreMakefile drivers/xen/core/Makefile
     1.9 +cp arch/ia64/xen/drivers/xenia64_init.c drivers/xen/core
    1.10 +cp arch/ia64/xen/drivers/evtchn_ia64.c drivers/xen/core
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/Makefile	Fri Sep 23 08:12:28 2005 -0600
     2.3 @@ -0,0 +1,19 @@
     2.4 +
     2.5 +
     2.6 +obj-y	+= core/
     2.7 +obj-y	+= console/
     2.8 +obj-y	+= evtchn/
     2.9 +#obj-y	+= balloon/
    2.10 +obj-y	+= privcmd/
    2.11 +obj-y	+= blkback/
    2.12 +#obj-y	+= netback/
    2.13 +obj-y	+= blkfront/
    2.14 +obj-y	+= xenbus/
    2.15 +#obj-y	+= netfront/
    2.16 +#obj-$(CONFIG_XEN_PRIVILEGED_GUEST)	+= privcmd/
    2.17 +#obj-$(CONFIG_XEN_BLKDEV_BACKEND)	+= blkback/
    2.18 +#obj-$(CONFIG_XEN_NETDEV_BACKEND)	+= netback/
    2.19 +#obj-$(CONFIG_XEN_BLKDEV_FRONTEND)	+= blkfront/
    2.20 +#obj-$(CONFIG_XEN_NETDEV_FRONTEND)	+= netfront/
    2.21 +#obj-$(CONFIG_XEN_BLKDEV_TAP)    	+= blktap/
    2.22 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/README	Fri Sep 23 08:12:28 2005 -0600
     3.3 @@ -0,0 +1,2 @@
     3.4 +This is a temporary location for source/Makefiles that need to be
     3.5 +patched/reworked in drivers/xen to work with xenlinux/ia64.
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/coreMakefile	Fri Sep 23 08:12:28 2005 -0600
     4.3 @@ -0,0 +1,24 @@
     4.4 +#
     4.5 +# Makefile for the linux kernel.
     4.6 +#
     4.7 +
     4.8 +XENARCH	:= $(subst ",,$(CONFIG_XENARCH))
     4.9 +
    4.10 +CPPFLAGS_vmlinux.lds += -U$(XENARCH)
    4.11 +
    4.12 +$(obj)/vmlinux.lds.S:
    4.13 +	@ln -fsn $(srctree)/arch/$(XENARCH)/kernel/vmlinux.lds.S $@
    4.14 +
    4.15 +
    4.16 +obj-y   := gnttab.o devmem.o
    4.17 +obj-$(CONFIG_PROC_FS) += xen_proc.o
    4.18 +
    4.19 +ifeq ($(ARCH),ia64)
    4.20 +obj-y   += evtchn_ia64.o
    4.21 +obj-y   += xenia64_init.o
    4.22 +else
    4.23 +extra-y += vmlinux.lds
    4.24 +obj-y   += reboot.o evtchn.o fixup.o 
    4.25 +obj-$(CONFIG_SMP)     += smp.o		# setup_profiling_timer def'd in ia64
    4.26 +obj-$(CONFIG_NET)     += skbuff.o	# until networking is up on ia64
    4.27 +endif
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/evtchn_ia64.c	Fri Sep 23 08:12:28 2005 -0600
     5.3 @@ -0,0 +1,151 @@
     5.4 +/* NOTE: This file split off from evtchn.c because there was
     5.5 +   some discussion that the mechanism is sufficiently different.
     5.6 +   It may be possible to merge it back in the future... djm */
     5.7 +#include <linux/config.h>
     5.8 +#include <linux/kernel.h>
     5.9 +#include <asm/hw_irq.h>
    5.10 +#include <asm-xen/evtchn.h>
    5.11 +
    5.12 +#define MAX_EVTCHN 256
    5.13 +static struct {
    5.14 +	irqreturn_t (*handler)(int, void *, struct pt_regs *);
    5.15 +	void *dev_id;
    5.16 +} evtchns[MAX_EVTCHN];
    5.17 +
    5.18 +int virq_to_evtchn[NR_VIRQS] = {-1};
    5.19 +unsigned int bind_virq_to_evtchn(int virq)
    5.20 +{
    5.21 +    evtchn_op_t op;
    5.22 +
    5.23 +    op.cmd = EVTCHNOP_bind_virq;
    5.24 +    op.u.bind_virq.virq = virq;
    5.25 +    if ( HYPERVISOR_event_channel_op(&op) != 0 )
    5.26 +        BUG();
    5.27 +
    5.28 +    virq_to_evtchn[virq] = op.u.bind_virq.port;
    5.29 +    return op.u.bind_virq.port;
    5.30 +}
    5.31 +
    5.32 +int bind_virq_to_irq(int virq)
    5.33 +{
    5.34 +	printk("bind_virq_to_irq called... FIXME??\n");
    5.35 +	while(1);
    5.36 +}
    5.37 +
    5.38 +void unbind_virq_from_evtchn(int virq)
    5.39 +{
    5.40 +    evtchn_op_t op;
    5.41 +
    5.42 +    op.cmd = EVTCHNOP_close;
    5.43 +    op.u.close.dom = DOMID_SELF;
    5.44 +    op.u.close.port = virq_to_evtchn[virq];
    5.45 +    if ( HYPERVISOR_event_channel_op(&op) != 0 )
    5.46 +	BUG();
    5.47 +
    5.48 +    virq_to_evtchn[virq] = -1;
    5.49 +}
    5.50 +
    5.51 +int bind_evtchn_to_irqhandler(unsigned int evtchn,
    5.52 +                   irqreturn_t (*handler)(int, void *, struct pt_regs *),
    5.53 +                   unsigned long irqflags, const char * devname, void *dev_id)
    5.54 +{
    5.55 +    if (evtchn >= MAX_EVTCHN)
    5.56 +        return -EINVAL;
    5.57 +
    5.58 +    evtchns[evtchn].handler = handler;
    5.59 +    evtchns[evtchn].dev_id = dev_id;
    5.60 +    unmask_evtchn(evtchn);
    5.61 +    return 0;
    5.62 +}
    5.63 +
    5.64 +void unbind_evtchn_from_irqhandler(unsigned int evtchn, void *dev_id)
    5.65 +{
    5.66 +    if (evtchn >= MAX_EVTCHN)
    5.67 +        return;
    5.68 +
    5.69 +    mask_evtchn(evtchn);
    5.70 +    evtchns[evtchn].handler = NULL;
    5.71 +}
    5.72 +
    5.73 +void unbind_evtchn_from_irq(unsigned int evtchn)
    5.74 +{
    5.75 +	printk("unbind_evtchn_from_irq called... FIXME??\n");
    5.76 +	while(1);
    5.77 +}
    5.78 +
    5.79 +irqreturn_t evtchn_interrupt(int irq, void *dev_id, struct pt_regs *regs)
    5.80 +{
    5.81 +    u32            l1, l2;
    5.82 +    unsigned int   l1i, l2i, port;
    5.83 +    irqreturn_t (*handler)(int, void *, struct pt_regs *);
    5.84 +    shared_info_t *s = HYPERVISOR_shared_info;
    5.85 +    vcpu_info_t   *vcpu_info = &s->vcpu_data[smp_processor_id()];
    5.86 +
    5.87 +    vcpu_info->evtchn_upcall_mask = 1;
    5.88 +    vcpu_info->evtchn_upcall_pending = 0;
    5.89 +
    5.90 +    /* NB. No need for a barrier here -- XCHG is a barrier on x86. */
    5.91 +    l1 = xchg(&vcpu_info->evtchn_pending_sel, 0);
    5.92 +    while ( l1 != 0 )
    5.93 +    {
    5.94 +        l1i = __ffs(l1);
    5.95 +        l1 &= ~(1 << l1i);
    5.96 +
    5.97 +        while ( (l2 = s->evtchn_pending[l1i] & ~s->evtchn_mask[l1i]) != 0 )
    5.98 +        {
    5.99 +            l2i = __ffs(l2);
   5.100 +            l2 &= ~(1 << l2i);
   5.101 +
   5.102 +            port = (l1i << 5) + l2i;
   5.103 +            if ( (handler = evtchns[port].handler) != NULL )
   5.104 +	    {
   5.105 +		clear_evtchn(port);
   5.106 +                handler(port, evtchns[port].dev_id, regs);
   5.107 +	    }
   5.108 +            else
   5.109 +	    {
   5.110 +                evtchn_device_upcall(port);
   5.111 +	    }
   5.112 +        }
   5.113 +    }
   5.114 +    vcpu_info->evtchn_upcall_mask = 0;
   5.115 +    return IRQ_HANDLED;
   5.116 +}
   5.117 +
   5.118 +void force_evtchn_callback(void)
   5.119 +{
   5.120 +	//(void)HYPERVISOR_xen_version(0, NULL);
   5.121 +}
   5.122 +
   5.123 +static struct irqaction evtchn_irqaction = {
   5.124 +	.handler =	evtchn_interrupt,
   5.125 +	.flags =	SA_INTERRUPT,
   5.126 +	.name =		"xen-event-channel"
   5.127 +};
   5.128 +
   5.129 +int evtchn_irq = 0xe9;
   5.130 +void __init evtchn_init(void)
   5.131 +{
   5.132 +    shared_info_t *s = HYPERVISOR_shared_info;
   5.133 +    vcpu_info_t   *vcpu_info = &s->vcpu_data[smp_processor_id()];
   5.134 +
   5.135 +#if 0
   5.136 +    int ret;
   5.137 +    irq = assign_irq_vector(AUTO_ASSIGN);
   5.138 +    ret = request_irq(irq, evtchn_interrupt, 0, "xen-event-channel", NULL);
   5.139 +    if (ret < 0)
   5.140 +    {
   5.141 +	printk("xen-event-channel unable to get irq %d (%d)\n", irq, ret);
   5.142 +	return;
   5.143 +    }
   5.144 +#endif
   5.145 +    register_percpu_irq(evtchn_irq, &evtchn_irqaction);
   5.146 +
   5.147 +    vcpu_info->arch.evtchn_vector = evtchn_irq;
   5.148 +    printk("xen-event-channel using irq %d\n", evtchn_irq);
   5.149 +}
   5.150 +
   5.151 +/* Following are set of interfaces unused on IA64/XEN, just keep it here */
   5.152 +
   5.153 +void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu) {}
   5.154 +int teardown_irq(unsigned int irq, struct irqaction * old) {return 0;}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/xenia64_init.c	Fri Sep 23 08:12:28 2005 -0600
     6.3 @@ -0,0 +1,48 @@
     6.4 +#ifdef __ia64__
     6.5 +#include <linux/config.h>
     6.6 +#include <linux/module.h>
     6.7 +#include <linux/efi.h>
     6.8 +#include <asm/sal.h>
     6.9 +#include <asm/hypervisor.h>
    6.10 +/* #include <asm-xen/evtchn.h> */
    6.11 +#include <linux/vmalloc.h>
    6.12 +
    6.13 +shared_info_t *HYPERVISOR_shared_info = (shared_info_t *)0xf100000000000000;
    6.14 +EXPORT_SYMBOL(HYPERVISOR_shared_info);
    6.15 +
    6.16 +static int initialized;
    6.17 +start_info_t *xen_start_info;
    6.18 +
    6.19 +int xen_init(void)
    6.20 +{
    6.21 +	shared_info_t *s = HYPERVISOR_shared_info;
    6.22 +
    6.23 +	if (initialized)
    6.24 +		return running_on_xen ? 0 : -1;
    6.25 +
    6.26 +	if (!running_on_xen)
    6.27 +		return -1;
    6.28 +
    6.29 +	xen_start_info = __va(s->arch.start_info_pfn << PAGE_SHIFT);
    6.30 +	xen_start_info->flags = s->arch.flags;
    6.31 +	printk("Running on Xen! start_info_pfn=0x%lx lags=0x%x\n",
    6.32 +		s->arch.start_info_pfn, xen_start_info->flags);
    6.33 +
    6.34 +	evtchn_init();
    6.35 +	initialized = 1;
    6.36 +	return 0;
    6.37 +}
    6.38 +
    6.39 +/* We just need a range of legal va here, though finally identity
    6.40 + * mapped one is instead used for gnttab mapping.
    6.41 + */
    6.42 +unsigned long alloc_empty_foreign_map_page_range(unsigned long pages)
    6.43 +{
    6.44 +	struct vm_struct *vma;
    6.45 +
    6.46 +	if ( (vma = get_vm_area(PAGE_SIZE * pages, VM_ALLOC)) == NULL )
    6.47 +		return NULL;
    6.48 +
    6.49 +	return (unsigned long)vma->addr;
    6.50 +}
    6.51 +#endif
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-ia64/hypercall.h	Fri Sep 23 08:12:28 2005 -0600
     7.3 @@ -0,0 +1,624 @@
     7.4 +/******************************************************************************
     7.5 + * hypercall.h
     7.6 + * 
     7.7 + * Linux-specific hypervisor handling.
     7.8 + * 
     7.9 + * Copyright (c) 2002-2004, K A Fraser
    7.10 + * 
    7.11 + * This file may be distributed separately from the Linux kernel, or
    7.12 + * incorporated into other software packages, subject to the following license:
    7.13 + * 
    7.14 + * Permission is hereby granted, free of charge, to any person obtaining a copy
    7.15 + * of this source file (the "Software"), to deal in the Software without
    7.16 + * restriction, including without limitation the rights to use, copy, modify,
    7.17 + * merge, publish, distribute, sublicense, and/or sell copies of the Software,
    7.18 + * and to permit persons to whom the Software is furnished to do so, subject to
    7.19 + * the following conditions:
    7.20 + * 
    7.21 + * The above copyright notice and this permission notice shall be included in
    7.22 + * all copies or substantial portions of the Software.
    7.23 + * 
    7.24 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    7.25 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    7.26 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    7.27 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    7.28 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    7.29 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
    7.30 + * IN THE SOFTWARE.
    7.31 + */
    7.32 +
    7.33 +#ifndef __HYPERCALL_H__
    7.34 +#define __HYPERCALL_H__
    7.35 +#include <asm-xen/xen-public/xen.h>
    7.36 +
    7.37 +/* FIXME: temp place to hold these page related macros */
    7.38 +#include <asm/page.h>
    7.39 +#define virt_to_machine(v) __pa(v)
    7.40 +#define machine_to_virt(m) __va(m)
    7.41 +//#define virt_to_mfn(v)	(__pa(v) >> 14)
    7.42 +//#define mfn_to_virt(m)	(__va(m << 14))
    7.43 +#define virt_to_mfn(v)	((__pa(v)) >> PAGE_SHIFT)
    7.44 +#define mfn_to_virt(m)	(__va((m) << PAGE_SHIFT))
    7.45 +
    7.46 +/*
    7.47 + * Assembler stubs for hyper-calls.
    7.48 + */
    7.49 +
    7.50 +#if 0
    7.51 +static inline int
    7.52 +HYPERVISOR_set_trap_table(
    7.53 +    trap_info_t *table)
    7.54 +{
    7.55 +#if 0
    7.56 +    int ret;
    7.57 +    unsigned long ignore;
    7.58 +
    7.59 +    __asm__ __volatile__ (
    7.60 +        TRAP_INSTR
    7.61 +        : "=a" (ret), "=b" (ignore)
    7.62 +	: "0" (__HYPERVISOR_set_trap_table), "1" (table)
    7.63 +	: "memory" );
    7.64 +
    7.65 +    return ret;
    7.66 +#endif
    7.67 +    return 1;
    7.68 +}
    7.69 +
    7.70 +static inline int
    7.71 +HYPERVISOR_mmu_update(
    7.72 +    mmu_update_t *req, int count, int *success_count, domid_t domid)
    7.73 +{
    7.74 +#if 0
    7.75 +    int ret;
    7.76 +    unsigned long ign1, ign2, ign3, ign4;
    7.77 +
    7.78 +    __asm__ __volatile__ (
    7.79 +        TRAP_INSTR
    7.80 +        : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
    7.81 +	: "0" (__HYPERVISOR_mmu_update), "1" (req), "2" (count),
    7.82 +        "3" (success_count), "4" (domid)
    7.83 +	: "memory" );
    7.84 +
    7.85 +    return ret;
    7.86 +#endif
    7.87 +    return 1;
    7.88 +}
    7.89 +
    7.90 +static inline int
    7.91 +HYPERVISOR_mmuext_op(
    7.92 +    struct mmuext_op *op, int count, int *success_count, domid_t domid)
    7.93 +{
    7.94 +#if 0
    7.95 +    int ret;
    7.96 +    unsigned long ign1, ign2, ign3, ign4;
    7.97 +
    7.98 +    __asm__ __volatile__ (
    7.99 +        TRAP_INSTR
   7.100 +        : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
   7.101 +	: "0" (__HYPERVISOR_mmuext_op), "1" (op), "2" (count),
   7.102 +        "3" (success_count), "4" (domid)
   7.103 +	: "memory" );
   7.104 +
   7.105 +    return ret;
   7.106 +#endif
   7.107 +    return 1;
   7.108 +}
   7.109 +
   7.110 +static inline int
   7.111 +HYPERVISOR_set_gdt(
   7.112 +    unsigned long *frame_list, int entries)
   7.113 +{
   7.114 +#if 0
   7.115 +    int ret;
   7.116 +    unsigned long ign1, ign2;
   7.117 +
   7.118 +    __asm__ __volatile__ (
   7.119 +        TRAP_INSTR
   7.120 +        : "=a" (ret), "=b" (ign1), "=c" (ign2)
   7.121 +	: "0" (__HYPERVISOR_set_gdt), "1" (frame_list), "2" (entries)
   7.122 +	: "memory" );
   7.123 +
   7.124 +
   7.125 +    return ret;
   7.126 +#endif
   7.127 +    return 1;
   7.128 +}
   7.129 +
   7.130 +static inline int
   7.131 +HYPERVISOR_stack_switch(
   7.132 +    unsigned long ss, unsigned long esp)
   7.133 +{
   7.134 +#if 0
   7.135 +    int ret;
   7.136 +    unsigned long ign1, ign2;
   7.137 +
   7.138 +    __asm__ __volatile__ (
   7.139 +        TRAP_INSTR
   7.140 +        : "=a" (ret), "=b" (ign1), "=c" (ign2)
   7.141 +	: "0" (__HYPERVISOR_stack_switch), "1" (ss), "2" (esp)
   7.142 +	: "memory" );
   7.143 +
   7.144 +    return ret;
   7.145 +#endif
   7.146 +    return 1;
   7.147 +}
   7.148 +
   7.149 +static inline int
   7.150 +HYPERVISOR_set_callbacks(
   7.151 +    unsigned long event_selector, unsigned long event_address,
   7.152 +    unsigned long failsafe_selector, unsigned long failsafe_address)
   7.153 +{
   7.154 +#if 0
   7.155 +    int ret;
   7.156 +    unsigned long ign1, ign2, ign3, ign4;
   7.157 +
   7.158 +    __asm__ __volatile__ (
   7.159 +        TRAP_INSTR
   7.160 +        : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
   7.161 +	: "0" (__HYPERVISOR_set_callbacks), "1" (event_selector),
   7.162 +	  "2" (event_address), "3" (failsafe_selector), "4" (failsafe_address)
   7.163 +	: "memory" );
   7.164 +
   7.165 +    return ret;
   7.166 +#endif
   7.167 +    return 1;
   7.168 +}
   7.169 +
   7.170 +static inline int
   7.171 +HYPERVISOR_fpu_taskswitch(
   7.172 +    int set)
   7.173 +{
   7.174 +#if 0
   7.175 +    int ret;
   7.176 +    unsigned long ign;
   7.177 +
   7.178 +    __asm__ __volatile__ (
   7.179 +        TRAP_INSTR
   7.180 +        : "=a" (ret), "=b" (ign)
   7.181 +        : "0" (__HYPERVISOR_fpu_taskswitch), "1" (set)
   7.182 +        : "memory" );
   7.183 +
   7.184 +    return ret;
   7.185 +#endif
   7.186 +    return 1;
   7.187 +}
   7.188 +
   7.189 +static inline int
   7.190 +HYPERVISOR_yield(
   7.191 +    void)
   7.192 +{
   7.193 +#if 0
   7.194 +    int ret;
   7.195 +    unsigned long ign;
   7.196 +
   7.197 +    __asm__ __volatile__ (
   7.198 +        TRAP_INSTR
   7.199 +        : "=a" (ret), "=b" (ign)
   7.200 +	: "0" (__HYPERVISOR_sched_op), "1" (SCHEDOP_yield)
   7.201 +	: "memory" );
   7.202 +
   7.203 +    return ret;
   7.204 +#endif
   7.205 +    return 1;
   7.206 +}
   7.207 +
   7.208 +static inline int
   7.209 +HYPERVISOR_block(
   7.210 +    void)
   7.211 +{
   7.212 +#if 0
   7.213 +    int ret;
   7.214 +    unsigned long ign1;
   7.215 +    __asm__ __volatile__ (
   7.216 +        TRAP_INSTR
   7.217 +        : "=a" (ret), "=b" (ign1)
   7.218 +	: "0" (__HYPERVISOR_sched_op), "1" (SCHEDOP_block)
   7.219 +	: "memory" );
   7.220 +
   7.221 +    return ret;
   7.222 +#endif
   7.223 +    return 1;
   7.224 +}
   7.225 +
   7.226 +static inline int
   7.227 +HYPERVISOR_shutdown(
   7.228 +    void)
   7.229 +{
   7.230 +#if 0
   7.231 +    int ret;
   7.232 +    unsigned long ign1;
   7.233 +    __asm__ __volatile__ (
   7.234 +        TRAP_INSTR
   7.235 +        : "=a" (ret), "=b" (ign1)
   7.236 +	: "0" (__HYPERVISOR_sched_op),
   7.237 +	  "1" (SCHEDOP_shutdown | (SHUTDOWN_poweroff << SCHEDOP_reasonshift))
   7.238 +        : "memory" );
   7.239 +
   7.240 +    return ret;
   7.241 +#endif
   7.242 +    return 1;
   7.243 +}
   7.244 +
   7.245 +static inline int
   7.246 +HYPERVISOR_reboot(
   7.247 +    void)
   7.248 +{
   7.249 +#if 0
   7.250 +    int ret;
   7.251 +    unsigned long ign1;
   7.252 +    __asm__ __volatile__ (
   7.253 +        TRAP_INSTR
   7.254 +        : "=a" (ret), "=b" (ign1)
   7.255 +	: "0" (__HYPERVISOR_sched_op),
   7.256 +	  "1" (SCHEDOP_shutdown | (SHUTDOWN_reboot << SCHEDOP_reasonshift))
   7.257 +        : "memory" );
   7.258 +
   7.259 +    return ret;
   7.260 +#endif
   7.261 +    return 1;
   7.262 +}
   7.263 +
   7.264 +static inline int
   7.265 +HYPERVISOR_suspend(
   7.266 +    unsigned long srec)
   7.267 +{
   7.268 +#if 0
   7.269 +    int ret;
   7.270 +    unsigned long ign1, ign2;
   7.271 +
   7.272 +    /* NB. On suspend, control software expects a suspend record in %esi. */
   7.273 +    __asm__ __volatile__ (
   7.274 +        TRAP_INSTR
   7.275 +        : "=a" (ret), "=b" (ign1), "=S" (ign2)
   7.276 +	: "0" (__HYPERVISOR_sched_op),
   7.277 +        "b" (SCHEDOP_shutdown | (SHUTDOWN_suspend << SCHEDOP_reasonshift)), 
   7.278 +        "S" (srec) : "memory");
   7.279 +
   7.280 +    return ret;
   7.281 +#endif
   7.282 +    return 1;
   7.283 +}
   7.284 +
   7.285 +static inline int
   7.286 +HYPERVISOR_crash(
   7.287 +    void)
   7.288 +{
   7.289 +#if 0
   7.290 +    int ret;
   7.291 +    unsigned long ign1;
   7.292 +    __asm__ __volatile__ (
   7.293 +        TRAP_INSTR
   7.294 +        : "=a" (ret), "=b" (ign1)
   7.295 +	: "0" (__HYPERVISOR_sched_op),
   7.296 +	  "1" (SCHEDOP_shutdown | (SHUTDOWN_crash << SCHEDOP_reasonshift))
   7.297 +        : "memory" );
   7.298 +
   7.299 +    return ret;
   7.300 +#endif
   7.301 +    return 1;
   7.302 +}
   7.303 +
   7.304 +static inline long
   7.305 +HYPERVISOR_set_timer_op(
   7.306 +    u64 timeout)
   7.307 +{
   7.308 +#if 0
   7.309 +    int ret;
   7.310 +    unsigned long timeout_hi = (unsigned long)(timeout>>32);
   7.311 +    unsigned long timeout_lo = (unsigned long)timeout;
   7.312 +    unsigned long ign1, ign2;
   7.313 +
   7.314 +    __asm__ __volatile__ (
   7.315 +        TRAP_INSTR
   7.316 +        : "=a" (ret), "=b" (ign1), "=c" (ign2)
   7.317 +	: "0" (__HYPERVISOR_set_timer_op), "b" (timeout_lo), "c" (timeout_hi)
   7.318 +	: "memory");
   7.319 +
   7.320 +    return ret;
   7.321 +#endif
   7.322 +    return 1;
   7.323 +}
   7.324 +
   7.325 +static inline int
   7.326 +HYPERVISOR_dom0_op(
   7.327 +    dom0_op_t *dom0_op)
   7.328 +{
   7.329 +#if 0
   7.330 +    int ret;
   7.331 +    unsigned long ign1;
   7.332 +
   7.333 +    dom0_op->interface_version = DOM0_INTERFACE_VERSION;
   7.334 +    __asm__ __volatile__ (
   7.335 +        TRAP_INSTR
   7.336 +        : "=a" (ret), "=b" (ign1)
   7.337 +	: "0" (__HYPERVISOR_dom0_op), "1" (dom0_op)
   7.338 +	: "memory");
   7.339 +
   7.340 +    return ret;
   7.341 +#endif
   7.342 +    return 1;
   7.343 +}
   7.344 +
   7.345 +static inline int
   7.346 +HYPERVISOR_set_debugreg(
   7.347 +    int reg, unsigned long value)
   7.348 +{
   7.349 +#if 0
   7.350 +    int ret;
   7.351 +    unsigned long ign1, ign2;
   7.352 +    __asm__ __volatile__ (
   7.353 +        TRAP_INSTR
   7.354 +        : "=a" (ret), "=b" (ign1), "=c" (ign2)
   7.355 +	: "0" (__HYPERVISOR_set_debugreg), "1" (reg), "2" (value)
   7.356 +	: "memory" );
   7.357 +
   7.358 +    return ret;
   7.359 +#endif
   7.360 +    return 1;
   7.361 +}
   7.362 +
   7.363 +static inline unsigned long
   7.364 +HYPERVISOR_get_debugreg(
   7.365 +    int reg)
   7.366 +{
   7.367 +#if 0
   7.368 +    unsigned long ret;
   7.369 +    unsigned long ign;
   7.370 +    __asm__ __volatile__ (
   7.371 +        TRAP_INSTR
   7.372 +        : "=a" (ret), "=b" (ign)
   7.373 +	: "0" (__HYPERVISOR_get_debugreg), "1" (reg)
   7.374 +	: "memory" );
   7.375 +
   7.376 +    return ret;
   7.377 +#endif
   7.378 +    return 1;
   7.379 +}
   7.380 +
   7.381 +static inline int
   7.382 +HYPERVISOR_update_descriptor(
   7.383 +    unsigned long ma, unsigned long word1, unsigned long word2)
   7.384 +{
   7.385 +#if 0
   7.386 +    int ret;
   7.387 +    unsigned long ign1, ign2, ign3;
   7.388 +
   7.389 +    __asm__ __volatile__ (
   7.390 +        TRAP_INSTR
   7.391 +        : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
   7.392 +	: "0" (__HYPERVISOR_update_descriptor), "1" (ma), "2" (word1),
   7.393 +	  "3" (word2)
   7.394 +	: "memory" );
   7.395 +
   7.396 +    return ret;
   7.397 +#endif
   7.398 +    return 1;
   7.399 +}
   7.400 +
   7.401 +static inline int
   7.402 +HYPERVISOR_set_fast_trap(
   7.403 +    int idx)
   7.404 +{
   7.405 +#if 0
   7.406 +    int ret;
   7.407 +    unsigned long ign;
   7.408 +
   7.409 +    __asm__ __volatile__ (
   7.410 +        TRAP_INSTR
   7.411 +        : "=a" (ret), "=b" (ign)
   7.412 +	: "0" (__HYPERVISOR_set_fast_trap), "1" (idx)
   7.413 +	: "memory" );
   7.414 +
   7.415 +    return ret;
   7.416 +#endif
   7.417 +    return 1;
   7.418 +}
   7.419 +
   7.420 +static inline int
   7.421 +HYPERVISOR_dom_mem_op(
   7.422 +    unsigned int op, unsigned long *extent_list,
   7.423 +    unsigned long nr_extents, unsigned int extent_order)
   7.424 +{
   7.425 +#if 0
   7.426 +    int ret;
   7.427 +    unsigned long ign1, ign2, ign3, ign4, ign5;
   7.428 +
   7.429 +    __asm__ __volatile__ (
   7.430 +        TRAP_INSTR
   7.431 +        : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4),
   7.432 +	  "=D" (ign5)
   7.433 +	: "0" (__HYPERVISOR_dom_mem_op), "1" (op), "2" (extent_list),
   7.434 +	  "3" (nr_extents), "4" (extent_order), "5" (DOMID_SELF)
   7.435 +        : "memory" );
   7.436 +
   7.437 +    return ret;
   7.438 +#endif
   7.439 +    return 1;
   7.440 +}
   7.441 +
   7.442 +static inline int
   7.443 +HYPERVISOR_multicall(
   7.444 +    void *call_list, int nr_calls)
   7.445 +{
   7.446 +#if 0
   7.447 +    int ret;
   7.448 +    unsigned long ign1, ign2;
   7.449 +
   7.450 +    __asm__ __volatile__ (
   7.451 +        TRAP_INSTR
   7.452 +        : "=a" (ret), "=b" (ign1), "=c" (ign2)
   7.453 +	: "0" (__HYPERVISOR_multicall), "1" (call_list), "2" (nr_calls)
   7.454 +	: "memory" );
   7.455 +
   7.456 +    return ret;
   7.457 +#endif
   7.458 +    return 1;
   7.459 +}
   7.460 +
   7.461 +static inline int
   7.462 +HYPERVISOR_update_va_mapping(
   7.463 +    unsigned long va, pte_t new_val, unsigned long flags)
   7.464 +{
   7.465 +#if 0
   7.466 +    int ret;
   7.467 +    unsigned long ign1, ign2, ign3;
   7.468 +
   7.469 +    __asm__ __volatile__ (
   7.470 +        TRAP_INSTR
   7.471 +        : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
   7.472 +	: "0" (__HYPERVISOR_update_va_mapping), 
   7.473 +          "1" (va), "2" ((new_val).pte_low), "3" (flags)
   7.474 +	: "memory" );
   7.475 +
   7.476 +    if ( unlikely(ret < 0) )
   7.477 +    {
   7.478 +        printk(KERN_ALERT "Failed update VA mapping: %08lx, %08lx, %08lx\n",
   7.479 +               va, (new_val).pte_low, flags);
   7.480 +        BUG();
   7.481 +    }
   7.482 +
   7.483 +    return ret;
   7.484 +#endif
   7.485 +    return 1;
   7.486 +}
   7.487 +#endif
   7.488 +
   7.489 +static inline int
   7.490 +HYPERVISOR_event_channel_op(
   7.491 +    void *op)
   7.492 +{
   7.493 +    int ret;
   7.494 +    __asm__ __volatile__ ( ";; mov r14=%2 ; mov r2=%1 ; break 0x1000 ;; mov %0=r8 ;;"
   7.495 +        : "=r" (ret)
   7.496 +        : "i" (__HYPERVISOR_event_channel_op), "r"(op)
   7.497 +        : "r14","r2","r8","memory" );
   7.498 +    return ret;
   7.499 +}
   7.500 +
   7.501 +#if 0
   7.502 +static inline int
   7.503 +HYPERVISOR_xen_version(
   7.504 +    int cmd)
   7.505 +{
   7.506 +#if 0
   7.507 +    int ret;
   7.508 +    unsigned long ignore;
   7.509 +
   7.510 +    __asm__ __volatile__ (
   7.511 +        TRAP_INSTR
   7.512 +        : "=a" (ret), "=b" (ignore)
   7.513 +	: "0" (__HYPERVISOR_xen_version), "1" (cmd)
   7.514 +	: "memory" );
   7.515 +
   7.516 +    return ret;
   7.517 +#endif
   7.518 +    return 1;
   7.519 +}
   7.520 +#endif
   7.521 +
   7.522 +static inline int
   7.523 +HYPERVISOR_console_io(
   7.524 +    int cmd, int count, char *str)
   7.525 +{
   7.526 +    int ret;
   7.527 +    __asm__ __volatile__ ( ";; mov r14=%2 ; mov r15=%3 ; mov r16=%4 ; mov r2=%1 ; break 0x1000 ;; mov %0=r8 ;;"
   7.528 +        : "=r" (ret)
   7.529 +        : "i" (__HYPERVISOR_console_io), "r"(cmd), "r"(count), "r"(str)
   7.530 +        : "r14","r15","r16","r2","r8","memory" );
   7.531 +    return ret;
   7.532 +}
   7.533 +
   7.534 +#if 0
   7.535 +static inline int
   7.536 +HYPERVISOR_physdev_op(
   7.537 +    void *physdev_op)
   7.538 +{
   7.539 +#if 0
   7.540 +    int ret;
   7.541 +    unsigned long ign;
   7.542 +
   7.543 +    __asm__ __volatile__ (
   7.544 +        TRAP_INSTR
   7.545 +        : "=a" (ret), "=b" (ign)
   7.546 +	: "0" (__HYPERVISOR_physdev_op), "1" (physdev_op)
   7.547 +	: "memory" );
   7.548 +
   7.549 +    return ret;
   7.550 +#endif
   7.551 +    return 1;
   7.552 +}
   7.553 +#endif
   7.554 +
   7.555 +static inline int
   7.556 +HYPERVISOR_grant_table_op(
   7.557 +    unsigned int cmd, void *uop, unsigned int count)
   7.558 +{
   7.559 +    int ret;
   7.560 +    __asm__ __volatile__ ( ";; mov r14=%2 ; mov r15=%3 ; mov r16=%4 ; mov r2=%1 ; break 0x1000 ;; mov %0=r8 ;;"
   7.561 +        : "=r" (ret)
   7.562 +        : "i" (__HYPERVISOR_grant_table_op), "r"(cmd), "r"(uop), "r"(count)
   7.563 +        : "r14","r15","r16","r2","r8","memory" );
   7.564 +    return ret;
   7.565 +}
   7.566 +
   7.567 +#if 0
   7.568 +static inline int
   7.569 +HYPERVISOR_update_va_mapping_otherdomain(
   7.570 +    unsigned long va, pte_t new_val, unsigned long flags, domid_t domid)
   7.571 +{
   7.572 +#if 0
   7.573 +    int ret;
   7.574 +    unsigned long ign1, ign2, ign3, ign4;
   7.575 +
   7.576 +    __asm__ __volatile__ (
   7.577 +        TRAP_INSTR
   7.578 +        : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
   7.579 +	: "0" (__HYPERVISOR_update_va_mapping_otherdomain),
   7.580 +          "1" (va), "2" ((new_val).pte_low), "3" (flags), "4" (domid) :
   7.581 +        "memory" );
   7.582 +    
   7.583 +    return ret;
   7.584 +#endif
   7.585 +    return 1;
   7.586 +}
   7.587 +
   7.588 +static inline int
   7.589 +HYPERVISOR_vm_assist(
   7.590 +    unsigned int cmd, unsigned int type)
   7.591 +{
   7.592 +#if 0
   7.593 +    int ret;
   7.594 +    unsigned long ign1, ign2;
   7.595 +
   7.596 +    __asm__ __volatile__ (
   7.597 +        TRAP_INSTR
   7.598 +        : "=a" (ret), "=b" (ign1), "=c" (ign2)
   7.599 +	: "0" (__HYPERVISOR_vm_assist), "1" (cmd), "2" (type)
   7.600 +	: "memory" );
   7.601 +
   7.602 +    return ret;
   7.603 +#endif
   7.604 +    return 1;
   7.605 +}
   7.606 +
   7.607 +static inline int
   7.608 +HYPERVISOR_boot_vcpu(
   7.609 +    unsigned long vcpu, vcpu_guest_context_t *ctxt)
   7.610 +{
   7.611 +#if 0
   7.612 +    int ret;
   7.613 +    unsigned long ign1, ign2;
   7.614 +
   7.615 +    __asm__ __volatile__ (
   7.616 +        TRAP_INSTR
   7.617 +        : "=a" (ret), "=b" (ign1), "=c" (ign2)
   7.618 +	: "0" (__HYPERVISOR_boot_vcpu), "1" (vcpu), "2" (ctxt)
   7.619 +	: "memory");
   7.620 +
   7.621 +    return ret;
   7.622 +#endif
   7.623 +    return 1;
   7.624 +}
   7.625 +#endif
   7.626 +
   7.627 +#endif /* __HYPERCALL_H__ */