0a122b
From 9b80afa6377ff6cb0f0f28ab3719ddb5b61e4193 Mon Sep 17 00:00:00 2001
0a122b
From: Eduardo Habkost <ehabkost@redhat.com>
0a122b
Date: Mon, 20 Jan 2014 19:05:29 +0100
0a122b
Subject: [PATCH 32/34] pc: Create pc_compat_rhel*() functions
0a122b
0a122b
RH-Author: Eduardo Habkost <ehabkost@redhat.com>
0a122b
Message-id: <1390244730-31038-2-git-send-email-ehabkost@redhat.com>
0a122b
Patchwork-id: 56847
0a122b
O-Subject: [RHEL7 qemu-kvm PATCH 1/2] pc: Create pc_compat_rhel*() functions
0a122b
Bugzilla: 1049706
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
RH-Acked-by: Bandan Das <bsd@redhat.com>
0a122b
0a122b
Bugzilla: 1049706
0a122b
Brew scratch build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=6900764
0a122b
Upstream status: not applicable
0a122b
0a122b
This is the RHEL equivalent of upstream
0a122b
commit 396f79f45ea75bd1c421522f29b4f91d490df7cc.
0a122b
0a122b
With the previous code, the compat code for a newer release could undo
0a122b
the compat changes made by the compat code for an older release. With
0a122b
the pc_init_*()/pc_compat_*() pattern, we can have two compat functions
0a122b
touching the same bits, as the older compat functions will run last,
0a122b
allowing it to undo changes done by newer compat functions.
0a122b
0a122b
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
0a122b
---
0a122b
 hw/i386/pc_piix.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++---------
0a122b
 hw/i386/pc_q35.c  |  5 +++++
0a122b
 2 files changed, 55 insertions(+), 9 deletions(-)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 hw/i386/pc_piix.c |   59 ++++++++++++++++++++++++++++++++++++++++++++--------
0a122b
 hw/i386/pc_q35.c  |    5 ++++
0a122b
 2 files changed, 55 insertions(+), 9 deletions(-)
0a122b
0a122b
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
0a122b
index e061877..769571c 100644
0a122b
--- a/hw/i386/pc_piix.c
0a122b
+++ b/hw/i386/pc_piix.c
0a122b
@@ -743,8 +743,13 @@ machine_init(pc_machine_init);
0a122b
 
0a122b
 /* Red Hat Enterprise Linux machine types */
0a122b
 
0a122b
+static void pc_compat_rhel700(QEMUMachineInitArgs *args)
0a122b
+{
0a122b
+}
0a122b
+
0a122b
 static void pc_init_rhel700(QEMUMachineInitArgs *args)
0a122b
 {
0a122b
+    pc_compat_rhel700(args);
0a122b
     pc_init_pci(args);
0a122b
 }
0a122b
 
0a122b
@@ -868,8 +873,9 @@ static QEMUMachine pc_machine_rhel700 = {
0a122b
         .value    = "rhel6-virtio.rom",\
0a122b
     }
0a122b
 
0a122b
-static void pc_init_rhel650(QEMUMachineInitArgs *args)
0a122b
+static void pc_compat_rhel650(QEMUMachineInitArgs *args)
0a122b
 {
0a122b
+    pc_compat_rhel700(args);
0a122b
     x86_cpu_compat_set_features("pentium", FEAT_1_EDX, 0, CPUID_APIC);
0a122b
     x86_cpu_compat_set_features("pentium2", FEAT_1_EDX, 0, CPUID_APIC);
0a122b
     x86_cpu_compat_set_features("pentium3", FEAT_1_EDX, 0, CPUID_APIC);
0a122b
@@ -911,7 +917,12 @@ static void pc_init_rhel650(QEMUMachineInitArgs *args)
0a122b
 
0a122b
     rom_file_in_ram = false; 
0a122b
     has_acpi_build = false;
0a122b
-    pc_init_rhel700(args);
0a122b
+}
0a122b
+
0a122b
+static void pc_init_rhel650(QEMUMachineInitArgs *args)
0a122b
+{
0a122b
+    pc_compat_rhel650(args);
0a122b
+    pc_init_pci(args);
0a122b
 }
0a122b
 
