Skip to content

riscv: backport mainline xtheadvector support - #355

Open
zhuzhenxxx-collab wants to merge 1534 commits into
RVCK-Project:rvck-6.6from
zhuzhenxxx-collab:rvck-6.6-xtheadvector-backport
Open

riscv: backport mainline xtheadvector support #355
zhuzhenxxx-collab wants to merge 1534 commits into
RVCK-Project:rvck-6.6from
zhuzhenxxx-collab:rvck-6.6-xtheadvector-backport

Conversation

@zhuzhenxxx-collab

@zhuzhenxxx-collab zhuzhenxxx-collab commented Jul 31, 2026

Copy link
Copy Markdown

修复th1520 开启非对齐vector后启动崩溃。

将上游 xtheadvector 主线支持 backport 到 rvck-6.6。先 revert 基线 4 个旧改 commit,再合入 18 个上游 commit。共 22 commits。

Reverts (4)

  • Revert "fix: riscv: xtheadvector: fix setup_v_vsize"
  • Revert "xtheadvector: fix it used as v-ext when hwprobe is used"
  • Revert "riscv: xtheadvector: enable vector function"
  • Revert "T-Head C9xx cores implement an older version (0.7.1) of the vector specification."

Series 1: riscv: Add support for xtheadvector (v11, Charlie Jenkins)

Cover: https://lore.kernel.org/r/20241113-xtheadvector-v11-0-236c22791ef9@rivosinc.com

13 patches 合入 12 个,patch 10 (21e49e64f307) 基线已有,跳过。

  • [01/13] e576b7cb8183 dt-bindings: riscv: Add xtheadvector ISA extension description
  • [02/13] bf6279b38a4b dt-bindings: cpus: add a thead vlen register length property
  • [03/13] ce1daeeba600 riscv: dts: allwinner: Add xtheadvector to the D1/D1s devicetree
  • [04/13] cddd63869f92 riscv: Add thead and xtheadvector as a vendor extension
  • [05/13] 377be47f90e4 riscv: vector: Use vlenb from DT for thead
  • [06/13] 66f197785d51 RISC-V: define the elements of the VCSR vector CSR
  • [07/13] b9a931442451 riscv: csr: Add CSR encodings for CSR_VXRM/CSR_VXSAT (有差异,基线 csr.h 已有部分定义)
  • [08/13] 01e3313e34d0 riscv: Add xtheadvector instruction definitions
  • [09/13] d863910eabaf riscv: vector: Support xtheadvector save/restore (有差异,仅需 vector.h hunks)
  • [10/13] 21e49e64f307 riscv: hwprobe: Add thead vendor extension probing — 基线已有,跳过
  • [11/13] 7fa00fd6ff53 riscv: hwprobe: Document thead vendor extensions and xtheadvector extension
  • [12/13] 57d7713af93e selftests: riscv: Fix vector tests
  • [13/13] c384c5d4a2ae selftests: riscv: Support xtheadvector in vector tests

Series 2: D1 dts isa-extensions 转换 (依赖补丁)

Link: https://lore.kernel.org/r/20231009-moonlight-gray-92debdc89f30@wendy

  • c3f7c14856eb riscv: dts: allwinner: convert isa detection to new properties

Series 3: zve-detection v5 (仅 patch 7)

Link: https://lore.kernel.org/r/20240510-zve-detection-v5-7-0711bdd26c12@sifive.com

  • [07/11] ac295b67422d riscv: vector: adjust minimum Vector requirement to ZVE32X (有差异,部分 backport,仅 sys_hwprobe.c + uaccess.S)

fixes (4)

测试

root@light-a-val:/root/selftest# ./v_initval
TAP version 13
1..1
# Starting 1 tests from 1 test cases.
#  RUN           global.v_initval ...
#            OK  global.v_initval
ok 1 global.v_initval
# PASSED: 1 / 1 tests passed.
# Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
root@light-a-val:/root/selftest# ./vstate_prctl
TAP version 13
1..13
# Starting 13 tests from 1 test cases.
#  RUN           global.get_control_no_v ...
#      SKIP      Test expects vector to be not supp[ 2247.157782] vstate_exec_nol[1496]: unhandled signal 4 code 0x1 at 0x0000000000013ca8 in vstate_exec_nolibc[10000+7000]
[ 2247.169836] CPU: 0 PID: 1496 Comm: vstate_exec_nol Not tainted 6.6.143+ #99
[ 2247.176819] Hardware name: Sipeed Lichee Pi 4A (DT)
[ 2247.181710] epc : 0000000000013ca8 ra : 0000000000013c40 sp : 0000003fd0688d00
[ 2247.188947]  gp : 0000000000016800 tp : 00000000212df7a0 t0 : 00000000003dd1fb
[ 2247.196182]  t1 : 0000003fd97ff838 t2 : 0000000000000000 s0 : 0000003fd0688d70
[ 2247.203413]  s1 : 0000000000000000 a0 : 0000000000000001 a1 : 0000000000000000
[ 2247.210643]  a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000001
[ 2247.217874]  a5 : 0000000000000000 a6 : 7efefefefefefeff a7 : 00000000000000a7
[ 2247.225107]  s2 : 0000000000013abe s3 : 0000000000013a36 s4 : 0000000000010248
[ 2247.232339]  s5 : 0000000000084018 s6 : 000000002fcfc490 s7 : 000000002fcdf300
[ 2247.239569]  s8 : 0000000000000000 s9 : 000000002fd1a9e0 s10: 000000002fd1aa40
[ 2247.246800]  s11: 000000002fd1aa00 t3 : 0000000000028d18 t4 : 0000000000000000
[ 2247.254032]  t5 : ffffffffffffffff t6 : 00000000212e05ca ssp : 0000000000000000
[ 2247.261354] status: 0000000200004020 badaddr: 000000000d307057 cause: 0000000000000002
orted
#        [ 2247.269592] audit: type=1701 audit(1659952044.404:23): auid=4294967295 uid=0 gid=0 ses=4294967295 subj=unconfined pid=1496 comm="vstate_exec_nol" exe="/root/selftest/vstate_exec_nolibc" sig=4 res=1
    OK  global.get_control_no_v
