From: Andrew Jones <ajones@ventanamicro.com>
To: Yong-Xuan Wang <yongxuan.wang@sifive.com>
Cc: qemu-devel@nongnu.org, qemu-riscv@nongnu.org,
rkanwal@rivosinc.com, anup@brainfault.org,
dbarboza@ventanamicro.com, atishp@atishpatra.org,
vincent.chen@sifive.com, greentime.hu@sifive.com,
frank.chang@sifive.com, jim.shu@sifive.com,
Palmer Dabbelt <palmer@dabbelt.com>,
Alistair Francis <alistair.francis@wdc.com>,
Bin Meng <bin.meng@windriver.com>,
Weiwei Li <liweiwei@iscas.ac.cn>,
Liu Zhiwei <zhiwei_liu@linux.alibaba.com>
Subject: Re: [PATCH v6 5/5] target/riscv: select KVM AIA in riscv virt machine
Date: Fri, 21 Jul 2023 20:06:56 +0200 [thread overview]
Message-ID: <20230721-4f5015dcef5454d421f033ea@orel> (raw)
In-Reply-To: <20230714084429.22349-6-yongxuan.wang@sifive.com>
On Fri, Jul 14, 2023 at 08:44:27AM +0000, Yong-Xuan Wang wrote:
...
> +#if defined(CONFIG_KVM)
> +static char *virt_get_kvm_aia(Object *obj, Error **errp)
> +{
> + RISCVVirtState *s = RISCV_VIRT_MACHINE(obj);
> +
> + return g_strdup(kvm_aia_mode_str(s->kvm_aia_mode));
> +}
> +
> +static void virt_set_kvm_aia(Object *obj, const char *val, Error **errp)
> +{
> + RISCVVirtState *s = RISCV_VIRT_MACHINE(obj);
> +
> + if (!strcmp(val, "emul")) {
> + s->kvm_aia_mode = KVM_DEV_RISCV_AIA_MODE_EMUL;
> + } else if (!strcmp(val, "hwaccel")) {
> + s->kvm_aia_mode = KVM_DEV_RISCV_AIA_MODE_HWACCEL;
> + } else if (!strcmp(val, "auto")) {
> + s->kvm_aia_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");
> + }
> +}
> +#endif
> +
> static bool virt_get_aclint(Object *obj, Error **errp)
> {
> RISCVVirtState *s = RISCV_VIRT_MACHINE(obj);
> @@ -1687,6 +1745,18 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
> sprintf(str, "Set number of guest MMIO pages for AIA IMSIC. Valid value "
> "should be between 0 and %d.", VIRT_IRQCHIP_MAX_GUESTS);
> object_class_property_set_description(oc, "aia-guests", str);
> +
> +#if defined(CONFIG_KVM)
> + object_class_property_add_str(oc, "kvm-aia", virt_get_kvm_aia,
> + virt_set_kvm_aia);
> + object_class_property_set_description(oc, "kvm-aia",
> + "Set KVM AIA mode. Valid values are "
> + "emul, hwaccel, and auto. Default "
> + "is auto.");
> + object_property_set_default_str(object_class_property_find(oc, "kvm-aia"),
> + "auto");
I'm starting to think the "kvm-aia" property should be renamed to
"riscv-aia" or just "aia" and added in
target/riscv/kvm.c:kvm_arch_accel_class_init() to be a riscv kvm
accelerator property instead of a virt machine property.
Thanks,
drew
> +
> +#endif
> object_class_property_add(oc, "acpi", "OnOffAuto",
> virt_get_acpi, virt_set_acpi,
> NULL, NULL);
> diff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h
> index e5c474b26e..d0140feeff 100644
> --- a/include/hw/riscv/virt.h
> +++ b/include/hw/riscv/virt.h
> @@ -56,6 +56,7 @@ struct RISCVVirtState {
> bool have_aclint;
> RISCVVirtAIAType aia_type;
> int aia_guests;
> + uint64_t kvm_aia_mode;
> char *oem_id;
> char *oem_table_id;
> OnOffAuto acpi;
> --
> 2.17.1
>
prev parent reply other threads:[~2023-07-21 18:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-14 8:44 [PATCH v6 0/5] Add RISC-V KVM AIA Support Yong-Xuan Wang
2023-07-14 8:44 ` [PATCH v6 1/5] target/riscv: support the AIA device emulation with KVM enabled Yong-Xuan Wang
2023-07-14 8:44 ` [PATCH v6 2/5] target/riscv: check the in-kernel irqchip support Yong-Xuan Wang
2023-07-14 8:44 ` [PATCH v6 3/5] target/riscv: Create an KVM AIA irqchip Yong-Xuan Wang
2023-07-21 17:41 ` Andrew Jones
2023-07-14 8:44 ` [PATCH v6 4/5] target/riscv: update APLIC and IMSIC to support KVM AIA Yong-Xuan Wang
2023-07-14 8:44 ` [PATCH v6 5/5] target/riscv: select KVM AIA in riscv virt machine Yong-Xuan Wang
2023-07-21 18:06 ` Andrew Jones [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=20230721-4f5015dcef5454d421f033ea@orel \
--to=ajones@ventanamicro.com \
--cc=alistair.francis@wdc.com \
--cc=anup@brainfault.org \
--cc=atishp@atishpatra.org \
--cc=bin.meng@windriver.com \
--cc=dbarboza@ventanamicro.com \
--cc=frank.chang@sifive.com \
--cc=greentime.hu@sifive.com \
--cc=jim.shu@sifive.com \
--cc=liweiwei@iscas.ac.cn \
--cc=palmer@dabbelt.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=rkanwal@rivosinc.com \
--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).