ia64/xen-unstable

changeset 10102:b736d3335641

Introduce is_running_on_xen() to test whether we are running on Xen before
initialising a Xen-specific driver or subsystem.

For ia64:
* Call xen_init in setup_arch.
* Remove xen_ksyms.c

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author kaf24@firebug.cl.cam.ac.uk
date Fri May 19 15:35:19 2006 +0100 (2006-05-19)
parents 1855124935e2
children 093f8d333568
files linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c 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/drivers/xenia64_init.c linux-2.6-xen-sparse/arch/ia64/xen/xensetup.S linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6-xen-sparse/drivers/xen/console/console.c linux-2.6-xen-sparse/drivers/xen/core/gnttab.c linux-2.6-xen-sparse/drivers/xen/core/hypervisor_sysfs.c linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c linux-2.6-xen-sparse/drivers/xen/netback/netback.c linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c	Fri May 19 15:22:11 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/swiotlb.c	Fri May 19 15:35:19 2006 +0100
     1.3 @@ -191,6 +191,7 @@ swiotlb_init(void)
     1.4  	if (swiotlb_force == 1) {
     1.5  		swiotlb = 1;
     1.6  	} else if ((swiotlb_force != -1) &&
     1.7 +		   is_running_on_xen() &&
     1.8  		   (xen_start_info->flags & SIF_INITDOMAIN)) {
     1.9  		/* Domain 0 always has a swiotlb. */
    1.10  		ram_end = HYPERVISOR_memory_op(XENMEM_maximum_ram_page, NULL);
     2.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c	Fri May 19 15:22:11 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/setup.c	Fri May 19 15:35:19 2006 +0100
     2.3 @@ -514,6 +514,9 @@ setup_arch (char **cmdline_p)
     2.4  #ifdef CONFIG_XEN
     2.5  	if (running_on_xen) {
     2.6  		extern shared_info_t *HYPERVISOR_shared_info;
     2.7 +		extern int xen_init (void);
     2.8 +
     2.9 +		xen_init ();
    2.10  
    2.11  		/* xen_start_info isn't setup yet, get the flags manually */
    2.12  		if (HYPERVISOR_shared_info->arch.flags & SIF_INITDOMAIN) {
     3.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/Makefile	Fri May 19 15:22:11 2006 +0100
     3.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/Makefile	Fri May 19 15:35:19 2006 +0100
     3.3 @@ -2,7 +2,7 @@
     3.4  # Makefile for Xen components
     3.5  #
     3.6  
     3.7 -obj-y := hypercall.o xenivt.o xenentry.o xensetup.o xenpal.o xenhpski.o xenconsole.o xen_ksyms.o
     3.8 +obj-y := hypercall.o xenivt.o xenentry.o xensetup.o xenpal.o xenhpski.o xenconsole.o
     3.9  
    3.10  obj-$(CONFIG_XEN_IA64_DOM0_VP) += hypervisor.o pci-dma-xen.o
    3.11 -pci-dma-xen-$(CONFIG_XEN_IA64_DOM0_VP) := ../../i386/kernel/pci-dma-xen.o
    3.12 \ No newline at end of file
    3.13 +pci-dma-xen-$(CONFIG_XEN_IA64_DOM0_VP) := ../../i386/kernel/pci-dma-xen.o
     4.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/drivers/xenia64_init.c	Fri May 19 15:22:11 2006 +0100
     4.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/drivers/xenia64_init.c	Fri May 19 15:35:19 2006 +0100
     4.3 @@ -11,17 +11,20 @@
     4.4  shared_info_t *HYPERVISOR_shared_info = (shared_info_t *)XSI_BASE;
     4.5  EXPORT_SYMBOL(HYPERVISOR_shared_info);
     4.6  
     4.7 -static int initialized;
     4.8  start_info_t *xen_start_info;
     4.9  
    4.10 +int running_on_xen;
    4.11 +EXPORT_SYMBOL(running_on_xen);
    4.12 +
    4.13  int xen_init(void)
    4.14  {
    4.15 +	static int initialized;
    4.16  	shared_info_t *s = HYPERVISOR_shared_info;
    4.17  
    4.18  	if (initialized)
    4.19  		return running_on_xen ? 0 : -1;
    4.20  
    4.21 -	if (!running_on_xen)
    4.22 +	if (!is_running_on_xen())
    4.23  		return -1;
    4.24  
    4.25  	xen_start_info = __va(s->arch.start_info_pfn << PAGE_SHIFT);
     5.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/xen_ksyms.c	Fri May 19 15:22:11 2006 +0100
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,12 +0,0 @@
     5.4 -/*
     5.5 - * Architecture-specific kernel symbols
     5.6 - *
     5.7 - * Don't put any exports here unless it's defined in an assembler file.
     5.8 - * All other exports should be put directly after the definition.
     5.9 - */
    5.10 -
    5.11 -#include <linux/config.h>
    5.12 -#include <linux/module.h>
    5.13 -
    5.14 -extern int is_running_on_xen(void);
    5.15 -EXPORT_SYMBOL(is_running_on_xen);
     6.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/xensetup.S	Fri May 19 15:22:11 2006 +0100
     6.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/xensetup.S	Fri May 19 15:35:19 2006 +0100
     6.3 @@ -8,12 +8,6 @@
     6.4  #include <asm/processor.h>
     6.5  #include <asm/asmmacro.h>
     6.6  
     6.7 -	.data
     6.8 -	.align 8
     6.9 -	.globl running_on_xen
    6.10 -running_on_xen:
    6.11 -	data4 0
    6.12 -
    6.13  #define isBP	p3	// are we the Bootstrap Processor?
    6.14  
    6.15  	.text
    6.16 @@ -27,9 +21,3 @@ GLOBAL_ENTRY(early_xen_setup)
    6.17  (p7)	mov cr.iva=r10
    6.18  	br.ret.sptk.many rp;;
    6.19  END(early_xen_setup)
    6.20 -
    6.21 -GLOBAL_ENTRY(is_running_on_xen)
    6.22 -	movl r9=running_on_xen;;
    6.23 -	ld4 r8=[r9]
    6.24 -	br.ret.sptk.many rp;;
    6.25 -END(is_running_on_xen)
     7.1 --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c	Fri May 19 15:22:11 2006 +0100
     7.2 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c	Fri May 19 15:35:19 2006 +0100
     7.3 @@ -468,8 +468,8 @@ static int __init balloon_init(void)
     7.4  
     7.5  	IPRINTK("Initialising balloon driver.\n");
     7.6  
     7.7 -	if (xen_init() < 0)
     7.8 -		return -1;
     7.9 +	if (!is_running_on_xen())
    7.10 +		return -ENODEV;
    7.11  
    7.12  	current_pages = min(xen_start_info->nr_pages, max_pfn);
    7.13  	totalram_pages = current_pages;
     8.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Fri May 19 15:22:11 2006 +0100
     8.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Fri May 19 15:35:19 2006 +0100
     8.3 @@ -526,7 +526,7 @@ static int __init blkif_init(void)
     8.4  	struct page *page;
     8.5  	int i;
     8.6  
     8.7 -	if (xen_init() < 0)
     8.8 +	if (!is_running_on_xen())
     8.9  		return -ENODEV;
    8.10  
    8.11  	mmap_pages            = blkif_reqs * BLKIF_MAX_SEGMENTS_PER_REQUEST;
     9.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Fri May 19 15:22:11 2006 +0100
     9.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Fri May 19 15:35:19 2006 +0100
     9.3 @@ -792,7 +792,7 @@ static struct xenbus_driver blkfront = {
     9.4  
     9.5  static int __init xlblk_init(void)
     9.6  {
     9.7 -	if (xen_init() < 0)
     9.8 +	if (!is_running_on_xen())
     9.9  		return -ENODEV;
    9.10  
    9.11  	return xenbus_register_frontend(&blkfront);
    10.1 --- a/linux-2.6-xen-sparse/drivers/xen/console/console.c	Fri May 19 15:22:11 2006 +0100
    10.2 +++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c	Fri May 19 15:35:19 2006 +0100
    10.3 @@ -183,7 +183,7 @@ static struct console kcons_info = {
    10.4  #define __RETCODE 0
    10.5  static int __init xen_console_init(void)
    10.6  {
    10.7 -	if (xen_init() < 0)
    10.8 +	if (!is_running_on_xen())
    10.9  		return __RETCODE;
   10.10  
   10.11  	if (xen_start_info->flags & SIF_INITDOMAIN) {
   10.12 @@ -566,7 +566,7 @@ static int __init xencons_init(void)
   10.13  {
   10.14  	int rc;
   10.15  
   10.16 -	if (xen_init() < 0)
   10.17 +	if (!is_running_on_xen())
   10.18  		return -ENODEV;
   10.19  
   10.20  	if (xc_mode == XC_OFF)
    11.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c	Fri May 19 15:22:11 2006 +0100
    11.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c	Fri May 19 15:35:19 2006 +0100
    11.3 @@ -443,7 +443,7 @@ gnttab_init(void)
    11.4  {
    11.5  	int i;
    11.6  
    11.7 -	if (xen_init() < 0)
    11.8 +	if (!is_running_on_xen())
    11.9  		return -ENODEV;
   11.10  
   11.11  	if (gnttab_resume() < 0)
    12.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/hypervisor_sysfs.c	Fri May 19 15:22:11 2006 +0100
    12.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/hypervisor_sysfs.c	Fri May 19 15:35:19 2006 +0100
    12.3 @@ -49,6 +49,9 @@ static struct kobj_type hyp_sysfs_kobj_t
    12.4  
    12.5  static int __init hypervisor_subsys_init(void)
    12.6  {
    12.7 +	if (!is_running_on_xen())
    12.8 +		return -ENODEV;
    12.9 +
   12.10  	hypervisor_subsys.kset.kobj.ktype = &hyp_sysfs_kobj_type;
   12.11  	return subsystem_register(&hypervisor_subsys);
   12.12  }
    13.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c	Fri May 19 15:22:11 2006 +0100
    13.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c	Fri May 19 15:35:19 2006 +0100
    13.3 @@ -276,7 +276,12 @@ static void xen_properties_destroy(void)
    13.4  
    13.5  static int __init hyper_sysfs_init(void)
    13.6  {
    13.7 -	int ret = xen_sysfs_type_init();
    13.8 +	int ret;
    13.9 +
   13.10 +	if (!is_running_on_xen())
   13.11 +		return -ENODEV;
   13.12 +
   13.13 +	ret = xen_sysfs_type_init();
   13.14  	if (ret)
   13.15  		goto out;
   13.16  	ret = xen_sysfs_version_init();
    14.1 --- a/linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c	Fri May 19 15:22:11 2006 +0100
    14.2 +++ b/linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c	Fri May 19 15:35:19 2006 +0100
    14.3 @@ -429,6 +429,9 @@ static int __init evtchn_init(void)
    14.4  {
    14.5  	int err;
    14.6  
    14.7 +	if (!is_running_on_xen())
    14.8 +		return -ENODEV;
    14.9 +
   14.10  	spin_lock_init(&port_user_lock);
   14.11  	memset(port_user, 0, sizeof(port_user));
   14.12  
    15.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Fri May 19 15:22:11 2006 +0100
    15.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Fri May 19 15:35:19 2006 +0100
    15.3 @@ -810,6 +810,9 @@ static int __init netback_init(void)
    15.4  	int i;
    15.5  	struct page *page;
    15.6  
    15.7 +	if (!is_running_on_xen())
    15.8 +		return -ENODEV;
    15.9 +
   15.10  	/* We can increase reservation by this much in net_rx_action(). */
   15.11  	balloon_update_driver_allowance(NET_RX_RING_SIZE);
   15.12  
    16.1 --- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Fri May 19 15:22:11 2006 +0100
    16.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c	Fri May 19 15:35:19 2006 +0100
    16.3 @@ -1454,6 +1454,9 @@ static struct notifier_block notifier_in
    16.4  
    16.5  static int __init netif_init(void)
    16.6  {
    16.7 +	if (!is_running_on_xen())
    16.8 +		return -ENODEV;
    16.9 +
   16.10  	if (xen_start_info->flags & SIF_INITDOMAIN)
   16.11  		return 0;
   16.12  
    17.1 --- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Fri May 19 15:22:11 2006 +0100
    17.2 +++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Fri May 19 15:35:19 2006 +0100
    17.3 @@ -271,6 +271,9 @@ static int capabilities_read(char *page,
    17.4  
    17.5  static int __init privcmd_init(void)
    17.6  {
    17.7 +	if (!is_running_on_xen())
    17.8 +		return -ENODEV;
    17.9 +
   17.10  	/* Set of hypercalls that privileged applications may execute. */
   17.11  	set_bit(__HYPERVISOR_acm_op,           hypercall_permission_map);
   17.12  	set_bit(__HYPERVISOR_dom0_op,          hypercall_permission_map);
    18.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Fri May 19 15:22:11 2006 +0100
    18.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Fri May 19 15:35:19 2006 +0100
    18.3 @@ -966,10 +966,8 @@ static int __init xenbus_probe_init(void
    18.4  
    18.5  	DPRINTK("");
    18.6  
    18.7 -	if (xen_init() < 0) {
    18.8 -		DPRINTK("failed");
    18.9 +	if (!is_running_on_xen())
   18.10  		return -ENODEV;
   18.11 -	}
   18.12  
   18.13  	/* Register ourselves with the kernel bus subsystem */
   18.14  	bus_register(&xenbus_frontend.bus);
   18.15 @@ -1069,10 +1067,8 @@ static int __init wait_for_devices(void)
   18.16  {
   18.17  	unsigned long timeout = jiffies + 10*HZ;
   18.18  
   18.19 -	if (xen_init() < 0) {
   18.20 -		DPRINTK("failed");
   18.21 +	if (!is_running_on_xen())
   18.22  		return -ENODEV;
   18.23 -	}
   18.24  
   18.25  	while (time_before(jiffies, timeout)) {
   18.26  		if (all_devices_ready())
    19.1 --- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h	Fri May 19 15:22:11 2006 +0100
    19.2 +++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h	Fri May 19 15:35:19 2006 +0100
    19.3 @@ -118,7 +118,7 @@ u64 jiffies_to_st(unsigned long jiffies)
    19.4  #define MULTI_UVMDOMID_INDEX 4
    19.5  #endif
    19.6  
    19.7 -#define xen_init()	(0)
    19.8 +#define is_running_on_xen() 1
    19.9  
   19.10  static inline int
   19.11  HYPERVISOR_yield(
    20.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h	Fri May 19 15:22:11 2006 +0100
    20.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h	Fri May 19 15:35:19 2006 +0100
    20.3 @@ -53,7 +53,7 @@ extern start_info_t *xen_start_info;
    20.4  
    20.5  void force_evtchn_callback(void);
    20.6  
    20.7 -int xen_init(void);
    20.8 +#define is_running_on_xen() running_on_xen
    20.9  
   20.10  /* Turn jiffies into Xen system time. XXX Implement me. */
   20.11  #define jiffies_to_st(j)	0
   20.12 @@ -147,7 +147,7 @@ xen_create_contiguous_region(unsigned lo
   20.13                               unsigned int order, unsigned int address_bits)
   20.14  {
   20.15  	int ret = 0;
   20.16 -	if (running_on_xen) {
   20.17 +	if (is_running_on_xen()) {
   20.18  		ret = __xen_create_contiguous_region(vstart, order,
   20.19  		                                     address_bits);
   20.20  	}
   20.21 @@ -158,7 +158,7 @@ void __xen_destroy_contiguous_region(uns
   20.22  static inline void
   20.23  xen_destroy_contiguous_region(unsigned long vstart, unsigned int order)
   20.24  {
   20.25 -	if (running_on_xen)
   20.26 +	if (is_running_on_xen())
   20.27  		__xen_destroy_contiguous_region(vstart, order);
   20.28  }
   20.29  #else
    21.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h	Fri May 19 15:22:11 2006 +0100
    21.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h	Fri May 19 15:35:19 2006 +0100
    21.3 @@ -41,12 +41,7 @@
    21.4  #endif
    21.5  
    21.6  #ifndef __ASSEMBLY__
    21.7 -#ifdef MODULE
    21.8 -extern int is_running_on_xen(void);
    21.9 -#define running_on_xen (is_running_on_xen())
   21.10 -#else
   21.11  extern int running_on_xen;
   21.12 -#endif
   21.13  
   21.14  #define	XEN_HYPER_SSM_I			asm("break 0x7");
   21.15  #define	XEN_HYPER_GET_IVR		asm("break 0x8");