Skip to contentSkip to conversation

Hppa serial fix patches

GIT PULL Applied Helge Deller 2 participants 5 messages May 28, 2022

lore
Share & tools
lore

Helge Deller

author Reviewed-by Mark Cave-Ayland
#0 lore raw

The following changes since commit 58b53669e87fed0d70903e05cd42079fbbdbc195:

Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2022-05-25 13:46:29 -0700)

are available in the Git repository at:

https://github.com/hdeller/qemu-hppa.git tags/hppa-serial-fix-pull-request

for you to fetch changes up to 5079892df5f113c7f2b77f53bf7663f6c7bc6be9:

hppa: Fix serial port assignments and pass-through (2022-05-28 12:25:42 +0200)

----------------------------------------------------------------
hppa: Fix serial port pass-through

This series fixes the SeaBIOS-hppa firmware and the serial ports setup code in qemu so that it reflects the real hardware and allows serial port pass-through from the host to guests.

Tested with Linux guests.

v2: Changes suggested by: Mark Cave-Ayland <[email protected]>
- Split out hppa_hardware.h restoration to an own patch
- Drop unneccesary checks for serial_hd(x)

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

Helge Deller (3):
New SeaBIOS-hppa version 6
hppa: Sync contents of hppa_hardware.h header file with SeaBIOS-hppa
hppa: Fix serial port assignments and pass-through

 hw/hppa/hppa_hardware.h   |  10 ++++++++--
 hw/hppa/machine.c         |  22 ++++++++--------------
 pc-bios/hppa-firmware.img | Bin 719040 -> 719368 bytes
 roms/seabios-hppa         |   2 +-
 4 files changed, 17 insertions(+), 17 deletions(-)

--
2.35.3

#1 lore raw

[PULL 2/3] hppa: Sync contents of hppa_hardware.h header file with SeaBIOS-hppa

The hppa_hardware.h header file holds many constants for addresses and offsets which are needed while building the firmware (SeaBIOS-hppa) and while setting up the virtual machine in QEMU.

That's why this header file needs to be in sync between both source code repositories. This patch adds a comment mentioning this dependency at the top of this file and restores some DINO relevant offsets.

---
 hw/hppa/hppa_hardware.h | 6 ++++++
 1 file changed, 6 insertions(+)
hw/hppa/hppa_hardware.h +6 -0
index 8b6b9222cb..3f7627b98f 100644
@@ -1,4 +1,5 @@
 /* HPPA cores and system support chips.  */
+/* Be aware: QEMU and seabios-hppa repositories share this file as-is. */
 
 #ifndef HW_HPPA_HPPA_HARDWARE_H
 #define HW_HPPA_HPPA_HARDWARE_H
@@ -30,6 +31,11 @@
 #define PCI_HPA         DINO_HPA        /* PCI bus */
 #define IDE_HPA         0xf9000000      /* Boot disc controller */
 
+/* offsets to DINO HPA: */
+#define DINO_PCI_ADDR           0x064
+#define DINO_CONFIG_DATA        0x068
+#define DINO_IO_DATA            0x06c
+
 #define PORT_PCI_CMD    (PCI_HPA + DINO_PCI_ADDR)
 #define PORT_PCI_DATA   (PCI_HPA + DINO_CONFIG_DATA)
 

--
2.35.3

#2 lore raw

[PULL 3/3] hppa: Fix serial port assignments and pass-through

In reply to Helge Deller

This fixes the serial ports in the emulation to behave as on original hardware.

On the real hardware, the LASI UART is serial port #0 and the DINO UART is serial port #1. This is fixed in SeaBIOS-hppa firmware v6, which is why at least this firmware version is required.

The serial port addresses in hppa/hppa_hardware.h have to be swapped, and when creating the virtual serial ports the correct port addresses are used.

This patch now for example allows to specify on the qemu command line:
-serial mon:stdio -serial /dev/ttyS4
to use the emulated ttyS0 in the guest for console output, and pass ttyS4 from the host to ttyS1 in the guest.

---
 hw/hppa/hppa_hardware.h |  4 ++--
 hw/hppa/machine.c       | 22 ++++++++--------------
 2 files changed, 10 insertions(+), 16 deletions(-)
hw/hppa/hppa_hardware.h +2 -2
index 3f7627b98f..a5ac3dd0fd 100644
@@ -41,8 +41,8 @@
 
 #define FW_CFG_IO_BASE  0xfffa0000
 
-#define PORT_SERIAL1    (DINO_UART_HPA + 0x800)
-#define PORT_SERIAL2    (LASI_UART_HPA + 0x800)
+#define PORT_SERIAL1    (LASI_UART_HPA + 0x800)
+#define PORT_SERIAL2    (DINO_UART_HPA + 0x800)
 
 #define HPPA_MAX_CPUS   16      /* max. number of SMP CPUs */
 #define CPU_CLOCK_MHZ   250     /* emulate a 250 MHz CPU */
