diff options
-rw-r--r-- | drivers/xen/Kconfig | 10 | ||||
-rw-r--r-- | drivers/xen/Makefile | 1 | ||||
-rw-r--r-- | drivers/xen/manage.c | 9 | ||||
-rw-r--r-- | drivers/xen/sys-hypervisor.c | 445 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_probe.c | 61 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_xs.c | 2 | ||||
-rw-r--r-- | drivers/xen/xenfs/super.c | 19 | ||||
-rw-r--r-- | include/xen/interface/version.h | 3 | ||||
-rw-r--r-- | include/xen/xenbus.h | 3 |
9 files changed, 494 insertions, 59 deletions
diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index 1bbb9108f31e..c0c490ea7d1b 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig | |||
@@ -51,3 +51,13 @@ config XEN_COMPAT_XENFS | |||
51 | a xen platform. | 51 | a xen platform. |
52 | If in doubt, say yes. | 52 | If in doubt, say yes. |
53 | 53 | ||
54 | config XEN_SYS_HYPERVISOR | ||
55 | bool "Create xen entries under /sys/hypervisor" | ||
56 | depends on XEN && SYSFS | ||
57 | select SYS_HYPERVISOR | ||
58 | default y | ||
59 | help | ||
60 | Create entries under /sys/hypervisor describing the Xen | ||
61 | hypervisor environment. When running native or in another | ||
62 | virtual environment, /sys/hypervisor will still be present, | ||
63 | but will have no xen contents. \ No newline at end of file | ||
diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile index 1567639847e7..ec2a39b1e26f 100644 --- a/drivers/xen/Makefile +++ b/drivers/xen/Makefile | |||
@@ -6,3 +6,4 @@ obj-$(CONFIG_XEN_XENCOMM) += xencomm.o | |||
6 | obj-$(CONFIG_XEN_BALLOON) += balloon.o | 6 | obj-$(CONFIG_XEN_BALLOON) += balloon.o |
7 | obj-$(CONFIG_XEN_DEV_EVTCHN) += evtchn.o | 7 | obj-$(CONFIG_XEN_DEV_EVTCHN) += evtchn.o |
8 | obj-$(CONFIG_XENFS) += xenfs/ | 8 | obj-$(CONFIG_XENFS) += xenfs/ |
9 | obj-$(CONFIG_XEN_SYS_HYPERVISOR) += sys-hypervisor.o \ No newline at end of file | ||
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index b703dd2c9f11..5269bb4d2496 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
@@ -104,9 +104,8 @@ static void do_suspend(void) | |||
104 | goto out; | 104 | goto out; |
105 | } | 105 | } |
106 | 106 | ||
107 | printk("suspending xenbus...\n"); | 107 | printk(KERN_DEBUG "suspending xenstore...\n"); |
108 | /* XXX use normal device tree? */ | 108 | xs_suspend(); |
109 | xenbus_suspend(); | ||
110 | 109 | ||
111 | err = stop_machine(xen_suspend, &cancelled, cpumask_of(0)); | 110 | err = stop_machine(xen_suspend, &cancelled, cpumask_of(0)); |
112 | if (err) { | 111 | if (err) { |
@@ -116,9 +115,9 @@ static void do_suspend(void) | |||
116 | 115 | ||
117 | if (!cancelled) { | 116 | if (!cancelled) { |
118 | xen_arch_resume(); | 117 | xen_arch_resume(); |
119 | xenbus_resume(); | 118 | xs_resume(); |
120 | } else | 119 | } else |
121 | xenbus_suspend_cancel(); | 120 | xs_suspend_cancel(); |
122 | 121 | ||
123 | device_resume(PMSG_RESUME); | 122 | device_resume(PMSG_RESUME); |
124 | 123 | ||
diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c new file mode 100644 index 000000000000..88a60e03ccf0 --- /dev/null +++ b/drivers/xen/sys-hypervisor.c | |||
@@ -0,0 +1,445 @@ | |||
1 | /* | ||
2 | * copyright (c) 2006 IBM Corporation | ||
3 | * Authored by: Mike D. Day <ncmike@us.ibm.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | */ | ||
9 | |||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/module.h> | ||
12 | #include <linux/kobject.h> | ||
13 | |||
14 | #include <asm/xen/hypervisor.h> | ||
15 | #include <asm/xen/hypercall.h> | ||
16 | |||
17 | #include <xen/xenbus.h> | ||
18 | #include <xen/interface/xen.h> | ||
19 | #include <xen/interface/version.h> | ||
20 | |||
21 | #define HYPERVISOR_ATTR_RO(_name) \ | ||
22 | static struct hyp_sysfs_attr _name##_attr = __ATTR_RO(_name) | ||
23 | |||
24 | #define HYPERVISOR_ATTR_RW(_name) \ | ||
25 | static struct hyp_sysfs_attr _name##_attr = \ | ||
26 | __ATTR(_name, 0644, _name##_show, _name##_store) | ||
27 | |||
28 | struct hyp_sysfs_attr { | ||
29 | struct attribute attr; | ||
30 | ssize_t (*show)(struct hyp_sysfs_attr *, char *); | ||
31 | ssize_t (*store)(struct hyp_sysfs_attr *, const char *, size_t); | ||
32 | void *hyp_attr_data; | ||
33 | }; | ||
34 | |||
35 | static ssize_t type_show(struct hyp_sysfs_attr *attr, char *buffer) | ||
36 | { | ||
37 | return sprintf(buffer, "xen\n"); | ||
38 | } | ||
39 | |||
40 | HYPERVISOR_ATTR_RO(type); | ||
41 | |||
42 | static int __init xen_sysfs_type_init(void) | ||
43 | { | ||
44 | return sysfs_create_file(hypervisor_kobj, &type_attr.attr); | ||
45 | } | ||
46 | |||
47 | static void xen_sysfs_type_destroy(void) | ||
48 | { | ||
49 | sysfs_remove_file(hypervisor_kobj, &type_attr.attr); | ||
50 | } | ||
51 | |||
52 | /* xen version attributes */ | ||
53 | static ssize_t major_show(struct hyp_sysfs_attr *attr, char *buffer) | ||
54 | { | ||
55 | int version = HYPERVISOR_xen_version(XENVER_version, NULL); | ||
56 | if (version) | ||
57 | return sprintf(buffer, "%d\n", version >> 16); | ||
58 | return -ENODEV; | ||
59 | } | ||
60 | |||
61 | HYPERVISOR_ATTR_RO(major); | ||
62 | |||
63 | static ssize_t minor_show(struct hyp_sysfs_attr *attr, char *buffer) | ||
64 | { | ||
65 | int version = HYPERVISOR_xen_version(XENVER_version, NULL); | ||
66 | if (version) | ||
67 | return sprintf(buffer, "%d\n", version & 0xff); | ||
68 | return -ENODEV; | ||
69 | } | ||
70 | |||
71 | HYPERVISOR_ATTR_RO(minor); | ||
72 | |||
73 | static ssize_t extra_show(struct hyp_sysfs_attr *attr, char *buffer) | ||
74 | { | ||
75 | int ret = -ENOMEM; | ||
76 | char *extra; | ||
77 | |||
78 | extra = kmalloc(XEN_EXTRAVERSION_LEN, GFP_KERNEL); | ||
79 | if (extra) { | ||
80 | ret = HYPERVISOR_xen_version(XENVER_extraversion, extra); | ||
81 | if (!ret) | ||
82 | ret = sprintf(buffer, "%s\n", extra); | ||
83 | kfree(extra); | ||
84 | } | ||
85 | |||
86 | return ret; | ||
87 | } | ||
88 | |||
89 | HYPERVISOR_ATTR_RO(extra); | ||
90 | |||
91 | static struct attribute *version_attrs[] = { | ||
92 | &major_attr.attr, | ||
93 | &minor_attr.attr, | ||
94 | &extra_attr.attr, | ||
95 | NULL | ||
96 | }; | ||
97 | |||
98 | static struct attribute_group version_group = { | ||
99 | .name = "version", | ||
100 | .attrs = version_attrs, | ||
101 | }; | ||
102 | |||
103 | static int __init xen_sysfs_version_init(void) | ||
104 | { | ||
105 | return sysfs_create_group(hypervisor_kobj, &version_group); | ||
106 | } | ||
107 | |||
108 | static void xen_sysfs_version_destroy(void) | ||
109 | { | ||
110 | sysfs_remove_group(hypervisor_kobj, &version_group); | ||
111 | } | ||
112 | |||
113 | /* UUID */ | ||
114 | |||
115 | static ssize_t uuid_show(struct hyp_sysfs_attr *attr, char *buffer) | ||
116 | { | ||
117 | char *vm, *val; | ||
118 | int ret; | ||
119 | extern int xenstored_ready; | ||
120 | |||
121 | if (!xenstored_ready) | ||
122 | return -EBUSY; | ||
123 | |||
124 | vm = xenbus_read(XBT_NIL, "vm", "", NULL); | ||
125 | if (IS_ERR(vm)) | ||
126 | return PTR_ERR(vm); | ||
127 | val = xenbus_read(XBT_NIL, vm, "uuid", NULL); | ||
128 | kfree(vm); | ||
129 | if (IS_ERR(val)) | ||
130 | return PTR_ERR(val); | ||
131 | ret = sprintf(buffer, "%s\n", val); | ||
132 | kfree(val); | ||
133 | return ret; | ||
134 | } | ||
135 | |||
136 | HYPERVISOR_ATTR_RO(uuid); | ||
137 | |||
138 | static int __init xen_sysfs_uuid_init(void) | ||
139 | { | ||
140 | return sysfs_create_file(hypervisor_kobj, &uuid_attr.attr); | ||
141 | } | ||
142 | |||
143 | static void xen_sysfs_uuid_destroy(void) | ||
144 | { | ||
145 | sysfs_remove_file(hypervisor_kobj, &uuid_attr.attr); | ||
146 | } | ||
147 | |||
148 | /* xen compilation attributes */ | ||
149 | |||
150 | static ssize_t compiler_show(struct hyp_sysfs_attr *attr, char *buffer) | ||
151 | { | ||
152 | int ret = -ENOMEM; | ||
153 | struct xen_compile_info *info; | ||
154 | |||
155 | info = kmalloc(sizeof(struct xen_compile_info), GFP_KERNEL); | ||
156 | if (info) { | ||
157 | ret = HYPERVISOR_xen_version(XENVER_compile_info, info); | ||
158 | if (!ret) | ||
159 | ret = sprintf(buffer, "%s\n", info->compiler); | ||
160 | kfree(info); | ||
161 | } | ||
162 | |||
163 | return ret; | ||
164 | } | ||
165 | |||
166 | HYPERVISOR_ATTR_RO(compiler); | ||
167 | |||
168 | static ssize_t compiled_by_show(struct hyp_sysfs_attr *attr, char *buffer) | ||
169 | { | ||
170 | int ret = -ENOMEM; | ||
171 | struct xen_compile_info *info; | ||
172 | |||
173 | info = kmalloc(sizeof(struct xen_compile_info), GFP_KERNEL); | ||
174 | if (info) { | ||
175 | ret = HYPERVISOR_xen_version(XENVER_compile_info, info); | ||
176 | if (!ret) | ||
177 | ret = sprintf(buffer, "%s\n", info->compile_by); | ||
178 | kfree(info); | ||
179 | } | ||
180 | |||
181 | return ret; | ||
182 | } | ||
183 | |||
184 | HYPERVISOR_ATTR_RO(compiled_by); | ||
185 | |||
186 | static ssize_t compile_date_show(struct hyp_sysfs_attr *attr, char *buffer) | ||
187 | { | ||
188 | int ret = -ENOMEM; | ||
189 | struct xen_compile_info *info; | ||
190 | |||
191 | info = kmalloc(sizeof(struct xen_compile_info), GFP_KERNEL); | ||
192 | if (info) { | ||
193 | ret = HYPERVISOR_xen_version(XENVER_compile_info, info); | ||
194 | if (!ret) | ||
195 | ret = sprintf(buffer, "%s\n", info->compile_date); | ||
196 | kfree(info); | ||
197 | } | ||
198 | |||
199 | return ret; | ||
200 | } | ||
201 | |||
202 | HYPERVISOR_ATTR_RO(compile_date); | ||
203 | |||
204 | static struct attribute *xen_compile_attrs[] = { | ||
205 | &compiler_attr.attr, | ||
206 | &compiled_by_attr.attr, | ||
207 | &compile_date_attr.attr, | ||
208 | NULL | ||
209 | }; | ||
210 | |||
211 | static struct attribute_group xen_compilation_group = { | ||
212 | .name = "compilation", | ||
213 | .attrs = xen_compile_attrs, | ||
214 | }; | ||
215 | |||
216 | int __init static xen_compilation_init(void) | ||
217 | { | ||
218 | return sysfs_create_group(hypervisor_kobj, &xen_compilation_group); | ||
219 | } | ||
220 | |||
221 | static void xen_compilation_destroy(void) | ||
222 | { | ||
223 | sysfs_remove_group(hypervisor_kobj, &xen_compilation_group); | ||
224 | } | ||
225 | |||
226 | /* xen properties info */ | ||
227 | |||
228 | static ssize_t capabilities_show(struct hyp_sysfs_attr *attr, char *buffer) | ||
229 | { | ||
230 | int ret = -ENOMEM; | ||
231 | char *caps; | ||
232 | |||
233 | caps = kmalloc(XEN_CAPABILITIES_INFO_LEN, GFP_KERNEL); | ||
234 | if (caps) { | ||
235 | ret = HYPERVISOR_xen_version(XENVER_capabilities, caps); | ||
236 | if (!ret) | ||
237 | ret = sprintf(buffer, "%s\n", caps); | ||
238 | kfree(caps); | ||
239 | } | ||
240 | |||
241 | return ret; | ||
242 | } | ||
243 | |||
244 | HYPERVISOR_ATTR_RO(capabilities); | ||
245 | |||
246 | static ssize_t changeset_show(struct hyp_sysfs_attr *attr, char *buffer) | ||
247 | { | ||
248 | int ret = -ENOMEM; | ||
249 | char *cset; | ||
250 | |||
251 | cset = kmalloc(XEN_CHANGESET_INFO_LEN, GFP_KERNEL); | ||
252 | if (cset) { | ||
253 | ret = HYPERVISOR_xen_version(XENVER_changeset, cset); | ||
254 | if (!ret) | ||
255 | ret = sprintf(buffer, "%s\n", cset); | ||
256 | kfree(cset); | ||
257 | } | ||
258 | |||
259 | return ret; | ||
260 | } | ||
261 | |||
262 | HYPERVISOR_ATTR_RO(changeset); | ||
263 | |||
264 | static ssize_t virtual_start_show(struct hyp_sysfs_attr *attr, char *buffer) | ||
265 | { | ||
266 | int ret = -ENOMEM; | ||
267 | struct xen_platform_parameters *parms; | ||
268 | |||
269 | parms = kmalloc(sizeof(struct xen_platform_parameters), GFP_KERNEL); | ||
270 | if (parms) { | ||
271 | ret = HYPERVISOR_xen_version(XENVER_platform_parameters, | ||
272 | parms); | ||
273 | if (!ret) | ||
274 | ret = sprintf(buffer, "%lx\n", parms->virt_start); | ||
275 | kfree(parms); | ||
276 | } | ||
277 | |||
278 | return ret; | ||
279 | } | ||
280 | |||
281 | HYPERVISOR_ATTR_RO(virtual_start); | ||
282 | |||
283 | static ssize_t pagesize_show(struct hyp_sysfs_attr *attr, char *buffer) | ||
284 | { | ||
285 | int ret; | ||
286 | |||
287 | ret = HYPERVISOR_xen_version(XENVER_pagesize, NULL); | ||
288 | if (ret > 0) | ||
289 | ret = sprintf(buffer, "%x\n", ret); | ||
290 | |||
291 | return ret; | ||
292 | } | ||
293 | |||
294 | HYPERVISOR_ATTR_RO(pagesize); | ||
295 | |||
296 | static ssize_t xen_feature_show(int index, char *buffer) | ||
297 | { | ||
298 | ssize_t ret; | ||
299 | struct xen_feature_info info; | ||
300 | |||
301 | info.submap_idx = index; | ||
302 | ret = HYPERVISOR_xen_version(XENVER_get_features, &info); | ||
303 | if (!ret) | ||
304 | ret = sprintf(buffer, "%08x", info.submap); | ||
305 | |||
306 | return ret; | ||
307 | } | ||
308 | |||
309 | static ssize_t features_show(struct hyp_sysfs_attr *attr, char *buffer) | ||
310 | { | ||
311 | ssize_t len; | ||
312 | int i; | ||
313 | |||
314 | len = 0; | ||
315 | for (i = XENFEAT_NR_SUBMAPS-1; i >= 0; i--) { | ||
316 | int ret = xen_feature_show(i, buffer + len); | ||
317 | if (ret < 0) { | ||
318 | if (len == 0) | ||
319 | len = ret; | ||
320 | break; | ||
321 | } | ||
322 | len += ret; | ||
323 | } | ||
324 | if (len > 0) | ||
325 | buffer[len++] = '\n'; | ||
326 | |||
327 | return len; | ||
328 | } | ||
329 | |||
330 | HYPERVISOR_ATTR_RO(features); | ||
331 | |||
332 | static struct attribute *xen_properties_attrs[] = { | ||
333 | &capabilities_attr.attr, | ||
334 | &changeset_attr.attr, | ||
335 | &virtual_start_attr.attr, | ||
336 | &pagesize_attr.attr, | ||
337 | &features_attr.attr, | ||
338 | NULL | ||
339 | }; | ||
340 | |||
341 | static struct attribute_group xen_properties_group = { | ||
342 | .name = "properties", | ||
343 | .attrs = xen_properties_attrs, | ||
344 | }; | ||
345 | |||
346 | static int __init xen_properties_init(void) | ||
347 | { | ||
348 | return sysfs_create_group(hypervisor_kobj, &xen_properties_group); | ||
349 | } | ||
350 | |||
351 | static void xen_properties_destroy(void) | ||
352 | { | ||
353 | sysfs_remove_group(hypervisor_kobj, &xen_properties_group); | ||
354 | } | ||
355 | |||
356 | static int __init hyper_sysfs_init(void) | ||
357 | { | ||
358 | int ret; | ||
359 | |||
360 | if (!xen_domain()) | ||
361 | return -ENODEV; | ||
362 | |||
363 | ret = xen_sysfs_type_init(); | ||
364 | if (ret) | ||
365 | goto out; | ||
366 | ret = xen_sysfs_version_init(); | ||
367 | if (ret) | ||
368 | goto version_out; | ||
369 | ret = xen_compilation_init(); | ||
370 | if (ret) | ||
371 | goto comp_out; | ||
372 | ret = xen_sysfs_uuid_init(); | ||
373 | if (ret) | ||
374 | goto uuid_out; | ||
375 | ret = xen_properties_init(); | ||
376 | if (ret) | ||
377 | goto prop_out; | ||
378 | |||
379 | goto out; | ||
380 | |||
381 | prop_out: | ||
382 | xen_sysfs_uuid_destroy(); | ||
383 | uuid_out: | ||
384 | xen_compilation_destroy(); | ||
385 | comp_out: | ||
386 | xen_sysfs_version_destroy(); | ||
387 | version_out: | ||
388 | xen_sysfs_type_destroy(); | ||
389 | out: | ||
390 | return ret; | ||
391 | } | ||
392 | |||
393 | static void __exit hyper_sysfs_exit(void) | ||
394 | { | ||
395 | xen_properties_destroy(); | ||
396 | xen_compilation_destroy(); | ||
397 | xen_sysfs_uuid_destroy(); | ||
398 | xen_sysfs_version_destroy(); | ||
399 | xen_sysfs_type_destroy(); | ||
400 | |||
401 | } | ||
402 | module_init(hyper_sysfs_init); | ||
403 | module_exit(hyper_sysfs_exit); | ||
404 | |||
405 | static ssize_t hyp_sysfs_show(struct kobject *kobj, | ||
406 | struct attribute *attr, | ||
407 | char *buffer) | ||
408 | { | ||
409 | struct hyp_sysfs_attr *hyp_attr; | ||
410 | hyp_attr = container_of(attr, struct hyp_sysfs_attr, attr); | ||
411 | if (hyp_attr->show) | ||
412 | return hyp_attr->show(hyp_attr, buffer); | ||
413 | return 0; | ||
414 | } | ||
415 | |||
416 | static ssize_t hyp_sysfs_store(struct kobject *kobj, | ||
417 | struct attribute *attr, | ||
418 | const char *buffer, | ||
419 | size_t len) | ||
420 | { | ||
421 | struct hyp_sysfs_attr *hyp_attr; | ||
422 | hyp_attr = container_of(attr, struct hyp_sysfs_attr, attr); | ||
423 | if (hyp_attr->store) | ||
424 | return hyp_attr->store(hyp_attr, buffer, len); | ||
425 | return 0; | ||
426 | } | ||
427 | |||
428 | static struct sysfs_ops hyp_sysfs_ops = { | ||
429 | .show = hyp_sysfs_show, | ||
430 | .store = hyp_sysfs_store, | ||
431 | }; | ||
432 | |||
433 | static struct kobj_type hyp_sysfs_kobj_type = { | ||
434 | .sysfs_ops = &hyp_sysfs_ops, | ||
435 | }; | ||
436 | |||
437 | static int __init hypervisor_subsys_init(void) | ||
438 | { | ||
439 | if (!xen_domain()) | ||
440 | return -ENODEV; | ||
441 | |||
442 | hypervisor_kobj->ktype = &hyp_sysfs_kobj_type; | ||
443 | return 0; | ||
444 | } | ||
445 | device_initcall(hypervisor_subsys_init); | ||
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c index 773d1cf23283..d42e25d5968d 100644 --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c | |||
@@ -71,6 +71,9 @@ static int xenbus_probe_frontend(const char *type, const char *name); | |||
71 | 71 | ||
72 | static void xenbus_dev_shutdown(struct device *_dev); | 72 | static void xenbus_dev_shutdown(struct device *_dev); |
73 | 73 | ||
74 | static int xenbus_dev_suspend(struct device *dev, pm_message_t state); | ||
75 | static int xenbus_dev_resume(struct device *dev); | ||
76 | |||
74 | /* If something in array of ids matches this device, return it. */ | 77 | /* If something in array of ids matches this device, return it. */ |
75 | static const struct xenbus_device_id * | 78 | static const struct xenbus_device_id * |
76 | match_device(const struct xenbus_device_id *arr, struct xenbus_device *dev) | 79 | match_device(const struct xenbus_device_id *arr, struct xenbus_device *dev) |
@@ -188,6 +191,9 @@ static struct xen_bus_type xenbus_frontend = { | |||
188 | .remove = xenbus_dev_remove, | 191 | .remove = xenbus_dev_remove, |
189 | .shutdown = xenbus_dev_shutdown, | 192 | .shutdown = xenbus_dev_shutdown, |
190 | .dev_attrs = xenbus_dev_attrs, | 193 | .dev_attrs = xenbus_dev_attrs, |
194 | |||
195 | .suspend = xenbus_dev_suspend, | ||
196 | .resume = xenbus_dev_resume, | ||
191 | }, | 197 | }, |
192 | }; | 198 | }; |
193 | 199 | ||
@@ -654,6 +660,7 @@ void xenbus_dev_changed(const char *node, struct xen_bus_type *bus) | |||
654 | 660 | ||
655 | kfree(root); | 661 | kfree(root); |
656 | } | 662 | } |
663 | EXPORT_SYMBOL_GPL(xenbus_dev_changed); | ||
657 | 664 | ||
658 | static void frontend_changed(struct xenbus_watch *watch, | 665 | static void frontend_changed(struct xenbus_watch *watch, |
659 | const char **vec, unsigned int len) | 666 | const char **vec, unsigned int len) |
@@ -669,7 +676,7 @@ static struct xenbus_watch fe_watch = { | |||
669 | .callback = frontend_changed, | 676 | .callback = frontend_changed, |
670 | }; | 677 | }; |
671 | 678 | ||
672 | static int suspend_dev(struct device *dev, void *data) | 679 | static int xenbus_dev_suspend(struct device *dev, pm_message_t state) |
673 | { | 680 | { |
674 | int err = 0; | 681 | int err = 0; |
675 | struct xenbus_driver *drv; | 682 | struct xenbus_driver *drv; |
@@ -682,35 +689,14 @@ static int suspend_dev(struct device *dev, void *data) | |||
682 | drv = to_xenbus_driver(dev->driver); | 689 | drv = to_xenbus_driver(dev->driver); |
683 | xdev = container_of(dev, struct xenbus_device, dev); | 690 | xdev = container_of(dev, struct xenbus_device, dev); |
684 | if (drv->suspend) | 691 | if (drv->suspend) |
685 | err = drv->suspend(xdev); | 692 | err = drv->suspend(xdev, state); |
686 | if (err) | 693 | if (err) |
687 | printk(KERN_WARNING | 694 | printk(KERN_WARNING |
688 | "xenbus: suspend %s failed: %i\n", dev_name(dev), err); | 695 | "xenbus: suspend %s failed: %i\n", dev_name(dev), err); |
689 | return 0; | 696 | return 0; |
690 | } | 697 | } |
691 | 698 | ||
692 | static int suspend_cancel_dev(struct device *dev, void *data) | 699 | static int xenbus_dev_resume(struct device *dev) |
693 | { | ||
694 | int err = 0; | ||
695 | struct xenbus_driver *drv; | ||
696 | struct xenbus_device *xdev; | ||
697 | |||
698 | DPRINTK(""); | ||
699 | |||
700 | if (dev->driver == NULL) | ||
701 | return 0; | ||
702 | drv = to_xenbus_driver(dev->driver); | ||
703 | xdev = container_of(dev, struct xenbus_device, dev); | ||
704 | if (drv->suspend_cancel) | ||
705 | err = drv->suspend_cancel(xdev); | ||
706 | if (err) | ||
707 | printk(KERN_WARNING | ||
708 | "xenbus: suspend_cancel %s failed: %i\n", | ||
709 | dev_name(dev), err); | ||
710 | return 0; | ||
711 | } | ||
712 | |||
713 | static int resume_dev(struct device *dev, void *data) | ||
714 | { | 700 | { |
715 | int err; | 701 | int err; |
716 | struct xenbus_driver *drv; | 702 | struct xenbus_driver *drv; |
@@ -755,33 +741,6 @@ static int resume_dev(struct device *dev, void *data) | |||
755 | return 0; | 741 | return 0; |
756 | } | 742 | } |
757 | 743 | ||
758 | void xenbus_suspend(void) | ||
759 | { | ||
760 | DPRINTK(""); | ||
761 | |||
762 | bus_for_each_dev(&xenbus_frontend.bus, NULL, NULL, suspend_dev); | ||
763 | xenbus_backend_suspend(suspend_dev); | ||
764 | xs_suspend(); | ||
765 | } | ||
766 | EXPORT_SYMBOL_GPL(xenbus_suspend); | ||
767 | |||
768 | void xenbus_resume(void) | ||
769 | { | ||
770 | xb_init_comms(); | ||
771 | xs_resume(); | ||
772 | bus_for_each_dev(&xenbus_frontend.bus, NULL, NULL, resume_dev); | ||
773 | xenbus_backend_resume(resume_dev); | ||
774 | } | ||
775 | EXPORT_SYMBOL_GPL(xenbus_resume); | ||
776 | |||
777 | void xenbus_suspend_cancel(void) | ||
778 | { | ||
779 | xs_suspend_cancel(); | ||
780 | bus_for_each_dev(&xenbus_frontend.bus, NULL, NULL, suspend_cancel_dev); | ||
781 | xenbus_backend_resume(suspend_cancel_dev); | ||
782 | } | ||
783 | EXPORT_SYMBOL_GPL(xenbus_suspend_cancel); | ||
784 | |||
785 | /* A flag to determine if xenstored is 'ready' (i.e. has started) */ | 744 | /* A flag to determine if xenstored is 'ready' (i.e. has started) */ |
786 | int xenstored_ready = 0; | 745 | int xenstored_ready = 0; |
787 | 746 | ||
diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c index e325eab4724d..eab33f1dbdf7 100644 --- a/drivers/xen/xenbus/xenbus_xs.c +++ b/drivers/xen/xenbus/xenbus_xs.c | |||
@@ -673,6 +673,8 @@ void xs_resume(void) | |||
673 | struct xenbus_watch *watch; | 673 | struct xenbus_watch *watch; |
674 | char token[sizeof(watch) * 2 + 1]; | 674 | char token[sizeof(watch) * 2 + 1]; |
675 | 675 | ||
676 | xb_init_comms(); | ||
677 | |||
676 | mutex_unlock(&xs_state.response_mutex); | 678 | mutex_unlock(&xs_state.response_mutex); |
677 | mutex_unlock(&xs_state.request_mutex); | 679 | mutex_unlock(&xs_state.request_mutex); |
678 | up_write(&xs_state.transaction_mutex); | 680 | up_write(&xs_state.transaction_mutex); |
diff --git a/drivers/xen/xenfs/super.c b/drivers/xen/xenfs/super.c index 515741a8e6b8..6559e0c752ce 100644 --- a/drivers/xen/xenfs/super.c +++ b/drivers/xen/xenfs/super.c | |||
@@ -20,10 +20,27 @@ | |||
20 | MODULE_DESCRIPTION("Xen filesystem"); | 20 | MODULE_DESCRIPTION("Xen filesystem"); |
21 | MODULE_LICENSE("GPL"); | 21 | MODULE_LICENSE("GPL"); |
22 | 22 | ||
23 | static ssize_t capabilities_read(struct file *file, char __user *buf, | ||
24 | size_t size, loff_t *off) | ||
25 | { | ||
26 | char *tmp = ""; | ||
27 | |||
28 | if (xen_initial_domain()) | ||
29 | tmp = "control_d\n"; | ||
30 | |||
31 | return simple_read_from_buffer(buf, size, off, tmp, strlen(tmp)); | ||
32 | } | ||
33 | |||
34 | static const struct file_operations capabilities_file_ops = { | ||
35 | .read = capabilities_read, | ||
36 | }; | ||
37 | |||
23 | static int xenfs_fill_super(struct super_block *sb, void *data, int silent) | 38 | static int xenfs_fill_super(struct super_block *sb, void *data, int silent) |
24 | { | 39 | { |
25 | static struct tree_descr xenfs_files[] = { | 40 | static struct tree_descr xenfs_files[] = { |
26 | [2] = {"xenbus", &xenbus_file_ops, S_IRUSR|S_IWUSR}, | 41 | [1] = {}, |
42 | { "xenbus", &xenbus_file_ops, S_IRUSR|S_IWUSR }, | ||
43 | { "capabilities", &capabilities_file_ops, S_IRUGO }, | ||
27 | {""}, | 44 | {""}, |
28 | }; | 45 | }; |
29 | 46 | ||
diff --git a/include/xen/interface/version.h b/include/xen/interface/version.h index 453235e923f0..e8b6519d47e9 100644 --- a/include/xen/interface/version.h +++ b/include/xen/interface/version.h | |||
@@ -57,4 +57,7 @@ struct xen_feature_info { | |||
57 | /* Declares the features reported by XENVER_get_features. */ | 57 | /* Declares the features reported by XENVER_get_features. */ |
58 | #include "features.h" | 58 | #include "features.h" |
59 | 59 | ||
60 | /* arg == NULL; returns host memory page size. */ | ||
61 | #define XENVER_pagesize 7 | ||
62 | |||
60 | #endif /* __XEN_PUBLIC_VERSION_H__ */ | 63 | #endif /* __XEN_PUBLIC_VERSION_H__ */ |
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h index f87f9614844d..b9763badbd77 100644 --- a/include/xen/xenbus.h +++ b/include/xen/xenbus.h | |||
@@ -91,8 +91,7 @@ struct xenbus_driver { | |||
91 | void (*otherend_changed)(struct xenbus_device *dev, | 91 | void (*otherend_changed)(struct xenbus_device *dev, |
92 | enum xenbus_state backend_state); | 92 | enum xenbus_state backend_state); |
93 | int (*remove)(struct xenbus_device *dev); | 93 | int (*remove)(struct xenbus_device *dev); |
94 | int (*suspend)(struct xenbus_device *dev); | 94 | int (*suspend)(struct xenbus_device *dev, pm_message_t state); |
95 | int (*suspend_cancel)(struct xenbus_device *dev); | ||
96 | int (*resume)(struct xenbus_device *dev); | 95 | int (*resume)(struct xenbus_device *dev); |
97 | int (*uevent)(struct xenbus_device *, char **, int, char *, int); | 96 | int (*uevent)(struct xenbus_device *, char **, int, char *, int); |
98 | struct device_driver driver; | 97 | struct device_driver driver; |