diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-11-10 00:56:21 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-11-10 00:56:21 -0500 |
commit | 0020dd0b8c03c55a15c5bf372082be4a54d84622 (patch) | |
tree | 78f920d0dd8622194bab7ebfd39e904c6eb46207 | |
parent | a1c2d60889d633ffecfa9f1f7ac0bdb474b7484e (diff) | |
parent | ab277bbf662ef17ffb7fd8dd7a462a34e326e492 (diff) |
Merge tag 'stable/for-linus-3.7-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen
Pull Xen fixes from Konrad Rzeszutek Wilk:
"There are three ARM compile fixes (we forgot to export certain
functions and if the drivers are built as an module - we go belly-up).
There is also an mismatch of irq_enter() / exit_idle() calls sequence
which were fixed some time ago in other piece of codes, but failed to
appear in the Xen code.
Lastly a fix for to help in the field with troubleshooting in case we
cannot get the appropriate parameter and also fallback code when
working with very old hypervisors."
Bug-fixes:
- Fix compile issues on ARM.
- Fix hypercall fallback code for old hypervisors.
- Print out which HVM parameter failed if it fails.
- Fix idle notifier call after irq_enter.
* tag 'stable/for-linus-3.7-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
xen/arm: Fix compile errors when drivers are compiled as modules (export more).
xen/arm: Fix compile errors when drivers are compiled as modules.
xen/generic: Disable fallback build on ARM.
xen/events: fix RCU warning, or Call idle notifier after irq_enter()
xen/hvm: If we fail to fetch an HVM parameter print out which flag it is.
xen/hypercall: fix hypercall fallback code for very old hypervisors
-rw-r--r-- | arch/arm/xen/enlighten.c | 11 | ||||
-rw-r--r-- | arch/x86/include/asm/xen/hypercall.h | 21 | ||||
-rw-r--r-- | drivers/xen/Makefile | 1 | ||||
-rw-r--r-- | drivers/xen/events.c | 2 | ||||
-rw-r--r-- | drivers/xen/fallback.c | 80 | ||||
-rw-r--r-- | include/xen/hvm.h | 34 |
6 files changed, 132 insertions, 17 deletions
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c index 59bcb96ac369..f57609275449 100644 --- a/arch/arm/xen/enlighten.c +++ b/arch/arm/xen/enlighten.c | |||
@@ -166,3 +166,14 @@ void free_xenballooned_pages(int nr_pages, struct page **pages) | |||
166 | *pages = NULL; | 166 | *pages = NULL; |
167 | } | 167 | } |
168 | EXPORT_SYMBOL_GPL(free_xenballooned_pages); | 168 | EXPORT_SYMBOL_GPL(free_xenballooned_pages); |
169 | |||
170 | /* In the hypervisor.S file. */ | ||
171 | EXPORT_SYMBOL_GPL(HYPERVISOR_event_channel_op); | ||
172 | EXPORT_SYMBOL_GPL(HYPERVISOR_grant_table_op); | ||
173 | EXPORT_SYMBOL_GPL(HYPERVISOR_xen_version); | ||
174 | EXPORT_SYMBOL_GPL(HYPERVISOR_console_io); | ||
175 | EXPORT_SYMBOL_GPL(HYPERVISOR_sched_op); | ||
176 | EXPORT_SYMBOL_GPL(HYPERVISOR_hvm_op); | ||
177 | EXPORT_SYMBOL_GPL(HYPERVISOR_memory_op); | ||
178 | EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op); | ||
179 | EXPORT_SYMBOL_GPL(privcmd_call); | ||
diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h index 59c226d120cd..c20d1ce62dc6 100644 --- a/arch/x86/include/asm/xen/hypercall.h +++ b/arch/x86/include/asm/xen/hypercall.h | |||
@@ -359,18 +359,14 @@ HYPERVISOR_update_va_mapping(unsigned long va, pte_t new_val, | |||
359 | return _hypercall4(int, update_va_mapping, va, | 359 | return _hypercall4(int, update_va_mapping, va, |
360 | new_val.pte, new_val.pte >> 32, flags); | 360 | new_val.pte, new_val.pte >> 32, flags); |
361 | } | 361 | } |
362 | extern int __must_check xen_event_channel_op_compat(int, void *); | ||
362 | 363 | ||
363 | static inline int | 364 | static inline int |
364 | HYPERVISOR_event_channel_op(int cmd, void *arg) | 365 | HYPERVISOR_event_channel_op(int cmd, void *arg) |
365 | { | 366 | { |
366 | int rc = _hypercall2(int, event_channel_op, cmd, arg); | 367 | int rc = _hypercall2(int, event_channel_op, cmd, arg); |
367 | if (unlikely(rc == -ENOSYS)) { | 368 | if (unlikely(rc == -ENOSYS)) |
368 | struct evtchn_op op; | 369 | rc = xen_event_channel_op_compat(cmd, arg); |
369 | op.cmd = cmd; | ||
370 | memcpy(&op.u, arg, sizeof(op.u)); | ||
371 | rc = _hypercall1(int, event_channel_op_compat, &op); | ||
372 | memcpy(arg, &op.u, sizeof(op.u)); | ||
373 | } | ||
374 | return rc; | 370 | return rc; |
375 | } | 371 | } |
376 | 372 | ||
@@ -386,17 +382,14 @@ HYPERVISOR_console_io(int cmd, int count, char *str) | |||
386 | return _hypercall3(int, console_io, cmd, count, str); | 382 | return _hypercall3(int, console_io, cmd, count, str); |
387 | } | 383 | } |
388 | 384 | ||
385 | extern int __must_check HYPERVISOR_physdev_op_compat(int, void *); | ||
386 | |||
389 | static inline int | 387 | static inline int |
390 | HYPERVISOR_physdev_op(int cmd, void *arg) | 388 | HYPERVISOR_physdev_op(int cmd, void *arg) |
391 | { | 389 | { |
392 | int rc = _hypercall2(int, physdev_op, cmd, arg); | 390 | int rc = _hypercall2(int, physdev_op, cmd, arg); |
393 | if (unlikely(rc == -ENOSYS)) { | 391 | if (unlikely(rc == -ENOSYS)) |
394 | struct physdev_op op; | 392 | rc = HYPERVISOR_physdev_op_compat(cmd, arg); |
395 | op.cmd = cmd; | ||
396 | memcpy(&op.u, arg, sizeof(op.u)); | ||
397 | rc = _hypercall1(int, physdev_op_compat, &op); | ||
398 | memcpy(arg, &op.u, sizeof(op.u)); | ||
399 | } | ||
400 | return rc; | 393 | return rc; |
401 | } | 394 | } |
402 | 395 | ||
diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile index 0e8637035457..74354708c6c4 100644 --- a/drivers/xen/Makefile +++ b/drivers/xen/Makefile | |||
@@ -2,6 +2,7 @@ ifneq ($(CONFIG_ARM),y) | |||
2 | obj-y += manage.o balloon.o | 2 | obj-y += manage.o balloon.o |
3 | obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o | 3 | obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o |
4 | endif | 4 | endif |
5 | obj-$(CONFIG_X86) += fallback.o | ||
5 | obj-y += grant-table.o features.o events.o | 6 | obj-y += grant-table.o features.o events.o |
6 | obj-y += xenbus/ | 7 | obj-y += xenbus/ |
7 | 8 | ||
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 912ac81b6dbf..0be4df39e953 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -1395,10 +1395,10 @@ void xen_evtchn_do_upcall(struct pt_regs *regs) | |||
1395 | { | 1395 | { |
1396 | struct pt_regs *old_regs = set_irq_regs(regs); | 1396 | struct pt_regs *old_regs = set_irq_regs(regs); |
1397 | 1397 | ||
1398 | irq_enter(); | ||
1398 | #ifdef CONFIG_X86 | 1399 | #ifdef CONFIG_X86 |
1399 | exit_idle(); | 1400 | exit_idle(); |
1400 | #endif | 1401 | #endif |
1401 | irq_enter(); | ||
1402 | 1402 | ||
1403 | __xen_evtchn_do_upcall(); | 1403 | __xen_evtchn_do_upcall(); |
1404 | 1404 | ||
diff --git a/drivers/xen/fallback.c b/drivers/xen/fallback.c new file mode 100644 index 000000000000..0ef7c4d40f86 --- /dev/null +++ b/drivers/xen/fallback.c | |||
@@ -0,0 +1,80 @@ | |||
1 | #include <linux/kernel.h> | ||
2 | #include <linux/string.h> | ||
3 | #include <linux/bug.h> | ||
4 | #include <linux/export.h> | ||
5 | #include <asm/hypervisor.h> | ||
6 | #include <asm/xen/hypercall.h> | ||
7 | |||
8 | int xen_event_channel_op_compat(int cmd, void *arg) | ||
9 | { | ||
10 | struct evtchn_op op; | ||
11 | int rc; | ||
12 | |||
13 | op.cmd = cmd; | ||
14 | memcpy(&op.u, arg, sizeof(op.u)); | ||
15 | rc = _hypercall1(int, event_channel_op_compat, &op); | ||
16 | |||
17 | switch (cmd) { | ||
18 | case EVTCHNOP_close: | ||
19 | case EVTCHNOP_send: | ||
20 | case EVTCHNOP_bind_vcpu: | ||
21 | case EVTCHNOP_unmask: | ||
22 | /* no output */ | ||
23 | break; | ||
24 | |||
25 | #define COPY_BACK(eop) \ | ||
26 | case EVTCHNOP_##eop: \ | ||
27 | memcpy(arg, &op.u.eop, sizeof(op.u.eop)); \ | ||
28 | break | ||
29 | |||
30 | COPY_BACK(bind_interdomain); | ||
31 | COPY_BACK(bind_virq); | ||
32 | COPY_BACK(bind_pirq); | ||
33 | COPY_BACK(status); | ||
34 | COPY_BACK(alloc_unbound); | ||
35 | COPY_BACK(bind_ipi); | ||
36 | #undef COPY_BACK | ||
37 | |||
38 | default: | ||
39 | WARN_ON(rc != -ENOSYS); | ||
40 | break; | ||
41 | } | ||
42 | |||
43 | return rc; | ||
44 | } | ||
45 | EXPORT_SYMBOL_GPL(xen_event_channel_op_compat); | ||
46 | |||
47 | int HYPERVISOR_physdev_op_compat(int cmd, void *arg) | ||
48 | { | ||
49 | struct physdev_op op; | ||
50 | int rc; | ||
51 | |||
52 | op.cmd = cmd; | ||
53 | memcpy(&op.u, arg, sizeof(op.u)); | ||
54 | rc = _hypercall1(int, physdev_op_compat, &op); | ||
55 | |||
56 | switch (cmd) { | ||
57 | case PHYSDEVOP_IRQ_UNMASK_NOTIFY: | ||
58 | case PHYSDEVOP_set_iopl: | ||
59 | case PHYSDEVOP_set_iobitmap: | ||
60 | case PHYSDEVOP_apic_write: | ||
61 | /* no output */ | ||
62 | break; | ||
63 | |||
64 | #define COPY_BACK(pop, fld) \ | ||
65 | case PHYSDEVOP_##pop: \ | ||
66 | memcpy(arg, &op.u.fld, sizeof(op.u.fld)); \ | ||
67 | break | ||
68 | |||
69 | COPY_BACK(irq_status_query, irq_status_query); | ||
70 | COPY_BACK(apic_read, apic_op); | ||
71 | COPY_BACK(ASSIGN_VECTOR, irq_op); | ||
72 | #undef COPY_BACK | ||
73 | |||
74 | default: | ||
75 | WARN_ON(rc != -ENOSYS); | ||
76 | break; | ||
77 | } | ||
78 | |||
79 | return rc; | ||
80 | } | ||
diff --git a/include/xen/hvm.h b/include/xen/hvm.h index b193fa2f9fdd..13e43e41637d 100644 --- a/include/xen/hvm.h +++ b/include/xen/hvm.h | |||
@@ -5,6 +5,36 @@ | |||
5 | #include <xen/interface/hvm/params.h> | 5 | #include <xen/interface/hvm/params.h> |
6 | #include <asm/xen/hypercall.h> | 6 | #include <asm/xen/hypercall.h> |
7 | 7 | ||
8 | static const char *param_name(int op) | ||
9 | { | ||
10 | #define PARAM(x) [HVM_PARAM_##x] = #x | ||
11 | static const char *const names[] = { | ||
12 | PARAM(CALLBACK_IRQ), | ||
13 | PARAM(STORE_PFN), | ||
14 | PARAM(STORE_EVTCHN), | ||
15 | PARAM(PAE_ENABLED), | ||
16 | PARAM(IOREQ_PFN), | ||
17 | PARAM(BUFIOREQ_PFN), | ||
18 | PARAM(TIMER_MODE), | ||
19 | PARAM(HPET_ENABLED), | ||
20 | PARAM(IDENT_PT), | ||
21 | PARAM(DM_DOMAIN), | ||
22 | PARAM(ACPI_S_STATE), | ||
23 | PARAM(VM86_TSS), | ||
24 | PARAM(VPT_ALIGN), | ||
25 | PARAM(CONSOLE_PFN), | ||
26 | PARAM(CONSOLE_EVTCHN), | ||
27 | }; | ||
28 | #undef PARAM | ||
29 | |||
30 | if (op >= ARRAY_SIZE(names)) | ||
31 | return "unknown"; | ||
32 | |||
33 | if (!names[op]) | ||
34 | return "reserved"; | ||
35 | |||
36 | return names[op]; | ||
37 | } | ||
8 | static inline int hvm_get_parameter(int idx, uint64_t *value) | 38 | static inline int hvm_get_parameter(int idx, uint64_t *value) |
9 | { | 39 | { |
10 | struct xen_hvm_param xhv; | 40 | struct xen_hvm_param xhv; |
@@ -14,8 +44,8 @@ static inline int hvm_get_parameter(int idx, uint64_t *value) | |||
14 | xhv.index = idx; | 44 | xhv.index = idx; |
15 | r = HYPERVISOR_hvm_op(HVMOP_get_param, &xhv); | 45 | r = HYPERVISOR_hvm_op(HVMOP_get_param, &xhv); |
16 | if (r < 0) { | 46 | if (r < 0) { |
17 | printk(KERN_ERR "Cannot get hvm parameter %d: %d!\n", | 47 | printk(KERN_ERR "Cannot get hvm parameter %s (%d): %d!\n", |
18 | idx, r); | 48 | param_name(idx), idx, r); |
19 | return r; | 49 | return r; |
20 | } | 50 | } |
21 | *value = xhv.value; | 51 | *value = xhv.value; |