ok 1 # SKIP Test expects vector to be not supported
#  RUN           global.set_control_no_v ...
#      SKIP      Test expects vector to be n[ 2247.302064] vstate_exec_nol[1508]: unhandled signal 4 code 0x1 at 0x0000000000013ca8 in vstate_exec_nolibc[10000+7000]
ot supported
# [ 2247.314212] CPU: 1 PID: 1508 Comm: vstate_exec_nol Not tainted 6.6.143+ #99
           OK  g[ 2247.322558] Hardware name: Sipeed Lichee Pi 4A (DT)
lobal.set_contro[ 2247.328825] epc : 0000000000013ca8 ra : 0000000000013c40 sp : 0000003fec1efd10
l_no_v
ok 2 # S[ 2247.337430]  gp : 0000000000016800 tp : 00000000212df7a0 t0 : 00000000003dd1fb
KIP Test expects[ 2247.346038]  t1 : 0000003fd97ff838 t2 : 0000000000000000 s0 : 0000003fec1efd80
 vector to be no[ 2247.354644]  s1 : 0000000000000000 a0 : 0000000000000015 a1 : 0000000000000000
t supported
#  [ 2247.363253]  a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000015
RUN           gl[ 2247.371858]  a5 : 0000000000000000 a6 : 7efefefefefefeff a7 : 00000000000000a7
obal.vstate_on_c[ 2247.380464]  s2 : 0000000000013abe s3 : 0000000000013a36 s4 : 0000000000010248
urrent ...
#   [ 2247.389072]  s5 : 0000000000084018 s6 : 000000002fcfc490 s7 : 000000002fcdf300
         OK  glo[ 2247.397678]  s8 : 0000000000000000 s9 : 000000002fd1a9e0 s10: 000000002fd1aa40
bal.vstate_on_cu[ 2247.406284]  s11: 000000002fd1aa00 t3 : 0000000000028d18 t4 : 0000000000000001
rrent
ok 3 glob[ 2247.414893]  t5 : ffffffffffffffff t6 : 00000000212e05d5 ssp : 0000000000000000
al.vstate_on_cur[ 2247.423585] status: 0000000200004020 badaddr: 000000000d307057 cause: 0000000000000002
rent
#  RUN    [ 2247.433216] audit: type=1701 audit(1659952044.568:24): auid=4294967295 uid=0 gid=0 ses=4294967295 subj=unconfined pid=1508 comm="vstate_exec_nol" exe="/root/selftest/vstate_exec_nolibc" sig=4 res=1
       global.vstate_off_eperm ...
#            OK  global.vstate_off_eperm
ok[ 2247.457998] vstate_exec_nol[1511]: unhandled signal 4 code 0x1 at 0x0000000000013ca8 in vstate_exec_nolibc[10000+7000]
[ 2247.469467] CPU: 0 PID: 1511 Comm: vstate_exec_nol Not tainted 6.6.143+ #99
[ 2247.476451] Hardware name: Sipeed Lichee Pi 4A (DT)
[ 2247.481341] epc : 0000000000013ca8 ra : 0000000000013c40 sp : 0000003fd61ffd00
[ 2247.488576]  gp : 0000000000016800 tp : 00000000212df7a0 t0 : 00000000003dd1fb
[ 2247.495812]  t1 : 0000003fd97ff838 t2 : 0000000000000000 s0 : 0000003fd61ffd70
[ 2247.503046]  s1 : 0000000000000000 a0 : 0000000000000015 a1 : 0000000000000000
[ 2247.510277]  a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000015
[ 2247.517509]  a5 : 0000000000000000 a6 : 7efefefefefefeff a7 : 00000000000000a7
[ 2247.524741]  s2 : 0000000000013abe s3 : 0000000000013a36 s4 : 0000000000010248
[ 2247.531974]  s5 : 0000000000084018 s6 : 000000002fcfc490 s7 : 000000002fcdf300
[ 2247.539206]  s8 : 0000000000000000 s9 : 000000002fd1a9e0 s10: 000000002fd1aa40
[ 2247.546437]  s11: 000000002fd1aa00 t3 : 0000000000028d18 t4 : 0000000000000000
 4 global.vstate_off_eperm
#  RUN           glo[ 2247.553682]  t5 : ffffffffffffffff t6 : 00000000212e05ca ssp : 0000000000000000
bal.vstate_on_no[ 2247.553695] status: 0000000200004020 badaddr: 000000000d307057 cause: 0000000000000002
_nesting ...
# [ 2247.553995] audit: type=1701 audit(1659952044.688:25): auid=4294967295 uid=0 gid=0 ses=4294967295 subj=unconfined pid=1511 comm="vstate_exec_nol" exe="/root/selftest/vstate_exec_nolibc" sig=4 res=1
           OK  global.vstate_on_no_nesting
