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

s390/lowcore: Convert relocated lowcore alternative to machine feature

Convert the explicit relocated lowcore alternative type to a more
generic machine feature. This only reduces the number of alternative
types, but has no impact on code generation.

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
e4da8249 b7e81efc

+18 -23
+2 -1
arch/s390/boot/ipl_parm.c
··· 5 5 #include <linux/pgtable.h> 6 6 #include <asm/abs_lowcore.h> 7 7 #include <asm/page-states.h> 8 + #include <asm/machine.h> 8 9 #include <asm/ebcdic.h> 9 10 #include <asm/sclp.h> 10 11 #include <asm/sections.h> ··· 313 312 } 314 313 #endif 315 314 if (!strcmp(param, "relocate_lowcore") && test_facility(193)) 316 - relocate_lowcore = 1; 315 + set_machine_feature(MFEATURE_LOWCORE); 317 316 if (!strcmp(param, "earlyprintk")) 318 317 boot_earlyprintk = true; 319 318 if (!strcmp(param, "debug"))
-1
arch/s390/boot/startup.c
··· 34 34 unsigned long __bootdata_preserved(page_noexec_mask); 35 35 unsigned long __bootdata_preserved(segment_noexec_mask); 36 36 unsigned long __bootdata_preserved(region_noexec_mask); 37 - int __bootdata_preserved(relocate_lowcore); 38 37 39 38 u64 __bootdata_preserved(stfle_fac_list[16]); 40 39 struct oldmem_data __bootdata_preserved(oldmem_data);
+2 -1
arch/s390/boot/vmem.c
··· 11 11 #include <asm/ctlreg.h> 12 12 #include <asm/physmem_info.h> 13 13 #include <asm/maccess.h> 14 + #include <asm/machine.h> 14 15 #include <asm/abs_lowcore.h> 15 16 #include "decompressor.h" 16 17 #include "boot.h" ··· 518 517 __arch_set_page_dat((void *)swapper_pg_dir, 1UL << CRST_ALLOC_ORDER); 519 518 __arch_set_page_dat((void *)invalid_pg_dir, 1UL << CRST_ALLOC_ORDER); 520 519 521 - if (relocate_lowcore) 520 + if (machine_has_relocated_lowcore()) 522 521 lowcore_address = LOWCORE_ALT_ADDRESS; 523 522 524 523 /*
-7
arch/s390/include/asm/abs_lowcore.h
··· 25 25 put_cpu(); 26 26 } 27 27 28 - extern int relocate_lowcore; 29 - 30 - static inline int have_relocated_lowcore(void) 31 - { 32 - return relocate_lowcore; 33 - } 34 - 35 28 #endif /* _ASM_S390_ABS_LOWCORE_H */
-4
arch/s390/include/asm/alternative.h
··· 34 34 #define ALT_TYPE_FACILITY 0 35 35 #define ALT_TYPE_FEATURE 1 36 36 #define ALT_TYPE_SPEC 2 37 - #define ALT_TYPE_LOWCORE 3 38 37 39 38 #define ALT_DATA_SHIFT 0 40 39 #define ALT_TYPE_SHIFT 20 ··· 50 51 #define ALT_SPEC(facility) (ALT_CTX_LATE << ALT_CTX_SHIFT | \ 51 52 ALT_TYPE_SPEC << ALT_TYPE_SHIFT | \ 52 53 (facility) << ALT_DATA_SHIFT) 53 - 54 - #define ALT_LOWCORE (ALT_CTX_EARLY << ALT_CTX_SHIFT | \ 55 - ALT_TYPE_LOWCORE << ALT_TYPE_SHIFT) 56 54 57 55 #ifndef __ASSEMBLY__ 58 56
+4 -3
arch/s390/include/asm/lowcore.h
··· 10 10 #define _ASM_S390_LOWCORE_H 11 11 12 12 #include <linux/types.h> 13 + #include <asm/machine.h> 13 14 #include <asm/ptrace.h> 14 15 #include <asm/ctlreg.h> 15 16 #include <asm/cpu.h> ··· 223 222 224 223 if (__is_defined(__DECOMPRESSOR)) 225 224 return NULL; 226 - asm(ALTERNATIVE("llilh %[lc],0", "llilh %[lc],%[alt]", ALT_LOWCORE) 225 + asm(ALTERNATIVE("llilh %[lc],0", "llilh %[lc],%[alt]", ALT_FEATURE(MFEATURE_LOWCORE)) 227 226 : [lc] "=d" (lc) 228 227 : [alt] "i" (LOWCORE_ALT_ADDRESS >> 16)); 229 228 return lc; ··· 241 240 .macro GET_LC reg 242 241 ALTERNATIVE "llilh \reg,0", \ 243 242 __stringify(llilh \reg, LOWCORE_ALT_ADDRESS >> 16), \ 244 - ALT_LOWCORE 243 + ALT_FEATURE(MFEATURE_LOWCORE) 245 244 .endm 246 245 247 246 .macro STMG_LC start, end, savearea 248 247 ALTERNATIVE "stmg \start, \end, \savearea", \ 249 248 __stringify(stmg \start, \end, LOWCORE_ALT_ADDRESS + \savearea), \ 250 - ALT_LOWCORE 249 + ALT_FEATURE(MFEATURE_LOWCORE) 251 250 .endm 252 251 253 252 #endif /* __ASSEMBLY__ */
+6
arch/s390/include/asm/machine.h
··· 6 6 #ifndef __ASM_S390_MACHINE_H 7 7 #define __ASM_S390_MACHINE_H 8 8 9 + #include <linux/const.h> 10 + 11 + #define MFEATURE_LOWCORE 0 12 + 9 13 #ifndef __ASSEMBLY__ 10 14 11 15 #include <linux/bitops.h> ··· 75 71 return __test_machine_feature_constant(feature); \ 76 72 return test_machine_feature(feature); \ 77 73 } 74 + 75 + DEFINE_MACHINE_HAS_FEATURE(relocated_lowcore, MFEATURE_LOWCORE) 78 76 79 77 #endif /* __ASSEMBLY__ */ 80 78 #endif /* __ASM_S390_MACHINE_H */
-1
arch/s390/kernel/abs_lowcore.c
··· 5 5 #include <asm/sections.h> 6 6 7 7 unsigned long __bootdata_preserved(__abs_lowcore); 8 - int __bootdata_preserved(relocate_lowcore); 9 8 10 9 int abs_lowcore_map(int cpu, struct lowcore *lc, bool alloc) 11 10 {
-3
arch/s390/kernel/alternative.c
··· 33 33 case ALT_TYPE_SPEC: 34 34 replace = nobp_enabled(); 35 35 break; 36 - case ALT_TYPE_LOWCORE: 37 - replace = have_relocated_lowcore(); 38 - break; 39 36 default: 40 37 replace = false; 41 38 }
+2 -1
arch/s390/kernel/entry.S
··· 29 29 #include <asm/nmi.h> 30 30 #include <asm/nospec-insn.h> 31 31 #include <asm/lowcore.h> 32 + #include <asm/machine.h> 32 33 33 34 _LPP_OFFSET = __LC_LPP 34 35 ··· 45 44 ALTERNATIVE_2 "b \lpswe;nopr", \ 46 45 ".insn siy,0xeb0000000071,\address,0", ALT_FACILITY(193), \ 47 46 __stringify(.insn siy,0xeb0000000071,LOWCORE_ALT_ADDRESS+\address,0), \ 48 - ALT_LOWCORE 47 + ALT_FEATURE(MFEATURE_LOWCORE) 49 48 .endm 50 49 51 50 .macro MBEAR reg, lowcore
+2 -1
arch/s390/kernel/setup.c
··· 54 54 55 55 #include <asm/archrandom.h> 56 56 #include <asm/boot_data.h> 57 + #include <asm/machine.h> 57 58 #include <asm/ipl.h> 58 59 #include <asm/facility.h> 59 60 #include <asm/smp.h> ··· 912 911 if (!boot_earlyprintk) 913 912 boot_rb_foreach(print_rb_entry); 914 913 915 - if (have_relocated_lowcore()) 914 + if (machine_has_relocated_lowcore()) 916 915 pr_info("Lowcore relocated to 0x%px\n", get_lowcore()); 917 916 918 917 log_component_list();