]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
Handle ARM dom0 for xenstore
authorJulien Grall <julien.grall@linaro.org>
Fri, 6 Jun 2014 00:21:48 +0000 (01:21 +0100)
committerJulien Grall <julien.grall@citrix.com>
Mon, 2 Nov 2015 11:46:55 +0000 (11:46 +0000)
sys/dev/xen/xenstore/xenstore.c

index d8b21b4fdc52a11e4450d25fba8892d2488a2dd3..f74c7f5e7f1137abbe69546f927a494190992438 100644 (file)
@@ -1165,40 +1165,42 @@ xs_attach(device_t dev)
        struct proc *p;
 
        xs.initialized = false;
+
        if (xen_hvm_domain()) {
                xs.evtchn = hvm_get_parameter(HVM_PARAM_STORE_EVTCHN);
                xs.gpfn = hvm_get_parameter(HVM_PARAM_STORE_PFN);
-               xen_store = xen_pmap(xs.gpfn * PAGE_SIZE, PAGE_SIZE);
-               xs.initialized = true;
+               if (xs.evtchn != 0)
+                       xen_store = xen_pmap(xs.gpfn * PAGE_SIZE, PAGE_SIZE);
        } else if (xen_pv_domain()) {
-               if (HYPERVISOR_start_info->store_evtchn == 0) {
-                       struct evtchn_alloc_unbound alloc_unbound;
-
-                       /* Allocate a local event channel for xenstore */
-                       alloc_unbound.dom = DOMID_SELF;
-                       alloc_unbound.remote_dom = DOMID_SELF;
-                       error = HYPERVISOR_event_channel_op(
-                           EVTCHNOP_alloc_unbound, &alloc_unbound);
-                       if (error != 0)
-                               panic(
-                                  "unable to alloc event channel for Dom0: %d",
-                                   error);
-
-                       HYPERVISOR_start_info->store_evtchn =
-                           alloc_unbound.port;
-                       xs.evtchn = alloc_unbound.port;
-
-                       /* Allocate memory for the xs shared ring */
-                       xen_store = malloc(PAGE_SIZE, M_XENSTORE,
-                           M_WAITOK | M_ZERO);
-               } else {
-                       xs.evtchn = HYPERVISOR_start_info->store_evtchn;
-                       xs.initialized = true;
-               }
+               xs.evtchn = HYPERVISOR_start_info->store_evtchn;
        } else {
                panic("Unknown domain type, cannot initialize xenstore.");
        }
 
+       if (xs.evtchn == 0) {
+               struct evtchn_alloc_unbound alloc_unbound;
+
+               /* Allocate a local event channel for xenstore */
+               alloc_unbound.dom = DOMID_SELF;
+               alloc_unbound.remote_dom = DOMID_SELF;
+               error = HYPERVISOR_event_channel_op(
+                   EVTCHNOP_alloc_unbound, &alloc_unbound);
+               if (error != 0)
+                       panic(
+                          "unable to alloc event channel for Dom0: %d",
+                           error);
+
+               HYPERVISOR_start_info->store_evtchn =
+                   alloc_unbound.port;
+               xs.evtchn = alloc_unbound.port;
+
+               /* Allocate memory for the xs shared ring */
+               xen_store = malloc(PAGE_SIZE, M_XENSTORE,
+                   M_WAITOK | M_ZERO);
+       }
+       else
+               xs.initialized = true;
+
        TAILQ_INIT(&xs.reply_list);
        TAILQ_INIT(&xs.watch_events);