From e31809f655d2298a4e21e317c8c6cb453a63939b Mon Sep 17 00:00:00 2001
From: Sebastian Ott <sebott@redhat.com>
Date: Tue, 28 May 2024 14:04:07 +0200
Subject: [PATCH 3/9] x86: create pc-i440fx machine type for rhel10

RH-Author: Sebastian Ott <sebott@redhat.com>
RH-MergeRequest: 270: RHEL10 machine types
RH-Jira: RHEL-29002 RHEL-29003 RHEL-35587 RHEL-38411 RHEL-45141 RHEL-52318 RHEL-52320
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
RH-Acked-by: Eric Auger <eric.auger@redhat.com>
RH-Commit: [3/7] e5aab53bc07dac21097497ce0d9798c6414dce57 (seott1/cos-qemu-kvm)

Create a new machine type pc-i440fx-rhel10.0.0,
set it as default and alias to pc.

Signed-off-by: Sebastian Ott <sebott@redhat.com>
---
 hw/i386/pc_piix.c | 37 +++++++++++++++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 2 deletions(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 447f98b438..663f67aa3a 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -830,6 +830,41 @@ DEFINE_PC_MACHINE(xenfv, "xenfv-3.1", pc_xen_hvm_init,
 
 /* Red Hat Enterprise Linux machine types */
 
+static void pc_machine_rhel10_options(MachineClass *m)
+{
+    PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
+    ObjectClass *oc = OBJECT_CLASS(m);
+    pcmc->default_south_bridge = TYPE_PIIX3_DEVICE;
+    pcmc->pci_root_uid = 0;
+    pcmc->default_cpu_version = 1;
+
+    m->family = "pc_piix_Y";
+    m->default_machine_opts = "firmware=bios-256k.bin";
+    m->default_display = "std";
+    m->default_nic = "e1000";
+    m->no_parallel = 1;
+    m->no_floppy = 1;
+    machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
+
+    object_class_property_add_enum(oc, "x-south-bridge", "PCSouthBridgeOption",
+                                   &PCSouthBridgeOption_lookup,
+                                   pc_get_south_bridge,
+                                   pc_set_south_bridge);
+    object_class_property_set_description(oc, "x-south-bridge",
+                                     "Use a different south bridge than PIIX3");
+}
+
+static void pc_i440fx_rhel_machine_10_0_0_options(MachineClass *m)
+{
+    pc_machine_rhel10_options(m);
+
+    m->desc = "RHEL 10.0.0 PC (i440FX + PIIX, 1996)";
+    m->deprecation_reason = rhel_old_machine_deprecation;
+    m->alias = "pc";
+    m->is_default = 1;
+}
+DEFINE_I440FX_MACHINE(10, 0, 0);
+
 /* Options for the latest rhel7 machine type */
 static void pc_machine_rhel7_options(MachineClass *m)
 {
@@ -844,8 +879,6 @@ static void pc_machine_rhel7_options(MachineClass *m)
     m->auto_enable_numa_with_memdev = false;
     machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
     compat_props_add(m->compat_props, pc_rhel_compat, pc_rhel_compat_len);
-    m->alias = "pc";
-    m->is_default = 1;
     m->smp_props.prefer_sockets = true;
 }
 
-- 
2.39.3