aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-07-01 14:53:46 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-07-01 14:53:46 -0400
commit7adf12b87f45a77d364464018fb8e9e1ac875152 (patch)
tree9e2f96ba1f7b1b768143d22ad3b77d248aae77c2
parent02201e3f1b46aed7c6348f406b7b40de80ba6de3 (diff)
parent6684fa1cdb1ebe804e9707f389255d461b2e95b0 (diff)
Merge tag 'for-linus-4.2-rc0-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull xen updates from David Vrabel: "Xen features and cleanups for 4.2-rc0: - add "make xenconfig" to assist in generating configs for Xen guests - preparatory cleanups necessary for supporting 64 KiB pages in ARM guests - automatically use hvc0 as the default console in ARM guests" * tag 'for-linus-4.2-rc0-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: block/xen-blkback: s/nr_pages/nr_segs/ block/xen-blkfront: Remove invalid comment block/xen-blkfront: Remove unused macro MAXIMUM_OUTSTANDING_BLOCK_REQS arm/xen: Drop duplicate define mfn_to_virt xen/grant-table: Remove unused macro SPP xen/xenbus: client: Fix call of virt_to_mfn in xenbus_grant_ring xen: Include xen/page.h rather than asm/xen/page.h kconfig: add xenconfig defconfig helper kconfig: clarify kvmconfig is for kvm xen/pcifront: Remove usage of struct timeval xen/tmem: use BUILD_BUG_ON() in favor of BUG_ON() hvc_xen: avoid uninitialized variable warning xenbus: avoid uninitialized variable warning xen/arm: allow console=hvc0 to be omitted for guests arm,arm64/xen: move Xen initialization earlier arm/xen: Correctly check if the event channel interrupt is present
-rw-r--r--arch/arm/include/asm/xen/hypervisor.h8
-rw-r--r--arch/arm/include/asm/xen/page.h1
-rw-r--r--arch/arm/kernel/setup.c2
-rw-r--r--arch/arm/xen/enlighten.c62
-rw-r--r--arch/arm/xen/mm.c2
-rw-r--r--arch/arm/xen/p2m.c2
-rw-r--r--arch/arm64/kernel/setup.c2
-rw-r--r--arch/x86/configs/xen.config28
-rw-r--r--drivers/block/xen-blkback/blkback.c10
-rw-r--r--drivers/block/xen-blkback/common.h2
-rw-r--r--drivers/block/xen-blkfront.c6
-rw-r--r--drivers/net/xen-netback/netback.c2
-rw-r--r--drivers/net/xen-netfront.c1
-rw-r--r--drivers/pci/xen-pcifront.c8
-rw-r--r--drivers/tty/hvc/hvc_xen.c2
-rw-r--r--drivers/xen/events/events_base.c2
-rw-r--r--drivers/xen/events/events_fifo.c2
-rw-r--r--drivers/xen/gntdev.c2
-rw-r--r--drivers/xen/grant-table.c1
-rw-r--r--drivers/xen/manage.c2
-rw-r--r--drivers/xen/tmem.c4
-rw-r--r--drivers/xen/xenbus/xenbus_client.c8
-rw-r--r--drivers/xen/xenbus/xenbus_probe.c2
-rw-r--r--kernel/configs/xen.config48
-rw-r--r--scripts/kconfig/Makefile7
25 files changed, 157 insertions, 59 deletions
diff --git a/arch/arm/include/asm/xen/hypervisor.h b/arch/arm/include/asm/xen/hypervisor.h
index 1317ee40f4df..04ff8e7b37df 100644
--- a/arch/arm/include/asm/xen/hypervisor.h
+++ b/arch/arm/include/asm/xen/hypervisor.h
@@ -1,6 +1,8 @@
1#ifndef _ASM_ARM_XEN_HYPERVISOR_H 1#ifndef _ASM_ARM_XEN_HYPERVISOR_H
2#define _ASM_ARM_XEN_HYPERVISOR_H 2#define _ASM_ARM_XEN_HYPERVISOR_H
3 3
4#include <linux/init.h>
5
4extern struct shared_info *HYPERVISOR_shared_info; 6extern struct shared_info *HYPERVISOR_shared_info;
5extern struct start_info *xen_start_info; 7extern struct start_info *xen_start_info;
6 8
@@ -18,4 +20,10 @@ static inline enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
18 20
19extern struct dma_map_ops *xen_dma_ops; 21extern struct dma_map_ops *xen_dma_ops;
20 22
23#ifdef CONFIG_XEN
24void __init xen_early_init(void);
25#else
26static inline void xen_early_init(void) { return; }
27#endif
28
21#endif /* _ASM_ARM_XEN_HYPERVISOR_H */ 29#endif /* _ASM_ARM_XEN_HYPERVISOR_H */
diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h
index 0b579b2f4e0e..1bee8ca12494 100644
--- a/arch/arm/include/asm/xen/page.h
+++ b/arch/arm/include/asm/xen/page.h
@@ -12,7 +12,6 @@
12#include <xen/interface/grant_table.h> 12#include <xen/interface/grant_table.h>
13 13
14#define phys_to_machine_mapping_valid(pfn) (1) 14#define phys_to_machine_mapping_valid(pfn) (1)
15#define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT))
16 15
17#define pte_mfn pte_pfn 16#define pte_mfn pte_pfn
18#define mfn_pte pfn_pte 17#define mfn_pte pfn_pte
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index e6d8c7658ffd..36c18b73c1f4 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -46,6 +46,7 @@
46#include <asm/cacheflush.h> 46#include <asm/cacheflush.h>
47#include <asm/cachetype.h> 47#include <asm/cachetype.h>
48#include <asm/tlbflush.h> 48#include <asm/tlbflush.h>
49#include <asm/xen/hypervisor.h>
49 50
50#include <asm/prom.h> 51#include <asm/prom.h>
51#include <asm/mach/arch.h> 52#include <asm/mach/arch.h>
@@ -972,6 +973,7 @@ void __init setup_arch(char **cmdline_p)
972 973
973 arm_dt_init_cpu_maps(); 974 arm_dt_init_cpu_maps();
974 psci_init(); 975 psci_init();
976 xen_early_init();
975#ifdef CONFIG_SMP 977#ifdef CONFIG_SMP
976 if (is_smp()) { 978 if (is_smp()) {
977 if (!mdesc->smp_init || !mdesc->smp_init()) { 979 if (!mdesc->smp_init || !mdesc->smp_init()) {
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 7d0f07020c80..6c09cc440a2b 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -24,6 +24,7 @@
24#include <linux/cpuidle.h> 24#include <linux/cpuidle.h>
25#include <linux/cpufreq.h> 25#include <linux/cpufreq.h>
26#include <linux/cpu.h> 26#include <linux/cpu.h>
27#include <linux/console.h>
27 28
28#include <linux/mm.h> 29#include <linux/mm.h>
29 30
@@ -51,7 +52,9 @@ EXPORT_SYMBOL_GPL(xen_have_vector_callback);
51int xen_platform_pci_unplug = XEN_UNPLUG_ALL; 52int xen_platform_pci_unplug = XEN_UNPLUG_ALL;
52EXPORT_SYMBOL_GPL(xen_platform_pci_unplug); 53EXPORT_SYMBOL_GPL(xen_platform_pci_unplug);
53 54
54static __read_mostly int xen_events_irq = -1; 55static __read_mostly unsigned int xen_events_irq;
56
57static __initdata struct device_node *xen_node;
55 58
56int xen_remap_domain_mfn_array(struct vm_area_struct *vma, 59int xen_remap_domain_mfn_array(struct vm_area_struct *vma,
57 unsigned long addr, 60 unsigned long addr,
@@ -150,40 +153,28 @@ static irqreturn_t xen_arm_callback(int irq, void *arg)
150 * documentation of the Xen Device Tree format. 153 * documentation of the Xen Device Tree format.
151 */ 154 */
152#define GRANT_TABLE_PHYSADDR 0 155#define GRANT_TABLE_PHYSADDR 0
153static int __init xen_guest_init(void) 156void __init xen_early_init(void)
154{ 157{
155 struct xen_add_to_physmap xatp;
156 static struct shared_info *shared_info_page = 0;
157 struct device_node *node;
158 int len; 158 int len;
159 const char *s = NULL; 159 const char *s = NULL;
160 const char *version = NULL; 160 const char *version = NULL;
161 const char *xen_prefix = "xen,xen-"; 161 const char *xen_prefix = "xen,xen-";
162 struct resource res;
163 phys_addr_t grant_frames;
164 162
165 node = of_find_compatible_node(NULL, NULL, "xen,xen"); 163 xen_node = of_find_compatible_node(NULL, NULL, "xen,xen");
166 if (!node) { 164 if (!xen_node) {
167 pr_debug("No Xen support\n"); 165 pr_debug("No Xen support\n");
168 return 0; 166 return;
169 } 167 }
170 s = of_get_property(node, "compatible", &len); 168 s = of_get_property(xen_node, "compatible", &len);
171 if (strlen(xen_prefix) + 3 < len && 169 if (strlen(xen_prefix) + 3 < len &&
172 !strncmp(xen_prefix, s, strlen(xen_prefix))) 170 !strncmp(xen_prefix, s, strlen(xen_prefix)))
173 version = s + strlen(xen_prefix); 171 version = s + strlen(xen_prefix);
174 if (version == NULL) { 172 if (version == NULL) {
175 pr_debug("Xen version not found\n"); 173 pr_debug("Xen version not found\n");
176 return 0; 174 return;
177 } 175 }
178 if (of_address_to_resource(node, GRANT_TABLE_PHYSADDR, &res))
179 return 0;
180 grant_frames = res.start;
181 xen_events_irq = irq_of_parse_and_map(node, 0);
182 pr_info("Xen %s support found, events_irq=%d gnttab_frame=%pa\n",
183 version, xen_events_irq, &grant_frames);
184 176
185 if (xen_events_irq < 0) 177 pr_info("Xen %s support found\n", version);
186 return -ENODEV;
187 178
188 xen_domain_type = XEN_HVM_DOMAIN; 179 xen_domain_type = XEN_HVM_DOMAIN;
189 180
@@ -194,9 +185,34 @@ static int __init xen_guest_init(void)
194 else 185 else
195 xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED); 186 xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED);
196 187
197 if (!shared_info_page) 188 if (!console_set_on_cmdline && !xen_initial_domain())
198 shared_info_page = (struct shared_info *) 189 add_preferred_console("hvc", 0, NULL);
199 get_zeroed_page(GFP_KERNEL); 190}
191
192static int __init xen_guest_init(void)
193{
194 struct xen_add_to_physmap xatp;
195 struct shared_info *shared_info_page = NULL;
196 struct resource res;
197 phys_addr_t grant_frames;
198
199 if (!xen_domain())
200 return 0;
201
202 if (of_address_to_resource(xen_node, GRANT_TABLE_PHYSADDR, &res)) {
203 pr_err("Xen grant table base address not found\n");
204 return -ENODEV;
205 }
206 grant_frames = res.start;
207
208 xen_events_irq = irq_of_parse_and_map(xen_node, 0);
209 if (!xen_events_irq) {
210 pr_err("Xen event channel interrupt not found\n");
211 return -ENODEV;
212 }
213
214 shared_info_page = (struct shared_info *)get_zeroed_page(GFP_KERNEL);
215
200 if (!shared_info_page) { 216 if (!shared_info_page) {
201 pr_err("not enough memory\n"); 217 pr_err("not enough memory\n");
202 return -ENOMEM; 218 return -ENOMEM;
diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c
index 498325074a06..03e75fef15b8 100644
--- a/arch/arm/xen/mm.c
+++ b/arch/arm/xen/mm.c
@@ -15,10 +15,10 @@
15#include <xen/xen.h> 15#include <xen/xen.h>
16#include <xen/interface/grant_table.h> 16#include <xen/interface/grant_table.h>
17#include <xen/interface/memory.h> 17#include <xen/interface/memory.h>
18#include <xen/page.h>
18#include <xen/swiotlb-xen.h> 19#include <xen/swiotlb-xen.h>
19 20
20#include <asm/cacheflush.h> 21#include <asm/cacheflush.h>
21#include <asm/xen/page.h>
22#include <asm/xen/hypercall.h> 22#include <asm/xen/hypercall.h>
23#include <asm/xen/interface.h> 23#include <asm/xen/interface.h>
24 24
diff --git a/arch/arm/xen/p2m.c b/arch/arm/xen/p2m.c
index cb7a14c5cd69..887596c67b12 100644
--- a/arch/arm/xen/p2m.c
+++ b/arch/arm/xen/p2m.c
@@ -10,10 +10,10 @@
10 10
11#include <xen/xen.h> 11#include <xen/xen.h>
12#include <xen/interface/memory.h> 12#include <xen/interface/memory.h>
13#include <xen/page.h>
13#include <xen/swiotlb-xen.h> 14#include <xen/swiotlb-xen.h>
14 15
15#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
16#include <asm/xen/page.h>
17#include <asm/xen/hypercall.h> 17#include <asm/xen/hypercall.h>
18#include <asm/xen/interface.h> 18#include <asm/xen/interface.h>
19 19
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index ffd3970721bf..f3067d4d4e35 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -64,6 +64,7 @@
64#include <asm/psci.h> 64#include <asm/psci.h>
65#include <asm/efi.h> 65#include <asm/efi.h>
66#include <asm/virt.h> 66#include <asm/virt.h>
67#include <asm/xen/hypervisor.h>
67 68
68unsigned long elf_hwcap __read_mostly; 69unsigned long elf_hwcap __read_mostly;
69EXPORT_SYMBOL_GPL(elf_hwcap); 70EXPORT_SYMBOL_GPL(elf_hwcap);
@@ -401,6 +402,7 @@ void __init setup_arch(char **cmdline_p)
401 } else { 402 } else {
402 psci_acpi_init(); 403 psci_acpi_init();
403 } 404 }
405 xen_early_init();
404 406
405 cpu_read_bootcpu_ops(); 407 cpu_read_bootcpu_ops();
406#ifdef CONFIG_SMP 408#ifdef CONFIG_SMP
diff --git a/arch/x86/configs/xen.config b/arch/x86/configs/xen.config
new file mode 100644
index 000000000000..d9fc7139fd46
--- /dev/null
+++ b/arch/x86/configs/xen.config
@@ -0,0 +1,28 @@
1# global x86 required specific stuff
2# On 32-bit HIGHMEM4G is not allowed
3CONFIG_HIGHMEM64G=y
4CONFIG_64BIT=y
5
6# These enable us to allow some of the
7# not so generic stuff below
8CONFIG_HYPERVISOR_GUEST=y
9CONFIG_PCI=y
10CONFIG_PCI_MSI=y
11CONFIG_X86_MCE=y
12CONFIG_ACPI_PROCESSOR=y
13CONFIG_CPU_FREQ=y
14
15# x86 xen specific config options
16CONFIG_XEN_PVH=y
17CONFIG_XEN_MAX_DOMAIN_MEMORY=500
18CONFIG_XEN_SAVE_RESTORE=y
19# CONFIG_XEN_DEBUG_FS is not set
20CONFIG_XEN_MCE_LOG=y
21CONFIG_XEN_ACPI_PROCESSOR=m
22# x86 specific backend drivers
23CONFIG_XEN_PCIDEV_BACKEND=m
24# x86 specific frontend drivers
25CONFIG_XEN_PCIDEV_FRONTEND=m
26# depends on MEMORY_HOTPLUG, arm64 doesn't enable this yet,
27# move to generic config if it ever does.
28CONFIG_XEN_BALLOON_MEMORY_HOTPLUG=y
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index 2126842fb6e8..ced96777b677 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -736,7 +736,7 @@ static void xen_blkbk_unmap_and_respond(struct pending_req *req)
736 struct grant_page **pages = req->segments; 736 struct grant_page **pages = req->segments;
737 unsigned int invcount; 737 unsigned int invcount;
738 738
739 invcount = xen_blkbk_unmap_prepare(blkif, pages, req->nr_pages, 739 invcount = xen_blkbk_unmap_prepare(blkif, pages, req->nr_segs,
740 req->unmap, req->unmap_pages); 740 req->unmap, req->unmap_pages);
741 741
742 work->data = req; 742 work->data = req;
@@ -922,7 +922,7 @@ static int xen_blkbk_map_seg(struct pending_req *pending_req)
922 int rc; 922 int rc;
923 923
924 rc = xen_blkbk_map(pending_req->blkif, pending_req->segments, 924 rc = xen_blkbk_map(pending_req->blkif, pending_req->segments,
925 pending_req->nr_pages, 925 pending_req->nr_segs,
926 (pending_req->operation != BLKIF_OP_READ)); 926 (pending_req->operation != BLKIF_OP_READ));
927 927
928 return rc; 928 return rc;
@@ -938,7 +938,7 @@ static int xen_blkbk_parse_indirect(struct blkif_request *req,
938 int indirect_grefs, rc, n, nseg, i; 938 int indirect_grefs, rc, n, nseg, i;
939 struct blkif_request_segment *segments = NULL; 939 struct blkif_request_segment *segments = NULL;
940 940
941 nseg = pending_req->nr_pages; 941 nseg = pending_req->nr_segs;
942 indirect_grefs = INDIRECT_PAGES(nseg); 942 indirect_grefs = INDIRECT_PAGES(nseg);
943 BUG_ON(indirect_grefs > BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST); 943 BUG_ON(indirect_grefs > BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST);
944 944
@@ -1258,7 +1258,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
1258 pending_req->id = req->u.rw.id; 1258 pending_req->id = req->u.rw.id;
1259 pending_req->operation = req_operation; 1259 pending_req->operation = req_operation;
1260 pending_req->status = BLKIF_RSP_OKAY; 1260 pending_req->status = BLKIF_RSP_OKAY;
1261 pending_req->nr_pages = nseg; 1261 pending_req->nr_segs = nseg;
1262 1262
1263 if (req->operation != BLKIF_OP_INDIRECT) { 1263 if (req->operation != BLKIF_OP_INDIRECT) {
1264 preq.dev = req->u.rw.handle; 1264 preq.dev = req->u.rw.handle;
@@ -1379,7 +1379,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
1379 1379
1380 fail_flush: 1380 fail_flush:
1381 xen_blkbk_unmap(blkif, pending_req->segments, 1381 xen_blkbk_unmap(blkif, pending_req->segments,
1382 pending_req->nr_pages); 1382 pending_req->nr_segs);
1383 fail_response: 1383 fail_response:
1384 /* Haven't submitted any bio's yet. */ 1384 /* Haven't submitted any bio's yet. */
1385 make_response(blkif, req->u.rw.id, req_operation, BLKIF_RSP_ERROR); 1385 make_response(blkif, req->u.rw.id, req_operation, BLKIF_RSP_ERROR);
diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h
index 8ccc49d01c8e..45a044a53d1e 100644
--- a/drivers/block/xen-blkback/common.h
+++ b/drivers/block/xen-blkback/common.h
@@ -345,7 +345,7 @@ struct grant_page {
345struct pending_req { 345struct pending_req {
346 struct xen_blkif *blkif; 346 struct xen_blkif *blkif;
347 u64 id; 347 u64 id;
348 int nr_pages; 348 int nr_segs;
349 atomic_t pendcnt; 349 atomic_t pendcnt;
350 unsigned short operation; 350 unsigned short operation;
351 int status; 351 int status;
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index fc770b7d3beb..6d89ed35d80c 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -1074,12 +1074,6 @@ static void blkif_completion(struct blk_shadow *s, struct blkfront_info *info,
1074 s->req.u.indirect.nr_segments : s->req.u.rw.nr_segments; 1074 s->req.u.indirect.nr_segments : s->req.u.rw.nr_segments;
1075 1075
1076 if (bret->operation == BLKIF_OP_READ && info->feature_persistent) { 1076 if (bret->operation == BLKIF_OP_READ && info->feature_persistent) {
1077 /*
1078 * Copy the data received from the backend into the bvec.
1079 * Since bv_offset can be different than 0, and bv_len different
1080 * than PAGE_SIZE, we have to keep track of the current offset,
1081 * to be sure we are copying the data from the right shared page.
1082 */
1083 for_each_sg(s->sg, sg, nseg, i) { 1077 for_each_sg(s->sg, sg, nseg, i) {
1084 BUG_ON(sg->offset + sg->length > PAGE_SIZE); 1078 BUG_ON(sg->offset + sg->length > PAGE_SIZE);
1085 shared_data = kmap_atomic( 1079 shared_data = kmap_atomic(
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 5485f91294e7..880d0d63e872 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -44,9 +44,9 @@
44#include <xen/xen.h> 44#include <xen/xen.h>
45#include <xen/events.h> 45#include <xen/events.h>
46#include <xen/interface/memory.h> 46#include <xen/interface/memory.h>
47#include <xen/page.h>
47 48
48#include <asm/xen/hypercall.h> 49#include <asm/xen/hypercall.h>
49#include <asm/xen/page.h>
50 50
51/* Provide an option to disable split event channels at load time as 51/* Provide an option to disable split event channels at load time as
52 * event channels are limited resource. Split event channels are 52 * event channels are limited resource. Split event channels are
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 56d8afd11077..b3e9491bc8ec 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -45,7 +45,6 @@
45#include <linux/slab.h> 45#include <linux/slab.h>
46#include <net/ip.h> 46#include <net/ip.h>
47 47
48#include <asm/xen/page.h>
49#include <xen/xen.h> 48#include <xen/xen.h>
50#include <xen/xenbus.h> 49#include <xen/xenbus.h>
51#include <xen/events.h> 50#include <xen/events.h>
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index 240f38872085..8b7a900cd28b 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -20,6 +20,7 @@
20#include <linux/workqueue.h> 20#include <linux/workqueue.h>
21#include <linux/bitops.h> 21#include <linux/bitops.h>
22#include <linux/time.h> 22#include <linux/time.h>
23#include <linux/ktime.h>
23#include <xen/platform_pci.h> 24#include <xen/platform_pci.h>
24 25
25#include <asm/xen/swiotlb-xen.h> 26#include <asm/xen/swiotlb-xen.h>
@@ -115,7 +116,6 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
115 evtchn_port_t port = pdev->evtchn; 116 evtchn_port_t port = pdev->evtchn;
116 unsigned irq = pdev->irq; 117 unsigned irq = pdev->irq;
117 s64 ns, ns_timeout; 118 s64 ns, ns_timeout;
118 struct timeval tv;
119 119
120 spin_lock_irqsave(&pdev->sh_info_lock, irq_flags); 120 spin_lock_irqsave(&pdev->sh_info_lock, irq_flags);
121 121
@@ -132,8 +132,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
132 * (in the latter case we end up continually re-executing poll() with a 132 * (in the latter case we end up continually re-executing poll() with a
133 * timeout in the past). 1s difference gives plenty of slack for error. 133 * timeout in the past). 1s difference gives plenty of slack for error.
134 */ 134 */
135 do_gettimeofday(&tv); 135 ns_timeout = ktime_get_ns() + 2 * (s64)NSEC_PER_SEC;
136 ns_timeout = timeval_to_ns(&tv) + 2 * (s64)NSEC_PER_SEC;
137 136
138 xen_clear_irq_pending(irq); 137 xen_clear_irq_pending(irq);
139 138
@@ -141,8 +140,7 @@ static int do_pci_op(struct pcifront_device *pdev, struct xen_pci_op *op)
141 (unsigned long *)&pdev->sh_info->flags)) { 140 (unsigned long *)&pdev->sh_info->flags)) {
142 xen_poll_irq_timeout(irq, jiffies + 3*HZ); 141 xen_poll_irq_timeout(irq, jiffies + 3*HZ);
143 xen_clear_irq_pending(irq); 142 xen_clear_irq_pending(irq);
144 do_gettimeofday(&tv); 143 ns = ktime_get_ns();
145 ns = timeval_to_ns(&tv);
146 if (ns > ns_timeout) { 144 if (ns > ns_timeout) {
147 dev_err(&pdev->xdev->dev, 145 dev_err(&pdev->xdev->dev,
148 "pciback not responding!!!\n"); 146 "pciback not responding!!!\n");
diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c
index 7a3d146a5f0e..a9d837f83ce8 100644
--- a/drivers/tty/hvc/hvc_xen.c
+++ b/drivers/tty/hvc/hvc_xen.c
@@ -302,7 +302,7 @@ static int xen_initial_domain_console_init(void)
302static void xen_console_update_evtchn(struct xencons_info *info) 302static void xen_console_update_evtchn(struct xencons_info *info)
303{ 303{
304 if (xen_hvm_domain()) { 304 if (xen_hvm_domain()) {
305 uint64_t v; 305 uint64_t v = 0;
306 int err; 306 int err;
307 307
308 err = hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN, &v); 308 err = hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN, &v);
diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
index 38387950490e..96093ae369a5 100644
--- a/drivers/xen/events/events_base.c
+++ b/drivers/xen/events/events_base.c
@@ -39,8 +39,8 @@
39#include <asm/irq.h> 39#include <asm/irq.h>
40#include <asm/idle.h> 40#include <asm/idle.h>
41#include <asm/io_apic.h> 41#include <asm/io_apic.h>
42#include <asm/xen/page.h>
43#include <asm/xen/pci.h> 42#include <asm/xen/pci.h>
43#include <xen/page.h>
44#endif 44#endif
45#include <asm/sync_bitops.h> 45#include <asm/sync_bitops.h>
46#include <asm/xen/hypercall.h> 46#include <asm/xen/hypercall.h>
diff --git a/drivers/xen/events/events_fifo.c b/drivers/xen/events/events_fifo.c
index 417415d738d0..ed673e1acd61 100644
--- a/drivers/xen/events/events_fifo.c
+++ b/drivers/xen/events/events_fifo.c
@@ -44,13 +44,13 @@
44#include <asm/sync_bitops.h> 44#include <asm/sync_bitops.h>
45#include <asm/xen/hypercall.h> 45#include <asm/xen/hypercall.h>
46#include <asm/xen/hypervisor.h> 46#include <asm/xen/hypervisor.h>
47#include <asm/xen/page.h>
48 47
49#include <xen/xen.h> 48#include <xen/xen.h>
50#include <xen/xen-ops.h> 49#include <xen/xen-ops.h>
51#include <xen/events.h> 50#include <xen/events.h>
52#include <xen/interface/xen.h> 51#include <xen/interface/xen.h>
53#include <xen/interface/event_channel.h> 52#include <xen/interface/event_channel.h>
53#include <xen/page.h>
54 54
55#include "events_internal.h" 55#include "events_internal.h"
56 56
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
index 89274850741b..67b9163db718 100644
--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -41,9 +41,9 @@
41#include <xen/balloon.h> 41#include <xen/balloon.h>
42#include <xen/gntdev.h> 42#include <xen/gntdev.h>
43#include <xen/events.h> 43#include <xen/events.h>
44#include <xen/page.h>
44#include <asm/xen/hypervisor.h> 45#include <asm/xen/hypervisor.h>
45#include <asm/xen/hypercall.h> 46#include <asm/xen/hypercall.h>
46#include <asm/xen/page.h>
47 47
48MODULE_LICENSE("GPL"); 48MODULE_LICENSE("GPL");
49MODULE_AUTHOR("Derek G. Murray <Derek.Murray@cl.cam.ac.uk>, " 49MODULE_AUTHOR("Derek G. Murray <Derek.Murray@cl.cam.ac.uk>, "
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index b1c7170e5c9e..62f591f8763c 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -138,7 +138,6 @@ static struct gnttab_free_callback *gnttab_free_callback_list;
138static int gnttab_expand(unsigned int req_entries); 138static int gnttab_expand(unsigned int req_entries);
139 139
140#define RPP (PAGE_SIZE / sizeof(grant_ref_t)) 140#define RPP (PAGE_SIZE / sizeof(grant_ref_t))
141#define SPP (PAGE_SIZE / sizeof(grant_status_t))
142 141
143static inline grant_ref_t *__gnttab_entry(grant_ref_t entry) 142static inline grant_ref_t *__gnttab_entry(grant_ref_t entry)
144{ 143{
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
index 9e6a85104a20..d10effee9b9e 100644
--- a/drivers/xen/manage.c
+++ b/drivers/xen/manage.c
@@ -19,10 +19,10 @@
19#include <xen/grant_table.h> 19#include <xen/grant_table.h>
20#include <xen/events.h> 20#include <xen/events.h>
21#include <xen/hvc-console.h> 21#include <xen/hvc-console.h>
22#include <xen/page.h>
22#include <xen/xen-ops.h> 23#include <xen/xen-ops.h>
23 24
24#include <asm/xen/hypercall.h> 25#include <asm/xen/hypercall.h>
25#include <asm/xen/page.h>
26#include <asm/xen/hypervisor.h> 26#include <asm/xen/hypervisor.h>
27 27
28enum shutdown_state { 28enum shutdown_state {
diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c
index d88f36754bf7..239738f944ba 100644
--- a/drivers/xen/tmem.c
+++ b/drivers/xen/tmem.c
@@ -17,8 +17,8 @@
17 17
18#include <xen/xen.h> 18#include <xen/xen.h>
19#include <xen/interface/xen.h> 19#include <xen/interface/xen.h>
20#include <xen/page.h>
20#include <asm/xen/hypercall.h> 21#include <asm/xen/hypercall.h>
21#include <asm/xen/page.h>
22#include <asm/xen/hypervisor.h> 22#include <asm/xen/hypervisor.h>
23#include <xen/tmem.h> 23#include <xen/tmem.h>
24 24
@@ -389,7 +389,7 @@ static int __init xen_tmem_init(void)
389 } 389 }
390#endif 390#endif
391#ifdef CONFIG_CLEANCACHE 391#ifdef CONFIG_CLEANCACHE
392 BUG_ON(sizeof(struct cleancache_filekey) != sizeof(struct tmem_oid)); 392 BUILD_BUG_ON(sizeof(struct cleancache_filekey) != sizeof(struct tmem_oid));
393 if (tmem_enabled && cleancache) { 393 if (tmem_enabled && cleancache) {
394 int err; 394 int err;
395 395
diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
index 96b2011d25f3..9ad327238ba9 100644
--- a/drivers/xen/xenbus/xenbus_client.c
+++ b/drivers/xen/xenbus/xenbus_client.c
@@ -37,7 +37,7 @@
37#include <linux/vmalloc.h> 37#include <linux/vmalloc.h>
38#include <linux/export.h> 38#include <linux/export.h>
39#include <asm/xen/hypervisor.h> 39#include <asm/xen/hypervisor.h>
40#include <asm/xen/page.h> 40#include <xen/page.h>
41#include <xen/interface/xen.h> 41#include <xen/interface/xen.h>
42#include <xen/interface/event_channel.h> 42#include <xen/interface/event_channel.h>
43#include <xen/balloon.h> 43#include <xen/balloon.h>
@@ -379,16 +379,16 @@ int xenbus_grant_ring(struct xenbus_device *dev, void *vaddr,
379 int i, j; 379 int i, j;
380 380
381 for (i = 0; i < nr_pages; i++) { 381 for (i = 0; i < nr_pages; i++) {
382 unsigned long addr = (unsigned long)vaddr +
383 (PAGE_SIZE * i);
384 err = gnttab_grant_foreign_access(dev->otherend_id, 382 err = gnttab_grant_foreign_access(dev->otherend_id,
385 virt_to_mfn(addr), 0); 383 virt_to_mfn(vaddr), 0);
386 if (err < 0) { 384 if (err < 0) {
387 xenbus_dev_fatal(dev, err, 385 xenbus_dev_fatal(dev, err,
388 "granting access to ring page"); 386 "granting access to ring page");
389 goto fail; 387 goto fail;
390 } 388 }
391 grefs[i] = err; 389 grefs[i] = err;
390
391 vaddr = vaddr + PAGE_SIZE;
392 } 392 }
393 393
394 return 0; 394 return 0;
diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index 5390a674b5e3..4308fb3cf7c2 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -742,7 +742,7 @@ static int xenbus_resume_cb(struct notifier_block *nb,
742 int err = 0; 742 int err = 0;
743 743
744 if (xen_hvm_domain()) { 744 if (xen_hvm_domain()) {
745 uint64_t v; 745 uint64_t v = 0;
746 746
747 err = hvm_get_parameter(HVM_PARAM_STORE_EVTCHN, &v); 747 err = hvm_get_parameter(HVM_PARAM_STORE_EVTCHN, &v);
748 if (!err && v) 748 if (!err && v)
diff --git a/kernel/configs/xen.config b/kernel/configs/xen.config
new file mode 100644
index 000000000000..ff756221f112
--- /dev/null
+++ b/kernel/configs/xen.config
@@ -0,0 +1,48 @@
1# global stuff - these enable us to allow some
2# of the not so generic stuff below for xen
3CONFIG_PARAVIRT=y
4CONFIG_NET=y
5CONFIG_NET_CORE=y
6CONFIG_NETDEVICES=y
7CONFIG_BLOCK=y
8CONFIG_WATCHDOG=y
9CONFIG_TARGET_CORE=y
10CONFIG_SCSI=y
11CONFIG_FB=y
12CONFIG_INPUT_MISC=y
13CONFIG_MEMORY_HOTPLUG=y
14CONFIG_TTY=y
15# Technically not required but otherwise produces
16# pretty useless systems starting from allnoconfig
17# You want TCP/IP and ELF binaries right?
18CONFIG_INET=y
19CONFIG_BINFMT_ELF=y
20# generic config
21CONFIG_XEN=y
22CONFIG_XEN_DOM0=y
23# backend drivers
24CONFIG_XEN_BACKEND=y
25CONFIG_XEN_BLKDEV_BACKEND=m
26CONFIG_XEN_NETDEV_BACKEND=m
27CONFIG_HVC_XEN=y
28CONFIG_XEN_WDT=m
29CONFIG_XEN_SCSI_BACKEND=m
30# frontend drivers
31CONFIG_XEN_FBDEV_FRONTEND=m
32CONFIG_HVC_XEN_FRONTEND=y
33CONFIG_INPUT_XEN_KBDDEV_FRONTEND=m
34CONFIG_XEN_SCSI_FRONTEND=m
35# others
36CONFIG_XEN_BALLOON=y
37CONFIG_XEN_SCRUB_PAGES=y
38CONFIG_XEN_DEV_EVTCHN=m
39CONFIG_XEN_BLKDEV_FRONTEND=m
40CONFIG_XEN_NETDEV_FRONTEND=m
41CONFIG_XENFS=m
42CONFIG_XEN_COMPAT_XENFS=y
43CONFIG_XEN_SYS_HYPERVISOR=y
44CONFIG_XEN_XENBUS_FRONTEND=y
45CONFIG_XEN_GNTDEV=m
46CONFIG_XEN_GRANT_DEV_ALLOC=m
47CONFIG_SWIOTLB_XEN=y
48CONFIG_XEN_PRIVCMD=m
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index d9b1fef0c67e..f52abae0ec5f 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -115,6 +115,10 @@ PHONY += kvmconfig
115kvmconfig: kvm_guest.config 115kvmconfig: kvm_guest.config
116 @: 116 @:
117 117
118PHONY += xenconfig
119xenconfig: xen.config
120 @:
121
118PHONY += tinyconfig 122PHONY += tinyconfig
119tinyconfig: 123tinyconfig:
120 $(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config 124 $(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config
@@ -139,7 +143,8 @@ help:
139 @echo ' randconfig - New config with random answer to all options' 143 @echo ' randconfig - New config with random answer to all options'
140 @echo ' listnewconfig - List new options' 144 @echo ' listnewconfig - List new options'
141 @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value' 145 @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value'
142 @echo ' kvmconfig - Enable additional options for guest kernel support' 146 @echo ' kvmconfig - Enable additional options for kvm guest kernel support'
147 @echo ' xenconfig - Enable additional options for xen dom0 and guest kernel support'
143 @echo ' tinyconfig - Configure the tiniest possible kernel' 148 @echo ' tinyconfig - Configure the tiniest possible kernel'
144 149
145# lxdialog stuff 150# lxdialog stuff