ia64/xen-unstable

changeset 9568:d0d3fef37685 3.0.2-branched

Handle failure to register the xen store event channel instead of
just not initialising xenbus/store when the supervisor_mode_kernel
feature flag is enabled.

When initialising grant tables only -ENOSYS is a valid reason
to fail so BUG_ON anything else like we did prior to changeset
9498.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
author Ian.Campbell@xensource.com
date Mon Apr 03 14:34:20 2006 +0100 (2006-04-03)
parents 4ad317429111
children 590c33d6097c
files linux-2.6-xen-sparse/drivers/xen/core/gnttab.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c	Sun Apr 02 16:16:53 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c	Mon Apr 03 14:34:20 2006 +0100
     1.3 @@ -395,10 +395,10 @@ gnttab_resume(void)
     1.4  	setup.frame_list = frames;
     1.5  
     1.6  	rc = HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1);
     1.7 -	if (rc < 0)
     1.8 -		return rc;
     1.9 +	if (rc == -ENOSYS)
    1.10 +		return -ENOSYS;
    1.11  
    1.12 -	BUG_ON(setup.status);
    1.13 +	BUG_ON(rc || setup.status);
    1.14  
    1.15  #ifndef __ia64__
    1.16  	if (shared == NULL) {
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Sun Apr 02 16:16:53 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c	Mon Apr 03 14:34:20 2006 +0100
     2.3 @@ -984,6 +984,7 @@ static int xsd_port_read(char *page, cha
     2.4  static int __init xenbus_probe_init(void)
     2.5  {
     2.6  	int err = 0, dom0;
     2.7 +	unsigned long page = 0;
     2.8  
     2.9  	DPRINTK("");
    2.10  
    2.11 @@ -992,19 +993,9 @@ static int __init xenbus_probe_init(void
    2.12  		return -ENODEV;
    2.13  	}
    2.14  
    2.15 -	/* Register ourselves with the kernel bus & device subsystems */
    2.16 +	/* Register ourselves with the kernel bus subsystem */
    2.17  	bus_register(&xenbus_frontend.bus);
    2.18  	bus_register(&xenbus_backend.bus);
    2.19 -	device_register(&xenbus_frontend.dev);
    2.20 -	device_register(&xenbus_backend.dev);
    2.21 -
    2.22 -	/*
    2.23 -         * The supervisor_mode_kernel feature only allows a single
    2.24 -         * domain so there is no need to initialise event channels
    2.25 -         * etc.
    2.26 -         */
    2.27 -	if (xen_feature(XENFEAT_supervisor_mode_kernel))
    2.28 -		return -ENODEV;
    2.29  
    2.30  	/*
    2.31  	 * Domain0 doesn't have a store_evtchn or store_mfn yet.
    2.32 @@ -1012,11 +1003,7 @@ static int __init xenbus_probe_init(void
    2.33  	dom0 = (xen_start_info->store_evtchn == 0);
    2.34  
    2.35  	if (dom0) {
    2.36 -
    2.37 -		unsigned long page;
    2.38  		evtchn_op_t op = { 0 };
    2.39 -		int ret;
    2.40 -
    2.41  
    2.42  		/* Allocate page. */
    2.43  		page = get_zeroed_page(GFP_KERNEL);
    2.44 @@ -1032,8 +1019,10 @@ static int __init xenbus_probe_init(void
    2.45  		op.u.alloc_unbound.dom        = DOMID_SELF;
    2.46  		op.u.alloc_unbound.remote_dom = 0;
    2.47  
    2.48 -		ret = HYPERVISOR_event_channel_op(&op);
    2.49 -		BUG_ON(ret);
    2.50 +		err = HYPERVISOR_event_channel_op(&op);
    2.51 +		if (err == -ENOSYS)
    2.52 +			goto err;
    2.53 +		BUG_ON(err);
    2.54  		xen_start_info->store_evtchn = op.u.alloc_unbound.port;
    2.55  
    2.56  		/* And finally publish the above info in /proc/xen */
    2.57 @@ -1056,13 +1045,29 @@ static int __init xenbus_probe_init(void
    2.58  	if (err) {
    2.59  		printk(KERN_WARNING
    2.60  		       "XENBUS: Error initializing xenstore comms: %i\n", err);
    2.61 -		return err;
    2.62 +		goto err;
    2.63  	}
    2.64  
    2.65 +	/* Register ourselves with the kernel device subsystem */
    2.66 +	device_register(&xenbus_frontend.dev);
    2.67 +	device_register(&xenbus_backend.dev);
    2.68 +
    2.69  	if (!dom0)
    2.70  		xenbus_probe(NULL);
    2.71  
    2.72  	return 0;
    2.73 +
    2.74 + err:
    2.75 +	if (page)
    2.76 +		free_page(page);
    2.77 +
    2.78 +	/*
    2.79 +         * Do not unregister the xenbus front/backend buses here. The
    2.80 +         * buses must exist because front/backend drivers will use
    2.81 +         * them when they are registered.
    2.82 +         */
    2.83 +
    2.84 +	return err;
    2.85  }
    2.86  
    2.87  postcore_initcall(xenbus_probe_init);