From bebf2a1cd2a85c54398c462944011b28c533a5ab Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Mon, 26 Nov 2007 08:35:10 +0100 Subject: [PATCH] xen dom0: Initialize xenbus for dom0. Signed-off-by: Jeremy Fitzhardinge Signed-off-by: Juan Quintela --- drivers/xen/xenbus/xenbus_probe.c | 30 +++++++++++++++++++++++++++++- 1 files changed, 29 insertions(+), 1 deletions(-) diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index 4750de3..298c4c8 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c @@ -787,6 +787,7 @@ void xenbus_probe(struct work_struct *unused) static int __init xenbus_probe_init(void) { int err = 0; + unsigned long page = 0; DPRINTK(""); @@ -807,7 +808,31 @@ static int __init xenbus_probe_init(void) * Domain0 doesn't have a store_evtchn or store_mfn yet. */ if (is_initial_xendomain()) { - /* dom0 not yet supported */ + struct evtchn_alloc_unbound alloc_unbound; + + /* Allocate page. */ + page = get_zeroed_page(GFP_KERNEL); + if (!page) + return -ENOMEM; + + xen_store_mfn = xen_start_info->store_mfn = + pfn_to_mfn(virt_to_phys((void *)page) >> + PAGE_SHIFT); + + /* Next allocate a local port which xenstored can bind to */ + alloc_unbound.dom = DOMID_SELF; + alloc_unbound.remote_dom = 0; + + err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound, + &alloc_unbound); + if (err == -ENOSYS) + goto out_unreg_front; + + BUG_ON(err); + xen_store_evtchn = xen_start_info->store_evtchn = + alloc_unbound.port; + + xen_store_interface = mfn_to_virt(xen_store_mfn); } else { xenstored_ready = 1; xen_store_evtchn = xen_start_info->store_evtchn; @@ -835,6 +860,9 @@ static int __init xenbus_probe_init(void) bus_unregister(&xenbus_frontend.bus); out_error: + if (page != 0) + free_page(page); + return err; } -- 1.5.3.4