Skip to content

vmm: fix riscv64 legacy serial MMIO setup#591

Open
yzewei wants to merge 1 commit intocontainers:mainfrom
yzewei:vmm-rv
Open

vmm: fix riscv64 legacy serial MMIO setup#591
yzewei wants to merge 1 commit intocontainers:mainfrom
yzewei:vmm-rv

Conversation

@yzewei
Copy link

@yzewei yzewei commented Mar 17, 2026

Background

In the RISCv64 boot path, the legacy serial initialization chain is not synchronized, causing cargo check -p vmm --target riscv64gc-unknown-linux-gnu to fail to compile.

  1. The attach_legacy_devices() method in builder.rs calls a non-existent serial_device.

  2. The KVM MMIO serial registration logic for RISCv64 calls a non-existent serial.set_intc(intc). The current RISCv64 legacy serial does not provide this interface; its interrupt triggering path depends on the registered IRQFD, rather than actively injecting interrupts through the interrupt controller held by the serial device as in Aarch64.

@yzewei
Copy link
Author

yzewei commented Mar 17, 2026

PTAL

Copy link
Collaborator

@dorindabassey dorindabassey left a comment

Choose a reason for hiding this comment

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

LGTM

@mz-pdm
Copy link
Collaborator

mz-pdm commented Mar 20, 2026

It would be nice to put the PR description to the commit message.

@yzewei
Copy link
Author

yzewei commented Mar 23, 2026

It would be nice to put the PR description to the commit message.

done. PLZ

Copy link
Collaborator

@mz-pdm mz-pdm left a comment

Choose a reason for hiding this comment

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

Thank you for adding the commit message. It would be even better if the markup, namely the backslashes and the double quote at the end, were removed, but other than that the change looks good to me.

Fix `cargo check` failures for the `riscv64gc-unknown-linux-gnu` target
caused by an unsynchronized legacy serial initialization chain.

Changes include:
- Correct `attach_legacy_devices()` in `builder.rs` which incorrectly
  referenced a non-existent `serial_device`.
- Remove invalid `serial.set_intc(intc)` call in KVM MMIO serial
  registration. Unlike Aarch64, the RISCv64 legacy serial does not
  support active interrupt injection via an internal interrupt controller.
  Instead, interrupt triggering relies on the registered IRQFD.

This aligns the RISCv64 boot path with the architecture's actual
interrupt handling capabilities.

Signed-off-by: Zewei Yang <yangzewei@loongson.cn>
@yzewei
Copy link
Author

yzewei commented Mar 24, 2026

Thank you for adding the commit message. It would be even better if the markup, namely the backslashes and the double quote at the end, were removed, but other than that the change looks good to me.

got it.

Copy link
Collaborator

@slp slp left a comment

Choose a reason for hiding this comment

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

NAK. RISCV does have its own IrqChip abstraction, KvmAia. The serial device implementation should be updated to install it via set_intc and make use of it for triggering interrupts.

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.

4 participants