From: "Jan Beulich" Subject: [PATCH] linux/x86: clean up hypercall headers Date: Fri, 18 Jan 2008 16:15:37 +0000 Message-ID: <4790DEB9.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org - don't define HYPERVISOR_hvm_op() for pv guests (requiring to not include include/xen/hvm.h in non-pv-driver builds) - remove the custome __STR/STR macros - remove stringification where not necessary - reduce instruction size for pv-driver case on x86-64 As usual, written and tested on 2.6.24-rc7 and made apply to the 2.6.18 tree without further testing. Signed-off-by: Jan Beulich Index: head-2007-12-11/drivers/xen/xenbus/xenbus_probe.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head-2007-12-11.orig/drivers/xen/xenbus/xenbus_probe.c 2007-12-11 = 11:17:36.000000000 +0100 +++ head-2007-12-11/drivers/xen/xenbus/xenbus_probe.c 2007-12-21 = 11:26:51.000000000 +0100 @@ -53,7 +53,9 @@ #include #include #include +#ifdef MODULE #include +#endif =20 #include "xenbus_comms.h" #include "xenbus_probe.h" Index: head-2007-12-11/drivers/xen/xenbus/xenbus_probe_backend.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head-2007-12-11.orig/drivers/xen/xenbus/xenbus_probe_backend.c = 2007-12-11 11:17:36.000000000 +0100 +++ head-2007-12-11/drivers/xen/xenbus/xenbus_probe_backend.c 2007-12-21 = 11:23:53.000000000 +0100 @@ -52,7 +52,6 @@ #include #include #include -#include =20 #include "xenbus_comms.h" #include "xenbus_probe.h" Index: head-2007-12-11/include/asm-i386/mach-xen/asm/hypercall.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head-2007-12-11.orig/include/asm-i386/mach-xen/asm/hypercall.h = 2007-12-21 11:21:58.000000000 +0100 +++ head-2007-12-11/include/asm-i386/mach-xen/asm/hypercall.h 2007-12-21 = 10:19:20.000000000 +0100 @@ -40,16 +40,13 @@ # error "please don't include this file directly" #endif =20 -#define __STR(x) #x -#define STR(x) __STR(x) - #ifdef CONFIG_XEN #define HYPERCALL_STR(name) \ - "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)" + "call hypercall_page + ("__stringify(__HYPERVISOR_##name)" * 32)" #else #define HYPERCALL_STR(name) \ - "mov "__stringify(hypercall_stubs)",%%eax; " \ - "add $("STR(__HYPERVISOR_##name)" * 32),%%eax; " \ + "mov hypercall_stubs,%%eax; " \ + "add $("__stringify(__HYPERVISOR_##name)" * 32),%%eax; "\ "call *%%eax" #endif =20 @@ -375,12 +372,14 @@ HYPERVISOR_nmi_op( return _hypercall2(int, nmi_op, op, arg); } =20 +#ifndef CONFIG_XEN static inline unsigned long HYPERVISOR_hvm_op( int op, void *arg) { return _hypercall2(unsigned long, hvm_op, op, arg); } +#endif =20 static inline int HYPERVISOR_callback_op( Index: head-2007-12-11/include/asm-x86_64/mach-xen/asm/hypercall.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head-2007-12-11.orig/include/asm-x86_64/mach-xen/asm/hypercall.h = 2007-12-21 11:21:58.000000000 +0100 +++ head-2007-12-11/include/asm-x86_64/mach-xen/asm/hypercall.h 2007-12-21 = 10:19:16.000000000 +0100 @@ -44,16 +44,13 @@ # error "please don't include this file directly" #endif =20 -#define __STR(x) #x -#define STR(x) __STR(x) - #ifdef CONFIG_XEN #define HYPERCALL_STR(name) \ - "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)" + "call hypercall_page + ("__stringify(__HYPERVISOR_##name)" * 32)" #else #define HYPERCALL_STR(name) \ - "mov "__stringify(hypercall_stubs)",%%rax; " \ - "add $("STR(__HYPERVISOR_##name)" * 32),%%rax; " \ + "mov $("__stringify(__HYPERVISOR_##name)" * 32),%%eax; "\ + "add hypercall_stubs(%%rip),%%rax; " \ "call *%%rax" #endif =20 @@ -376,12 +373,14 @@ HYPERVISOR_nmi_op( return _hypercall2(int, nmi_op, op, arg); } =20 +#ifndef CONFIG_XEN static inline unsigned long HYPERVISOR_hvm_op( int op, void *arg) { return _hypercall2(unsigned long, hvm_op, op, arg); } +#endif =20 static inline int HYPERVISOR_callback_op(