From: Igor Mammedov <imammedo@redhat.com>
To: Marcel Apfelbaum <marcel.a@redhat.com>
Cc: peter.maydell@linaro.org, alex@alex.org.uk, mst@redhat.com,
aik@ozlabs.ru, hutao@cn.fujitsu.com, mjt@tls.msk.ru,
qemu-devel@nongnu.org, agraf@suse.de, kraxel@redhat.com,
pasteka@kabsi.at, s.priebe@profihost.ag, agarcia@igalia.com,
armbru@redhat.com, aliguori@amazon.com,
david@gibson.dropbear.id.au, lersek@redhat.com,
ehabkost@redhat.com, stefanha@redhat.com,
cornelia.huck@de.ibm.com, tangchen@cn.fujitsu.com,
rth@twiddle.net, andrey@xdel.ru,
vasilis.liaskovitis@profitbricks.com, pbonzini@redhat.com,
"Andreas Färber" <afaerber@suse.de>,
aurelien@aurel32.net
Subject: Re: [Qemu-devel] [PATCH v2 06/31] pc: create custom generic PC machine type
Date: Wed, 21 May 2014 09:30:40 +0200 [thread overview]
Message-ID: <20140521093040.53307fc5@nial.usersys.redhat.com> (raw)
In-Reply-To: <1400601332.12073.43.camel@localhost.localdomain>
On Tue, 20 May 2014 18:55:32 +0300
Marcel Apfelbaum <marcel.a@redhat.com> wrote:
> On Tue, 2014-05-20 at 17:15 +0200, Igor Mammedov wrote:
> > it will be used for PC specific options/variables
> >
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> > hw/i386/pc.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++
> > hw/i386/pc_piix.c | 36 +++++++++++++++---------------
> > hw/i386/pc_q35.c | 12 +++++-----
> > include/hw/i386/pc.h | 24 +++++++++++++++++++++
> > 4 files changed, 105 insertions(+), 24 deletions(-)
> >
> > diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> > index e6369d5..f6781d8 100644
> > --- a/hw/i386/pc.c
> > +++ b/hw/i386/pc.c
> > @@ -1459,3 +1459,60 @@ void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name)
> > gsi_state->ioapic_irq[i] = qdev_get_gpio_in(dev, i);
> > }
> > }
> > +
> > +static void pc_generic_machine_class_init(ObjectClass *oc, void *data)
> > +{
> > + MachineClass *mc = MACHINE_CLASS(oc);
> > + QEMUMachine *qm = data;
> > +
> > + mc->name = qm->name;
> > + mc->alias = qm->alias;
> > + mc->desc = qm->desc;
> > + mc->init = qm->init;
> > + mc->reset = qm->reset;
> > + mc->hot_add_cpu = qm->hot_add_cpu;
> > + mc->kvm_type = qm->kvm_type;
> > + mc->block_default_type = qm->block_default_type;
> > + mc->max_cpus = qm->max_cpus;
> > + mc->no_serial = qm->no_serial;
> > + mc->no_parallel = qm->no_parallel;
> > + mc->use_virtcon = qm->use_virtcon;
> > + mc->use_sclp = qm->use_sclp;
> > + mc->no_floppy = qm->no_floppy;
> > + mc->no_cdrom = qm->no_cdrom;
> > + mc->no_sdcard = qm->no_sdcard;
> > + mc->is_default = qm->is_default;
> > + mc->default_machine_opts = qm->default_machine_opts;
> > + mc->default_boot_order = qm->default_boot_order;
> > + mc->compat_props = qm->compat_props;
> > + mc->hw_version = qm->hw_version;
> > +}
> Hi Igor,
> This conflicts with the latest "machine as QOM object" series in which
> MachineClass does not have a pointer to QEMUMachine and
> pc_generic_machine_class_init is not needed anymore.
I'm not sure with what it conflicts, this patch is rebased on top of
https://github.com/afaerber/qemu-cpu/commit/33ead66c86c96e37d141cfcfda5664b2fa0408fd
from qom-next queue, which drops QEMUMachineInitArgs but QEMUMachine is still exists/used.
MachineClass does not have a pointer to QEMUMachine so we have to
initialize MachineClass fields directly /that's what's changed from previous version/
If there will be more patches about Machine conversion in qom-next before
next series respin, I'll rebase it on top them.
>
> If your series will come first we will have a re-base problem on
> Andreas's QOM's queue.
> Andreas, what's the best practice here?
>
> > +
> > +void qemu_register_pc_machine(QEMUMachine *m)
> > +{
> > + char *name = g_strconcat(m->name, TYPE_MACHINE_SUFFIX, NULL);
> > + TypeInfo ti = {
> > + .name = name,
> > + .parent = TYPE_PC_MACHINE,
> > + .class_init = pc_generic_machine_class_init,
> > + .class_data = (void *)m,
> > + };
> > +
> > + type_register(&ti);
> > + g_free(name);
> > +}
> > +
> > +static const TypeInfo pc_machine_info = {
> > + .name = TYPE_PC_MACHINE,
> > + .parent = TYPE_MACHINE,
> > + .abstract = true,
> > + .instance_size = sizeof(PCMachineState),
> > + .class_size = sizeof(PCMachineClass),
> > +};
> > +
> > +static void pc_machine_register_types(void)
> > +{
> > + type_register_static(&pc_machine_info);
> > +}
> > +
> > +type_init(pc_machine_register_types)
> > diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> > index a48e263..abb599b 100644
> > --- a/hw/i386/pc_piix.c
> > +++ b/hw/i386/pc_piix.c
> > @@ -843,25 +843,25 @@ static QEMUMachine xenfv_machine = {
> >
> > static void pc_machine_init(void)
> > {
> > - qemu_register_machine(&pc_i440fx_machine_v2_1);
> > - qemu_register_machine(&pc_i440fx_machine_v2_0);
> > - qemu_register_machine(&pc_i440fx_machine_v1_7);
> > - qemu_register_machine(&pc_i440fx_machine_v1_6);
> > - qemu_register_machine(&pc_i440fx_machine_v1_5);
> > - qemu_register_machine(&pc_i440fx_machine_v1_4);
> > - qemu_register_machine(&pc_machine_v1_3);
> > - qemu_register_machine(&pc_machine_v1_2);
> > - qemu_register_machine(&pc_machine_v1_1);
> > - qemu_register_machine(&pc_machine_v1_0);
> > - qemu_register_machine(&pc_machine_v0_15);
> > - qemu_register_machine(&pc_machine_v0_14);
> > - qemu_register_machine(&pc_machine_v0_13);
> > - qemu_register_machine(&pc_machine_v0_12);
> > - qemu_register_machine(&pc_machine_v0_11);
> > - qemu_register_machine(&pc_machine_v0_10);
> > - qemu_register_machine(&isapc_machine);
> > + qemu_register_pc_machine(&pc_i440fx_machine_v2_1);
> > + qemu_register_pc_machine(&pc_i440fx_machine_v2_0);
> > + qemu_register_pc_machine(&pc_i440fx_machine_v1_7);
> > + qemu_register_pc_machine(&pc_i440fx_machine_v1_6);
> > + qemu_register_pc_machine(&pc_i440fx_machine_v1_5);
> > + qemu_register_pc_machine(&pc_i440fx_machine_v1_4);
> > + qemu_register_pc_machine(&pc_machine_v1_3);
> > + qemu_register_pc_machine(&pc_machine_v1_2);
> > + qemu_register_pc_machine(&pc_machine_v1_1);
> > + qemu_register_pc_machine(&pc_machine_v1_0);
> > + qemu_register_pc_machine(&pc_machine_v0_15);
> > + qemu_register_pc_machine(&pc_machine_v0_14);
> > + qemu_register_pc_machine(&pc_machine_v0_13);
> > + qemu_register_pc_machine(&pc_machine_v0_12);
> > + qemu_register_pc_machine(&pc_machine_v0_11);
> > + qemu_register_pc_machine(&pc_machine_v0_10);
> > + qemu_register_pc_machine(&isapc_machine);
> > #ifdef CONFIG_XEN
> > - qemu_register_machine(&xenfv_machine);
> > + qemu_register_pc_machine(&xenfv_machine);
> > #endif
> > }
> >
> > diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
> > index b3c02c1..d211393 100644
> > --- a/hw/i386/pc_q35.c
> > +++ b/hw/i386/pc_q35.c
> > @@ -384,12 +384,12 @@ static QEMUMachine pc_q35_machine_v1_4 = {
> >
> > static void pc_q35_machine_init(void)
> > {
> > - qemu_register_machine(&pc_q35_machine_v2_1);
> > - qemu_register_machine(&pc_q35_machine_v2_0);
> > - qemu_register_machine(&pc_q35_machine_v1_7);
> > - qemu_register_machine(&pc_q35_machine_v1_6);
> > - qemu_register_machine(&pc_q35_machine_v1_5);
> > - qemu_register_machine(&pc_q35_machine_v1_4);
> > + qemu_register_pc_machine(&pc_q35_machine_v2_1);
> > + qemu_register_pc_machine(&pc_q35_machine_v2_0);
> > + qemu_register_pc_machine(&pc_q35_machine_v1_7);
> > + qemu_register_pc_machine(&pc_q35_machine_v1_6);
> > + qemu_register_pc_machine(&pc_q35_machine_v1_5);
> > + qemu_register_pc_machine(&pc_q35_machine_v1_4);
> > }
> >
> > machine_init(pc_q35_machine_init);
> > diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> > index 32a7687..c7b053c 100644
> > --- a/include/hw/i386/pc.h
> > +++ b/include/hw/i386/pc.h
> > @@ -12,9 +12,33 @@
> > #include "qemu/bitmap.h"
> > #include "sysemu/sysemu.h"
> > #include "hw/pci/pci.h"
> > +#include "hw/boards.h"
> >
> > #define HPET_INTCAP "hpet-intcap"
> >
> > +struct PCMachineState {
> > + /*< private >*/
> > + MachineState parent_obj;
> > +};
> > +
> > +struct PCMachineClass {
> > + /*< private >*/
> > + MachineClass parent_class;
> > +};
> > +
> > +typedef struct PCMachineState PCMachineState;
> > +typedef struct PCMachineClass PCMachineClass;
> > +
> > +#define TYPE_PC_MACHINE "generic-pc-machine"
> I'll name it pc-machine, without introducing the "generic"
> code word, but maybe is just me.
>
> Thanks,
> Marcel
>
> > +#define PC_MACHINE(obj) \
> > + OBJECT_CHECK(PCMachineState, (obj), TYPE_PC_MACHINE)
> > +#define PC_MACHINE_GET_CLASS(obj) \
> > + OBJECT_GET_CLASS(PCMachineClass, (obj), TYPE_PC_MACHINE)
> > +#define PC_MACHINE_CLASS(klass) \
> > + OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE)
> > +
> > +void qemu_register_pc_machine(QEMUMachine *m);
> > +
> > /* PC-style peripherals (also used by other machines). */
> >
> > typedef struct PcPciInfo {
>
>
>
next prev parent reply other threads:[~2014-05-21 7:34 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-20 15:15 [Qemu-devel] [PATCH v2 00/31] pc: ACPI memory hotplug Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 01/31] pc: ACPI BIOS: use enum for defining memory affinity flags Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 02/31] object_add: allow completion handler to get canonical path Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 03/31] vl.c: daemonize before guest memory allocation Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 04/31] add memdev backend infrastructure Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 05/31] vl.c: extend -m option to support options for memory hotplug Igor Mammedov
2014-05-21 8:10 ` Michael S. Tsirkin
2014-05-21 8:26 ` Igor Mammedov
2014-05-21 8:27 ` Andrey Korolyov
2014-05-21 8:55 ` Igor Mammedov
2014-05-21 9:12 ` Andrey Korolyov
2014-05-21 9:52 ` Igor Mammedov
2014-05-21 10:04 ` Andrey Korolyov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 06/31] pc: create custom generic PC machine type Igor Mammedov
2014-05-20 15:55 ` Marcel Apfelbaum
2014-05-21 7:30 ` Igor Mammedov [this message]
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 07/31] qdev: hotplug for buss-less devices Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 08/31] qdev: expose DeviceState.hotplugged field as a property Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 09/31] dimm: implement dimm device abstraction Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 10/31] memory: add memory_region_is_mapped() API Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 11/31] dimm: do not allow to set already used memdev Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 12/31] pc: initialize memory hotplug address space Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 13/31] pc: exit QEMU if number of slots more than supported 256 Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 14/31] pc: add 'etc/reserved-memory-end' fw_cfg interface for SeaBIOS Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 15/31] pc: add memory hotplug handler to PC_MACHINE Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 16/31] dimm: add busy address check and address auto-allocation Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 17/31] dimm: add busy slot check and slot auto-allocation Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 18/31] acpi: rename cpu_hotplug_defs.h to acpi_defs.h Igor Mammedov
2014-05-20 15:35 ` Michael S. Tsirkin
2014-05-20 16:03 ` Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 19/31] acpi: memory hotplug ACPI hardware implementation Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 20/31] trace: add acpi memory hotplug IO region events Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 21/31] trace: pc: add DIMM slot & address allocation Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 24/31] pc: ich9 lpc: make it work with global/compat properties Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 29/31] pc: ACPI BIOS: implement memory hotplug interface Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 30/31] pc: ACPI BIOS: reserve SRAT entry for hotplug mem hole Igor Mammedov
2014-05-20 15:38 ` Michael S. Tsirkin
2014-05-21 7:56 ` Igor Mammedov
2014-05-21 8:02 ` Michael S. Tsirkin
2014-05-21 8:05 ` Michael S. Tsirkin
2014-05-21 11:22 ` Igor Mammedov
2014-05-21 12:44 ` Michael S. Tsirkin
2014-05-21 13:56 ` Igor Mammedov
2014-05-21 15:01 ` Michael S. Tsirkin
2014-05-21 15:17 ` Igor Mammedov
2014-05-20 15:15 ` [Qemu-devel] [PATCH v2 31/31] pc: ACPI BIOS: make GPE.3 handle memory hotplug event on PIIX and Q35 machines Igor Mammedov
2014-05-21 11:29 ` [Qemu-devel] [PATCH v2 22/31] acpi:piix4: allow plug/unlug callbacks handle not only PCI devices Igor Mammedov
2014-05-21 11:29 ` [Qemu-devel] [PATCH v2 23/31] acpi:piix4: add memory hotplug handling Igor Mammedov
2014-05-21 11:29 ` [Qemu-devel] [PATCH v2 25/31] acpi:ich9: " Igor Mammedov
2014-05-21 11:29 ` [Qemu-devel] [PATCH v2 26/31] pc: migrate piix4 & ich9 MemHotplugState Igor Mammedov
2014-05-23 15:11 ` Andrey Korolyov
2014-05-23 15:41 ` Igor Mammedov
2014-05-21 11:29 ` [Qemu-devel] [PATCH v2 27/31] pc: add acpi-device link to PCMachineState Igor Mammedov
2014-05-21 11:29 ` [Qemu-devel] [PATCH v2 28/31] pc: propagate memory hotplug event to ACPI device Igor Mammedov
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=20140521093040.53307fc5@nial.usersys.redhat.com \
--to=imammedo@redhat.com \
--cc=afaerber@suse.de \
--cc=agarcia@igalia.com \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=alex@alex.org.uk \
--cc=aliguori@amazon.com \
--cc=andrey@xdel.ru \
--cc=armbru@redhat.com \
--cc=aurelien@aurel32.net \
--cc=cornelia.huck@de.ibm.com \
--cc=david@gibson.dropbear.id.au \
--cc=ehabkost@redhat.com \
--cc=hutao@cn.fujitsu.com \
--cc=kraxel@redhat.com \
--cc=lersek@redhat.com \
--cc=marcel.a@redhat.com \
--cc=mjt@tls.msk.ru \
--cc=mst@redhat.com \
--cc=pasteka@kabsi.at \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=s.priebe@profihost.ag \
--cc=stefanha@redhat.com \
--cc=tangchen@cn.fujitsu.com \
--cc=vasilis.liaskovitis@profitbricks.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).