]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
s390/lowcore: Convert relocated lowcore alternative to machine feature
authorHeiko Carstens <hca@linux.ibm.com>
Fri, 7 Feb 2025 14:48:57 +0000 (15:48 +0100)
committerVasily Gorbik <gor@linux.ibm.com>
Tue, 4 Mar 2025 16:18:05 +0000 (17:18 +0100)
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>
arch/s390/boot/ipl_parm.c
arch/s390/boot/startup.c
arch/s390/boot/vmem.c
arch/s390/include/asm/abs_lowcore.h
arch/s390/include/asm/alternative.h
arch/s390/include/asm/lowcore.h
arch/s390/include/asm/machine.h
arch/s390/kernel/abs_lowcore.c
arch/s390/kernel/alternative.c
arch/s390/kernel/entry.S
arch/s390/kernel/setup.c

index d3731f2983b77c6eb8f0158a6be04b983eda5fa8..13316bfa589c01402f8e61236c9214e1b89f598c 100644 (file)
@@ -5,6 +5,7 @@
 #include <linux/pgtable.h>
 #include <asm/abs_lowcore.h>
 #include <asm/page-states.h>
+#include <asm/machine.h>
 #include <asm/ebcdic.h>
 #include <asm/sclp.h>
 #include <asm/sections.h>
@@ -312,7 +313,7 @@ void parse_boot_command_line(void)
                }
 #endif
                if (!strcmp(param, "relocate_lowcore") && test_facility(193))
-                       relocate_lowcore = 1;
+                       set_machine_feature(MFEATURE_LOWCORE);
                if (!strcmp(param, "earlyprintk"))
                        boot_earlyprintk = true;
                if (!strcmp(param, "debug"))
index 72d48e1d67be812209b334f34b3d4ca5f1127c14..f8e6d7eb7cc2b23418a92a22356e00ea42466536 100644 (file)
@@ -34,7 +34,6 @@ unsigned long __bootdata_preserved(max_mappable);
 unsigned long __bootdata_preserved(page_noexec_mask);
 unsigned long __bootdata_preserved(segment_noexec_mask);
 unsigned long __bootdata_preserved(region_noexec_mask);
-int __bootdata_preserved(relocate_lowcore);
 
 u64 __bootdata_preserved(stfle_fac_list[16]);
 struct oldmem_data __bootdata_preserved(oldmem_data);
index 1e87cffac2f102632e4ed8d8b6b08fbadd5ddd1d..1d073acd05a7b882391697ab98727c1514c2beb0 100644 (file)
@@ -11,6 +11,7 @@
 #include <asm/ctlreg.h>
 #include <asm/physmem_info.h>
 #include <asm/maccess.h>
+#include <asm/machine.h>
 #include <asm/abs_lowcore.h>
 #include "decompressor.h"
 #include "boot.h"
@@ -517,7 +518,7 @@ void setup_vmem(unsigned long kernel_start, unsigned long kernel_end, unsigned l
        __arch_set_page_dat((void *)swapper_pg_dir, 1UL << CRST_ALLOC_ORDER);
        __arch_set_page_dat((void *)invalid_pg_dir, 1UL << CRST_ALLOC_ORDER);
 
-       if (relocate_lowcore)
+       if (machine_has_relocated_lowcore())
                lowcore_address = LOWCORE_ALT_ADDRESS;
 
        /*
index 004d17ea05cf38bb5ca0dd6958924ab47ff1e3b6..317c07c09ae4092f7bf7ec02abb94e0a4bd19e0c 100644 (file)
@@ -25,11 +25,4 @@ static inline void put_abs_lowcore(struct lowcore *lc)
        put_cpu();
 }
 
-extern int relocate_lowcore;
-
-static inline int have_relocated_lowcore(void)
-{
-       return relocate_lowcore;
-}
-
 #endif /* _ASM_S390_ABS_LOWCORE_H */
index 67abef07ac93108c3c79a7985e1d22057a955925..c7bf60a541e9349bd2eb27ce74934cf53c5a2b6b 100644 (file)
@@ -34,7 +34,6 @@
 #define ALT_TYPE_FACILITY      0
 #define ALT_TYPE_FEATURE       1
 #define ALT_TYPE_SPEC          2
-#define ALT_TYPE_LOWCORE       3
 
 #define ALT_DATA_SHIFT         0
 #define ALT_TYPE_SHIFT         20
@@ -52,9 +51,6 @@
                                         ALT_TYPE_SPEC << ALT_TYPE_SHIFT        | \
                                         (facility) << ALT_DATA_SHIFT)
 
-#define ALT_LOWCORE                    (ALT_CTX_EARLY << ALT_CTX_SHIFT         | \
-                                        ALT_TYPE_LOWCORE << ALT_TYPE_SHIFT)
-
 #ifndef __ASSEMBLY__
 
 #include <linux/types.h>
index 42a092fa102972315b6ec06ac55fb32c169665dd..60c887cdbaec97f299b899143782af2e3e82f23e 100644 (file)
@@ -10,6 +10,7 @@
 #define _ASM_S390_LOWCORE_H
 
 #include <linux/types.h>
