Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756075AbYKMTjt (ORCPT ); Thu, 13 Nov 2008 14:39:49 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754580AbYKMTeT (ORCPT ); Thu, 13 Nov 2008 14:34:19 -0500 Received: from gw.goop.org ([64.81.55.164]:34398 "EHLO mail.goop.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752827AbYKMTeI (ORCPT ); Thu, 13 Nov 2008 14:34:08 -0500 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [PATCH 21 of 38] xen dom0: Initialize xenbus for dom0 X-Mercurial-Node: c91af5fdca49a2305c5a8a7afb64c07b62ddcece Message-Id: In-Reply-To: Date: Thu, 13 Nov 2008 11:10:19 -0800 From: Jeremy Fitzhardinge To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Xen-devel , the arch/x86 maintainers , Ian Campbell Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2039 Lines: 73 From: Juan Quintela Do initial xenbus/xenstore setup in dom0. In dom0 we need to actually allocate the xenstore resources, rather than being given them from outside. Signed-off-by: Jeremy Fitzhardinge Signed-off-by: Juan Quintela --- drivers/xen/xenbus/xenbus_probe.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c @@ -810,6 +810,7 @@ static int __init xenbus_probe_init(void) { int err = 0; + unsigned long page = 0; DPRINTK(""); @@ -830,7 +831,31 @@ * Domain0 doesn't have a store_evtchn or store_mfn yet. */ if (xen_initial_domain()) { - /* dom0 not yet supported */ + struct evtchn_alloc_unbound alloc_unbound; + + /* Allocate Xenstore 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; @@ -858,6 +883,9 @@ bus_unregister(&xenbus_frontend.bus); out_error: + if (page != 0) + free_page(page); + return err; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/