hw/hppa/machine.c +8 -14
index d1e174b1f4..63b9dd2396 100644
@@ -32,7 +32,7 @@
 
 #define MAX_IDE_BUS 2
 
-#define MIN_SEABIOS_HPPA_VERSION 1 /* require at least this fw version */
+#define MIN_SEABIOS_HPPA_VERSION 6 /* require at least this fw version */
 
 #define HPA_POWER_BUTTON (FIRMWARE_END - 0x10)
 
@@ -236,20 +236,14 @@ static void machine_hppa_init(MachineState *machine)
     /* Realtime clock, used by firmware for PDC_TOD call. */
     mc146818_rtc_init(isa_bus, 2000, NULL);
 
-    /* Serial code setup.  */
-    if (serial_hd(0)) {
-        uint32_t addr = DINO_UART_HPA + 0x800;
-        serial_mm_init(addr_space, addr, 0,
-                       qdev_get_gpio_in(dino_dev, DINO_IRQ_RS232INT),
-                       115200, serial_hd(0), DEVICE_BIG_ENDIAN);
-    }
+    /* Serial ports: Lasi and Dino use a 7.272727 MHz clock. */
+    serial_mm_init(addr_space, LASI_UART_HPA + 0x800, 0,
+        qdev_get_gpio_in(lasi_dev, LASI_IRQ_UART_HPA), 7272727 / 16,
+        serial_hd(0), DEVICE_BIG_ENDIAN);
 
-    if (serial_hd(1)) {
-        /* Serial port */
-        serial_mm_init(addr_space, LASI_UART_HPA + 0x800, 0,
-                qdev_get_gpio_in(lasi_dev, LASI_IRQ_UART_HPA), 8000000 / 16,
-                serial_hd(1), DEVICE_BIG_ENDIAN);
-    }
+    serial_mm_init(addr_space, DINO_UART_HPA + 0x800, 0,
+        qdev_get_gpio_in(dino_dev, DINO_IRQ_RS232INT), 7272727 / 16,
+        serial_hd(1), DEVICE_BIG_ENDIAN);
 
     /* Parallel port */
     parallel_mm_init(addr_space, LASI_LPT_HPA + 0x800, 0,

--
2.35.3

#3 lore raw

[PULL 1/3] New SeaBIOS-hppa version 6

In reply to Helge Deller

Staring with SEABIOS_HPPA_VERSION 6 the serial ports are now emulated as on physical hardware, with LASI UART being serial port #0 and DINO UART as serial port #1. On older versions those ports were swapped.

This SeaBIOS-hppa fix is needed to allow fixing the qemu serial pass-through from host to guest.

---
 pc-bios/hppa-firmware.img | Bin 719040 -> 719368 bytes
 roms/seabios-hppa         |   2 +-
 2 files changed, 1 insertion(+), 1 deletion(-)
pc-bios/hppa-firmware.img binary +0 -0
index 392bce072bad607b1baaff0136f35844fa5d439e..b2cbb71ee0f91623d038db04d6900a5ed17472a6 100644
GIT binary patch
roms/seabios-hppa +1 -1
index 17ca7a9998..458626c4c6 160000
@@ -1 +1 @@
-Subproject commit 17ca7a9998c1755d42321cfc0afb5f480f5a58ff
+Subproject commit 458626c4c6441045c0612f24313c7cf1f95e71c6

--
2.35.3

#4 lore raw
In reply to Helge Deller
Quoted 19 lines · Helge Deller

The following changes since commit 58b53669e87fed0d70903e05cd42079fbbdbc195:

   Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging (2022-05-25 13:46:29 -0700)

are available in the Git repository at:

https://github.com/hdeller/qemu-hppa.git tags/hppa-serial-fix-pull-request

for you to fetch changes up to 5079892df5f113c7f2b77f53bf7663f6c7bc6be9:

hppa: Fix serial port assignments and pass-through (2022-05-28 12:25:42 +0200)

----------------------------------------------------------------
hppa: Fix serial port pass-through

This series fixes the SeaBIOS-hppa firmware and the serial ports setup code in qemu so that it reflects the real hardware and allows serial port pass-through from the host to guests.

Quoted 8 lines

Tested with Linux guests.

v2: Changes suggested by: Mark Cave-Ayland <[email protected]>
- Split out hppa_hardware.h restoration to an own patch
- Drop unneccesary checks for serial_hd(x)

Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/7.1 as appropriate.

r~

Quoted 17 lines

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

Helge Deller (3):
New SeaBIOS-hppa version 6
hppa: Sync contents of hppa_hardware.h header file with SeaBIOS-hppa
hppa: Fix serial port assignments and pass-through

  hw/hppa/hppa_hardware.h   |  10 ++++++++--
  hw/hppa/machine.c         |  22 ++++++++--------------
  pc-bios/hppa-firmware.img | Bin 719040 -> 719368 bytes
  roms/seabios-hppa         |   2 +-
  4 files changed, 17 insertions(+), 17 deletions(-)

--
2.35.3