[0/7] remoteproc/mailbox: add Allwinner A523/A527/T527 E907 RISC-V support

Message ID 20260922034711.190253-1-tcmichals@gmail.com (mailing list archive)
Headers
Series remoteproc/mailbox: add Allwinner A523/A527/T527 E907 RISC-V support |

Message

Tim Michals Sept. 22, 2026, 3:47 a.m. UTC
This patch series introduces mainline Linux support for the Alibaba T-Head
XuanTie E907 (RV32IMAFDC @ 200 MHz) RISC-V auxiliary co-processor and the
4-port hardware Message Box IP integrated into Allwinner A523, A527, and
T527 (sun55i) SoCs.

The series adds the standalone 4-port hardware Message Box driver with
KUnit tests, the XuanTie RemoteProc driver with da_to_va KUnit tests, the
associated Devicetree binding schemas, and DTS node enablement.

Background & Hardware Architecture
==================================
Allwinner sun55i SoCs integrate an octa-core ARM Cortex-A55 cluster
alongside an auxiliary XuanTie E907 RISC-V co-processor. The co-processor
boots from on-chip dedicated SRAM Space 0 (Host PA 0x07280000 / Core DA
0x3FFC0000, 256 KB), can access secondary switchable SRAM Space 1 (Host
PA 0x072C0000 / Core DA 0x40000000, 256 KB), and interacts with external
DDR DRAM across the SoC's internal AXI bus.

Inter-processor communication (IPC) is coordinated via a 4-port hardware
Message Box controller (CPUX_MSGBOX at 0x03003000). The mailbox acts as a
star crossbar connecting four processors on the silicon die:
  - Port 0: ARM Cortex-A55 host cluster
  - Port 1: Cadence Tensilica HiFi4 Audio DSP
  - Port 2: Power Management Unit (CPUS)
  - Port 3: XuanTie E907 RISC-V co-processor

The Cortex-A55 exposes 12 logical channels (4 per remote processor), where
Channels 8..11 route directly to the XuanTie E907.

Hardware Validation & Silicon Evidence
======================================
This driver series has been extensively validated on physical silicon using
the Radxa Cubie A5E development board (Allwinner A527 / T527) running
mainline Linux PREEMPT_RT:

1. In-Kernel KUnit Tests:
   - sun55i_msgbox_test: Register mapping, channel routing, and interrupt
     mask bit manipulation across all 4 ports.
   - sunxi_rproc_test: Comprehensive da_to_va address translation across
     SRAM Space 0 (Host PA & Core DA), SRAM Space 1, DDR DRAM carveouts,
     and trace memory regions.

2. Target Automated Test Suite:
   - testBasic.elf: Core reset de-assertion, SRAM boot, MISA CSR
     verification (0x40901125), and heartbeat logging via debugfs trace0.
   - testStringBinaryTrace0.elf: Sustained trace0 ring-buffer streaming,
     hardware single-precision FPU math (sine wave calculation), and
     packed binary telemetry parsing.
   - testCrash.elf: Machine-mode exception trap (mtvec) verification,
     capturing full register autopsy (mepc, mcause=0x2, 31 GPRs) upon
     intentional illegal instruction while the host remains stable.
   - testPingRpmsg.elf: Full Linux VirtIO RPMsg framework validation
     over dynamic DDR CMA buffers. Tested 1,000 round-trip ping-pong
     packets with 100% success rate, measuring ~175 us average RTT
     latency and 5.37 MB/s bandwidth at 512-byte VirtIO buffer size.

PREEMPT_RT Real-Time Compliance
===============================
When the E907 announces a new RPMsg channel via Name Service announcement,
the kernel's rpmsg_char/virtio_rpmsg_bus layers acquire sleeping mutexes
(device_register, blocking_notifier_call_chain). Calling these from
hard-IRQ context triggers "scheduling while atomic" warnings on PREEMPT_RT
kernels. In sunxi_rproc.c, the mailbox callback defers the VirtIO vring
interrupt handler via schedule_work(&priv->vq_work), ensuring 100% clean
operation on PREEMPT_RT kernels.

Design Decisions for Maintainer Review
======================================
1. Standalone drivers/mailbox/sun55i-msgbox.c vs sun6i-msgbox.c:
   The existing sun6i-msgbox.c driver is architected around a legacy
   2-core point-to-point mailbox with flat global registers. The sun55i
   hardware is a 4-processor crossbar where registers are banked per
   processor in independent 0x100-byte apertures with hardware routing
   tables and 8-entry FIFOs. A clean standalone controller driver
   was implemented to avoid extensive conditional branches across every
   function.

2. Devicetree YAML Schemas:
   Both allwinner,sun55i-a523-msgbox.yaml and allwinner,sun55i-rproc.yaml
   have been created and pass dt_binding_check and checkpatch.pl cleanly.

