From c6c148f7c5a1c7731c42eb1d98df0171deda6552 Mon Sep 17 00:00:00 2001
From: Markus Armbruster <armbru@redhat.com>
Date: Mon, 8 Sep 2014 09:23:13 +0200
Subject: [PATCH 09/15] rhel: Add rhel7.1.0 machine types

Message-id: <1410168194-26833-2-git-send-email-armbru@redhat.com>
Patchwork-id: 60898
O-Subject: [PATCH v3 RHEV-7.1 qemu-kvm-rhev 1/2] rhel: Add rhel7.1.0 machine types
Bugzilla: 1093023
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>

Clean slate, except keep the CPU RDTSCP tweaks, because they aren't
just for backward compatibility, they're for avoiding issues that
still need to be addressed upstream.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
Bugzilla: 1093023

 hw/i386/pc_piix.c | 58 ++++++++++++++++++++++++++++++++++++++-----------------
 hw/i386/pc_q35.c  | 53 ++++++++++++++++++++++++++++++++++++--------------
 2 files changed, 78 insertions(+), 33 deletions(-)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 hw/i386/pc_piix.c |   56 ++++++++++++++++++++++++++++++++++++----------------
 hw/i386/pc_q35.c  |   53 +++++++++++++++++++++++++++++++++++--------------
 2 files changed, 77 insertions(+), 32 deletions(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 38018f6..855c951 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -924,8 +924,46 @@ machine_init(pc_machine_init);
 
 /* Red Hat Enterprise Linux machine types */
 
+static void pc_compat_rhel710(MachineState *machine)
+{
+    /* KVM can't expose RDTSCP on AMD CPUs, so there's no point in enabling it
+     * on AMD CPU models.
+     */
+    x86_cpu_compat_set_features("phenom", FEAT_8000_0001_EDX, 0,
+                                CPUID_EXT2_RDTSCP);
+    x86_cpu_compat_set_features("Opteron_G2", FEAT_8000_0001_EDX, 0,
+                                CPUID_EXT2_RDTSCP);
+    x86_cpu_compat_set_features("Opteron_G3", FEAT_8000_0001_EDX, 0,
+                                CPUID_EXT2_RDTSCP);
+    x86_cpu_compat_set_features("Opteron_G4", FEAT_8000_0001_EDX, 0,
+                                CPUID_EXT2_RDTSCP);
+    x86_cpu_compat_set_features("Opteron_G5", FEAT_8000_0001_EDX, 0,
+                                CPUID_EXT2_RDTSCP);
+}
+
+static void pc_init_rhel710(MachineState *machine)
+{
+    pc_compat_rhel710(machine);
+    pc_init_pci(machine);
+}
+
+static QEMUMachine pc_machine_rhel710 = {
+    PC_DEFAULT_MACHINE_OPTIONS,
+    .name = "pc-i440fx-rhel7.1.0",
+    .alias = "pc",
+    .desc = "RHEL 7.1.0 PC (i440FX + PIIX, 1996)",
+    .init = pc_init_rhel710,
+    .is_default = 1,
+    .default_machine_opts = "firmware=bios-256k.bin",
+    .compat_props = (GlobalProperty[]) {
+        { /* end of list */ }
+    },
+};
+
 static void pc_compat_rhel700(MachineState *machine)
 {
+    pc_compat_rhel710(machine);
+
     /* Upstream enables it for everyone, we're a little more selective */
     x86_cpu_compat_disable_kvm_features(FEAT_1_ECX, CPUID_EXT_X2APIC);
 
@@ -940,20 +978,6 @@ static void pc_compat_rhel700(MachineState *machine)
     x86_cpu_compat_set_features("Opteron_G4", FEAT_1_ECX, CPUID_EXT_X2APIC, 0);
     x86_cpu_compat_set_features("Opteron_G5", FEAT_1_ECX, CPUID_EXT_X2APIC, 0);
 
-    /* KVM can't expose RDTSCP on AMD CPUs, so there's no point in enabling it
-     * on AMD CPU models.
-     */
-    x86_cpu_compat_set_features("phenom", FEAT_8000_0001_EDX, 0,
-                                CPUID_EXT2_RDTSCP);
-    x86_cpu_compat_set_features("Opteron_G2", FEAT_8000_0001_EDX, 0,
-                                CPUID_EXT2_RDTSCP);
-    x86_cpu_compat_set_features("Opteron_G3", FEAT_8000_0001_EDX, 0,
-                                CPUID_EXT2_RDTSCP);
-    x86_cpu_compat_set_features("Opteron_G4", FEAT_8000_0001_EDX, 0,
-                                CPUID_EXT2_RDTSCP);
-    x86_cpu_compat_set_features("Opteron_G5", FEAT_8000_0001_EDX, 0,
-                                CPUID_EXT2_RDTSCP);
-
     legacy_acpi_table_size = 6418; /* see pc_compat_2_0() */
     smbios_legacy_mode = true;
     has_reserved_memory = false;
@@ -963,16 +987,13 @@ static void pc_init_rhel700(MachineState *machine)
 {
     pc_compat_rhel700(machine);
     pc_init_pci(machine);
-
 }
 
 static QEMUMachine pc_machine_rhel700 = {
     PC_DEFAULT_MACHINE_OPTIONS,
     .name = "pc-i440fx-rhel7.0.0",
-    .alias = "pc",
     .desc = "RHEL 7.0.0 PC (i440FX + PIIX, 1996)",
     .init = pc_init_rhel700,
-    .is_default = 1,
     .default_machine_opts = "firmware=bios-256k.bin",
     .compat_props = (GlobalProperty[]) {
         PC_RHEL7_0_COMPAT,
@@ -1428,6 +1449,7 @@ static QEMUMachine pc_machine_rhel600 = {
 
 static void rhel_machine_init(void)
 {
+    qemu_register_pc_machine(&pc_machine_rhel710);
     qemu_register_pc_machine(&pc_machine_rhel700);
     qemu_register_pc_machine(&pc_machine_rhel650);
     qemu_register_pc_machine(&pc_machine_rhel640);
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index bed13a2..098151e 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -435,8 +435,45 @@ machine_init(pc_q35_machine_init);
 
 /* Red Hat Enterprise Linux machine types */
 
+static void pc_q35_compat_rhel710(MachineState *machine)
+{
+    /* KVM can't expose RDTSCP on AMD CPUs, so there's no point in enabling it
+     * on AMD CPU models.
+     */
+    x86_cpu_compat_set_features("phenom", FEAT_8000_0001_EDX, 0,
+                                CPUID_EXT2_RDTSCP);
+    x86_cpu_compat_set_features("Opteron_G2", FEAT_8000_0001_EDX, 0,
+                                CPUID_EXT2_RDTSCP);
+    x86_cpu_compat_set_features("Opteron_G3", FEAT_8000_0001_EDX, 0,
+                                CPUID_EXT2_RDTSCP);
+    x86_cpu_compat_set_features("Opteron_G4", FEAT_8000_0001_EDX, 0,
+                                CPUID_EXT2_RDTSCP);
+    x86_cpu_compat_set_features("Opteron_G5", FEAT_8000_0001_EDX, 0,
+                                CPUID_EXT2_RDTSCP);
+}
+
+static void pc_q35_init_rhel710(MachineState *machine)
+{
+    pc_q35_compat_rhel710(machine);
+    pc_q35_init(machine);
+}
+
+static QEMUMachine pc_q35_machine_rhel710 = {
+    PC_DEFAULT_MACHINE_OPTIONS,
+    .name = "pc-q35-rhel7.1.0",
+    .alias = "q35",
+    .desc = "RHEL-7.1.0 PC (Q35 + ICH9, 2009)",
+    .init = pc_q35_init_rhel710,
+    .default_machine_opts = "firmware=bios-256k.bin",
+    .compat_props = (GlobalProperty[]) {
+        { /* end of list */ }
+    },
+};
+
 static void pc_q35_compat_rhel700(MachineState *machine)
 {
+    pc_q35_compat_rhel710(machine);
+
     /* Upstream enables it for everyone, we're a little more selective */
     x86_cpu_compat_disable_kvm_features(FEAT_1_ECX, CPUID_EXT_X2APIC);
 
@@ -451,20 +488,6 @@ static void pc_q35_compat_rhel700(MachineState *machine)
     x86_cpu_compat_set_features("Opteron_G4", FEAT_1_ECX, CPUID_EXT_X2APIC, 0);
     x86_cpu_compat_set_features("Opteron_G5", FEAT_1_ECX, CPUID_EXT_X2APIC, 0);
 
-    /* KVM can't expose RDTSCP on AMD CPUs, so there's no point in enabling it
-     * on AMD CPU models.
-     */
-    x86_cpu_compat_set_features("phenom", FEAT_8000_0001_EDX, 0,
-                                CPUID_EXT2_RDTSCP);
-    x86_cpu_compat_set_features("Opteron_G2", FEAT_8000_0001_EDX, 0,
-                                CPUID_EXT2_RDTSCP);
-    x86_cpu_compat_set_features("Opteron_G3", FEAT_8000_0001_EDX, 0,
-                                CPUID_EXT2_RDTSCP);
-    x86_cpu_compat_set_features("Opteron_G4", FEAT_8000_0001_EDX, 0,
-                                CPUID_EXT2_RDTSCP);
-    x86_cpu_compat_set_features("Opteron_G5", FEAT_8000_0001_EDX, 0,
-                                CPUID_EXT2_RDTSCP);
-
     smbios_legacy_mode = true;
     has_reserved_memory = false;
 }
@@ -478,7 +501,6 @@ static void pc_q35_init_rhel700(MachineState *machine)
 static QEMUMachine pc_q35_machine_rhel700 = {
     PC_DEFAULT_MACHINE_OPTIONS,
     .name = "pc-q35-rhel7.0.0",
-    .alias = "q35",
     .desc = "RHEL-7.0.0 PC (Q35 + ICH9, 2009)",
     .init = pc_q35_init_rhel700,
     .default_machine_opts = "firmware=bios-256k.bin",
@@ -490,6 +512,7 @@ static QEMUMachine pc_q35_machine_rhel700 = {
 
 static void rhel_pc_q35_machine_init(void)
 {
+    qemu_register_pc_machine(&pc_q35_machine_rhel710);
     qemu_register_pc_machine(&pc_q35_machine_rhel700);
 }
 
-- 
1.7.1

