android_kernel_samsung_sm8650/arch
Nathan Chancellor 61114e734c
riscv: Move alternative length validation into subsection
After commit 49b290e430 ("riscv: prevent compressed instructions in
alternatives"), builds with LLVM's integrated assembler fail:

  In file included from arch/riscv/mm/init.c:10:
  In file included from ./include/linux/mm.h:29:
  In file included from ./include/linux/pgtable.h:6:
  In file included from ./arch/riscv/include/asm/pgtable.h:108:
  ./arch/riscv/include/asm/tlbflush.h:23:2: error: expected assembly-time absolute expression
          ALT_FLUSH_TLB_PAGE(__asm__ __volatile__ ("sfence.vma %0" : : "r" (addr) : "memory"));
          ^
  ./arch/riscv/include/asm/errata_list.h:33:5: note: expanded from macro 'ALT_FLUSH_TLB_PAGE'
  asm(ALTERNATIVE("sfence.vma %0", "sfence.vma", SIFIVE_VENDOR_ID,        \
      ^
  ./arch/riscv/include/asm/alternative-macros.h:187:2: note: expanded from macro 'ALTERNATIVE'
          _ALTERNATIVE_CFG(old_content, new_content, vendor_id, errata_id, CONFIG_k)
          ^
  ./arch/riscv/include/asm/alternative-macros.h:113:2: note: expanded from macro '_ALTERNATIVE_CFG'
          __ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, IS_ENABLED(CONFIG_k))
          ^
  ./arch/riscv/include/asm/alternative-macros.h:110:2: note: expanded from macro '__ALTERNATIVE_CFG'
          ALT_NEW_CONTENT(vendor_id, errata_id, enable, new_c)
          ^
  ./arch/riscv/include/asm/alternative-macros.h:99:3: note: expanded from macro 'ALT_NEW_CONTENT'
          ".org   . - (889b - 888b) + (887b - 886b)\n"                    \
           ^
  <inline asm>:26:6: note: instantiated into assembly here
  .org    . - (889b - 888b) + (887b - 886b)
          ^

This error happens because LLVM's integrated assembler has a one-pass
design, which means it cannot figure out the instruction lengths when
the .org directive is outside of the subsection that contains the
instructions, which was changed by the .option directives added by the
above change.

Move the .org directives before the .previous directive so that these
directives are always within the same subsection, which resolves the
failures and does not introduce any new issues with GNU as. This was
done for arm64 in commit 966a0acce2 ("arm64/alternatives: move length
validation inside the subsection") and commit 22315a2296 ("arm64:
alternatives: Move length validation in alternative_{insn, endif}").

While there is no error from the assembly versions of the macro, they
appear to have the same problem so just make the same change there as
well so that there are no problems in the future.

Link: https://github.com/ClangBuiltLinux/linux/issues/1640
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20220516214520.3252074-1-nathan@kernel.org
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2022-06-02 15:55:22 -07:00
..
alpha Not a lot of material this cycle. Many singleton patches against various 2022-05-27 11:22:03 -07:00
arc ARC: bpf: define uapi for BPF_PROG_TYPE_PERF_EVENT program type 2022-04-26 09:35:28 -07:00
arm More power management updates for 5.19-rc1 2022-05-30 11:37:26 -07:00
arm64 RISC-V Patches for the 5.19 Merge Window, Part 1 2022-05-31 14:10:54 -07:00
csky More power management updates for 5.19-rc1 2022-05-30 11:37:26 -07:00
hexagon ptrace: Cleanups for v5.18 2022-03-28 17:29:53 -07:00
ia64 More power management updates for 5.19-rc1 2022-05-30 11:37:26 -07:00
m68k More power management updates for 5.19-rc1 2022-05-30 11:37:26 -07:00
microblaze microblaze: fix typos in comments 2022-05-02 08:36:10 +02:00
mips RISC-V Patches for the 5.19 Merge Window, Part 1 2022-05-31 14:10:54 -07:00
nios2 Kbuild updates for v5.19 2022-05-26 12:09:50 -07:00
openrisc OpenRISC updates for 5.19 2022-05-26 17:27:49 -07:00
parisc RISC-V Patches for the 5.19 Merge Window, Part 1 2022-05-31 14:10:54 -07:00
powerpc RISC-V Patches for the 5.19 Merge Window, Part 1 2022-05-31 14:10:54 -07:00
riscv riscv: Move alternative length validation into subsection 2022-06-02 15:55:22 -07:00
s390 RISC-V Patches for the 5.19 Merge Window, Part 1 2022-05-31 14:10:54 -07:00
sh More power management updates for 5.19-rc1 2022-05-30 11:37:26 -07:00
sparc RISC-V Patches for the 5.19 Merge Window, Part 1 2022-05-31 14:10:54 -07:00
um Kbuild updates for v5.19 2022-05-26 12:09:50 -07:00
x86 RISC-V Patches for the 5.19 Merge Window, Part 1 2022-05-31 14:10:54 -07:00
xtensa Random number generator updates for Linux 5.19-rc1. 2022-05-24 11:58:10 -07:00
.gitignore
Kconfig powerpc updates for 5.19 2022-05-28 11:27:17 -07:00