yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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