All of lore.kernel.org
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: peter.maydell@linaro.org, qemu-devel@nongnu.org
Cc: Helge Deller <deller@gmx.de>, Richard Henderson <rth@twiddle.net>
Subject: [PATCH v3 3/8] hw/hppa: Implement proper SeaBIOS version check
Date: Tue,  4 Aug 2020 16:00:51 +0200	[thread overview]
Message-ID: <20200804140056.7690-4-deller@gmx.de> (raw)
In-Reply-To: <20200804140056.7690-1-deller@gmx.de>

It's important that the SeaBIOS hppa firmware is at least at a minimal
level to ensure proper interaction between qemu and firmware.

Implement a proper firmware version check by telling SeaBIOS via the
fw_cfg interface which minimal SeaBIOS version is required by this
running qemu instance. If the firmware detects that it's too old, it
will stop.

Signed-off-by: Helge Deller <deller@gmx.de>
---
 hw/hppa/machine.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index 49155537cd..90aeefe2a4 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -25,6 +25,8 @@

 #define MAX_IDE_BUS 2

+#define MIN_SEABIOS_HPPA_VERSION 1 /* require at least this fw version */
+
 static ISABus *hppa_isa_bus(void)
 {
     ISABus *isa_bus;
@@ -56,6 +58,23 @@ static uint64_t cpu_hppa_to_phys(void *opaque, uint64_t addr)
 static HPPACPU *cpu[HPPA_MAX_CPUS];
 static uint64_t firmware_entry;

+static FWCfgState *create_fw_cfg(MachineState *ms)
+{
+    FWCfgState *fw_cfg;
+    uint64_t val;
+
+    fw_cfg = fw_cfg_init_mem(QEMU_FW_CFG_IO_BASE, QEMU_FW_CFG_IO_BASE + 4);
+    fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, ms->smp.cpus);
+    fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, HPPA_MAX_CPUS);
+    fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, ram_size);
+
+    val = cpu_to_le64(MIN_SEABIOS_HPPA_VERSION);
+    fw_cfg_add_file(fw_cfg, "/etc/firmware-min-version",
+                    g_memdup(&val, sizeof(val)), sizeof(val));
+
+    return fw_cfg;
+}
+
 static void machine_hppa_init(MachineState *machine)
 {
     const char *kernel_filename = machine->kernel_filename;
@@ -118,6 +137,9 @@ static void machine_hppa_init(MachineState *machine)
                        115200, serial_hd(0), DEVICE_BIG_ENDIAN);
     }

+    /* fw_cfg configuration interface */
+    create_fw_cfg(machine);
+
     /* SCSI disk setup. */
     dev = DEVICE(pci_create_simple(pci_bus, -1, "lsi53c895a"));
     lsi53c8xx_handle_legacy_cmdline(dev);
--
2.21.3



  parent reply	other threads:[~2020-08-04 14:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-04 14:00 [PATCH v3 0/8] target-hppa fixes v3 Helge Deller
2020-08-04 14:00 ` [PATCH v3 1/8] hw/hppa: Sync hppa_hardware.h file with SeaBIOS sources Helge Deller
2020-08-04 14:00 ` [PATCH v3 2/8] seabios-hppa: Update to SeaBIOS hppa version 1 Helge Deller
2020-08-04 14:00 ` Helge Deller [this message]
2020-08-04 14:00 ` [PATCH v3 4/8] hw/display/artist.c: fix out of bounds check Helge Deller
2020-08-04 16:40   ` Alexander Bulekov
2020-08-04 14:00 ` [PATCH v3 5/8] hw/hppa/lasi: Don't abort on invalid IMR value Helge Deller
2020-08-04 14:00 ` [PATCH v3 6/8] hw/display/artist: Check offset in draw_line to avoid buffer over-run Helge Deller
2020-08-04 14:00 ` [PATCH v3 7/8] hw/display/artist: Refactor artist_rop8() " Helge Deller
2020-08-04 16:39   ` Alexander Bulekov
2020-08-04 21:20     ` Helge Deller
2020-08-04 22:01       ` Alexander Bulekov
2020-08-05  4:33         ` Alexander Bulekov
2020-08-05 20:44         ` Helge Deller
2020-08-06 15:46           ` Alexander Bulekov
2020-08-09  5:17             ` Helge Deller
2020-08-09 17:17               ` Alexander Bulekov
2020-08-09 19:38                 ` Helge Deller
2020-08-09 19:51                   ` Helge Deller
2020-08-09 23:52                     ` [PATCH v3 7/8] hw/display/artist: Refactor artist_rop8() to avoid buffer over-runy Alexander Bulekov
2020-08-04 14:00 ` [PATCH v3 8/8] hw/display/artist: Prevent out of VRAM buffer accesses Helge Deller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200804140056.7690-4-deller@gmx.de \
    --to=deller@gmx.de \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.