aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/xen')
-rw-r--r--drivers/xen/xenbus/xenbus_probe_frontend.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c
index 3159a37d966d..a7e25073de19 100644
--- a/drivers/xen/xenbus/xenbus_probe_frontend.c
+++ b/drivers/xen/xenbus/xenbus_probe_frontend.c
@@ -29,6 +29,8 @@
29#include "xenbus_probe.h" 29#include "xenbus_probe.h"
30 30
31 31
32static struct workqueue_struct *xenbus_frontend_wq;
33
32/* device/<type>/<id> => <type>-<id> */ 34/* device/<type>/<id> => <type>-<id> */
33static int frontend_bus_id(char bus_id[XEN_BUS_ID_SIZE], const char *nodename) 35static int frontend_bus_id(char bus_id[XEN_BUS_ID_SIZE], const char *nodename)
34{ 36{
@@ -89,9 +91,40 @@ static void backend_changed(struct xenbus_watch *watch,
89 xenbus_otherend_changed(watch, vec, len, 1); 91 xenbus_otherend_changed(watch, vec, len, 1);
90} 92}
91 93
94static void xenbus_frontend_delayed_resume(struct work_struct *w)
95{
96 struct xenbus_device *xdev = container_of(w, struct xenbus_device, work);
97
98 xenbus_dev_resume(&xdev->dev);
99}
100
101static int xenbus_frontend_dev_resume(struct device *dev)
102{
103 /*
104 * If xenstored is running in this domain, we cannot access the backend
105 * state at the moment, so we need to defer xenbus_dev_resume
106 */
107 if (xen_store_domain_type == XS_LOCAL) {
108 struct xenbus_device *xdev = to_xenbus_device(dev);
109
110 if (!xenbus_frontend_wq) {
111 pr_err("%s: no workqueue to process delayed resume\n",
112 xdev->nodename);
113 return -EFAULT;
114 }
115
116 INIT_WORK(&xdev->work, xenbus_frontend_delayed_resume);
117 queue_work(xenbus_frontend_wq, &xdev->work);
118
119 return 0;
120 }
121
122 return xenbus_dev_resume(dev);
123}
124
92static const struct dev_pm_ops xenbus_pm_ops = { 125static const struct dev_pm_ops xenbus_pm_ops = {
93 .suspend = xenbus_dev_suspend, 126 .suspend = xenbus_dev_suspend,
94 .resume = xenbus_dev_resume, 127 .resume = xenbus_frontend_dev_resume,
95 .freeze = xenbus_dev_suspend, 128 .freeze = xenbus_dev_suspend,
96 .thaw = xenbus_dev_cancel, 129 .thaw = xenbus_dev_cancel,
97 .restore = xenbus_dev_resume, 130 .restore = xenbus_dev_resume,
@@ -440,6 +473,8 @@ static int __init xenbus_probe_frontend_init(void)
440 473
441 register_xenstore_notifier(&xenstore_notifier); 474 register_xenstore_notifier(&xenstore_notifier);
442 475
476 xenbus_frontend_wq = create_workqueue("xenbus_frontend");
477
443 return 0; 478 return 0;
444} 479}
445subsys_initcall(xenbus_probe_frontend_init); 480subsys_initcall(xenbus_probe_frontend_init);