From: Kashyap Chamarthy <kchamart@redhat.com>
To: Yong-Xuan Wang <yongxuan.wang@sifive.com>
Cc: qemu-devel@nongnu.org, qemu-riscv@nongnu.org,
greentime.hu@sifive.com, vincent.chen@sifive.com,
frank.chang@sifive.com, jim.shu@sifive.com
Subject: Re: [PATCH v2 0/8] riscv: AIA: kernel-irqchip=off support
Date: Tue, 4 Mar 2025 00:49:26 +0530 [thread overview]
Message-ID: <Z8YAvmO4OMEeyL3U@gezellig> (raw)
In-Reply-To: <20250224082417.31382-1-yongxuan.wang@sifive.com>
On Mon, Feb 24, 2025 at 04:24:07PM +0800, Yong-Xuan Wang wrote:
> This series introduces the user-space AIA MSI emulation when using KVM
> acceleration.
>
> After this series, RISC-V QEMU virt machine with KVM acceleration has
> 3 parameters to control the type of irqchip and its emulation method:
> - Machine prop "aia" controls the type of irqchip
> - none: use PLIC and emulated in user-space
> - aplic: use AIA wired and emulated in user-space
> - aplic-imsic: use AIA MSI, emulation mode is determined by
> "kernel-irqchip" and "riscv-aia". This can only be used
> when the host machine support the AIA extension.
> - Accel prop "kernel-irqchip", effective with AIA MSI
> - on: in-kernel APLIC and in-kernel IMSIC
> - off: user-space APLIC and user-space IMSIC
> - split: user-space APLIC and in-kernel IMSIC
> - Accel prop "riscv-aia", effective with in-kernel IMSIC
> - emul: use MRIF as in-kernel IMSIC
> - hw: use hardware guest IMSIC file as in-kernel IMSIC
> - auto: use the hardware guest IMSICs whenever available otherwise
> fallback to MRIF
[...]
> Yong-Xuan Wang (8):
> target/riscv/kvm: rewrite get/set for KVM_REG_RISCV_CSR
> target/riscv/kvm: add KVM_REG_RISCV_CSR_AIA
> target/riscv/kvm: add KVM_REG_RISCV_CSR_SMSTATEEN
> target/riscv: add helper to get CSR name
> target/riscv/kvm: rewrite kvm_riscv_handle_csr
> target/riscv/kvm: add CSR_SIREG and CSR_STOPEI emulation
> docs: update the description about RISC-V AIA
> hw/intc/imsic: prevent to use IMSIC when host doesn't support AIA
> extension
>
> docs/specs/riscv-aia.rst | 24 +++-
> docs/system/riscv/virt.rst | 10 +-
> hw/intc/riscv_imsic.c | 17 ++-
> target/riscv/cpu.h | 10 +-
> target/riscv/csr.c | 30 ++---
> target/riscv/kvm/kvm-cpu.c | 235 +++++++++++++++++++++++++++++++------
> 6 files changed, 254 insertions(+), 72 deletions(-)
I don't pretend to grok all the details here, and I couldn't test the
KVM-acceleration path ("-accel kvm,kernel-irqchip=split"), as I don't
yet have hardware to test. I was able to test the TCG part:
I'm at:
$> git describe
v9.2.0-1976-g68d58113df
My QEMU command-line is here[1]. I tried out these two variataions:
... -machine virt,accel=tcg,aia=aplic,kernel-irqchip=split ...
... -machine virt,accel=tcg,aia=aplic-imsic,kernel-irqchip=split ...
And booted a Fedora-41 RISC-V host-generic guest image from here:
https://dl.fedoraproject.org/pub/alt/risc-v/release/41/Server/riscv64/images/
As near as I see, nothing exploded :)
I see that:
- From the docs: “aia=aplic” selects APLIC (advanced platform level
interrupt controller) to handle wired interrupts whereas the
“aia=aplic-imsic” selects APLIC and IMSIC (incoming message signaled
interrupt controller) to handle both wired interrupts and MSIs
- There's no user-visible change here, but only a developer-visible
change: in terms of what's being emulated in userspace vs. in-kernel
irqchip.)
So, if it's still not too late:
Tested-by: Kashyap Chamarthy <kchamart@redhat.com>
* * *
[1] QEMU command-line:
------------------------------------------------------------------------
$ ./qemu-system-riscv64
-display none
-cpu max
-no-user-config
-nodefaults
-serial stdio
-smp 4,sockets=4,cores=1,threads=1
-machine virt,accel=tcg,aia=aplic,kernel-irqchip=split
-blockdev node-name=node-Base1,driver=raw,file.driver=file,file.filename=./base1.raw,file.node-name=node-Base1-file
-device virtio-blk,drive=node-Base1,id=virtio0
-device virtio-net-device,netdev=net \
-netdev user,id=net,hostfwd=tcp::2222-:22 \
-blockdev '{"driver":"file","filename":"/usr/share/edk2/riscv/RISCV_VIRT_CODE.qcow2","node-name":"pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"pflash0-format","read-only":true,"driver":"qcow2","file":"pflash0-storage"}' \
-blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/base1_VARS.qcow2","node-name":"pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
-blockdev '{"node-name":"pflash1-format","read-only":false,"driver":"qcow2","file":"pflash1-storage"}' \
-machine virt,usb=off,dump-guest-core=off,memory-backend=riscv_virt_board.ram,pflash0=pflash0-format,pflash1=pflash1-format,acpi=off \
-m size=4194304k \
-object '{"qom-type":"memory-backend-ram","id":"riscv_virt_board.ram","size":4294967296}' \
-object rng-random,filename=/dev/urandom,id=rng \
-device virtio-rng-device,rng=rng
------------------------------------------------------------------------
--
/kashyap
prev parent reply other threads:[~2025-03-03 19:21 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-24 8:24 [PATCH v2 0/8] riscv: AIA: kernel-irqchip=off support Yong-Xuan Wang
2025-02-24 8:24 ` [PATCH v2 1/8] target/riscv/kvm: rewrite get/set for KVM_REG_RISCV_CSR Yong-Xuan Wang
2025-02-28 13:10 ` Andrew Jones
2025-02-24 8:24 ` [PATCH v2 2/8] target/riscv/kvm: add KVM_REG_RISCV_CSR_AIA Yong-Xuan Wang
2025-02-28 13:18 ` Andrew Jones
2025-02-24 8:24 ` [PATCH v2 3/8] target/riscv/kvm: add KVM_REG_RISCV_CSR_SMSTATEEN Yong-Xuan Wang
2025-02-28 13:21 ` Andrew Jones
2025-02-24 8:24 ` [PATCH v2 4/8] target/riscv: add helper to get CSR name Yong-Xuan Wang
2025-02-28 13:23 ` Andrew Jones
2025-02-24 8:24 ` [PATCH v2 5/8] target/riscv/kvm: rewrite kvm_riscv_handle_csr Yong-Xuan Wang
2025-03-04 15:45 ` Andrew Jones
2025-02-24 8:24 ` [PATCH v2 6/8] target/riscv/kvm: add CSR_SIREG and CSR_STOPEI emulation Yong-Xuan Wang
2025-03-04 15:52 ` Andrew Jones
2025-02-24 8:24 ` [PATCH v2 7/8] docs: update the description about RISC-V AIA Yong-Xuan Wang
2025-02-28 13:33 ` Andrew Jones
2025-02-24 8:24 ` [PATCH v2 8/8] hw/intc/imsic: prevent to use IMSIC when host doesn't support AIA extension Yong-Xuan Wang
2025-02-28 13:36 ` Andrew Jones
2025-03-03 19:19 ` Kashyap Chamarthy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z8YAvmO4OMEeyL3U@gezellig \
--to=kchamart@redhat.com \
--cc=frank.chang@sifive.com \
--cc=greentime.hu@sifive.com \
--cc=jim.shu@sifive.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=vincent.chen@sifive.com \
--cc=yongxuan.wang@sifive.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).