From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Marcel Apfelbaum" <marcel.a@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Alexander Graf" <agraf@suse.de>,
"Don Slutz" <dslutz@verizon.com>,
"Igor Mammedov" <imammedo@redhat.com>,
"Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [RFC v3 34/35] piix: Move compat/init functions closer to corresponding class_init
Date: Fri, 4 Jul 2014 21:10:01 -0300 [thread overview]
Message-ID: <1404519002-10224-35-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1404519002-10224-1-git-send-email-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
hw/i386/pc_piix.c | 92 +++++++++++++++++++++++++++----------------------------
1 file changed, 45 insertions(+), 47 deletions(-)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 94e9dfe..3716f98 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -279,53 +279,6 @@ static void pc_init1(MachineState *machine)
}
}
-static void pc_compat_1_7(MachineState *machine)
-{
- x86_cpu_compat_disable_kvm_features(FEAT_1_ECX, CPUID_EXT_X2APIC);
-}
-
-static void pc_compat_1_4(MachineState *machine)
-{
- pc_compat_1_7(machine);
- x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE);
- x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, CPUID_EXT_PCLMULQDQ);
-}
-
-static void pc_compat_1_3(MachineState *machine)
-{
- pc_compat_1_4(machine);
- enable_compat_apic_id_mode();
-}
-
-static void pc_compat_1_2(MachineState *machine)
-{
- pc_compat_1_3(machine);
- x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI);
-}
-
-static void pc_compat_isa(MachineState *machine)
-{
- if (!machine->cpu_model) {
- machine->cpu_model = "486";
- }
- x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI);
- enable_compat_apic_id_mode();
-}
-
-#ifdef CONFIG_XEN
-static void pc_xen_hvm_init(MachineState *machine)
-{
- PCIBus *bus;
-
- pc_init1(machine);
-
- bus = pci_find_primary_bus();
- if (bus != NULL) {
- pci_create_simple(bus, -1, "xen-platform");
- }
-}
-#endif
-
/**
* PCI440FXMachineClass;
*/
@@ -395,6 +348,11 @@ static const TypeInfo pc_i440fx_machine_v2_0_type_info = {
.class_init = pc_i440fx_machine_v2_0_class_init,
};
+static void pc_compat_1_7(MachineState *machine)
+{
+ x86_cpu_compat_disable_kvm_features(FEAT_1_ECX, CPUID_EXT_X2APIC);
+}
+
static void pc_i440fx_machine_v1_7_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
@@ -458,6 +416,13 @@ static const TypeInfo pc_i440fx_machine_v1_5_type_info = {
.class_init = pc_i440fx_machine_v1_5_class_init,
};
+static void pc_compat_1_4(MachineState *machine)
+{
+ pc_compat_1_7(machine);
+ x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE);
+ x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, CPUID_EXT_PCLMULQDQ);
+}
+
static void pc_i440fx_machine_v1_4_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
@@ -498,6 +463,12 @@ static const TypeInfo pc_i440fx_machine_v1_4_type_info = {
.value = "off",\
}
+static void pc_compat_1_3(MachineState *machine)
+{
+ pc_compat_1_4(machine);
+ enable_compat_apic_id_mode();
+}
+
static void pc_machine_v1_3_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
@@ -545,6 +516,12 @@ static const TypeInfo pc_machine_v1_3_type_info = {
.value = "off",\
}
+static void pc_compat_1_2(MachineState *machine)
+{
+ pc_compat_1_3(machine);
+ x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI);
+}
+
static void pc_machine_v1_2_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
@@ -877,6 +854,15 @@ static const TypeInfo pc_machine_v0_10_type_info = {
.class_init = pc_machine_v0_10_class_init,
};
+static void pc_compat_isa(MachineState *machine)
+{
+ if (!machine->cpu_model) {
+ machine->cpu_model = "486";
+ }
+ x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI);
+ enable_compat_apic_id_mode();
+}
+
static void isapc_machine_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
@@ -909,6 +895,18 @@ static const TypeInfo isapc_machine_type_info = {
};
#ifdef CONFIG_XEN
+static void pc_xen_hvm_init(MachineState *machine)
+{
+ PCIBus *bus;
+
+ pc_init1(machine);
+
+ bus = pci_find_primary_bus();
+ if (bus != NULL) {
+ pci_create_simple(bus, -1, "xen-platform");
+ }
+}
+
static void xenfv_machine_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
--
1.9.3
next prev parent reply other threads:[~2014-07-05 0:12 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-05 0:09 [Qemu-devel] [RFC v3 00/35] Convert PC machine-types to QOM classes Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 01/35] pc_piix: Add missing compat code to pc-0.1[0123] Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 02/35] target-i385: Add kvmclock_enabled static Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 03/35] pc_piix: Reuse pc_compat_1_2() on pc_init_pci_no_kvmclock() Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 04/35] pc: Replace tabs with spaces on pc.h Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 05/35] vl.c: Use qdev_prop_register_global() for single globals Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 06/35] piix: Move pc-0.14 qxl compat properties to PC_COMPAT_0_14 Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 07/35] piix: Move pc-0.13 virtio-9p-pci compat to PC_COMPAT_0_13 Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 08/35] piix: Move pc-0.1[23] rombar compat props " Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 09/35] piix: Move pc-0.11 drive version compat props TO PC_COMPAT_0_11 Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 10/35] machine: Make compat_props a linked list Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 11/35] pc: Register machine classes directly instead of using QEMUMachine Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 12/35] pc: Eliminate pc_common_machine_options() Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 13/35] pc: Eliminate pc_default_machine_options() Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 14/35] piix: Eliminate pc_i440fx_machine_options() Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 15/35] q35: Eliminate pc_q35_machine_options() Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 16/35] q35: Eliminate pc_q35_1_4_machine_options() Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 17/35] pc: Eliminate all *_machine_options() functions Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 18/35] machine: Eliminate QEMUMachine.compat_props Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 19/35] pc: Rename pc_machine variable to pcms Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 20/35] pc: Move pci_enabled parameter to PCMachineClass Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 21/35] q35: Use PCMachineClass.pci_enabled field Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 22/35] pc: Move kvmclock_enabled to PCMachineClass Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 23/35] pc: Move smbios_legacy_mode " Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 24/35] pc: Move smbios_defaults " Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 25/35] pc: Move has_acpi_build " Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 26/35] pc: Move has_pci_info " Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 27/35] pc: Move gigabyte_align " Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 28/35] pc: Move has_reserved_memory " Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 29/35] pc: Move option_rom_has_mr/rom_file_has_mr to MachineClass Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 30/35] piix: Eliminate pc_init_pci() Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 31/35] piix: Introduce struct PCI440FXMachineClass Eduardo Habkost
2014-07-05 0:09 ` [Qemu-devel] [RFC v3 32/35] pc: Create common machine init function Eduardo Habkost
2014-07-05 0:10 ` [Qemu-devel] [RFC v3 33/35] pc: Eliminate empty or trivial compat functions Eduardo Habkost
2014-07-05 0:10 ` Eduardo Habkost [this message]
2014-07-05 0:10 ` [Qemu-devel] [RFC v3 35/35] pc: Move {ram, pci, rom}_memory variables to PCMachineState Eduardo Habkost
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=1404519002-10224-35-git-send-email-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=dslutz@verizon.com \
--cc=imammedo@redhat.com \
--cc=marcel.a@redhat.com \
--cc=mst@redhat.com \
--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).