ok 5 global.vstate_on_no_nesting
#  RUN           global.vstate_off_nesting ...
#            OK  global.vstate_off_nesting
ok 6 global.vstate_off_nesting
#  RUN           global.vstate_on_inherit_no_nesting ...
#            OK  global.vstate_on_inherit_no_nesting
ok 7 global.vstate_on_inherit_no_nesting
#  RUN           global.vstate_on_inherit ...
#            OK  global.vstate_on_inherit
ok 8 global.vstate_on_inherit
#  RUN           global.vstate_off_inherit_no_nesting ...
#            OK  global.vstate_off_inherit_no_nesting
ok 9 global.vstate_off_inherit_no_nesting
#  RUN           global.vstate_off_inherit ...
#            OK  global.vstate_off_inherit
ok 10 global.vstate_off_inherit
#  RUN           global.inval_set_control_1 ...
#            OK  global.inval_set_control_1
ok 11 global.inval_set_control_1
#  RUN           global.inval_set_control_2 ...
#            OK  global.inval_set_control_2
ok 12 global.inval_set_control_2
#  RUN           global.inval_set_control_3 ...
#            OK  global.inval_set_control_3
ok 13 global.inval_set_control_3
# PASSED: 13 / 13 tests passed.
# Totals: pass:11 fail:0 xfail:0 xpass:0 skip:2 error:0
root@light-a-val:/root/selftest#

fixed: #354

pathakraul and others added 30 commits July 1, 2026 10:17
mainline inclusion
from mainline-6.17
commit 5ba9f52
category: feature
bugzilla: RVCK-Project#243

--------------------------------

The RPMI specification defines a clock service group which can be
accessed via SBI MPXY extension or dedicated S-mode RPMI transport.

Add mailbox client based clock driver for the RISC-V RPMI clock
service group.

Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Co-developed-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Rahul Pathak <rpathak@ventanamicro.com>
Link: https://lore.kernel.org/r/20250818040920.272664-11-apatel@ventanamicro.com
[pjw@kernel.org: converted rpmi_clkrate_u64 macro to a function; replaced bare constant with a macro]
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.17
commit a72ab25
category: feature
bugzilla: RVCK-Project#243

--------------------------------

Add device tree bindings for the RPMI system MSI service group
based message proxy implemented by the SBI implementation (machine
mode firmware or hypervisor).

The RPMI system MSI service group is defined by the RISC-V
platform management interface (RPMI) specification.

Reviewed-by: Atish Patra <atishp@rivosinc.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Link: https://lore.kernel.org/r/20250818040920.272664-12-apatel@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.17
commit 3e6cf38
category: feature
bugzilla: RVCK-Project#243

--------------------------------

Add device tree bindings for the RPMI system MSI service group
based interrupt controller for the supervisor software.

The RPMI system MSI service group is defined by the RISC-V
platform management interface (RPMI) specification.

Reviewed-by: Atish Patra <atishp@rivosinc.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Link: https://lore.kernel.org/r/20250818040920.272664-13-apatel@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.17
commit aa43953
category: feature
bugzilla: RVCK-Project#243

--------------------------------

The RPMI specification defines a system MSI service group which
allows application processors to receive MSIs upon system events
such as graceful shutdown/reboot request, CPU hotplug event, memory
hotplug event, etc.

Add an irqchip driver for the RISC-V RPMI system MSI service group
to directly receive system MSIs in Linux kernel.

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Link: https://lore.kernel.org/r/20250818040920.272664-14-apatel@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
…nargs_prop

mainline inclusion
from mainline-6.17
commit e121be7
category: feature
bugzilla: RVCK-Project#243

--------------------------------

Currently, acpi_fwnode_get_reference_args() delegates to the internal
function __acpi_node_get_property_reference() to retrieve property
references. However, this function does not handle the nargs_prop (cells
property) parameter, and instead expects the number of arguments (nargs)
to be known or hardcoded.

As a result, when fwnode_property_get_reference_args() is used with a
valid nargs_prop, the ACPI backend ignores it, whereas the Device Tree
(DT) backend uses the #*-cells property from the reference node to
determine the number of arguments dynamically.

To support the nargs_prop in ACPI, refactor the code as follows:

- Move the implementation from __acpi_node_get_property_reference()
  into acpi_fwnode_get_reference_args().

- Update __acpi_node_get_property_reference() to call the (now updated)
  acpi_fwnode_get_reference_args() passing NULL as nargs_prop to keep
  the behavior of __acpi_node_get_property_reference() intact.

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Link: https://lore.kernel.org/r/20250818040920.272664-15-apatel@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.17
commit 159c86f
category: feature
bugzilla: RVCK-Project#243

--------------------------------

