aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Bolle <pebolle@tiscali.nl>2014-02-08 17:35:43 -0500
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2014-02-11 10:12:37 -0500
commitd8320b2d2e7d1cda8216d496c7c685c5fdf74ff0 (patch)
treee835dfa89c6edac1f4b1e1d438cbbc18a017f4e2
parent564eb714f5f09ac733c26860d5f0831f213fbdf1 (diff)
ia64/xen: Remove Xen support for ia64 even more
Commit d52eefb47d4e ("ia64/xen: Remove Xen support for ia64") removed the Kconfig symbol XEN_XENCOMM. But it didn't remove the code depending on that symbol. Remove that code now. Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Acked-by: David Vrabel <david.vrabel@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
-rw-r--r--drivers/xen/Makefile1
-rw-r--r--drivers/xen/xencomm.c219
-rw-r--r--include/xen/interface/xencomm.h41
-rw-r--r--include/xen/xencomm.h77
4 files changed, 0 insertions, 338 deletions
diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile
index d75c811bfa56..45e00afa7f2d 100644
--- a/drivers/xen/Makefile
+++ b/drivers/xen/Makefile
@@ -16,7 +16,6 @@ xen-pad-$(CONFIG_X86) += xen-acpi-pad.o
16dom0-$(CONFIG_X86) += pcpu.o 16dom0-$(CONFIG_X86) += pcpu.o
17obj-$(CONFIG_XEN_DOM0) += $(dom0-y) 17obj-$(CONFIG_XEN_DOM0) += $(dom0-y)
18obj-$(CONFIG_BLOCK) += biomerge.o 18obj-$(CONFIG_BLOCK) += biomerge.o
19obj-$(CONFIG_XEN_XENCOMM) += xencomm.o
20obj-$(CONFIG_XEN_BALLOON) += xen-balloon.o 19obj-$(CONFIG_XEN_BALLOON) += xen-balloon.o
21obj-$(CONFIG_XEN_SELFBALLOONING) += xen-selfballoon.o 20obj-$(CONFIG_XEN_SELFBALLOONING) += xen-selfballoon.o
22obj-$(CONFIG_XEN_DEV_EVTCHN) += xen-evtchn.o 21obj-$(CONFIG_XEN_DEV_EVTCHN) += xen-evtchn.o
diff --git a/drivers/xen/xencomm.c b/drivers/xen/xencomm.c
deleted file mode 100644
index 4793fc594549..000000000000
--- a/drivers/xen/xencomm.c
+++ /dev/null
@@ -1,219 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 *
16 * Copyright (C) IBM Corp. 2006
17 *
18 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
19 */
20
21#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
22
23#include <linux/mm.h>
24#include <linux/slab.h>
25#include <asm/page.h>
26#include <xen/xencomm.h>
27#include <xen/interface/xen.h>
28#include <asm/xen/xencomm.h> /* for xencomm_is_phys_contiguous() */
29
30static int xencomm_init(struct xencomm_desc *desc,
31 void *buffer, unsigned long bytes)
32{
33 unsigned long recorded = 0;
34 int i = 0;
35
36 while ((recorded < bytes) && (i < desc->nr_addrs)) {
37 unsigned long vaddr = (unsigned long)buffer + recorded;
38 unsigned long paddr;
39 int offset;
40 int chunksz;
41
42 offset = vaddr % PAGE_SIZE; /* handle partial pages */
43 chunksz = min(PAGE_SIZE - offset, bytes - recorded);
44
45 paddr = xencomm_vtop(vaddr);
46 if (paddr == ~0UL) {
47 printk(KERN_DEBUG "%s: couldn't translate vaddr %lx\n",
48 __func__, vaddr);
49 return -EINVAL;
50 }
51
52 desc->address[i++] = paddr;
53 recorded += chunksz;
54 }
55
56 if (recorded < bytes) {
57 printk(KERN_DEBUG
58 "%s: could only translate %ld of %ld bytes\n",
59 __func__, recorded, bytes);
60 return -ENOSPC;
61 }
62
63 /* mark remaining addresses invalid (just for safety) */
64 while (i < desc->nr_addrs)
65 desc->address[i++] = XENCOMM_INVALID;
66
67 desc->magic = XENCOMM_MAGIC;
68
69 return 0;
70}
71
72static struct xencomm_desc *xencomm_alloc(gfp_t gfp_mask,
73 void *buffer, unsigned long bytes)
74{
75 struct xencomm_desc *desc;
76 unsigned long buffer_ulong = (unsigned long)buffer;
77 unsigned long start = buffer_ulong & PAGE_MASK;
78 unsigned long end = (buffer_ulong + bytes) | ~PAGE_MASK;
79 unsigned long nr_addrs = (end - start + 1) >> PAGE_SHIFT;
80 unsigned long size = sizeof(*desc) +
81 sizeof(desc->address[0]) * nr_addrs;
82
83 /*
84 * slab allocator returns at least sizeof(void*) aligned pointer.
85 * When sizeof(*desc) > sizeof(void*), struct xencomm_desc might
86 * cross page boundary.
87 */
88 if (sizeof(*desc) > sizeof(void *)) {
89 unsigned long order = get_order(size);
90 desc = (struct xencomm_desc *)__get_free_pages(gfp_mask,
91 order);
92 if (desc == NULL)
93 return NULL;
94
95 desc->nr_addrs =
96 ((PAGE_SIZE << order) - sizeof(struct xencomm_desc)) /
97 sizeof(*desc->address);
98 } else {
99 desc = kmalloc(size, gfp_mask);
100 if (desc == NULL)
101 return NULL;
102
103 desc->nr_addrs = nr_addrs;
104 }
105 return desc;
106}
107
108void xencomm_free(struct xencomm_handle *desc)
109{
110 if (desc && !((ulong)desc & XENCOMM_INLINE_FLAG)) {
111 struct xencomm_desc *desc__ = (struct xencomm_desc *)desc;
112 if (sizeof(*desc__) > sizeof(void *)) {
113 unsigned long size = sizeof(*desc__) +
114 sizeof(desc__->address[0]) * desc__->nr_addrs;
115 unsigned long order = get_order(size);
116 free_pages((unsigned long)__va(desc), order);
117 } else
118 kfree(__va(desc));
119 }
120}
121
122static int xencomm_create(void *buffer, unsigned long bytes,
123 struct xencomm_desc **ret, gfp_t gfp_mask)
124{
125 struct xencomm_desc *desc;
126 int rc;
127
128 pr_debug("%s: %p[%ld]\n", __func__, buffer, bytes);
129
130 if (bytes == 0) {
131 /* don't create a descriptor; Xen recognizes NULL. */
132 BUG_ON(buffer != NULL);
133 *ret = NULL;
134 return 0;
135 }
136
137 BUG_ON(buffer == NULL); /* 'bytes' is non-zero */
138
139 desc = xencomm_alloc(gfp_mask, buffer, bytes);
140 if (!desc) {
141 printk(KERN_DEBUG "%s failure\n", "xencomm_alloc");
142 return -ENOMEM;
143 }
144
145 rc = xencomm_init(desc, buffer, bytes);
146 if (rc) {
147 printk(KERN_DEBUG "%s failure: %d\n", "xencomm_init", rc);
148 xencomm_free((struct xencomm_handle *)__pa(desc));
149 return rc;
150 }
151
152 *ret = desc;
153 return 0;
154}
155
156static struct xencomm_handle *xencomm_create_inline(void *ptr)
157{
158 unsigned long paddr;
159
160 BUG_ON(!xencomm_is_phys_contiguous((unsigned long)ptr));
161
162 paddr = (unsigned long)xencomm_pa(ptr);
163 BUG_ON(paddr & XENCOMM_INLINE_FLAG);
164 return (struct xencomm_handle *)(paddr | XENCOMM_INLINE_FLAG);
165}
166
167/* "mini" routine, for stack-based communications: */
168static int xencomm_create_mini(void *buffer,
169 unsigned long bytes, struct xencomm_mini *xc_desc,
170 struct xencomm_desc **ret)
171{
172 int rc = 0;
173 struct xencomm_desc *desc;
174 BUG_ON(((unsigned long)xc_desc) % sizeof(*xc_desc) != 0);
175
176 desc = (void *)xc_desc;
177
178 desc->nr_addrs = XENCOMM_MINI_ADDRS;
179
180 rc = xencomm_init(desc, buffer, bytes);
181 if (!rc)
182 *ret = desc;
183
184 return rc;
185}
186
187struct xencomm_handle *xencomm_map(void *ptr, unsigned long bytes)
188{
189 int rc;
190 struct xencomm_desc *desc;
191
192 if (xencomm_is_phys_contiguous((unsigned long)ptr))
193 return xencomm_create_inline(ptr);
194
195 rc = xencomm_create(ptr, bytes, &desc, GFP_KERNEL);
196
197 if (rc || desc == NULL)
198 return NULL;
199
200 return xencomm_pa(desc);
201}
202
203struct xencomm_handle *__xencomm_map_no_alloc(void *ptr, unsigned long bytes,
204 struct xencomm_mini *xc_desc)
205{
206 int rc;
207 struct xencomm_desc *desc = NULL;
208
209 if (xencomm_is_phys_contiguous((unsigned long)ptr))
210 return xencomm_create_inline(ptr);
211
212 rc = xencomm_create_mini(ptr, bytes, xc_desc,
213 &desc);
214
215 if (rc)
216 return NULL;
217
218 return xencomm_pa(desc);
219}
diff --git a/include/xen/interface/xencomm.h b/include/xen/interface/xencomm.h
deleted file mode 100644
index ac45e0712afa..000000000000
--- a/include/xen/interface/xencomm.h
+++ /dev/null
@@ -1,41 +0,0 @@
1/*
2 * Permission is hereby granted, free of charge, to any person obtaining a copy
3 * of this software and associated documentation files (the "Software"), to
4 * deal in the Software without restriction, including without limitation the
5 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
6 * sell copies of the Software, and to permit persons to whom the Software is
7 * furnished to do so, subject to the following conditions:
8 *
9 * The above copyright notice and this permission notice shall be included in
10 * all copies or substantial portions of the Software.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18 * DEALINGS IN THE SOFTWARE.
19 *
20 * Copyright (C) IBM Corp. 2006
21 */
22
23#ifndef _XEN_XENCOMM_H_
24#define _XEN_XENCOMM_H_
25
26/* A xencomm descriptor is a scatter/gather list containing physical
27 * addresses corresponding to a virtually contiguous memory area. The
28 * hypervisor translates these physical addresses to machine addresses to copy
29 * to and from the virtually contiguous area.
30 */
31
32#define XENCOMM_MAGIC 0x58434F4D /* 'XCOM' */
33#define XENCOMM_INVALID (~0UL)
34
35struct xencomm_desc {
36 uint32_t magic;
37 uint32_t nr_addrs; /* the number of entries in address[] */
38 uint64_t address[0];
39};
40
41#endif /* _XEN_XENCOMM_H_ */
diff --git a/include/xen/xencomm.h b/include/xen/xencomm.h
deleted file mode 100644
index e43b039be112..000000000000
--- a/include/xen/xencomm.h
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 *
16 * Copyright (C) IBM Corp. 2006
17 *
18 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
19 * Jerone Young <jyoung5@us.ibm.com>
20 */
21
22#ifndef _LINUX_XENCOMM_H_
23#define _LINUX_XENCOMM_H_
24
25#include <xen/interface/xencomm.h>
26
27#define XENCOMM_MINI_ADDRS 3
28struct xencomm_mini {
29 struct xencomm_desc _desc;
30 uint64_t address[XENCOMM_MINI_ADDRS];
31};
32
33/* To avoid additionnal virt to phys conversion, an opaque structure is
34 presented. */
35struct xencomm_handle;
36
37extern void xencomm_free(struct xencomm_handle *desc);
38extern struct xencomm_handle *xencomm_map(void *ptr, unsigned long bytes);
39extern struct xencomm_handle *__xencomm_map_no_alloc(void *ptr,
40 unsigned long bytes, struct xencomm_mini *xc_area);
41
42#if 0
43#define XENCOMM_MINI_ALIGNED(xc_desc, n) \
44 struct xencomm_mini xc_desc ## _base[(n)] \
45 __attribute__((__aligned__(sizeof(struct xencomm_mini)))); \
46 struct xencomm_mini *xc_desc = &xc_desc ## _base[0];
47#else
48/*
49 * gcc bug workaround:
50 * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16660
51 * gcc doesn't handle properly stack variable with
52 * __attribute__((__align__(sizeof(struct xencomm_mini))))
53 */
54#define XENCOMM_MINI_ALIGNED(xc_desc, n) \
55 unsigned char xc_desc ## _base[((n) + 1 ) * \
56 sizeof(struct xencomm_mini)]; \
57 struct xencomm_mini *xc_desc = (struct xencomm_mini *) \
58 ((unsigned long)xc_desc ## _base + \
59 (sizeof(struct xencomm_mini) - \
60 ((unsigned long)xc_desc ## _base) % \
61 sizeof(struct xencomm_mini)));
62#endif
63#define xencomm_map_no_alloc(ptr, bytes) \
64 ({ XENCOMM_MINI_ALIGNED(xc_desc, 1); \
65 __xencomm_map_no_alloc(ptr, bytes, xc_desc); })
66
67/* provided by architecture code: */
68extern unsigned long xencomm_vtop(unsigned long vaddr);
69
70static inline void *xencomm_pa(void *ptr)
71{
72 return (void *)xencomm_vtop((unsigned long)ptr);
73}
74
75#define xen_guest_handle(hnd) ((hnd).p)
76
77#endif /* _LINUX_XENCOMM_H_ */