Skip to content

Conversation

@jserv
Copy link
Collaborator

@jserv jserv commented Oct 22, 2025

This removes unnecessary interrupt update calls in mem_load() for non-interactive devices (PLIC, VirtIO-Net/Blk/RNG/Sound/FS, ACLINT MTIMER/MSWI/SSWI).

Rationale:

  • MMIO read operations mostly query state without changing interrupt status
  • Can safely defer interrupt updates to periodic batch processing (every 64 cycles)
  • UART is exception due to interactive nature (read clears in_ready flag)
  • MMIO write operations trigger device actions and must update interrupts immediately

Summary by cubic

Removed interrupt updates from the MMIO read path for non-interactive devices and deferred them to periodic batch processing to reduce unnecessary work. UART reads remain immediate due to clearing the in_ready flag.

  • Refactors
    • Removed per-read interrupt updates in mem_load for PLIC, VirtIO Net/Blk/RNG/Snd/FS, and ACLINT MTIMER/MSWI/SSWI.
    • Added periodic virtio-rng interrupt update in semu_step when InterruptStatus is set.
    • MMIO writes still update interrupts immediately.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

@shengwen-tw
Copy link
Collaborator

Hi @Mes0903,
Maybe we can apply the same logic for virtio-gpu / virtio-input to run all graphics applications in #34. This would help ensure there’s no impact on virtio-gpu / virtio-input.

@Cuda-Chen
Copy link
Collaborator

Hi @jserv ,

It may take some time but I will start to check whether this PR makes impact on virtio-snd.

For @shengwen-tw and @Mes0903 ,
You can start to check virtio-gpu / virtio-input in the same time and make the approve as I think these two components are the blocker.

@jserv jserv force-pushed the improve-mmio branch 2 times, most recently from 56366c6 to 0d5ce34 Compare October 27, 2025 18:09
This removes unnecessary interrupt update calls in mem_load() for
non-interactive devices (PLIC, VirtIO-Net/Blk/RNG/Sound/FS, ACLINT
MTIMER/MSWI/SSWI).

Rationale:
- MMIO read operations mostly query state without changing interrupt
  status
- Can safely defer interrupt updates to periodic batch processing (every
  64 cycles)
- UART is exception due to interactive nature (read clears in_ready
  flag)
- MMIO write operations trigger device actions and must update
  interrupts immediately
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants