rcore-os / virtio-drivers

VirtIO guest drivers in Rust.
MIT License
209 stars 63 forks source link

how to configure interrupt for virtio-blk / virtio-console on riscv-qemu? #130

Closed fslongjin closed 5 months ago

fslongjin commented 5 months ago

Hello, I have a question. I'm trying to configure the virtio console driver on riscv qemu. I found that the fdt has an interrupt number, but I'm not sure how to enable the interrupt of this device in the virtio drivers library. Could you please ask me how to do it?

qwandor commented 5 months ago

As far as I understand from the VirtIO specification you shouldn't need to do anything special on the VirtIO side. Used buffer notifications should be enabled by default, and you call VirtIOConsole::ack_interrupt when you get the interrupt. I don't know much about RISC-V or whatever qemu emulated system you're using, you'll presumably need to configure your interrupt controller appropriately, but that should be the same as any other interrupt.