Skip to content

[Bug] [RISC-V] PLIC completion before ISR dispatch in non-DM mode #12010

Closed

Description

@boa-z

RT-Thread Version

master 5.4.0

Affected area

Architecture / libcpu

Hardware/BSP vendor

Not applicable / Other

Architecture

RISC-V

Board and hardware details

Not applicable / Other

Develop Toolchain

GCC

Describe the bug

In the new RISC-V common port, the non-DM PLIC handler completes the interrupt before dispatching it to the device ISR:

static rt_bool_t handler_plic_irq(int hwirq, void *data)
{
    plic_irq_ack_or_eoi(rt_hw_cpu_id(), hwirq);

    return handler_irq(hwirq, data);
}

For level-triggered interrupts, this may cause the same IRQ to be dispatched again before the device handler clears the interrupt source.

According to the RISC-V PLIC specification, completion normally follows interrupt servicing.

The DM path already handles level-triggered interrupts in this order, with plic_irq_eoi() called after rt_pic_handle_isr().

Would it make sense to adjust the completion order in the non-DM path as well? I noticed that the DM path handles edge-triggered interrupts differently, so I'd appreciate some guidance on the intended behavior here.

Other additional context

Activity

  1. added
    bugThis PR/issue is a bug in the current code.
    on Nov 9, 2026
  2. github-actions commented on Nov 9, 2026

    @github-actions

    如需认领并处理此 Issue,请评论 /claim。

    To claim and work on this issue, comment /claim.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Arch: RISC-VBSP related with risc-vbugThis PR/issue is a bug in the current code.libcpu

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions