Unverified Commit 2613c15b authored by Palmer Dabbelt's avatar Palmer Dabbelt
Browse files

Merge patch series "riscv: Add support for xtheadvector"

Charlie Jenkins <charlie@rivosinc.com> says:

xtheadvector is a custom extension that is based upon riscv vector
version 0.7.1 [1]. All of the vector routines have been modified to
support this alternative vector version based upon whether xtheadvector
was determined to be supported at boot.

vlenb is not supported on the existing xtheadvector hardware, so a
devicetree property thead,vlenb is added to provide the vlenb to Linux.

There is a new hwprobe key RISCV_HWPROBE_KEY_VENDOR_EXT_THEAD_0 that is
used to request which thead vendor extensions are supported on the
current platform. This allows future vendors to allocate hwprobe keys
for their vendor.

Support for xtheadvector is also added to the vector kselftests.

[1] https://github.com/T-head-Semi/thead-extension-spec/blob/95358cb2cca9489361c61d335e03d3134b14133f/xtheadvector.adoc



* b4-shazam-merge:
  riscv: Add ghostwrite vulnerability
  selftests: riscv: Support xtheadvector in vector tests
  selftests: riscv: Fix vector tests
  riscv: hwprobe: Document thead vendor extensions and xtheadvector extension
  riscv: hwprobe: Add thead vendor extension probing
  riscv: vector: Support xtheadvector save/restore
  riscv: Add xtheadvector instruction definitions
  riscv: csr: Add CSR encodings for CSR_VXRM/CSR_VXSAT
  RISC-V: define the elements of the VCSR vector CSR
  riscv: vector: Use vlenb from DT for thead
  riscv: Add thead and xtheadvector as a vendor extension
  riscv: dts: allwinner: Add xtheadvector to the D1/D1s devicetree
  dt-bindings: cpus: add a thead vlen register length property
  dt-bindings: riscv: Add xtheadvector ISA extension description

Signed-off-by: default avatarCharlie Jenkins <charlie@rivosinc.com>
Link: https://lore.kernel.org/r/20241113-xtheadvector-v11-0-236c22791ef9@rivosinc.com


Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
parents 26f2d6de 4bf97069
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -293,3 +293,13 @@ The following keys are defined:

  * :c:macro:`RISCV_HWPROBE_MISALIGNED_VECTOR_UNSUPPORTED`: Misaligned vector accesses are
    not supported at all and will generate a misaligned address fault.

* :c:macro:`RISCV_HWPROBE_KEY_VENDOR_EXT_THEAD_0`: A bitmask containing the
  thead vendor extensions that are compatible with the
  :c:macro:`RISCV_HWPROBE_BASE_BEHAVIOR_IMA`: base system behavior.

  * T-HEAD

    * :c:macro:`RISCV_HWPROBE_VENDOR_EXT_XTHEADVECTOR`: The xtheadvector vendor
        extension is supported in the T-Head ISA extensions spec starting from
	commit a18c801634 ("Add T-Head VECTOR vendor extension. ").
+19 −0
Original line number Diff line number Diff line
@@ -26,6 +26,18 @@ description: |
allOf:
  - $ref: /schemas/cpu.yaml#
  - $ref: extensions.yaml
  - if:
      not:
        properties:
          compatible:
            contains:
              enum:
                - thead,c906
                - thead,c910
                - thead,c920
    then:
      properties:
        thead,vlenb: false

properties:
  compatible:
@@ -95,6 +107,13 @@ properties:
    description:
      The blocksize in bytes for the Zicboz cache operations.

  thead,vlenb:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      VLEN/8, the vector register length in bytes. This property is required on
      thead systems where the vector register length is not identical on all harts, or
      the vlenb CSR is not available.

  # RISC-V has multiple properties for cache op block sizes as the sizes
  # differ between individual CBO extensions
  cache-op-block-size: false
+10 −0
Original line number Diff line number Diff line
@@ -621,6 +621,10 @@ properties:
            latency, as ratified in commit 56ed795 ("Update
            riscv-crypto-spec-vector.adoc") of riscv-crypto.

        # vendor extensions, each extension sorted alphanumerically under the
        # vendor they belong to. Vendors are sorted alphanumerically as well.

        # Andes
        - const: xandespmu
          description:
            The Andes Technology performance monitor extension for counter overflow
@@ -628,6 +632,12 @@ properties:
            Registers in the AX45MP datasheet.
            https://www.andestech.com/wp-content/uploads/AX45MP-1C-Rev.-5.0.0-Datasheet.pdf

        # T-HEAD
        - const: xtheadvector
          description:
            The T-HEAD specific 0.7.1 vector implementation as written in
            https://github.com/T-head-Semi/thead-extension-spec/blob/95358cb2cca9489361c61d335e03d3134b14133f/xtheadvector.adoc.

    allOf:
      # Zcb depends on Zca
      - if:
+11 −0
Original line number Diff line number Diff line
@@ -119,4 +119,15 @@ config ERRATA_THEAD_PMU

	  If you don't know what to do here, say "Y".

config ERRATA_THEAD_GHOSTWRITE
	bool "Apply T-Head Ghostwrite errata"
	depends on ERRATA_THEAD && RISCV_ISA_XTHEADVECTOR
	default y
	help
	  The T-Head C9xx cores have a vulnerability in the xtheadvector
	  instruction set. When this errata is enabled, the CPUs will be probed
	  to determine if they are vulnerable and disable xtheadvector.

	  If you don't know what to do here, say "Y".

endmenu # "CPU errata selection"
+26 −0
Original line number Diff line number Diff line
@@ -16,4 +16,30 @@ config RISCV_ISA_VENDOR_EXT_ANDES
	  If you don't know what to do here, say Y.
endmenu

menu "T-Head"
config RISCV_ISA_VENDOR_EXT_THEAD
	bool "T-Head vendor extension support"
	select RISCV_ISA_VENDOR_EXT
	default y
	help
	  Say N here to disable detection of and support for all T-Head vendor
	  extensions. Without this option enabled, T-Head vendor extensions will
	  not be detected at boot and their presence not reported to userspace.

	  If you don't know what to do here, say Y.

config RISCV_ISA_XTHEADVECTOR
	bool "xtheadvector extension support"
	depends on RISCV_ISA_VENDOR_EXT_THEAD
	depends on RISCV_ISA_V
	depends on FPU
	default y
	help
	  Say N here if you want to disable all xtheadvector related procedures
	  in the kernel. This will disable vector for any T-Head board that
	  contains xtheadvector rather than the standard vector.

	  If you don't know what to do here, say Y.
endmenu

endmenu
Loading