Skip to content

Add regression test BSP, build scripts, and CI for RV32/RV64#526

Open
akifejaz wants to merge 5 commits into
eclipse-threadx:devfrom
akifejaz:dev
Open

Add regression test BSP, build scripts, and CI for RV32/RV64#526
akifejaz wants to merge 5 commits into
eclipse-threadx:devfrom
akifejaz:dev

Conversation

@akifejaz
Copy link
Copy Markdown
Contributor

Adds QEMU-virt BSP and regression test infrastructure for RISC-V 32/64-bit ports.

  • QEMU-virt board support package (CLINT timer, PLIC, UART, trap handler, linker script)
  • Build/test scripts (run.sh, build_tx_riscv.sh, test_tx_riscv.sh) running 5 configs × 2 architectures (950 tests)
  • CI integration via regression_test.yml using xPack toolchain + QEMU
  • Fix 64-bit portability issues in regression tests: block/byte pool sizes, byte pool search pointer offset, timing tolerance, -Wconversion in trace code

All regression tests passes for RV32/RV64, please see the pipeline status here

Signed-off-by: Akif Ejaz <akif.ejaz@10xengineers.ai>
Signed-off-by: Akif Ejaz <akifejaz40@gmail.com>
Signed-off-by: Akif Ejaz <akifejaz40@gmail.com>
@akifejaz akifejaz marked this pull request as ready for review April 28, 2026 12:18
@fdesbiens fdesbiens self-assigned this Apr 28, 2026
@fdesbiens fdesbiens moved this to In review in ThreadX Roadmap Apr 28, 2026
@fdesbiens fdesbiens self-requested a review May 11, 2026 14:58
int plic_irq_intr(void)
{
int ret = -1;
int irqno = plic_claim();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plic_claim() can return any value 0–1023, but callbacks[] only has MAX_CALLBACK_NUM=128 entries. There is no bounds check before callbacks[irqno] is accessed.

 // Fix: add bounds check at top of plic_irq_intr()
 int irqno = plic_claim();
 if (irqno <= 0 || irqno >= MAX_CALLBACK_NUM) {
     plic_complete(irqno);
     return 0;  // spurious or out-of-range, not an error
 }

Note: checking irqno == 0 also handles the PLIC spurious-interrupt case (irqno=0 means "no interrupt").


irq_callback callbacks[MAX_CALLBACK_NUM];

void plic_irq_enable(int irqno)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(1 << irqno) is UB when irqno >= 32 (int overflow). The PLIC enable registers are also word-arrays, so only IRQs 0–31 are correctly addressable.

Fix: use (1U << (irqno % 32)) with the correct word offset, or add a guard that asserts/returns if irqno >= 32.

@fdesbiens
Copy link
Copy Markdown
Contributor

@akifejaz I reviewed the PR and everything looks good. Please add the two small comments above on the PLIC, and we should be good to go!

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

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

2 participants