From: Nathan Chancellor <nathan@kernel.org> To: Marc Zyngier <maz@kernel.org> Cc: linux-arm-kernel@lists.infradead.org, kernel-team@android.com, James Morse <james.morse@arm.com>, Nick Desaulniers <ndesaulniers@google.com>, Will Deacon <will@kernel.org>, Catalin Marinas <catalin.marinas@arm.com>, llvm@lists.linux.dev Subject: Re: [PATCH] arm64: Paper over ARM_SMCCC_ARCH_WORKAROUND_3 Clang issue Date: Wed, 9 Mar 2022 10:11:18 -0700 [thread overview] Message-ID: <YijftpaApSJWuZ3m@dev-arch.thelio-3990X> (raw) In-Reply-To: <20220309155716.3988480-1-maz@kernel.org> [-- Attachment #1: Type: text/plain, Size: 1959 bytes --] On Wed, Mar 09, 2022 at 03:57:16PM +0000, Marc Zyngier wrote: > Compiling the arm64 kernel with the BHB workarounds and Clang+LTO > results in a bunch of: > > <instantiation>:4:2: error: invalid fixup for movz/movk instruction > mov w0, #ARM_SMCCC_ARCH_WORKAROUND_3 > > when compiling arch/arm64/kernel/entry.S, and makes no sense at all. > > As it turns out, moving a single include line around makes the > problem disappear. Why, you'd ask? Well, I don't have the faintest > idea, and I'm running out of patience. So make of that what you want. > > Cc: James Morse <james.morse@arm.com> > Cc: Nick Desaulniers <ndesaulniers@google.com> > Cc: Will Deacon <will@kernel.org> > Cc: Catalin Marinas <catalin.marinas@arm.com> > Signed-off-by: Marc Zyngier <maz@kernel.org> > --- > include/linux/arm-smccc.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h > index 220c8c60e021..0a341dd9ff61 100644 > --- a/include/linux/arm-smccc.h > +++ b/include/linux/arm-smccc.h > @@ -5,7 +5,6 @@ > #ifndef __LINUX_ARM_SMCCC_H > #define __LINUX_ARM_SMCCC_H > > -#include <linux/init.h> > #include <uapi/linux/const.h> > > /* > @@ -193,6 +192,7 @@ > > #ifndef __ASSEMBLY__ > > +#include <linux/init.h> > #include <linux/linkage.h> > #include <linux/types.h> > > -- > 2.34.1 I am still looking at this but I wanted to post a preliminary finding. It seems the source of the error is that ARM_SMCCC_ARCH_WORKAROUND_3 is not getting expanded by the preprocessor. If you preprocess arch/arm64/kernel/entry.S without LTO then with LTO, it reveals the attached diff, which shows just "#ARM_SMCCC_ARCH_WORKAROUND_3", rather than "# (((1) << 31) | ((0) << 30) | (((0) & 0x3F) << 24) | ((0x3fff) & 0xFFFF))". $ make -skj"$(nproc)" ARCH=arm64 LLVM=1 mrproper defconfig arch/arm64/kernel/entry.s I'll see if I can figure out what is going wrong in the include chain. Cheers, Nathan [-- Attachment #2: entry.s.diff --] [-- Type: text/plain, Size: 9597 bytes --] diff --git a/entry.s.good b/entry.s.bad index ab98e34..b331cc4 100644 --- a/entry.s.good +++ b/entry.s.bad @@ -35,71 +35,17 @@ # 6 "./include/linux/compiler.h" 2 # 266 "./include/linux/compiler.h" # 1 "./arch/arm64/include/asm/rwonce.h" 1 -# 71 "./arch/arm64/include/asm/rwonce.h" -# 1 "./include/asm-generic/rwonce.h" 1 -# 72 "./arch/arm64/include/asm/rwonce.h" 2 -# 267 "./include/linux/compiler.h" 2 -# 6 "./include/linux/init.h" 2 -# 1 "./include/linux/types.h" 1 - - - - - -# 1 "./include/uapi/linux/types.h" 1 - - - - -# 1 "./arch/arm64/include/generated/uapi/asm/types.h" 1 -# 1 "./include/uapi/asm-generic/types.h" 1 - - - - - - -# 1 "./include/asm-generic/int-ll64.h" 1 -# 11 "./include/asm-generic/int-ll64.h" -# 1 "./include/uapi/asm-generic/int-ll64.h" 1 -# 12 "./include/uapi/asm-generic/int-ll64.h" -# 1 "./arch/arm64/include/uapi/asm/bitsperlong.h" 1 -# 22 "./arch/arm64/include/uapi/asm/bitsperlong.h" -# 1 "./include/asm-generic/bitsperlong.h" 1 - - - - -# 1 "./include/uapi/asm-generic/bitsperlong.h" 1 -# 6 "./include/asm-generic/bitsperlong.h" 2 -# 23 "./arch/arm64/include/uapi/asm/bitsperlong.h" 2 -# 13 "./include/uapi/asm-generic/int-ll64.h" 2 -# 12 "./include/asm-generic/int-ll64.h" 2 -# 8 "./include/uapi/asm-generic/types.h" 2 -# 2 "./arch/arm64/include/generated/uapi/asm/types.h" 2 -# 6 "./include/uapi/linux/types.h" 2 -# 7 "./include/linux/types.h" 2 -# 7 "./include/linux/init.h" 2 -# 9 "./include/linux/arm-smccc.h" 2 -# 1 "./include/uapi/linux/const.h" 1 -# 10 "./include/linux/arm-smccc.h" 2 -# 11 "arch/arm64/kernel/entry.S" 2 - -# 1 "./include/linux/linkage.h" 1 - - - - - -# 1 "./include/linux/stringify.h" 1 -# 7 "./include/linux/linkage.h" 2 -# 1 "./include/linux/export.h" 1 -# 8 "./include/linux/linkage.h" 2 -# 1 "./arch/arm64/include/asm/linkage.h" 1 +# 11 "./arch/arm64/include/asm/rwonce.h" +# 1 "./arch/arm64/include/asm/alternative-macros.h" 1 +# 1 "./arch/arm64/include/generated/asm/cpucaps.h" 1 +# 6 "./arch/arm64/include/asm/alternative-macros.h" 2 +# 1 "./arch/arm64/include/asm/insn-def.h" 1 +# 7 "./arch/arm64/include/asm/alternative-macros.h" 2 +# 80 "./arch/arm64/include/asm/alternative-macros.h" # 1 "./arch/arm64/include/asm/assembler.h" 1 # 15 "./arch/arm64/include/asm/assembler.h" # 1 "./include/asm-generic/export.h" 1 @@ -141,108 +87,6 @@ __kstrtab_\name: # 1 "./arch/arm64/include/asm/alternative-macros.h" 1 - - - - -# 1 "./arch/arm64/include/generated/asm/cpucaps.h" 1 -# 6 "./arch/arm64/include/asm/alternative-macros.h" 2 -# 1 "./arch/arm64/include/asm/insn-def.h" 1 -# 7 "./arch/arm64/include/asm/alternative-macros.h" 2 -# 80 "./arch/arm64/include/asm/alternative-macros.h" -# 1 "./arch/arm64/include/asm/assembler.h" 1 -# 81 "./arch/arm64/include/asm/alternative-macros.h" 2 - -.macro altinstruction_entry orig_offset alt_offset feature orig_len alt_len - .word \orig_offset - . - .word \alt_offset - . - .hword \feature - .byte \orig_len - .byte \alt_len -.endm - -.macro alternative_insn insn1, insn2, cap, enable = 1 - .if \enable -661: \insn1 -662: .pushsection .altinstructions, "a" - altinstruction_entry 661b, 663f, \cap, 662b-661b, 664f-663f - .popsection - .subsection 1 -663: \insn2 -664: .org . - (664b-663b) + (662b-661b) - .org . - (662b-661b) + (664b-663b) - .previous - .endif -.endm -# 126 "./arch/arm64/include/asm/alternative-macros.h" -.macro alternative_if_not cap - .set .Lasm_alt_mode, 0 - .pushsection .altinstructions, "a" - altinstruction_entry 661f, 663f, \cap, 662f-661f, 664f-663f - .popsection -661: -.endm - -.macro alternative_if cap - .set .Lasm_alt_mode, 1 - .pushsection .altinstructions, "a" - altinstruction_entry 663f, 661f, \cap, 664f-663f, 662f-661f - .popsection - .subsection 1 - .align 2 -661: -.endm - -.macro alternative_cb cb - .set .Lasm_alt_mode, 0 - .pushsection .altinstructions, "a" - altinstruction_entry 661f, \cb, 71, 662f-661f, 0 - .popsection -661: -.endm - - - - -.macro alternative_else -662: - .if .Lasm_alt_mode==0 - .subsection 1 - .else - .previous - .endif -663: -.endm - - - - -.macro alternative_endif -664: - .org . - (664b-663b) + (662b-661b) - .org . - (662b-661b) + (664b-663b) - .if .Lasm_alt_mode==0 - .previous - .endif -.endm - - - - -.macro alternative_cb_end -662: -.endm - - - - - - -.macro alternative_else_nop_endif -alternative_else - nops (662b-661b) / 4 -alternative_endif -.endm # 6 "./arch/arm64/include/asm/alternative.h" 2 # 18 "./arch/arm64/include/asm/assembler.h" 2 # 1 "./arch/arm64/include/asm/asm-bug.h" 1 @@ -305,12 +149,30 @@ alternative_endif # 1 "./include/vdso/const.h" 1 + + + + +# 1 "./include/uapi/linux/const.h" 1 +# 6 "./include/vdso/const.h" 2 # 5 "./include/linux/const.h" 2 # 6 "./include/linux/bits.h" 2 # 1 "./include/vdso/bits.h" 1 # 7 "./include/linux/bits.h" 2 -# 13 "./arch/arm64/include/asm/sysreg.h" 2 +# 1 "./arch/arm64/include/uapi/asm/bitsperlong.h" 1 +# 22 "./arch/arm64/include/uapi/asm/bitsperlong.h" +# 1 "./include/asm-generic/bitsperlong.h" 1 + + + +# 1 "./include/uapi/asm-generic/bitsperlong.h" 1 +# 6 "./include/asm-generic/bitsperlong.h" 2 +# 23 "./arch/arm64/include/uapi/asm/bitsperlong.h" 2 +# 8 "./include/linux/bits.h" 2 +# 13 "./arch/arm64/include/asm/sysreg.h" 2 +# 1 "./include/linux/stringify.h" 1 +# 14 "./arch/arm64/include/asm/sysreg.h" 2 # 1 "./include/linux/kasan-tags.h" 1 # 15 "./arch/arm64/include/asm/sysreg.h" 2 @@ -365,8 +227,35 @@ alternative_endif # 2 "./include/uapi/linux/errno.h" 2 # 6 "./include/linux/errno.h" 2 # 9 "./arch/arm64/include/asm/debug-monitors.h" 2 +# 1 "./include/linux/types.h" 1 + + + +# 1 "./include/uapi/linux/types.h" 1 + + + + +# 1 "./arch/arm64/include/generated/uapi/asm/types.h" 1 +# 1 "./include/uapi/asm-generic/types.h" 1 + + + + + + +# 1 "./include/asm-generic/int-ll64.h" 1 +# 11 "./include/asm-generic/int-ll64.h" +# 1 "./include/uapi/asm-generic/int-ll64.h" 1 +# 12 "./include/asm-generic/int-ll64.h" 2 +# 8 "./include/uapi/asm-generic/types.h" 2 +# 2 "./arch/arm64/include/generated/uapi/asm/types.h" 2 +# 6 "./include/uapi/linux/types.h" 2 +# 7 "./include/linux/types.h" 2 +# 10 "./arch/arm64/include/asm/debug-monitors.h" 2 + # 1 "./arch/arm64/include/asm/esr.h" 1 # 10 "./arch/arm64/include/asm/esr.h" # 1 "./arch/arm64/include/asm/memory.h" 1 @@ -389,6 +278,12 @@ alternative_endif # 1 "./arch/arm64/include/asm/insn.h" 1 # 10 "./arch/arm64/include/asm/insn.h" # 1 "./include/linux/build_bug.h" 1 + + + + +# 1 "./include/linux/compiler.h" 1 +# 6 "./include/linux/build_bug.h" 2 # 11 "./arch/arm64/include/asm/insn.h" 2 # 13 "./arch/arm64/include/asm/debug-monitors.h" 2 # 1 "./arch/arm64/include/asm/ptrace.h" 1 @@ -409,6 +304,9 @@ alternative_endif # 26 "./arch/arm64/include/asm/assembler.h" 2 # 1 "./arch/arm64/include/asm/thread_info.h" 1 +# 11 "./arch/arm64/include/asm/thread_info.h" +# 1 "./include/linux/compiler.h" 1 +# 12 "./arch/arm64/include/asm/thread_info.h" 2 # 28 "./arch/arm64/include/asm/assembler.h" 2 @@ -1089,7 +987,7 @@ alternative_cb_end stp x0, x1, [sp, #-16]! stp x2, x3, [sp, #-16]! - mov w0, #(((1) << 31) | ((0) << 30) | (((0) & 0x3F) << 24) | ((0x3fff) & 0xFFFF)) + mov w0, #ARM_SMCCC_ARCH_WORKAROUND_3 alternative_cb smccc_patch_fw_mitigation_conduit nop alternative_cb_end @@ -1097,6 +995,122 @@ alternative_cb_end ldp x0, x1, [sp], #16 .endm +# 81 "./arch/arm64/include/asm/alternative-macros.h" 2 + +.macro altinstruction_entry orig_offset alt_offset feature orig_len alt_len + .word \orig_offset - . + .word \alt_offset - . + .hword \feature + .byte \orig_len + .byte \alt_len +.endm + +.macro alternative_insn insn1, insn2, cap, enable = 1 + .if \enable +661: \insn1 +662: .pushsection .altinstructions, "a" + altinstruction_entry 661b, 663f, \cap, 662b-661b, 664f-663f + .popsection + .subsection 1 +663: \insn2 +664: .org . - (664b-663b) + (662b-661b) + .org . - (662b-661b) + (664b-663b) + .previous + .endif +.endm +# 126 "./arch/arm64/include/asm/alternative-macros.h" +.macro alternative_if_not cap + .set .Lasm_alt_mode, 0 + .pushsection .altinstructions, "a" + altinstruction_entry 661f, 663f, \cap, 662f-661f, 664f-663f + .popsection +661: +.endm + +.macro alternative_if cap + .set .Lasm_alt_mode, 1 + .pushsection .altinstructions, "a" + altinstruction_entry 663f, 661f, \cap, 664f-663f, 662f-661f + .popsection + .subsection 1 + .align 2 +661: +.endm + +.macro alternative_cb cb + .set .Lasm_alt_mode, 0 + .pushsection .altinstructions, "a" + altinstruction_entry 661f, \cb, 71, 662f-661f, 0 + .popsection +661: +.endm + + + + +.macro alternative_else +662: + .if .Lasm_alt_mode==0 + .subsection 1 + .else + .previous + .endif +663: +.endm + + + + +.macro alternative_endif +664: + .org . - (664b-663b) + (662b-661b) + .org . - (662b-661b) + (664b-663b) + .if .Lasm_alt_mode==0 + .previous + .endif +.endm + + + + +.macro alternative_cb_end +662: +.endm + + + + + + +.macro alternative_else_nop_endif +alternative_else + nops (662b-661b) / 4 +alternative_endif +.endm +# 12 "./arch/arm64/include/asm/rwonce.h" 2 +# 71 "./arch/arm64/include/asm/rwonce.h" +# 1 "./include/asm-generic/rwonce.h" 1 +# 72 "./arch/arm64/include/asm/rwonce.h" 2 +# 267 "./include/linux/compiler.h" 2 +# 6 "./include/linux/init.h" 2 +# 9 "./include/linux/arm-smccc.h" 2 +# 11 "arch/arm64/kernel/entry.S" 2 + +# 1 "./include/linux/linkage.h" 1 + + + + + + +# 1 "./include/linux/export.h" 1 +# 8 "./include/linux/linkage.h" 2 +# 1 "./arch/arm64/include/asm/linkage.h" 1 + + + + +# 1 "./arch/arm64/include/asm/assembler.h" 1 # 6 "./arch/arm64/include/asm/linkage.h" 2 # 9 "./include/linux/linkage.h" 2 # 13 "arch/arm64/kernel/entry.S" 2
WARNING: multiple messages have this Message-ID (diff)
From: Nathan Chancellor <nathan@kernel.org> To: Marc Zyngier <maz@kernel.org> Cc: linux-arm-kernel@lists.infradead.org, kernel-team@android.com, James Morse <james.morse@arm.com>, Nick Desaulniers <ndesaulniers@google.com>, Will Deacon <will@kernel.org>, Catalin Marinas <catalin.marinas@arm.com>, llvm@lists.linux.dev Subject: Re: [PATCH] arm64: Paper over ARM_SMCCC_ARCH_WORKAROUND_3 Clang issue Date: Wed, 9 Mar 2022 10:11:18 -0700 [thread overview] Message-ID: <YijftpaApSJWuZ3m@dev-arch.thelio-3990X> (raw) In-Reply-To: <20220309155716.3988480-1-maz@kernel.org> [-- Attachment #1: Type: text/plain, Size: 1959 bytes --] On Wed, Mar 09, 2022 at 03:57:16PM +0000, Marc Zyngier wrote: > Compiling the arm64 kernel with the BHB workarounds and Clang+LTO > results in a bunch of: > > <instantiation>:4:2: error: invalid fixup for movz/movk instruction > mov w0, #ARM_SMCCC_ARCH_WORKAROUND_3 > > when compiling arch/arm64/kernel/entry.S, and makes no sense at all. > > As it turns out, moving a single include line around makes the > problem disappear. Why, you'd ask? Well, I don't have the faintest > idea, and I'm running out of patience. So make of that what you want. > > Cc: James Morse <james.morse@arm.com> > Cc: Nick Desaulniers <ndesaulniers@google.com> > Cc: Will Deacon <will@kernel.org> > Cc: Catalin Marinas <catalin.marinas@arm.com> > Signed-off-by: Marc Zyngier <maz@kernel.org> > --- > include/linux/arm-smccc.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h > index 220c8c60e021..0a341dd9ff61 100644 > --- a/include/linux/arm-smccc.h > +++ b/include/linux/arm-smccc.h > @@ -5,7 +5,6 @@ > #ifndef __LINUX_ARM_SMCCC_H > #define __LINUX_ARM_SMCCC_H > > -#include <linux/init.h> > #include <uapi/linux/const.h> > > /* > @@ -193,6 +192,7 @@ > > #ifndef __ASSEMBLY__ > > +#include <linux/init.h> > #include <linux/linkage.h> > #include <linux/types.h> > > -- > 2.34.1 I am still looking at this but I wanted to post a preliminary finding. It seems the source of the error is that ARM_SMCCC_ARCH_WORKAROUND_3 is not getting expanded by the preprocessor. If you preprocess arch/arm64/kernel/entry.S without LTO then with LTO, it reveals the attached diff, which shows just "#ARM_SMCCC_ARCH_WORKAROUND_3", rather than "# (((1) << 31) | ((0) << 30) | (((0) & 0x3F) << 24) | ((0x3fff) & 0xFFFF))". $ make -skj"$(nproc)" ARCH=arm64 LLVM=1 mrproper defconfig arch/arm64/kernel/entry.s I'll see if I can figure out what is going wrong in the include chain. Cheers, Nathan [-- Attachment #2: entry.s.diff --] [-- Type: text/plain, Size: 9597 bytes --] diff --git a/entry.s.good b/entry.s.bad index ab98e34..b331cc4 100644 --- a/entry.s.good +++ b/entry.s.bad @@ -35,71 +35,17 @@ # 6 "./include/linux/compiler.h" 2 # 266 "./include/linux/compiler.h" # 1 "./arch/arm64/include/asm/rwonce.h" 1 -# 71 "./arch/arm64/include/asm/rwonce.h" -# 1 "./include/asm-generic/rwonce.h" 1 -# 72 "./arch/arm64/include/asm/rwonce.h" 2 -# 267 "./include/linux/compiler.h" 2 -# 6 "./include/linux/init.h" 2 -# 1 "./include/linux/types.h" 1 - - - - - -# 1 "./include/uapi/linux/types.h" 1 - - - - -# 1 "./arch/arm64/include/generated/uapi/asm/types.h" 1 -# 1 "./include/uapi/asm-generic/types.h" 1 - - - - - - -# 1 "./include/asm-generic/int-ll64.h" 1 -# 11 "./include/asm-generic/int-ll64.h" -# 1 "./include/uapi/asm-generic/int-ll64.h" 1 -# 12 "./include/uapi/asm-generic/int-ll64.h" -# 1 "./arch/arm64/include/uapi/asm/bitsperlong.h" 1 -# 22 "./arch/arm64/include/uapi/asm/bitsperlong.h" -# 1 "./include/asm-generic/bitsperlong.h" 1 - - - - -# 1 "./include/uapi/asm-generic/bitsperlong.h" 1 -# 6 "./include/asm-generic/bitsperlong.h" 2 -# 23 "./arch/arm64/include/uapi/asm/bitsperlong.h" 2 -# 13 "./include/uapi/asm-generic/int-ll64.h" 2 -# 12 "./include/asm-generic/int-ll64.h" 2 -# 8 "./include/uapi/asm-generic/types.h" 2 -# 2 "./arch/arm64/include/generated/uapi/asm/types.h" 2 -# 6 "./include/uapi/linux/types.h" 2 -# 7 "./include/linux/types.h" 2 -# 7 "./include/linux/init.h" 2 -# 9 "./include/linux/arm-smccc.h" 2 -# 1 "./include/uapi/linux/const.h" 1 -# 10 "./include/linux/arm-smccc.h" 2 -# 11 "arch/arm64/kernel/entry.S" 2 - -# 1 "./include/linux/linkage.h" 1 - - - - - -# 1 "./include/linux/stringify.h" 1 -# 7 "./include/linux/linkage.h" 2 -# 1 "./include/linux/export.h" 1 -# 8 "./include/linux/linkage.h" 2 -# 1 "./arch/arm64/include/asm/linkage.h" 1 +# 11 "./arch/arm64/include/asm/rwonce.h" +# 1 "./arch/arm64/include/asm/alternative-macros.h" 1 +# 1 "./arch/arm64/include/generated/asm/cpucaps.h" 1 +# 6 "./arch/arm64/include/asm/alternative-macros.h" 2 +# 1 "./arch/arm64/include/asm/insn-def.h" 1 +# 7 "./arch/arm64/include/asm/alternative-macros.h" 2 +# 80 "./arch/arm64/include/asm/alternative-macros.h" # 1 "./arch/arm64/include/asm/assembler.h" 1 # 15 "./arch/arm64/include/asm/assembler.h" # 1 "./include/asm-generic/export.h" 1 @@ -141,108 +87,6 @@ __kstrtab_\name: # 1 "./arch/arm64/include/asm/alternative-macros.h" 1 - - - - -# 1 "./arch/arm64/include/generated/asm/cpucaps.h" 1 -# 6 "./arch/arm64/include/asm/alternative-macros.h" 2 -# 1 "./arch/arm64/include/asm/insn-def.h" 1 -# 7 "./arch/arm64/include/asm/alternative-macros.h" 2 -# 80 "./arch/arm64/include/asm/alternative-macros.h" -# 1 "./arch/arm64/include/asm/assembler.h" 1 -# 81 "./arch/arm64/include/asm/alternative-macros.h" 2 - -.macro altinstruction_entry orig_offset alt_offset feature orig_len alt_len - .word \orig_offset - . - .word \alt_offset - . - .hword \feature - .byte \orig_len - .byte \alt_len -.endm - -.macro alternative_insn insn1, insn2, cap, enable = 1 - .if \enable -661: \insn1 -662: .pushsection .altinstructions, "a" - altinstruction_entry 661b, 663f, \cap, 662b-661b, 664f-663f - .popsection - .subsection 1 -663: \insn2 -664: .org . - (664b-663b) + (662b-661b) - .org . - (662b-661b) + (664b-663b) - .previous - .endif -.endm -# 126 "./arch/arm64/include/asm/alternative-macros.h" -.macro alternative_if_not cap - .set .Lasm_alt_mode, 0 - .pushsection .altinstructions, "a" - altinstruction_entry 661f, 663f, \cap, 662f-661f, 664f-663f - .popsection -661: -.endm - -.macro alternative_if cap - .set .Lasm_alt_mode, 1 - .pushsection .altinstructions, "a" - altinstruction_entry 663f, 661f, \cap, 664f-663f, 662f-661f - .popsection - .subsection 1 - .align 2 -661: -.endm - -.macro alternative_cb cb - .set .Lasm_alt_mode, 0 - .pushsection .altinstructions, "a" - altinstruction_entry 661f, \cb, 71, 662f-661f, 0 - .popsection -661: -.endm - - - - -.macro alternative_else -662: - .if .Lasm_alt_mode==0 - .subsection 1 - .else - .previous - .endif -663: -.endm - - - - -.macro alternative_endif -664: - .org . - (664b-663b) + (662b-661b) - .org . - (662b-661b) + (664b-663b) - .if .Lasm_alt_mode==0 - .previous - .endif -.endm - - - - -.macro alternative_cb_end -662: -.endm - - - - - - -.macro alternative_else_nop_endif -alternative_else - nops (662b-661b) / 4 -alternative_endif -.endm # 6 "./arch/arm64/include/asm/alternative.h" 2 # 18 "./arch/arm64/include/asm/assembler.h" 2 # 1 "./arch/arm64/include/asm/asm-bug.h" 1 @@ -305,12 +149,30 @@ alternative_endif # 1 "./include/vdso/const.h" 1 + + + + +# 1 "./include/uapi/linux/const.h" 1 +# 6 "./include/vdso/const.h" 2 # 5 "./include/linux/const.h" 2 # 6 "./include/linux/bits.h" 2 # 1 "./include/vdso/bits.h" 1 # 7 "./include/linux/bits.h" 2 -# 13 "./arch/arm64/include/asm/sysreg.h" 2 +# 1 "./arch/arm64/include/uapi/asm/bitsperlong.h" 1 +# 22 "./arch/arm64/include/uapi/asm/bitsperlong.h" +# 1 "./include/asm-generic/bitsperlong.h" 1 + + + +# 1 "./include/uapi/asm-generic/bitsperlong.h" 1 +# 6 "./include/asm-generic/bitsperlong.h" 2 +# 23 "./arch/arm64/include/uapi/asm/bitsperlong.h" 2 +# 8 "./include/linux/bits.h" 2 +# 13 "./arch/arm64/include/asm/sysreg.h" 2 +# 1 "./include/linux/stringify.h" 1 +# 14 "./arch/arm64/include/asm/sysreg.h" 2 # 1 "./include/linux/kasan-tags.h" 1 # 15 "./arch/arm64/include/asm/sysreg.h" 2 @@ -365,8 +227,35 @@ alternative_endif # 2 "./include/uapi/linux/errno.h" 2 # 6 "./include/linux/errno.h" 2 # 9 "./arch/arm64/include/asm/debug-monitors.h" 2 +# 1 "./include/linux/types.h" 1 + + + +# 1 "./include/uapi/linux/types.h" 1 + + + + +# 1 "./arch/arm64/include/generated/uapi/asm/types.h" 1 +# 1 "./include/uapi/asm-generic/types.h" 1 + + + + + + +# 1 "./include/asm-generic/int-ll64.h" 1 +# 11 "./include/asm-generic/int-ll64.h" +# 1 "./include/uapi/asm-generic/int-ll64.h" 1 +# 12 "./include/asm-generic/int-ll64.h" 2 +# 8 "./include/uapi/asm-generic/types.h" 2 +# 2 "./arch/arm64/include/generated/uapi/asm/types.h" 2 +# 6 "./include/uapi/linux/types.h" 2 +# 7 "./include/linux/types.h" 2 +# 10 "./arch/arm64/include/asm/debug-monitors.h" 2 + # 1 "./arch/arm64/include/asm/esr.h" 1 # 10 "./arch/arm64/include/asm/esr.h" # 1 "./arch/arm64/include/asm/memory.h" 1 @@ -389,6 +278,12 @@ alternative_endif # 1 "./arch/arm64/include/asm/insn.h" 1 # 10 "./arch/arm64/include/asm/insn.h" # 1 "./include/linux/build_bug.h" 1 + + + + +# 1 "./include/linux/compiler.h" 1 +# 6 "./include/linux/build_bug.h" 2 # 11 "./arch/arm64/include/asm/insn.h" 2 # 13 "./arch/arm64/include/asm/debug-monitors.h" 2 # 1 "./arch/arm64/include/asm/ptrace.h" 1 @@ -409,6 +304,9 @@ alternative_endif # 26 "./arch/arm64/include/asm/assembler.h" 2 # 1 "./arch/arm64/include/asm/thread_info.h" 1 +# 11 "./arch/arm64/include/asm/thread_info.h" +# 1 "./include/linux/compiler.h" 1 +# 12 "./arch/arm64/include/asm/thread_info.h" 2 # 28 "./arch/arm64/include/asm/assembler.h" 2 @@ -1089,7 +987,7 @@ alternative_cb_end stp x0, x1, [sp, #-16]! stp x2, x3, [sp, #-16]! - mov w0, #(((1) << 31) | ((0) << 30) | (((0) & 0x3F) << 24) | ((0x3fff) & 0xFFFF)) + mov w0, #ARM_SMCCC_ARCH_WORKAROUND_3 alternative_cb smccc_patch_fw_mitigation_conduit nop alternative_cb_end @@ -1097,6 +995,122 @@ alternative_cb_end ldp x0, x1, [sp], #16 .endm +# 81 "./arch/arm64/include/asm/alternative-macros.h" 2 + +.macro altinstruction_entry orig_offset alt_offset feature orig_len alt_len + .word \orig_offset - . + .word \alt_offset - . + .hword \feature + .byte \orig_len + .byte \alt_len +.endm + +.macro alternative_insn insn1, insn2, cap, enable = 1 + .if \enable +661: \insn1 +662: .pushsection .altinstructions, "a" + altinstruction_entry 661b, 663f, \cap, 662b-661b, 664f-663f + .popsection + .subsection 1 +663: \insn2 +664: .org . - (664b-663b) + (662b-661b) + .org . - (662b-661b) + (664b-663b) + .previous + .endif +.endm +# 126 "./arch/arm64/include/asm/alternative-macros.h" +.macro alternative_if_not cap + .set .Lasm_alt_mode, 0 + .pushsection .altinstructions, "a" + altinstruction_entry 661f, 663f, \cap, 662f-661f, 664f-663f + .popsection +661: +.endm + +.macro alternative_if cap + .set .Lasm_alt_mode, 1 + .pushsection .altinstructions, "a" + altinstruction_entry 663f, 661f, \cap, 664f-663f, 662f-661f + .popsection + .subsection 1 + .align 2 +661: +.endm + +.macro alternative_cb cb + .set .Lasm_alt_mode, 0 + .pushsection .altinstructions, "a" + altinstruction_entry 661f, \cb, 71, 662f-661f, 0 + .popsection +661: +.endm + + + + +.macro alternative_else +662: + .if .Lasm_alt_mode==0 + .subsection 1 + .else + .previous + .endif +663: +.endm + + + + +.macro alternative_endif +664: + .org . - (664b-663b) + (662b-661b) + .org . - (662b-661b) + (664b-663b) + .if .Lasm_alt_mode==0 + .previous + .endif +.endm + + + + +.macro alternative_cb_end +662: +.endm + + + + + + +.macro alternative_else_nop_endif +alternative_else + nops (662b-661b) / 4 +alternative_endif +.endm +# 12 "./arch/arm64/include/asm/rwonce.h" 2 +# 71 "./arch/arm64/include/asm/rwonce.h" +# 1 "./include/asm-generic/rwonce.h" 1 +# 72 "./arch/arm64/include/asm/rwonce.h" 2 +# 267 "./include/linux/compiler.h" 2 +# 6 "./include/linux/init.h" 2 +# 9 "./include/linux/arm-smccc.h" 2 +# 11 "arch/arm64/kernel/entry.S" 2 + +# 1 "./include/linux/linkage.h" 1 + + + + + + +# 1 "./include/linux/export.h" 1 +# 8 "./include/linux/linkage.h" 2 +# 1 "./arch/arm64/include/asm/linkage.h" 1 + + + + +# 1 "./arch/arm64/include/asm/assembler.h" 1 # 6 "./arch/arm64/include/asm/linkage.h" 2 # 9 "./include/linux/linkage.h" 2 # 13 "arch/arm64/kernel/entry.S" 2 [-- Attachment #3: Type: text/plain, Size: 176 bytes --] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-03-09 17:11 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-03-09 15:57 [PATCH] arm64: Paper over ARM_SMCCC_ARCH_WORKAROUND_3 Clang issue Marc Zyngier 2022-03-09 16:09 ` James Morse 2022-03-09 17:11 ` Nathan Chancellor [this message] 2022-03-09 17:11 ` Nathan Chancellor 2022-03-09 17:50 ` Nathan Chancellor 2022-03-09 17:50 ` Nathan Chancellor 2022-03-09 18:26 ` James Morse 2022-03-09 18:26 ` James Morse 2022-03-09 18:45 ` Catalin Marinas 2022-03-09 18:45 ` Catalin Marinas 2022-03-09 19:20 ` Nathan Chancellor 2022-03-09 19:20 ` Nathan Chancellor 2022-03-09 17:19 ` Robin Murphy
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=YijftpaApSJWuZ3m@dev-arch.thelio-3990X \ --to=nathan@kernel.org \ --cc=catalin.marinas@arm.com \ --cc=james.morse@arm.com \ --cc=kernel-team@android.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=llvm@lists.linux.dev \ --cc=maz@kernel.org \ --cc=ndesaulniers@google.com \ --cc=will@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.