Skip to contentSkip to conversation

target-hppa fixes

GIT PULL Helge Deller 2 participants 7 messages Jul 28, 2020 – Jul 29, 2020

lore
Share & tools
lore
#0 lore raw

Please pull to fix those two bugs in target-hppa:

* Fix the SeaBIOS-hppa firmware build with gcc-10 on Debian

* Fix the following runtime warning with artist framebuffer:
"write outside bounds: wants 1256x1023, max size 1280x1024"

in addition the SeaBIOS-hppa firmware now includes a version check to prevent starting when it's incompatible to the emulated qemu hardware.

Helge

----------------------------------------------------------------

The following changes since commit 3461487523b897d324e8d91f3fd20ed55f849544:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20200727' into staging (2020-07-28 18:43:48 +0100)

are available in the Git repository at:

https://github.com/hdeller/qemu-hppa.git target-hppa

for you to fetch changes up to 9aa10e5543566facf328e76d3b5a4aa9d2b79756:

hw/display/artist.c: fix out of bounds check (2020-07-28 21:17:44 +0200)

----------------------------------------------------------------

Helge Deller (3):
hw/hppa: Sync hppa_hardware.h file with SeaBIOS sources
seabios-hppa: Update to SeaBIOS hppa version 1 hw/hppa: Implement proper SeaBIOS version check

Sven Schnelle (1):
hw/display/artist.c: fix out of bounds check

 hw/display/artist.c       |  18 ++++++------------
 hw/hppa/hppa_hardware.h   |   6 ++++++
 hw/hppa/lasi.c            |   2 --
 hw/hppa/machine.c         |  22 ++++++++++++++++++++++
 pc-bios/hppa-firmware.img | Bin 766136 -> 783144 bytes
 roms/seabios-hppa         |   2 +-
 6 files changed, 35 insertions(+), 15 deletions(-)

--
2.21.3

Helge Deller (3):
hw/hppa: Sync hppa_hardware.h file with SeaBIOS sources
seabios-hppa: Update to SeaBIOS hppa version 1 hw/hppa: Implement proper SeaBIOS version check

Sven Schnelle (1):
hw/display/artist.c: fix out of bounds check

 hw/display/artist.c       |  18 ++++++------------
 hw/hppa/hppa_hardware.h   |   6 ++++++
 hw/hppa/lasi.c            |   2 --
 hw/hppa/machine.c         |  22 ++++++++++++++++++++++
 pc-bios/hppa-firmware.img | Bin 766136 -> 783144 bytes
 roms/seabios-hppa         |   2 +-
 6 files changed, 35 insertions(+), 15 deletions(-)

--
2.21.3

#1 lore raw

[PULL 1/4] hw/hppa: Sync hppa_hardware.h file with SeaBIOS sources

The hppa_hardware.h file is shared with SeaBIOS. Sync it.

---
 hw/hppa/hppa_hardware.h | 6 ++++++
 hw/hppa/lasi.c          | 2 --
 2 files changed, 6 insertions(+), 2 deletions(-)
hw/hppa/hppa_hardware.h +6 -0
index 4a2fe2df60..cdb7fa6240 100644
@@ -17,6 +17,7 @@
 #define LASI_UART_HPA   0xffd05000
 #define LASI_SCSI_HPA   0xffd06000
 #define LASI_LAN_HPA    0xffd07000
+#define LASI_RTC_HPA    0xffd09000
 #define LASI_LPT_HPA    0xffd02000
 #define LASI_AUDIO_HPA  0xffd04000
 #define LASI_PS2KBD_HPA 0xffd08000
@@ -37,10 +38,15 @@
 #define PORT_PCI_CMD    (PCI_HPA + DINO_PCI_ADDR)
 #define PORT_PCI_DATA   (PCI_HPA + DINO_CONFIG_DATA)
 
+/* QEMU fw_cfg interface port */
+#define QEMU_FW_CFG_IO_BASE     (MEMORY_HPA + 0x80)
+
 #define PORT_SERIAL1    (DINO_UART_HPA + 0x800)
 #define PORT_SERIAL2    (LASI_UART_HPA + 0x800)
 
 #define HPPA_MAX_CPUS   8       /* max. number of SMP CPUs */
 #define CPU_CLOCK_MHZ   250     /* emulate a 250 MHz CPU */
 
+#define CPU_HPA_CR_REG  7       /* store CPU HPA in cr7 (SeaBIOS internal) */
+
 #endif
hw/hppa/lasi.c +0 -2
index 19974034f3..ffcbb988b8 100644
@@ -54,8 +54,6 @@
 #define LASI_CHIP(obj) \
     OBJECT_CHECK(LasiState, (obj), TYPE_LASI_CHIP)
 
