Merge patch series "Remove toolchain dependencies for Zicbom"
authorPalmer Dabbelt <palmer@rivosinc.com>
Wed, 15 Feb 2023 05:33:27 +0000 (21:33 -0800)
committerPalmer Dabbelt <palmer@rivosinc.com>
Wed, 15 Feb 2023 05:33:27 +0000 (21:33 -0800)
Conor Dooley <conor@kernel.org> says:

From: Conor Dooley <conor.dooley@microchip.com>

I've yoinked patch 1 from Drew's series adding support for Zicboz &
attached two more patches here that remove the need for, and then drop
the toolchain support checks for Zicbom. The goal is to remove the need
for checking the presence of toolchain Zicbom support in the work being
done to support non instruction based CMOs [1].

I've tested compliation on a number of different configurations with
the Zicbom config option enabled. The important ones to call out I
guess are:
- clang/llvm 14 w/ LLVM=1 which doesn't support Zicbom atm.
- gcc 11 w/ binutils 2.37 which doesn't support Zicbom atm either.
- clang/llvm 15 w/ LLVM=1 BUT with binutils 2.37's ld. This is the
  configuration that prompted adding the LD checks as cc/as supports
  Zicbom, but ld doesn't [2].
- gcc 12 w/ binutils 2.39 & clang 15 w/ LLVM=1, both of these supported
  Zicbom before and still do.

I also checked building the THEAD errata etc with
CONFIG_RISCV_ISA_ZICBOM disabled, and there were no build issues there
either.

* b4-shazam-merge:
  RISC-V: remove toolchain version checks for Zicbom
  RISC-V: replace cbom instructions with an insn-def
  RISC-V: insn-def: Add I-type insn-def

Link: https://lore.kernel.org/r/20230108163356.3063839-1-conor@kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1  2 
arch/riscv/Kconfig
arch/riscv/Makefile
arch/riscv/include/asm/errata_list.h

@@@ -416,44 -416,12 +416,36 @@@ config RISCV_ISA_SVPBM
  
           If you don't know what to do here, say Y.
  
- config TOOLCHAIN_HAS_ZICBOM
-       bool
-       default y
-       depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zicbom)
-       depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zicbom)
-       depends on LLD_VERSION >= 150000 || LD_VERSION >= 23800
 +config TOOLCHAIN_HAS_ZBB
 +      bool
 +      default y
 +      depends on !64BIT || $(cc-option,-mabi=lp64 -march=rv64ima_zbb)
 +      depends on !32BIT || $(cc-option,-mabi=ilp32 -march=rv32ima_zbb)
 +      depends on LLD_VERSION >= 150000 || LD_VERSION >= 23900
 +      depends on AS_IS_GNU
 +
 +config RISCV_ISA_ZBB
 +      bool "Zbb extension support for bit manipulation instructions"
 +      depends on TOOLCHAIN_HAS_ZBB
 +      depends on !XIP_KERNEL && MMU
 +      select RISCV_ALTERNATIVE
 +      default y
 +      help
 +         Adds support to dynamically detect the presence of the ZBB
 +         extension (basic bit manipulation) and enable its usage.
 +
 +         The Zbb extension provides instructions to accelerate a number
 +         of bit-specific operations (count bit population, sign extending,
 +         bitrotation, etc).
 +
 +         If you don't know what to do here, say Y.
 +
  config RISCV_ISA_ZICBOM
        bool "Zicbom extension support for non-coherent DMA operation"
-       depends on TOOLCHAIN_HAS_ZICBOM
        depends on !XIP_KERNEL && MMU
 -      select RISCV_DMA_NONCOHERENT
 -      select RISCV_ALTERNATIVE
        default y
 +      select RISCV_ALTERNATIVE
 +      select RISCV_DMA_NONCOHERENT
        help
           Adds support to dynamically detect the presence of the ZICBOM
           extension (Cache Block Management Operations) and enable its
Simple merge
@@@ -7,7 -7,7 +7,8 @@@
  
  #include <asm/alternative.h>
  #include <asm/csr.h>
+ #include <asm/insn-def.h>
 +#include <asm/hwcap.h>
  #include <asm/vendorid_list.h>
  
  #ifdef CONFIG_ERRATA_SIFIVE