diff options
-rw-r--r-- | 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 d409495876f1..d242610597c0 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c | |||
@@ -801,6 +801,7 @@ device_initcall(xenbus_probe_initcall); | |||
801 | static int __init xenbus_init(void) | 801 | static 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 | ||