Currently, ACPI does not support the use of a nargs_prop (e.g.,
associated with a reference in fwnode_property_get_reference_args().
Instead, ACPI expects the number of arguments (nargs) to be explicitly
passed or known.

This behavior diverges from Open Firmware (OF), which allows the use of
a #*-cells property in the referenced node to determine the number of
arguments. Since fwnode_property_get_reference_args() is a common
interface used across both OF and ACPI firmware paradigms, it is
desirable to have a unified calling convention that works seamlessly for
both.

Add the support for ACPI to parse a nargs_prop from the referenced
fwnode, aligning its behavior with the OF backend. This allows drivers
and subsystems using fwnode_property_get_reference_args() to work in a
firmware-agnostic way without having to hardcode or special-case
argument counts for ACPI.

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Link: https://lore.kernel.org/r/20250818040920.272664-16-apatel@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.17
commit 4215d1c
category: feature
bugzilla: RVCK-Project#243

--------------------------------

The RPMI System MSI interrupt controller (just like PLIC and APLIC)
needs to probed prior to devices like GED which use interrupts provided
by it. Also, it has dependency on the SBI MPXY mailbox device.

Add HIDs of RPMI System MSI and SBI MPXY mailbox devices to the honor
list so that those dependencies are handled.

Reviewed-by: Atish Patra <atishp@rivosinc.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Link: https://lore.kernel.org/r/20250818040920.272664-17-apatel@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.17
commit 694b2ef
category: feature
bugzilla: RVCK-Project#243

--------------------------------

Currently, the interrupt controller list is created without any order.
Create the list sorted with the GSI base of the interrupt controllers.

Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Link: https://lore.kernel.org/r/20250818040920.272664-18-apatel@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.17
commit 4d185fd
category: feature
bugzilla: RVCK-Project#243

--------------------------------

Some RISC-V interrupt controllers like RPMI based system MSI interrupt
controllers do not have MADT entry defined. These interrupt controllers
exist only in the namespace. ACPI spec defines _GSB method to get the
GSI base of the interrupt controller, However, there is no such standard
method to get the GSI range. To support such interrupt controllers, set
the GSI range of such interrupt controllers to non-overlapping range and
provide API for interrupt controller driver to update it with proper
value.

Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Link: https://lore.kernel.org/r/20250818040920.272664-19-apatel@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.17
commit bb96fb5
category: feature
bugzilla: RVCK-Project#243

--------------------------------

The RPMI System MSI device will provide GSIs to downstream devices
(such as GED) so add it to the RISC-V GSI to fwnode mapping.

Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Link: https://lore.kernel.org/r/20250818040920.272664-20-apatel@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.17
commit 3f5d7a5
category: feature
bugzilla: RVCK-Project#243

--------------------------------

ACPI based loadable drivers which need MSIs will also need
imsic_acpi_get_fwnode() to update the device MSI domain so
export this function.

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Link: https://lore.kernel.org/r/20250818040920.272664-21-apatel@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.17
commit 7e64042
category: feature
bugzilla: RVCK-Project#243

--------------------------------

Add ACPI support for the RISC-V SBI message proxy (MPXY) based
mailbox driver.

Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Link: https://lore.kernel.org/r/20250818040920.272664-22-apatel@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.17
commit 4752b0c
category: feature
bugzilla: RVCK-Project#243

--------------------------------

Add ACPI support for the RISC-V RPMI system MSI based irqchip driver.

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Link: https://lore.kernel.org/r/20250818040920.272664-23-apatel@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.17
commit f30d7cc
category: feature
bugzilla: RVCK-Project#243

--------------------------------

The GPIO keyboard and event device can be used to receive graceful
shutdown or reboot input keys so let us enable it by default for
RV64 (just like ARM64).

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Link: https://lore.kernel.org/r/20250818040920.272664-24-apatel@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.17
commit 67b8766
category: feature
bugzilla: RVCK-Project#243

--------------------------------

Add Rahul and myself as maintainers for RISC-V RPMI and MPXY drivers.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
Link: https://lore.kernel.org/r/20250818040920.272664-25-apatel@ventanamicro.com
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
dist inclusion
category: cleanup
Link: RVCK-Project#252

--------------------------------

This reverts commit 9898f99.

Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
dist inclusion
category: bugfix
Link: RVCK-Project#258

--------------------------------

Commit 3d4a329 ("Revert chore: use xuantie instead of thead")
removed the source line for drivers/clk/xuantie/Kconfig but did not
add back the source line for drivers/clk/thead/Kconfig.

This causes CONFIG_CLK_TH1520_FM to be unavailable in menuconfig,
which leads to clock driver not being built and boot failures on
TH1520 boards.

Fixes: 3d4a329 ("Revert chore: use xuantie instead of thead")
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
dist inclusion
category: bugfix
Link: RVCK-Project#258

--------------------------------

The openEuler OpenSBI firmware looks for "xuantie,th1520-aon" compatible
string and requires the "opensbi-mboxes" property to initialize the AON
subsystem for CPU hotplug and suspend-to-RAM functionality.

After the revert commit 3d4a329, the aon node only has
"thead,th1520-aon" compatible which causes OpenSBI to fail with:
  "aon node not found in FDT"

This patch fixes the aon node by:
1. Adding "xuantie,th1520-aon" compatible for OpenSBI compatibility
2. Adding "opensbi-mboxes" property pointing to mbox_910r
3. Adding third parameter to mboxes for proper mailbox channel config
4. Adding status = "okay" to enable the node

Fixes: 3d4a329 ("Revert chore: use xuantie instead of thead")
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
dist inclusion
category: cleanup
Link: RVCK-Project#235

--------------------------------

This reverts commit 2e4869d.

Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
dist inclusion
category: cleanup
Link: RVCK-Project#235

--------------------------------

This reverts commit 61085f0.

Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
dist inclusion
category: cleanup
Link: RVCK-Project#235

--------------------------------

This reverts commit f57b43b.

Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from Linux 7.0-rc3
commit 30e7573
category: feature
bugzilla: RVCK-Project#236

--------------------------------

Add a YAML schema for the T-HEAD TH1520 SoC reset controller. This
controller manages resets for subsystems such as the GPU within the
TH1520 SoC.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
Link: https://lore.kernel.org/r/20250303152511.494405-2-m.wilczynski@samsung.com
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from Linux 7.0-rc3
commit 4a65326
category: feature
bugzilla: RVCK-Project#236

--------------------------------

Add reset controller driver for the T-HEAD TH1520 SoC that manages
hardware reset lines for various subsystems. The driver currently
implements support for GPU reset control, with infrastructure in place
to extend support for NPU and Watchdog Timer resets in future updates.

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
Link: https://lore.kernel.org/r/20250303152511.494405-3-m.wilczynski@samsung.com
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from Linux 7.0-rc3
commit cf5e81d
category: feature
bugzilla: RVCK-Project#236

--------------------------------

Add the "gpu-clkgen" reset property to the AON device tree node. This
allows the AON power domain driver to detect the capability to power
sequence the GPU and spawn the necessary pwrseq-thead-gpu auxiliary
driver for managing the GPU's complex power sequence.

This commit also adds the prerequisite
dt-bindings/reset/thead,th1520-reset.h include to make the
TH1520_RESET_ID_GPU_CLKGEN available. This include was previously
dropped during a conflict resolution [1].

Link: https://lore.kernel.org/all/aAvfn2mq0Ksi8DF2@x1/ [1]

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Drew Fustini <drew@pdp7.com>
Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
Signed-off-by: Drew Fustini <drew@pdp7.com>
Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.7-rc8
commit 683c5bb
category: feature
bugzilla: RVCK-Project#256

--------------------------------

ENTRY()/END()/WEAK() macros are deprecated and we should make use of the
new SYM_*() macros [1] for better annotation of symbols. Replace the
deprecated ones with the new ones and fix wrong usage of END()/ENDPROC()
to correctly describe the symbols.

[1] https://docs.kernel.org/core-api/asm-annotations.html

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.7-rc8
commit e5ff012
category: feature
bugzilla: RVCK-Project#256

--------------------------------

For the sake of coherency, use local labels in assembly when
applicable. This also avoid kprobes being confused when applying a
kprobe since the size of function is computed by checking where the
next visible symbol is located. This might end up in computing some
function size to be way shorter than expected and thus failing to apply
kprobes to the specified offset.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.11
commit 1a74833
category: feature
bugzilla: RVCK-Project#256

--------------------------------

Currently, userstacktrace is unsupported for riscv. So use the
perf_callchain_user() code as blueprint to implement the
arch_stack_walk_user() which add userstacktrace support on riscv.
Meanwhile, we can use arch_stack_walk_user() to simplify the implementation
of perf_callchain_user().

A ftrace test case is shown as below:

	# cd /sys/kernel/debug/tracing
	# echo 1 > options/userstacktrace
	# echo 1 > options/sym-userobj
	# echo 1 > events/sched/sched_process_fork/enable
	# cat trace
	......
	            bash-178     [000] ...1.    97.968395: sched_process_fork: comm=bash pid=178 child_comm=bash child_pid=231
	            bash-178     [000] ...1.    97.970075: <user stack trace>
	 => /lib/libc.so.6[+0xb5090]

Also a simple perf test is ok as below:

	# perf record -e cpu-clock --call-graph fp top
	# perf report --call-graph

	.....
	[[31m  66.54%[[m     0.00%  top      [kernel.kallsyms]            [k] ret_from_exception
            |
            ---ret_from_exception
               |
               |--[[31m58.97%[[m--do_trap_ecall_u
               |          |
               |          |--[[31m17.34%[[m--__riscv_sys_read
               |          |          ksys_read
               |          |          |
               |          |           --[[31m16.88%[[m--vfs_read
               |          |                     |
               |          |                     |--[[31m10.90%[[m--seq_read

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Tested-by: Jinjie Ruan <ruanjinjie@huawei.com>
Cc: Björn Töpel <bjorn@kernel.org>
Link: https://lore.kernel.org/r/20240708032847.2998158-3-ruanjinjie@huawei.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.12-rc6
commit 5bb5ccb
category: feature
bugzilla: RVCK-Project#256

--------------------------------

Introduce basic guest support in perf, enabling it to distinguish
between PMU interrupts in the host or guest, and collect
fundamental information.

Signed-off-by: Quan Zhou <zhouquan@iscas.ac.cn>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Link: https://lore.kernel.org/r/a67d527dc1b11493fe11f7f53584772fdd983744.1728957131.git.zhouquan@iscas.ac.cn
Signed-off-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.12-rc6
commit eded675
category: feature
bugzilla: RVCK-Project#256

--------------------------------

For the information collected on the host side, we need to
identify which data originates from the guest and record
these events separately, this can be achieved by having
KVM register perf callbacks.

Signed-off-by: Quan Zhou <zhouquan@iscas.ac.cn>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Link: https://lore.kernel.org/r/00342d535311eb0629b9ba4f1e457a48e2abee33.1728957131.git.zhouquan@iscas.ac.cn
Signed-off-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
mainline inclusion
from mainline-6.12-rc6
commit e403a90
category: feature
bugzilla: RVCK-Project#256

--------------------------------

Order the object files alphabetically in the Makefile so that
it is very predictable inserting new object files in the future.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Atish Patra <atishp@rivosinc.com>
Link: https://lore.kernel.org/r/20241020194734.58686-2-apatel@ventanamicro.com
Signed-off-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
encrow and others added 25 commits July 14, 2026 17:53
riscv inclusion
category: feature
bugzilla: RVCK-Project#322

--------------------------------

Add the SpacemiT K3 USB3 combo PHY driver.

On K3 the PCIe/USB subsystem provides three single-lane PIPE3 PHYs
(PHY2/3/4) shared between PCIe Port C/D and USB3 Port B/C/D. Lane
ownership is selected through the APMU PMUA_PCIE_SUBSYS_MGMT register:
the driver acquires the syscon-apmu regmap, disables PCIe-A x8 mode and
switches the requested lane to USB before bringing the PHY up, so USB3
operation is only possible when the conflicting PCIe x8 configuration
is not in use.

Bring-up performs R-calibration trim override (N/P trim) and PLL/PU
lock polling via the HSIO APB spare registers, and exposes the standard
generic-phy init/exit/power and set_speed operations for the xHCI/dwc3
stack. The driver also registers a Type-C orientation switch/mux so the
combo PHY can follow cable orientation on Type-C ports.

Signed-off-by: Yongchao Jia <yongchao.jia@spacemit.com>
riscv inclusion
category: feature
bugzilla: RVCK-Project#322

--------------------------------

Add the K3 USB3 controller and combo PHY nodes to k3.dtsi and enable
them on the com260 board, wiring up the usb3_portb controller, its
USB2/USB3 PHYs and the on-board VL817 hub.

Signed-off-by: Yongchao Jia <yongchao.jia@spacemit.com>
USB: spacemit-k3: Add Spacemit K3 USB host controller support
dist inclusion
category: cleanup
Link: RVCK-Project#354

--------------------------------

This reverts commit 30843df.

Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
dist inclusion
category: cleanup
Link: RVCK-Project#354

--------------------------------

This reverts commit 4a43937.

Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
dist inclusion
category: cleanup
Link: RVCK-Project#354

--------------------------------

This reverts commit 3401b2a.

Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
…ector specification."

dist inclusion
category: cleanup
Link: RVCK-Project#354

--------------------------------

This reverts commit d701970.

Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
mainline inclusion
from mainline-6.10
commit c3f7c14 ("riscv: dts: allwinner: convert isa detection to new properties")
category: feature
Link: RVCK-Project#354

--------------------------------

Convert the D1 devicetrees to use the new properties
"riscv,isa-base" & "riscv,isa-extensions".
For compatibility with other projects, "riscv,isa" remains.

Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20231009-moonlight-gray-92debdc89f30@wendy
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
mainline inclusion
from mainline-6.14
commit e576b7c ("dt-bindings: riscv: Add xtheadvector ISA extension description")
category: feature
Link: RVCK-Project#354

--------------------------------

The xtheadvector ISA extension is described on the T-Head extension spec
Github page [1] at commit 95358cb2cca9.

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

Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Tested-by: Yangyu Chen <cyy@cyyself.name>
Link: https://lore.kernel.org/r/20241113-xtheadvector-v11-1-236c22791ef9@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
mainline inclusion
from mainline-6.14
commit bf6279b ("dt-bindings: cpus: add a thead vlen register length property")
category: feature
Link: RVCK-Project#354

--------------------------------

Add a property analogous to the vlenb CSR so that software can detect
the vector length of each CPU prior to it being brought online.
Currently software has to assume that the vector length read from the
boot CPU applies to all possible CPUs. On T-Head CPUs implementing
pre-ratification vector, reading the th.vlenb CSR may produce an illegal
instruction trap, so this property is required on such systems.

Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Tested-by: Yangyu Chen <cyy@cyyself.name>
Link: https://lore.kernel.org/r/20241113-xtheadvector-v11-2-236c22791ef9@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
mainline inclusion
from mainline-6.14
commit ce1daee ("riscv: dts: allwinner: Add xtheadvector to the D1/D1s devicetree")
category: feature
Link: RVCK-Project#354

--------------------------------

The D1/D1s SoCs support xtheadvector so it can be included in the
devicetree. Also include vlenb for the cpu.

Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Tested-by: Yangyu Chen <cyy@cyyself.name>
Link: https://lore.kernel.org/r/20241113-xtheadvector-v11-3-236c22791ef9@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
mainline inclusion
from mainline-6.14
commit cddd638 ("riscv: Add thead and xtheadvector as a vendor extension")
category: feature
Link: RVCK-Project#354

--------------------------------

Add support to the kernel for THead vendor extensions with the target of
the new extension xtheadvector.

Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Tested-by: Yangyu Chen <cyy@cyyself.name>
Link: https://lore.kernel.org/r/20241113-xtheadvector-v11-4-236c22791ef9@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
mainline inclusion
from mainline-6.14
commit 377be47 ("riscv: vector: Use vlenb from DT for thead")
category: feature
Link: RVCK-Project#354

--------------------------------

If thead,vlenb is provided in the device tree, prefer that over reading
the vlenb csr.

Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Tested-by: Yangyu Chen <cyy@cyyself.name>
Link: https://lore.kernel.org/r/20241113-xtheadvector-v11-5-236c22791ef9@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
mainline inclusion
from mainline-6.14
commit 66f1977 ("RISC-V: define the elements of the VCSR vector CSR")
category: feature
Link: RVCK-Project#354

--------------------------------

The VCSR CSR contains two elements VXRM[2:1] and VXSAT[0].

Define constants for those to access the elements in a readable way.

Acked-by: Guo Ren <guoren@kernel.org>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Heiko Stuebner <heiko.stuebner@vrull.eu>
Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Tested-by: Yangyu Chen <cyy@cyyself.name>
Link: https://lore.kernel.org/r/20241113-xtheadvector-v11-6-236c22791ef9@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
mainline inclusion
from mainline-6.14
commit b9a9314 ("riscv: csr: Add CSR encodings for CSR_VXRM/CSR_VXSAT")
category: feature
Link: RVCK-Project#354

--------------------------------

The VXRM vector csr for xtheadvector has an encoding of 0xa and VXSAT
has an encoding of 0x9.

Co-developed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Tested-by: Yangyu Chen <cyy@cyyself.name>
Link: https://lore.kernel.org/r/20241113-xtheadvector-v11-7-236c22791ef9@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
[zhenxing.zhu@linux.alibaba.com: adapted to rvck-6.6 baseline csr.h which already has partial CSR definitions]
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
mainline inclusion
from mainline-6.14
commit 01e3313 ("riscv: Add xtheadvector instruction definitions")
category: feature
Link: RVCK-Project#354

--------------------------------

xtheadvector uses different encodings than standard vector for
vsetvli and vector loads/stores. Write the instruction formats to be
used in assembly code.

Co-developed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Tested-by: Yangyu Chen <cyy@cyyself.name>
Link: https://lore.kernel.org/r/20241113-xtheadvector-v11-8-236c22791ef9@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
mainline inclusion
from mainline-6.14
commit d863910 ("riscv: vector: Support xtheadvector save/restore")
category: feature
Link: RVCK-Project#354

--------------------------------

Use alternatives to add support for xtheadvector vector save/restore
routines.

Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Tested-by: Yangyu Chen <cyy@cyyself.name>
Link: https://lore.kernel.org/r/20241113-xtheadvector-v11-9-236c22791ef9@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
[zhenxing.zhu@linux.alibaba.com: only vector.h hunks needed, other files already in rvck-6.6 baseline]
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
…ension

mainline inclusion
from mainline-6.14
commit 7fa00fd ("riscv: hwprobe: Document thead vendor extensions and xtheadvector extension")
category: feature
Link: RVCK-Project#354

--------------------------------

Document support for thead vendor extensions using the key
RISCV_HWPROBE_KEY_VENDOR_EXT_THEAD_0 and xtheadvector extension using
the key RISCV_HWPROBE_VENDOR_EXT_XTHEADVECTOR.

Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Reviewed-by: Evan Green <evan@rivosinc.com>
Tested-by: Yangyu Chen <cyy@cyyself.name>
Link: https://lore.kernel.org/r/20241113-xtheadvector-v11-11-236c22791ef9@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
mainline inclusion
from mainline-6.14
commit 57d7713 ("selftests: riscv: Fix vector tests")
category: feature
Link: RVCK-Project#354

--------------------------------

Overhaul the riscv vector tests to use kselftest_harness to help the
test cases correctly report the results and decouple the individual test
cases from each other. With this refactoring, only run the test cases if
vector is reported and properly report the test case as skipped
otherwise. The v_initval_nolibc test was previously not checking if
vector was supported and used a function (malloc) which invalidates
the state of the vector registers.

Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Tested-by: Yangyu Chen <cyy@cyyself.name>
Link: https://lore.kernel.org/r/20241113-xtheadvector-v11-12-236c22791ef9@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
mainline inclusion
from mainline-6.14
commit c384c5d ("selftests: riscv: Support xtheadvector in vector tests")
category: feature
Link: RVCK-Project#354

--------------------------------

Extend existing vector tests to be compatible with the xtheadvector
instructions.

Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Tested-by: Yangyu Chen <cyy@cyyself.name>
Link: https://lore.kernel.org/r/20241113-xtheadvector-v11-13-236c22791ef9@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
mainline inclusion
from mainline-6.16
commit 4262bd0 ("riscv: vector: Fix context save/restore with xtheadvector")
category: feature
Link: RVCK-Project#354

--------------------------------

Previously only v0-v7 were correctly saved/restored,
and the context of v8-v31 are damanged.
Correctly save/restore v8-v31 to avoid breaking userspace.

Fixes: d863910 ("riscv: vector: Support xtheadvector save/restore")
Cc: stable@vger.kernel.org
Signed-off-by: Han Gao <rabenda.cn@gmail.com>
Tested-by: Xiongchuan Tan <tanxiongchuan@isrc.iscas.ac.cn>
Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
Reviewed-by: Yanteng Si <si.yanteng@linux.dev>
Reviewed-by: Andy Chiu <andybnac@gmail.com>
Link: https://lore.kernel.org/r/9b9eb2337f3d5336ce813721f8ebea51e0b2b553.1747994822.git.rabenda.cn@gmail.com
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
…ous_vlenb()

mainline inclusion
from mainline-6.18
commit 2dc99ea ("riscv: cpufeature: avoid uninitialized variable in has_thead_homogeneous_vlenb()")
category: feature
Link: RVCK-Project#354

--------------------------------

In has_thead_homogeneous_vlenb(), smatch detected that the vlenb variable
could be used while uninitialized.  It appears that this could happen if
no CPUs described in DT have the "thead,vlenb" property.

Fix by initializing vlenb to 0, which will keep thead_vlenb_of set to 0
(as it was statically initialized).  This in turn will cause
riscv_v_setup_vsize() to fall back to CSR probing - the desired result if
thead,vlenb isn't provided in the DT data.

While here, fix a nearby comment typo.

Cc: stable@vger.kernel.org
Cc: Charlie Jenkins <charlie@rivosinc.com>
Fixes: 377be47 ("riscv: vector: Use vlenb from DT for thead")
Signed-off-by: Paul Walmsley <pjw@kernel.org>
Link: https://lore.kernel.org/r/22674afb-2fe8-2a83-1818-4c37bd554579@kernel.org
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
mainline inclusion
from mainline-6.18
commit 9f393d8 ("riscv: dts: allwinner: d1: fix vlenb property")
category: feature
Link: RVCK-Project#354

--------------------------------

According to [1], the C906 vector registers are 128 bits wide.
The 'thead,vlenb' property specifies the vector register length
in bytes, so its value must be set to 16.

[1] https://dl.linux-sunxi.org/D1/Xuantie_C906_R1S0_User_Manual.pdf

Fixes: ce1daee ("riscv: dts: allwinner: Add xtheadvector to the D1/D1s devicetree")
Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
Link: https://patch.msgid.link/20251119203508.1032716-1-geomatsi@gmail.com
Signed-off-by: Chen-Yu Tsai <wens@kernel.org>
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
mainline inclusion
from mainline-6.19
commit aef6dc0 ("riscv: dts: thead: add xtheadvector to the th1520 devicetree")
category: feature
Link: RVCK-Project#354

--------------------------------

The th1520 support xtheadvector [1] so it can be included in the
devicetree. Also include vlenb for the cpu. And set vlenb=16 [2].

This can be tested by passing the "mitigations=off" kernel parameter.

Link: https://lore.kernel.org/linux-riscv/20241113-xtheadvector-v11-4-236c22791ef9@rivosinc.com/ [1]
Link: https://lore.kernel.org/linux-riscv/aCO44SAoS2kIP61r@ghost/ [2]

Signed-off-by: Han Gao <rabenda.cn@gmail.com>
Reviewed-by: Drew Fustini <fustini@kernel.org>
Signed-off-by: Drew Fustini <fustini@kernel.org>
[zhenxing.zhu@linux.alibaba.com: xtheadvector already in isa, only added thead,vlenb property]
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
mainline inclusion
from mainline-6.11
commit ac295b6 ("riscv: vector: adjust minimum Vector requirement to ZVE32X")
category: feature
Link: RVCK-Project#354

--------------------------------

Make has_vector() to check for ZVE32X. Every in-kernel usage of V that
requires a more complicate version of V must then call out explicitly.

Also, change riscv_v_first_use_handler(), and boot code that calls
riscv_v_setup_vsize() to accept ZVE32X.

Most kernel/user interfaces requires minimum of ZVE32X. Thus, programs
compiled and run with ZVE32X should be supported by the kernel on most
aspects. This includes context-switch, signal, ptrace, prctl, and
hwprobe.

One exception is that ELF_HWCAP returns 'V' only if full V is supported
on the platform. This means that the system without a full V must not
rely on ELF_HWCAP to tell whether it is allowable to execute Vector
without first invoking a prctl() check.

Signed-off-by: Andy Chiu <andy.chiu@sifive.com>
Acked-by: Joel Granados <j.granados@samsung.com>
Link: https://lore.kernel.org/r/20240510-zve-detection-v5-7-0711bdd26c12@sifive.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
[zhenxing.zhu@linux.alibaba.com: partial backport, vector.h/cpufeature.c/vector.c already applied via baseline, only sys_hwprobe.c and uaccess.S hunks added]
Signed-off-by: ZhenXing Zhu <zhenxing.zhu@linux.alibaba.com>
@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown

开始测试 log: https://github.com/RVCK-Project/rvck/actions/runs/30614654906

参数解析结果
args value
repository RVCK-Project/rvck
head ref pull/355/head
base ref rvck-6.6
LAVA repo RVCK-Project/lavaci
LAVA hardware ['qemu']
LAVA Testcase path lava-testcases/common-test/ltp/ltp.yaml
need run job kunit-test,kernel-build,check-patch,lava-trigger

测试完成

详细结果:
check result
kunit-test success
kernel-build success
check-patch failure
lava-trigger-qemu failure
lava-trigger-sg2042 skipped
lava-trigger-k1 skipped
lava-trigger-lpi4a skipped

Kunit Test Result

[08:59:26] Testing complete. Ran 482 tests: passed: 465, skipped: 17

Kernel Build Result

Check Patch Result

Total Errors 1
Total Warnings 22

LAVA Check (qemu)


lava 执行失败.

@zhuzhenxxx-collab

Copy link
Copy Markdown
Author

主线回合代码 checkpatch 格式校验失败。

patch-20260731080725/0014-riscv-vector-Support-xtheadvector-save-restore.patch

ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#341: FILE: arch/riscv/include/asm/vector.h:276:

  •   	".option pop\n\t": "=&r" (vl));
    

@sterling-teng

Copy link
Copy Markdown
Contributor

rvck-6.6已经rebase,请尽快rebase开发分支后push -f,该pr系th1520平台启动修复,会优先审阅合并。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TH1520 kernel crash when enabling vector (xtheadvector)