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>
This commit is contained in:
Heiko Carstens 2025-02-07 15:49:07 +01:00 committed by Vasily Gorbik
parent 91d6e44221
commit 52109a067a
41 changed files with 140 additions and 103 deletions

View file

@ -8,6 +8,7 @@
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/maccess.h> #include <asm/maccess.h>
#include <asm/machine.h> #include <asm/machine.h>
#include <asm/sysinfo.h>
#include <asm/cpu_mf.h> #include <asm/cpu_mf.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/timex.h> #include <asm/timex.h>
@ -49,6 +50,27 @@ void error(char *x)
disabled_wait(); disabled_wait();
} }
static char sysinfo_page[PAGE_SIZE] __aligned(PAGE_SIZE);
static void detect_machine_type(void)
{
struct sysinfo_3_2_2 *vmms = (struct sysinfo_3_2_2 *)&sysinfo_page;
/* Check current-configuration-level */
if (stsi(NULL, 0, 0, 0) <= 2) {
set_machine_feature(MFEATURE_LPAR);
return;
}
/* Get virtual-machine cpu information. */
if (stsi(vmms, 3, 2, 2) || !vmms->count)
return;
/* Detect known hypervisors */
if (!memcmp(vmms->vm[0].cpi, "\xd2\xe5\xd4", 3))
set_machine_feature(MFEATURE_KVM);
else if (!memcmp(vmms->vm[0].cpi, "\xa9\x61\xe5\xd4", 4))
set_machine_feature(MFEATURE_VM);
}
static void detect_diag9c(void) static void detect_diag9c(void)
{ {
unsigned long reg1, reg2; unsigned long reg1, reg2;
@ -520,6 +542,7 @@ void startup_kernel(void)
sclp_early_detect_machine_features(); sclp_early_detect_machine_features();
detect_facilities(); detect_facilities();
detect_diag9c(); detect_diag9c();
detect_machine_type();
cmma_init(); cmma_init();
sanitize_prot_virt_host(); sanitize_prot_virt_host();
max_physmem_end = detect_max_physmem_end(); max_physmem_end = detect_max_physmem_end();

View file

@ -9,6 +9,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <asm/machine.h>
#include <asm/diag.h> #include <asm/diag.h>
#include <asm/hypfs.h> #include <asm/hypfs.h>
#include "hypfs.h" #include "hypfs.h"
@ -107,7 +108,7 @@ static struct hypfs_dbfs_file dbfs_file_0c = {
*/ */
int __init hypfs_diag0c_init(void) int __init hypfs_diag0c_init(void)
{ {
if (!MACHINE_IS_VM) if (!machine_is_vm())
return 0; return 0;
hypfs_dbfs_create_file(&dbfs_file_0c); hypfs_dbfs_create_file(&dbfs_file_0c);
return 0; return 0;
@ -118,7 +119,7 @@ int __init hypfs_diag0c_init(void)
*/ */
void hypfs_diag0c_exit(void) void hypfs_diag0c_exit(void)
{ {
if (!MACHINE_IS_VM) if (!machine_is_vm())
return; return;
hypfs_dbfs_remove_file(&dbfs_file_0c); hypfs_dbfs_remove_file(&dbfs_file_0c);
} }

View file

@ -16,6 +16,7 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/machine.h>
#include <asm/diag.h> #include <asm/diag.h>
#include <asm/ebcdic.h> #include <asm/ebcdic.h>
#include "hypfs_diag.h" #include "hypfs_diag.h"
@ -382,7 +383,7 @@ static void diag224_delete_name_table(void)
int __init __hypfs_diag_fs_init(void) int __init __hypfs_diag_fs_init(void)
{ {
if (MACHINE_IS_LPAR) if (machine_is_lpar())
return diag224_get_name_table(); return diag224_get_name_table();
return 0; return 0;
} }

View file

@ -11,6 +11,7 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <asm/extable.h> #include <asm/extable.h>
#include <asm/machine.h>
#include <asm/diag.h> #include <asm/diag.h>
#include <asm/ebcdic.h> #include <asm/ebcdic.h>
#include <asm/timex.h> #include <asm/timex.h>
@ -121,7 +122,7 @@ static struct hypfs_dbfs_file dbfs_file_2fc = {
int hypfs_vm_init(void) int hypfs_vm_init(void)
{ {
if (!MACHINE_IS_VM) if (!machine_is_vm())
return 0; return 0;
if (diag2fc(0, all_guests, NULL) > 0) if (diag2fc(0, all_guests, NULL) > 0)
diag2fc_guest_query = all_guests; diag2fc_guest_query = all_guests;
@ -135,7 +136,7 @@ int hypfs_vm_init(void)
void hypfs_vm_exit(void) void hypfs_vm_exit(void)
{ {
if (!MACHINE_IS_VM) if (!machine_is_vm())
return; return;
hypfs_dbfs_remove_file(&dbfs_file_2fc); hypfs_dbfs_remove_file(&dbfs_file_2fc);
} }

View file

@ -24,6 +24,7 @@
#include <linux/kobject.h> #include <linux/kobject.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/uio.h> #include <linux/uio.h>
#include <asm/machine.h>
#include <asm/ebcdic.h> #include <asm/ebcdic.h>
#include "hypfs.h" #include "hypfs.h"
@ -184,7 +185,7 @@ static ssize_t hypfs_write_iter(struct kiocb *iocb, struct iov_iter *from)
goto out; goto out;
} }
hypfs_delete_tree(sb->s_root); hypfs_delete_tree(sb->s_root);
if (MACHINE_IS_VM) if (machine_is_vm())
rc = hypfs_vm_create_files(sb->s_root); rc = hypfs_vm_create_files(sb->s_root);
else else
rc = hypfs_diag_create_files(sb->s_root); rc = hypfs_diag_create_files(sb->s_root);
@ -273,7 +274,7 @@ static int hypfs_fill_super(struct super_block *sb, struct fs_context *fc)
sb->s_root = root_dentry = d_make_root(root_inode); sb->s_root = root_dentry = d_make_root(root_inode);
if (!root_dentry) if (!root_dentry)
return -ENOMEM; return -ENOMEM;
if (MACHINE_IS_VM) if (machine_is_vm())
rc = hypfs_vm_create_files(root_dentry); rc = hypfs_vm_create_files(root_dentry);
else else
rc = hypfs_diag_create_files(root_dentry); rc = hypfs_diag_create_files(root_dentry);

View file

@ -9,6 +9,7 @@
#define _ASM_S390_APPLDATA_H #define _ASM_S390_APPLDATA_H
#include <linux/io.h> #include <linux/io.h>
#include <asm/machine.h>
#include <asm/diag.h> #include <asm/diag.h>
#define APPLDATA_START_INTERVAL_REC 0x80 #define APPLDATA_START_INTERVAL_REC 0x80
@ -48,7 +49,7 @@ static inline int appldata_asm(struct appldata_parameter_list *parm_list,
{ {
int ry; int ry;
if (!MACHINE_IS_VM) if (!machine_is_vm())
return -EOPNOTSUPP; return -EOPNOTSUPP;
parm_list->diag = 0xdc; parm_list->diag = 0xdc;
parm_list->function = fn; parm_list->function = fn;

View file

@ -15,6 +15,9 @@
#define MFEATURE_TX 4 #define MFEATURE_TX 4
#define MFEATURE_ESOP 5 #define MFEATURE_ESOP 5
#define MFEATURE_DIAG9C 6 #define MFEATURE_DIAG9C 6
#define MFEATURE_VM 7
#define MFEATURE_KVM 8
#define MFEATURE_LPAR 9
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
@ -88,6 +91,13 @@ DEFINE_MACHINE_HAS_FEATURE(tlb_guest, MFEATURE_TLB_GUEST)
DEFINE_MACHINE_HAS_FEATURE(tx, MFEATURE_TX) DEFINE_MACHINE_HAS_FEATURE(tx, MFEATURE_TX)
DEFINE_MACHINE_HAS_FEATURE(esop, MFEATURE_ESOP) DEFINE_MACHINE_HAS_FEATURE(esop, MFEATURE_ESOP)
DEFINE_MACHINE_HAS_FEATURE(diag9c, MFEATURE_DIAG9C) DEFINE_MACHINE_HAS_FEATURE(diag9c, MFEATURE_DIAG9C)
DEFINE_MACHINE_HAS_FEATURE(vm, MFEATURE_VM)
DEFINE_MACHINE_HAS_FEATURE(kvm, MFEATURE_KVM)
DEFINE_MACHINE_HAS_FEATURE(lpar, MFEATURE_LPAR)
#define machine_is_vm machine_has_vm
#define machine_is_kvm machine_has_kvm
#define machine_is_lpar machine_has_lpar
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* __ASM_S390_MACHINE_H */ #endif /* __ASM_S390_MACHINE_H */

View file

@ -13,13 +13,6 @@
#define PARMAREA 0x10400 #define PARMAREA 0x10400
#define COMMAND_LINE_SIZE CONFIG_COMMAND_LINE_SIZE #define COMMAND_LINE_SIZE CONFIG_COMMAND_LINE_SIZE
/*
* Machine features detected in early.c
*/
#define MACHINE_FLAG_VM BIT(0)
#define MACHINE_FLAG_KVM BIT(1)
#define MACHINE_FLAG_LPAR BIT(2)
#define LPP_MAGIC BIT(31) #define LPP_MAGIC BIT(31)
#define LPP_PID_MASK _AC(0xffffffff, UL) #define LPP_PID_MASK _AC(0xffffffff, UL)
@ -63,10 +56,6 @@ extern unsigned long max_mappable;
/* The Write Back bit position in the physaddr is given by the SLPC PCI */ /* The Write Back bit position in the physaddr is given by the SLPC PCI */
extern unsigned long mio_wb_bit_mask; extern unsigned long mio_wb_bit_mask;
#define MACHINE_IS_VM (get_lowcore()->machine_flags & MACHINE_FLAG_VM)
#define MACHINE_IS_KVM (get_lowcore()->machine_flags & MACHINE_FLAG_KVM)
#define MACHINE_IS_LPAR (get_lowcore()->machine_flags & MACHINE_FLAG_LPAR)
/* /*
* Console mode. Override with conmode= * Console mode. Override with conmode=
*/ */

View file

@ -22,6 +22,7 @@
#include <asm/asm-extable.h> #include <asm/asm-extable.h>
#include <linux/memblock.h> #include <linux/memblock.h>
#include <asm/access-regs.h> #include <asm/access-regs.h>
#include <asm/machine.h>
#include <asm/diag.h> #include <asm/diag.h>
#include <asm/ebcdic.h> #include <asm/ebcdic.h>
#include <asm/fpu.h> #include <asm/fpu.h>
@ -82,26 +83,6 @@ static noinline __init void init_kernel_storage_key(void)
static __initdata char sysinfo_page[PAGE_SIZE] __aligned(PAGE_SIZE); static __initdata char sysinfo_page[PAGE_SIZE] __aligned(PAGE_SIZE);
static noinline __init void detect_machine_type(void)
{
struct sysinfo_3_2_2 *vmms = (struct sysinfo_3_2_2 *)&sysinfo_page;
/* Check current-configuration-level */
if (stsi(NULL, 0, 0, 0) <= 2) {
get_lowcore()->machine_flags |= MACHINE_FLAG_LPAR;
return;
}
/* Get virtual-machine cpu information. */
if (stsi(vmms, 3, 2, 2) || !vmms->count)
return;
/* Detect known hypervisors */
if (!memcmp(vmms->vm[0].cpi, "\xd2\xe5\xd4", 3))
get_lowcore()->machine_flags |= MACHINE_FLAG_KVM;
else if (!memcmp(vmms->vm[0].cpi, "\xa9\x61\xe5\xd4", 4))
get_lowcore()->machine_flags |= MACHINE_FLAG_VM;
}
/* Remove leading, trailing and double whitespace. */ /* Remove leading, trailing and double whitespace. */
static inline void strim_all(char *str) static inline void strim_all(char *str)
{ {
@ -142,9 +123,9 @@ static noinline __init void setup_arch_string(void)
strim_all(hvstr); strim_all(hvstr);
} else { } else {
sprintf(hvstr, "%s", sprintf(hvstr, "%s",
MACHINE_IS_LPAR ? "LPAR" : machine_is_lpar() ? "LPAR" :
MACHINE_IS_VM ? "z/VM" : machine_is_vm() ? "z/VM" :
MACHINE_IS_KVM ? "KVM" : "unknown"); machine_is_kvm() ? "KVM" : "unknown");
} }
dump_stack_set_arch_desc("%s (%s)", mstr, hvstr); dump_stack_set_arch_desc("%s (%s)", mstr, hvstr);
} }
@ -249,7 +230,6 @@ void __init startup_init(void)
lockdep_off(); lockdep_off();
sort_amode31_extable(); sort_amode31_extable();
setup_lowcore_early(); setup_lowcore_early();
detect_machine_type();
setup_arch_string(); setup_arch_string();
setup_boot_command_line(); setup_boot_command_line();
detect_machine_facilities(); detect_machine_facilities();

View file

@ -22,6 +22,7 @@
#include <linux/debug_locks.h> #include <linux/debug_locks.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <asm/asm-extable.h> #include <asm/asm-extable.h>
#include <asm/machine.h>
#include <asm/diag.h> #include <asm/diag.h>
#include <asm/ipl.h> #include <asm/ipl.h>
#include <asm/smp.h> #include <asm/smp.h>
@ -685,7 +686,7 @@ static int __init ipl_init(void)
goto out; goto out;
switch (ipl_info.type) { switch (ipl_info.type) {
case IPL_TYPE_CCW: case IPL_TYPE_CCW:
if (MACHINE_IS_VM) if (machine_is_vm())
rc = sysfs_create_group(&ipl_kset->kobj, rc = sysfs_create_group(&ipl_kset->kobj,
&ipl_ccw_attr_group_vm); &ipl_ccw_attr_group_vm);
else else
@ -1272,7 +1273,7 @@ static void reipl_block_ccw_fill_parms(struct ipl_parameter_block *ipb)
ipb->ccw.flags = IPL_PB0_FLAG_LOADPARM; ipb->ccw.flags = IPL_PB0_FLAG_LOADPARM;
/* VM PARM */ /* VM PARM */
if (MACHINE_IS_VM && ipl_block_valid && if (machine_is_vm() && ipl_block_valid &&
(ipl_block.ccw.vm_flags & IPL_PB0_CCW_VM_FLAG_VP)) { (ipl_block.ccw.vm_flags & IPL_PB0_CCW_VM_FLAG_VP)) {
ipb->ccw.vm_flags |= IPL_PB0_CCW_VM_FLAG_VP; ipb->ccw.vm_flags |= IPL_PB0_CCW_VM_FLAG_VP;
@ -1286,7 +1287,7 @@ static int __init reipl_nss_init(void)
{ {
int rc; int rc;
if (!MACHINE_IS_VM) if (!machine_is_vm())
return 0; return 0;
reipl_block_nss = (void *) get_zeroed_page(GFP_KERNEL); reipl_block_nss = (void *) get_zeroed_page(GFP_KERNEL);
@ -1311,8 +1312,8 @@ static int __init reipl_ccw_init(void)
return -ENOMEM; return -ENOMEM;
rc = sysfs_create_group(&reipl_kset->kobj, rc = sysfs_create_group(&reipl_kset->kobj,
MACHINE_IS_VM ? &reipl_ccw_attr_group_vm machine_is_vm() ? &reipl_ccw_attr_group_vm
: &reipl_ccw_attr_group_lpar); : &reipl_ccw_attr_group_lpar);
if (rc) if (rc)
return rc; return rc;
@ -1987,7 +1988,7 @@ static void vmcmd_run(struct shutdown_trigger *trigger)
static int vmcmd_init(void) static int vmcmd_init(void)
{ {
if (!MACHINE_IS_VM) if (!machine_is_vm())
return -EOPNOTSUPP; return -EOPNOTSUPP;
vmcmd_kset = kset_create_and_add("vmcmd", NULL, firmware_kobj); vmcmd_kset = kset_create_and_add("vmcmd", NULL, firmware_kobj);
if (!vmcmd_kset) if (!vmcmd_kset)
@ -2264,7 +2265,7 @@ static void __init strncpy_skip_quote(char *dst, char *src, int n)
static int __init vmcmd_on_reboot_setup(char *str) static int __init vmcmd_on_reboot_setup(char *str)
{ {
if (!MACHINE_IS_VM) if (!machine_is_vm())
return 1; return 1;
strncpy_skip_quote(vmcmd_on_reboot, str, VMCMD_MAX_SIZE); strncpy_skip_quote(vmcmd_on_reboot, str, VMCMD_MAX_SIZE);
vmcmd_on_reboot[VMCMD_MAX_SIZE] = 0; vmcmd_on_reboot[VMCMD_MAX_SIZE] = 0;
@ -2275,7 +2276,7 @@ __setup("vmreboot=", vmcmd_on_reboot_setup);
static int __init vmcmd_on_panic_setup(char *str) static int __init vmcmd_on_panic_setup(char *str)
{ {
if (!MACHINE_IS_VM) if (!machine_is_vm())
return 1; return 1;
strncpy_skip_quote(vmcmd_on_panic, str, VMCMD_MAX_SIZE); strncpy_skip_quote(vmcmd_on_panic, str, VMCMD_MAX_SIZE);
vmcmd_on_panic[VMCMD_MAX_SIZE] = 0; vmcmd_on_panic[VMCMD_MAX_SIZE] = 0;
@ -2286,7 +2287,7 @@ __setup("vmpanic=", vmcmd_on_panic_setup);
static int __init vmcmd_on_halt_setup(char *str) static int __init vmcmd_on_halt_setup(char *str)
{ {
if (!MACHINE_IS_VM) if (!machine_is_vm())
return 1; return 1;
strncpy_skip_quote(vmcmd_on_halt, str, VMCMD_MAX_SIZE); strncpy_skip_quote(vmcmd_on_halt, str, VMCMD_MAX_SIZE);
vmcmd_on_halt[VMCMD_MAX_SIZE] = 0; vmcmd_on_halt[VMCMD_MAX_SIZE] = 0;
@ -2297,7 +2298,7 @@ __setup("vmhalt=", vmcmd_on_halt_setup);
static int __init vmcmd_on_poff_setup(char *str) static int __init vmcmd_on_poff_setup(char *str)
{ {
if (!MACHINE_IS_VM) if (!machine_is_vm())
return 1; return 1;
strncpy_skip_quote(vmcmd_on_poff, str, VMCMD_MAX_SIZE); strncpy_skip_quote(vmcmd_on_poff, str, VMCMD_MAX_SIZE);
vmcmd_on_poff[VMCMD_MAX_SIZE] = 0; vmcmd_on_poff[VMCMD_MAX_SIZE] = 0;

View file

@ -25,6 +25,7 @@
#include <asm/irq_regs.h> #include <asm/irq_regs.h>
#include <asm/cputime.h> #include <asm/cputime.h>
#include <asm/lowcore.h> #include <asm/lowcore.h>
#include <asm/machine.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/hw_irq.h> #include <asm/hw_irq.h>
#include <asm/stacktrace.h> #include <asm/stacktrace.h>
@ -164,7 +165,7 @@ void noinstr do_io_irq(struct pt_regs *regs)
do_irq_async(regs, THIN_INTERRUPT); do_irq_async(regs, THIN_INTERRUPT);
else else
do_irq_async(regs, IO_INTERRUPT); do_irq_async(regs, IO_INTERRUPT);
} while (MACHINE_IS_LPAR && irq_pending(regs)); } while (machine_is_lpar() && irq_pending(regs));
irq_exit_rcu(); irq_exit_rcu();

View file

@ -15,6 +15,7 @@
#include <linux/debug_locks.h> #include <linux/debug_locks.h>
#include <linux/cpufeature.h> #include <linux/cpufeature.h>
#include <asm/guarded_storage.h> #include <asm/guarded_storage.h>
#include <asm/machine.h>
#include <asm/pfault.h> #include <asm/pfault.h>
#include <asm/cio.h> #include <asm/cio.h>
#include <asm/fpu.h> #include <asm/fpu.h>
@ -179,7 +180,7 @@ void arch_kexec_unprotect_crashkres(void)
static int machine_kexec_prepare_kdump(void) static int machine_kexec_prepare_kdump(void)
{ {
#ifdef CONFIG_CRASH_DUMP #ifdef CONFIG_CRASH_DUMP
if (MACHINE_IS_VM) if (machine_is_vm())
diag10_range(PFN_DOWN(crashk_res.start), diag10_range(PFN_DOWN(crashk_res.start),
PFN_DOWN(crashk_res.end - crashk_res.start + 1)); PFN_DOWN(crashk_res.end - crashk_res.start + 1));
return 0; return 0;

View file

@ -252,7 +252,7 @@ static void __init conmode_default(void)
char query_buffer[1024]; char query_buffer[1024];
char *ptr; char *ptr;
if (MACHINE_IS_VM) { if (machine_is_vm()) {
cpcmd("QUERY CONSOLE", query_buffer, 1024, NULL); cpcmd("QUERY CONSOLE", query_buffer, 1024, NULL);
console_devno = simple_strtoul(query_buffer + 5, NULL, 16); console_devno = simple_strtoul(query_buffer + 5, NULL, 16);
ptr = strstr(query_buffer, "SUBCHANNEL ="); ptr = strstr(query_buffer, "SUBCHANNEL =");
@ -290,7 +290,7 @@ static void __init conmode_default(void)
SET_CONSOLE_SCLP; SET_CONSOLE_SCLP;
#endif #endif
} }
} else if (MACHINE_IS_KVM) { } else if (machine_is_kvm()) {
if (sclp.has_vt220 && IS_ENABLED(CONFIG_SCLP_VT220_CONSOLE)) if (sclp.has_vt220 && IS_ENABLED(CONFIG_SCLP_VT220_CONSOLE))
SET_CONSOLE_VT220; SET_CONSOLE_VT220;
else if (sclp.has_linemode && IS_ENABLED(CONFIG_SCLP_CONSOLE)) else if (sclp.has_linemode && IS_ENABLED(CONFIG_SCLP_CONSOLE))
@ -653,7 +653,7 @@ static void __init reserve_crashkernel(void)
return; return;
} }
if (!oldmem_data.start && MACHINE_IS_VM) if (!oldmem_data.start && machine_is_vm())
diag10_range(PFN_DOWN(crash_base), PFN_DOWN(crash_size)); diag10_range(PFN_DOWN(crash_base), PFN_DOWN(crash_size));
crashk_res.start = crash_base; crashk_res.start = crash_base;
crashk_res.end = crash_base + crash_size - 1; crashk_res.end = crash_base + crash_size - 1;
@ -899,12 +899,12 @@ void __init setup_arch(char **cmdline_p)
/* /*
* print what head.S has found out about the machine * print what head.S has found out about the machine
*/ */
if (MACHINE_IS_VM) if (machine_is_vm())
pr_info("Linux is running as a z/VM " pr_info("Linux is running as a z/VM "
"guest operating system in 64-bit mode\n"); "guest operating system in 64-bit mode\n");
else if (MACHINE_IS_KVM) else if (machine_is_kvm())
pr_info("Linux is running under KVM in 64-bit mode\n"); pr_info("Linux is running under KVM in 64-bit mode\n");
else if (MACHINE_IS_LPAR) else if (machine_is_lpar())
pr_info("Linux is running natively in 64-bit mode\n"); pr_info("Linux is running natively in 64-bit mode\n");
else else
pr_info("Linux is running as a guest in 64-bit mode\n"); pr_info("Linux is running as a guest in 64-bit mode\n");

View file

@ -16,6 +16,7 @@
#include <linux/export.h> #include <linux/export.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <asm/asm-extable.h> #include <asm/asm-extable.h>
#include <asm/machine.h>
#include <asm/ebcdic.h> #include <asm/ebcdic.h>
#include <asm/debug.h> #include <asm/debug.h>
#include <asm/sysinfo.h> #include <asm/sysinfo.h>
@ -378,7 +379,7 @@ static struct service_level service_level_vm = {
static __init int create_proc_service_level(void) static __init int create_proc_service_level(void)
{ {
proc_create_seq("service_levels", 0, NULL, &service_level_seq_ops); proc_create_seq("service_levels", 0, NULL, &service_level_seq_ops);
if (MACHINE_IS_VM) if (machine_is_vm())
register_service_level(&service_level_vm); register_service_level(&service_level_vm);
return 0; return 0;
} }

View file

@ -15,6 +15,7 @@
#include <linux/percpu.h> #include <linux/percpu.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/alternative.h> #include <asm/alternative.h>
#include <asm/machine.h>
#include <asm/asm.h> #include <asm/asm.h>
int spin_retry = -1; int spin_retry = -1;
@ -212,7 +213,7 @@ static inline void arch_spin_lock_queued(arch_spinlock_t *lp)
if (count-- >= 0) if (count-- >= 0)
continue; continue;
count = spin_retry; count = spin_retry;
if (!MACHINE_IS_LPAR || arch_vcpu_is_preempted(owner - 1)) if (!machine_is_lpar() || arch_vcpu_is_preempted(owner - 1))
smp_yield_cpu(owner - 1); smp_yield_cpu(owner - 1);
} }
@ -255,7 +256,7 @@ static inline void arch_spin_lock_classic(arch_spinlock_t *lp)
if (count-- >= 0) if (count-- >= 0)
continue; continue;
count = spin_retry; count = spin_retry;
if (!MACHINE_IS_LPAR || arch_vcpu_is_preempted(owner - 1)) if (!machine_is_lpar() || arch_vcpu_is_preempted(owner - 1))
smp_yield_cpu(owner - 1); smp_yield_cpu(owner - 1);
} }
} }
@ -337,7 +338,7 @@ void arch_spin_relax(arch_spinlock_t *lp)
cpu = READ_ONCE(lp->lock) & _Q_LOCK_CPU_MASK; cpu = READ_ONCE(lp->lock) & _Q_LOCK_CPU_MASK;
if (!cpu) if (!cpu)
return; return;
if (MACHINE_IS_LPAR && !arch_vcpu_is_preempted(cpu - 1)) if (machine_is_lpar() && !arch_vcpu_is_preempted(cpu - 1))
return; return;
smp_yield_cpu(cpu - 1); smp_yield_cpu(cpu - 1);
} }

View file

@ -21,6 +21,7 @@
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/refcount.h> #include <linux/refcount.h>
#include <linux/pgtable.h> #include <linux/pgtable.h>
#include <asm/machine.h>
#include <asm/diag.h> #include <asm/diag.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/ebcdic.h> #include <asm/ebcdic.h>
@ -255,7 +256,7 @@ segment_type (char* name)
int rc; int rc;
struct dcss_segment seg; struct dcss_segment seg;
if (!MACHINE_IS_VM) if (!machine_is_vm())
return -ENOSYS; return -ENOSYS;
dcss_mkname(name, seg.dcss_name); dcss_mkname(name, seg.dcss_name);
@ -418,7 +419,7 @@ segment_load (char *name, int do_nonshared, unsigned long *addr,
struct dcss_segment *seg; struct dcss_segment *seg;
int rc; int rc;
if (!MACHINE_IS_VM) if (!machine_is_vm())
return -ENOSYS; return -ENOSYS;
mutex_lock(&dcss_lock); mutex_lock(&dcss_lock);
@ -540,7 +541,7 @@ segment_unload(char *name)
unsigned long dummy; unsigned long dummy;
struct dcss_segment *seg; struct dcss_segment *seg;
if (!MACHINE_IS_VM) if (!machine_is_vm())
return; return;
mutex_lock(&dcss_lock); mutex_lock(&dcss_lock);
@ -572,7 +573,7 @@ segment_save(char *name)
char cmd2[80]; char cmd2[80];
int i, response; int i, response;
if (!MACHINE_IS_VM) if (!machine_is_vm())
return; return;
mutex_lock(&dcss_lock); mutex_lock(&dcss_lock);

View file

@ -21,6 +21,7 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <asm/machine.h>
#include <asm/ccwdev.h> #include <asm/ccwdev.h>
#include <asm/ebcdic.h> #include <asm/ebcdic.h>
#include <asm/idals.h> #include <asm/idals.h>
@ -3382,7 +3383,7 @@ int dasd_device_is_ro(struct dasd_device *device)
struct diag210 diag_data; struct diag210 diag_data;
int rc; int rc;
if (!MACHINE_IS_VM) if (!machine_is_vm())
return 0; return 0;
ccw_device_get_id(device->cdev, &dev_id); ccw_device_get_id(device->cdev, &dev_id);
memset(&diag_data, 0, sizeof(diag_data)); memset(&diag_data, 0, sizeof(diag_data));

View file

@ -18,6 +18,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <asm/machine.h>
#include <asm/debug.h> #include <asm/debug.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <asm/ipl.h> #include <asm/ipl.h>
@ -234,7 +235,7 @@ static int __init dasd_parse_keyword(char *keyword)
return 0; return 0;
} }
if (strncmp("nopav", keyword, length) == 0) { if (strncmp("nopav", keyword, length) == 0) {
if (MACHINE_IS_VM) if (machine_is_vm())
pr_info("'nopav' is not supported on z/VM\n"); pr_info("'nopav' is not supported on z/VM\n");
else { else {
dasd_nopav = 1; dasd_nopav = 1;

View file

@ -18,6 +18,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <asm/asm-extable.h> #include <asm/asm-extable.h>
#include <asm/machine.h>
#include <asm/dasd.h> #include <asm/dasd.h>
#include <asm/debug.h> #include <asm/debug.h>
#include <asm/diag.h> #include <asm/diag.h>
@ -654,7 +655,7 @@ static struct dasd_discipline dasd_diag_discipline = {
static int __init static int __init
dasd_diag_init(void) dasd_diag_init(void)
{ {
if (!MACHINE_IS_VM) { if (!machine_is_vm()) {
pr_info("Discipline %s cannot be used without z/VM\n", pr_info("Discipline %s cannot be used without z/VM\n",
dasd_diag_discipline.name); dasd_diag_discipline.name);
return -ENODEV; return -ENODEV;

View file

@ -23,6 +23,7 @@
#include <linux/io.h> #include <linux/io.h>
#include <asm/css_chars.h> #include <asm/css_chars.h>
#include <asm/machine.h>
#include <asm/debug.h> #include <asm/debug.h>
#include <asm/idals.h> #include <asm/idals.h>
#include <asm/ebcdic.h> #include <asm/ebcdic.h>
@ -1953,7 +1954,7 @@ static int dasd_eckd_validate_server(struct dasd_device *device,
if (private->uid.type == UA_BASE_PAV_ALIAS || if (private->uid.type == UA_BASE_PAV_ALIAS ||
private->uid.type == UA_HYPER_PAV_ALIAS) private->uid.type == UA_HYPER_PAV_ALIAS)
return 0; return 0;
if (dasd_nopav || MACHINE_IS_VM) if (dasd_nopav || machine_is_vm())
enable_pav = 0; enable_pav = 0;
else else
enable_pav = 1; enable_pav = 1;

View file

@ -23,6 +23,7 @@
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/serial.h> /* ASYNC_* flags */ #include <linux/serial.h> /* ASYNC_* flags */
#include <linux/slab.h> #include <linux/slab.h>
#include <asm/machine.h>
#include <asm/ccwdev.h> #include <asm/ccwdev.h>
#include <asm/cio.h> #include <asm/cio.h>
#include <linux/io.h> #include <linux/io.h>
@ -907,7 +908,7 @@ static int __init con3215_init(void)
return -ENODEV; return -ENODEV;
/* Set the console mode for VM */ /* Set the console mode for VM */
if (MACHINE_IS_VM) { if (machine_is_vm()) {
cpcmd("TERM CONMODE 3215", NULL, 0, NULL); cpcmd("TERM CONMODE 3215", NULL, 0, NULL);
cpcmd("TERM AUTOCR OFF", NULL, 0, NULL); cpcmd("TERM AUTOCR OFF", NULL, 0, NULL);
} }

View file

@ -23,6 +23,7 @@
#include <linux/memblock.h> #include <linux/memblock.h>
#include <linux/compat.h> #include <linux/compat.h>
#include <asm/machine.h>
#include <asm/ccwdev.h> #include <asm/ccwdev.h>
#include <asm/cio.h> #include <asm/cio.h>
#include <asm/ebcdic.h> #include <asm/ebcdic.h>
@ -2156,7 +2157,7 @@ con3270_init(void)
return -ENODEV; return -ENODEV;
/* Set the console mode for VM */ /* Set the console mode for VM */
if (MACHINE_IS_VM) { if (machine_is_vm()) {
cpcmd("TERM CONMODE 3270", NULL, 0, NULL); cpcmd("TERM CONMODE 3270", NULL, 0, NULL);
cpcmd("TERM AUTOCR OFF", NULL, 0, NULL); cpcmd("TERM AUTOCR OFF", NULL, 0, NULL);
} }

View file

@ -17,6 +17,8 @@
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/crc16.h> #include <linux/crc16.h>
#include <asm/machine.h>
#include "hmcdrv_ftp.h" #include "hmcdrv_ftp.h"
#include "hmcdrv_cache.h" #include "hmcdrv_cache.h"
#include "sclp_ftp.h" #include "sclp_ftp.h"
@ -308,9 +310,9 @@ int hmcdrv_ftp_startup(void)
mutex_lock(&hmcdrv_ftp_mutex); /* block transfers while start-up */ mutex_lock(&hmcdrv_ftp_mutex); /* block transfers while start-up */
if (hmcdrv_ftp_refcnt == 0) { if (hmcdrv_ftp_refcnt == 0) {
if (MACHINE_IS_VM) if (machine_is_vm())
hmcdrv_ftp_funcs = &hmcdrv_ftp_zvm; hmcdrv_ftp_funcs = &hmcdrv_ftp_zvm;
else if (MACHINE_IS_LPAR || MACHINE_IS_KVM) else if (machine_is_lpar() || machine_is_kvm())
hmcdrv_ftp_funcs = &hmcdrv_ftp_lpar; hmcdrv_ftp_funcs = &hmcdrv_ftp_lpar;
else else
rc = -EOPNOTSUPP; rc = -EOPNOTSUPP;

View file

@ -24,6 +24,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <net/iucv/iucv.h> #include <net/iucv/iucv.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <asm/machine.h>
#include <asm/ebcdic.h> #include <asm/ebcdic.h>
#include <asm/extmem.h> #include <asm/extmem.h>
@ -456,7 +457,7 @@ static int __init mon_init(void)
{ {
int rc; int rc;
if (!MACHINE_IS_VM) { if (!machine_is_vm()) {
pr_err("The z/VM *MONITOR record device driver cannot be " pr_err("The z/VM *MONITOR record device driver cannot be "
"loaded without z/VM\n"); "loaded without z/VM\n");
return -ENODEV; return -ENODEV;

View file

@ -23,6 +23,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/machine.h>
#include <asm/ebcdic.h> #include <asm/ebcdic.h>
#include <asm/appldata.h> #include <asm/appldata.h>
#include <asm/monwriter.h> #include <asm/monwriter.h>
@ -293,7 +294,7 @@ static struct miscdevice mon_dev = {
static int __init mon_init(void) static int __init mon_init(void)
{ {
if (!MACHINE_IS_VM) if (!machine_is_vm())
return -ENODEV; return -ENODEV;
/* /*
* misc_register() has to be the last action in module_init(), because * misc_register() has to be the last action in module_init(), because

View file

@ -17,6 +17,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <asm/machine.h>
#include <asm/ccwdev.h> #include <asm/ccwdev.h>
#include <asm/cio.h> #include <asm/cio.h>
#include <asm/ebcdic.h> #include <asm/ebcdic.h>
@ -618,7 +619,7 @@ static void raw3270_reset_device_cb(struct raw3270_request *rq, void *data)
if (rq->rc) { if (rq->rc) {
/* Reset command failed. */ /* Reset command failed. */
rp->state = RAW3270_STATE_INIT; rp->state = RAW3270_STATE_INIT;
} else if (MACHINE_IS_VM) { } else if (machine_is_vm()) {
raw3270_size_device_vm(rp); raw3270_size_device_vm(rp);
raw3270_size_device_done(rp); raw3270_size_device_done(rp);
} else { } else {

View file

@ -12,6 +12,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/list.h> #include <linux/list.h>
#include <asm/asm-extable.h> #include <asm/asm-extable.h>
#include <asm/machine.h>
#include <asm/sclp.h> #include <asm/sclp.h>
#include <asm/ebcdic.h> #include <asm/ebcdic.h>
#include <asm/asm.h> #include <asm/asm.h>
@ -342,21 +343,21 @@ static inline int sclp_service_call(sclp_cmdw_t command, void *sccb)
static inline unsigned char static inline unsigned char
sclp_ascebc(unsigned char ch) sclp_ascebc(unsigned char ch)
{ {
return (MACHINE_IS_VM) ? _ascebc[ch] : _ascebc_500[ch]; return (machine_is_vm()) ? _ascebc[ch] : _ascebc_500[ch];
} }
/* translate string from EBCDIC to ASCII */ /* translate string from EBCDIC to ASCII */
static inline void static inline void
sclp_ebcasc_str(char *str, int nr) sclp_ebcasc_str(char *str, int nr)
{ {
(MACHINE_IS_VM) ? EBCASC(str, nr) : EBCASC_500(str, nr); (machine_is_vm()) ? EBCASC(str, nr) : EBCASC_500(str, nr);
} }
/* translate string from ASCII to EBCDIC */ /* translate string from ASCII to EBCDIC */
static inline void static inline void
sclp_ascebc_str(char *str, int nr) sclp_ascebc_str(char *str, int nr)
{ {
(MACHINE_IS_VM) ? ASCEBC(str, nr) : ASCEBC_500(str, nr); (machine_is_vm()) ? ASCEBC(str, nr) : ASCEBC_500(str, nr);
} }
static inline struct gds_vector * static inline struct gds_vector *

View file

@ -74,7 +74,7 @@ static void __init sclp_early_facilities_detect(void)
sclp.hamax = U64_MAX; sclp.hamax = U64_MAX;
if (!sccb->hcpua) { if (!sccb->hcpua) {
if (MACHINE_IS_VM) if (machine_is_vm())
sclp.max_cores = 64; sclp.max_cores = 64;
else else
sclp.max_cores = sccb->ncpurl; sclp.max_cores = sccb->ncpurl;

View file

@ -499,7 +499,7 @@ sclp_tty_init(void)
int rc; int rc;
/* z/VM multiplexes the line mode output on the 32xx screen */ /* z/VM multiplexes the line mode output on the 32xx screen */
if (MACHINE_IS_VM && !CONSOLE_IS_SCLP) if (machine_is_vm() && !CONSOLE_IS_SCLP)
return 0; return 0;
if (!sclp.has_linemode) if (!sclp.has_linemode)
return 0; return 0;
@ -524,7 +524,7 @@ sclp_tty_init(void)
timer_setup(&sclp_tty_timer, sclp_tty_timeout, 0); timer_setup(&sclp_tty_timer, sclp_tty_timeout, 0);
sclp_ttybuf = NULL; sclp_ttybuf = NULL;
sclp_tty_buffer_count = 0; sclp_tty_buffer_count = 0;
if (MACHINE_IS_VM) { if (machine_is_vm()) {
/* case input lines to lowercase */ /* case input lines to lowercase */
sclp_tty_tolower = 1; sclp_tty_tolower = 1;
} }

View file

@ -23,6 +23,7 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/cma.h> #include <linux/cma.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/machine.h>
#include <asm/cpcmd.h> #include <asm/cpcmd.h>
#include <asm/debug.h> #include <asm/debug.h>
#include <asm/vmcp.h> #include <asm/vmcp.h>
@ -52,7 +53,7 @@ early_param("vmcp_cma", early_parse_vmcp_cma);
void __init vmcp_cma_reserve(void) void __init vmcp_cma_reserve(void)
{ {
if (!MACHINE_IS_VM) if (!machine_is_vm())
return; return;
cma_declare_contiguous(0, vmcp_cma_size, 0, 0, 0, false, "vmcp", &vmcp_cma); cma_declare_contiguous(0, vmcp_cma_size, 0, 0, 0, false, "vmcp", &vmcp_cma);
} }
@ -254,7 +255,7 @@ static int __init vmcp_init(void)
{ {
int ret; int ret;
if (!MACHINE_IS_VM) if (!machine_is_vm())
return 0; return 0;
vmcp_debug = debug_register("vmcp", 1, 1, 240); vmcp_debug = debug_register("vmcp", 1, 1, 240);

View file

@ -23,6 +23,7 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/atomic.h> #include <linux/atomic.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <asm/machine.h>
#include <asm/cpcmd.h> #include <asm/cpcmd.h>
#include <asm/debug.h> #include <asm/debug.h>
#include <asm/ebcdic.h> #include <asm/ebcdic.h>
@ -809,7 +810,7 @@ static int __init vmlogrdr_init(void)
int i; int i;
dev_t dev; dev_t dev;
if (! MACHINE_IS_VM) { if (!machine_is_vm()) {
pr_err("not running under VM, driver not loaded.\n"); pr_err("not running under VM, driver not loaded.\n");
return -ENODEV; return -ENODEV;
} }

View file

@ -18,6 +18,7 @@
#include <linux/kobject.h> #include <linux/kobject.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <asm/machine.h>
#include <asm/cio.h> #include <asm/cio.h>
#include <asm/ccwdev.h> #include <asm/ccwdev.h>
#include <asm/debug.h> #include <asm/debug.h>
@ -1009,7 +1010,7 @@ static int __init ur_init(void)
int rc; int rc;
dev_t dev; dev_t dev;
if (!MACHINE_IS_VM) { if (!machine_is_vm()) {
pr_err("The %s cannot be loaded without z/VM\n", pr_err("The %s cannot be loaded without z/VM\n",
ur_banner); ur_banner);
return -ENODEV; return -ENODEV;

View file

@ -12,6 +12,7 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <asm/machine.h>
#include <asm/ccwdev.h> #include <asm/ccwdev.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/cio.h> #include <asm/cio.h>
@ -175,7 +176,7 @@ static void snsid_callback(struct ccw_device *cdev, void *data, int rc)
struct senseid *senseid = &cdev->private->dma_area->senseid; struct senseid *senseid = &cdev->private->dma_area->senseid;
int vm = 0; int vm = 0;
if (rc && MACHINE_IS_VM) { if (rc && machine_is_vm()) {
/* Try diag 0x210 fallback on z/VM. */ /* Try diag 0x210 fallback on z/VM. */
snsid_init(cdev); snsid_init(cdev);
if (diag210_get_dev_info(cdev) == 0) { if (diag210_get_dev_info(cdev) == 0) {

View file

@ -26,6 +26,7 @@
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <asm/machine.h>
#include <asm/airq.h> #include <asm/airq.h>
#include <asm/tpi.h> #include <asm/tpi.h>
#include <linux/atomic.h> #include <linux/atomic.h>
@ -2324,7 +2325,7 @@ static inline int __init ap_async_init(void)
* Setup the high resolution poll timer. * Setup the high resolution poll timer.
* If we are running under z/VM adjust polling to z/VM polling rate. * If we are running under z/VM adjust polling to z/VM polling rate.
*/ */
if (MACHINE_IS_VM) if (machine_is_vm())
poll_high_timeout = 1500000; poll_high_timeout = 1500000;
hrtimer_init(&ap_poll_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); hrtimer_init(&ap_poll_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
ap_poll_timer.function = ap_poll_timeout; ap_poll_timer.function = ap_poll_timeout;

View file

@ -22,6 +22,7 @@
#include <linux/hash.h> #include <linux/hash.h>
#include <linux/hashtable.h> #include <linux/hashtable.h>
#include <net/switchdev.h> #include <net/switchdev.h>
#include <asm/machine.h>
#include <asm/chsc.h> #include <asm/chsc.h>
#include <asm/css_chars.h> #include <asm/css_chars.h>
#include <asm/setup.h> #include <asm/setup.h>
@ -299,7 +300,7 @@ static int qeth_l2_request_initial_mac(struct qeth_card *card)
QETH_CARD_TEXT(card, 2, "l2reqmac"); QETH_CARD_TEXT(card, 2, "l2reqmac");
if (MACHINE_IS_VM) { if (machine_is_vm()) {
rc = qeth_vm_request_mac(card); rc = qeth_vm_request_mac(card);
if (!rc) if (!rc)
goto out; goto out;

View file

@ -13,6 +13,7 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <net/iucv/iucv.h> #include <net/iucv/iucv.h>
#include <asm/machine.h>
#include <asm/cpcmd.h> #include <asm/cpcmd.h>
#include <asm/ebcdic.h> #include <asm/ebcdic.h>
#include "smsgiucv.h" #include "smsgiucv.h"
@ -138,7 +139,7 @@ static int __init smsg_init(void)
{ {
int rc; int rc;
if (!MACHINE_IS_VM) { if (!machine_is_vm()) {
rc = -EPROTONOSUPPORT; rc = -EPROTONOSUPPORT;
goto out; goto out;
} }

View file

@ -23,6 +23,7 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <net/iucv/iucv.h> #include <net/iucv/iucv.h>
#include <asm/machine.h>
#include "smsgiucv.h" #include "smsgiucv.h"
/* prefix used for SMSG registration */ /* prefix used for SMSG registration */
@ -153,7 +154,7 @@ static int __init smsgiucv_app_init(void)
struct device_driver *smsgiucv_drv; struct device_driver *smsgiucv_drv;
int rc; int rc;
if (!MACHINE_IS_VM) if (!machine_is_vm())
return -ENODEV; return -ENODEV;
smsgiucv_drv = driver_find(SMSGIUCV_DRV_NAME, &iucv_bus); smsgiucv_drv = driver_find(SMSGIUCV_DRV_NAME, &iucv_bus);

View file

@ -24,6 +24,7 @@
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/wait.h> #include <linux/wait.h>
#include <net/iucv/iucv.h> #include <net/iucv/iucv.h>
#include <asm/machine.h>
#include "hvc_console.h" #include "hvc_console.h"
@ -1240,7 +1241,7 @@ static int param_set_vmidfilter(const char *val, const struct kernel_param *kp)
{ {
int rc; int rc;
if (!MACHINE_IS_VM || !hvc_iucv_devices) if (!machine_is_vm() || !hvc_iucv_devices)
return -ENODEV; return -ENODEV;
if (!val) if (!val)
@ -1269,7 +1270,7 @@ static int param_get_vmidfilter(char *buffer, const struct kernel_param *kp)
size_t index, len; size_t index, len;
void *start, *end; void *start, *end;
if (!MACHINE_IS_VM || !hvc_iucv_devices) if (!machine_is_vm() || !hvc_iucv_devices)
return -ENODEV; return -ENODEV;
rc = 0; rc = 0;
@ -1306,7 +1307,7 @@ static int __init hvc_iucv_init(void)
if (!hvc_iucv_devices) if (!hvc_iucv_devices)
return -ENODEV; return -ENODEV;
if (!MACHINE_IS_VM) { if (!machine_is_vm()) {
pr_notice("The z/VM IUCV HVC device driver cannot " pr_notice("The z/VM IUCV HVC device driver cannot "
"be used without z/VM\n"); "be used without z/VM\n");
rc = -ENODEV; rc = -ENODEV;

View file

@ -27,6 +27,7 @@
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/watchdog.h> #include <linux/watchdog.h>
#include <asm/machine.h>
#include <asm/ebcdic.h> #include <asm/ebcdic.h>
#include <asm/diag.h> #include <asm/diag.h>
#include <linux/io.h> #include <linux/io.h>
@ -110,7 +111,7 @@ static int wdt_start(struct watchdog_device *dev)
int ret; int ret;
unsigned int func; unsigned int func;
if (MACHINE_IS_VM) { if (machine_is_vm()) {
func = conceal_on ? (WDT_FUNC_INIT | WDT_FUNC_CONCEAL) func = conceal_on ? (WDT_FUNC_INIT | WDT_FUNC_CONCEAL)
: WDT_FUNC_INIT; : WDT_FUNC_INIT;
ret = diag288_str(func, dev->timeout, wdt_cmd); ret = diag288_str(func, dev->timeout, wdt_cmd);
@ -136,7 +137,7 @@ static int wdt_ping(struct watchdog_device *dev)
int ret; int ret;
unsigned int func; unsigned int func;
if (MACHINE_IS_VM) { if (machine_is_vm()) {
/* /*
* It seems to be ok to z/VM to use the init function to * It seems to be ok to z/VM to use the init function to
* retrigger the watchdog. On LPAR WDT_FUNC_CHANGE must * retrigger the watchdog. On LPAR WDT_FUNC_CHANGE must
@ -192,7 +193,7 @@ static int __init diag288_init(void)
watchdog_set_nowayout(&wdt_dev, nowayout_info); watchdog_set_nowayout(&wdt_dev, nowayout_info);
if (MACHINE_IS_VM) { if (machine_is_vm()) {
cmd_buf = kmalloc(MAX_CMDLEN, GFP_KERNEL); cmd_buf = kmalloc(MAX_CMDLEN, GFP_KERNEL);
if (!cmd_buf) { if (!cmd_buf) {
pr_err("The watchdog cannot be initialized\n"); pr_err("The watchdog cannot be initialized\n");

View file

@ -28,6 +28,7 @@
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/security.h> #include <linux/security.h>
#include <net/sock.h> #include <net/sock.h>
#include <asm/machine.h>
#include <asm/ebcdic.h> #include <asm/ebcdic.h>
#include <asm/cpcmd.h> #include <asm/cpcmd.h>
#include <linux/kmod.h> #include <linux/kmod.h>
@ -2272,7 +2273,7 @@ static int __init afiucv_init(void)
{ {
int err; int err;
if (MACHINE_IS_VM && IS_ENABLED(CONFIG_IUCV)) { if (machine_is_vm() && IS_ENABLED(CONFIG_IUCV)) {
cpcmd("QUERY USERID", iucv_userid, sizeof(iucv_userid), &err); cpcmd("QUERY USERID", iucv_userid, sizeof(iucv_userid), &err);
if (unlikely(err)) { if (unlikely(err)) {
WARN_ON(err); WARN_ON(err);

View file

@ -39,6 +39,7 @@
#include <linux/reboot.h> #include <linux/reboot.h>
#include <net/iucv/iucv.h> #include <net/iucv/iucv.h>
#include <linux/atomic.h> #include <linux/atomic.h>
#include <asm/machine.h>
#include <asm/ebcdic.h> #include <asm/ebcdic.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/irq.h> #include <asm/irq.h>
@ -1865,7 +1866,7 @@ static int __init iucv_init(void)
{ {
int rc; int rc;
if (!MACHINE_IS_VM) { if (!machine_is_vm()) {
rc = -EPROTONOSUPPORT; rc = -EPROTONOSUPPORT;
goto out; goto out;
} }