-#define LASI_RTC_HPA    (LASI_HPA + 0x9000)
-
 typedef struct LasiState {
     PCIHostState parent_obj;
 

--
2.21.3

#2 lore raw

[PULL 3/4] hw/hppa: Implement proper SeaBIOS version check

In reply to Helge Deller

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.

---
 hw/hppa/machine.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
hw/hppa/machine.c +22 -0
index 49155537cd..90aeefe2a4 100644
@@ -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

#3 lore raw

[PULL 4/4] hw/display/artist.c: fix out of bounds check

In reply to Helge Deller

From: Sven Schnelle <[email protected]>

---
 hw/display/artist.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
hw/display/artist.c +6 -12
index 6261bfe65b..46043ec895 100644
@@ -340,14 +340,13 @@ static void vram_bit_write(ARTISTState *s, int posx, int posy, bool incr_x,
 {
     struct vram_buffer *buf;
     uint32_t vram_bitmask = s->vram_bitmask;
-    int mask, i, pix_count, pix_length, offset, height, width;
+    int mask, i, pix_count, pix_length, offset, width;
     uint8_t *data8, *p;
 
     pix_count = vram_write_pix_per_transfer(s);
     pix_length = vram_pixel_length(s);
 
     buf = vram_write_buffer(s);
-    height = buf->height;
     width = buf->width;
 
     if (s->cmap_bm_access) {
@@ -367,20 +366,13 @@ static void vram_bit_write(ARTISTState *s, int posx, int posy, bool incr_x,
         pix_count = size * 8;
     }
 
-    if (posy * width + posx + pix_count > buf->size) {
-        qemu_log("write outside bounds: wants %dx%d, max size %dx%d\n",
-                 posx, posy, width, height);
-        return;
-    }
-
-
     switch (pix_length) {
     case 0:
         if (s->image_bitmap_op & 0x20000000) {
             data &= vram_bitmask;
         }
 
-        for (i = 0; i < pix_count; i++) {
+        for (i = 0; i < pix_count && offset + i < buf->size; i++) {
             artist_rop8(s, p + offset + pix_count - 1 - i,
                         (data & 1) ? (s->plane_mask >> 24) : 0);
             data >>= 1;
@@ -398,7 +390,9 @@ static void vram_bit_write(ARTISTState *s, int posx, int posy, bool incr_x,
         for (i = 3; i >= 0; i--) {
             if (!(s->image_bitmap_op & 0x20000000) ||
                 s->vram_bitmask & (1 << (28 + i))) {
-                artist_rop8(s, p + offset + 3 - i, data8[ROP8OFF(i)]);
+                if (offset + 3 - i < buf->size) {
+                    artist_rop8(s, p + offset + 3 - i, data8[ROP8OFF(i)]);
+                }
             }
         }
         memory_region_set_dirty(&buf->mr, offset, 3);
@@ -420,7 +414,7 @@ static void vram_bit_write(ARTISTState *s, int posx, int posy, bool incr_x,
             break;
         }
 
-        for (i = 0; i < pix_count; i++) {
+        for (i = 0; i < pix_count && offset + i < buf->size; i++) {
             mask = 1 << (pix_count - 1 - i);
 
             if (!(s->image_bitmap_op & 0x20000000) ||

--
2.21.3

#4 lore raw

[PULL 2/4] seabios-hppa: Update to SeaBIOS hppa version 1

In reply to Helge Deller

Changes include:
* Introduce SeaBIOS firmware version check
* Implement QEMU fw_cfg interface support
* Fix endian bug in romfile_loadint()
* gcc-10 compile fix

Required for proper version checking and gcc-10 update on Debian.

---
 pc-bios/hppa-firmware.img | Bin 766136 -> 783144 bytes
 roms/seabios-hppa         |   2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)
pc-bios/hppa-firmware.img binary +0 -0
index 82d98b13536cdc9830edfec5caa33bc5b09ca912..eb11ca12f60453c3b43562853a8a19ca9a30dfcb 100644
GIT binary patch
roms/seabios-hppa +1 -1
index 1630ac7d65..004258352c 160000
@@ -1 +1 @@
-Subproject commit 1630ac7d65c4a09218cc677f1fa56cd5b3140447
+Subproject commit 004258352cd89a30367ccc97f8a0a30f92e42717

--
2.21.3

#5 lore raw
In reply to Helge Deller
Quoted 10 lines · Helge Deller

Please pull to fix those two bugs in target-hppa:

* Fix the SeaBIOS-hppa firmware build with gcc-10 on Debian

* Fix the following runtime warning with artist framebuffer:
"write outside bounds: wants 1256x1023, max size 1280x1024"

in addition the SeaBIOS-hppa firmware now includes a version check to prevent starting when it's incompatible to the emulated qemu hardware.

Hi. I'd rather not take a pull request from somebody who's never submitted one before at rc2 with four patches none of which have been reviewed, I'm afraid.

Richard, you're listed in MAINTAINERS for most of these files, would you mind giving them a look over?

thanks
-- PMM

#6 lore raw
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Helge Deller

Please pull to fix those two bugs in target-hppa:

* Fix the SeaBIOS-hppa firmware build with gcc-10 on Debian

* Fix the following runtime warning with artist framebuffer:
"write outside bounds: wants 1256x1023, max size 1280x1024"

Quoted 6 lines
Quoted 2 lines

in addition the SeaBIOS-hppa firmware now includes a version check to prevent starting when it's incompatible to the emulated qemu hardware.

Hi. I'd rather not take a pull request from somebody who's never submitted one before at rc2 with four patches none of which have been reviewed, I'm afraid.

Sure, your reluctance is understood.

Quoted 2 lines

Richard, you're listed in MAINTAINERS for most of these files, would you mind giving them a look over?

If Richard gives his Ok, it would be really nice if you could apply those.

Thanks!
Helge