xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: stefano.stabellini@eu.citrix.com
To: linux-kernel@vger.kernel.org
Cc: xen-devel@lists.xensource.com,
	Jeremy Fitzhardinge <Jeremy.Fitzhardinge@citrix.com>,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>,
	Juan Quintela <quintela@redhat.com>,
	Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH v2 05/10] xen: Initialize xenbus for dom0.
Date: Mon,  4 Oct 2010 12:28:45 +0100	[thread overview]
Message-ID: <1286191730-3188-5-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1009301536300.2864@kaball-desktop>

From: Juan Quintela <quintela@redhat.com>

Do initial xenbus/xenstore setup in dom0.  In dom0 we need to actually
allocate the xenstore resources, rather than being given them from
outside.

[ Impact: initialize Xenbus ]

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 drivers/xen/xenbus/xenbus_probe.c |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index 29bac51..df0049e 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -798,6 +798,7 @@ device_initcall(xenbus_probe_initcall);
 static int __init xenbus_init(void)
 {
 	int err = 0;
+	unsigned long page = 0;
 
 	DPRINTK("");
 
@@ -818,7 +819,31 @@ static int __init xenbus_init(void)
 	 * 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)
+			goto out_error;
+
+		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_error;
+
+		BUG_ON(err);
+		xen_store_evtchn = xen_start_info->store_evtchn =
+			alloc_unbound.port;
+
+		xen_store_interface = mfn_to_virt(xen_store_mfn);
 	} else {
 		if (xen_hvm_domain()) {
 			uint64_t v = 0;
@@ -864,6 +889,8 @@ static int __init xenbus_init(void)
 	bus_unregister(&xenbus_frontend.bus);
 
   out_error:
+	if (page != 0)
+		free_page(page);
 	return err;
 }
 
-- 
1.5.6.5

  parent reply	other threads:[~2010-10-04 11:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-04 11:27 [PATCH v2 00/10] xen: initial domain support Stefano Stabellini
2010-10-04 11:28 ` [PATCH v2 01/10] xen: remap GSIs as pirqs when running as initial domain stefano.stabellini
2010-10-04 19:24   ` Konrad Rzeszutek Wilk
2010-10-05  0:44     ` Install Xen 4.0.1 on Fedora 13 Hui Kang
2010-10-05  5:53       ` Pasi Kärkkäinen
2010-10-05 13:11     ` [Xen-devel] [PATCH v2 01/10] xen: remap GSIs as pirqs when running as initial domain Stefano Stabellini
2010-10-06 16:50       ` Konrad Rzeszutek Wilk
2010-10-06 17:53         ` Stefano Stabellini
2010-10-04 11:28 ` [PATCH v2 02/10] xen: remap MSIs into " stefano.stabellini
2010-10-04 11:28 ` [PATCH v2 03/10] xen: map a dummy page for local apic and ioapic in xen_set_fixmap stefano.stabellini
2010-10-04 11:28 ` [PATCH v2 04/10] xen: use vcpu_ops to setup cpu masks stefano.stabellini
2010-10-04 11:28 ` stefano.stabellini [this message]
2010-10-04 11:28 ` [PATCH v2 06/10] xen: add the direct mapping area for ISA bus access stefano.stabellini
2010-10-04 11:28 ` [PATCH v2 07/10] xen: introduce XEN_DOM0 as a silent option stefano.stabellini
2010-10-04 11:28 ` [PATCH v2 08/10] xen: use host E820 map for dom0 stefano.stabellini
2010-10-04 11:28 ` [PATCH v2 09/10] xen: make hvc_xen console work " stefano.stabellini
2010-10-04 11:28 ` [PATCH v2 10/10] xen: mask the MTRR feature from the cpuid stefano.stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1286191730-3188-5-git-send-email-stefano.stabellini@eu.citrix.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=Jeremy.Fitzhardinge@citrix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quintela@redhat.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).