Incorrect AIA mtopi handling without an IMSIC
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- c
- Domain
- operating-systems
Research direction
Start by reproducing the failure in the local RVVM branch with AIA support enabled, IMSIC and APLIC/PLIC toggled off, and legacy CLINT IPI in use. Trace OpenSBI's handling of the unhandled local interrupt and the mtopi/stopi versus mtopei/stopei CSR distinction; done means this configuration no longer crashes while remaining consistent with the RISC-V AIA specification.
Written by the indexing model from the issue text.
Description
The RISC-V AIA specification introduces a couple of new CSRs, and mandates that mtopei & stopei CSRs are ONLY present whenever there is AIA implemented, and an RISC-V IMSIC present in the system, but other CSRs may exist even without an IMSIC:
OpenSBI apparently assumes that IMSIC must be present whenever mtopi CSR is available instead of mtopei... and crashes whenever the guest uses legacy CLINT for IPI.
[ 0.103777] smp: Bringing up secondary CPUs ...
sbi_trap_error: hart0: trap0: unhandled local interrupt (error -1006)
sbi_trap_error: hart0: trap0: mcause=0x8000000000000003 mtval=0x0000000000000000
sbi_trap_error: hart0: trap0: mepc=0xffffffff80b4d2f8 mstatus=0x0000000a00000920
sbi_trap_error: hart0: trap0: ra=0xffffffff80b4d2ec sp=0xffffffc600003de0
sbi_trap_error: hart0: trap0: gp=0xffffffff82321198 tp=0xffffffff82325cc0
sbi_trap_error: hart0: trap0: s0=0xffffffc600003e10 s1=0xffffffff8235d3c8
sbi_trap_error: hart0: trap0: a0=0x000000000210f673 a1=0xffffffffffffffff
sbi_trap_error: hart0: trap0: a2=0x0000000000000015 a3=0x0000000000f5b338
sbi_trap_error: hart0: trap0: a4=0x0000000000000004 a5=0x000000000c800000
sbi_trap_error: hart0: trap0: a6=0x000000000200eeed a7=0xffffffff82786b60
sbi_trap_error: hart0: trap0: s2=0x0000000000000004 s3=0xffffffff8235d3c8
sbi_trap_error: hart0: trap0: s4=0x0000000000000000 s5=0x0000000000000000
sbi_trap_error: hart0: trap0: s6=0xffffffd602d50500 s7=0xffffffff80e00128
sbi_trap_error: hart0: trap0: s8=0x0000000000000000 s9=0x0000000000000001
sbi_trap_error: hart0: trap0: s10=0x0000000000000000 s11=0x0000000000000000
sbi_trap_error: hart0: trap0: t0=0x0000000000000040 t1=0x0000000000000000
sbi_trap_error: hart0: trap0: t2=0xffffffffffffffff t3=0x0000000000000002
sbi_trap_error: hart0: trap0: t4=0x0000000000000402 t5=0xffffffd602d53a68
sbi_trap_error: hart0: trap0: t6=0xffffffd602d53a70
This happens on a local RVVM branch that introduces RISC-V AIA support, and IMSIC+APLIC/PLIC supposed to be toggled, but AIA support in the CPU remains (That is, mtopi and stopi are still available, but mtopei / stopei are not).
Judging by the spec, it should be legal, but OpenSBI crashes unless I workaround it (By making mtopi unavailable too), so I think it is worth reporting.
- Dominant language
- C
- Stars
- 1.6k
- Forks
- 734
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from riscv-software-src/opensbi
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
riscv-software-src/opensbi#425 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
riscv-software-src/opensbi#424 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
riscv-software-src/opensbi#439 ·
-
sbi_trap_redirect() does not clear SPELP when the interrupted context had no landing pad expectedOpen
Difficulty 3/5 1-2 days Newbie friendliness 67/100
riscv-software-src/opensbi#438 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
riscv-software-src/opensbi#436 · 3 comments ·
All issues in riscv-software-src/opensbi
Similar issues
-
area/docdb kind/failing-test priority/medium status/awaiting-triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
yugabyte/yugabyte-db#39462 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
libreswan/libreswan#3185 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
category:port-update
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days