1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * S390 version 4 * Copyright IBM Corp. 1999, 2017 5 */ 6 #ifndef _ASM_S390_SETUP_H 7 #define _ASM_S390_SETUP_H 8 9 #include <linux/bits.h> 10 #include <uapi/asm/setup.h> 11 #include <linux/build_bug.h> 12 13 #define EP_OFFSET 0x10008 14 #define EP_STRING "S390EP" 15 #define PARMAREA 0x10400 16 #define EARLY_SCCB_OFFSET 0x11000 17 #define HEAD_END 0x12000 18 19 #define EARLY_SCCB_SIZE PAGE_SIZE 20 21 /* 22 * Machine features detected in early.c 23 */ 24 25 #define MACHINE_FLAG_VM BIT(0) 26 #define MACHINE_FLAG_KVM BIT(1) 27 #define MACHINE_FLAG_LPAR BIT(2) 28 #define MACHINE_FLAG_DIAG9C BIT(3) 29 #define MACHINE_FLAG_ESOP BIT(4) 30 #define MACHINE_FLAG_IDTE BIT(5) 31 #define MACHINE_FLAG_DIAG44 BIT(6) 32 #define MACHINE_FLAG_EDAT1 BIT(7) 33 #define MACHINE_FLAG_EDAT2 BIT(8) 34 #define MACHINE_FLAG_TOPOLOGY BIT(10) 35 #define MACHINE_FLAG_TE BIT(11) 36 #define MACHINE_FLAG_TLB_LC BIT(12) 37 #define MACHINE_FLAG_VX BIT(13) 38 #define MACHINE_FLAG_TLB_GUEST BIT(14) 39 #define MACHINE_FLAG_NX BIT(15) 40 #define MACHINE_FLAG_GS BIT(16) 41 #define MACHINE_FLAG_SCC BIT(17) 42 #define MACHINE_FLAG_PCI_MIO BIT(18) 43 44 #define LPP_MAGIC BIT(31) 45 #define LPP_PID_MASK _AC(0xffffffff, UL) 46 47 /* Offsets to entry points in kernel/head.S */ 48 49 #define STARTUP_NORMAL_OFFSET 0x10000 50 #define STARTUP_KDUMP_OFFSET 0x10010 51 52 /* Offsets to parameters in kernel/head.S */ 53 54 #define IPL_DEVICE_OFFSET 0x10400 55 #define INITRD_START_OFFSET 0x10408 56 #define INITRD_SIZE_OFFSET 0x10410 57 #define OLDMEM_BASE_OFFSET 0x10418 58 #define OLDMEM_SIZE_OFFSET 0x10420 59 #define KERNEL_VERSION_OFFSET 0x10428 60 #define COMMAND_LINE_OFFSET 0x10480 61 62 #ifndef __ASSEMBLY__ 63 64 #include <asm/lowcore.h> 65 #include <asm/types.h> 66 67 #define IPL_DEVICE (*(unsigned long *) (IPL_DEVICE_OFFSET)) 68 #define INITRD_START (*(unsigned long *) (INITRD_START_OFFSET)) 69 #define INITRD_SIZE (*(unsigned long *) (INITRD_SIZE_OFFSET)) 70 #define OLDMEM_BASE (*(unsigned long *) (OLDMEM_BASE_OFFSET)) 71 #define OLDMEM_SIZE (*(unsigned long *) (OLDMEM_SIZE_OFFSET)) 72 #define COMMAND_LINE ((char *) (COMMAND_LINE_OFFSET)) 73 74 struct parmarea { 75 unsigned long ipl_device; /* 0x10400 */ 76 unsigned long initrd_start; /* 0x10408 */ 77 unsigned long initrd_size; /* 0x10410 */ 78 unsigned long oldmem_base; /* 0x10418 */ 79 unsigned long oldmem_size; /* 0x10420 */ 80 unsigned long kernel_version; /* 0x10428 */ 81 char pad1[0x10480 - 0x10430]; /* 0x10430 - 0x10480 */ 82 char command_line[ARCH_COMMAND_LINE_SIZE]; /* 0x10480 */ 83 }; 84 85 extern int noexec_disabled; 86 extern int memory_end_set; 87 extern unsigned long memory_end; 88 extern unsigned long vmalloc_size; 89 extern unsigned long max_physmem_end; 90 extern unsigned long __swsusp_reset_dma; 91 92 #define MACHINE_IS_VM (S390_lowcore.machine_flags & MACHINE_FLAG_VM) 93 #define MACHINE_IS_KVM (S390_lowcore.machine_flags & MACHINE_FLAG_KVM) 94 #define MACHINE_IS_LPAR (S390_lowcore.machine_flags & MACHINE_FLAG_LPAR) 95 96 #define MACHINE_HAS_DIAG9C (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG9C) 97 #define MACHINE_HAS_ESOP (S390_lowcore.machine_flags & MACHINE_FLAG_ESOP) 98 #define MACHINE_HAS_IDTE (S390_lowcore.machine_flags & MACHINE_FLAG_IDTE) 99 #define MACHINE_HAS_DIAG44 (S390_lowcore.machine_flags & MACHINE_FLAG_DIAG44) 100 #define MACHINE_HAS_EDAT1 (S390_lowcore.machine_flags & MACHINE_FLAG_EDAT1) 101 #define MACHINE_HAS_EDAT2 (S390_lowcore.machine_flags & MACHINE_FLAG_EDAT2) 102 #define MACHINE_HAS_TOPOLOGY (S390_lowcore.machine_flags & MACHINE_FLAG_TOPOLOGY) 103 #define MACHINE_HAS_TE (S390_lowcore.machine_flags & MACHINE_FLAG_TE) 104 #define MACHINE_HAS_TLB_LC (S390_lowcore.machine_flags & MACHINE_FLAG_TLB_LC) 105 #define MACHINE_HAS_VX (S390_lowcore.machine_flags & MACHINE_FLAG_VX) 106 #define MACHINE_HAS_TLB_GUEST (S390_lowcore.machine_flags & MACHINE_FLAG_TLB_GUEST) 107 #define MACHINE_HAS_NX (S390_lowcore.machine_flags & MACHINE_FLAG_NX) 108 #define MACHINE_HAS_GS (S390_lowcore.machine_flags & MACHINE_FLAG_GS) 109 #define MACHINE_HAS_SCC (S390_lowcore.machine_flags & MACHINE_FLAG_SCC) 110 #define MACHINE_HAS_PCI_MIO (S390_lowcore.machine_flags & MACHINE_FLAG_PCI_MIO) 111 112 /* 113 * Console mode. Override with conmode= 114 */ 115 extern unsigned int console_mode; 116 extern unsigned int console_devno; 117 extern unsigned int console_irq; 118 119 extern char vmhalt_cmd[]; 120 extern char vmpoff_cmd[]; 121 122 #define CONSOLE_IS_UNDEFINED (console_mode == 0) 123 #define CONSOLE_IS_SCLP (console_mode == 1) 124 #define CONSOLE_IS_3215 (console_mode == 2) 125 #define CONSOLE_IS_3270 (console_mode == 3) 126 #define CONSOLE_IS_VT220 (console_mode == 4) 127 #define CONSOLE_IS_HVC (console_mode == 5) 128 #define SET_CONSOLE_SCLP do { console_mode = 1; } while (0) 129 #define SET_CONSOLE_3215 do { console_mode = 2; } while (0) 130 #define SET_CONSOLE_3270 do { console_mode = 3; } while (0) 131 #define SET_CONSOLE_VT220 do { console_mode = 4; } while (0) 132 #define SET_CONSOLE_HVC do { console_mode = 5; } while (0) 133 134 #ifdef CONFIG_PFAULT 135 extern int pfault_init(void); 136 extern void pfault_fini(void); 137 #else /* CONFIG_PFAULT */ 138 #define pfault_init() ({-1;}) 139 #define pfault_fini() do { } while (0) 140 #endif /* CONFIG_PFAULT */ 141 142 #ifdef CONFIG_VMCP 143 void vmcp_cma_reserve(void); 144 #else vmcp_cma_reserve(void)145static inline void vmcp_cma_reserve(void) { } 146 #endif 147 148 void report_user_fault(struct pt_regs *regs, long signr, int is_mm_fault); 149 150 void cmma_init(void); 151 void cmma_init_nodat(void); 152 153 extern void (*_machine_restart)(char *command); 154 extern void (*_machine_halt)(void); 155 extern void (*_machine_power_off)(void); 156 157 extern unsigned long __kaslr_offset; kaslr_offset(void)158static inline unsigned long kaslr_offset(void) 159 { 160 return __kaslr_offset; 161 } 162 gen_lpswe(unsigned long addr)163static inline u32 gen_lpswe(unsigned long addr) 164 { 165 BUILD_BUG_ON(addr > 0xfff); 166 return 0xb2b20000 | addr; 167 } 168 169 #else /* __ASSEMBLY__ */ 170 171 #define IPL_DEVICE (IPL_DEVICE_OFFSET) 172 #define INITRD_START (INITRD_START_OFFSET) 173 #define INITRD_SIZE (INITRD_SIZE_OFFSET) 174 #define OLDMEM_BASE (OLDMEM_BASE_OFFSET) 175 #define OLDMEM_SIZE (OLDMEM_SIZE_OFFSET) 176 #define COMMAND_LINE (COMMAND_LINE_OFFSET) 177 178 #endif /* __ASSEMBLY__ */ 179 #endif /* _ASM_S390_SETUP_H */ 180