From d3cf31ddb2d9be1098236472401185786c0f42e4 Mon Sep 17 00:00:00 2001 From: "Ian.Campbell@xensource.com" Date: Mon, 3 Apr 2006 14:34:20 +0100 Subject: 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 --- linux-2.6-xen-sparse/drivers/xen/core/gnttab.c | 6 ++-- .../drivers/xen/xenbus/xenbus_probe.c | 41 ++++++++++++---------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c index fa12e701d4..71da6c4df9 100644 --- a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c +++ b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c @@ -395,10 +395,10 @@ gnttab_resume(void) setup.frame_list = frames; rc = HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1); - if (rc < 0) - return rc; + if (rc == -ENOSYS) + return -ENOSYS; - BUG_ON(setup.status); + BUG_ON(rc || setup.status); #ifndef __ia64__ if (shared == NULL) { diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c index db1492d050..e9c8315856 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c @@ -984,6 +984,7 @@ static int xsd_port_read(char *page, char **start, off_t off, static int __init xenbus_probe_init(void) { int err = 0, dom0; + unsigned long page = 0; DPRINTK(""); @@ -992,19 +993,9 @@ static int __init xenbus_probe_init(void) return -ENODEV; } - /* Register ourselves with the kernel bus & device subsystems */ + /* Register ourselves with the kernel bus subsystem */ bus_register(&xenbus_frontend.bus); bus_register(&xenbus_backend.bus); - device_register(&xenbus_frontend.dev); - device_register(&xenbus_backend.dev); - - /* - * The supervisor_mode_kernel feature only allows a single - * domain so there is no need to initialise event channels - * etc. - */ - if (xen_feature(XENFEAT_supervisor_mode_kernel)) - return -ENODEV; /* * Domain0 doesn't have a store_evtchn or store_mfn yet. @@ -1012,11 +1003,7 @@ static int __init xenbus_probe_init(void) dom0 = (xen_start_info->store_evtchn == 0); if (dom0) { - - unsigned long page; evtchn_op_t op = { 0 }; - int ret; - /* Allocate page. */ page = get_zeroed_page(GFP_KERNEL); @@ -1032,8 +1019,10 @@ static int __init xenbus_probe_init(void) op.u.alloc_unbound.dom = DOMID_SELF; op.u.alloc_unbound.remote_dom = 0; - ret = HYPERVISOR_event_channel_op(&op); - BUG_ON(ret); + err = HYPERVISOR_event_channel_op(&op); + if (err == -ENOSYS) + goto err; + BUG_ON(err); xen_start_info->store_evtchn = op.u.alloc_unbound.port; /* And finally publish the above info in /proc/xen */ @@ -1056,13 +1045,29 @@ static int __init xenbus_probe_init(void) if (err) { printk(KERN_WARNING "XENBUS: Error initializing xenstore comms: %i\n", err); - return err; + goto err; } + /* Register ourselves with the kernel device subsystem */ + device_register(&xenbus_frontend.dev); + device_register(&xenbus_backend.dev); + if (!dom0) xenbus_probe(NULL); return 0; + + err: + if (page) + free_page(page); + + /* + * Do not unregister the xenbus front/backend buses here. The + * buses must exist because front/backend drivers will use + * them when they are registered. + */ + + return err; } postcore_initcall(xenbus_probe_init); -- cgit v1.2.3