Acknowledgements & References
=============================
Thanks to the Linux-sunxi community and YuzukiHD for SyterKit and
FreeRTOS-HIFI4-DSP as independent references to cross-check register
offsets, SRAM mappings, and clock/reset sequencing on the T527 and A733.


Tim Michals (7):
  dt-bindings: mailbox: add Allwinner sun55i msgbox schema
  mailbox: sun55i: add Allwinner sun55i/sun60i 4-port Message Box driver
  mailbox: sun55i: add KUnit tests for routing and registers
  dt-bindings: remoteproc: add allwinner sun55i rproc binding
  remoteproc: sunxi: add allwinner riscv remoteproc driver
  remoteproc: sunxi: add KUnit tests for da_to_va address translation
  arm64: dts: allwinner: add a523 msgbox and remoteproc nodes

 .../mailbox/allwinner,sun55i-a523-msgbox.yaml |  93 ++
 .../remoteproc/allwinner,sun55i-rproc.yaml    | 152 +++
 .../arm64/boot/dts/allwinner/sun55i-a523.dtsi |  39 +
 drivers/mailbox/Kconfig                       |  20 +
 drivers/mailbox/Makefile                      |   3 +
 drivers/mailbox/sun55i-msgbox.c               | 337 +++++++
 drivers/mailbox/sun55i_msgbox_test.c          | 296 ++++++
 drivers/remoteproc/Kconfig                    |  19 +
 drivers/remoteproc/Makefile                   |   2 +
 drivers/remoteproc/sunxi_rproc.c              | 905 ++++++++++++++++++
 drivers/remoteproc/sunxi_rproc_test.c         | 442 +++++++++
 11 files changed, 2308 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/allwinner,sun55i-a523-msgbox.yaml
 create mode 100644 Documentation/devicetree/bindings/remoteproc/allwinner,sun55i-rproc.yaml
 create mode 100644 drivers/mailbox/sun55i-msgbox.c
 create mode 100644 drivers/mailbox/sun55i_msgbox_test.c
 create mode 100644 drivers/remoteproc/sunxi_rproc.c
 create mode 100644 drivers/remoteproc/sunxi_rproc_test.c
  

Comments

Chen-Yu Tsai Sept. 22, 2026, 6:34 a.m. UTC | #1
Hi,

