From: Andrew Jones <ajones@ventanamicro.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,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Alistair Francis" <alistair.francis@wdc.com>,
"Weiwei Li" <liwei1518@gmail.com>,
"Daniel Henrique Barboza" <dbarboza@ventanamicro.com>,
"Liu Zhiwei" <zhiwei_liu@linux.alibaba.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PATCH 7/8] target/riscv/kvm: rename riscv-aia to riscv-imsic
Date: Mon, 17 Feb 2025 15:07:45 +0100 [thread overview]
Message-ID: <20250217-9d3c0d38ed66b1a8257b4515@orel> (raw)
In-Reply-To: <20250217081730.9000-8-yongxuan.wang@sifive.com>
On Mon, Feb 17, 2025 at 04:17:27PM +0800, Yong-Xuan Wang wrote:
> The riscv-aia property only controls the in-kernel IMSIC mode, the
> emulation of AIA MSI mode is controlled by the kernel-irqchip property.
> Rename the riscv-aia property to riscv-imsic to prevent the confusion.
>
> Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
> ---
> target/riscv/kvm/kvm-cpu.c | 52 ++++++++++++++++++++------------------
> 1 file changed, 27 insertions(+), 25 deletions(-)
>
> diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c
> index c047d5f36951..ab53b76ab81f 100644
> --- a/target/riscv/kvm/kvm-cpu.c
> +++ b/target/riscv/kvm/kvm-cpu.c
> @@ -1798,9 +1798,9 @@ void kvm_riscv_set_irq(RISCVCPU *cpu, int irq, int level)
> }
> }
>
> -static int aia_mode;
> +static int imsic_mode;
>
> -static const char *kvm_aia_mode_str(uint64_t mode)
> +static const char *kvm_imsic_mode_str(uint64_t mode)
> {
> switch (mode) {
> case KVM_DEV_RISCV_AIA_MODE_EMUL:
> @@ -1813,19 +1813,19 @@ static const char *kvm_aia_mode_str(uint64_t mode)
> };
> }
>
> -static char *riscv_get_kvm_aia(Object *obj, Error **errp)
> +static char *riscv_get_kvm_imsic(Object *obj, Error **errp)
> {
> - return g_strdup(kvm_aia_mode_str(aia_mode));
> + return g_strdup(kvm_imsic_mode_str(imsic_mode));
> }
>
> -static void riscv_set_kvm_aia(Object *obj, const char *val, Error **errp)
> +static void riscv_set_kvm_imsic(Object *obj, const char *val, Error **errp)
> {
> if (!strcmp(val, "emul")) {
> - aia_mode = KVM_DEV_RISCV_AIA_MODE_EMUL;
> + imsic_mode = KVM_DEV_RISCV_AIA_MODE_EMUL;
> } else if (!strcmp(val, "hwaccel")) {
> - aia_mode = KVM_DEV_RISCV_AIA_MODE_HWACCEL;
> + imsic_mode = KVM_DEV_RISCV_AIA_MODE_HWACCEL;
> } else if (!strcmp(val, "auto")) {
> - aia_mode = KVM_DEV_RISCV_AIA_MODE_AUTO;
> + imsic_mode = KVM_DEV_RISCV_AIA_MODE_AUTO;
> } else {
> error_setg(errp, "Invalid KVM AIA mode");
> error_append_hint(errp, "Valid values are emul, hwaccel, and auto.\n");
> @@ -1834,13 +1834,15 @@ static void riscv_set_kvm_aia(Object *obj, const char *val, Error **errp)
>
> void kvm_arch_accel_class_init(ObjectClass *oc)
> {
> - object_class_property_add_str(oc, "riscv-aia", riscv_get_kvm_aia,
> - riscv_set_kvm_aia);
> - object_class_property_set_description(oc, "riscv-aia",
> - "Set KVM AIA mode. Valid values are 'emul', 'hwaccel' and 'auto'. "
> - "Changing KVM AIA modes relies on host support. Defaults to 'auto' "
> - "if the host supports it");
> - object_property_set_default_str(object_class_property_find(oc, "riscv-aia"),
> + object_class_property_add_str(oc, "riscv-imsic", riscv_get_kvm_imsic,
> + riscv_set_kvm_imsic);
> + object_class_property_set_description(oc, "riscv-imsic",
> + "Set KVM IMSIC mode. Valid values are 'emul', 'hwaccel' and 'auto'. "
> + "Changing KVM IMSIC modes relies on host support. Defaults to 'auto' "
> + "if the host supports it. This property only takes effect when the "
> + "kernel-irqchip=on|split when using AIA MSI.");
> + object_property_set_default_str(object_class_property_find(oc,
> + "riscv-imsic"),
> "auto");
We can't change property names without deprecating the old name (which
isn't likely worth it).
Thanks,
drew
> }
>
> @@ -1851,7 +1853,7 @@ void kvm_riscv_aia_create(MachineState *machine, uint64_t group_shift,
> {
> int ret, i;
> int aia_fd = -1;
> - uint64_t default_aia_mode;
> + uint64_t default_imsic_mode;
> uint64_t socket_count = riscv_socket_count(machine);
> uint64_t max_hart_per_socket = 0;
> uint64_t socket, base_hart, hart_count, socket_imsic_base, imsic_addr;
> @@ -1867,24 +1869,24 @@ void kvm_riscv_aia_create(MachineState *machine, uint64_t group_shift,
>
> ret = kvm_device_access(aia_fd, KVM_DEV_RISCV_AIA_GRP_CONFIG,
> KVM_DEV_RISCV_AIA_CONFIG_MODE,
> - &default_aia_mode, false, NULL);
> + &default_imsic_mode, false, NULL);
> if (ret < 0) {
> - error_report("KVM AIA: failed to get current KVM AIA mode");
> + error_report("KVM AIA: failed to get current KVM IMSIC mode");
> exit(1);
> }
>
> - if (default_aia_mode != aia_mode) {
> + if (default_imsic_mode != imsic_mode) {
> ret = kvm_device_access(aia_fd, KVM_DEV_RISCV_AIA_GRP_CONFIG,
> KVM_DEV_RISCV_AIA_CONFIG_MODE,
> - &aia_mode, true, NULL);
> + &imsic_mode, true, NULL);
> if (ret < 0) {
> - warn_report("KVM AIA: failed to set KVM AIA mode '%s', using "
> + warn_report("KVM AIA: failed to set KVM IMSIC mode '%s', using "
> "default host mode '%s'",
> - kvm_aia_mode_str(aia_mode),
> - kvm_aia_mode_str(default_aia_mode));
> + kvm_imsic_mode_str(imsic_mode),
> + kvm_imsic_mode_str(default_imsic_mode));
>
> - /* failed to change AIA mode, use default */
> - aia_mode = default_aia_mode;
> + /* failed to change IMSIC mode, use default */
> + imsic_mode = default_imsic_mode;
> }
> }
>
> --
> 2.17.1
>
next prev parent reply other threads:[~2025-02-17 14:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-17 8:17 [PATCH 0/8] riscv: AIA: kernel-irqchip=off support Yong-Xuan Wang
2025-02-17 8:17 ` [PATCH 1/8] target/riscv/kvm: rewrite get/set for KVM_REG_RISCV_CSR Yong-Xuan Wang
2025-02-17 8:17 ` [PATCH 2/8] target/riscv/kvm: add KVM_REG_RISCV_CSR_AIA Yong-Xuan Wang
2025-02-17 8:17 ` [PATCH 3/8] target/riscv/kvm: add KVM_REG_RISCV_CSR_SMSTATEEN Yong-Xuan Wang
2025-02-17 8:17 ` [PATCH 4/8] target/riscv: add helper to get CSR name Yong-Xuan Wang
2025-02-17 14:01 ` Andrew Jones
2025-02-24 7:56 ` Yong-Xuan Wang
2025-02-17 8:17 ` [PATCH 5/8] target/riscv/kvm: rewrite kvm_riscv_handle_csr Yong-Xuan Wang
2025-02-17 8:17 ` [PATCH 6/8] target/riscv/kvm: add CSR_SIREG and CSR_STOPEI emulation Yong-Xuan Wang
2025-02-17 8:17 ` [PATCH 7/8] target/riscv/kvm: rename riscv-aia to riscv-imsic Yong-Xuan Wang
2025-02-17 14:07 ` Andrew Jones [this message]
2025-02-19 11:26 ` Yong-Xuan Wang
2025-02-17 8:17 ` [PATCH 8/8] docs: update the description about RISC-V AIA Yong-Xuan Wang
2025-02-18 15:53 ` [PATCH 0/8] riscv: AIA: kernel-irqchip=off support Kashyap Chamarthy
2025-02-24 7:17 ` Yong-Xuan Wang
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=20250217-9d3c0d38ed66b1a8257b4515@orel \
--to=ajones@ventanamicro.com \
--cc=alistair.francis@wdc.com \
--cc=dbarboza@ventanamicro.com \
--cc=frank.chang@sifive.com \
--cc=greentime.hu@sifive.com \
--cc=jim.shu@sifive.com \
--cc=liwei1518@gmail.com \
--cc=palmer@dabbelt.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=vincent.chen@sifive.com \
--cc=yongxuan.wang@sifive.com \
--cc=zhiwei_liu@linux.alibaba.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).