ia64/xen-unstable

changeset 9761:d63c6ba11c65

[IA64] add dom0vp hypercall interfaces

adds the dom0vp hypercall interfaces.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author awilliam@ldap.hp.com
date Tue Apr 25 14:02:21 2006 -0600 (2006-04-25)
parents 8a2b2b45e237
children a3cc276f2e87
files linux-2.6-xen-sparse/include/asm-ia64/hypercall.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h	Tue Apr 25 13:57:56 2006 -0600
     1.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/hypercall.h	Tue Apr 25 14:02:21 2006 -0600
     1.3 @@ -271,4 +271,210 @@ extern fastcall unsigned int __do_IRQ(un
     1.4  static inline void exit_idle(void) {}
     1.5  #define do_IRQ(irq, regs) __do_IRQ((irq), (regs))
     1.6  
     1.7 +#ifdef CONFIG_XEN_IA64_DOM0_VP
     1.8 +#include <asm/xen/privop.h>
     1.9 +
    1.10 +#define _hypercall_imm1(type, name, imm, a1)			\
    1.11 +({								\
    1.12 +	long __res;						\
    1.13 +	__asm__ __volatile__ (";;\n"				\
    1.14 +			      "mov r14=%2\n"			\
    1.15 +			      "mov r15=%3\n"			\
    1.16 +			      "mov r2=%1\n"			\
    1.17 +			      "break 0x1000 ;;\n"		\
    1.18 +			      "mov %0=r8 ;;\n"			\
    1.19 +			      : "=r" (__res)			\
    1.20 +			      : "i" (__HYPERVISOR_##name),	\
    1.21 +				"i" (imm),			\
    1.22 +				"r" ((unsigned long)(a1))	\
    1.23 +			      : "r14","r15","r2","r8",		\
    1.24 +				"memory" );			\
    1.25 +	(type)__res;						\
    1.26 +})
    1.27 +
    1.28 +#define _hypercall_imm2(type, name, imm, a1, a2)		\
    1.29 +({								\
    1.30 +	long __res;						\
    1.31 +	__asm__ __volatile__ (";;\n"				\
    1.32 +			      "mov r14=%2\n"			\
    1.33 +			      "mov r15=%3\n"			\
    1.34 +			      "mov r16=%4\n"			\
    1.35 +			      "mov r2=%1\n"			\
    1.36 +			      "break 0x1000 ;;\n"		\
    1.37 +			      "mov %0=r8 ;;\n"			\
    1.38 +			      : "=r" (__res)			\
    1.39 +			      : "i" (__HYPERVISOR_##name),	\
    1.40 +				"i" (imm),			\
    1.41 +				"r" ((unsigned long)(a1)),	\
    1.42 +				"r" ((unsigned long)(a2))	\
    1.43 +			      : "r14","r15","r16","r2","r8",	\
    1.44 +				"memory" );			\
    1.45 +	(type)__res;						\
    1.46 +})
    1.47 +
    1.48 +#define _hypercall_imm3(type, name, imm, a1, a2, a3)		\
    1.49 +({								\
    1.50 +	long __res;						\
    1.51 +	__asm__ __volatile__ (";;\n"				\
    1.52 +			      "mov r14=%2\n"			\
    1.53 +			      "mov r15=%3\n"			\
    1.54 +			      "mov r16=%4\n"			\
    1.55 +			      "mov r17=%5\n"			\
    1.56 +			      "mov r2=%1\n"			\
    1.57 +			      "break 0x1000 ;;\n"		\
    1.58 +			      "mov %0=r8 ;;\n"			\
    1.59 +			      : "=r" (__res)			\
    1.60 +			      : "i" (__HYPERVISOR_##name),	\
    1.61 +				"i" (imm),			\
    1.62 +				"r" ((unsigned long)(a1)),	\
    1.63 +				"r" ((unsigned long)(a2)),	\
    1.64 +				"r" ((unsigned long)(a3))	\
    1.65 +			      : "r14","r15","r16","r17",	\
    1.66 +				"r2","r8",			\
    1.67 +				"memory" );			\
    1.68 +	(type)__res;						\
    1.69 +})
    1.70 +
    1.71 +#define _hypercall_imm4(type, name, imm, a1, a2, a3, a4)	\
    1.72 +({								\
    1.73 +	long __res;						\
    1.74 +	__asm__ __volatile__ (";;\n"				\
    1.75 +			      "mov r14=%2\n"			\
    1.76 +			      "mov r15=%3\n"			\
    1.77 +			      "mov r16=%4\n"			\
    1.78 +			      "mov r17=%5\n"			\
    1.79 +			      "mov r18=%6\n"			\
    1.80 +			      "mov r2=%1\n"			\
    1.81 +			      "break 0x1000 ;;\n"		\
    1.82 +			      "mov %0=r8 ;;\n"			\
    1.83 +			      : "=r" (__res)			\
    1.84 +			      : "i" (__HYPERVISOR_##name),	\
    1.85 +				"i" (imm),			\
    1.86 +				"r" ((unsigned long)(a1)),	\
    1.87 +				"r" ((unsigned long)(a2)),	\
    1.88 +				"r" ((unsigned long)(a3)),	\
    1.89 +				"r" ((unsigned long)(a4))	\
    1.90 +			      : "r14","r15","r16","r17","r18",	\
    1.91 +				"r2","r8",			\
    1.92 +				"memory" );			\
    1.93 +	(type)__res;						\
    1.94 +})
    1.95 +
    1.96 +static inline unsigned long
    1.97 +__HYPERVISOR_ioremap(unsigned long ioaddr, unsigned long size)
    1.98 +{
    1.99 +	return _hypercall_imm2(unsigned long, ia64_dom0vp_op,
   1.100 +			       IA64_DOM0VP_ioremap, ioaddr, size);
   1.101 +}
   1.102 +
   1.103 +static inline unsigned long
   1.104 +HYPERVISOR_ioremap(unsigned long ioaddr, unsigned long size)
   1.105 +{
   1.106 +	unsigned long ret = ioaddr;
   1.107 +	if (running_on_xen) {
   1.108 +		ret = __HYPERVISOR_ioremap(ioaddr, size);
   1.109 +	}
   1.110 +	return ret;
   1.111 +}
   1.112 +
   1.113 +static inline unsigned long
   1.114 +__HYPERVISOR_phystomach(unsigned long gpfn)
   1.115 +{
   1.116 +	return _hypercall_imm1(unsigned long, ia64_dom0vp_op,
   1.117 +			       IA64_DOM0VP_phystomach, gpfn);
   1.118 +}
   1.119 +
   1.120 +static inline unsigned long
   1.121 +HYPERVISOR_phystomach(unsigned long gpfn)
   1.122 +{
   1.123 +	unsigned long ret = gpfn;
   1.124 +	if (running_on_xen) {
   1.125 +		ret = __HYPERVISOR_phystomach(gpfn);
   1.126 +	}
   1.127 +	return ret;
   1.128 +}
   1.129 +
   1.130 +static inline unsigned long
   1.131 +__HYPERVISOR_machtophys(unsigned long mfn)
   1.132 +{
   1.133 +	return _hypercall_imm1(unsigned long, ia64_dom0vp_op,
   1.134 +			       IA64_DOM0VP_machtophys, mfn);
   1.135 +}
   1.136 +
   1.137 +static inline unsigned long
   1.138 +HYPERVISOR_machtophys(unsigned long mfn)
   1.139 +{
   1.140 +	unsigned long ret = mfn;
   1.141 +	if (running_on_xen) {
   1.142 +		ret = __HYPERVISOR_machtophys(mfn);
   1.143 +	}
   1.144 +	return ret;
   1.145 +}
   1.146 +
   1.147 +static inline unsigned long
   1.148 +__HYPERVISOR_populate_physmap(unsigned long gpfn, unsigned int extent_order,
   1.149 +			      unsigned int address_bits)
   1.150 +{
   1.151 +	return _hypercall_imm3(unsigned long, ia64_dom0vp_op,
   1.152 +			       IA64_DOM0VP_populate_physmap, gpfn, 
   1.153 +			       extent_order, address_bits);
   1.154 +}
   1.155 +
   1.156 +static inline unsigned long
   1.157 +HYPERVISOR_populate_physmap(unsigned long gpfn, unsigned int extent_order,
   1.158 +			    unsigned int address_bits)
   1.159 +{
   1.160 +	unsigned long ret = 0;
   1.161 +	if (running_on_xen) {
   1.162 +		ret = __HYPERVISOR_populate_physmap(gpfn, extent_order,
   1.163 +						    address_bits);
   1.164 +	}
   1.165 +	return ret;
   1.166 +}
   1.167 +
   1.168 +static inline unsigned long
   1.169 +__HYPERVISOR_zap_physmap(unsigned long gpfn, unsigned int extent_order)
   1.170 +{
   1.171 +	return _hypercall_imm2(unsigned long, ia64_dom0vp_op,
   1.172 +			       IA64_DOM0VP_zap_physmap, gpfn, extent_order);
   1.173 +}
   1.174 +
   1.175 +static inline unsigned long
   1.176 +HYPERVISOR_zap_physmap(unsigned long gpfn, unsigned int extent_order)
   1.177 +{
   1.178 +	unsigned long ret = 0;
   1.179 +	if (running_on_xen) {
   1.180 +		ret = __HYPERVISOR_zap_physmap(gpfn, extent_order);
   1.181 +	}
   1.182 +	return ret;
   1.183 +}
   1.184 +
   1.185 +static inline unsigned long
   1.186 +__HYPERVISOR_add_physmap(unsigned long gpfn, unsigned long mfn,
   1.187 +			 unsigned int flags, domid_t domid)
   1.188 +{
   1.189 +	return _hypercall_imm4(unsigned long, ia64_dom0vp_op,
   1.190 +			       IA64_DOM0VP_add_physmap, gpfn, mfn, flags,
   1.191 +			       domid);
   1.192 +}
   1.193 +static inline unsigned long
   1.194 +HYPERVISOR_add_physmap(unsigned long gpfn, unsigned long mfn,
   1.195 +		       unsigned int flags, domid_t domid)
   1.196 +{
   1.197 +	unsigned long ret = 0;
   1.198 +	BUG_ON(!running_on_xen);//XXX
   1.199 +	if (running_on_xen) {
   1.200 +		ret = __HYPERVISOR_add_physmap(gpfn, mfn, flags, domid);
   1.201 +	}
   1.202 +	return ret;
   1.203 +}
   1.204 +#else
   1.205 +#define HYPERVISOR_ioremap(ioaddr, size)		({ioaddr;})
   1.206 +#define HYPERVISOR_phystomach(gpfn)			({gpfn;})
   1.207 +#define HYPERVISOR_machtophys(mfn)			({mfn;})
   1.208 +#define HYPERVISOR_populate_physmap(gpfn, extent_order, address_bits) \
   1.209 +							({0;})
   1.210 +#define HYPERVISOR_zap_physmap(gpfn, extent_order)	({0;})
   1.211 +#define HYPERVISOR_add_physmap(gpfn, mfn, flags)	({0;})
   1.212 +#endif
   1.213  #endif /* __HYPERCALL_H__ */