diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2009-02-09 15:05:51 -0500 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-01-05 16:29:58 -0500 |
commit | df660251eb534649f90f9dcfe1da1cef4ea48a3e (patch) | |
tree | f4ce5d401d16f13437f553117acb7807d05ed2dd /drivers | |
parent | 2de06cc1f18d638cc7ab1169f61a8599045c2d4f (diff) |
xen: add backend driver support
Impact: backend device support
Add the basic machinery to support backend drivers.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
[corresponds to 79727b851bac in git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git]
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/xen/Kconfig | 8 | ||||
-rw-r--r-- | drivers/xen/xenbus/Makefile | 3 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_comms.c | 1 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe.c | 13 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe.h | 1 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe_backend.c | 300 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe_frontend.c | 39 |
7 files changed, 344 insertions, 21 deletions
diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index 10b6bef2e217..84bf17bbb1cd 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig | |||
@@ -29,6 +29,14 @@ config XEN_DEV_EVTCHN | |||
29 | firing. | 29 | firing. |
30 | If in doubt, say yes. | 30 | If in doubt, say yes. |
31 | 31 | ||
32 | config XEN_BACKEND | ||
33 | tristate "Backend driver support" | ||
34 | depends on XEN_DOM0 | ||
35 | default y | ||
36 | help | ||
37 | Support for backend device drivers that provide I/O services | ||
38 | to other virtual machines. | ||
39 | |||
32 | config XENFS | 40 | config XENFS |
33 | tristate "Xen filesystem" | 41 | tristate "Xen filesystem" |
34 | default y | 42 | default y |
diff --git a/drivers/xen/xenbus/Makefile b/drivers/xen/xenbus/Makefile index 33e8cf8149b3..8dca685358b4 100644 --- a/drivers/xen/xenbus/Makefile +++ b/drivers/xen/xenbus/Makefile | |||
@@ -6,4 +6,7 @@ xenbus-objs += xenbus_comms.o | |||
6 | xenbus-objs += xenbus_xs.o | 6 | xenbus-objs += xenbus_xs.o |
7 | xenbus-objs += xenbus_probe.o | 7 | xenbus-objs += xenbus_probe.o |
8 | 8 | ||
9 | xenbus-be-objs-$(CONFIG_XEN_BACKEND) += xenbus_probe_backend.o | ||
10 | xenbus-objs += $(xenbus-be-objs-y) | ||
11 | |||
9 | obj-$(CONFIG_XEN_XENBUS_FRONTEND) += xenbus_probe_frontend.o | 12 | obj-$(CONFIG_XEN_XENBUS_FRONTEND) += xenbus_probe_frontend.o |
diff --git a/drivers/xen/xenbus/xenbus_comms.c b/drivers/xen/xenbus/xenbus_comms.c index 090c61ee8fd0..700dc7714838 100644 --- a/drivers/xen/xenbus/xenbus_comms.c +++ b/drivers/xen/xenbus/xenbus_comms.c | |||
@@ -49,6 +49,7 @@ static DECLARE_WAIT_QUEUE_HEAD(xb_waitq); | |||
49 | static irqreturn_t wake_waiting(int irq, void *unused) | 49 | static irqreturn_t wake_waiting(int irq, void *unused) |
50 | { | 50 | { |
51 | if (unlikely(xenstored_ready == 0)) { | 51 | if (unlikely(xenstored_ready == 0)) { |
52 | printk(KERN_CRIT "xenbus_probe wake_waiting\n"); | ||
52 | xenstored_ready = 1; | 53 | xenstored_ready = 1; |
53 | schedule_work(&probe_work); | 54 | schedule_work(&probe_work); |
54 | } | 55 | } |
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index d46205868b88..b09eb17ba007 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c | |||
@@ -95,17 +95,6 @@ int xenbus_match(struct device *_dev, struct device_driver *_drv) | |||
95 | EXPORT_SYMBOL_GPL(xenbus_match); | 95 | EXPORT_SYMBOL_GPL(xenbus_match); |
96 | 96 | ||
97 | 97 | ||
98 | int xenbus_uevent(struct device *_dev, struct kobj_uevent_env *env) | ||
99 | { | ||
100 | struct xenbus_device *dev = to_xenbus_device(_dev); | ||
101 | |||
102 | if (add_uevent_var(env, "MODALIAS=xen:%s", dev->devicetype)) | ||
103 | return -ENOMEM; | ||
104 | |||
105 | return 0; | ||
106 | } | ||
107 | EXPORT_SYMBOL_GPL(xenbus_uevent); | ||
108 | |||
109 | static void free_otherend_details(struct xenbus_device *dev) | 98 | static void free_otherend_details(struct xenbus_device *dev) |
110 | { | 99 | { |
111 | kfree(dev->otherend); | 100 | kfree(dev->otherend); |
@@ -690,6 +679,8 @@ void xenbus_probe(struct work_struct *unused) | |||
690 | { | 679 | { |
691 | xenstored_ready = 1; | 680 | xenstored_ready = 1; |
692 | 681 | ||
682 | printk(KERN_CRIT "xenbus_probe wake_waiting\n"); | ||
683 | |||
693 | /* Notify others that xenstore is up */ | 684 | /* Notify others that xenstore is up */ |
694 | blocking_notifier_call_chain(&xenstore_chain, 0, NULL); | 685 | blocking_notifier_call_chain(&xenstore_chain, 0, NULL); |
695 | } | 686 | } |
diff --git a/drivers/xen/xenbus/xenbus_probe.h b/drivers/xen/xenbus/xenbus_probe.h index be390cef329f..0e5fc4c63eb2 100644 --- a/drivers/xen/xenbus/xenbus_probe.h +++ b/drivers/xen/xenbus/xenbus_probe.h | |||
@@ -60,7 +60,6 @@ extern int xenbus_probe_devices(struct xen_bus_type *bus); | |||
60 | 60 | ||
61 | extern void xenbus_dev_changed(const char *node, struct xen_bus_type *bus); | 61 | extern void xenbus_dev_changed(const char *node, struct xen_bus_type *bus); |
62 | 62 | ||
63 | extern int xenbus_uevent(struct device *_dev, struct kobj_uevent_env *env); | ||
64 | extern void xenbus_dev_shutdown(struct device *_dev); | 63 | extern void xenbus_dev_shutdown(struct device *_dev); |
65 | 64 | ||
66 | extern int xenbus_dev_suspend(struct device *dev, pm_message_t state); | 65 | extern int xenbus_dev_suspend(struct device *dev, pm_message_t state); |
diff --git a/drivers/xen/xenbus/xenbus_probe_backend.c b/drivers/xen/xenbus/xenbus_probe_backend.c new file mode 100644 index 000000000000..7459ccee3c8b --- /dev/null +++ b/drivers/xen/xenbus/xenbus_probe_backend.c | |||
@@ -0,0 +1,300 @@ | |||
1 | /****************************************************************************** | ||
2 | * Talks to Xen Store to figure out what devices we have (backend half). | ||
3 | * | ||
4 | * Copyright (C) 2005 Rusty Russell, IBM Corporation | ||
5 | * Copyright (C) 2005 Mike Wray, Hewlett-Packard | ||
6 | * Copyright (C) 2005, 2006 XenSource Ltd | ||
7 | * Copyright (C) 2007 Solarflare Communications, Inc. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License version 2 | ||
11 | * as published by the Free Software Foundation; or, when distributed | ||
12 | * separately from the Linux kernel or incorporated into other | ||
13 | * software packages, subject to the following license: | ||
14 | * | ||
15 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
16 | * of this source file (the "Software"), to deal in the Software without | ||
17 | * restriction, including without limitation the rights to use, copy, modify, | ||
18 | * merge, publish, distribute, sublicense, and/or sell copies of the Software, | ||
19 | * and to permit persons to whom the Software is furnished to do so, subject to | ||
20 | * the following conditions: | ||
21 | * | ||
22 | * The above copyright notice and this permission notice shall be included in | ||
23 | * all copies or substantial portions of the Software. | ||
24 | * | ||
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
26 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
27 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
28 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
29 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
30 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
31 | * IN THE SOFTWARE. | ||
32 | */ | ||
33 | |||
34 | #define DPRINTK(fmt, args...) \ | ||
35 | pr_debug("xenbus_probe (%s:%d) " fmt ".\n", \ | ||
36 | __func__, __LINE__, ##args) | ||
37 | |||
38 | #include <linux/kernel.h> | ||
39 | #include <linux/err.h> | ||
40 | #include <linux/string.h> | ||
41 | #include <linux/ctype.h> | ||
42 | #include <linux/fcntl.h> | ||
43 | #include <linux/mm.h> | ||
44 | #include <linux/notifier.h> | ||
45 | |||
46 | #include <asm/page.h> | ||
47 | #include <asm/pgtable.h> | ||
48 | #include <asm/xen/hypervisor.h> | ||
49 | #include <asm/hypervisor.h> | ||
50 | #include <xen/xenbus.h> | ||
51 | #include <xen/evtchn.h> | ||
52 | #include <xen/features.h> | ||
53 | |||
54 | #include "xenbus_comms.h" | ||
55 | #include "xenbus_probe.h" | ||
56 | |||
57 | /* backend/<type>/<fe-uuid>/<id> => <type>-<fe-domid>-<id> */ | ||
58 | static int backend_bus_id(char bus_id[XEN_BUS_ID_SIZE], const char *nodename) | ||
59 | { | ||
60 | int domid, err; | ||
61 | const char *devid, *type, *frontend; | ||
62 | unsigned int typelen; | ||
63 | |||
64 | type = strchr(nodename, '/'); | ||
65 | if (!type) | ||
66 | return -EINVAL; | ||
67 | type++; | ||
68 | typelen = strcspn(type, "/"); | ||
69 | if (!typelen || type[typelen] != '/') | ||
70 | return -EINVAL; | ||
71 | |||
72 | devid = strrchr(nodename, '/') + 1; | ||
73 | |||
74 | err = xenbus_gather(XBT_NIL, nodename, "frontend-id", "%i", &domid, | ||
75 | "frontend", NULL, &frontend, | ||
76 | NULL); | ||
77 | if (err) | ||
78 | return err; | ||
79 | if (strlen(frontend) == 0) | ||
80 | err = -ERANGE; | ||
81 | if (!err && !xenbus_exists(XBT_NIL, frontend, "")) | ||
82 | err = -ENOENT; | ||
83 | kfree(frontend); | ||
84 | |||
85 | if (err) | ||
86 | return err; | ||
87 | |||
88 | if (snprintf(bus_id, XEN_BUS_ID_SIZE, | ||
89 | "%.*s-%i-%s", typelen, type, domid, devid) >= XEN_BUS_ID_SIZE) | ||
90 | return -ENOSPC; | ||
91 | return 0; | ||
92 | } | ||
93 | |||
94 | static int xenbus_uevent_backend(struct device *dev, | ||
95 | struct kobj_uevent_env *env) | ||
96 | { | ||
97 | struct xenbus_device *xdev; | ||
98 | struct xenbus_driver *drv; | ||
99 | struct xen_bus_type *bus; | ||
100 | |||
101 | DPRINTK(""); | ||
102 | |||
103 | if (dev == NULL) | ||
104 | return -ENODEV; | ||
105 | |||
106 | xdev = to_xenbus_device(dev); | ||
107 | bus = container_of(xdev->dev.bus, struct xen_bus_type, bus); | ||
108 | if (xdev == NULL) | ||
109 | return -ENODEV; | ||
110 | |||
111 | /* stuff we want to pass to /sbin/hotplug */ | ||
112 | if (add_uevent_var(env, "XENBUS_TYPE=%s", xdev->devicetype)) | ||
113 | return -ENOMEM; | ||
114 | |||
115 | if (add_uevent_var(env, "XENBUS_PATH=%s", xdev->nodename)) | ||
116 | return -ENOMEM; | ||
117 | |||
118 | if (add_uevent_var(env, "XENBUS_BASE_PATH=%s", bus->root)) | ||
119 | return -ENOMEM; | ||
120 | |||
121 | if (dev->driver) { | ||
122 | drv = to_xenbus_driver(dev->driver); | ||
123 | if (drv && drv->uevent) | ||
124 | return drv->uevent(xdev, env); | ||
125 | } | ||
126 | |||
127 | return 0; | ||
128 | } | ||
129 | |||
130 | /* backend/<typename>/<frontend-uuid>/<name> */ | ||
131 | static int xenbus_probe_backend_unit(struct xen_bus_type *bus, | ||
132 | const char *dir, | ||
133 | const char *type, | ||
134 | const char *name) | ||
135 | { | ||
136 | char *nodename; | ||
137 | int err; | ||
138 | |||
139 | nodename = kasprintf(GFP_KERNEL, "%s/%s", dir, name); | ||
140 | if (!nodename) | ||
141 | return -ENOMEM; | ||
142 | |||
143 | DPRINTK("%s\n", nodename); | ||
144 | |||
145 | err = xenbus_probe_node(bus, type, nodename); | ||
146 | kfree(nodename); | ||
147 | return err; | ||
148 | } | ||
149 | |||
150 | /* backend/<typename>/<frontend-domid> */ | ||
151 | static int xenbus_probe_backend(struct xen_bus_type *bus, const char *type, const char *domid) | ||
152 | { | ||
153 | char *nodename; | ||
154 | int err = 0; | ||
155 | char **dir; | ||
156 | unsigned int i, dir_n = 0; | ||
157 | |||
158 | DPRINTK(""); | ||
159 | |||
160 | nodename = kasprintf(GFP_KERNEL, "%s/%s/%s", bus->root, type, domid); | ||
161 | if (!nodename) | ||
162 | return -ENOMEM; | ||
163 | |||
164 | dir = xenbus_directory(XBT_NIL, nodename, "", &dir_n); | ||
165 | if (IS_ERR(dir)) { | ||
166 | kfree(nodename); | ||
167 | return PTR_ERR(dir); | ||
168 | } | ||
169 | |||
170 | for (i = 0; i < dir_n; i++) { | ||
171 | err = xenbus_probe_backend_unit(bus, nodename, type, dir[i]); | ||
172 | if (err) | ||
173 | break; | ||
174 | } | ||
175 | kfree(dir); | ||
176 | kfree(nodename); | ||
177 | return err; | ||
178 | } | ||
179 | |||
180 | static void frontend_changed(struct xenbus_watch *watch, | ||
181 | const char **vec, unsigned int len) | ||
182 | { | ||
183 | xenbus_otherend_changed(watch, vec, len, 0); | ||
184 | } | ||
185 | |||
186 | static struct device_attribute xenbus_backend_dev_attrs[] = { | ||
187 | __ATTR_NULL | ||
188 | }; | ||
189 | |||
190 | static struct xen_bus_type xenbus_backend = { | ||
191 | .root = "backend", | ||
192 | .levels = 3, /* backend/type/<frontend>/<id> */ | ||
193 | .get_bus_id = backend_bus_id, | ||
194 | .probe = xenbus_probe_backend, | ||
195 | .otherend_changed = frontend_changed, | ||
196 | .bus = { | ||
197 | .name = "xen-backend", | ||
198 | .match = xenbus_match, | ||
199 | .uevent = xenbus_uevent_backend, | ||
200 | .probe = xenbus_dev_probe, | ||
201 | .remove = xenbus_dev_remove, | ||
202 | .shutdown = xenbus_dev_shutdown, | ||
203 | .dev_attrs = xenbus_backend_dev_attrs, | ||
204 | }, | ||
205 | }; | ||
206 | |||
207 | static void backend_changed(struct xenbus_watch *watch, | ||
208 | const char **vec, unsigned int len) | ||
209 | { | ||
210 | DPRINTK(""); | ||
211 | |||
212 | xenbus_dev_changed(vec[XS_WATCH_PATH], &xenbus_backend); | ||
213 | } | ||
214 | |||
215 | static struct xenbus_watch be_watch = { | ||
216 | .node = "backend", | ||
217 | .callback = backend_changed, | ||
218 | }; | ||
219 | |||
220 | static int read_frontend_details(struct xenbus_device *xendev) | ||
221 | { | ||
222 | return xenbus_read_otherend_details(xendev, "frontend-id", "frontend"); | ||
223 | } | ||
224 | |||
225 | //void xenbus_backend_suspend(int (*fn)(struct device *, void *)) | ||
226 | //{ | ||
227 | // DPRINTK(""); | ||
228 | // bus_for_each_dev(&xenbus_backend.bus, NULL, NULL, fn); | ||
229 | //} | ||
230 | |||
231 | //void xenbus_backend_resume(int (*fn)(struct device *, void *)) | ||
232 | //{ | ||
233 | // DPRINTK(""); | ||
234 | // bus_for_each_dev(&xenbus_backend.bus, NULL, NULL, fn); | ||
235 | //} | ||
236 | |||
237 | //int xenbus_for_each_backend(void *arg, int (*fn)(struct device *, void *)) | ||
238 | //{ | ||
239 | // return bus_for_each_dev(&xenbus_backend.bus, NULL, arg, fn); | ||
240 | //} | ||
241 | //EXPORT_SYMBOL_GPL(xenbus_for_each_backend); | ||
242 | |||
243 | int xenbus_dev_is_online(struct xenbus_device *dev) | ||
244 | { | ||
245 | int rc, val; | ||
246 | |||
247 | rc = xenbus_scanf(XBT_NIL, dev->nodename, "online", "%d", &val); | ||
248 | if (rc != 1) | ||
249 | val = 0; /* no online node present */ | ||
250 | |||
251 | return val; | ||
252 | } | ||
253 | EXPORT_SYMBOL_GPL(xenbus_dev_is_online); | ||
254 | |||
255 | int __xenbus_register_backend(struct xenbus_driver *drv, | ||
256 | struct module *owner, const char *mod_name) | ||
257 | { | ||
258 | drv->read_otherend_details = read_frontend_details; | ||
259 | |||
260 | return xenbus_register_driver_common(drv, &xenbus_backend, | ||
261 | owner, mod_name); | ||
262 | } | ||
263 | EXPORT_SYMBOL_GPL(__xenbus_register_backend); | ||
264 | |||
265 | static int backend_probe_and_watch(struct notifier_block *notifier, | ||
266 | unsigned long event, | ||
267 | void *data) | ||
268 | { | ||
269 | /* Enumerate devices in xenstore and watch for changes. */ | ||
270 | xenbus_probe_devices(&xenbus_backend); | ||
271 | printk(KERN_CRIT "%s devices probed ok\n", __func__); | ||
272 | register_xenbus_watch(&be_watch); | ||
273 | printk(KERN_CRIT "%s watch add ok ok\n", __func__); | ||
274 | printk(KERN_CRIT "%s all done\n", __func__); | ||
275 | return NOTIFY_DONE; | ||
276 | } | ||
277 | |||
278 | static int __init xenbus_probe_backend_init(void) | ||
279 | { | ||
280 | static struct notifier_block xenstore_notifier = { | ||
281 | .notifier_call = backend_probe_and_watch | ||
282 | }; | ||
283 | int err; | ||
284 | |||
285 | DPRINTK(""); | ||
286 | |||
287 | /* Register ourselves with the kernel bus subsystem */ | ||
288 | err = bus_register(&xenbus_backend.bus); | ||
289 | if (err) { | ||
290 | printk(KERN_CRIT "%s didn't register bus!\n", __func__); | ||
291 | return err; | ||
292 | } | ||
293 | printk(KERN_CRIT "%s bus registered ok\n", __func__); | ||
294 | |||
295 | register_xenstore_notifier(&xenstore_notifier); | ||
296 | |||
297 | return 0; | ||
298 | } | ||
299 | |||
300 | module_init(xenbus_probe_backend_init); | ||
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c index 04c4f0123521..dd31d5a43b40 100644 --- a/drivers/xen/xenbus/xenbus_probe_frontend.c +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c | |||
@@ -62,6 +62,17 @@ static int xenbus_probe_frontend(struct xen_bus_type *bus, const char *type, con | |||
62 | return err; | 62 | return err; |
63 | } | 63 | } |
64 | 64 | ||
65 | static int xenbus_uevent_frontend(struct device *_dev, struct kobj_uevent_env *env) | ||
66 | { | ||
67 | struct xenbus_device *dev = to_xenbus_device(_dev); | ||
68 | |||
69 | if (add_uevent_var(env, "MODALIAS=xen:%s", dev->devicetype)) | ||
70 | return -ENOMEM; | ||
71 | |||
72 | return 0; | ||
73 | } | ||
74 | |||
75 | |||
65 | static void backend_changed(struct xenbus_watch *watch, | 76 | static void backend_changed(struct xenbus_watch *watch, |
66 | const char **vec, unsigned int len) | 77 | const char **vec, unsigned int len) |
67 | { | 78 | { |
@@ -81,7 +92,7 @@ static struct xen_bus_type xenbus_frontend = { | |||
81 | .bus = { | 92 | .bus = { |
82 | .name = "xen", | 93 | .name = "xen", |
83 | .match = xenbus_match, | 94 | .match = xenbus_match, |
84 | .uevent = xenbus_uevent, | 95 | .uevent = xenbus_uevent_frontend, |
85 | .probe = xenbus_dev_probe, | 96 | .probe = xenbus_dev_probe, |
86 | .remove = xenbus_dev_remove, | 97 | .remove = xenbus_dev_remove, |
87 | .shutdown = xenbus_dev_shutdown, | 98 | .shutdown = xenbus_dev_shutdown, |
@@ -232,8 +243,25 @@ int __xenbus_register_frontend(struct xenbus_driver *drv, | |||
232 | } | 243 | } |
233 | EXPORT_SYMBOL_GPL(__xenbus_register_frontend); | 244 | EXPORT_SYMBOL_GPL(__xenbus_register_frontend); |
234 | 245 | ||
246 | static int frontend_probe_and_watch(struct notifier_block *notifier, | ||
247 | unsigned long event, | ||
248 | void *data) | ||
249 | { | ||
250 | /* Enumerate devices in xenstore and watch for changes. */ | ||
251 | xenbus_probe_devices(&xenbus_frontend); | ||
252 | printk(KERN_CRIT "%s devices probed ok\n", __func__); | ||
253 | register_xenbus_watch(&fe_watch); | ||
254 | printk(KERN_CRIT "%s watch add ok ok\n", __func__); | ||
255 | printk(KERN_CRIT "%s all done\n", __func__); | ||
256 | return NOTIFY_DONE; | ||
257 | } | ||
258 | |||
259 | |||
235 | static int __init xenbus_probe_frontend_init(void) | 260 | static int __init xenbus_probe_frontend_init(void) |
236 | { | 261 | { |
262 | static struct notifier_block xenstore_notifier = { | ||
263 | .notifier_call = frontend_probe_and_watch | ||
264 | }; | ||
237 | int err; | 265 | int err; |
238 | 266 | ||
239 | DPRINTK(""); | 267 | DPRINTK(""); |
@@ -246,14 +274,7 @@ static int __init xenbus_probe_frontend_init(void) | |||
246 | } | 274 | } |
247 | printk(KERN_CRIT "%s bus registered ok\n", __func__); | 275 | printk(KERN_CRIT "%s bus registered ok\n", __func__); |
248 | 276 | ||
249 | if (!xen_initial_domain()) { | 277 | register_xenstore_notifier(&xenstore_notifier); |
250 | /* Enumerate devices in xenstore and watch for changes. */ | ||
251 | xenbus_probe_devices(&xenbus_frontend); | ||
252 | printk(KERN_CRIT "%s devices probed ok\n", __func__); | ||
253 | register_xenbus_watch(&fe_watch); | ||
254 | printk(KERN_CRIT "%s watch add ok ok\n", __func__); | ||
255 | printk(KERN_CRIT "%s all done\n", __func__); | ||
256 | } | ||
257 | 278 | ||
258 | return 0; | 279 | return 0; |
259 | } | 280 | } |