Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Intrupt delegattion Not Masked in M-Mode as Expected #2693

Open
1 task done
riscv914 opened this issue Jan 8, 2025 · 0 comments
Open
1 task done

[BUG] Intrupt delegattion Not Masked in M-Mode as Expected #2693

riscv914 opened this issue Jan 8, 2025 · 0 comments
Labels
Type:Bug For bugs in the RTL, Documentation, Verification environment or Tool and Build system

Comments

@riscv914
Copy link

riscv914 commented Jan 8, 2025

Is there an existing CVA6 bug for this?

  • I have searched the existing bug issues

Bug Description

According to the RISC-V ISA, delegated interrupts should result in the interrupt being masked at the delegator privilege level. For example, if the Supervisor Timer Interrupt (STI) is delegated to S-mode by setting mideleg[5], STIs should not be taken when executing in M-mode. If mideleg[5] is cleared, STIs can be taken in any mode, and regardless of the current mode, control should transfer to M-mode.

However, when the STI interrupt is delegated to S-mode and the interrupt is triggered, the interrupt is not masked in M-mode as expected. It remains visible in M-mode even though it should be masked, and we can see the interrupt in the mip register.


Code for Reproducing the Bug:

int main() {
    asm volatile ("li t0, 0x20"); 
    asm volatile ("csrs mip, t0");  // Set STI interrupt in mip
    asm volatile ("csrr t0, mip");  // Read the mip register (Check mask)
    asm volatile ("csrr t0, sip");  // Read the sip register (shows delegation)
}

Expected Behavior:

When the STI interrupt is delegated to S-mode, and the interrupt is triggered, it should be masked in M-mode and should not be visible in the mip register while executing in M-mode. The interrupt should be visible in the sip register when executing in S-mode.


Observed Behavior:

The STI interrupt is still visible in M-mode, even though it should be masked due to the delegation to S-mode. This violates the expected behavior as defined by the RISC-V ISA for delegated interrupts.


CVA6 commit: 2155d0e
Build config : cv64a6_imafdch_sv39_wb

@riscv914 riscv914 added the Type:Bug For bugs in the RTL, Documentation, Verification environment or Tool and Build system label Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type:Bug For bugs in the RTL, Documentation, Verification environment or Tool and Build system
Projects
None yet
Development

No branches or pull requests

1 participant