Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * Talks to Xen Store to figure out what devices we have. |
| 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 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License version 2 |
| 10 | * as published by the Free Software Foundation; or, when distributed |
| 11 | * separately from the Linux kernel or incorporated into other |
| 12 | * software packages, subject to the following license: |
| 13 | * |
| 14 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 15 | * of this source file (the "Software"), to deal in the Software without |
| 16 | * restriction, including without limitation the rights to use, copy, modify, |
| 17 | * merge, publish, distribute, sublicense, and/or sell copies of the Software, |
| 18 | * and to permit persons to whom the Software is furnished to do so, subject to |
| 19 | * the following conditions: |
| 20 | * |
| 21 | * The above copyright notice and this permission notice shall be included in |
| 22 | * all copies or substantial portions of the Software. |
| 23 | * |
| 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 25 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 26 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 27 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 28 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 29 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 30 | * IN THE SOFTWARE. |
| 31 | */ |
| 32 | |
| 33 | #define DPRINTK(fmt, args...) \ |
| 34 | pr_debug("xenbus_probe (%s:%d) " fmt ".\n", \ |
| 35 | __func__, __LINE__, ##args) |
| 36 | |
| 37 | #include <linux/kernel.h> |
| 38 | #include <linux/err.h> |
| 39 | #include <linux/string.h> |
| 40 | #include <linux/ctype.h> |
| 41 | #include <linux/fcntl.h> |
| 42 | #include <linux/mm.h> |
Alex Zeffertt | 1107ba8 | 2009-01-07 18:07:11 -0800 | [diff] [blame] | 43 | #include <linux/proc_fs.h> |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 44 | #include <linux/notifier.h> |
| 45 | #include <linux/kthread.h> |
| 46 | #include <linux/mutex.h> |
| 47 | #include <linux/io.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 48 | #include <linux/slab.h> |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 49 | |
| 50 | #include <asm/page.h> |
| 51 | #include <asm/pgtable.h> |
| 52 | #include <asm/xen/hypervisor.h> |
Jeremy Fitzhardinge | 1ccbf53 | 2009-10-06 15:11:14 -0700 | [diff] [blame] | 53 | |
| 54 | #include <xen/xen.h> |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 55 | #include <xen/xenbus.h> |
| 56 | #include <xen/events.h> |
| 57 | #include <xen/page.h> |
| 58 | |
Sheng Yang | bee6ab53 | 2010-05-14 12:39:33 +0100 | [diff] [blame] | 59 | #include <xen/hvm.h> |
| 60 | |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 61 | #include "xenbus_comms.h" |
| 62 | #include "xenbus_probe.h" |
| 63 | |
Alex Zeffertt | 1107ba8 | 2009-01-07 18:07:11 -0800 | [diff] [blame] | 64 | |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 65 | int xen_store_evtchn; |
Jeremy Fitzhardinge | 8e3e999 | 2009-03-21 23:51:26 -0700 | [diff] [blame] | 66 | EXPORT_SYMBOL_GPL(xen_store_evtchn); |
Alex Zeffertt | 1107ba8 | 2009-01-07 18:07:11 -0800 | [diff] [blame] | 67 | |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 68 | struct xenstore_domain_interface *xen_store_interface; |
Jeremy Fitzhardinge | 8e3e999 | 2009-03-21 23:51:26 -0700 | [diff] [blame] | 69 | EXPORT_SYMBOL_GPL(xen_store_interface); |
| 70 | |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 71 | static unsigned long xen_store_mfn; |
| 72 | |
| 73 | static BLOCKING_NOTIFIER_HEAD(xenstore_chain); |
| 74 | |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 75 | /* If something in array of ids matches this device, return it. */ |
| 76 | static const struct xenbus_device_id * |
| 77 | match_device(const struct xenbus_device_id *arr, struct xenbus_device *dev) |
| 78 | { |
| 79 | for (; *arr->devicetype != '\0'; arr++) { |
| 80 | if (!strcmp(arr->devicetype, dev->devicetype)) |
| 81 | return arr; |
| 82 | } |
| 83 | return NULL; |
| 84 | } |
| 85 | |
| 86 | int xenbus_match(struct device *_dev, struct device_driver *_drv) |
| 87 | { |
| 88 | struct xenbus_driver *drv = to_xenbus_driver(_drv); |
| 89 | |
| 90 | if (!drv->ids) |
| 91 | return 0; |
| 92 | |
| 93 | return match_device(drv->ids, to_xenbus_device(_dev)) != NULL; |
| 94 | } |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 95 | EXPORT_SYMBOL_GPL(xenbus_match); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 96 | |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 97 | |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 98 | static void free_otherend_details(struct xenbus_device *dev) |
| 99 | { |
| 100 | kfree(dev->otherend); |
| 101 | dev->otherend = NULL; |
| 102 | } |
| 103 | |
| 104 | |
| 105 | static void free_otherend_watch(struct xenbus_device *dev) |
| 106 | { |
| 107 | if (dev->otherend_watch.node) { |
| 108 | unregister_xenbus_watch(&dev->otherend_watch); |
| 109 | kfree(dev->otherend_watch.node); |
| 110 | dev->otherend_watch.node = NULL; |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 115 | static int talk_to_otherend(struct xenbus_device *dev) |
| 116 | { |
| 117 | struct xenbus_driver *drv = to_xenbus_driver(dev->dev.driver); |
| 118 | |
| 119 | free_otherend_watch(dev); |
| 120 | free_otherend_details(dev); |
| 121 | |
| 122 | return drv->read_otherend_details(dev); |
| 123 | } |
| 124 | |
| 125 | |
| 126 | |
| 127 | static int watch_otherend(struct xenbus_device *dev) |
| 128 | { |
| 129 | struct xen_bus_type *bus = container_of(dev->dev.bus, struct xen_bus_type, bus); |
| 130 | |
| 131 | return xenbus_watch_pathfmt(dev, &dev->otherend_watch, bus->otherend_changed, |
| 132 | "%s/%s", dev->otherend, "state"); |
| 133 | } |
| 134 | |
| 135 | |
| 136 | int xenbus_read_otherend_details(struct xenbus_device *xendev, |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 137 | char *id_node, char *path_node) |
| 138 | { |
| 139 | int err = xenbus_gather(XBT_NIL, xendev->nodename, |
| 140 | id_node, "%i", &xendev->otherend_id, |
| 141 | path_node, NULL, &xendev->otherend, |
| 142 | NULL); |
| 143 | if (err) { |
| 144 | xenbus_dev_fatal(xendev, err, |
| 145 | "reading other end details from %s", |
| 146 | xendev->nodename); |
| 147 | return err; |
| 148 | } |
| 149 | if (strlen(xendev->otherend) == 0 || |
| 150 | !xenbus_exists(XBT_NIL, xendev->otherend, "")) { |
| 151 | xenbus_dev_fatal(xendev, -ENOENT, |
| 152 | "unable to read other end from %s. " |
| 153 | "missing or inaccessible.", |
| 154 | xendev->nodename); |
| 155 | free_otherend_details(xendev); |
| 156 | return -ENOENT; |
| 157 | } |
| 158 | |
| 159 | return 0; |
| 160 | } |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 161 | EXPORT_SYMBOL_GPL(xenbus_read_otherend_details); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 162 | |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 163 | void xenbus_otherend_changed(struct xenbus_watch *watch, |
| 164 | const char **vec, unsigned int len, |
| 165 | int ignore_on_shutdown) |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 166 | { |
| 167 | struct xenbus_device *dev = |
| 168 | container_of(watch, struct xenbus_device, otherend_watch); |
| 169 | struct xenbus_driver *drv = to_xenbus_driver(dev->dev.driver); |
| 170 | enum xenbus_state state; |
| 171 | |
| 172 | /* Protect us against watches firing on old details when the otherend |
| 173 | details change, say immediately after a resume. */ |
| 174 | if (!dev->otherend || |
| 175 | strncmp(dev->otherend, vec[XS_WATCH_PATH], |
| 176 | strlen(dev->otherend))) { |
Joe Perches | 898eb71 | 2007-10-18 03:06:30 -0700 | [diff] [blame] | 177 | dev_dbg(&dev->dev, "Ignoring watch at %s\n", |
| 178 | vec[XS_WATCH_PATH]); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 179 | return; |
| 180 | } |
| 181 | |
| 182 | state = xenbus_read_driver_state(dev->otherend); |
| 183 | |
Joe Perches | 898eb71 | 2007-10-18 03:06:30 -0700 | [diff] [blame] | 184 | dev_dbg(&dev->dev, "state is %d, (%s), %s, %s\n", |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 185 | state, xenbus_strstate(state), dev->otherend_watch.node, |
| 186 | vec[XS_WATCH_PATH]); |
| 187 | |
| 188 | /* |
| 189 | * Ignore xenbus transitions during shutdown. This prevents us doing |
| 190 | * work that can fail e.g., when the rootfs is gone. |
| 191 | */ |
| 192 | if (system_state > SYSTEM_RUNNING) { |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 193 | if (ignore_on_shutdown && (state == XenbusStateClosing)) |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 194 | xenbus_frontend_closed(dev); |
| 195 | return; |
| 196 | } |
| 197 | |
| 198 | if (drv->otherend_changed) |
| 199 | drv->otherend_changed(dev, state); |
| 200 | } |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 201 | EXPORT_SYMBOL_GPL(xenbus_otherend_changed); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 202 | |
| 203 | int xenbus_dev_probe(struct device *_dev) |
| 204 | { |
| 205 | struct xenbus_device *dev = to_xenbus_device(_dev); |
| 206 | struct xenbus_driver *drv = to_xenbus_driver(_dev->driver); |
| 207 | const struct xenbus_device_id *id; |
| 208 | int err; |
| 209 | |
| 210 | DPRINTK("%s", dev->nodename); |
| 211 | |
| 212 | if (!drv->probe) { |
| 213 | err = -ENODEV; |
| 214 | goto fail; |
| 215 | } |
| 216 | |
| 217 | id = match_device(drv->ids, dev); |
| 218 | if (!id) { |
| 219 | err = -ENODEV; |
| 220 | goto fail; |
| 221 | } |
| 222 | |
| 223 | err = talk_to_otherend(dev); |
| 224 | if (err) { |
| 225 | dev_warn(&dev->dev, "talk_to_otherend on %s failed.\n", |
| 226 | dev->nodename); |
| 227 | return err; |
| 228 | } |
| 229 | |
| 230 | err = drv->probe(dev, id); |
| 231 | if (err) |
| 232 | goto fail; |
| 233 | |
| 234 | err = watch_otherend(dev); |
| 235 | if (err) { |
| 236 | dev_warn(&dev->dev, "watch_otherend on %s failed.\n", |
| 237 | dev->nodename); |
| 238 | return err; |
| 239 | } |
| 240 | |
| 241 | return 0; |
| 242 | fail: |
| 243 | xenbus_dev_error(dev, err, "xenbus_dev_probe on %s", dev->nodename); |
| 244 | xenbus_switch_state(dev, XenbusStateClosed); |
Jeremy Fitzhardinge | 7432e4b | 2009-10-29 14:19:42 -0700 | [diff] [blame] | 245 | return err; |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 246 | } |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 247 | EXPORT_SYMBOL_GPL(xenbus_dev_probe); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 248 | |
| 249 | int xenbus_dev_remove(struct device *_dev) |
| 250 | { |
| 251 | struct xenbus_device *dev = to_xenbus_device(_dev); |
| 252 | struct xenbus_driver *drv = to_xenbus_driver(_dev->driver); |
| 253 | |
| 254 | DPRINTK("%s", dev->nodename); |
| 255 | |
| 256 | free_otherend_watch(dev); |
| 257 | free_otherend_details(dev); |
| 258 | |
| 259 | if (drv->remove) |
| 260 | drv->remove(dev); |
| 261 | |
| 262 | xenbus_switch_state(dev, XenbusStateClosed); |
| 263 | return 0; |
| 264 | } |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 265 | EXPORT_SYMBOL_GPL(xenbus_dev_remove); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 266 | |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 267 | void xenbus_dev_shutdown(struct device *_dev) |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 268 | { |
| 269 | struct xenbus_device *dev = to_xenbus_device(_dev); |
| 270 | unsigned long timeout = 5*HZ; |
| 271 | |
| 272 | DPRINTK("%s", dev->nodename); |
| 273 | |
| 274 | get_device(&dev->dev); |
| 275 | if (dev->state != XenbusStateConnected) { |
| 276 | printk(KERN_INFO "%s: %s: %s != Connected, skipping\n", __func__, |
| 277 | dev->nodename, xenbus_strstate(dev->state)); |
| 278 | goto out; |
| 279 | } |
| 280 | xenbus_switch_state(dev, XenbusStateClosing); |
| 281 | timeout = wait_for_completion_timeout(&dev->down, timeout); |
| 282 | if (!timeout) |
| 283 | printk(KERN_INFO "%s: %s timeout closing device\n", |
| 284 | __func__, dev->nodename); |
| 285 | out: |
| 286 | put_device(&dev->dev); |
| 287 | } |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 288 | EXPORT_SYMBOL_GPL(xenbus_dev_shutdown); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 289 | |
| 290 | int xenbus_register_driver_common(struct xenbus_driver *drv, |
| 291 | struct xen_bus_type *bus, |
| 292 | struct module *owner, |
| 293 | const char *mod_name) |
| 294 | { |
| 295 | drv->driver.name = drv->name; |
| 296 | drv->driver.bus = &bus->bus; |
| 297 | drv->driver.owner = owner; |
| 298 | drv->driver.mod_name = mod_name; |
| 299 | |
| 300 | return driver_register(&drv->driver); |
| 301 | } |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 302 | EXPORT_SYMBOL_GPL(xenbus_register_driver_common); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 303 | |
| 304 | void xenbus_unregister_driver(struct xenbus_driver *drv) |
| 305 | { |
| 306 | driver_unregister(&drv->driver); |
| 307 | } |
| 308 | EXPORT_SYMBOL_GPL(xenbus_unregister_driver); |
| 309 | |
| 310 | struct xb_find_info |
| 311 | { |
| 312 | struct xenbus_device *dev; |
| 313 | const char *nodename; |
| 314 | }; |
| 315 | |
| 316 | static int cmp_dev(struct device *dev, void *data) |
| 317 | { |
| 318 | struct xenbus_device *xendev = to_xenbus_device(dev); |
| 319 | struct xb_find_info *info = data; |
| 320 | |
| 321 | if (!strcmp(xendev->nodename, info->nodename)) { |
| 322 | info->dev = xendev; |
| 323 | get_device(dev); |
| 324 | return 1; |
| 325 | } |
| 326 | return 0; |
| 327 | } |
| 328 | |
| 329 | struct xenbus_device *xenbus_device_find(const char *nodename, |
| 330 | struct bus_type *bus) |
| 331 | { |
| 332 | struct xb_find_info info = { .dev = NULL, .nodename = nodename }; |
| 333 | |
| 334 | bus_for_each_dev(bus, NULL, &info, cmp_dev); |
| 335 | return info.dev; |
| 336 | } |
| 337 | |
| 338 | static int cleanup_dev(struct device *dev, void *data) |
| 339 | { |
| 340 | struct xenbus_device *xendev = to_xenbus_device(dev); |
| 341 | struct xb_find_info *info = data; |
| 342 | int len = strlen(info->nodename); |
| 343 | |
| 344 | DPRINTK("%s", info->nodename); |
| 345 | |
| 346 | /* Match the info->nodename path, or any subdirectory of that path. */ |
| 347 | if (strncmp(xendev->nodename, info->nodename, len)) |
| 348 | return 0; |
| 349 | |
| 350 | /* If the node name is longer, ensure it really is a subdirectory. */ |
| 351 | if ((strlen(xendev->nodename) > len) && (xendev->nodename[len] != '/')) |
| 352 | return 0; |
| 353 | |
| 354 | info->dev = xendev; |
| 355 | get_device(dev); |
| 356 | return 1; |
| 357 | } |
| 358 | |
| 359 | static void xenbus_cleanup_devices(const char *path, struct bus_type *bus) |
| 360 | { |
| 361 | struct xb_find_info info = { .nodename = path }; |
| 362 | |
| 363 | do { |
| 364 | info.dev = NULL; |
| 365 | bus_for_each_dev(bus, NULL, &info, cleanup_dev); |
| 366 | if (info.dev) { |
| 367 | device_unregister(&info.dev->dev); |
| 368 | put_device(&info.dev->dev); |
| 369 | } |
| 370 | } while (info.dev); |
| 371 | } |
| 372 | |
| 373 | static void xenbus_dev_release(struct device *dev) |
| 374 | { |
| 375 | if (dev) |
| 376 | kfree(to_xenbus_device(dev)); |
| 377 | } |
| 378 | |
| 379 | static ssize_t xendev_show_nodename(struct device *dev, |
| 380 | struct device_attribute *attr, char *buf) |
| 381 | { |
| 382 | return sprintf(buf, "%s\n", to_xenbus_device(dev)->nodename); |
| 383 | } |
Jeremy Fitzhardinge | db05fed | 2009-11-24 16:41:47 -0800 | [diff] [blame] | 384 | static DEVICE_ATTR(nodename, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_nodename, NULL); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 385 | |
| 386 | static ssize_t xendev_show_devtype(struct device *dev, |
| 387 | struct device_attribute *attr, char *buf) |
| 388 | { |
| 389 | return sprintf(buf, "%s\n", to_xenbus_device(dev)->devicetype); |
| 390 | } |
Jeremy Fitzhardinge | db05fed | 2009-11-24 16:41:47 -0800 | [diff] [blame] | 391 | static DEVICE_ATTR(devtype, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_devtype, NULL); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 392 | |
Mark McLoughlin | d2f0c52 | 2008-04-02 10:54:05 -0700 | [diff] [blame] | 393 | static ssize_t xendev_show_modalias(struct device *dev, |
| 394 | struct device_attribute *attr, char *buf) |
| 395 | { |
| 396 | return sprintf(buf, "xen:%s\n", to_xenbus_device(dev)->devicetype); |
| 397 | } |
Jeremy Fitzhardinge | db05fed | 2009-11-24 16:41:47 -0800 | [diff] [blame] | 398 | static DEVICE_ATTR(modalias, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_modalias, NULL); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 399 | |
| 400 | int xenbus_probe_node(struct xen_bus_type *bus, |
| 401 | const char *type, |
| 402 | const char *nodename) |
| 403 | { |
Kay Sievers | 2a678cc | 2009-01-06 10:44:34 -0800 | [diff] [blame] | 404 | char devname[XEN_BUS_ID_SIZE]; |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 405 | int err; |
| 406 | struct xenbus_device *xendev; |
| 407 | size_t stringlen; |
| 408 | char *tmpstring; |
| 409 | |
| 410 | enum xenbus_state state = xenbus_read_driver_state(nodename); |
| 411 | |
| 412 | if (state != XenbusStateInitialising) { |
| 413 | /* Device is not new, so ignore it. This can happen if a |
| 414 | device is going away after switching to Closed. */ |
| 415 | return 0; |
| 416 | } |
| 417 | |
| 418 | stringlen = strlen(nodename) + 1 + strlen(type) + 1; |
| 419 | xendev = kzalloc(sizeof(*xendev) + stringlen, GFP_KERNEL); |
| 420 | if (!xendev) |
| 421 | return -ENOMEM; |
| 422 | |
| 423 | xendev->state = XenbusStateInitialising; |
| 424 | |
| 425 | /* Copy the strings into the extra space. */ |
| 426 | |
| 427 | tmpstring = (char *)(xendev + 1); |
| 428 | strcpy(tmpstring, nodename); |
| 429 | xendev->nodename = tmpstring; |
| 430 | |
| 431 | tmpstring += strlen(tmpstring) + 1; |
| 432 | strcpy(tmpstring, type); |
| 433 | xendev->devicetype = tmpstring; |
| 434 | init_completion(&xendev->down); |
| 435 | |
| 436 | xendev->dev.bus = &bus->bus; |
| 437 | xendev->dev.release = xenbus_dev_release; |
| 438 | |
Kay Sievers | 2a678cc | 2009-01-06 10:44:34 -0800 | [diff] [blame] | 439 | err = bus->get_bus_id(devname, xendev->nodename); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 440 | if (err) |
| 441 | goto fail; |
| 442 | |
Kay Sievers | 2a678cc | 2009-01-06 10:44:34 -0800 | [diff] [blame] | 443 | dev_set_name(&xendev->dev, devname); |
| 444 | |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 445 | /* Register with generic device framework. */ |
| 446 | err = device_register(&xendev->dev); |
| 447 | if (err) |
| 448 | goto fail; |
| 449 | |
| 450 | err = device_create_file(&xendev->dev, &dev_attr_nodename); |
| 451 | if (err) |
| 452 | goto fail_unregister; |
| 453 | |
| 454 | err = device_create_file(&xendev->dev, &dev_attr_devtype); |
| 455 | if (err) |
Mark McLoughlin | d2f0c52 | 2008-04-02 10:54:05 -0700 | [diff] [blame] | 456 | goto fail_remove_nodename; |
| 457 | |
| 458 | err = device_create_file(&xendev->dev, &dev_attr_modalias); |
| 459 | if (err) |
| 460 | goto fail_remove_devtype; |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 461 | |
| 462 | return 0; |
Mark McLoughlin | d2f0c52 | 2008-04-02 10:54:05 -0700 | [diff] [blame] | 463 | fail_remove_devtype: |
| 464 | device_remove_file(&xendev->dev, &dev_attr_devtype); |
| 465 | fail_remove_nodename: |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 466 | device_remove_file(&xendev->dev, &dev_attr_nodename); |
| 467 | fail_unregister: |
| 468 | device_unregister(&xendev->dev); |
| 469 | fail: |
| 470 | kfree(xendev); |
| 471 | return err; |
| 472 | } |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 473 | EXPORT_SYMBOL_GPL(xenbus_probe_node); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 474 | |
| 475 | static int xenbus_probe_device_type(struct xen_bus_type *bus, const char *type) |
| 476 | { |
| 477 | int err = 0; |
| 478 | char **dir; |
| 479 | unsigned int dir_n = 0; |
| 480 | int i; |
| 481 | |
| 482 | dir = xenbus_directory(XBT_NIL, bus->root, type, &dir_n); |
Jeremy Fitzhardinge | a39bda2 | 2010-03-29 14:38:12 -0700 | [diff] [blame] | 483 | if (IS_ERR(dir)) |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 484 | return PTR_ERR(dir); |
| 485 | |
| 486 | for (i = 0; i < dir_n; i++) { |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 487 | err = bus->probe(bus, type, dir[i]); |
Jeremy Fitzhardinge | a39bda2 | 2010-03-29 14:38:12 -0700 | [diff] [blame] | 488 | if (err) |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 489 | break; |
| 490 | } |
Jeremy Fitzhardinge | a39bda2 | 2010-03-29 14:38:12 -0700 | [diff] [blame] | 491 | |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 492 | kfree(dir); |
| 493 | return err; |
| 494 | } |
| 495 | |
| 496 | int xenbus_probe_devices(struct xen_bus_type *bus) |
| 497 | { |
| 498 | int err = 0; |
| 499 | char **dir; |
| 500 | unsigned int i, dir_n; |
| 501 | |
| 502 | dir = xenbus_directory(XBT_NIL, bus->root, "", &dir_n); |
Jeremy Fitzhardinge | a39bda2 | 2010-03-29 14:38:12 -0700 | [diff] [blame] | 503 | if (IS_ERR(dir)) |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 504 | return PTR_ERR(dir); |
| 505 | |
| 506 | for (i = 0; i < dir_n; i++) { |
| 507 | err = xenbus_probe_device_type(bus, dir[i]); |
Jeremy Fitzhardinge | a39bda2 | 2010-03-29 14:38:12 -0700 | [diff] [blame] | 508 | if (err) |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 509 | break; |
| 510 | } |
Jeremy Fitzhardinge | a39bda2 | 2010-03-29 14:38:12 -0700 | [diff] [blame] | 511 | |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 512 | kfree(dir); |
| 513 | return err; |
| 514 | } |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 515 | EXPORT_SYMBOL_GPL(xenbus_probe_devices); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 516 | |
| 517 | static unsigned int char_count(const char *str, char c) |
| 518 | { |
| 519 | unsigned int i, ret = 0; |
| 520 | |
| 521 | for (i = 0; str[i]; i++) |
| 522 | if (str[i] == c) |
| 523 | ret++; |
| 524 | return ret; |
| 525 | } |
| 526 | |
| 527 | static int strsep_len(const char *str, char c, unsigned int len) |
| 528 | { |
| 529 | unsigned int i; |
| 530 | |
| 531 | for (i = 0; str[i]; i++) |
| 532 | if (str[i] == c) { |
| 533 | if (len == 0) |
| 534 | return i; |
| 535 | len--; |
| 536 | } |
| 537 | return (len == 0) ? i : -ERANGE; |
| 538 | } |
| 539 | |
| 540 | void xenbus_dev_changed(const char *node, struct xen_bus_type *bus) |
| 541 | { |
| 542 | int exists, rootlen; |
| 543 | struct xenbus_device *dev; |
Kay Sievers | 2a678cc | 2009-01-06 10:44:34 -0800 | [diff] [blame] | 544 | char type[XEN_BUS_ID_SIZE]; |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 545 | const char *p, *root; |
| 546 | |
| 547 | if (char_count(node, '/') < 2) |
| 548 | return; |
| 549 | |
| 550 | exists = xenbus_exists(XBT_NIL, node, ""); |
| 551 | if (!exists) { |
| 552 | xenbus_cleanup_devices(node, &bus->bus); |
| 553 | return; |
| 554 | } |
| 555 | |
| 556 | /* backend/<type>/... or device/<type>/... */ |
| 557 | p = strchr(node, '/') + 1; |
Kay Sievers | 2a678cc | 2009-01-06 10:44:34 -0800 | [diff] [blame] | 558 | snprintf(type, XEN_BUS_ID_SIZE, "%.*s", (int)strcspn(p, "/"), p); |
| 559 | type[XEN_BUS_ID_SIZE-1] = '\0'; |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 560 | |
| 561 | rootlen = strsep_len(node, '/', bus->levels); |
| 562 | if (rootlen < 0) |
| 563 | return; |
| 564 | root = kasprintf(GFP_KERNEL, "%.*s", rootlen, node); |
| 565 | if (!root) |
| 566 | return; |
| 567 | |
| 568 | dev = xenbus_device_find(root, &bus->bus); |
| 569 | if (!dev) |
| 570 | xenbus_probe_node(bus, type, root); |
| 571 | else |
| 572 | put_device(&dev->dev); |
| 573 | |
| 574 | kfree(root); |
| 575 | } |
Jeremy Fitzhardinge | c6a960c | 2009-02-09 12:05:53 -0800 | [diff] [blame] | 576 | EXPORT_SYMBOL_GPL(xenbus_dev_changed); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 577 | |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 578 | int xenbus_dev_suspend(struct device *dev, pm_message_t state) |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 579 | { |
| 580 | int err = 0; |
| 581 | struct xenbus_driver *drv; |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 582 | struct xenbus_device *xdev = container_of(dev, struct xenbus_device, dev); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 583 | |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 584 | DPRINTK("%s", xdev->nodename); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 585 | |
| 586 | if (dev->driver == NULL) |
| 587 | return 0; |
| 588 | drv = to_xenbus_driver(dev->driver); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 589 | if (drv->suspend) |
Ian Campbell | de5b31b | 2009-02-09 12:05:50 -0800 | [diff] [blame] | 590 | err = drv->suspend(xdev, state); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 591 | if (err) |
| 592 | printk(KERN_WARNING |
Kay Sievers | 2a678cc | 2009-01-06 10:44:34 -0800 | [diff] [blame] | 593 | "xenbus: suspend %s failed: %i\n", dev_name(dev), err); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 594 | return 0; |
| 595 | } |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 596 | EXPORT_SYMBOL_GPL(xenbus_dev_suspend); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 597 | |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 598 | int xenbus_dev_resume(struct device *dev) |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 599 | { |
| 600 | int err; |
| 601 | struct xenbus_driver *drv; |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 602 | struct xenbus_device *xdev = container_of(dev, struct xenbus_device, dev); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 603 | |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 604 | DPRINTK("%s", xdev->nodename); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 605 | |
| 606 | if (dev->driver == NULL) |
| 607 | return 0; |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 608 | drv = to_xenbus_driver(dev->driver); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 609 | err = talk_to_otherend(xdev); |
| 610 | if (err) { |
| 611 | printk(KERN_WARNING |
| 612 | "xenbus: resume (talk_to_otherend) %s failed: %i\n", |
Kay Sievers | 2a678cc | 2009-01-06 10:44:34 -0800 | [diff] [blame] | 613 | dev_name(dev), err); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 614 | return err; |
| 615 | } |
| 616 | |
| 617 | xdev->state = XenbusStateInitialising; |
| 618 | |
| 619 | if (drv->resume) { |
| 620 | err = drv->resume(xdev); |
| 621 | if (err) { |
| 622 | printk(KERN_WARNING |
| 623 | "xenbus: resume %s failed: %i\n", |
Kay Sievers | 2a678cc | 2009-01-06 10:44:34 -0800 | [diff] [blame] | 624 | dev_name(dev), err); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 625 | return err; |
| 626 | } |
| 627 | } |
| 628 | |
| 629 | err = watch_otherend(xdev); |
| 630 | if (err) { |
| 631 | printk(KERN_WARNING |
| 632 | "xenbus_probe: resume (watch_otherend) %s failed: " |
Kay Sievers | 2a678cc | 2009-01-06 10:44:34 -0800 | [diff] [blame] | 633 | "%d.\n", dev_name(dev), err); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 634 | return err; |
| 635 | } |
| 636 | |
| 637 | return 0; |
| 638 | } |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 639 | EXPORT_SYMBOL_GPL(xenbus_dev_resume); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 640 | |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 641 | /* A flag to determine if xenstored is 'ready' (i.e. has started) */ |
| 642 | int xenstored_ready = 0; |
| 643 | |
| 644 | |
| 645 | int register_xenstore_notifier(struct notifier_block *nb) |
| 646 | { |
| 647 | int ret = 0; |
| 648 | |
Stefano Stabellini | a947f0f | 2010-10-04 16:10:06 +0100 | [diff] [blame] | 649 | if (xenstored_ready > 0) |
| 650 | ret = nb->notifier_call(nb, 0, NULL); |
| 651 | else |
| 652 | blocking_notifier_chain_register(&xenstore_chain, nb); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 653 | |
| 654 | return ret; |
| 655 | } |
| 656 | EXPORT_SYMBOL_GPL(register_xenstore_notifier); |
| 657 | |
| 658 | void unregister_xenstore_notifier(struct notifier_block *nb) |
| 659 | { |
| 660 | blocking_notifier_chain_unregister(&xenstore_chain, nb); |
| 661 | } |
| 662 | EXPORT_SYMBOL_GPL(unregister_xenstore_notifier); |
| 663 | |
| 664 | void xenbus_probe(struct work_struct *unused) |
| 665 | { |
Stefano Stabellini | a947f0f | 2010-10-04 16:10:06 +0100 | [diff] [blame] | 666 | xenstored_ready = 1; |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 667 | |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 668 | /* Notify others that xenstore is up */ |
| 669 | blocking_notifier_call_chain(&xenstore_chain, 0, NULL); |
| 670 | } |
Stefano Stabellini | 183d03c | 2010-05-17 17:08:21 +0100 | [diff] [blame] | 671 | EXPORT_SYMBOL_GPL(xenbus_probe); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 672 | |
Stefano Stabellini | 183d03c | 2010-05-17 17:08:21 +0100 | [diff] [blame] | 673 | static int __init xenbus_probe_initcall(void) |
| 674 | { |
| 675 | if (!xen_domain()) |
| 676 | return -ENODEV; |
| 677 | |
| 678 | if (xen_initial_domain() || xen_hvm_domain()) |
| 679 | return 0; |
| 680 | |
| 681 | xenbus_probe(NULL); |
| 682 | return 0; |
| 683 | } |
| 684 | |
| 685 | device_initcall(xenbus_probe_initcall); |
| 686 | |
| 687 | static int __init xenbus_init(void) |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 688 | { |
| 689 | int err = 0; |
Juan Quintela | b37a56d | 2010-09-02 14:53:56 +0100 | [diff] [blame] | 690 | unsigned long page = 0; |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 691 | |
| 692 | DPRINTK(""); |
| 693 | |
| 694 | err = -ENODEV; |
Jeremy Fitzhardinge | 6e83358 | 2008-08-19 13:16:17 -0700 | [diff] [blame] | 695 | if (!xen_domain()) |
Jeremy Fitzhardinge | 7432e4b | 2009-10-29 14:19:42 -0700 | [diff] [blame] | 696 | return err; |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 697 | |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 698 | /* |
| 699 | * Domain0 doesn't have a store_evtchn or store_mfn yet. |
| 700 | */ |
Jeremy Fitzhardinge | 6e83358 | 2008-08-19 13:16:17 -0700 | [diff] [blame] | 701 | if (xen_initial_domain()) { |
Juan Quintela | b37a56d | 2010-09-02 14:53:56 +0100 | [diff] [blame] | 702 | struct evtchn_alloc_unbound alloc_unbound; |
| 703 | |
| 704 | /* Allocate Xenstore page */ |
| 705 | page = get_zeroed_page(GFP_KERNEL); |
| 706 | if (!page) |
| 707 | goto out_error; |
| 708 | |
| 709 | xen_store_mfn = xen_start_info->store_mfn = |
| 710 | pfn_to_mfn(virt_to_phys((void *)page) >> |
| 711 | PAGE_SHIFT); |
| 712 | |
| 713 | /* Next allocate a local port which xenstored can bind to */ |
| 714 | alloc_unbound.dom = DOMID_SELF; |
| 715 | alloc_unbound.remote_dom = 0; |
| 716 | |
| 717 | err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound, |
| 718 | &alloc_unbound); |
| 719 | if (err == -ENOSYS) |
| 720 | goto out_error; |
| 721 | |
| 722 | BUG_ON(err); |
| 723 | xen_store_evtchn = xen_start_info->store_evtchn = |
| 724 | alloc_unbound.port; |
| 725 | |
| 726 | xen_store_interface = mfn_to_virt(xen_store_mfn); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 727 | } else { |
Sheng Yang | bee6ab53 | 2010-05-14 12:39:33 +0100 | [diff] [blame] | 728 | if (xen_hvm_domain()) { |
| 729 | uint64_t v = 0; |
| 730 | err = hvm_get_parameter(HVM_PARAM_STORE_EVTCHN, &v); |
| 731 | if (err) |
| 732 | goto out_error; |
| 733 | xen_store_evtchn = (int)v; |
| 734 | err = hvm_get_parameter(HVM_PARAM_STORE_PFN, &v); |
| 735 | if (err) |
| 736 | goto out_error; |
| 737 | xen_store_mfn = (unsigned long)v; |
| 738 | xen_store_interface = ioremap(xen_store_mfn << PAGE_SHIFT, PAGE_SIZE); |
| 739 | } else { |
| 740 | xen_store_evtchn = xen_start_info->store_evtchn; |
| 741 | xen_store_mfn = xen_start_info->store_mfn; |
| 742 | xen_store_interface = mfn_to_virt(xen_store_mfn); |
Stefano Stabellini | a947f0f | 2010-10-04 16:10:06 +0100 | [diff] [blame] | 743 | xenstored_ready = 1; |
Sheng Yang | bee6ab53 | 2010-05-14 12:39:33 +0100 | [diff] [blame] | 744 | } |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 745 | } |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 746 | |
| 747 | /* Initialize the interface to xenstore. */ |
| 748 | err = xs_init(); |
| 749 | if (err) { |
| 750 | printk(KERN_WARNING |
| 751 | "XENBUS: Error initializing xenstore comms: %i\n", err); |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 752 | goto out_error; |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 753 | } |
| 754 | |
Alex Zeffertt | 1107ba8 | 2009-01-07 18:07:11 -0800 | [diff] [blame] | 755 | #ifdef CONFIG_XEN_COMPAT_XENFS |
| 756 | /* |
| 757 | * Create xenfs mountpoint in /proc for compatibility with |
| 758 | * utilities that expect to find "xenbus" under "/proc/xen". |
| 759 | */ |
| 760 | proc_mkdir("xen", NULL); |
| 761 | #endif |
| 762 | |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 763 | return 0; |
| 764 | |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 765 | out_error: |
Juan Quintela | b37a56d | 2010-09-02 14:53:56 +0100 | [diff] [blame] | 766 | if (page != 0) |
| 767 | free_page(page); |
Ian Campbell | 2de06cc | 2009-02-09 12:05:51 -0800 | [diff] [blame] | 768 | |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 769 | return err; |
| 770 | } |
| 771 | |
Stefano Stabellini | 183d03c | 2010-05-17 17:08:21 +0100 | [diff] [blame] | 772 | postcore_initcall(xenbus_init); |
Jeremy Fitzhardinge | 4bac07c | 2007-07-17 18:37:06 -0700 | [diff] [blame] | 773 | |
| 774 | MODULE_LICENSE("GPL"); |