aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2010-09-02 09:53:56 -0400
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>2010-10-22 16:25:45 -0400
commitb37a56d6f3c0595d8d65ddd5b7610d11735c4978 (patch)
treebfd7ddea47b7d8b086c67d3ac91e1ac999690a10
parent801fd14a725ef7757d33f07b83415cdd2165e50a (diff)
xen: Initialize xenbus for dom0.
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> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
-rw-r--r--drivers/xen/xenbus/xenbus_probe.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index d409495876f..d242610597c 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -801,6 +801,7 @@ device_initcall(xenbus_probe_initcall);
801static int __init xenbus_init(void) 801static int __init xenbus_init(void)
802{ 802{
803 int err = 0; 803 int err = 0;
804 unsigned long page = 0;
804 805
805 DPRINTK(""); 806 DPRINTK("");
806 807
@@ -821,7 +822,31 @@ static int __init xenbus_init(void)
821 * Domain0 doesn't have a store_evtchn or store_mfn yet. 822 * Domain0 doesn't have a store_evtchn or store_mfn yet.
822 */ 823 */
823 if (xen_initial_domain()) { 824 if (xen_initial_domain()) {
824 /* dom0 not yet supported */ 825 struct evtchn_alloc_unbound alloc_unbound;
826
827 /* Allocate Xenstore page */
828 page = get_zeroed_page(GFP_KERNEL);
829 if (!page)
830 goto out_error;
831
832 xen_store_mfn = xen_start_info->store_mfn =
833 pfn_to_mfn(virt_to_phys((void *)page) >>
834 PAGE_SHIFT);
835
836 /* Next allocate a local port which xenstored can bind to */
837 alloc_unbound.dom = DOMID_SELF;
838 alloc_unbound.remote_dom = 0;
839
840 err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound,
841 &alloc_unbound);
842 if (err == -ENOSYS)
843 goto out_error;
844
845 BUG_ON(err);
846 xen_store_evtchn = xen_start_info->store_evtchn =
847 alloc_unbound.port;
848
849 xen_store_interface = mfn_to_virt(xen_store_mfn);
825 } else { 850 } else {
826 if (xen_hvm_domain()) { 851 if (xen_hvm_domain()) {
827 uint64_t v = 0; 852 uint64_t v = 0;
@@ -867,6 +892,8 @@ static int __init xenbus_init(void)
867 bus_unregister(&xenbus_frontend.bus); 892 bus_unregister(&xenbus_frontend.bus);
868 893
869 out_error: 894 out_error:
895 if (page != 0)
896 free_page(page);
870 return err; 897 return err;
871} 898}
872 899