diff options
Diffstat (limited to 'drivers/xen')
-rw-r--r-- | drivers/xen/Kconfig | 2 | ||||
-rw-r--r-- | drivers/xen/Makefile | 1 | ||||
-rw-r--r-- | drivers/xen/balloon.c | 3 | ||||
-rw-r--r-- | drivers/xen/dbgp.c | 2 | ||||
-rw-r--r-- | drivers/xen/events.c | 6 | ||||
-rw-r--r-- | drivers/xen/fallback.c | 80 | ||||
-rw-r--r-- | drivers/xen/gntdev.c | 36 | ||||
-rw-r--r-- | drivers/xen/grant-table.c | 8 | ||||
-rw-r--r-- | drivers/xen/privcmd.c | 18 | ||||
-rw-r--r-- | drivers/xen/sys-hypervisor.c | 4 | ||||
-rw-r--r-- | drivers/xen/xen-pciback/vpci.c | 14 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_dev_frontend.c | 2 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_xs.c | 4 |
13 files changed, 142 insertions, 38 deletions
diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index d4dffcd52873..126d8ce591ce 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig | |||
@@ -3,6 +3,7 @@ menu "Xen driver support" | |||
3 | 3 | ||
4 | config XEN_BALLOON | 4 | config XEN_BALLOON |
5 | bool "Xen memory balloon driver" | 5 | bool "Xen memory balloon driver" |
6 | depends on !ARM | ||
6 | default y | 7 | default y |
7 | help | 8 | help |
8 | The balloon driver allows the Xen domain to request more memory from | 9 | The balloon driver allows the Xen domain to request more memory from |
@@ -145,6 +146,7 @@ config SWIOTLB_XEN | |||
145 | 146 | ||
146 | config XEN_TMEM | 147 | config XEN_TMEM |
147 | bool | 148 | bool |
149 | depends on !ARM | ||
148 | default y if (CLEANCACHE || FRONTSWAP) | 150 | default y if (CLEANCACHE || FRONTSWAP) |
149 | help | 151 | help |
150 | Shim to interface in-kernel Transcendent Memory hooks | 152 | Shim to interface in-kernel Transcendent Memory hooks |
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/balloon.c b/drivers/xen/balloon.c index 31ab82fda38a..d6886d90ccfd 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
@@ -55,7 +55,6 @@ | |||
55 | #include <asm/pgalloc.h> | 55 | #include <asm/pgalloc.h> |
56 | #include <asm/pgtable.h> | 56 | #include <asm/pgtable.h> |
57 | #include <asm/tlb.h> | 57 | #include <asm/tlb.h> |
58 | #include <asm/e820.h> | ||
59 | 58 | ||
60 | #include <asm/xen/hypervisor.h> | 59 | #include <asm/xen/hypervisor.h> |
61 | #include <asm/xen/hypercall.h> | 60 | #include <asm/xen/hypercall.h> |
@@ -88,7 +87,7 @@ struct balloon_stats balloon_stats; | |||
88 | EXPORT_SYMBOL_GPL(balloon_stats); | 87 | EXPORT_SYMBOL_GPL(balloon_stats); |
89 | 88 | ||
90 | /* We increase/decrease in batches which fit in a page */ | 89 | /* We increase/decrease in batches which fit in a page */ |
91 | static unsigned long frame_list[PAGE_SIZE / sizeof(unsigned long)]; | 90 | static xen_pfn_t frame_list[PAGE_SIZE / sizeof(unsigned long)]; |
92 | 91 | ||
93 | #ifdef CONFIG_HIGHMEM | 92 | #ifdef CONFIG_HIGHMEM |
94 | #define inc_totalhigh_pages() (totalhigh_pages++) | 93 | #define inc_totalhigh_pages() (totalhigh_pages++) |
diff --git a/drivers/xen/dbgp.c b/drivers/xen/dbgp.c index 42569c77ccc8..f3ccc80a455f 100644 --- a/drivers/xen/dbgp.c +++ b/drivers/xen/dbgp.c | |||
@@ -8,7 +8,9 @@ | |||
8 | 8 | ||
9 | static int xen_dbgp_op(struct usb_hcd *hcd, int op) | 9 | static int xen_dbgp_op(struct usb_hcd *hcd, int op) |
10 | { | 10 | { |
11 | #ifdef CONFIG_PCI | ||
11 | const struct device *ctrlr = hcd_to_bus(hcd)->controller; | 12 | const struct device *ctrlr = hcd_to_bus(hcd)->controller; |
13 | #endif | ||
12 | struct physdev_dbgp_op dbgp; | 14 | struct physdev_dbgp_op dbgp; |
13 | 15 | ||
14 | if (!xen_initial_domain()) | 16 | if (!xen_initial_domain()) |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 59e10a1286d5..0be4df39e953 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -115,7 +115,9 @@ struct irq_info { | |||
115 | #define PIRQ_SHAREABLE (1 << 1) | 115 | #define PIRQ_SHAREABLE (1 << 1) |
116 | 116 | ||
117 | static int *evtchn_to_irq; | 117 | static int *evtchn_to_irq; |
118 | #ifdef CONFIG_X86 | ||
118 | static unsigned long *pirq_eoi_map; | 119 | static unsigned long *pirq_eoi_map; |
120 | #endif | ||
119 | static bool (*pirq_needs_eoi)(unsigned irq); | 121 | static bool (*pirq_needs_eoi)(unsigned irq); |
120 | 122 | ||
121 | static DEFINE_PER_CPU(unsigned long [NR_EVENT_CHANNELS/BITS_PER_LONG], | 123 | static DEFINE_PER_CPU(unsigned long [NR_EVENT_CHANNELS/BITS_PER_LONG], |
@@ -277,10 +279,12 @@ static unsigned int cpu_from_evtchn(unsigned int evtchn) | |||
277 | return ret; | 279 | return ret; |
278 | } | 280 | } |
279 | 281 | ||
282 | #ifdef CONFIG_X86 | ||
280 | static bool pirq_check_eoi_map(unsigned irq) | 283 | static bool pirq_check_eoi_map(unsigned irq) |
281 | { | 284 | { |
282 | return test_bit(pirq_from_irq(irq), pirq_eoi_map); | 285 | return test_bit(pirq_from_irq(irq), pirq_eoi_map); |
283 | } | 286 | } |
287 | #endif | ||
284 | 288 | ||
285 | static bool pirq_needs_eoi_flag(unsigned irq) | 289 | static bool pirq_needs_eoi_flag(unsigned irq) |
286 | { | 290 | { |
@@ -1391,10 +1395,10 @@ void xen_evtchn_do_upcall(struct pt_regs *regs) | |||
1391 | { | 1395 | { |
1392 | struct pt_regs *old_regs = set_irq_regs(regs); | 1396 | struct pt_regs *old_regs = set_irq_regs(regs); |
1393 | 1397 | ||
1398 | irq_enter(); | ||
1394 | #ifdef CONFIG_X86 | 1399 | #ifdef CONFIG_X86 |
1395 | exit_idle(); | 1400 | exit_idle(); |
1396 | #endif | 1401 | #endif |
1397 | irq_enter(); | ||
1398 | 1402 | ||
1399 | __xen_evtchn_do_upcall(); | 1403 | __xen_evtchn_do_upcall(); |
1400 | 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/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index 610bfc6be177..2e22df2f7a3f 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c | |||
@@ -105,6 +105,21 @@ static void gntdev_print_maps(struct gntdev_priv *priv, | |||
105 | #endif | 105 | #endif |
106 | } | 106 | } |
107 | 107 | ||
108 | static void gntdev_free_map(struct grant_map *map) | ||
109 | { | ||
110 | if (map == NULL) | ||
111 | return; | ||
112 | |||
113 | if (map->pages) | ||
114 | free_xenballooned_pages(map->count, map->pages); | ||
115 | kfree(map->pages); | ||
116 | kfree(map->grants); | ||
117 | kfree(map->map_ops); | ||
118 | kfree(map->unmap_ops); | ||
119 | kfree(map->kmap_ops); | ||
120 | kfree(map); | ||
121 | } | ||
122 | |||
108 | static struct grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count) | 123 | static struct grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count) |
109 | { | 124 | { |
110 | struct grant_map *add; | 125 | struct grant_map *add; |
@@ -142,12 +157,7 @@ static struct grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count) | |||
142 | return add; | 157 | return add; |
143 | 158 | ||
144 | err: | 159 | err: |
145 | kfree(add->pages); | 160 | gntdev_free_map(add); |
146 | kfree(add->grants); | ||
147 | kfree(add->map_ops); | ||
148 | kfree(add->unmap_ops); | ||
149 | kfree(add->kmap_ops); | ||
150 | kfree(add); | ||
151 | return NULL; | 161 | return NULL; |
152 | } | 162 | } |
153 | 163 | ||
@@ -198,17 +208,9 @@ static void gntdev_put_map(struct grant_map *map) | |||
198 | evtchn_put(map->notify.event); | 208 | evtchn_put(map->notify.event); |
199 | } | 209 | } |
200 | 210 | ||
201 | if (map->pages) { | 211 | if (map->pages && !use_ptemod) |
202 | if (!use_ptemod) | 212 | unmap_grant_pages(map, 0, map->count); |
203 | unmap_grant_pages(map, 0, map->count); | 213 | gntdev_free_map(map); |
204 | |||
205 | free_xenballooned_pages(map->count, map->pages); | ||
206 | } | ||
207 | kfree(map->pages); | ||
208 | kfree(map->grants); | ||
209 | kfree(map->map_ops); | ||
210 | kfree(map->unmap_ops); | ||
211 | kfree(map); | ||
212 | } | 214 | } |
213 | 215 | ||
214 | /* ------------------------------------------------------------------ */ | 216 | /* ------------------------------------------------------------------ */ |
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index b2b0a375b348..b91f14e83164 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c | |||
@@ -84,7 +84,7 @@ struct gnttab_ops { | |||
84 | * nr_gframes is the number of frames to map grant table. Returning | 84 | * nr_gframes is the number of frames to map grant table. Returning |
85 | * GNTST_okay means success and negative value means failure. | 85 | * GNTST_okay means success and negative value means failure. |
86 | */ | 86 | */ |
87 | int (*map_frames)(unsigned long *frames, unsigned int nr_gframes); | 87 | int (*map_frames)(xen_pfn_t *frames, unsigned int nr_gframes); |
88 | /* | 88 | /* |
89 | * Release a list of frames which are mapped in map_frames for grant | 89 | * Release a list of frames which are mapped in map_frames for grant |
90 | * entry status. | 90 | * entry status. |
@@ -960,7 +960,7 @@ static unsigned nr_status_frames(unsigned nr_grant_frames) | |||
960 | return (nr_grant_frames * GREFS_PER_GRANT_FRAME + SPP - 1) / SPP; | 960 | return (nr_grant_frames * GREFS_PER_GRANT_FRAME + SPP - 1) / SPP; |
961 | } | 961 | } |
962 | 962 | ||
963 | static int gnttab_map_frames_v1(unsigned long *frames, unsigned int nr_gframes) | 963 | static int gnttab_map_frames_v1(xen_pfn_t *frames, unsigned int nr_gframes) |
964 | { | 964 | { |
965 | int rc; | 965 | int rc; |
966 | 966 | ||
@@ -977,7 +977,7 @@ static void gnttab_unmap_frames_v1(void) | |||
977 | arch_gnttab_unmap(gnttab_shared.addr, nr_grant_frames); | 977 | arch_gnttab_unmap(gnttab_shared.addr, nr_grant_frames); |
978 | } | 978 | } |
979 | 979 | ||
980 | static int gnttab_map_frames_v2(unsigned long *frames, unsigned int nr_gframes) | 980 | static int gnttab_map_frames_v2(xen_pfn_t *frames, unsigned int nr_gframes) |
981 | { | 981 | { |
982 | uint64_t *sframes; | 982 | uint64_t *sframes; |
983 | unsigned int nr_sframes; | 983 | unsigned int nr_sframes; |
@@ -1029,7 +1029,7 @@ static void gnttab_unmap_frames_v2(void) | |||
1029 | static int gnttab_map(unsigned int start_idx, unsigned int end_idx) | 1029 | static int gnttab_map(unsigned int start_idx, unsigned int end_idx) |
1030 | { | 1030 | { |
1031 | struct gnttab_setup_table setup; | 1031 | struct gnttab_setup_table setup; |
1032 | unsigned long *frames; | 1032 | xen_pfn_t *frames; |
1033 | unsigned int nr_gframes = end_idx + 1; | 1033 | unsigned int nr_gframes = end_idx + 1; |
1034 | int rc; | 1034 | int rc; |
1035 | 1035 | ||
diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c index 8adb9cc267f9..71f5c459b088 100644 --- a/drivers/xen/privcmd.c +++ b/drivers/xen/privcmd.c | |||
@@ -361,13 +361,13 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version) | |||
361 | down_write(&mm->mmap_sem); | 361 | down_write(&mm->mmap_sem); |
362 | 362 | ||
363 | vma = find_vma(mm, m.addr); | 363 | vma = find_vma(mm, m.addr); |
364 | ret = -EINVAL; | ||
365 | if (!vma || | 364 | if (!vma || |
366 | vma->vm_ops != &privcmd_vm_ops || | 365 | vma->vm_ops != &privcmd_vm_ops || |
367 | (m.addr != vma->vm_start) || | 366 | (m.addr != vma->vm_start) || |
368 | ((m.addr + (nr_pages << PAGE_SHIFT)) != vma->vm_end) || | 367 | ((m.addr + (nr_pages << PAGE_SHIFT)) != vma->vm_end) || |
369 | !privcmd_enforce_singleshot_mapping(vma)) { | 368 | !privcmd_enforce_singleshot_mapping(vma)) { |
370 | up_write(&mm->mmap_sem); | 369 | up_write(&mm->mmap_sem); |
370 | ret = -EINVAL; | ||
371 | goto out; | 371 | goto out; |
372 | } | 372 | } |
373 | 373 | ||
@@ -383,12 +383,16 @@ static long privcmd_ioctl_mmap_batch(void __user *udata, int version) | |||
383 | 383 | ||
384 | up_write(&mm->mmap_sem); | 384 | up_write(&mm->mmap_sem); |
385 | 385 | ||
386 | if (state.global_error && (version == 1)) { | 386 | if (version == 1) { |
387 | /* Write back errors in second pass. */ | 387 | if (state.global_error) { |
388 | state.user_mfn = (xen_pfn_t *)m.arr; | 388 | /* Write back errors in second pass. */ |
389 | state.err = err_array; | 389 | state.user_mfn = (xen_pfn_t *)m.arr; |
390 | ret = traverse_pages(m.num, sizeof(xen_pfn_t), | 390 | state.err = err_array; |
391 | &pagelist, mmap_return_errors_v1, &state); | 391 | ret = traverse_pages(m.num, sizeof(xen_pfn_t), |
392 | &pagelist, mmap_return_errors_v1, &state); | ||
393 | } else | ||
394 | ret = 0; | ||
395 | |||
392 | } else if (version == 2) { | 396 | } else if (version == 2) { |
393 | ret = __copy_to_user(m.err, err_array, m.num * sizeof(int)); | 397 | ret = __copy_to_user(m.err, err_array, m.num * sizeof(int)); |
394 | if (ret) | 398 | if (ret) |
diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c index 5e5ad7e28858..96453f8a85c5 100644 --- a/drivers/xen/sys-hypervisor.c +++ b/drivers/xen/sys-hypervisor.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/kobject.h> | 13 | #include <linux/kobject.h> |
14 | #include <linux/err.h> | ||
14 | 15 | ||
15 | #include <asm/xen/hypervisor.h> | 16 | #include <asm/xen/hypervisor.h> |
16 | #include <asm/xen/hypercall.h> | 17 | #include <asm/xen/hypercall.h> |
@@ -284,7 +285,8 @@ static ssize_t virtual_start_show(struct hyp_sysfs_attr *attr, char *buffer) | |||
284 | ret = HYPERVISOR_xen_version(XENVER_platform_parameters, | 285 | ret = HYPERVISOR_xen_version(XENVER_platform_parameters, |
285 | parms); | 286 | parms); |
286 | if (!ret) | 287 | if (!ret) |
287 | ret = sprintf(buffer, "%lx\n", parms->virt_start); | 288 | ret = sprintf(buffer, "%"PRI_xen_ulong"\n", |
289 | parms->virt_start); | ||
288 | kfree(parms); | 290 | kfree(parms); |
289 | } | 291 | } |
290 | 292 | ||
diff --git a/drivers/xen/xen-pciback/vpci.c b/drivers/xen/xen-pciback/vpci.c index 46d140baebd8..0f478ac483cd 100644 --- a/drivers/xen/xen-pciback/vpci.c +++ b/drivers/xen/xen-pciback/vpci.c | |||
@@ -89,9 +89,15 @@ static int __xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev, | |||
89 | 89 | ||
90 | mutex_lock(&vpci_dev->lock); | 90 | mutex_lock(&vpci_dev->lock); |
91 | 91 | ||
92 | /* Keep multi-function devices together on the virtual PCI bus */ | 92 | /* |
93 | for (slot = 0; slot < PCI_SLOT_MAX; slot++) { | 93 | * Keep multi-function devices together on the virtual PCI bus, except |
94 | if (!list_empty(&vpci_dev->dev_list[slot])) { | 94 | * virtual functions. |
95 | */ | ||
96 | if (!dev->is_virtfn) { | ||
97 | for (slot = 0; slot < PCI_SLOT_MAX; slot++) { | ||
98 | if (list_empty(&vpci_dev->dev_list[slot])) | ||
99 | continue; | ||
100 | |||
95 | t = list_entry(list_first(&vpci_dev->dev_list[slot]), | 101 | t = list_entry(list_first(&vpci_dev->dev_list[slot]), |
96 | struct pci_dev_entry, list); | 102 | struct pci_dev_entry, list); |
97 | 103 | ||
@@ -116,7 +122,7 @@ static int __xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev, | |||
116 | pci_name(dev), slot); | 122 | pci_name(dev), slot); |
117 | list_add_tail(&dev_entry->list, | 123 | list_add_tail(&dev_entry->list, |
118 | &vpci_dev->dev_list[slot]); | 124 | &vpci_dev->dev_list[slot]); |
119 | func = PCI_FUNC(dev->devfn); | 125 | func = dev->is_virtfn ? 0 : PCI_FUNC(dev->devfn); |
120 | goto unlock; | 126 | goto unlock; |
121 | } | 127 | } |
122 | } | 128 | } |
diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c index 89f76252a16f..ac727028e658 100644 --- a/drivers/xen/xenbus/xenbus_dev_frontend.c +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c | |||
@@ -458,7 +458,7 @@ static ssize_t xenbus_file_write(struct file *filp, | |||
458 | goto out; | 458 | goto out; |
459 | 459 | ||
460 | /* Can't write a xenbus message larger we can buffer */ | 460 | /* Can't write a xenbus message larger we can buffer */ |
461 | if ((len + u->len) > sizeof(u->u.buffer)) { | 461 | if (len > sizeof(u->u.buffer) - u->len) { |
462 | /* On error, dump existing buffer */ | 462 | /* On error, dump existing buffer */ |
463 | u->len = 0; | 463 | u->len = 0; |
464 | rc = -EINVAL; | 464 | rc = -EINVAL; |
diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c index 48220e129f85..acedeabe589c 100644 --- a/drivers/xen/xenbus/xenbus_xs.c +++ b/drivers/xen/xenbus/xenbus_xs.c | |||
@@ -625,8 +625,9 @@ static struct xenbus_watch *find_watch(const char *token) | |||
625 | * so if we are running on anything older than 4 do not attempt to read | 625 | * so if we are running on anything older than 4 do not attempt to read |
626 | * control/platform-feature-xs_reset_watches. | 626 | * control/platform-feature-xs_reset_watches. |
627 | */ | 627 | */ |
628 | static bool xen_strict_xenbus_quirk() | 628 | static bool xen_strict_xenbus_quirk(void) |
629 | { | 629 | { |
630 | #ifdef CONFIG_X86 | ||
630 | uint32_t eax, ebx, ecx, edx, base; | 631 | uint32_t eax, ebx, ecx, edx, base; |
631 | 632 | ||
632 | base = xen_cpuid_base(); | 633 | base = xen_cpuid_base(); |
@@ -634,6 +635,7 @@ static bool xen_strict_xenbus_quirk() | |||
634 | 635 | ||
635 | if ((eax >> 16) < 4) | 636 | if ((eax >> 16) < 4) |
636 | return true; | 637 | return true; |
638 | #endif | ||
637 | return false; | 639 | return false; |
638 | 640 | ||
639 | } | 641 | } |