From: gaosong <gaosong@loongson.cn>
To: Bibo Mao <maobibo@loongson.cn>, Peter Xu <peterx@redhat.com>,
Fabiano Rosas <farosas@suse.de>, Thomas Huth <thuth@redhat.com>,
Laurent Vivier <lvivier@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH 3/5] hw/loongarch: Add compat machine for 9.0
Date: Mon, 4 Mar 2024 16:40:50 +0800 [thread overview]
Message-ID: <e34ca6da-d0d9-abf5-07fa-182783fb63f6@loongson.cn> (raw)
In-Reply-To: <20240220124126.1164081-4-maobibo@loongson.cn>
在 2024/2/20 20:41, Bibo Mao 写道:
> Since migration test case requires compat machine type support,
> compat machine is added for qemu 9.0 here.
>
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> ---
> hw/loongarch/virt.c | 60 +++++++++++++++++++++++++++++++++++----------
> 1 file changed, 47 insertions(+), 13 deletions(-)
>
Reviewed-by: Song Gao <gaosong@loongson.cn>
Thanks.
Song Gao
> diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
> index d0827aafab..a7d700497d 100644
> --- a/hw/loongarch/virt.c
> +++ b/hw/loongarch/virt.c
> @@ -46,6 +46,32 @@
> #include "hw/block/flash.h"
> #include "qemu/error-report.h"
>
> +#define DEFINE_VIRT_MACHINE_LATEST(major, minor, latest) \
> + static void virt_##major##_##minor##_class_init(ObjectClass *oc, \
> + void *data) \
> + { \
> + MachineClass *mc = MACHINE_CLASS(oc); \
> + virt_machine_##major##_##minor##_options(mc); \
> + mc->desc = "QEMU " # major "." # minor " ARM Virtual Machine"; \
> + if (latest) { \
> + mc->alias = "virt"; \
> + } \
> + } \
> + static const TypeInfo machvirt_##major##_##minor##_info = { \
> + .name = MACHINE_TYPE_NAME("virt-" # major "." # minor), \
> + .parent = TYPE_VIRT_MACHINE, \
> + .class_init = virt_##major##_##minor##_class_init, \
> + }; \
> + static void machvirt_machine_##major##_##minor##_init(void) \
> + { \
> + type_register_static(&machvirt_##major##_##minor##_info); \
> + } \
> + type_init(machvirt_machine_##major##_##minor##_init);
> +
> +#define DEFINE_VIRT_MACHINE_AS_LATEST(major, minor) \
> + DEFINE_VIRT_MACHINE_LATEST(major, minor, true)
> +#define DEFINE_VIRT_MACHINE(major, minor) \
> + DEFINE_VIRT_MACHINE_LATEST(major, minor, false)
>
> struct loaderparams {
> uint64_t ram_size;
> @@ -1151,18 +1177,26 @@ static void virt_class_init(ObjectClass *oc, void *data)
> #endif
> }
>
> -static const TypeInfo virt_machine_types[] = {
> - {
> - .name = TYPE_VIRT_MACHINE,
> - .parent = TYPE_MACHINE,
> - .instance_size = sizeof(VirtMachineState),
> - .class_init = virt_class_init,
> - .instance_init = virt_machine_initfn,
> - .interfaces = (InterfaceInfo[]) {
> - { TYPE_HOTPLUG_HANDLER },
> - { }
> - },
> - }
> +static const TypeInfo virt_machine_info = {
> + .name = TYPE_VIRT_MACHINE,
> + .parent = TYPE_MACHINE,
> + .abstract = true,
> + .instance_size = sizeof(VirtMachineState),
> + .class_init = virt_class_init,
> + .instance_init = virt_machine_initfn,
> + .interfaces = (InterfaceInfo[]) {
> + { TYPE_HOTPLUG_HANDLER },
> + { }
> + },
> };
>
> -DEFINE_TYPES(virt_machine_types)
> +static void machvirt_machine_init(void)
> +{
> + type_register_static(&virt_machine_info);
> +}
> +type_init(machvirt_machine_init);
> +
> +static void virt_machine_9_0_options(MachineClass *mc)
> +{
> +}
> +DEFINE_VIRT_MACHINE_AS_LATEST(9, 0)
>
next prev parent reply other threads:[~2024-03-04 8:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-20 12:41 [PATCH 0/5] Add migration test for loongarch64 Bibo Mao
2024-02-20 12:41 ` [PATCH 1/5] hw/loongarch: Rename LOONGARCH_MACHINE with VIRT_MACHINE Bibo Mao
2024-02-20 12:41 ` [PATCH 2/5] hw/loongarch: Rename LoongArchMachineState with VirtMachineState Bibo Mao
2024-02-20 12:41 ` [PATCH 3/5] hw/loongarch: Add compat machine for 9.0 Bibo Mao
2024-03-04 8:40 ` gaosong [this message]
2024-02-20 12:41 ` [PATCH 4/5] hw/loongarch: Set minimium memory size as 256M Bibo Mao
2024-02-20 16:47 ` Thomas Huth
2024-02-21 1:52 ` maobibo
2024-02-20 12:41 ` [PATCH 5/5] tests: Add migration test for loongarch64 Bibo Mao
2024-02-20 16:49 ` Thomas Huth
2024-02-21 3:01 ` Peter Xu
[not found] ` <2c298d69-f7d2-829f-c700-e6d6e1f86080@loongson.cn>
2024-02-21 4:14 ` Peter Xu
2024-02-21 21:24 ` Fabiano Rosas
2024-02-22 1:57 ` maobibo
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=e34ca6da-d0d9-abf5-07fa-182783fb63f6@loongson.cn \
--to=gaosong@loongson.cn \
--cc=farosas@suse.de \
--cc=lvivier@redhat.com \
--cc=maobibo@loongson.cn \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.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).