From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 11/31] target-arm: Add virt class and machine types
Date: Tue, 23 Dec 2014 13:54:07 +0000 [thread overview]
Message-ID: <1419342867-15527-12-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1419342867-15527-1-git-send-email-peter.maydell@linaro.org>
From: Greg Bellows <greg.bellows@linaro.org>
Switch virt qemu machine support to use the newer object type, class, and
instance model. Added virt TypeInfo with static registration along with virt
specific class and machine structs. Also added virt class initialization
method.
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1418684992-8996-7-git-send-email-greg.bellows@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/arm/virt.c | 40 ++++++++++++++++++++++++++++++++++------
1 file changed, 34 insertions(+), 6 deletions(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 314e55b..b6bb914 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -86,6 +86,23 @@ typedef struct VirtBoardInfo {
uint32_t clock_phandle;
} VirtBoardInfo;
+typedef struct {
+ MachineClass parent;
+ VirtBoardInfo *daughterboard;
+} VirtMachineClass;
+
+typedef struct {
+ MachineState parent;
+} VirtMachineState;
+
+#define TYPE_VIRT_MACHINE "virt"
+#define VIRT_MACHINE(obj) \
+ OBJECT_CHECK(VirtMachineState, (obj), TYPE_VIRT_MACHINE)
+#define VIRT_MACHINE_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(VirtMachineClass, obj, TYPE_VIRT_MACHINE)
+#define VIRT_MACHINE_CLASS(klass) \
+ OBJECT_CLASS_CHECK(VirtMachineClass, klass, TYPE_VIRT_MACHINE)
+
/* Addresses and sizes of our components.
* 0..128MB is space for a flash device so we can run bootrom code such as UEFI.
* 128MB..256MB is used for miscellaneous device I/O.
@@ -615,16 +632,27 @@ static void machvirt_init(MachineState *machine)
arm_load_kernel(ARM_CPU(first_cpu), &vbi->bootinfo);
}
-static QEMUMachine machvirt_a15_machine = {
- .name = "virt",
- .desc = "ARM Virtual Machine",
- .init = machvirt_init,
- .max_cpus = 8,
+static void virt_class_init(ObjectClass *oc, void *data)
+{
+ MachineClass *mc = MACHINE_CLASS(oc);
+
+ mc->name = TYPE_VIRT_MACHINE;
+ mc->desc = "ARM Virtual Machine",
+ mc->init = machvirt_init;
+ mc->max_cpus = 8;
+}
+
+static const TypeInfo machvirt_info = {
+ .name = TYPE_VIRT_MACHINE,
+ .parent = TYPE_MACHINE,
+ .instance_size = sizeof(VirtMachineState),
+ .class_size = sizeof(VirtMachineClass),
+ .class_init = virt_class_init,
};
static void machvirt_machine_init(void)
{
- qemu_register_machine(&machvirt_a15_machine);
+ type_register_static(&machvirt_info);
}
machine_init(machvirt_machine_init);
--
1.9.1
next prev parent reply other threads:[~2014-12-23 13:54 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-23 13:53 [Qemu-devel] [PULL 00/31] target-arm queue Peter Maydell
2014-12-23 13:53 ` [Qemu-devel] [PULL 01/31] audio: Don't free hw resources until after hw backend is stopped Peter Maydell
2014-12-23 13:53 ` [Qemu-devel] [PULL 02/31] target-arm: Merge EL3 CP15 register lists Peter Maydell
2014-12-23 13:53 ` [Qemu-devel] [PULL 03/31] machine: remove qemu_machine_opts global list Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 04/31] vl.c: simplified machine_set_property Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 05/31] vl.c: add HMP help to machine Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 06/31] target-arm: Add vexpress class and machine types Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 07/31] target-arm: Add vexpress a9 & a15 machine objects Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 08/31] target-arm: Switch to common vexpress machine init Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 09/31] target-arm: Add vexpress machine secure property Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 10/31] target-arm: Change vexpress daughterboard init arg Peter Maydell
2014-12-23 13:54 ` Peter Maydell [this message]
2014-12-23 13:54 ` [Qemu-devel] [PULL 12/31] target-arm: Add virt machine secure property Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 13/31] target-arm: Add feature unset function Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 14/31] target-arm: Add ARMCPU secure property Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 15/31] target-arm: Add arm_boot_info secure_boot control Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 16/31] target-arm: Enable CPU has_el3 prop during VE init Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 17/31] target-arm: Set CPU has_el3 prop during virt init Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 18/31] target-arm: Breakout integratorcp and versatilepb cpu init Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 19/31] target-arm: Disable EL3 on unsupported machines Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 20/31] target-arm: add cpu feature EL3 to CPUs with Security Extensions Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 21/31] fw_cfg: hard separation between the MMIO and I/O port mappings Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 22/31] fw_cfg: move boards to fw_cfg_init_io() / fw_cfg_init_mem() Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 23/31] fw_cfg_mem: max access size and region size are the same for data register Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 24/31] fw_cfg_mem: flip ctl_mem_ops and data_mem_ops to DEVICE_BIG_ENDIAN Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 25/31] exec: allows 8-byte accesses in subpage_ops Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 26/31] fw_cfg_mem: introduce the "data_width" property Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 27/31] fw_cfg_mem: expose the "data_width" property with fw_cfg_init_mem_wide() Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 28/31] arm: add fw_cfg to "virt" board Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 29/31] hw/loader: split out load_image_gzipped_buffer() Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 30/31] hw/arm: pass pristine kernel image to guest firmware over fw_cfg Peter Maydell
2014-12-23 13:54 ` [Qemu-devel] [PULL 31/31] hw/arm/virt: enable passing of EFI-stubbed kernel to guest UEFI firmware Peter Maydell
2014-12-23 17:46 ` [Qemu-devel] [PULL 00/31] target-arm queue Peter Maydell
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=1419342867-15527-12-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).