xen-unstable.hg

changeset 11973:9e8fdcc46fa3

[IA64] Xencomm fixes for HVM PV-drivers and driver domain.

Create xcom_mini.c from xcom_hcall.c

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author awilliam@xenbuild.aw
date Sat Oct 14 16:26:27 2006 -0600 (2006-10-14)
parents b725c9e51a7c
children 7c2a5f96a192
files linux-2.6-xen-sparse/arch/ia64/kernel/setup.c linux-2.6-xen-sparse/arch/ia64/xen/Makefile linux-2.6-xen-sparse/arch/ia64/xen/xcom_hcall.c linux-2.6-xen-sparse/arch/ia64/xen/xcom_mini.c linux-2.6-xen-sparse/arch/ia64/xen/xencomm.c linux-2.6-xen-sparse/include/asm-ia64/hypercall.h linux-2.6-xen-sparse/include/asm-ia64/xen/xcom_hcall.h linux-2.6-xen-sparse/include/asm-ia64/xen/xencomm.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c	Sat Oct 14 13:28:45 2006 -0600
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c	Sat Oct 14 16:26:27 2006 -0600
     1.3 @@ -63,6 +63,7 @@
     1.4  #include <asm/system.h>
     1.5  #ifdef CONFIG_XEN
     1.6  #include <asm/hypervisor.h>
     1.7 +#include <asm/xen/xencomm.h>
     1.8  #endif
     1.9  #include <linux/dma-mapping.h>
    1.10  
    1.11 @@ -76,8 +77,6 @@ EXPORT_SYMBOL(__per_cpu_offset);
    1.12  #endif
    1.13  
    1.14  #ifdef CONFIG_XEN
    1.15 -unsigned long kernel_start_pa;
    1.16 -
    1.17  static int
    1.18  xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
    1.19  {
    1.20 @@ -435,7 +434,9 @@ setup_arch (char **cmdline_p)
    1.21  
    1.22  #ifdef CONFIG_XEN
    1.23  	if (is_running_on_xen()) {
    1.24 -		kernel_start_pa = KERNEL_START - ia64_tpa(KERNEL_START);
    1.25 +		/* Must be done before any hypercall.  */
    1.26 +		xencomm_init();
    1.27 +
    1.28  		setup_xen_features();
    1.29  		/* Register a call for panic conditions. */
    1.30  		notifier_chain_register(&panic_notifier_list, &xen_panic_block);
     2.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/Makefile	Sat Oct 14 13:28:45 2006 -0600
     2.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/Makefile	Sat Oct 14 16:26:27 2006 -0600
     2.3 @@ -4,6 +4,6 @@
     2.4  
     2.5  obj-y := hypercall.o xenivt.o xenentry.o xensetup.o xenpal.o xenhpski.o \
     2.6  	 hypervisor.o pci-dma-xen.o util.o xencomm.o xcom_hcall.o \
     2.7 -	 xcom_privcmd.o
     2.8 +	 xcom_mini.o xcom_privcmd.o
     2.9  
    2.10  pci-dma-xen-y := ../../i386/kernel/pci-dma-xen.o
     3.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/xcom_hcall.c	Sat Oct 14 13:28:45 2006 -0600
     3.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/xcom_hcall.c	Sat Oct 14 16:26:27 2006 -0600
     3.3 @@ -32,7 +32,6 @@
     3.4  #include <xen/interface/callback.h>
     3.5  #include <xen/interface/acm_ops.h>
     3.6  #include <xen/interface/hvm/params.h>
     3.7 -#include <xen/public/privcmd.h>
     3.8  #include <asm/hypercall.h>
     3.9  #include <asm/page.h>
    3.10  #include <asm/uaccess.h>
    3.11 @@ -142,9 +141,18 @@ xencomm_hypercall_sched_op(int cmd, void
    3.12  	case SCHEDOP_yield:
    3.13  	case SCHEDOP_block:
    3.14  	case SCHEDOP_shutdown:
    3.15 -	case SCHEDOP_poll:
    3.16  	case SCHEDOP_remote_shutdown:
    3.17  		break;
    3.18 +	case SCHEDOP_poll:
    3.19 +	{
    3.20 +		sched_poll_t *poll = arg;
    3.21 +		struct xencomm_handle *ports;
    3.22 +
    3.23 +		ports = xencomm_create_inline(xen_guest_handle(poll->ports));
    3.24 +
    3.25 +		set_xen_guest_handle(poll->ports, (void *)ports);
    3.26 +		break;
    3.27 +	}
    3.28  	default:
    3.29  		printk("%s: unknown sched op %d\n", __func__, cmd);
    3.30  		return -ENOSYS;
    3.31 @@ -263,207 +271,3 @@ xencomm_hypercall_suspend(unsigned long 
    3.32  
    3.33  	return xencomm_arch_hypercall_suspend(xencomm_create_inline(&arg));
    3.34  }
    3.35 -
    3.36 -int
    3.37 -xencomm_mini_hypercall_event_channel_op(int cmd, void *op)
    3.38 -{
    3.39 -	struct xencomm_mini xc_area[2];
    3.40 -	int nbr_area = 2;
    3.41 -	struct xencomm_handle *desc;
    3.42 -	int rc;
    3.43 -
    3.44 -	rc = xencomm_create_mini(xc_area, &nbr_area,
    3.45 -	                         op, sizeof(evtchn_op_t), &desc);
    3.46 -	if (rc)
    3.47 -		return rc;
    3.48 -
    3.49 -	return xencomm_arch_hypercall_event_channel_op(cmd, desc);
    3.50 -}
    3.51 -EXPORT_SYMBOL(xencomm_mini_hypercall_event_channel_op);
    3.52 -
    3.53 -static int
    3.54 -xencommize_mini_grant_table_op(struct xencomm_mini *xc_area, int *nbr_area,
    3.55 -                               unsigned int cmd, void *op, unsigned int count,
    3.56 -                               struct xencomm_handle **desc)
    3.57 -{
    3.58 -	struct xencomm_handle *desc1;
    3.59 -	unsigned int argsize;
    3.60 -	int rc;
    3.61 -
    3.62 -	switch (cmd) {
    3.63 -	case GNTTABOP_map_grant_ref:
    3.64 -		argsize = sizeof(struct gnttab_map_grant_ref);
    3.65 -		break;
    3.66 -	case GNTTABOP_unmap_grant_ref:
    3.67 -		argsize = sizeof(struct gnttab_unmap_grant_ref);
    3.68 -		break;
    3.69 -	case GNTTABOP_setup_table:
    3.70 -	{
    3.71 -		struct gnttab_setup_table *setup = op;
    3.72 -
    3.73 -		argsize = sizeof(*setup);
    3.74 -
    3.75 -		if (count != 1)
    3.76 -			return -EINVAL;
    3.77 -		rc = xencomm_create_mini
    3.78 -			(xc_area, nbr_area,
    3.79 -			 xen_guest_handle(setup->frame_list),
    3.80 -			 setup->nr_frames 
    3.81 -			 * sizeof(*xen_guest_handle(setup->frame_list)),
    3.82 -			 &desc1);
    3.83 -		if (rc)
    3.84 -			return rc;
    3.85 -		set_xen_guest_handle(setup->frame_list, (void *)desc1);
    3.86 -		break;
    3.87 -	}
    3.88 -	case GNTTABOP_dump_table:
    3.89 -		argsize = sizeof(struct gnttab_dump_table);
    3.90 -		break;
    3.91 -	case GNTTABOP_transfer:
    3.92 -		argsize = sizeof(struct gnttab_transfer);
    3.93 -		break;
    3.94 -	default:
    3.95 -		printk("%s: unknown mini grant table op %d\n", __func__, cmd);
    3.96 -		BUG();
    3.97 -	}
    3.98 -
    3.99 -	rc = xencomm_create_mini(xc_area, nbr_area, op, count * argsize, desc);
   3.100 -	if (rc)
   3.101 -		return rc;
   3.102 -
   3.103 -	return 0;
   3.104 -}
   3.105 -
   3.106 -int
   3.107 -xencomm_mini_hypercall_grant_table_op(unsigned int cmd, void *op,
   3.108 -                                      unsigned int count)
   3.109 -{
   3.110 -	int rc;
   3.111 -	struct xencomm_handle *desc;
   3.112 -	int nbr_area = 2;
   3.113 -	struct xencomm_mini xc_area[2];
   3.114 -
   3.115 -	rc = xencommize_mini_grant_table_op(xc_area, &nbr_area,
   3.116 -	                                    cmd, op, count, &desc);
   3.117 -	if (rc)
   3.118 -		return rc;
   3.119 -
   3.120 -	return xencomm_arch_hypercall_grant_table_op(cmd, desc, count);
   3.121 -}
   3.122 -EXPORT_SYMBOL(xencomm_mini_hypercall_grant_table_op);
   3.123 -
   3.124 -int
   3.125 -xencomm_mini_hypercall_multicall(void *call_list, int nr_calls)
   3.126 -{
   3.127 -	int i;
   3.128 -	multicall_entry_t *mce;
   3.129 -	int nbr_area = 2 + nr_calls * 3;
   3.130 -	struct xencomm_mini xc_area[nbr_area];
   3.131 -	struct xencomm_handle *desc;
   3.132 -	int rc;
   3.133 -
   3.134 -	for (i = 0; i < nr_calls; i++) {
   3.135 -		mce = (multicall_entry_t *)call_list + i;
   3.136 -
   3.137 -		switch (mce->op) {
   3.138 -		case __HYPERVISOR_update_va_mapping:
   3.139 -		case __HYPERVISOR_mmu_update:
   3.140 -			/* No-op on ia64.  */
   3.141 -			break;
   3.142 -		case __HYPERVISOR_grant_table_op:
   3.143 -			rc = xencommize_mini_grant_table_op
   3.144 -				(xc_area, &nbr_area,
   3.145 -				 mce->args[0], (void *)mce->args[1],
   3.146 -				 mce->args[2], &desc);
   3.147 -			if (rc)
   3.148 -				return rc;
   3.149 -			mce->args[1] = (unsigned long)desc;
   3.150 -			break;
   3.151 -		case __HYPERVISOR_memory_op:
   3.152 -		default:
   3.153 -			printk("%s: unhandled multicall op entry op %lu\n",
   3.154 -			       __func__, mce->op);
   3.155 -			return -ENOSYS;
   3.156 -		}
   3.157 -	}
   3.158 -
   3.159 -	rc = xencomm_create_mini(xc_area, &nbr_area, call_list,
   3.160 -	                         nr_calls * sizeof(multicall_entry_t), &desc);
   3.161 -	if (rc)
   3.162 -		return rc;
   3.163 -
   3.164 -	return xencomm_arch_hypercall_multicall(desc, nr_calls);
   3.165 -}
   3.166 -EXPORT_SYMBOL(xencomm_mini_hypercall_multicall);
   3.167 -
   3.168 -static int
   3.169 -xencommize_mini_memory_reservation(struct xencomm_mini *area, int *nbr_area,
   3.170 -                                   xen_memory_reservation_t *mop)
   3.171 -{
   3.172 -	struct xencomm_handle *desc;
   3.173 -	int rc;
   3.174 -
   3.175 -	rc = xencomm_create_mini
   3.176 -		(area, nbr_area,
   3.177 -		 xen_guest_handle(mop->extent_start),
   3.178 -		 mop->nr_extents 
   3.179 -		 * sizeof(*xen_guest_handle(mop->extent_start)),
   3.180 -		 &desc);
   3.181 -	if (rc)
   3.182 -		return rc;
   3.183 -
   3.184 -	set_xen_guest_handle(mop->extent_start, (void *)desc);
   3.185 -
   3.186 -	return 0;
   3.187 -}
   3.188 -
   3.189 -int
   3.190 -xencomm_mini_hypercall_memory_op(unsigned int cmd, void *arg)
   3.191 -{
   3.192 -	int nbr_area = 4;
   3.193 -	struct xencomm_mini xc_area[4];
   3.194 -	struct xencomm_handle *desc;
   3.195 -	int rc;
   3.196 -	unsigned int argsize;
   3.197 -
   3.198 -	switch (cmd) {
   3.199 -	case XENMEM_increase_reservation:
   3.200 -	case XENMEM_decrease_reservation:
   3.201 -	case XENMEM_populate_physmap:
   3.202 -		argsize = sizeof(xen_memory_reservation_t);
   3.203 -		rc = xencommize_mini_memory_reservation
   3.204 -			(xc_area, &nbr_area, (xen_memory_reservation_t *)arg);
   3.205 -		if (rc)
   3.206 -			return rc;
   3.207 -		break;
   3.208 -		
   3.209 -	case XENMEM_maximum_ram_page:
   3.210 -		argsize = 0;
   3.211 -		break;
   3.212 -
   3.213 -	case XENMEM_exchange:
   3.214 -		argsize = sizeof(xen_memory_exchange_t);
   3.215 -		rc = xencommize_mini_memory_reservation
   3.216 -			(xc_area, &nbr_area,
   3.217 -			 &((xen_memory_exchange_t *)arg)->in);
   3.218 -		if (rc)
   3.219 -			return rc;
   3.220 -		rc = xencommize_mini_memory_reservation
   3.221 -			(xc_area, &nbr_area,
   3.222 -			 &((xen_memory_exchange_t *)arg)->out);
   3.223 -		if (rc)
   3.224 -			return rc;
   3.225 -		break;
   3.226 -
   3.227 -	default:
   3.228 -		printk("%s: unknown mini memory op %d\n", __func__, cmd);
   3.229 -		return -ENOSYS;
   3.230 -	}
   3.231 -
   3.232 -	rc = xencomm_create_mini(xc_area, &nbr_area, arg, argsize, &desc);
   3.233 -	if (rc)
   3.234 -		return rc;
   3.235 -
   3.236 -	return xencomm_arch_hypercall_memory_op(cmd, desc);
   3.237 -}
   3.238 -EXPORT_SYMBOL(xencomm_mini_hypercall_memory_op);
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/xcom_mini.c	Sat Oct 14 16:26:27 2006 -0600
     4.3 @@ -0,0 +1,319 @@
     4.4 +/*
     4.5 + * This program is free software; you can redistribute it and/or modify
     4.6 + * it under the terms of the GNU General Public License as published by
     4.7 + * the Free Software Foundation; either version 2 of the License, or
     4.8 + * (at your option) any later version.
     4.9 + *
    4.10 + * This program is distributed in the hope that it will be useful,
    4.11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4.13 + * GNU General Public License for more details.
    4.14 + *
    4.15 + * You should have received a copy of the GNU General Public License
    4.16 + * along with this program; if not, write to the Free Software
    4.17 + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    4.18 + *
    4.19 + *          Tristan Gingold <tristan.gingold@bull.net>
    4.20 + */
    4.21 +#include <linux/types.h>
    4.22 +#include <linux/errno.h>
    4.23 +#include <linux/kernel.h>
    4.24 +#include <linux/module.h>
    4.25 +#include <xen/interface/xen.h>
    4.26 +#include <xen/interface/dom0_ops.h>
    4.27 +#include <xen/interface/memory.h>
    4.28 +#include <xen/interface/xencomm.h>
    4.29 +#include <xen/interface/version.h>
    4.30 +#include <xen/interface/event_channel.h>
    4.31 +#include <xen/interface/physdev.h>
    4.32 +#include <xen/interface/grant_table.h>
    4.33 +#include <xen/interface/hvm/params.h>
    4.34 +#ifdef CONFIG_VMX_GUEST
    4.35 +#include <asm/hypervisor.h>
    4.36 +#else
    4.37 +#include <asm/hypercall.h>
    4.38 +#endif
    4.39 +#include <asm/xen/xencomm.h>
    4.40 +
    4.41 +int
    4.42 +xencomm_mini_hypercall_event_channel_op(int cmd, void *op)
    4.43 +{
    4.44 +	struct xencomm_mini xc_area[2];
    4.45 +	int nbr_area = 2;
    4.46 +	struct xencomm_handle *desc;
    4.47 +	int rc;
    4.48 +
    4.49 +	rc = xencomm_create_mini(xc_area, &nbr_area,
    4.50 +	                         op, sizeof(evtchn_op_t), &desc);
    4.51 +	if (rc)
    4.52 +		return rc;
    4.53 +
    4.54 +	return xencomm_arch_hypercall_event_channel_op(cmd, desc);
    4.55 +}
    4.56 +EXPORT_SYMBOL(xencomm_mini_hypercall_event_channel_op);
    4.57 +
    4.58 +static int
    4.59 +xencommize_mini_grant_table_op(struct xencomm_mini *xc_area, int *nbr_area,
    4.60 +                               unsigned int cmd, void *op, unsigned int count,
    4.61 +                               struct xencomm_handle **desc)
    4.62 +{
    4.63 +	struct xencomm_handle *desc1;
    4.64 +	unsigned int argsize;
    4.65 +	int rc;
    4.66 +
    4.67 +	switch (cmd) {
    4.68 +	case GNTTABOP_map_grant_ref:
    4.69 +		argsize = sizeof(struct gnttab_map_grant_ref);
    4.70 +		break;
    4.71 +	case GNTTABOP_unmap_grant_ref:
    4.72 +		argsize = sizeof(struct gnttab_unmap_grant_ref);
    4.73 +		break;
    4.74 +	case GNTTABOP_setup_table:
    4.75 +	{
    4.76 +		struct gnttab_setup_table *setup = op;
    4.77 +
    4.78 +		argsize = sizeof(*setup);
    4.79 +
    4.80 +		if (count != 1)
    4.81 +			return -EINVAL;
    4.82 +		rc = xencomm_create_mini
    4.83 +			(xc_area, nbr_area,
    4.84 +			 xen_guest_handle(setup->frame_list),
    4.85 +			 setup->nr_frames 
    4.86 +			 * sizeof(*xen_guest_handle(setup->frame_list)),
    4.87 +			 &desc1);
    4.88 +		if (rc)
    4.89 +			return rc;
    4.90 +		set_xen_guest_handle(setup->frame_list, (void *)desc1);
    4.91 +		break;
    4.92 +	}
    4.93 +	case GNTTABOP_dump_table:
    4.94 +		argsize = sizeof(struct gnttab_dump_table);
    4.95 +		break;
    4.96 +	case GNTTABOP_transfer:
    4.97 +		argsize = sizeof(struct gnttab_transfer);
    4.98 +		break;
    4.99 +	default:
   4.100 +		printk("%s: unknown mini grant table op %d\n", __func__, cmd);
   4.101 +		BUG();
   4.102 +	}
   4.103 +
   4.104 +	rc = xencomm_create_mini(xc_area, nbr_area, op, count * argsize, desc);
   4.105 +	if (rc)
   4.106 +		return rc;
   4.107 +
   4.108 +	return 0;
   4.109 +}
   4.110 +
   4.111 +int
   4.112 +xencomm_mini_hypercall_grant_table_op(unsigned int cmd, void *op,
   4.113 +                                      unsigned int count)
   4.114 +{
   4.115 +	int rc;
   4.116 +	struct xencomm_handle *desc;
   4.117 +	int nbr_area = 2;
   4.118 +	struct xencomm_mini xc_area[2];
   4.119 +
   4.120 +	rc = xencommize_mini_grant_table_op(xc_area, &nbr_area,
   4.121 +	                                    cmd, op, count, &desc);
   4.122 +	if (rc)
   4.123 +		return rc;
   4.124 +
   4.125 +	return xencomm_arch_hypercall_grant_table_op(cmd, desc, count);
   4.126 +}
   4.127 +EXPORT_SYMBOL(xencomm_mini_hypercall_grant_table_op);
   4.128 +
   4.129 +int
   4.130 +xencomm_mini_hypercall_multicall(void *call_list, int nr_calls)
   4.131 +{
   4.132 +	int i;
   4.133 +	multicall_entry_t *mce;
   4.134 +	int nbr_area = 2 + nr_calls * 3;
   4.135 +	struct xencomm_mini xc_area[nbr_area];
   4.136 +	struct xencomm_handle *desc;
   4.137 +	int rc;
   4.138 +
   4.139 +	for (i = 0; i < nr_calls; i++) {
   4.140 +		mce = (multicall_entry_t *)call_list + i;
   4.141 +
   4.142 +		switch (mce->op) {
   4.143 +		case __HYPERVISOR_update_va_mapping:
   4.144 +		case __HYPERVISOR_mmu_update:
   4.145 +			/* No-op on ia64.  */
   4.146 +			break;
   4.147 +		case __HYPERVISOR_grant_table_op:
   4.148 +			rc = xencommize_mini_grant_table_op
   4.149 +				(xc_area, &nbr_area,
   4.150 +				 mce->args[0], (void *)mce->args[1],
   4.151 +				 mce->args[2], &desc);
   4.152 +			if (rc)
   4.153 +				return rc;
   4.154 +			mce->args[1] = (unsigned long)desc;
   4.155 +			break;
   4.156 +		case __HYPERVISOR_memory_op:
   4.157 +		default:
   4.158 +			printk("%s: unhandled multicall op entry op %lu\n",
   4.159 +			       __func__, mce->op);
   4.160 +			return -ENOSYS;
   4.161 +		}
   4.162 +	}
   4.163 +
   4.164 +	rc = xencomm_create_mini(xc_area, &nbr_area, call_list,
   4.165 +	                         nr_calls * sizeof(multicall_entry_t), &desc);
   4.166 +	if (rc)
   4.167 +		return rc;
   4.168 +
   4.169 +	return xencomm_arch_hypercall_multicall(desc, nr_calls);
   4.170 +}
   4.171 +EXPORT_SYMBOL(xencomm_mini_hypercall_multicall);
   4.172 +
   4.173 +static int
   4.174 +xencommize_mini_memory_reservation(struct xencomm_mini *area, int *nbr_area,
   4.175 +                                   xen_memory_reservation_t *mop)
   4.176 +{
   4.177 +	struct xencomm_handle *desc;
   4.178 +	int rc;
   4.179 +
   4.180 +	rc = xencomm_create_mini
   4.181 +		(area, nbr_area,
   4.182 +		 xen_guest_handle(mop->extent_start),
   4.183 +		 mop->nr_extents 
   4.184 +		 * sizeof(*xen_guest_handle(mop->extent_start)),
   4.185 +		 &desc);
   4.186 +	if (rc)
   4.187 +		return rc;
   4.188 +
   4.189 +	set_xen_guest_handle(mop->extent_start, (void *)desc);
   4.190 +
   4.191 +	return 0;
   4.192 +}
   4.193 +
   4.194 +int
   4.195 +xencomm_mini_hypercall_memory_op(unsigned int cmd, void *arg)
   4.196 +{
   4.197 +	int nbr_area = 4;
   4.198 +	struct xencomm_mini xc_area[4];
   4.199 +	struct xencomm_handle *desc;
   4.200 +	int rc;
   4.201 +	unsigned int argsize;
   4.202 +
   4.203 +	switch (cmd) {
   4.204 +	case XENMEM_increase_reservation:
   4.205 +	case XENMEM_decrease_reservation:
   4.206 +	case XENMEM_populate_physmap:
   4.207 +		argsize = sizeof(xen_memory_reservation_t);
   4.208 +		rc = xencommize_mini_memory_reservation
   4.209 +			(xc_area, &nbr_area, (xen_memory_reservation_t *)arg);
   4.210 +		if (rc)
   4.211 +			return rc;
   4.212 +		break;
   4.213 +		
   4.214 +	case XENMEM_maximum_ram_page:
   4.215 +		argsize = 0;
   4.216 +		break;
   4.217 +
   4.218 +	case XENMEM_exchange:
   4.219 +		argsize = sizeof(xen_memory_exchange_t);
   4.220 +		rc = xencommize_mini_memory_reservation
   4.221 +			(xc_area, &nbr_area,
   4.222 +			 &((xen_memory_exchange_t *)arg)->in);
   4.223 +		if (rc)
   4.224 +			return rc;
   4.225 +		rc = xencommize_mini_memory_reservation
   4.226 +			(xc_area, &nbr_area,
   4.227 +			 &((xen_memory_exchange_t *)arg)->out);
   4.228 +		if (rc)
   4.229 +			return rc;
   4.230 +		break;
   4.231 +
   4.232 +	case XENMEM_add_to_physmap:
   4.233 +		argsize = sizeof (xen_add_to_physmap_t);
   4.234 +		break;
   4.235 +
   4.236 +	default:
   4.237 +		printk("%s: unknown mini memory op %d\n", __func__, cmd);
   4.238 +		return -ENOSYS;
   4.239 +	}
   4.240 +
   4.241 +	rc = xencomm_create_mini(xc_area, &nbr_area, arg, argsize, &desc);
   4.242 +	if (rc)
   4.243 +		return rc;
   4.244 +
   4.245 +	return xencomm_arch_hypercall_memory_op(cmd, desc);
   4.246 +}
   4.247 +EXPORT_SYMBOL(xencomm_mini_hypercall_memory_op);
   4.248 +
   4.249 +unsigned long
   4.250 +xencomm_mini_hypercall_hvm_op(int cmd, void *arg)
   4.251 +{
   4.252 +	struct xencomm_handle *desc;
   4.253 +	int nbr_area = 2;
   4.254 +	struct xencomm_mini xc_area[2];
   4.255 +	unsigned int argsize;
   4.256 +	int rc;
   4.257 +
   4.258 +	switch (cmd) {
   4.259 +	case HVMOP_get_param:
   4.260 +	case HVMOP_set_param:
   4.261 +		argsize = sizeof(xen_hvm_param_t);
   4.262 +		break;
   4.263 +	default:
   4.264 +		printk("%s: unknown HVMOP %d\n", __func__, cmd);
   4.265 +		return -EINVAL;
   4.266 +	}
   4.267 +
   4.268 +	rc = xencomm_create_mini(xc_area, &nbr_area, arg, argsize, &desc);
   4.269 +	if (rc)
   4.270 +		return rc;
   4.271 +
   4.272 +	return xencomm_arch_hypercall_hvm_op(cmd, desc);
   4.273 +}
   4.274 +EXPORT_SYMBOL(xencomm_mini_hypercall_hvm_op);
   4.275 +
   4.276 +int
   4.277 +xencomm_mini_hypercall_xen_version(int cmd, void *arg)
   4.278 +{
   4.279 +	struct xencomm_handle *desc;
   4.280 +	int nbr_area = 2;
   4.281 +	struct xencomm_mini xc_area[2];
   4.282 +	unsigned int argsize;
   4.283 +	int rc;
   4.284 +
   4.285 +	switch (cmd) {
   4.286 +	case XENVER_version:
   4.287 +		/* do not actually pass an argument */
   4.288 +		return xencomm_arch_hypercall_xen_version(cmd, 0);
   4.289 +	case XENVER_extraversion:
   4.290 +		argsize = sizeof(xen_extraversion_t);
   4.291 +		break;
   4.292 +	case XENVER_compile_info:
   4.293 +		argsize = sizeof(xen_compile_info_t);
   4.294 +		break;
   4.295 +	case XENVER_capabilities:
   4.296 +		argsize = sizeof(xen_capabilities_info_t);
   4.297 +		break;
   4.298 +	case XENVER_changeset:
   4.299 +		argsize = sizeof(xen_changeset_info_t);
   4.300 +		break;
   4.301 +	case XENVER_platform_parameters:
   4.302 +		argsize = sizeof(xen_platform_parameters_t);
   4.303 +		break;
   4.304 +	case XENVER_pagesize:
   4.305 +		argsize = (arg == NULL) ? 0 : sizeof(void *);
   4.306 +		break;
   4.307 +	case XENVER_get_features:
   4.308 +		argsize = (arg == NULL) ? 0 : sizeof(xen_feature_info_t);
   4.309 +		break;
   4.310 +
   4.311 +	default:
   4.312 +		printk("%s: unknown version op %d\n", __func__, cmd);
   4.313 +		return -ENOSYS;
   4.314 +	}
   4.315 +
   4.316 +	rc = xencomm_create_mini(xc_area, &nbr_area, arg, argsize, &desc);
   4.317 +	if (rc)
   4.318 +		return rc;
   4.319 +
   4.320 +	return xencomm_arch_hypercall_xen_version(cmd, desc);
   4.321 +}
   4.322 +EXPORT_SYMBOL(xencomm_mini_hypercall_xen_version);
     5.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/xencomm.c	Sat Oct 14 13:28:45 2006 -0600
     5.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/xencomm.c	Sat Oct 14 16:26:27 2006 -0600
     5.3 @@ -18,12 +18,20 @@
     5.4  
     5.5  #include <linux/gfp.h>
     5.6  #include <linux/mm.h>
     5.7 +#include <xen/interface/xen.h>
     5.8  #include <asm/page.h>
     5.9  #include <asm/xen/xencomm.h>
    5.10 -#include <xen/interface/xen.h>
    5.11  
    5.12  static int xencomm_debug = 0;
    5.13  
    5.14 +static unsigned long kernel_start_pa;
    5.15 +
    5.16 +void
    5.17 +xencomm_init (void)
    5.18 +{
    5.19 +	kernel_start_pa = KERNEL_START - ia64_tpa(KERNEL_START);
    5.20 +}
    5.21 +
    5.22  /* Translate virtual address to physical address.  */
    5.23  unsigned long
    5.24  xencomm_vaddr_to_paddr(unsigned long vaddr)
    5.25 @@ -47,8 +55,6 @@ xencomm_vaddr_to_paddr(unsigned long vad
    5.26  		   work on  addresses.  */
    5.27  		if (vaddr >= KERNEL_START
    5.28  		    && vaddr < (KERNEL_START + KERNEL_TR_PAGE_SIZE)) {
    5.29 -			extern unsigned long kernel_start_pa;
    5.30 -			
    5.31  			return vaddr - kernel_start_pa;
    5.32  		}
    5.33  
    5.34 @@ -78,6 +84,11 @@ xencomm_vaddr_to_paddr(unsigned long vad
    5.35  		return __pa(vaddr);
    5.36  	}
    5.37  
    5.38 +
    5.39 +#ifdef CONFIG_VMX_GUEST
    5.40 +	/* No privcmd within vmx guest.  */
    5.41 +	return ~0UL;
    5.42 +#else
    5.43  	/* XXX double-check (lack of) locking */
    5.44  	vma = find_extend_vma(current->mm, vaddr);
    5.45  	if (!vma)
    5.46 @@ -89,10 +100,11 @@ xencomm_vaddr_to_paddr(unsigned long vad
    5.47  		return ~0UL;
    5.48  
    5.49  	return (page_to_pfn(page) << PAGE_SHIFT) | (vaddr & ~PAGE_MASK);
    5.50 +#endif
    5.51  }
    5.52  
    5.53  static int
    5.54 -xencomm_init(struct xencomm_desc *desc, void *buffer, unsigned long bytes)
    5.55 +xencomm_init_desc(struct xencomm_desc *desc, void *buffer, unsigned long bytes)
    5.56  {
    5.57  	unsigned long recorded = 0;
    5.58  	int i = 0;
    5.59 @@ -183,9 +195,9 @@ xencomm_create(void *buffer, unsigned lo
    5.60  	}
    5.61  	handle = (struct xencomm_handle *)__pa(desc);
    5.62  
    5.63 -	rc = xencomm_init(desc, buffer, bytes);
    5.64 +	rc = xencomm_init_desc(desc, buffer, bytes);
    5.65  	if (rc) {
    5.66 -		printk("%s failure: %d\n", "xencomm_init", rc);
    5.67 +		printk("%s failure: %d\n", "xencomm_init_desc", rc);
    5.68  		xencomm_free(handle);
    5.69  		return rc;
    5.70  	}
    5.71 @@ -231,7 +243,7 @@ xencomm_create_mini(struct xencomm_mini 
    5.72  		return -ENOMEM;
    5.73  	desc->nr_addrs = XENCOMM_MINI_ADDRS;
    5.74  
    5.75 -	rc = xencomm_init(desc, buffer, bytes);
    5.76 +	rc = xencomm_init_desc(desc, buffer, bytes);
    5.77  	if (rc)
    5.78  		return rc;
    5.79  
     6.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h	Sat Oct 14 13:28:45 2006 -0600
     6.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h	Sat Oct 14 16:26:27 2006 -0600
     6.3 @@ -402,11 +402,7 @@ HYPERVISOR_expose_p2m(unsigned long conv
     6.4  #define HYPERVISOR_xen_version xencomm_mini_hypercall_xen_version
     6.5  #define HYPERVISOR_console_io xencomm_mini_hypercall_console_io
     6.6  #define HYPERVISOR_hvm_op xencomm_mini_hypercall_hvm_op
     6.7 -#ifdef CONFIG_VMX_GUEST
     6.8 -#define HYPERVISOR_memory_op 0
     6.9 -#else
    6.10  #define HYPERVISOR_memory_op xencomm_mini_hypercall_memory_op
    6.11 -#endif
    6.12  #else
    6.13  #define HYPERVISOR_sched_op xencomm_hypercall_sched_op
    6.14  #define HYPERVISOR_event_channel_op xencomm_hypercall_event_channel_op
     7.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/xen/xcom_hcall.h	Sat Oct 14 13:28:45 2006 -0600
     7.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/xen/xcom_hcall.h	Sat Oct 14 16:26:27 2006 -0600
     7.3 @@ -66,6 +66,8 @@ extern int xencomm_mini_hypercall_callba
     7.4  
     7.5  extern int xencomm_mini_hypercall_memory_op(unsigned int cmd, void *arg);
     7.6  
     7.7 +extern unsigned long xencomm_mini_hypercall_hvm_op(int cmd, void *arg);
     7.8 +
     7.9  /* For privcmd.  Locally declare argument type to avoid include storm.
    7.10     Type coherency will be checked within privcmd.c  */
    7.11  struct privcmd_hypercall;
     8.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/xen/xencomm.h	Sat Oct 14 13:28:45 2006 -0600
     8.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/xen/xencomm.h	Sat Oct 14 16:26:27 2006 -0600
     8.3 @@ -27,6 +27,9 @@ struct xencomm_mini {
     8.4  	uint64_t address[XENCOMM_MINI_ADDRS];
     8.5  };
     8.6  
     8.7 +/* Must be called before any hypercall.  */
     8.8 +extern void xencomm_init (void);
     8.9 +
    8.10  /* To avoid additionnal virt to phys conversion, an opaque structure is
    8.11     presented.  */
    8.12  struct xencomm_handle;