Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+157 -59
+8
arch/arm/include/asm/xen/hypervisor.h
··· 1 1 #ifndef _ASM_ARM_XEN_HYPERVISOR_H 2 2 #define _ASM_ARM_XEN_HYPERVISOR_H 3 3 4 + #include <linux/init.h> 5 + 4 6 extern struct shared_info *HYPERVISOR_shared_info; 5 7 extern struct start_info *xen_start_info; 6 8 ··· 19 17 } 20 18 21 19 extern struct dma_map_ops *xen_dma_ops; 20 + 21 + #ifdef CONFIG_XEN 22 + void __init xen_early_init(void); 23 + #else 24 + static inline void xen_early_init(void) { return; } 25 + #endif 22 26 23 27 #endif /* _ASM_ARM_XEN_HYPERVISOR_H */
-1
arch/arm/include/asm/xen/page.h
··· 12 12 #include <xen/interface/grant_table.h> 13 13 14 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 16 #define pte_mfn pte_pfn 18 17 #define mfn_pte pfn_pte
+2
arch/arm/kernel/setup.c
··· 46 46 #include <asm/cacheflush.h> 47 47 #include <asm/cachetype.h> 48 48 #include <asm/tlbflush.h> 49 + #include <asm/xen/hypervisor.h> 49 50 50 51 #include <asm/prom.h> 51 52 #include <asm/mach/arch.h> ··· 973 972 974 973 arm_dt_init_cpu_maps(); 975 974 psci_init(); 975 + xen_early_init(); 976 976 #ifdef CONFIG_SMP 977 977 if (is_smp()) { 978 978 if (!mdesc->smp_init || !mdesc->smp_init()) {
+39 -23
arch/arm/xen/enlighten.c
··· 24 24 #include <linux/cpuidle.h> 25 25 #include <linux/cpufreq.h> 26 26 #include <linux/cpu.h> 27 + #include <linux/console.h> 27 28 28 29 #include <linux/mm.h> 29 30 ··· 52 51 int xen_platform_pci_unplug = XEN_UNPLUG_ALL; 53 52 EXPORT_SYMBOL_GPL(xen_platform_pci_unplug); 54 53 55 - static __read_mostly int xen_events_irq = -1; 54 + static __read_mostly unsigned int xen_events_irq; 55 + 56 + static __initdata struct device_node *xen_node; 56 57 57 58 int xen_remap_domain_mfn_array(struct vm_area_struct *vma, 58 59 unsigned long addr, ··· 153 150 * documentation of the Xen Device Tree format. 154 151 */ 155 152 #define GRANT_TABLE_PHYSADDR 0 156 - static int __init xen_guest_init(void) 153 + void __init xen_early_init(void) 157 154 { 158 - struct xen_add_to_physmap xatp; 159 - static struct shared_info *shared_info_page = 0; 160 - struct device_node *node; 161 155 int len; 162 156 const char *s = NULL; 163 157 const char *version = NULL; 164 158 const char *xen_prefix = "xen,xen-"; 165 - struct resource res; 166 - phys_addr_t grant_frames; 167 159 168 - node = of_find_compatible_node(NULL, NULL, "xen,xen"); 169 - if (!node) { 160 + xen_node = of_find_compatible_node(NULL, NULL, "xen,xen"); 161 + if (!xen_node) { 170 162 pr_debug("No Xen support\n"); 171 - return 0; 163 + return; 172 164 } 173 - s = of_get_property(node, "compatible", &len); 165 + s = of_get_property(xen_node, "compatible", &len); 174 166 if (strlen(xen_prefix) + 3 < len && 175 167 !strncmp(xen_prefix, s, strlen(xen_prefix))) 176 168 version = s + strlen(xen_prefix); 177 169 if (version == NULL) { 178 170 pr_debug("Xen version not found\n"); 179 - return 0; 171 + return; 180 172 } 181 - if (of_address_to_resource(node, GRANT_TABLE_PHYSADDR, &res)) 182 - return 0; 183 - grant_frames = res.start; 184 - xen_events_irq = irq_of_parse_and_map(node, 0); 185 - pr_info("Xen %s support found, events_irq=%d gnttab_frame=%pa\n", 186 - version, xen_events_irq, &grant_frames); 187 173 188 - if (xen_events_irq < 0) 189 - return -ENODEV; 174 + pr_info("Xen %s support found\n", version); 190 175 191 176 xen_domain_type = XEN_HVM_DOMAIN; 192 177 ··· 185 194 else 186 195 xen_start_info->flags &= ~(SIF_INITDOMAIN|SIF_PRIVILEGED); 187 196 188 - if (!shared_info_page) 189 - shared_info_page = (struct shared_info *) 190 - get_zeroed_page(GFP_KERNEL); 197 + if (!console_set_on_cmdline && !xen_initial_domain()) 198 + add_preferred_console("hvc", 0, NULL); 199 + } 200 + 201 + static int __init xen_guest_init(void) 202 + { 203 + struct xen_add_to_physmap xatp; 204 + struct shared_info *shared_info_page = NULL; 205 + struct resource res; 206 + phys_addr_t grant_frames; 207 + 208 + if (!xen_domain()) 209 + return 0; 210 + 211 + if (of_address_to_resource(xen_node, GRANT_TABLE_PHYSADDR, &res)) { 212 + pr_err("Xen grant table base address not found\n"); 213 + return -ENODEV; 214 + } 215 + grant_frames = res.start; 216 + 217 + xen_events_irq = irq_of_parse_and_map(xen_node, 0); 218 + if (!xen_events_irq) { 219 + pr_err("Xen event channel interrupt not found\n"); 220 + return -ENODEV; 221 + } 222 + 223 + shared_info_page = (struct shared_info *)get_zeroed_page(GFP_KERNEL); 224 + 191 225 if (!shared_info_page) { 192 226 pr_err("not enough memory\n"); 193 227 return -ENOMEM;
+1 -1
arch/arm/xen/mm.c
··· 15 15 #include <xen/xen.h> 16 16 #include <xen/interface/grant_table.h> 17 17 #include <xen/interface/memory.h> 18 + #include <xen/page.h> 18 19 #include <xen/swiotlb-xen.h> 19 20 20 21 #include <asm/cacheflush.h> 21 - #include <asm/xen/page.h> 22 22 #include <asm/xen/hypercall.h> 23 23 #include <asm/xen/interface.h> 24 24
+1 -1
arch/arm/xen/p2m.c
··· 10 10 11 11 #include <xen/xen.h> 12 12 #include <xen/interface/memory.h> 13 + #include <xen/page.h> 13 14 #include <xen/swiotlb-xen.h> 14 15 15 16 #include <asm/cacheflush.h> 16 - #include <asm/xen/page.h> 17 17 #include <asm/xen/hypercall.h> 18 18 #include <asm/xen/interface.h> 19 19
+2
arch/arm64/kernel/setup.c
··· 64 64 #include <asm/psci.h> 65 65 #include <asm/efi.h> 66 66 #include <asm/virt.h> 67 + #include <asm/xen/hypervisor.h> 67 68 68 69 unsigned long elf_hwcap __read_mostly; 69 70 EXPORT_SYMBOL_GPL(elf_hwcap); ··· 402 401 } else { 403 402 psci_acpi_init(); 404 403 } 404 + xen_early_init(); 405 405 406 406 cpu_read_bootcpu_ops(); 407 407 #ifdef CONFIG_SMP
+28
arch/x86/configs/xen.config
··· 1 + # global x86 required specific stuff 2 + # On 32-bit HIGHMEM4G is not allowed 3 + CONFIG_HIGHMEM64G=y 4 + CONFIG_64BIT=y 5 + 6 + # These enable us to allow some of the 7 + # not so generic stuff below 8 + CONFIG_HYPERVISOR_GUEST=y 9 + CONFIG_PCI=y 10 + CONFIG_PCI_MSI=y 11 + CONFIG_X86_MCE=y 12 + CONFIG_ACPI_PROCESSOR=y 13 + CONFIG_CPU_FREQ=y 14 + 15 + # x86 xen specific config options 16 + CONFIG_XEN_PVH=y 17 + CONFIG_XEN_MAX_DOMAIN_MEMORY=500 18 + CONFIG_XEN_SAVE_RESTORE=y 19 + # CONFIG_XEN_DEBUG_FS is not set 20 + CONFIG_XEN_MCE_LOG=y 21 + CONFIG_XEN_ACPI_PROCESSOR=m 22 + # x86 specific backend drivers 23 + CONFIG_XEN_PCIDEV_BACKEND=m 24 + # x86 specific frontend drivers 25 + CONFIG_XEN_PCIDEV_FRONTEND=m 26 + # depends on MEMORY_HOTPLUG, arm64 doesn't enable this yet, 27 + # move to generic config if it ever does. 28 + CONFIG_XEN_BALLOON_MEMORY_HOTPLUG=y
+5 -5
drivers/block/xen-blkback/blkback.c
··· 736 736 struct grant_page **pages = req->segments; 737 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 740 req->unmap, req->unmap_pages); 741 741 742 742 work->data = req; ··· 922 922 int rc; 923 923 924 924 rc = xen_blkbk_map(pending_req->blkif, pending_req->segments, 925 - pending_req->nr_pages, 925 + pending_req->nr_segs, 926 926 (pending_req->operation != BLKIF_OP_READ)); 927 927 928 928 return rc; ··· 938 938 int indirect_grefs, rc, n, nseg, i; 939 939 struct blkif_request_segment *segments = NULL; 940 940 941 - nseg = pending_req->nr_pages; 941 + nseg = pending_req->nr_segs; 942 942 indirect_grefs = INDIRECT_PAGES(nseg); 943 943 BUG_ON(indirect_grefs > BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST); 944 944 ··· 1258 1258 pending_req->id = req->u.rw.id; 1259 1259 pending_req->operation = req_operation; 1260 1260 pending_req->status = BLKIF_RSP_OKAY; 1261 - pending_req->nr_pages = nseg; 1261 + pending_req->nr_segs = nseg; 1262 1262 1263 1263 if (req->operation != BLKIF_OP_INDIRECT) { 1264 1264 preq.dev = req->u.rw.handle; ··· 1379 1379 1380 1380 fail_flush: 1381 1381 xen_blkbk_unmap(blkif, pending_req->segments, 1382 - pending_req->nr_pages); 1382 + pending_req->nr_segs); 1383 1383 fail_response: 1384 1384 /* Haven't submitted any bio's yet. */ 1385 1385 make_response(blkif, req->u.rw.id, req_operation, BLKIF_RSP_ERROR);
+1 -1
drivers/block/xen-blkback/common.h
··· 345 345 struct pending_req { 346 346 struct xen_blkif *blkif; 347 347 u64 id; 348 - int nr_pages; 348 + int nr_segs; 349 349 atomic_t pendcnt; 350 350 unsigned short operation; 351 351 int status;
-6
drivers/block/xen-blkfront.c
··· 1074 1074 s->req.u.indirect.nr_segments : s->req.u.rw.nr_segments; 1075 1075 1076 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 1077 for_each_sg(s->sg, sg, nseg, i) { 1084 1078 BUG_ON(sg->offset + sg->length > PAGE_SIZE); 1085 1079 shared_data = kmap_atomic(
+1 -1
drivers/net/xen-netback/netback.c
··· 44 44 #include <xen/xen.h> 45 45 #include <xen/events.h> 46 46 #include <xen/interface/memory.h> 47 + #include <xen/page.h> 47 48 48 49 #include <asm/xen/hypercall.h> 49 - #include <asm/xen/page.h> 50 50 51 51 /* Provide an option to disable split event channels at load time as 52 52 * event channels are limited resource. Split event channels are
-1
drivers/net/xen-netfront.c
··· 45 45 #include <linux/slab.h> 46 46 #include <net/ip.h> 47 47 48 - #include <asm/xen/page.h> 49 48 #include <xen/xen.h> 50 49 #include <xen/xenbus.h> 51 50 #include <xen/events.h>
+3 -5
drivers/pci/xen-pcifront.c
··· 20 20 #include <linux/workqueue.h> 21 21 #include <linux/bitops.h> 22 22 #include <linux/time.h> 23 + #include <linux/ktime.h> 23 24 #include <xen/platform_pci.h> 24 25 25 26 #include <asm/xen/swiotlb-xen.h> ··· 116 115 evtchn_port_t port = pdev->evtchn; 117 116 unsigned irq = pdev->irq; 118 117 s64 ns, ns_timeout; 119 - struct timeval tv; 120 118 121 119 spin_lock_irqsave(&pdev->sh_info_lock, irq_flags); 122 120 ··· 132 132 * (in the latter case we end up continually re-executing poll() with a 133 133 * timeout in the past). 1s difference gives plenty of slack for error. 134 134 */ 135 - do_gettimeofday(&tv); 136 - ns_timeout = timeval_to_ns(&tv) + 2 * (s64)NSEC_PER_SEC; 135 + ns_timeout = ktime_get_ns() + 2 * (s64)NSEC_PER_SEC; 137 136 138 137 xen_clear_irq_pending(irq); 139 138 ··· 140 141 (unsigned long *)&pdev->sh_info->flags)) { 141 142 xen_poll_irq_timeout(irq, jiffies + 3*HZ); 142 143 xen_clear_irq_pending(irq); 143 - do_gettimeofday(&tv); 144 - ns = timeval_to_ns(&tv); 144 + ns = ktime_get_ns(); 145 145 if (ns > ns_timeout) { 146 146 dev_err(&pdev->xdev->dev, 147 147 "pciback not responding!!!\n");
+1 -1
drivers/tty/hvc/hvc_xen.c
··· 302 302 static void xen_console_update_evtchn(struct xencons_info *info) 303 303 { 304 304 if (xen_hvm_domain()) { 305 - uint64_t v; 305 + uint64_t v = 0; 306 306 int err; 307 307 308 308 err = hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN, &v);
+1 -1
drivers/xen/events/events_base.c
··· 39 39 #include <asm/irq.h> 40 40 #include <asm/idle.h> 41 41 #include <asm/io_apic.h> 42 - #include <asm/xen/page.h> 43 42 #include <asm/xen/pci.h> 43 + #include <xen/page.h> 44 44 #endif 45 45 #include <asm/sync_bitops.h> 46 46 #include <asm/xen/hypercall.h>
+1 -1
drivers/xen/events/events_fifo.c
··· 44 44 #include <asm/sync_bitops.h> 45 45 #include <asm/xen/hypercall.h> 46 46 #include <asm/xen/hypervisor.h> 47 - #include <asm/xen/page.h> 48 47 49 48 #include <xen/xen.h> 50 49 #include <xen/xen-ops.h> 51 50 #include <xen/events.h> 52 51 #include <xen/interface/xen.h> 53 52 #include <xen/interface/event_channel.h> 53 + #include <xen/page.h> 54 54 55 55 #include "events_internal.h" 56 56
+1 -1
drivers/xen/gntdev.c
··· 41 41 #include <xen/balloon.h> 42 42 #include <xen/gntdev.h> 43 43 #include <xen/events.h> 44 + #include <xen/page.h> 44 45 #include <asm/xen/hypervisor.h> 45 46 #include <asm/xen/hypercall.h> 46 - #include <asm/xen/page.h> 47 47 48 48 MODULE_LICENSE("GPL"); 49 49 MODULE_AUTHOR("Derek G. Murray <Derek.Murray@cl.cam.ac.uk>, "
-1
drivers/xen/grant-table.c
··· 138 138 static int gnttab_expand(unsigned int req_entries); 139 139 140 140 #define RPP (PAGE_SIZE / sizeof(grant_ref_t)) 141 - #define SPP (PAGE_SIZE / sizeof(grant_status_t)) 142 141 143 142 static inline grant_ref_t *__gnttab_entry(grant_ref_t entry) 144 143 {
+1 -1
drivers/xen/manage.c
··· 19 19 #include <xen/grant_table.h> 20 20 #include <xen/events.h> 21 21 #include <xen/hvc-console.h> 22 + #include <xen/page.h> 22 23 #include <xen/xen-ops.h> 23 24 24 25 #include <asm/xen/hypercall.h> 25 - #include <asm/xen/page.h> 26 26 #include <asm/xen/hypervisor.h> 27 27 28 28 enum shutdown_state {
+2 -2
drivers/xen/tmem.c
··· 17 17 18 18 #include <xen/xen.h> 19 19 #include <xen/interface/xen.h> 20 + #include <xen/page.h> 20 21 #include <asm/xen/hypercall.h> 21 - #include <asm/xen/page.h> 22 22 #include <asm/xen/hypervisor.h> 23 23 #include <xen/tmem.h> 24 24 ··· 389 389 } 390 390 #endif 391 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 393 if (tmem_enabled && cleancache) { 394 394 int err; 395 395
+4 -4
drivers/xen/xenbus/xenbus_client.c
··· 37 37 #include <linux/vmalloc.h> 38 38 #include <linux/export.h> 39 39 #include <asm/xen/hypervisor.h> 40 - #include <asm/xen/page.h> 40 + #include <xen/page.h> 41 41 #include <xen/interface/xen.h> 42 42 #include <xen/interface/event_channel.h> 43 43 #include <xen/balloon.h> ··· 379 379 int i, j; 380 380 381 381 for (i = 0; i < nr_pages; i++) { 382 - unsigned long addr = (unsigned long)vaddr + 383 - (PAGE_SIZE * i); 384 382 err = gnttab_grant_foreign_access(dev->otherend_id, 385 - virt_to_mfn(addr), 0); 383 + virt_to_mfn(vaddr), 0); 386 384 if (err < 0) { 387 385 xenbus_dev_fatal(dev, err, 388 386 "granting access to ring page"); 389 387 goto fail; 390 388 } 391 389 grefs[i] = err; 390 + 391 + vaddr = vaddr + PAGE_SIZE; 392 392 } 393 393 394 394 return 0;
+1 -1
drivers/xen/xenbus/xenbus_probe.c
··· 742 742 int err = 0; 743 743 744 744 if (xen_hvm_domain()) { 745 - uint64_t v; 745 + uint64_t v = 0; 746 746 747 747 err = hvm_get_parameter(HVM_PARAM_STORE_EVTCHN, &v); 748 748 if (!err && v)
+48
kernel/configs/xen.config
··· 1 + # global stuff - these enable us to allow some 2 + # of the not so generic stuff below for xen 3 + CONFIG_PARAVIRT=y 4 + CONFIG_NET=y 5 + CONFIG_NET_CORE=y 6 + CONFIG_NETDEVICES=y 7 + CONFIG_BLOCK=y 8 + CONFIG_WATCHDOG=y 9 + CONFIG_TARGET_CORE=y 10 + CONFIG_SCSI=y 11 + CONFIG_FB=y 12 + CONFIG_INPUT_MISC=y 13 + CONFIG_MEMORY_HOTPLUG=y 14 + CONFIG_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? 18 + CONFIG_INET=y 19 + CONFIG_BINFMT_ELF=y 20 + # generic config 21 + CONFIG_XEN=y 22 + CONFIG_XEN_DOM0=y 23 + # backend drivers 24 + CONFIG_XEN_BACKEND=y 25 + CONFIG_XEN_BLKDEV_BACKEND=m 26 + CONFIG_XEN_NETDEV_BACKEND=m 27 + CONFIG_HVC_XEN=y 28 + CONFIG_XEN_WDT=m 29 + CONFIG_XEN_SCSI_BACKEND=m 30 + # frontend drivers 31 + CONFIG_XEN_FBDEV_FRONTEND=m 32 + CONFIG_HVC_XEN_FRONTEND=y 33 + CONFIG_INPUT_XEN_KBDDEV_FRONTEND=m 34 + CONFIG_XEN_SCSI_FRONTEND=m 35 + # others 36 + CONFIG_XEN_BALLOON=y 37 + CONFIG_XEN_SCRUB_PAGES=y 38 + CONFIG_XEN_DEV_EVTCHN=m 39 + CONFIG_XEN_BLKDEV_FRONTEND=m 40 + CONFIG_XEN_NETDEV_FRONTEND=m 41 + CONFIG_XENFS=m 42 + CONFIG_XEN_COMPAT_XENFS=y 43 + CONFIG_XEN_SYS_HYPERVISOR=y 44 + CONFIG_XEN_XENBUS_FRONTEND=y 45 + CONFIG_XEN_GNTDEV=m 46 + CONFIG_XEN_GRANT_DEV_ALLOC=m 47 + CONFIG_SWIOTLB_XEN=y 48 + CONFIG_XEN_PRIVCMD=m
+6 -1
scripts/kconfig/Makefile
··· 115 115 kvmconfig: kvm_guest.config 116 116 @: 117 117 118 + PHONY += xenconfig 119 + xenconfig: xen.config 120 + @: 121 + 118 122 PHONY += tinyconfig 119 123 tinyconfig: 120 124 $(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config ··· 143 139 @echo ' randconfig - New config with random answer to all options' 144 140 @echo ' listnewconfig - List new options' 145 141 @echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value' 146 - @echo ' kvmconfig - Enable additional options for guest kernel support' 142 + @echo ' kvmconfig - Enable additional options for kvm guest kernel support' 143 + @echo ' xenconfig - Enable additional options for xen dom0 and guest kernel support' 147 144 @echo ' tinyconfig - Configure the tiniest possible kernel' 148 145 149 146 # lxdialog stuff