thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-fw_cfg-factor-out-initialization-of-FW_CFG_ID-rev.-n.patch

9ae3a8
From 0dbf3617c8b4dda06460190d4017a5bc605f79d9 Mon Sep 17 00:00:00 2001
9ae3a8
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
9ae3a8
Date: Wed, 13 Dec 2017 13:38:35 +0100
9ae3a8
Subject: [PATCH 04/41] fw_cfg: factor out initialization of FW_CFG_ID (rev.
9ae3a8
 number)
9ae3a8
MIME-Version: 1.0
9ae3a8
Content-Type: text/plain; charset=UTF-8
9ae3a8
Content-Transfer-Encoding: 8bit
9ae3a8
9ae3a8
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
9ae3a8
Message-id: <20171213133912.26176-5-marcandre.lureau@redhat.com>
9ae3a8
Patchwork-id: 78354
9ae3a8
O-Subject: [RHEL-7.5 qemu-kvm PATCH v3 04/41] fw_cfg: factor out initialization of FW_CFG_ID (rev. number)
9ae3a8
Bugzilla: 1411490
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
From: "Gabriel L. Somlo" <somlo@cmu.edu>
9ae3a8
9ae3a8
The fw_cfg documentation says this of the revision key (0x0001, FW_CFG_ID):
9ae3a8
9ae3a8
> A 32-bit little-endian unsigned int, this item is used as an interface
9ae3a8
> revision number, and is currently set to 1 by all QEMU architectures
9ae3a8
> which expose a fw_cfg device.
9ae3a8
9ae3a8
arm/virt doesn't.  It could be argued that that's an error in
9ae3a8
"hw/arm/virt.c"; on the other hand, all of the other fw_cfg providing
9ae3a8
boards set the interface version to 1 manually, despite the device
9ae3a8
coming from the same, shared implementation. Therefore, instead of
9ae3a8
adding
9ae3a8
9ae3a8
    fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
9ae3a8
9ae3a8
to arm/virt, consolidate all such existing calls in the fw_cfg
9ae3a8
initialization code.
9ae3a8
9ae3a8
Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
9ae3a8
Message-Id: <1426789244-26318-1-git-send-email-somlo@cmu.edu>
9ae3a8
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
9ae3a8
(cherry picked from commit 3a5c76baf312d83cb77c8faa72c5f7a477effed0)
9ae3a8
9ae3a8
RHEL: Remove a few extra calls that got removed in upstream
9ae3a8
      commit 6a4e17711442849bf2cc731ccddef5a2a2d92d29.
9ae3a8
9ae3a8
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 hw/i386/pc.c          | 1 -
9ae3a8
 hw/nvram/fw_cfg.c     | 1 +
9ae3a8
 hw/ppc/mac_newworld.c | 1 -
9ae3a8
 hw/ppc/mac_oldworld.c | 1 -
9ae3a8
 hw/sparc/sun4m.c      | 3 ---
9ae3a8
 hw/sparc64/sun4u.c    | 1 -
9ae3a8
 6 files changed, 1 insertion(+), 7 deletions(-)
9ae3a8
9ae3a8
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
9ae3a8
index 1468d50..29d6588 100644
9ae3a8
--- a/hw/i386/pc.c
9ae3a8
+++ b/hw/i386/pc.c
9ae3a8
@@ -625,7 +625,6 @@ static FWCfgState *bochs_bios_init(void)
9ae3a8
      *     the APIC ID, not the "CPU index"
9ae3a8
      */
9ae3a8
     fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)apic_id_limit);
9ae3a8
-    fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
9ae3a8
     fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
9ae3a8
     fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES,
9ae3a8
                      acpi_tables, acpi_tables_len);
9ae3a8
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
9ae3a8
index a33e861..01d4566 100644
9ae3a8
--- a/hw/nvram/fw_cfg.c
9ae3a8
+++ b/hw/nvram/fw_cfg.c
9ae3a8
@@ -506,6 +506,7 @@ FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
9ae3a8
         sysbus_mmio_map(d, 1, data_addr);
9ae3a8
     }
9ae3a8
     fw_cfg_add_bytes(s, FW_CFG_SIGNATURE, (char *)"QEMU", 4);
9ae3a8
+    fw_cfg_add_i32(s, FW_CFG_ID, 1);
9ae3a8
     fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16);
9ae3a8
     fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)(display_type == DT_NOGRAPHIC));
9ae3a8
     fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus);
9ae3a8
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
9ae3a8
index ce44e95..77446d7 100644
9ae3a8
--- a/hw/ppc/mac_newworld.c
9ae3a8
+++ b/hw/ppc/mac_newworld.c
9ae3a8
@@ -416,7 +416,6 @@ static void ppc_core99_init(QEMUMachineInitArgs *args)
9ae3a8
 
9ae3a8
     fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2);
9ae3a8
     fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);
9ae3a8
-    fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
9ae3a8
     fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
9ae3a8
     fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, machine_arch);
9ae3a8
     fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_base);
9ae3a8
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
9ae3a8
index 3acca94..d52a110 100644
9ae3a8
--- a/hw/ppc/mac_oldworld.c
9ae3a8
+++ b/hw/ppc/mac_oldworld.c
9ae3a8
@@ -300,7 +300,6 @@ static void ppc_heathrow_init(QEMUMachineInitArgs *args)
9ae3a8
 
9ae3a8
     fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2);
9ae3a8
     fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);
9ae3a8
-    fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
9ae3a8
     fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
9ae3a8
     fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, ARCH_HEATHROW);
9ae3a8
     fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_base);
9ae3a8
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
9ae3a8
index 7c5b8e7..3c126e0 100644
9ae3a8
--- a/hw/sparc/sun4m.c
9ae3a8
+++ b/hw/sparc/sun4m.c
9ae3a8
@@ -1029,7 +1029,6 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,
9ae3a8
 
9ae3a8
     fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2);
9ae3a8
     fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);
9ae3a8
-    fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
9ae3a8
     fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
9ae3a8
     fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id);
9ae3a8
     fw_cfg_add_i16(fw_cfg, FW_CFG_SUN4M_DEPTH, graphic_depth);
9ae3a8
@@ -1674,7 +1673,6 @@ static void sun4d_hw_init(const struct sun4d_hwdef *hwdef, ram_addr_t RAM_size,
9ae3a8
 
9ae3a8
     fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2);
9ae3a8
     fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);
9ae3a8
-    fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
9ae3a8
     fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
9ae3a8
     fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id);
9ae3a8
     fw_cfg_add_i16(fw_cfg, FW_CFG_SUN4M_DEPTH, graphic_depth);
9ae3a8
@@ -1875,7 +1873,6 @@ static void sun4c_hw_init(const struct sun4c_hwdef *hwdef, ram_addr_t RAM_size,
9ae3a8
 
9ae3a8
     fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2);
9ae3a8
     fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);
9ae3a8
-    fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
9ae3a8
     fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
9ae3a8
     fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id);
9ae3a8
     fw_cfg_add_i16(fw_cfg, FW_CFG_SUN4M_DEPTH, graphic_depth);
9ae3a8
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
9ae3a8
index 5ce5ed6..63447fc 100644
9ae3a8
--- a/hw/sparc64/sun4u.c
9ae3a8
+++ b/hw/sparc64/sun4u.c
9ae3a8
@@ -885,7 +885,6 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
9ae3a8
 
9ae3a8
     fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0);
9ae3a8
     fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);
9ae3a8
-    fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
9ae3a8
     fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
9ae3a8
     fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id);
9ae3a8
     fw_cfg_add_i64(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_entry);
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8