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

s390: Convert MACHINE_IS_[LPAR|VM|KVM], etc, machine_is_[lpar|vm|kvm]()

Move machine type detection to the decompressor and use static branches
to implement and use machine_is_[lpar|vm|kvm]() instead of a runtime check
via MACHINE_IS_[LPAR|VM|KVM].

Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>

authored by

Heiko Carstens and committed by
Vasily Gorbik
52109a06 91d6e442

+140 -103
+23
arch/s390/boot/startup.c
··· 8 8 #include <asm/sections.h> 9 9 #include <asm/maccess.h> 10 10 #include <asm/machine.h> 11 + #include <asm/sysinfo.h> 11 12 #include <asm/cpu_mf.h> 12 13 #include <asm/setup.h> 13 14 #include <asm/timex.h> ··· 48 47 boot_emerg("%s\n", x); 49 48 boot_emerg(" -- System halted\n"); 50 49 disabled_wait(); 50 + } 51 + 52 + static char sysinfo_page[PAGE_SIZE] __aligned(PAGE_SIZE); 53 + 54 + static void detect_machine_type(void) 55 + { 56 + struct sysinfo_3_2_2 *vmms = (struct sysinfo_3_2_2 *)&sysinfo_page; 57 + 58 + /* Check current-configuration-level */ 59 + if (stsi(NULL, 0, 0, 0) <= 2) { 60 + set_machine_feature(MFEATURE_LPAR); 61 + return; 62 + } 63 + /* Get virtual-machine cpu information. */ 64 + if (stsi(vmms, 3, 2, 2) || !vmms->count) 65 + return; 66 + /* Detect known hypervisors */ 67 + if (!memcmp(vmms->vm[0].cpi, "\xd2\xe5\xd4", 3)) 68 + set_machine_feature(MFEATURE_KVM); 69 + else if (!memcmp(vmms->vm[0].cpi, "\xa9\x61\xe5\xd4", 4)) 70 + set_machine_feature(MFEATURE_VM); 51 71 } 52 72 53 73 static void detect_diag9c(void) ··· 542 520 sclp_early_detect_machine_features(); 543 521 detect_facilities(); 544 522 detect_diag9c(); 523 + detect_machine_type(); 545 524 cmma_init(); 546 525 sanitize_prot_virt_host(); 547 526 max_physmem_end = detect_max_physmem_end();
+3 -2
arch/s390/hypfs/hypfs_diag0c.c
··· 9 9 10 10 #include <linux/slab.h> 11 11 #include <linux/cpu.h> 12 + #include <asm/machine.h> 12 13 #include <asm/diag.h> 13 14 #include <asm/hypfs.h> 14 15 #include "hypfs.h" ··· 108 107 */ 109 108 int __init hypfs_diag0c_init(void) 110 109 { 111 - if (!MACHINE_IS_VM) 110 + if (!machine_is_vm()) 112 111 return 0; 113 112 hypfs_dbfs_create_file(&dbfs_file_0c); 114 113 return 0; ··· 119 118 */ 120 119 void hypfs_diag0c_exit(void) 121 120 { 122 - if (!MACHINE_IS_VM) 121 + if (!machine_is_vm()) 123 122 return; 124 123 hypfs_dbfs_remove_file(&dbfs_file_0c); 125 124 }
+2 -1
arch/s390/hypfs/hypfs_diag_fs.c
··· 16 16 #include <linux/string.h> 17 17 #include <linux/vmalloc.h> 18 18 #include <linux/mm.h> 19 + #include <asm/machine.h> 19 20 #include <asm/diag.h> 20 21 #include <asm/ebcdic.h> 21 22 #include "hypfs_diag.h" ··· 383 382 384 383 int __init __hypfs_diag_fs_init(void) 385 384 { 386 - if (MACHINE_IS_LPAR) 385 + if (machine_is_lpar()) 387 386 return diag224_get_name_table(); 388 387 return 0; 389 388 }
+3 -2
arch/s390/hypfs/hypfs_vm.c
··· 11 11 #include <linux/string.h> 12 12 #include <linux/vmalloc.h> 13 13 #include <asm/extable.h> 14 + #include <asm/machine.h> 14 15 #include <asm/diag.h> 15 16 #include <asm/ebcdic.h> 16 17 #include <asm/timex.h> ··· 122 121 123 122 int hypfs_vm_init(void) 124 123 { 125 - if (!MACHINE_IS_VM) 124 + if (!machine_is_vm()) 126 125 return 0; 127 126 if (diag2fc(0, all_guests, NULL) > 0) 128 127 diag2fc_guest_query = all_guests; ··· 136 135 137 136 void hypfs_vm_exit(void) 138 137 { 139 - if (!MACHINE_IS_VM) 138 + if (!machine_is_vm()) 140 139 return; 141 140 hypfs_dbfs_remove_file(&dbfs_file_2fc); 142 141 }
+3 -2
arch/s390/hypfs/inode.c
··· 24 24 #include <linux/kobject.h> 25 25 #include <linux/seq_file.h> 26 26 #include <linux/uio.h> 27 + #include <asm/machine.h> 27 28 #include <asm/ebcdic.h> 28 29 #include "hypfs.h" 29 30 ··· 185 184 goto out; 186 185 } 187 186 hypfs_delete_tree(sb->s_root); 188 - if (MACHINE_IS_VM) 187 + if (machine_is_vm()) 189 188 rc = hypfs_vm_create_files(sb->s_root); 190 189 else 191 190 rc = hypfs_diag_create_files(sb->s_root); ··· 274 273 sb->s_root = root_dentry = d_make_root(root_inode); 275 274 if (!root_dentry) 276 275 return -ENOMEM; 277 - if (MACHINE_IS_VM) 276 + if (machine_is_vm()) 278 277 rc = hypfs_vm_create_files(root_dentry); 279 278 else 280 279 rc = hypfs_diag_create_files(root_dentry);
+2 -1
arch/s390/include/asm/appldata.h
··· 9 9 #define _ASM_S390_APPLDATA_H 10 10 11 11 #include <linux/io.h> 12 + #include <asm/machine.h> 12 13 #include <asm/diag.h> 13 14 14 15 #define APPLDATA_START_INTERVAL_REC 0x80 ··· 49 48 { 50 49 int ry; 51 50 52 - if (!MACHINE_IS_VM) 51 + if (!machine_is_vm()) 53 52 return -EOPNOTSUPP; 54 53 parm_list->diag = 0xdc; 55 54 parm_list->function = fn;
+10
arch/s390/include/asm/machine.h
··· 15 15 #define MFEATURE_TX 4 16 16 #define MFEATURE_ESOP 5 17 17 #define MFEATURE_DIAG9C 6 18 + #define MFEATURE_VM 7 19 + #define MFEATURE_KVM 8 20 + #define MFEATURE_LPAR 9 18 21 19 22 #ifndef __ASSEMBLY__ 20 23 ··· 91 88 DEFINE_MACHINE_HAS_FEATURE(tx, MFEATURE_TX) 92 89 DEFINE_MACHINE_HAS_FEATURE(esop, MFEATURE_ESOP) 93 90 DEFINE_MACHINE_HAS_FEATURE(diag9c, MFEATURE_DIAG9C) 91 + DEFINE_MACHINE_HAS_FEATURE(vm, MFEATURE_VM) 92 + DEFINE_MACHINE_HAS_FEATURE(kvm, MFEATURE_KVM) 93 + DEFINE_MACHINE_HAS_FEATURE(lpar, MFEATURE_LPAR) 94 + 95 + #define machine_is_vm machine_has_vm 96 + #define machine_is_kvm machine_has_kvm 97 + #define machine_is_lpar machine_has_lpar 94 98 95 99 #endif /* __ASSEMBLY__ */ 96 100 #endif /* __ASM_S390_MACHINE_H */
-11
arch/s390/include/asm/setup.h
··· 13 13 #define PARMAREA 0x10400 14 14 15 15 #define COMMAND_LINE_SIZE CONFIG_COMMAND_LINE_SIZE 16 - /* 17 - * Machine features detected in early.c 18 - */ 19 - 20 - #define MACHINE_FLAG_VM BIT(0) 21 - #define MACHINE_FLAG_KVM BIT(1) 22 - #define MACHINE_FLAG_LPAR BIT(2) 23 16 24 17 #define LPP_MAGIC BIT(31) 25 18 #define LPP_PID_MASK _AC(0xffffffff, UL) ··· 55 62 56 63 /* The Write Back bit position in the physaddr is given by the SLPC PCI */ 57 64 extern unsigned long mio_wb_bit_mask; 58 - 59 - #define MACHINE_IS_VM (get_lowcore()->machine_flags & MACHINE_FLAG_VM) 60 - #define MACHINE_IS_KVM (get_lowcore()->machine_flags & MACHINE_FLAG_KVM) 61 - #define MACHINE_IS_LPAR (get_lowcore()->machine_flags & MACHINE_FLAG_LPAR) 62 65 63 66 /* 64 67 * Console mode. Override with conmode=
+4 -24
arch/s390/kernel/early.c
··· 22 22 #include <asm/asm-extable.h> 23 23 #include <linux/memblock.h> 24 24 #include <asm/access-regs.h> 25 + #include <asm/machine.h> 25 26 #include <asm/diag.h> 26 27 #include <asm/ebcdic.h> 27 28 #include <asm/fpu.h> ··· 83 82 84 83 static __initdata char sysinfo_page[PAGE_SIZE] __aligned(PAGE_SIZE); 85 84 86 - static noinline __init void detect_machine_type(void) 87 - { 88 - struct sysinfo_3_2_2 *vmms = (struct sysinfo_3_2_2 *)&sysinfo_page; 89 - 90 - /* Check current-configuration-level */ 91 - if (stsi(NULL, 0, 0, 0) <= 2) { 92 - get_lowcore()->machine_flags |= MACHINE_FLAG_LPAR; 93 - return; 94 - } 95 - /* Get virtual-machine cpu information. */ 96 - if (stsi(vmms, 3, 2, 2) || !vmms->count) 97 - return; 98 - 99 - /* Detect known hypervisors */ 100 - if (!memcmp(vmms->vm[0].cpi, "\xd2\xe5\xd4", 3)) 101 - get_lowcore()->machine_flags |= MACHINE_FLAG_KVM; 102 - else if (!memcmp(vmms->vm[0].cpi, "\xa9\x61\xe5\xd4", 4)) 103 - get_lowcore()->machine_flags |= MACHINE_FLAG_VM; 104 - } 105 - 106 85 /* Remove leading, trailing and double whitespace. */ 107 86 static inline void strim_all(char *str) 108 87 { ··· 123 142 strim_all(hvstr); 124 143 } else { 125 144 sprintf(hvstr, "%s", 126 - MACHINE_IS_LPAR ? "LPAR" : 127 - MACHINE_IS_VM ? "z/VM" : 128 - MACHINE_IS_KVM ? "KVM" : "unknown"); 145 + machine_is_lpar() ? "LPAR" : 146 + machine_is_vm() ? "z/VM" : 147 + machine_is_kvm() ? "KVM" : "unknown"); 129 148 } 130 149 dump_stack_set_arch_desc("%s (%s)", mstr, hvstr); 131 150 } ··· 230 249 lockdep_off(); 231 250 sort_amode31_extable(); 232 251 setup_lowcore_early(); 233 - detect_machine_type(); 234 252 setup_arch_string(); 235 253 setup_boot_command_line(); 236 254 detect_machine_facilities();
+11 -10
arch/s390/kernel/ipl.c
··· 22 22 #include <linux/debug_locks.h> 23 23 #include <linux/vmalloc.h> 24 24 #include <asm/asm-extable.h> 25 + #include <asm/machine.h> 25 26 #include <asm/diag.h> 26 27 #include <asm/ipl.h> 27 28 #include <asm/smp.h> ··· 686 685 goto out; 687 686 switch (ipl_info.type) { 688 687 case IPL_TYPE_CCW: 689 - if (MACHINE_IS_VM) 688 + if (machine_is_vm()) 690 689 rc = sysfs_create_group(&ipl_kset->kobj, 691 690 &ipl_ccw_attr_group_vm); 692 691 else ··· 1273 1272 ipb->ccw.flags = IPL_PB0_FLAG_LOADPARM; 1274 1273 1275 1274 /* VM PARM */ 1276 - if (MACHINE_IS_VM && ipl_block_valid && 1275 + if (machine_is_vm() && ipl_block_valid && 1277 1276 (ipl_block.ccw.vm_flags & IPL_PB0_CCW_VM_FLAG_VP)) { 1278 1277 1279 1278 ipb->ccw.vm_flags |= IPL_PB0_CCW_VM_FLAG_VP; ··· 1287 1286 { 1288 1287 int rc; 1289 1288 1290 - if (!MACHINE_IS_VM) 1289 + if (!machine_is_vm()) 1291 1290 return 0; 1292 1291 1293 1292 reipl_block_nss = (void *) get_zeroed_page(GFP_KERNEL); ··· 1312 1311 return -ENOMEM; 1313 1312 1314 1313 rc = sysfs_create_group(&reipl_kset->kobj, 1315 - MACHINE_IS_VM ? &reipl_ccw_attr_group_vm 1316 - : &reipl_ccw_attr_group_lpar); 1314 + machine_is_vm() ? &reipl_ccw_attr_group_vm 1315 + : &reipl_ccw_attr_group_lpar); 1317 1316 if (rc) 1318 1317 return rc; 1319 1318 ··· 1988 1987 1989 1988 static int vmcmd_init(void) 1990 1989 { 1991 - if (!MACHINE_IS_VM) 1990 + if (!machine_is_vm()) 1992 1991 return -EOPNOTSUPP; 1993 1992 vmcmd_kset = kset_create_and_add("vmcmd", NULL, firmware_kobj); 1994 1993 if (!vmcmd_kset) ··· 2265 2264 2266 2265 static int __init vmcmd_on_reboot_setup(char *str) 2267 2266 { 2268 - if (!MACHINE_IS_VM) 2267 + if (!machine_is_vm()) 2269 2268 return 1; 2270 2269 strncpy_skip_quote(vmcmd_on_reboot, str, VMCMD_MAX_SIZE); 2271 2270 vmcmd_on_reboot[VMCMD_MAX_SIZE] = 0; ··· 2276 2275 2277 2276 static int __init vmcmd_on_panic_setup(char *str) 2278 2277 { 2279 - if (!MACHINE_IS_VM) 2278 + if (!machine_is_vm()) 2280 2279 return 1; 2281 2280 strncpy_skip_quote(vmcmd_on_panic, str, VMCMD_MAX_SIZE); 2282 2281 vmcmd_on_panic[VMCMD_MAX_SIZE] = 0; ··· 2287 2286 2288 2287 static int __init vmcmd_on_halt_setup(char *str) 2289 2288 { 2290 - if (!MACHINE_IS_VM) 2289 + if (!machine_is_vm()) 2291 2290 return 1; 2292 2291 strncpy_skip_quote(vmcmd_on_halt, str, VMCMD_MAX_SIZE); 2293 2292 vmcmd_on_halt[VMCMD_MAX_SIZE] = 0; ··· 2298 2297 2299 2298 static int __init vmcmd_on_poff_setup(char *str) 2300 2299 { 2301 - if (!MACHINE_IS_VM) 2300 + if (!machine_is_vm()) 2302 2301 return 1; 2303 2302 strncpy_skip_quote(vmcmd_on_poff, str, VMCMD_MAX_SIZE); 2304 2303 vmcmd_on_poff[VMCMD_MAX_SIZE] = 0;
+2 -1
arch/s390/kernel/irq.c
··· 25 25 #include <asm/irq_regs.h> 26 26 #include <asm/cputime.h> 27 27 #include <asm/lowcore.h> 28 + #include <asm/machine.h> 28 29 #include <asm/irq.h> 29 30 #include <asm/hw_irq.h> 30 31 #include <asm/stacktrace.h> ··· 165 164 do_irq_async(regs, THIN_INTERRUPT); 166 165 else 167 166 do_irq_async(regs, IO_INTERRUPT); 168 - } while (MACHINE_IS_LPAR && irq_pending(regs)); 167 + } while (machine_is_lpar() && irq_pending(regs)); 169 168 170 169 irq_exit_rcu(); 171 170
+2 -1
arch/s390/kernel/machine_kexec.c
··· 15 15 #include <linux/debug_locks.h> 16 16 #include <linux/cpufeature.h> 17 17 #include <asm/guarded_storage.h> 18 + #include <asm/machine.h> 18 19 #include <asm/pfault.h> 19 20 #include <asm/cio.h> 20 21 #include <asm/fpu.h> ··· 180 179 static int machine_kexec_prepare_kdump(void) 181 180 { 182 181 #ifdef CONFIG_CRASH_DUMP 183 - if (MACHINE_IS_VM) 182 + if (machine_is_vm()) 184 183 diag10_range(PFN_DOWN(crashk_res.start), 185 184 PFN_DOWN(crashk_res.end - crashk_res.start + 1)); 186 185 return 0;
+6 -6
arch/s390/kernel/setup.c
··· 252 252 char query_buffer[1024]; 253 253 char *ptr; 254 254 255 - if (MACHINE_IS_VM) { 255 + if (machine_is_vm()) { 256 256 cpcmd("QUERY CONSOLE", query_buffer, 1024, NULL); 257 257 console_devno = simple_strtoul(query_buffer + 5, NULL, 16); 258 258 ptr = strstr(query_buffer, "SUBCHANNEL ="); ··· 290 290 SET_CONSOLE_SCLP; 291 291 #endif 292 292 } 293 - } else if (MACHINE_IS_KVM) { 293 + } else if (machine_is_kvm()) { 294 294 if (sclp.has_vt220 && IS_ENABLED(CONFIG_SCLP_VT220_CONSOLE)) 295 295 SET_CONSOLE_VT220; 296 296 else if (sclp.has_linemode && IS_ENABLED(CONFIG_SCLP_CONSOLE)) ··· 653 653 return; 654 654 } 655 655 656 - if (!oldmem_data.start && MACHINE_IS_VM) 656 + if (!oldmem_data.start && machine_is_vm()) 657 657 diag10_range(PFN_DOWN(crash_base), PFN_DOWN(crash_size)); 658 658 crashk_res.start = crash_base; 659 659 crashk_res.end = crash_base + crash_size - 1; ··· 899 899 /* 900 900 * print what head.S has found out about the machine 901 901 */ 902 - if (MACHINE_IS_VM) 902 + if (machine_is_vm()) 903 903 pr_info("Linux is running as a z/VM " 904 904 "guest operating system in 64-bit mode\n"); 905 - else if (MACHINE_IS_KVM) 905 + else if (machine_is_kvm()) 906 906 pr_info("Linux is running under KVM in 64-bit mode\n"); 907 - else if (MACHINE_IS_LPAR) 907 + else if (machine_is_lpar()) 908 908 pr_info("Linux is running natively in 64-bit mode\n"); 909 909 else 910 910 pr_info("Linux is running as a guest in 64-bit mode\n");
+2 -1
arch/s390/kernel/sysinfo.c
··· 16 16 #include <linux/export.h> 17 17 #include <linux/slab.h> 18 18 #include <asm/asm-extable.h> 19 + #include <asm/machine.h> 19 20 #include <asm/ebcdic.h> 20 21 #include <asm/debug.h> 21 22 #include <asm/sysinfo.h> ··· 379 378 static __init int create_proc_service_level(void) 380 379 { 381 380 proc_create_seq("service_levels", 0, NULL, &service_level_seq_ops); 382 - if (MACHINE_IS_VM) 381 + if (machine_is_vm()) 383 382 register_service_level(&service_level_vm); 384 383 return 0; 385 384 }
+4 -3
arch/s390/lib/spinlock.c
··· 15 15 #include <linux/percpu.h> 16 16 #include <linux/io.h> 17 17 #include <asm/alternative.h> 18 + #include <asm/machine.h> 18 19 #include <asm/asm.h> 19 20 20 21 int spin_retry = -1; ··· 213 212 if (count-- >= 0) 214 213 continue; 215 214 count = spin_retry; 216 - if (!MACHINE_IS_LPAR || arch_vcpu_is_preempted(owner - 1)) 215 + if (!machine_is_lpar() || arch_vcpu_is_preempted(owner - 1)) 217 216 smp_yield_cpu(owner - 1); 218 217 } 219 218 ··· 256 255 if (count-- >= 0) 257 256 continue; 258 257 count = spin_retry; 259 - if (!MACHINE_IS_LPAR || arch_vcpu_is_preempted(owner - 1)) 258 + if (!machine_is_lpar() || arch_vcpu_is_preempted(owner - 1)) 260 259 smp_yield_cpu(owner - 1); 261 260 } 262 261 } ··· 338 337 cpu = READ_ONCE(lp->lock) & _Q_LOCK_CPU_MASK; 339 338 if (!cpu) 340 339 return; 341 - if (MACHINE_IS_LPAR && !arch_vcpu_is_preempted(cpu - 1)) 340 + if (machine_is_lpar() && !arch_vcpu_is_preempted(cpu - 1)) 342 341 return; 343 342 smp_yield_cpu(cpu - 1); 344 343 }
+5 -4
arch/s390/mm/extmem.c
··· 21 21 #include <linux/ioport.h> 22 22 #include <linux/refcount.h> 23 23 #include <linux/pgtable.h> 24 + #include <asm/machine.h> 24 25 #include <asm/diag.h> 25 26 #include <asm/page.h> 26 27 #include <asm/ebcdic.h> ··· 256 255 int rc; 257 256 struct dcss_segment seg; 258 257 259 - if (!MACHINE_IS_VM) 258 + if (!machine_is_vm()) 260 259 return -ENOSYS; 261 260 262 261 dcss_mkname(name, seg.dcss_name); ··· 419 418 struct dcss_segment *seg; 420 419 int rc; 421 420 422 - if (!MACHINE_IS_VM) 421 + if (!machine_is_vm()) 423 422 return -ENOSYS; 424 423 425 424 mutex_lock(&dcss_lock); ··· 541 540 unsigned long dummy; 542 541 struct dcss_segment *seg; 543 542 544 - if (!MACHINE_IS_VM) 543 + if (!machine_is_vm()) 545 544 return; 546 545 547 546 mutex_lock(&dcss_lock); ··· 573 572 char cmd2[80]; 574 573 int i, response; 575 574 576 - if (!MACHINE_IS_VM) 575 + if (!machine_is_vm()) 577 576 return; 578 577 579 578 mutex_lock(&dcss_lock);
+2 -1
drivers/s390/block/dasd.c
··· 21 21 #include <linux/seq_file.h> 22 22 #include <linux/vmalloc.h> 23 23 24 + #include <asm/machine.h> 24 25 #include <asm/ccwdev.h> 25 26 #include <asm/ebcdic.h> 26 27 #include <asm/idals.h> ··· 3383 3382 struct diag210 diag_data; 3384 3383 int rc; 3385 3384 3386 - if (!MACHINE_IS_VM) 3385 + if (!machine_is_vm()) 3387 3386 return 0; 3388 3387 ccw_device_get_id(device->cdev, &dev_id); 3389 3388 memset(&diag_data, 0, sizeof(diag_data));
+2 -1
drivers/s390/block/dasd_devmap.c
··· 18 18 #include <linux/module.h> 19 19 #include <linux/slab.h> 20 20 21 + #include <asm/machine.h> 21 22 #include <asm/debug.h> 22 23 #include <linux/uaccess.h> 23 24 #include <asm/ipl.h> ··· 235 234 return 0; 236 235 } 237 236 if (strncmp("nopav", keyword, length) == 0) { 238 - if (MACHINE_IS_VM) 237 + if (machine_is_vm()) 239 238 pr_info("'nopav' is not supported on z/VM\n"); 240 239 else { 241 240 dasd_nopav = 1;
+2 -1
drivers/s390/block/dasd_diag.c
··· 18 18 #include <linux/init.h> 19 19 #include <linux/jiffies.h> 20 20 #include <asm/asm-extable.h> 21 + #include <asm/machine.h> 21 22 #include <asm/dasd.h> 22 23 #include <asm/debug.h> 23 24 #include <asm/diag.h> ··· 655 654 static int __init 656 655 dasd_diag_init(void) 657 656 { 658 - if (!MACHINE_IS_VM) { 657 + if (!machine_is_vm()) { 659 658 pr_info("Discipline %s cannot be used without z/VM\n", 660 659 dasd_diag_discipline.name); 661 660 return -ENODEV;
+2 -1
drivers/s390/block/dasd_eckd.c
··· 23 23 #include <linux/io.h> 24 24 25 25 #include <asm/css_chars.h> 26 + #include <asm/machine.h> 26 27 #include <asm/debug.h> 27 28 #include <asm/idals.h> 28 29 #include <asm/ebcdic.h> ··· 1954 1953 if (private->uid.type == UA_BASE_PAV_ALIAS || 1955 1954 private->uid.type == UA_HYPER_PAV_ALIAS) 1956 1955 return 0; 1957 - if (dasd_nopav || MACHINE_IS_VM) 1956 + if (dasd_nopav || machine_is_vm()) 1958 1957 enable_pav = 0; 1959 1958 else 1960 1959 enable_pav = 1;
+2 -1
drivers/s390/char/con3215.c
··· 23 23 #include <linux/reboot.h> 24 24 #include <linux/serial.h> /* ASYNC_* flags */ 25 25 #include <linux/slab.h> 26 + #include <asm/machine.h> 26 27 #include <asm/ccwdev.h> 27 28 #include <asm/cio.h> 28 29 #include <linux/io.h> ··· 908 907 return -ENODEV; 909 908 910 909 /* Set the console mode for VM */ 911 - if (MACHINE_IS_VM) { 910 + if (machine_is_vm()) { 912 911 cpcmd("TERM CONMODE 3215", NULL, 0, NULL); 913 912 cpcmd("TERM AUTOCR OFF", NULL, 0, NULL); 914 913 }
+2 -1
drivers/s390/char/con3270.c
··· 23 23 #include <linux/memblock.h> 24 24 #include <linux/compat.h> 25 25 26 + #include <asm/machine.h> 26 27 #include <asm/ccwdev.h> 27 28 #include <asm/cio.h> 28 29 #include <asm/ebcdic.h> ··· 2157 2156 return -ENODEV; 2158 2157 2159 2158 /* Set the console mode for VM */ 2160 - if (MACHINE_IS_VM) { 2159 + if (machine_is_vm()) { 2161 2160 cpcmd("TERM CONMODE 3270", NULL, 0, NULL); 2162 2161 cpcmd("TERM AUTOCR OFF", NULL, 0, NULL); 2163 2162 }
+4 -2
drivers/s390/char/hmcdrv_ftp.c
··· 17 17 #include <linux/ctype.h> 18 18 #include <linux/crc16.h> 19 19 20 + #include <asm/machine.h> 21 + 20 22 #include "hmcdrv_ftp.h" 21 23 #include "hmcdrv_cache.h" 22 24 #include "sclp_ftp.h" ··· 310 308 mutex_lock(&hmcdrv_ftp_mutex); /* block transfers while start-up */ 311 309 312 310 if (hmcdrv_ftp_refcnt == 0) { 313 - if (MACHINE_IS_VM) 311 + if (machine_is_vm()) 314 312 hmcdrv_ftp_funcs = &hmcdrv_ftp_zvm; 315 - else if (MACHINE_IS_LPAR || MACHINE_IS_KVM) 313 + else if (machine_is_lpar() || machine_is_kvm()) 316 314 hmcdrv_ftp_funcs = &hmcdrv_ftp_lpar; 317 315 else 318 316 rc = -EOPNOTSUPP;
+2 -1
drivers/s390/char/monreader.c
··· 24 24 #include <linux/slab.h> 25 25 #include <net/iucv/iucv.h> 26 26 #include <linux/uaccess.h> 27 + #include <asm/machine.h> 27 28 #include <asm/ebcdic.h> 28 29 #include <asm/extmem.h> 29 30 ··· 457 456 { 458 457 int rc; 459 458 460 - if (!MACHINE_IS_VM) { 459 + if (!machine_is_vm()) { 461 460 pr_err("The z/VM *MONITOR record device driver cannot be " 462 461 "loaded without z/VM\n"); 463 462 return -ENODEV;
+2 -1
drivers/s390/char/monwriter.c
··· 23 23 #include <linux/slab.h> 24 24 #include <linux/uaccess.h> 25 25 #include <linux/io.h> 26 + #include <asm/machine.h> 26 27 #include <asm/ebcdic.h> 27 28 #include <asm/appldata.h> 28 29 #include <asm/monwriter.h> ··· 294 293 295 294 static int __init mon_init(void) 296 295 { 297 - if (!MACHINE_IS_VM) 296 + if (!machine_is_vm()) 298 297 return -ENODEV; 299 298 /* 300 299 * misc_register() has to be the last action in module_init(), because
+2 -1
drivers/s390/char/raw3270.c
··· 17 17 #include <linux/types.h> 18 18 #include <linux/wait.h> 19 19 20 + #include <asm/machine.h> 20 21 #include <asm/ccwdev.h> 21 22 #include <asm/cio.h> 22 23 #include <asm/ebcdic.h> ··· 619 618 if (rq->rc) { 620 619 /* Reset command failed. */ 621 620 rp->state = RAW3270_STATE_INIT; 622 - } else if (MACHINE_IS_VM) { 621 + } else if (machine_is_vm()) { 623 622 raw3270_size_device_vm(rp); 624 623 raw3270_size_device_done(rp); 625 624 } else {
+4 -3
drivers/s390/char/sclp.h
··· 12 12 #include <linux/types.h> 13 13 #include <linux/list.h> 14 14 #include <asm/asm-extable.h> 15 + #include <asm/machine.h> 15 16 #include <asm/sclp.h> 16 17 #include <asm/ebcdic.h> 17 18 #include <asm/asm.h> ··· 343 342 static inline unsigned char 344 343 sclp_ascebc(unsigned char ch) 345 344 { 346 - return (MACHINE_IS_VM) ? _ascebc[ch] : _ascebc_500[ch]; 345 + return (machine_is_vm()) ? _ascebc[ch] : _ascebc_500[ch]; 347 346 } 348 347 349 348 /* translate string from EBCDIC to ASCII */ 350 349 static inline void 351 350 sclp_ebcasc_str(char *str, int nr) 352 351 { 353 - (MACHINE_IS_VM) ? EBCASC(str, nr) : EBCASC_500(str, nr); 352 + (machine_is_vm()) ? EBCASC(str, nr) : EBCASC_500(str, nr); 354 353 } 355 354 356 355 /* translate string from ASCII to EBCDIC */ 357 356 static inline void 358 357 sclp_ascebc_str(char *str, int nr) 359 358 { 360 - (MACHINE_IS_VM) ? ASCEBC(str, nr) : ASCEBC_500(str, nr); 359 + (machine_is_vm()) ? ASCEBC(str, nr) : ASCEBC_500(str, nr); 361 360 } 362 361 363 362 static inline struct gds_vector *
+1 -1
drivers/s390/char/sclp_early.c
··· 74 74 sclp.hamax = U64_MAX; 75 75 76 76 if (!sccb->hcpua) { 77 - if (MACHINE_IS_VM) 77 + if (machine_is_vm()) 78 78 sclp.max_cores = 64; 79 79 else 80 80 sclp.max_cores = sccb->ncpurl;
+2 -2
drivers/s390/char/sclp_tty.c
··· 499 499 int rc; 500 500 501 501 /* z/VM multiplexes the line mode output on the 32xx screen */ 502 - if (MACHINE_IS_VM && !CONSOLE_IS_SCLP) 502 + if (machine_is_vm() && !CONSOLE_IS_SCLP) 503 503 return 0; 504 504 if (!sclp.has_linemode) 505 505 return 0; ··· 524 524 timer_setup(&sclp_tty_timer, sclp_tty_timeout, 0); 525 525 sclp_ttybuf = NULL; 526 526 sclp_tty_buffer_count = 0; 527 - if (MACHINE_IS_VM) { 527 + if (machine_is_vm()) { 528 528 /* case input lines to lowercase */ 529 529 sclp_tty_tolower = 1; 530 530 }
+3 -2
drivers/s390/char/vmcp.c
··· 23 23 #include <linux/mutex.h> 24 24 #include <linux/cma.h> 25 25 #include <linux/mm.h> 26 + #include <asm/machine.h> 26 27 #include <asm/cpcmd.h> 27 28 #include <asm/debug.h> 28 29 #include <asm/vmcp.h> ··· 53 52 54 53 void __init vmcp_cma_reserve(void) 55 54 { 56 - if (!MACHINE_IS_VM) 55 + if (!machine_is_vm()) 57 56 return; 58 57 cma_declare_contiguous(0, vmcp_cma_size, 0, 0, 0, false, "vmcp", &vmcp_cma); 59 58 } ··· 255 254 { 256 255 int ret; 257 256 258 - if (!MACHINE_IS_VM) 257 + if (!machine_is_vm()) 259 258 return 0; 260 259 261 260 vmcp_debug = debug_register("vmcp", 1, 1, 240);
+2 -1
drivers/s390/char/vmlogrdr.c
··· 23 23 #include <linux/spinlock.h> 24 24 #include <linux/atomic.h> 25 25 #include <linux/uaccess.h> 26 + #include <asm/machine.h> 26 27 #include <asm/cpcmd.h> 27 28 #include <asm/debug.h> 28 29 #include <asm/ebcdic.h> ··· 810 809 int i; 811 810 dev_t dev; 812 811 813 - if (! MACHINE_IS_VM) { 812 + if (!machine_is_vm()) { 814 813 pr_err("not running under VM, driver not loaded.\n"); 815 814 return -ENODEV; 816 815 }
+2 -1
drivers/s390/char/vmur.c
··· 18 18 #include <linux/kobject.h> 19 19 20 20 #include <linux/uaccess.h> 21 + #include <asm/machine.h> 21 22 #include <asm/cio.h> 22 23 #include <asm/ccwdev.h> 23 24 #include <asm/debug.h> ··· 1010 1009 int rc; 1011 1010 dev_t dev; 1012 1011 1013 - if (!MACHINE_IS_VM) { 1012 + if (!machine_is_vm()) { 1014 1013 pr_err("The %s cannot be loaded without z/VM\n", 1015 1014 ur_banner); 1016 1015 return -ENODEV;
+2 -1
drivers/s390/cio/device_id.c
··· 12 12 #include <linux/string.h> 13 13 #include <linux/types.h> 14 14 #include <linux/errno.h> 15 + #include <asm/machine.h> 15 16 #include <asm/ccwdev.h> 16 17 #include <asm/setup.h> 17 18 #include <asm/cio.h> ··· 176 175 struct senseid *senseid = &cdev->private->dma_area->senseid; 177 176 int vm = 0; 178 177 179 - if (rc && MACHINE_IS_VM) { 178 + if (rc && machine_is_vm()) { 180 179 /* Try diag 0x210 fallback on z/VM. */ 181 180 snsid_init(cdev); 182 181 if (diag210_get_dev_info(cdev) == 0) {
+2 -1
drivers/s390/crypto/ap_bus.c
··· 26 26 #include <linux/notifier.h> 27 27 #include <linux/kthread.h> 28 28 #include <linux/mutex.h> 29 + #include <asm/machine.h> 29 30 #include <asm/airq.h> 30 31 #include <asm/tpi.h> 31 32 #include <linux/atomic.h> ··· 2325 2324 * Setup the high resolution poll timer. 2326 2325 * If we are running under z/VM adjust polling to z/VM polling rate. 2327 2326 */ 2328 - if (MACHINE_IS_VM) 2327 + if (machine_is_vm()) 2329 2328 poll_high_timeout = 1500000; 2330 2329 hrtimer_init(&ap_poll_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); 2331 2330 ap_poll_timer.function = ap_poll_timeout;
+2 -1
drivers/s390/net/qeth_l2_main.c
··· 22 22 #include <linux/hash.h> 23 23 #include <linux/hashtable.h> 24 24 #include <net/switchdev.h> 25 + #include <asm/machine.h> 25 26 #include <asm/chsc.h> 26 27 #include <asm/css_chars.h> 27 28 #include <asm/setup.h> ··· 300 299 301 300 QETH_CARD_TEXT(card, 2, "l2reqmac"); 302 301 303 - if (MACHINE_IS_VM) { 302 + if (machine_is_vm()) { 304 303 rc = qeth_vm_request_mac(card); 305 304 if (!rc) 306 305 goto out;
+2 -1
drivers/s390/net/smsgiucv.c
··· 13 13 #include <linux/device.h> 14 14 #include <linux/slab.h> 15 15 #include <net/iucv/iucv.h> 16 + #include <asm/machine.h> 16 17 #include <asm/cpcmd.h> 17 18 #include <asm/ebcdic.h> 18 19 #include "smsgiucv.h" ··· 139 138 { 140 139 int rc; 141 140 142 - if (!MACHINE_IS_VM) { 141 + if (!machine_is_vm()) { 143 142 rc = -EPROTONOSUPPORT; 144 143 goto out; 145 144 }
+2 -1
drivers/s390/net/smsgiucv_app.c
··· 23 23 #include <linux/spinlock.h> 24 24 #include <linux/workqueue.h> 25 25 #include <net/iucv/iucv.h> 26 + #include <asm/machine.h> 26 27 #include "smsgiucv.h" 27 28 28 29 /* prefix used for SMSG registration */ ··· 154 153 struct device_driver *smsgiucv_drv; 155 154 int rc; 156 155 157 - if (!MACHINE_IS_VM) 156 + if (!machine_is_vm()) 158 157 return -ENODEV; 159 158 160 159 smsgiucv_drv = driver_find(SMSGIUCV_DRV_NAME, &iucv_bus);
+4 -3
drivers/tty/hvc/hvc_iucv.c
··· 24 24 #include <linux/tty.h> 25 25 #include <linux/wait.h> 26 26 #include <net/iucv/iucv.h> 27 + #include <asm/machine.h> 27 28 28 29 #include "hvc_console.h" 29 30 ··· 1241 1240 { 1242 1241 int rc; 1243 1242 1244 - if (!MACHINE_IS_VM || !hvc_iucv_devices) 1243 + if (!machine_is_vm() || !hvc_iucv_devices) 1245 1244 return -ENODEV; 1246 1245 1247 1246 if (!val) ··· 1270 1269 size_t index, len; 1271 1270 void *start, *end; 1272 1271 1273 - if (!MACHINE_IS_VM || !hvc_iucv_devices) 1272 + if (!machine_is_vm() || !hvc_iucv_devices) 1274 1273 return -ENODEV; 1275 1274 1276 1275 rc = 0; ··· 1307 1306 if (!hvc_iucv_devices) 1308 1307 return -ENODEV; 1309 1308 1310 - if (!MACHINE_IS_VM) { 1309 + if (!machine_is_vm()) { 1311 1310 pr_notice("The z/VM IUCV HVC device driver cannot " 1312 1311 "be used without z/VM\n"); 1313 1312 rc = -ENODEV;
+4 -3
drivers/watchdog/diag288_wdt.c
··· 27 27 #include <linux/moduleparam.h> 28 28 #include <linux/slab.h> 29 29 #include <linux/watchdog.h> 30 + #include <asm/machine.h> 30 31 #include <asm/ebcdic.h> 31 32 #include <asm/diag.h> 32 33 #include <linux/io.h> ··· 111 110 int ret; 112 111 unsigned int func; 113 112 114 - if (MACHINE_IS_VM) { 113 + if (machine_is_vm()) { 115 114 func = conceal_on ? (WDT_FUNC_INIT | WDT_FUNC_CONCEAL) 116 115 : WDT_FUNC_INIT; 117 116 ret = diag288_str(func, dev->timeout, wdt_cmd); ··· 137 136 int ret; 138 137 unsigned int func; 139 138 140 - if (MACHINE_IS_VM) { 139 + if (machine_is_vm()) { 141 140 /* 142 141 * It seems to be ok to z/VM to use the init function to 143 142 * retrigger the watchdog. On LPAR WDT_FUNC_CHANGE must ··· 193 192 194 193 watchdog_set_nowayout(&wdt_dev, nowayout_info); 195 194 196 - if (MACHINE_IS_VM) { 195 + if (machine_is_vm()) { 197 196 cmd_buf = kmalloc(MAX_CMDLEN, GFP_KERNEL); 198 197 if (!cmd_buf) { 199 198 pr_err("The watchdog cannot be initialized\n");
+2 -1
net/iucv/af_iucv.c
··· 28 28 #include <linux/poll.h> 29 29 #include <linux/security.h> 30 30 #include <net/sock.h> 31 + #include <asm/machine.h> 31 32 #include <asm/ebcdic.h> 32 33 #include <asm/cpcmd.h> 33 34 #include <linux/kmod.h> ··· 2273 2272 { 2274 2273 int err; 2275 2274 2276 - if (MACHINE_IS_VM && IS_ENABLED(CONFIG_IUCV)) { 2275 + if (machine_is_vm() && IS_ENABLED(CONFIG_IUCV)) { 2277 2276 cpcmd("QUERY USERID", iucv_userid, sizeof(iucv_userid), &err); 2278 2277 if (unlikely(err)) { 2279 2278 WARN_ON(err);
+2 -1
net/iucv/iucv.c
··· 39 39 #include <linux/reboot.h> 40 40 #include <net/iucv/iucv.h> 41 41 #include <linux/atomic.h> 42 + #include <asm/machine.h> 42 43 #include <asm/ebcdic.h> 43 44 #include <asm/io.h> 44 45 #include <asm/irq.h> ··· 1866 1865 { 1867 1866 int rc; 1868 1867 1869 - if (!MACHINE_IS_VM) { 1868 + if (!machine_is_vm()) { 1870 1869 rc = -EPROTONOSUPPORT; 1871 1870 goto out; 1872 1871 }