+#include <asm/machine.h>
 #include <asm/ptrace.h>
 #include <asm/ctlreg.h>
 #include <asm/cpu.h>
@@ -222,7 +223,7 @@ static __always_inline struct lowcore *get_lowcore(void)
 
        if (__is_defined(__DECOMPRESSOR))
                return NULL;
-       asm(ALTERNATIVE("llilh %[lc],0", "llilh %[lc],%[alt]", ALT_LOWCORE)
+       asm(ALTERNATIVE("llilh %[lc],0", "llilh %[lc],%[alt]", ALT_FEATURE(MFEATURE_LOWCORE))
            : [lc] "=d" (lc)
            : [alt] "i" (LOWCORE_ALT_ADDRESS >> 16));
        return lc;
@@ -240,13 +241,13 @@ static inline void set_prefix(__u32 address)
 .macro GET_LC reg
        ALTERNATIVE "llilh      \reg,0",                                        \
                __stringify(llilh       \reg, LOWCORE_ALT_ADDRESS >> 16),       \
-               ALT_LOWCORE
+               ALT_FEATURE(MFEATURE_LOWCORE)
 .endm
 
 .macro STMG_LC start, end, savearea
        ALTERNATIVE "stmg       \start, \end, \savearea",                               \
                __stringify(stmg        \start, \end, LOWCORE_ALT_ADDRESS + \savearea), \
-               ALT_LOWCORE
+               ALT_FEATURE(MFEATURE_LOWCORE)
 .endm
 
 #endif /* __ASSEMBLY__ */
index bbe6c24bfc883fa11f432581f4334f9c30421cf4..bc30384d396d883a91eaa3c3e95bca4c1c8a1be5 100644 (file)
@@ -6,6 +6,10 @@
 #ifndef __ASM_S390_MACHINE_H
 #define __ASM_S390_MACHINE_H
 
+#include <linux/const.h>
+
+#define MFEATURE_LOWCORE       0
+
 #ifndef __ASSEMBLY__
 
 #include <linux/bitops.h>
@@ -72,5 +76,7 @@ static __always_inline bool machine_has_##name(void)                          \
        return test_machine_feature(feature);                                   \
 }
 
+DEFINE_MACHINE_HAS_FEATURE(relocated_lowcore, MFEATURE_LOWCORE)
+
 #endif /* __ASSEMBLY__ */
 #endif /* __ASM_S390_MACHINE_H */
index 88f0b91d7a7346f24f7df7c8d1cf69e88f333428..6252b7d115ddf4e7ed3dc40f97ca0733806e384d 100644 (file)
@@ -5,7 +5,6 @@
 #include <asm/sections.h>
 
 unsigned long __bootdata_preserved(__abs_lowcore);
-int __bootdata_preserved(relocate_lowcore);
 
 int abs_lowcore_map(int cpu, struct lowcore *lc, bool alloc)
 {
index d3839fc0543dc727d485cb6d514ed5dbb7bde645..2f56649bbde8707643f0351e21609ec697bb8ce0 100644 (file)
@@ -33,9 +33,6 @@ void __apply_alternatives(struct alt_instr *start, struct alt_instr *end, unsign
                case ALT_TYPE_SPEC:
                        replace = nobp_enabled();
                        break;
-               case ALT_TYPE_LOWCORE:
-                       replace = have_relocated_lowcore();
-                       break;
                default:
                        replace = false;
                }
index 4cc3408c4dacffcc166613a35911053bfc076caf..c328e05b584cac59f353bd6a6b605660ae54164b 100644 (file)
@@ -29,6 +29,7 @@
 #include <asm/nmi.h>
 #include <asm/nospec-insn.h>
 #include <asm/lowcore.h>
+#include <asm/machine.h>
 
 _LPP_OFFSET    = __LC_LPP
 
@@ -44,7 +45,7 @@ _LPP_OFFSET   = __LC_LPP
        ALTERNATIVE_2 "b \lpswe;nopr", \
                ".insn siy,0xeb0000000071,\address,0", ALT_FACILITY(193),               \
                __stringify(.insn siy,0xeb0000000071,LOWCORE_ALT_ADDRESS+\address,0),   \
-               ALT_LOWCORE
+               ALT_FEATURE(MFEATURE_LOWCORE)
        .endm
 
        .macro MBEAR reg, lowcore
index c9dd3446162547b1b52cd849830ca4deec898c19..ab8816cf2f8b8bcb0b2222ee1e26673d0f228f6e 100644 (file)
@@ -54,6 +54,7 @@
 
 #include <asm/archrandom.h>
 #include <asm/boot_data.h>
+#include <asm/machine.h>
 #include <asm/ipl.h>
 #include <asm/facility.h>
 #include <asm/smp.h>
@@ -911,7 +912,7 @@ void __init setup_arch(char **cmdline_p)
        if (!boot_earlyprintk)
                boot_rb_foreach(print_rb_entry);
 
-       if (have_relocated_lowcore())
+       if (machine_has_relocated_lowcore())
                pr_info("Lowcore relocated to 0x%px\n", get_lowcore());
 
        log_component_list();