[PATCH v12 00/25] Linux RISC-V AIA Support

Björn Töpel bjorn at kernel.org
Mon Jan 29 23:16:40 PST 2024


Anup Patel <apatel at ventanamicro.com> writes:

> The RISC-V AIA specification is ratified as-per the RISC-V international
> process. The latest ratified AIA specifcation can be found at:
> https://github.com/riscv/riscv-aia/releases/download/1.0/riscv-interrupts-1.0.pdf
>
> At a high-level, the AIA specification adds three things:
> 1) AIA CSRs
>    - Improved local interrupt support
> 2) Incoming Message Signaled Interrupt Controller (IMSIC)
>    - Per-HART MSI controller
>    - Support MSI virtualization
>    - Support IPI along with virtualization
> 3) Advanced Platform-Level Interrupt Controller (APLIC)
>    - Wired interrupt controller
>    - In MSI-mode, converts wired interrupt into MSIs (i.e. MSI generator)
>    - In Direct-mode, injects external interrupts directly into HARTs
>
> For an overview of the AIA specification, refer the AIA virtualization
> talk at KVM Forum 2022:
> https://static.sched.com/hosted_files/kvmforum2022/a1/AIA_Virtualization_in_KVM_RISCV_final.pdf
> https://www.youtube.com/watch?v=r071dL8Z0yo
>
> To test this series, use QEMU v7.2 (or higher) and OpenSBI v1.2 (or higher).
>
> These patches can also be found in the riscv_aia_v12 branch at:
> https://github.com/avpatel/linux.git
>
> Changes since v11:
>  - Rebased on Linux-6.8-rc1
>  - Included kernel/irq related patches from "genirq, irqchip: Convert ARM
>    MSI handling to per device MSI domains" series by Thomas.
>    (PATCH7, PATCH8, PATCH9, PATCH14, PATCH16, PATCH17, PATCH18, PATCH19,
>     PATCH20, PATCH21, PATCH22, PATCH23, and PATCH32 of
>     https://lore.kernel.org/linux-arm-kernel/20221121135653.208611233@linutronix.de/)
>  - Updated APLIC MSI-mode driver to use the new WIRED_TO_MSI mechanism.
>  - Updated IMSIC driver to support per-device MSI domains for PCI and
>    platform devices.

Thanks for working on this, Anup! I'm still reviewing the patches.

I'm hitting a boot hang in text patching, with this series applied on
6.8-rc2. IPI issues?

I'm booting with U-boot UEFI.

kernel config:
https://gist.github.com/bjoto/bac563e6dcaab68dba1a5eaf675d51aa

QEMU 8.2.0/OpenSBI 1.4:
  | qemu-system-riscv64 \
  | 	-machine virt,acpi=off,aia=aplic-imsic \
  | 	-cpu rv64,v=true,vlen=256,elen=64,h=true,zbkb=on,zbkc=on,zbkx=on,zkr=on,zkt=on,svinval=on,svnapot=on,svpbmt=on \
  | 	-smp 4 \
  | 	-object rng-random,filename=/dev/urandom,id=rng0 \
  | 	-device virtio-rng-device,rng=rng0 \
  | 	-append "root=/dev/vda2 rw earlycon console=tty0 console=ttyS0 panic=-1 oops=panic sysctl.vm.panic_on_oom=1" \
  |     -m 4G \
  |     ...

Last lines from the kernel:
  | ...
  | goldfish_rtc 101000.rtc: registered as rtc0             
  | goldfish_rtc 101000.rtc: setting system clock to 2024-01-30T06:39:28 UTC (1706596768)              

Same kernel boots w/ "-machine virt,acpi=off" (AIA is *not* enabled).

Related or not, I got this splat (once) a ftrace kselftest:
  | # selftests: ftrace: ftracetest-ktap
  | Unable to handle kernel paging request at virtual address 5a5a5a5a5a5a5ac2
  | Oops [#1]
  | Modules linked in: drm fuse i2c_core drm_panel_orientation_quirks backlight dm_mod configfs ip_tables x_tables [last unloaded: trace_printk]
  | CPU: 2 PID: 19691 Comm: ls Tainted: G        W          6.8.0-rc2-kselftest_plain #1
  | Hardware name: riscv-virtio,qemu (DT)
  | epc : set_top_events_ownership+0x14/0x5c
  |  ra : eventfs_get_attr+0x2e/0x50
  | epc : ffffffff80533aa4 ra : ffffffff80533b1a sp : ff20000001cebc70
  |  gp : ffffffff8258b860 tp : ff6000008623e240 t0 : ffffffff80533a98
  |  t1 : ffffffff825b6b60 t2 : 0000000000000008 s0 : ff20000001cebc80
  |  s1 : ffffffff8233c000 a0 : ff6000009224e9b8 a1 : ff20000001cebd28
  |  a2 : ff20000001cebd98 a3 : 000000000000025e a4 : ffffffff80000000
  |  a5 : 5a5a5a5a5a5a5a5a a6 : 0000000000000000 a7 : 0000000000735049
  |  s2 : 000000000000025e s3 : ff20000001cebd98 s4 : ff6000009224e9b8
  |  s5 : ff20000001cebd28 s6 : ffffffffffffff9c s7 : ff6000008ac6a1c0
  |  s8 : 00007fff9f685d80 s9 : 0000000000000000 s10: 00007fffd4550ef0
  |  s11: 0000000000000000 t3 : 0000000000000001 t4 : 0000000000000016
  |  t5 : ffffffff818145be t6 : ff6000009233d77e
  | status: 0000000200000120 badaddr: 5a5a5a5a5a5a5ac2 cause: 000000000000000d
  | [<ffffffff80533aa4>] set_top_events_ownership+0x14/0x5c
  | Code: b297 ffad 82e7 d302 1141 e422 0800 3783 ff85 cb89 (57b8) 8b09 
  | ---[ end trace 0000000000000000 ]---

This might be unrelated, but the hang above is on every boot.


Björn



More information about the linux-arm-kernel mailing list