On Tue, Sep 22, 2026 at 11:47 AM Tim Michals <tcmichals@gmail.com> wrote:
>
> This patch series introduces mainline Linux support for the Alibaba T-Head
> XuanTie E907 (RV32IMAFDC @ 200 MHz) RISC-V auxiliary co-processor and the
> 4-port hardware Message Box IP integrated into Allwinner A523, A527, and
> T527 (sun55i) SoCs.
>
> The series adds the standalone 4-port hardware Message Box driver with
> KUnit tests, the XuanTie RemoteProc driver with da_to_va KUnit tests, the
> associated Devicetree binding schemas, and DTS node enablement.
>
> Background & Hardware Architecture
> ==================================
> Allwinner sun55i SoCs integrate an octa-core ARM Cortex-A55 cluster
> alongside an auxiliary XuanTie E907 RISC-V co-processor. The co-processor
> boots from on-chip dedicated SRAM Space 0 (Host PA 0x07280000 / Core DA
> 0x3FFC0000, 256 KB), can access secondary switchable SRAM Space 1 (Host
> PA 0x072C0000 / Core DA 0x40000000, 256 KB), and interacts with external
> DDR DRAM across the SoC's internal AXI bus.
>
> Inter-processor communication (IPC) is coordinated via a 4-port hardware
> Message Box controller (CPUX_MSGBOX at 0x03003000). The mailbox acts as a
> star crossbar connecting four processors on the silicon die:
>   - Port 0: ARM Cortex-A55 host cluster
>   - Port 1: Cadence Tensilica HiFi4 Audio DSP
>   - Port 2: Power Management Unit (CPUS)
>   - Port 3: XuanTie E907 RISC-V co-processor
>
> The Cortex-A55 exposes 12 logical channels (4 per remote processor), where
> Channels 8..11 route directly to the XuanTie E907.
>
> Hardware Validation & Silicon Evidence
> ======================================
> This driver series has been extensively validated on physical silicon using
> the Radxa Cubie A5E development board (Allwinner A527 / T527) running
> mainline Linux PREEMPT_RT:
>
> 1. In-Kernel KUnit Tests:
>    - sun55i_msgbox_test: Register mapping, channel routing, and interrupt
>      mask bit manipulation across all 4 ports.
>    - sunxi_rproc_test: Comprehensive da_to_va address translation across
>      SRAM Space 0 (Host PA & Core DA), SRAM Space 1, DDR DRAM carveouts,
>      and trace memory regions.
>
> 2. Target Automated Test Suite:
>    - testBasic.elf: Core reset de-assertion, SRAM boot, MISA CSR
>      verification (0x40901125), and heartbeat logging via debugfs trace0.
>    - testStringBinaryTrace0.elf: Sustained trace0 ring-buffer streaming,
>      hardware single-precision FPU math (sine wave calculation), and
>      packed binary telemetry parsing.
>    - testCrash.elf: Machine-mode exception trap (mtvec) verification,
>      capturing full register autopsy (mepc, mcause=0x2, 31 GPRs) upon
>      intentional illegal instruction while the host remains stable.
>    - testPingRpmsg.elf: Full Linux VirtIO RPMsg framework validation
>      over dynamic DDR CMA buffers. Tested 1,000 round-trip ping-pong
>      packets with 100% success rate, measuring ~175 us average RTT
>      latency and 5.37 MB/s bandwidth at 512-byte VirtIO buffer size.
>
> PREEMPT_RT Real-Time Compliance
> ===============================
> When the E907 announces a new RPMsg channel via Name Service announcement,
> the kernel's rpmsg_char/virtio_rpmsg_bus layers acquire sleeping mutexes
> (device_register, blocking_notifier_call_chain). Calling these from
> hard-IRQ context triggers "scheduling while atomic" warnings on PREEMPT_RT
> kernels. In sunxi_rproc.c, the mailbox callback defers the VirtIO vring
> interrupt handler via schedule_work(&priv->vq_work), ensuring 100% clean
> operation on PREEMPT_RT kernels.
>
> Design Decisions for Maintainer Review
> ======================================
> 1. Standalone drivers/mailbox/sun55i-msgbox.c vs sun6i-msgbox.c:
>    The existing sun6i-msgbox.c driver is architected around a legacy
>    2-core point-to-point mailbox with flat global registers. The sun55i
>    hardware is a 4-processor crossbar where registers are banked per
>    processor in independent 0x100-byte apertures with hardware routing
>    tables and 8-entry FIFOs. A clean standalone controller driver
>    was implemented to avoid extensive conditional branches across every
>    function.
>
> 2. Devicetree YAML Schemas:
>    Both allwinner,sun55i-a523-msgbox.yaml and allwinner,sun55i-rproc.yaml
>    have been created and pass dt_binding_check and checkpatch.pl cleanly.
>
> Acknowledgements & References
> =============================
> Thanks to the Linux-sunxi community and YuzukiHD for SyterKit and
> FreeRTOS-HIFI4-DSP as independent references to cross-check register
> offsets, SRAM mappings, and clock/reset sequencing on the T527 and A733.
>
>
> Tim Michals (7):
>   dt-bindings: mailbox: add Allwinner sun55i msgbox schema
>   mailbox: sun55i: add Allwinner sun55i/sun60i 4-port Message Box driver
>   mailbox: sun55i: add KUnit tests for routing and registers
>   dt-bindings: remoteproc: add allwinner sun55i rproc binding
>   remoteproc: sunxi: add allwinner riscv remoteproc driver
>   remoteproc: sunxi: add KUnit tests for da_to_va address translation
>   arm64: dts: allwinner: add a523 msgbox and remoteproc nodes

There are many review comments from Sashiko, even a critical one.
Please go through them.

Also, please use just one compatible string for the SoC family, unless
you have knowledge of some differences. They are the same die and the
IP cores should be identical.

Last, please send the full series to all parties involved. Do not send
different patches to different people. Everyone should get the same
stuff so we all have the full picture. Unless you split the series in
two, one for the mailbox and one for the remoteproc.


Thanks
ChenYu


>  .../mailbox/allwinner,sun55i-a523-msgbox.yaml |  93 ++
>  .../remoteproc/allwinner,sun55i-rproc.yaml    | 152 +++
>  .../arm64/boot/dts/allwinner/sun55i-a523.dtsi |  39 +
>  drivers/mailbox/Kconfig                       |  20 +
>  drivers/mailbox/Makefile                      |   3 +
>  drivers/mailbox/sun55i-msgbox.c               | 337 +++++++
>  drivers/mailbox/sun55i_msgbox_test.c          | 296 ++++++
>  drivers/remoteproc/Kconfig                    |  19 +
>  drivers/remoteproc/Makefile                   |   2 +
>  drivers/remoteproc/sunxi_rproc.c              | 905 ++++++++++++++++++
>  drivers/remoteproc/sunxi_rproc_test.c         | 442 +++++++++
>  11 files changed, 2308 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mailbox/allwinner,sun55i-a523-msgbox.yaml
>  create mode 100644 Documentation/devicetree/bindings/remoteproc/allwinner,sun55i-rproc.yaml
>  create mode 100644 drivers/mailbox/sun55i-msgbox.c
>  create mode 100644 drivers/mailbox/sun55i_msgbox_test.c
>  create mode 100644 drivers/remoteproc/sunxi_rproc.c
>  create mode 100644 drivers/remoteproc/sunxi_rproc_test.c
>
> --
> 2.53.0
>