0a122b
 static QEMUMachine pc_machine_rhel650 = {
0a122b
@@ -950,10 +961,16 @@ static QEMUMachine pc_machine_rhel650 = {
0a122b
         .value    = "off",\
0a122b
     }
0a122b
 
0a122b
-static void pc_init_rhel640(QEMUMachineInitArgs *args)
0a122b
+static void pc_compat_rhel640(QEMUMachineInitArgs *args)
0a122b
 {
0a122b
+    pc_compat_rhel650(args);
0a122b
     x86_cpu_compat_set_features(NULL, FEAT_1_EDX, 0, CPUID_SEP);
0a122b
-    pc_init_rhel650(args);
0a122b
+}
0a122b
+
0a122b
+static void pc_init_rhel640(QEMUMachineInitArgs *args)
0a122b
+{
0a122b
+    pc_compat_rhel640(args);
0a122b
+    pc_init_pci(args);
0a122b
 }
0a122b
 
0a122b
 static QEMUMachine pc_machine_rhel640 = {
0a122b
@@ -1016,13 +1033,19 @@ static QEMUMachine pc_machine_rhel640 = {
0a122b
         .value    = "1",\
0a122b
     }
0a122b
 
0a122b
-static void pc_init_rhel630(QEMUMachineInitArgs *args)
0a122b
+static void pc_compat_rhel630(QEMUMachineInitArgs *args)
0a122b
 {
0a122b
+    pc_compat_rhel640(args);
0a122b
     disable_kvm_pv_eoi();
0a122b
     enable_compat_apic_id_mode();
0a122b
     x86_cpu_compat_set_features("SandyBridge", FEAT_1_ECX,
0a122b
                                 0, CPUID_EXT_TSC_DEADLINE_TIMER);
0a122b
-    pc_init_rhel640(args);
0a122b
+}
0a122b
+
0a122b
+static void pc_init_rhel630(QEMUMachineInitArgs *args)
0a122b
+{
0a122b
+    pc_compat_rhel630(args);
0a122b
+    pc_init_pci(args);
0a122b
 }
0a122b
 
0a122b
 static QEMUMachine pc_machine_rhel630 = {
0a122b
@@ -1045,9 +1068,15 @@ static QEMUMachine pc_machine_rhel630 = {
0a122b
         .value = "off",\
0a122b
     }
0a122b
 
0a122b
+static void pc_compat_rhel620(QEMUMachineInitArgs *args)
0a122b
+{
0a122b
+    pc_compat_rhel630(args);
0a122b
+}
0a122b
+
0a122b
 static void pc_init_rhel620(QEMUMachineInitArgs *args)
0a122b
 {
0a122b
-    pc_init_rhel630(args);
0a122b
+    pc_compat_rhel620(args);
0a122b
+    pc_init_pci(args);
0a122b
 }
0a122b
 
0a122b
 static QEMUMachine pc_machine_rhel620 = {
0a122b
@@ -1111,9 +1140,15 @@ static QEMUMachine pc_machine_rhel620 = {
0a122b
         .value    = "1",\
0a122b
     }
0a122b
 
0a122b
+static void pc_compat_rhel610(QEMUMachineInitArgs *args)
0a122b
+{
0a122b
+    pc_compat_rhel620(args);
0a122b
+}
0a122b
+
0a122b
 static void pc_init_rhel610(QEMUMachineInitArgs *args)
0a122b
 {
0a122b
-    pc_init_rhel620(args);
0a122b
+    pc_compat_rhel610(args);
0a122b
+    pc_init_pci(args);
0a122b
 }
0a122b
 
0a122b
 static QEMUMachine pc_machine_rhel610 = {
0a122b
@@ -1144,9 +1179,15 @@ static QEMUMachine pc_machine_rhel610 = {
0a122b
         .value    = stringify(0),\
0a122b
     }
0a122b
 
0a122b
+static void pc_compat_rhel600(QEMUMachineInitArgs *args)
0a122b
+{
0a122b
+    pc_compat_rhel610(args);
0a122b
+}
0a122b
+
0a122b
 static void pc_init_rhel600(QEMUMachineInitArgs *args)
0a122b
 {
0a122b
-    pc_init_rhel610(args);
0a122b
+    pc_compat_rhel600(args);
0a122b
+    pc_init_pci(args);
0a122b
 }
0a122b
 
0a122b
 static QEMUMachine pc_machine_rhel600 = {
0a122b
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
0a122b
index 8d1a714..0280a95 100644
0a122b
--- a/hw/i386/pc_q35.c
0a122b
+++ b/hw/i386/pc_q35.c
0a122b
@@ -268,8 +268,13 @@ machine_init(pc_q35_machine_init);
0a122b
 
0a122b
 /* Red Hat Enterprise Linux machine types */
0a122b
 
0a122b
+static void pc_q35_compat_rhel700(QEMUMachineInitArgs *args)
0a122b
+{
0a122b
+}
0a122b
+
0a122b
 static void pc_q35_init_rhel700(QEMUMachineInitArgs *args)
0a122b
 {
0a122b
+    pc_q35_compat_rhel700(args);
0a122b
     pc_q35_init(args);
0a122b
 }
0a122b
 
0a122b
-- 
0a122b
1.7.1
0a122b