From 0e6c83d18759e282fb4cfc19478a4217923421b3 Mon Sep 17 00:00:00 2001 From: Sebastian Ott Date: Tue, 30 Apr 2013 17:16:17 +0200 Subject: s390/cio: add ipldev keyword to cio_ignore Provide an 'ipldev' keyword to cio_ignore to (un)ignore the CCW or FCP based boot device. Reviewed-by: Peter Oberparleiter Signed-off-by: Sebastian Ott Signed-off-by: Martin Schwidefsky --- drivers/s390/cio/blacklist.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'drivers/s390') diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c index 2d2a966a3b3..706eb9b6513 100644 --- a/drivers/s390/cio/blacklist.c +++ b/drivers/s390/cio/blacklist.c @@ -1,7 +1,7 @@ /* * S/390 common I/O routines -- blacklisting of specific devices * - * Copyright IBM Corp. 1999, 2002 + * Copyright IBM Corp. 1999, 2013 * Author(s): Ingo Adlung (adlung@de.ibm.com) * Cornelia Huck (cornelia.huck@de.ibm.com) * Arnd Bergmann (arndb@de.ibm.com) @@ -17,8 +17,9 @@ #include #include -#include #include +#include +#include #include "blacklist.h" #include "cio.h" @@ -172,6 +173,22 @@ static int blacklist_parse_parameters(char *str, range_action action, to_cssid = __MAX_CSSID; to_ssid = __MAX_SSID; to = __MAX_SUBCHANNEL; + } else if (strcmp(parm, "ipldev") == 0) { + if (ipl_info.type == IPL_TYPE_CCW) { + from_cssid = 0; + from_ssid = ipl_info.data.ccw.dev_id.ssid; + from = ipl_info.data.ccw.dev_id.devno; + } else if (ipl_info.type == IPL_TYPE_FCP || + ipl_info.type == IPL_TYPE_FCP_DUMP) { + from_cssid = 0; + from_ssid = ipl_info.data.fcp.dev_id.ssid; + from = ipl_info.data.fcp.dev_id.devno; + } else { + continue; + } + to_cssid = from_cssid; + to_ssid = from_ssid; + to = from; } else { rc = parse_busid(strsep(&parm, "-"), &from_cssid, &from_ssid, &from, msgtrigger); -- cgit v1.2.3-70-g09d2 From d1eb16e64f20bbb88b0949fb5203ac43b661dffe Mon Sep 17 00:00:00 2001 From: Sebastian Ott Date: Tue, 30 Apr 2013 17:17:34 +0200 Subject: s390/cio: add condev keyword to cio_ignore Provide a 'condev' keyword to cio_ignore to (un)ignore the CCW console device. Reviewed-by: Peter Oberparleiter Signed-off-by: Sebastian Ott Signed-off-by: Martin Schwidefsky --- Documentation/s390/CommonIO | 11 ++++++----- drivers/s390/cio/blacklist.c | 7 +++++++ 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'drivers/s390') diff --git a/Documentation/s390/CommonIO b/Documentation/s390/CommonIO index d90a5ddb2b0..6e0f63f343b 100644 --- a/Documentation/s390/CommonIO +++ b/Documentation/s390/CommonIO @@ -10,7 +10,7 @@ Command line parameters * cio_ignore = device[,device[,..]] - device := {all | [!]ipldev | [!] | [!]-} + device := {all | [!]ipldev | [!]condev | [!] | [!]-} The given devices will be ignored by the common I/O-layer; no detection and device sensing will be done on any of those devices. The subchannel to @@ -24,10 +24,11 @@ Command line parameters device numbers (0xabcd or abcd, for 2.4 backward compatibility). If you give a device number 0xabcd, it will be interpreted as 0.0.abcd. - You can use the 'all' keyword to ignore all devices. The 'ipldev' keyword can - be used to refer to the CCW based boot device (this is probably useful only - when combined with the '!' operator). The '!' operator will cause the I/O-layer - to _not_ ignore a device. The command line is parsed from left to right. + You can use the 'all' keyword to ignore all devices. The 'ipldev' and 'condev' + keywords can be used to refer to the CCW based boot device and CCW console + device respectively (these are probably useful only when combined with the '!' + operator). The '!' operator will cause the I/O-layer to _not_ ignore a device. + The command line is parsed from left to right. For example, cio_ignore=0.0.0023-0.0.0042,0.0.4711 diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c index 706eb9b6513..a9fe3de2dec 100644 --- a/drivers/s390/cio/blacklist.c +++ b/drivers/s390/cio/blacklist.c @@ -189,6 +189,13 @@ static int blacklist_parse_parameters(char *str, range_action action, to_cssid = from_cssid; to_ssid = from_ssid; to = from; + } else if (strcmp(parm, "condev") == 0) { + if (console_devno == -1) + continue; + + from_cssid = to_cssid = 0; + from_ssid = to_ssid = 0; + from = to = console_devno; } else { rc = parse_busid(strsep(&parm, "-"), &from_cssid, &from_ssid, &from, msgtrigger); -- cgit v1.2.3-70-g09d2 From 7b1e427d685e2aee91f9a622f9c2691130f8e57d Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Sat, 27 Apr 2013 13:43:34 +0200 Subject: s390/zcore: calculate real memory size using own get_mem_size function The zcore device driver makes use of the global visible real_memory_size variable with its odd semantics. Since the zcore device driver already has code in place which calculates the memory size at module load time, use that code to calculate the current memory end value. One user less of the odd real_memory_size variable. Reviewed-by: Michael Holzheu Signed-off-by: Heiko Carstens Signed-off-by: Martin Schwidefsky --- drivers/s390/char/zcore.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'drivers/s390') diff --git a/drivers/s390/char/zcore.c b/drivers/s390/char/zcore.c index 22820610022..d415ba7f26a 100644 --- a/drivers/s390/char/zcore.c +++ b/drivers/s390/char/zcore.c @@ -557,7 +557,7 @@ static void __init set_lc_mask(struct save_area *map) /* * Initialize dump globals for a given architecture */ -static int __init sys_info_init(enum arch_id arch) +static int __init sys_info_init(enum arch_id arch, unsigned long mem_end) { int rc; @@ -579,7 +579,7 @@ static int __init sys_info_init(enum arch_id arch) rc = init_cpu_info(arch); if (rc) return rc; - sys_info.mem_size = real_memory_size; + sys_info.mem_size = mem_end; return 0; } @@ -601,7 +601,7 @@ static int __init check_sdias(void) return 0; } -static int __init get_mem_size(unsigned long *mem) +static int __init get_mem_info(unsigned long *mem, unsigned long *end) { int i; struct mem_chunk *chunk_array; @@ -615,28 +615,26 @@ static int __init get_mem_size(unsigned long *mem) if (chunk_array[i].size == 0) break; *mem += chunk_array[i].size; + *end = max(*end, chunk_array[i].addr + chunk_array[i].size); } kfree(chunk_array); return 0; } -static int __init zcore_header_init(int arch, struct zcore_header *hdr) +static void __init zcore_header_init(int arch, struct zcore_header *hdr, + unsigned long mem_size) { - int rc, i; - unsigned long memory = 0; u32 prefix; + int i; if (arch == ARCH_S390X) hdr->arch_id = DUMP_ARCH_S390X; else hdr->arch_id = DUMP_ARCH_S390; - rc = get_mem_size(&memory); - if (rc) - return rc; - hdr->mem_size = memory; - hdr->rmem_size = memory; + hdr->mem_size = mem_size; + hdr->rmem_size = mem_size; hdr->mem_end = sys_info.mem_size; - hdr->num_pages = memory / PAGE_SIZE; + hdr->num_pages = mem_size / PAGE_SIZE; hdr->tod = get_tod_clock(); get_cpu_id(&hdr->cpu_id); for (i = 0; zfcpdump_save_areas[i]; i++) { @@ -647,7 +645,6 @@ static int __init zcore_header_init(int arch, struct zcore_header *hdr) hdr->lc_vec[hdr->cpu_cnt] = prefix; hdr->cpu_cnt++; } - return 0; } /* @@ -682,9 +679,11 @@ static int __init zcore_reipl_init(void) static int __init zcore_init(void) { + unsigned long mem_size, mem_end; unsigned char arch; int rc; + mem_size = mem_end = 0; if (ipl_info.type != IPL_TYPE_FCP_DUMP) return -ENODATA; if (OLDMEM_BASE) @@ -727,13 +726,14 @@ static int __init zcore_init(void) } #endif /* CONFIG_64BIT */ - rc = sys_info_init(arch); + rc = get_mem_info(&mem_size, &mem_end); if (rc) goto fail; - rc = zcore_header_init(arch, &zcore_header); + rc = sys_info_init(arch, mem_end); if (rc) goto fail; + zcore_header_init(arch, &zcore_header, mem_size); rc = zcore_reipl_init(); if (rc) -- cgit v1.2.3-70-g09d2 From edefc7107afedd6bd59e80bc0586ddb276edfcbe Mon Sep 17 00:00:00 2001 From: Nick Wang Date: Tue, 3 Jul 2012 11:28:36 -0400 Subject: s390/kvm: Change the virtual memory mapping location for Virtio devices The current location for mapping Virtio devices does not take into consideration of the standby memory. This causes the failure of mapping standby memory since the location for the mapping is already taken by the Virtio devices. To fix the problem, we move the location to beyond the end of standby memory. Signed-off-by: Nick Wang Reviewed-by: Christian Borntraeger --- drivers/s390/kvm/kvm_virtio.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'drivers/s390') diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c index 6711e65764b..2ea6165366b 100644 --- a/drivers/s390/kvm/kvm_virtio.c +++ b/drivers/s390/kvm/kvm_virtio.c @@ -443,29 +443,30 @@ static int __init test_devices_support(unsigned long addr) } /* * Init function for virtio - * devices are in a single page above top of "normal" mem + * devices are in a single page above top of "normal" + standby mem */ static int __init kvm_devices_init(void) { int rc; + unsigned long total_memory_size = sclp_get_rzm() * sclp_get_rnmax(); if (!MACHINE_IS_KVM) return -ENODEV; - if (test_devices_support(real_memory_size) < 0) + if (test_devices_support(total_memory_size) < 0) return -ENODEV; - rc = vmem_add_mapping(real_memory_size, PAGE_SIZE); + rc = vmem_add_mapping(total_memory_size, PAGE_SIZE); if (rc) return rc; - kvm_devices = (void *) real_memory_size; + kvm_devices = (void *) total_memory_size; kvm_root = root_device_register("kvm_s390"); if (IS_ERR(kvm_root)) { rc = PTR_ERR(kvm_root); printk(KERN_ERR "Could not register kvm_s390 root device"); - vmem_remove_mapping(real_memory_size, PAGE_SIZE); + vmem_remove_mapping(total_memory_size, PAGE_SIZE); return rc; } -- cgit v1.2.3-70-g09d2 From df1bd59c5cc247d1d02588ff0a4e86a0cc5f9733 Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Tue, 30 Apr 2013 10:34:04 +0200 Subject: s390/mem_detect: limit memory detection loop to "mem=" parameter The current memory detection loop will detect all present memory of a machine. This is true even if the user specified the "mem=" parameter on the kernel command line. This can be a problem since the memory detection may cause a fully populated host page table for the guest, even for those parts of the memory that the guest will never use afterwards. So fix this and only detect memory up to a user supplied "mem=" limit if specified. Reported-by: Michael Johanssen Reviewed-by: Michael Holzheu Signed-off-by: Heiko Carstens Signed-off-by: Martin Schwidefsky --- arch/s390/include/asm/setup.h | 2 +- arch/s390/kernel/crash_dump.c | 2 +- arch/s390/kernel/early.c | 1 - arch/s390/kernel/setup.c | 2 +- arch/s390/mm/mem_detect.c | 23 ++++++++++++++++++++--- drivers/s390/char/zcore.c | 4 ++-- 6 files changed, 25 insertions(+), 9 deletions(-) (limited to 'drivers/s390') diff --git a/arch/s390/include/asm/setup.h b/arch/s390/include/asm/setup.h index 270fcd0fbf1..2765e40d873 100644 --- a/arch/s390/include/asm/setup.h +++ b/arch/s390/include/asm/setup.h @@ -46,7 +46,7 @@ extern struct mem_chunk memory_chunk[]; extern int memory_end_set; extern unsigned long memory_end; -void detect_memory_layout(struct mem_chunk chunk[]); +void detect_memory_layout(struct mem_chunk chunk[], unsigned long maxsize); void create_mem_hole(struct mem_chunk memory_chunk[], unsigned long addr, unsigned long size, int type); diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c index fb8d8781a01..30b7f63aa4e 100644 --- a/arch/s390/kernel/crash_dump.c +++ b/arch/s390/kernel/crash_dump.c @@ -88,7 +88,7 @@ static struct mem_chunk *get_memory_layout(void) struct mem_chunk *chunk_array; chunk_array = kzalloc_panic(MEMORY_CHUNKS * sizeof(struct mem_chunk)); - detect_memory_layout(chunk_array); + detect_memory_layout(chunk_array, 0); create_mem_hole(chunk_array, OLDMEM_BASE, OLDMEM_SIZE, CHUNK_CRASHK); return chunk_array; } diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c index bda011e2f8a..dc8770d7173 100644 --- a/arch/s390/kernel/early.c +++ b/arch/s390/kernel/early.c @@ -482,7 +482,6 @@ void __init startup_init(void) detect_machine_facilities(); setup_topology(); sclp_facilities_detect(); - detect_memory_layout(memory_chunk); #ifdef CONFIG_DYNAMIC_FTRACE S390_lowcore.ftrace_func = (unsigned long)ftrace_caller; #endif diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 555f1895972..cdd9ec0a6fc 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c @@ -1066,7 +1066,7 @@ void __init setup_arch(char **cmdline_p) memcpy(&uaccess, &uaccess_std, sizeof(uaccess)); parse_early_param(); - + detect_memory_layout(memory_chunk, memory_end); os_info_init(); setup_ipl(); reserve_oldmem(); diff --git a/arch/s390/mm/mem_detect.c b/arch/s390/mm/mem_detect.c index 854c08448de..ec00576bf8d 100644 --- a/arch/s390/mm/mem_detect.c +++ b/arch/s390/mm/mem_detect.c @@ -12,7 +12,7 @@ #define ADDR2G (1ULL << 31) -static void find_memory_chunks(struct mem_chunk chunk[]) +static void find_memory_chunks(struct mem_chunk chunk[], unsigned long maxsize) { unsigned long long memsize, rnmax, rzm; unsigned long addr = 0, size; @@ -27,6 +27,8 @@ static void find_memory_chunks(struct mem_chunk chunk[]) rzm = min(ADDR2G, rzm); memsize = memsize ? min(ADDR2G, memsize) : ADDR2G; } + if (maxsize) + memsize = memsize ? min((unsigned long)memsize, maxsize) : maxsize; do { size = 0; type = tprot(addr); @@ -36,6 +38,8 @@ static void find_memory_chunks(struct mem_chunk chunk[]) break; } while (type == tprot(addr + size)); if (type == CHUNK_READ_WRITE || type == CHUNK_READ_ONLY) { + if (memsize && (addr + size > memsize)) + size = memsize - addr; chunk[i].addr = addr; chunk[i].size = size; chunk[i].type = type; @@ -45,7 +49,20 @@ static void find_memory_chunks(struct mem_chunk chunk[]) } while (addr < memsize && i < MEMORY_CHUNKS); } -void detect_memory_layout(struct mem_chunk chunk[]) +/** + * detect_memory_layout - fill mem_chunk array with memory layout data + * @chunk: mem_chunk array to be filled + * @maxsize: maximum address where memory detection should stop + * + * Fills the passed in memory chunk array with the memory layout of the + * machine. The array must have a size of at least MEMORY_CHUNKS and will + * be fully initialized afterwards. + * If the maxsize paramater has a value > 0 memory detection will stop at + * that address. It is guaranteed that all chunks have an ending address + * that is smaller than maxsize. + * If maxsize is 0 all memory will be detected. + */ +void detect_memory_layout(struct mem_chunk chunk[], unsigned long maxsize) { unsigned long flags, flags_dat, cr0; @@ -69,7 +86,7 @@ void detect_memory_layout(struct mem_chunk chunk[]) } __ctl_store(cr0, 0, 0); __ctl_clear_bit(0, 28); - find_memory_chunks(chunk); + find_memory_chunks(chunk, maxsize); __ctl_load(cr0, 0, 0); out: __arch_local_irq_ssm(flags_dat); diff --git a/drivers/s390/char/zcore.c b/drivers/s390/char/zcore.c index d415ba7f26a..9e5e14686e7 100644 --- a/drivers/s390/char/zcore.c +++ b/drivers/s390/char/zcore.c @@ -426,7 +426,7 @@ static int zcore_memmap_open(struct inode *inode, struct file *filp) GFP_KERNEL); if (!chunk_array) return -ENOMEM; - detect_memory_layout(chunk_array); + detect_memory_layout(chunk_array, 0); buf = kzalloc(MEMORY_CHUNKS * CHUNK_INFO_SIZE, GFP_KERNEL); if (!buf) { kfree(chunk_array); @@ -610,7 +610,7 @@ static int __init get_mem_info(unsigned long *mem, unsigned long *end) GFP_KERNEL); if (!chunk_array) return -ENOMEM; - detect_memory_layout(chunk_array); + detect_memory_layout(chunk_array, 0); for (i = 0; i < MEMORY_CHUNKS; i++) { if (chunk_array[i].size == 0) break; -- cgit v1.2.3-70-g09d2 From 1553556067cd759f4fae8410bdaad33f5add78cc Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Thu, 2 May 2013 09:20:30 +0200 Subject: s390/memory hotplug,sclp: get rid of per memory increment usecount Given that the memory block size is always larger or equal to the memory increment size there is no need for a usecount anymore. Each memory increment belongs to exactly one memory block. So get rid of the usecount. Signed-off-by: Heiko Carstens Signed-off-by: Martin Schwidefsky --- drivers/s390/char/sclp_cmd.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'drivers/s390') diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c index 178836ec252..bf07c3a188d 100644 --- a/drivers/s390/char/sclp_cmd.c +++ b/drivers/s390/char/sclp_cmd.c @@ -345,7 +345,6 @@ struct memory_increment { struct list_head list; u16 rn; int standby; - int usecount; }; struct assign_storage_sccb { @@ -463,21 +462,10 @@ static int sclp_mem_change_state(unsigned long start, unsigned long size, break; if (start > istart + rzm - 1) continue; - if (online) { - if (incr->usecount++) - continue; - /* - * Don't break the loop if one assign fails. Loop may - * be walked again on CANCEL and we can't save - * information if state changed before or not. - * So continue and increase usecount for all increments. - */ + if (online) rc |= sclp_assign_storage(incr->rn); - } else { - if (--incr->usecount) - continue; + else sclp_unassign_storage(incr->rn); - } } return rc ? -EIO : 0; } @@ -561,8 +549,6 @@ static void __init sclp_add_standby_memory(void) add_memory_merged(0); } -#define MEM_SCT_SIZE (1UL << SECTION_SIZE_BITS) - static void __init insert_increment(u16 rn, int standby, int assigned) { struct memory_increment *incr, *new_incr; @@ -574,8 +560,6 @@ static void __init insert_increment(u16 rn, int standby, int assigned) return; new_incr->rn = rn; new_incr->standby = standby; - if (!standby) - new_incr->usecount = rzm > MEM_SCT_SIZE ? rzm/MEM_SCT_SIZE : 1; last_rn = 0; prev = &sclp_mem_list; list_for_each_entry(incr, &sclp_mem_list, list) { -- cgit v1.2.3-70-g09d2 From 56bbe686693df7edcca18d1808edd80609e63c31 Mon Sep 17 00:00:00 2001 From: Ingo Tuchscherer Date: Fri, 12 Apr 2013 17:52:08 +0200 Subject: s390/zcrypt: ap bus rescan problem when toggle crypto adapters on/off The bus rescan process was called simultaneously on every device failure. This finally leads into race conditions (double device add/remove actions). This patch protects the rescan area by mutual exclusion and improves ap_config_timer handling Signed-off-by: Ingo Tuchscherer Signed-off-by: Martin Schwidefsky --- drivers/s390/crypto/ap_bus.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'drivers/s390') diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index b8b340ac533..9de41aa1489 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c @@ -954,15 +954,11 @@ EXPORT_SYMBOL(ap_driver_unregister); void ap_bus_force_rescan(void) { - /* Delete the AP bus rescan timer. */ - del_timer(&ap_config_timer); - - /* processing a synchonuous bus rescan */ - ap_scan_bus(NULL); - - /* Setup the AP bus rescan timer again. */ - ap_config_timer.expires = jiffies + ap_config_time * HZ; - add_timer(&ap_config_timer); + /* reconfigure the AP bus rescan timer. */ + mod_timer(&ap_config_timer, jiffies + ap_config_time * HZ); + /* processing a asynchronous bus rescan */ + queue_work(ap_work_queue, &ap_config_work); + flush_work(&ap_config_work); } EXPORT_SYMBOL(ap_bus_force_rescan); @@ -1305,8 +1301,9 @@ static void ap_scan_bus(struct work_struct *unused) int rc, i; ap_query_configuration(); - if (ap_select_domain() != 0) + if (ap_select_domain() != 0) { return; + } for (i = 0; i < AP_DEVICES; i++) { qid = AP_MKQID(i, ap_domain_index); dev = bus_find_device(&ap_bus_type, NULL, -- cgit v1.2.3-70-g09d2