Skip to contentSkip to conversation

HPPA: i82596, PS/2 and graphics emulation

PATCH Superseded Sven Schnelle 4 participants 14 messages Nov 3, 2019 – Dec 20, 2019

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#1 lore raw

PATCH v4 1/6 hw/hppa/dino.c: Improve emulation of Dino PCI chip

In reply to Sven Schnelle

From: Helge Deller <[email protected]>

The tests of the dino chip with the Online-diagnostics CD ("ODE DINOTEST") now succeeds.
Additionally add some qemu trace events.

---
 MAINTAINERS          |  2 +-
 hw/hppa/dino.c       | 97 +++++++++++++++++++++++++++++++++++++-------
 hw/hppa/trace-events |  5 +++
 3 files changed, 89 insertions(+), 15 deletions(-)
MAINTAINERS +1 -1
index 92961faa0e..7f8abbddab 100644
@@ -874,7 +874,7 @@ F: hw/*/etraxfs_*.c
 
 HP-PARISC Machines
 ------------------
-Dino
+HP B160L
 M: Richard Henderson <[email protected]>
 R: Helge Deller <[email protected]>
 S: Odd Fixes
hw/hppa/dino.c +83 -14

236 lines not on this page · raw message

hw/hppa/trace-events +5 -0
index 4e2acb6176..f943b16c4e 100644
@@ -2,3 +2,8 @@
 
 # pci.c
 hppa_pci_iack_write(void) ""
+
+# dino.c
+dino_chip_mem_valid(uint64_t addr, uint32_t val) "access to addr 0x%"PRIx64" is %d"
+dino_chip_read(uint64_t addr, uint32_t val) "addr 0x%"PRIx64" val 0x%08x"
+dino_chip_write(uint64_t addr, uint32_t val) "addr 0x%"PRIx64" val 0x%08x"
Signature · 1 line
2.24.0.rc2
#0 lore raw

v4 cover HPPA: i82596, PS/2 and graphics emulation

Hi,

these series adds quite a lot to the HPPA emulation in QEMU:
i82596 emulation from Helge, PS/2 and Artist graphics emulation.

See https://parisc.wiki.kernel.org/index.php/Qemu for a few screenshots of QEMU running a X11/CDE session in HP-UX.

changes in v4:
- introduce Artist-internal address space
- rewrite screen update functions to use the generic framebuffer routines
- use dirty bitmap code to not always redraw the whole screen

Changes in v3:
- use BIT() macro in gsc_to_pci_forwarding()
- fix version id in vm state
- fix an error in the PS/2 KBD_CMD_SET_MAKE_BREAK implementation

Changes in v2:
- dropped 'hppa: remove ISA region' as that patch requires some more work
- added shortlog to seabios update
- use const and MAKE_64BIT_MASK in dino.c

Regards,
Sven

Helge Deller (2):
hw/hppa/dino.c: Improve emulation of Dino PCI chip
hppa: Add support for LASI chip with i82596 NIC

Sven Schnelle (4):
ps2: accept 'Set Key Make and Break' commands
hppa: add emulation of LASI PS2 controllers
hppa: Add emulation of Artist graphics
seabios-hppa: update to latest version

 MAINTAINERS                 |    4 +-
 hw/display/Kconfig          |    4 +
 hw/display/Makefile.objs    |    1 +
 hw/display/artist.c         | 1449 +++++++++++++++++++++++++++++++++++
 hw/display/trace-events     |    9 +
 hw/hppa/Kconfig             |    3 +
 hw/hppa/Makefile.objs       |    2 +-
 hw/hppa/dino.c              |   97 ++-
 hw/hppa/hppa_hardware.h     |    1 +
 hw/hppa/hppa_sys.h          |    2 +
 hw/hppa/lasi.c              |  368 +++++++++
 hw/hppa/machine.c           |   17 +-
 hw/hppa/trace-events        |   10 +
 hw/input/Kconfig            |    3 +
 hw/input/Makefile.objs      |    1 +
 hw/input/lasips2.c          |  289 +++++++
 hw/input/ps2.c              |   15 +
 hw/input/trace-events       |    5 +
 hw/net/Kconfig              |    7 +
 hw/net/Makefile.objs        |    2 +
 hw/net/i82596.c             |  734 ++++++++++++++++++
 hw/net/i82596.h             |   55 ++
 hw/net/lasi_i82596.c        |  188 +++++
 hw/net/trace-events         |   14 +
 include/hw/input/lasips2.h  |   16 +
 include/hw/input/ps2.h      |    1 +
 include/hw/net/lasi_82596.h |   29 +
 pc-bios/hppa-firmware.img   |  Bin 783724 -> 772876 bytes
 roms/seabios-hppa           |    2 +-
 29 files changed, 3310 insertions(+), 18 deletions(-)
 create mode 100644 hw/display/artist.c
 create mode 100644 hw/hppa/lasi.c
 create mode 100644 hw/input/lasips2.c
 create mode 100644 hw/net/i82596.c
 create mode 100644 hw/net/i82596.h
 create mode 100644 hw/net/lasi_i82596.c
 create mode 100644 include/hw/input/lasips2.h
 create mode 100644 include/hw/net/lasi_82596.h
Signature · 1 line
2.24.0.rc2
#4 lore raw

PATCH v4 4/6 hppa: add emulation of LASI PS2 controllers

---
 hw/hppa/Kconfig            |   1 +
 hw/hppa/lasi.c             |  10 +-
 hw/input/Kconfig           |   3 +
 hw/input/Makefile.objs     |   1 +
 hw/input/lasips2.c         | 289 +++++++++++++++++++++++++++++++++++++
 hw/input/ps2.c             |   5 +
 hw/input/trace-events      |   5 +
 include/hw/input/lasips2.h |  16 ++
 include/hw/input/ps2.h     |   1 +
 9 files changed, 330 insertions(+), 1 deletion(-)
 create mode 100644 hw/input/lasips2.c
 create mode 100644 include/hw/input/lasips2.h
hw/hppa/Kconfig +1 -0
index 2a7b38d6d6..7f9be7f25c 100644
@@ -11,3 +11,4 @@ config DINO
     select MC146818RTC
     select LSI_SCSI_PCI
     select LASI_82596
+    select LASIPS2
hw/hppa/lasi.c +9 -1
index 51752589f3..d8d03f95c0 100644
@@ -22,6 +22,7 @@
 #include "hw/net/lasi_82596.h"
 #include "hw/char/parallel.h"
 #include "hw/char/serial.h"
+#include "hw/input/lasips2.h"
 #include "exec/address-spaces.h"
 #include "migration/vmstate.h"
 
@@ -324,6 +325,7 @@ DeviceState *lasi_init(MemoryRegion *address_space)
                      lpt_irq, parallel_hds[0]);
 
     /* Real time clock (RTC), it's only one 32-bit counter @9000 */
+
     s->rtc = time(NULL);
     s->rtc_ref = 0;
 
@@ -333,8 +335,14 @@ DeviceState *lasi_init(MemoryRegion *address_space)
                 lasi_get_irq(LASI_UART_HPA));
         serial_mm_init(address_space, LASI_UART_HPA + 0x800, 0,
                 serial_irq, 8000000 / 16,
-                serial_hd(1), DEVICE_NATIVE_ENDIAN);
+                serial_hd(0), DEVICE_NATIVE_ENDIAN);
     }
+
+    /* PS/2 Keyboard/Mouse */
+    qemu_irq ps2kbd_irq = qemu_allocate_irq(lasi_set_irq, s,
+            lasi_get_irq(LASI_PS2KBD_HPA));
+    lasips2_init(address_space, LASI_PS2KBD_HPA,  ps2kbd_irq);
+
     return dev;
 }
 
hw/input/Kconfig +3 -0
index 287f08887b..25c77a1b87 100644
@@ -41,3 +41,6 @@ config VHOST_USER_INPUT
 
 config TSC210X
     bool
+
+config LASIPS2
+    select PS2
hw/input/Makefile.objs +1 -0
index a1bc502ed0..f98f635685 100644
@@ -15,3 +15,4 @@ common-obj-$(CONFIG_VHOST_USER_INPUT) += vhost-user-input.o
 obj-$(CONFIG_MILKYMIST) += milkymist-softusb.o
 obj-$(CONFIG_PXA2XX) += pxa2xx_keypad.o
 obj-$(CONFIG_TSC210X) += tsc210x.o
+obj-$(CONFIG_LASIPS2) += lasips2.o
hw/input/lasips2.c new file +289 -0

289 lines not on this page · raw message

hw/input/ps2.c +5 -0
index 0b671b6339..f8746d2f52 100644
@@ -192,6 +192,11 @@ static void ps2_reset_queue(PS2State *s)
     q->count = 0;
 }
 
+int ps2_queue_empty(PS2State *s)
+{
+    return s->queue.count == 0;
+}
+
 void ps2_queue_noirq(PS2State *s, int b)
 {
     PS2Queue *q = &s->queue;
hw/input/trace-events +5 -0
index cf072fa2f8..a2888fd10c 100644
@@ -53,3 +53,8 @@ tsc2005_sense(const char *state) "touchscreen sense %s"
 
 # virtio-input.c
 virtio_input_queue_full(void) "queue full"
+
+# lasips2.c
+lasips2_reg_read(unsigned int size, int id, uint64_t addr, const char *name, uint64_t val) "%u %d addr 0x%"PRIx64 "%s -> 0x%"PRIx64
+lasips2_reg_write(unsigned int size, int id, uint64_t addr, const char *name, uint64_t val) "%u %d addr 0x%"PRIx64 "%s <- 0x%"PRIx64
+lasips2_intr(unsigned int val) "%d"
include/hw/input/lasips2.h new file +16 -0
new file mode 100644
index 0000000000..0cd7b59064
@@ -0,0 +1,16 @@
+/*
+ * QEMU LASI PS/2 emulation
+ *
+ * Copyright (c) 2019 Sven Schnelle
+ *
+ */
+#ifndef HW_INPUT_LASIPS2_H
+#define HW_INPUT_LASIPS2_H
+
+#include "exec/hwaddr.h"
+
+#define TYPE_LASIPS2 "lasips2"
+
+void lasips2_init(MemoryRegion *address_space, hwaddr base, qemu_irq irq);
+
+#endif /* HW_INPUT_LASIPS2_H */
include/hw/input/ps2.h +1 -0
index b60455d4f6..35d983897a 100644
@@ -47,5 +47,6 @@ void ps2_queue_3(PS2State *s, int b1, int b2, int b3);
 void ps2_queue_4(PS2State *s, int b1, int b2, int b3, int b4);
 void ps2_keyboard_set_translation(void *opaque, int mode);
 void ps2_mouse_fake_event(void *opaque);
+int ps2_queue_empty(PS2State *s);
 
 #endif /* HW_PS2_H */
Signature · 1 line
2.24.0.rc2
#5 lore raw

PATCH v4 5/6 hppa: Add emulation of Artist graphics

In reply to Sven Schnelle

This adds emulation of Artist graphics good enough to get a Text console on both Linux and HP-UX. The X11 server from HP-UX also works.

---
 hw/display/Kconfig       |    4 +
 hw/display/Makefile.objs |    1 +
 hw/display/artist.c      | 1449 ++++++++++++++++++++++++++++++++++++++
 hw/display/trace-events  |    9 +
 hw/hppa/Kconfig          |    1 +
 hw/hppa/hppa_hardware.h  |    1 +
 hw/hppa/machine.c        |    9 +
 7 files changed, 1474 insertions(+)
 create mode 100644 hw/display/artist.c
hw/display/Kconfig +4 -0
index c500d1fc6d..15d59e10dc 100644
@@ -91,6 +91,10 @@ config TCX
 config CG3
     bool
 
+config ARTIST
+    bool
+    select FRAMEBUFFER
+
 config VGA
     bool
 
hw/display/Makefile.objs +1 -0
index f2182e3bef..5f03dfdcc4 100644
@@ -40,6 +40,7 @@ common-obj-$(CONFIG_SM501) += sm501.o
 common-obj-$(CONFIG_TCX) += tcx.o
 common-obj-$(CONFIG_CG3) += cg3.o
 common-obj-$(CONFIG_NEXTCUBE) += next-fb.o
+common-obj-$(CONFIG_ARTIST) += artist.o
 
 obj-$(CONFIG_VGA) += vga.o
 
hw/display/artist.c new file +1449 -0

1,449 lines not on this page · raw message

hw/display/trace-events +9 -0
index ba7787b180..e6e22bef88 100644
@@ -142,3 +142,12 @@ sii9022_switch_mode(const char *mode) "mode: %s"
 # ati.c
 ati_mm_read(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u 0x%"PRIx64 " %s -> 0x%"PRIx64
 ati_mm_write(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u 0x%"PRIx64 " %s <- 0x%"PRIx64
+
+# artist.c
+artist_reg_read(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u 0x%"PRIx64 "%s -> 0x%"PRIx64
+artist_reg_write(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u 0x%"PRIx64 "%s <- 0x%"PRIx64
+artist_vram_read(unsigned int size, uint64_t addr, int posx, int posy, uint64_t val) "%u 0x%"PRIx64 " %ux%u-> 0x%"PRIx64
+artist_vram_write(unsigned int size, uint64_t addr, uint64_t val) "%u 0x%"PRIx64 " <- 0x%"PRIx64
+artist_fill_window(unsigned int start_x, unsigned int start_y, unsigned int width, unsigned int height, uint32_t op, uint32_t ctlpln) "start=%ux%u length=%ux%u op=0x%08x ctlpln=0x%08x"
+artist_block_move(unsigned int start_x, unsigned int start_y, unsigned int dest_x, unsigned int dest_y, unsigned int width, unsigned int height) "source %ux%u -> dest %ux%u size %ux%u"
+artist_draw_line(unsigned int start_x, unsigned int start_y, unsigned int end_x, unsigned int end_y) "%ux%u %ux%u"
hw/hppa/Kconfig +1 -0
index 7f9be7f25c..82178c7dcb 100644
@@ -12,3 +12,4 @@ config DINO
     select LSI_SCSI_PCI
     select LASI_82596
     select LASIPS2
+    select ARTIST
hw/hppa/hppa_hardware.h +1 -0
index 507f91e05d..4a2fe2df60 100644
@@ -22,6 +22,7 @@
 #define LASI_PS2KBD_HPA 0xffd08000
 #define LASI_PS2MOU_HPA 0xffd08100
 #define LASI_GFX_HPA    0xf8000000
+#define ARTIST_FB_ADDR  0xf9000000
 #define CPU_HPA         0xfffb0000
 #define MEMORY_HPA      0xfffbf000
 
hw/hppa/machine.c +9 -0
index 967738477a..9d0192c4fa 100644
@@ -74,6 +74,7 @@ static void machine_hppa_init(MachineState *machine)
     MemoryRegion *cpu_region;
     long i;
     unsigned int smp_cpus = machine->smp.cpus;
+    SysBusDevice *s;
 
     ram_size = machine->ram_size;
 
@@ -126,6 +127,14 @@ static void machine_hppa_init(MachineState *machine)
     dev = DEVICE(pci_create_simple(pci_bus, -1, "lsi53c895a"));
     lsi53c8xx_handle_legacy_cmdline(dev);
 
+    if (vga_interface_type != VGA_NONE) {
+        dev = qdev_create(NULL, "artist");
+        qdev_init_nofail(dev);
+        s = SYS_BUS_DEVICE(dev);
+        sysbus_mmio_map(s, 0, LASI_GFX_HPA);
+        sysbus_mmio_map(s, 1, ARTIST_FB_ADDR);
+    }
+
     /* Network setup.  e1000 is good enough, failing Tulip support.  */
     for (i = 0; i < nb_nics; i++) {
         if (!enable_lasi_lan()) {
Signature · 1 line
2.24.0.rc2
#3 lore raw

PATCH v4 3/6 ps2: accept 'Set Key Make and Break' commands

In reply to Sven Schnelle

HP-UX sends both the 'Set key make and break (0xfc) and 'Set all key typematic make and break' (0xfa). QEMU response with 'Resend' as it doesn't handle these commands. HP-UX than reports an PS/2 max retransmission exceeded error. Add these commands and just reply with ACK.

---
 hw/input/ps2.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
hw/input/ps2.c +10 -0
index 67f92f6112..0b671b6339 100644
@@ -49,6 +49,8 @@
 #define KBD_CMD_RESET_DISABLE	0xF5	/* reset and disable scanning */
 #define KBD_CMD_RESET_ENABLE   	0xF6    /* reset and enable scanning */
 #define KBD_CMD_RESET		0xFF	/* Reset */
+#define KBD_CMD_SET_MAKE_BREAK  0xFC    /* Set Make and Break mode */
+#define KBD_CMD_SET_TYPEMATIC   0xFA    /* Set Typematic Make and Break mode */
 
 /* Keyboard Replies */
 #define KBD_REPLY_POR		0xAA	/* Power on reset */
@@ -573,6 +575,7 @@ void ps2_write_keyboard(void *opaque, int val)
         case KBD_CMD_SCANCODE:
         case KBD_CMD_SET_LEDS:
         case KBD_CMD_SET_RATE:
+        case KBD_CMD_SET_MAKE_BREAK:
             s->common.write_cmd = val;
             ps2_queue(&s->common, KBD_REPLY_ACK);
             break;
@@ -592,11 +595,18 @@ void ps2_write_keyboard(void *opaque, int val)
                 KBD_REPLY_ACK,
                 KBD_REPLY_POR);
             break;
+        case KBD_CMD_SET_TYPEMATIC:
+            ps2_queue(&s->common, KBD_REPLY_ACK);
+            break;
         default:
             ps2_queue(&s->common, KBD_REPLY_RESEND);
             break;
         }
         break;
+    case KBD_CMD_SET_MAKE_BREAK:
+        ps2_queue(&s->common, KBD_REPLY_ACK);
+        s->common.write_cmd = -1;
+        break;
     case KBD_CMD_SCANCODE:
         if (val == 0) {
             if (s->common.queue.count <= PS2_QUEUE_SIZE - 2) {
Signature · 1 line
2.24.0.rc2
#2 lore raw

PATCH v4 2/6 hppa: Add support for LASI chip with i82596 NIC

In reply to Sven Schnelle

From: Helge Deller <[email protected]>

LASI is a built-in multi-I/O chip which supports serial, parallel, network (Intel i82596 Apricot), sound and other functionalities. LASI has been used in many HP PARISC machines.
This patch adds the necessary parts to allow Linux and HP-UX to detect LASI and the network card.

---
 MAINTAINERS                 |   2 +
 hw/hppa/Kconfig             |   1 +
 hw/hppa/Makefile.objs       |   2 +-
 hw/hppa/hppa_sys.h          |   2 +
 hw/hppa/lasi.c              | 360 ++++++++++++++++++
 hw/hppa/machine.c           |   8 +-
 hw/hppa/trace-events        |   5 +
 hw/net/Kconfig              |   7 +
 hw/net/Makefile.objs        |   2 +
 hw/net/i82596.c             | 734 ++++++++++++++++++++++++++++++++++++
 hw/net/i82596.h             |  55 +++
 hw/net/lasi_i82596.c        | 188 +++++++++
 hw/net/trace-events         |  14 +
 include/hw/net/lasi_82596.h |  29 ++
 14 files changed, 1407 insertions(+), 2 deletions(-)
 create mode 100644 hw/hppa/lasi.c
 create mode 100644 hw/net/i82596.c
 create mode 100644 hw/net/i82596.h
 create mode 100644 hw/net/lasi_i82596.c
 create mode 100644 include/hw/net/lasi_82596.h
MAINTAINERS +2 -0
index 7f8abbddab..c4cdd761ba 100644
@@ -178,6 +178,8 @@ S: Maintained
 F: target/hppa/
 F: hw/hppa/
 F: disas/hppa.c
+F: hw/net/*i82596*
+F: include/hw/net/lasi_82596.h
 
 LM32 TCG CPUs
 M: Michael Walle <[email protected]>
hw/hppa/Kconfig +1 -0
index 6e5d74a825..2a7b38d6d6 100644
@@ -10,3 +10,4 @@ config DINO
     select IDE_CMD646
     select MC146818RTC
     select LSI_SCSI_PCI
+    select LASI_82596
hw/hppa/Makefile.objs +1 -1
index 67838f50a3..eac3467d8a 100644
@@ -1 +1 @@
-obj-$(CONFIG_DINO) += pci.o machine.o dino.o
+obj-$(CONFIG_DINO) += pci.o machine.o dino.o lasi.o
hw/hppa/hppa_sys.h +2 -0
index 43d25d21fc..d99b5dd87b 100644
@@ -11,6 +11,8 @@
 #include "hppa_hardware.h"
 
 PCIBus *dino_init(MemoryRegion *, qemu_irq *, qemu_irq *);
+DeviceState *lasi_init(MemoryRegion *);
+#define enable_lasi_lan()       0
 
 #define TYPE_DINO_PCI_HOST_BRIDGE "dino-pcihost"
 
hw/hppa/lasi.c new file +360 -0

360 lines not on this page · raw message

hw/hppa/machine.c +7 -1
index b30aba6d54..967738477a 100644
@@ -16,6 +16,7 @@
 #include "hw/ide.h"
 #include "hw/timer/i8254.h"
 #include "hw/char/serial.h"
+#include "hw/net/lasi_82596.h"
 #include "hppa_sys.h"
 #include "qemu/units.h"
 #include "qapi/error.h"
@@ -100,6 +101,9 @@ static void machine_hppa_init(MachineState *machine)
                                          "ram", ram_size);
     memory_region_add_subregion(addr_space, 0, ram_region);
 
+    /* Init Lasi chip */
+    lasi_init(addr_space);
+
     /* Init Dino (PCI host bus chip).  */
     pci_bus = dino_init(addr_space, &rtc_irq, &serial_irq);
     assert(pci_bus);
@@ -124,7 +128,9 @@ static void machine_hppa_init(MachineState *machine)
 
     /* Network setup.  e1000 is good enough, failing Tulip support.  */
     for (i = 0; i < nb_nics; i++) {
-        pci_nic_init_nofail(&nd_table[i], pci_bus, "e1000", NULL);
+        if (!enable_lasi_lan()) {
+            pci_nic_init_nofail(&nd_table[i], pci_bus, "e1000", NULL);
+        }
     }
 
     /* Load firmware.  Given that this is not "real" firmware,
hw/hppa/trace-events +5 -0
index f943b16c4e..3ff620319a 100644
@@ -7,3 +7,8 @@ hppa_pci_iack_write(void) ""
 dino_chip_mem_valid(uint64_t addr, uint32_t val) "access to addr 0x%"PRIx64" is %d"
 dino_chip_read(uint64_t addr, uint32_t val) "addr 0x%"PRIx64" val 0x%08x"
 dino_chip_write(uint64_t addr, uint32_t val) "addr 0x%"PRIx64" val 0x%08x"
+
+# lasi.c
+lasi_chip_mem_valid(uint64_t addr, uint32_t val) "access to addr 0x%"PRIx64" is %d"
+lasi_chip_read(uint64_t addr, uint32_t val) "addr 0x%"PRIx64" val 0x%08x"
+lasi_chip_write(uint64_t addr, uint32_t val) "addr 0x%"PRIx64" val 0x%08x"
hw/net/Kconfig +7 -0
index 3856417d42..c03cdfaa9d 100644
@@ -29,6 +29,9 @@ config TULIP
     default y if PCI_DEVICES
     depends on PCI
 
+config I82596_COMMON
+    bool
+
 config E1000_PCI
     bool
     default y if PCI_DEVICES
@@ -87,6 +90,10 @@ config LANCE
     bool
     select PCNET_COMMON
 
+config LASI_82596
+    bool
+    select I82596_COMMON
+
 config SUNHME
     bool
 
hw/net/Makefile.objs +2 -0
index 7907d2c199..19f13e9fa5 100644
@@ -28,6 +28,8 @@ common-obj-$(CONFIG_IMX_FEC) += imx_fec.o
 common-obj-$(CONFIG_CADENCE) += cadence_gem.o
 common-obj-$(CONFIG_STELLARIS_ENET) += stellaris_enet.o
 common-obj-$(CONFIG_LANCE) += lance.o
+common-obj-$(CONFIG_LASI_82596) += lasi_i82596.o
+common-obj-$(CONFIG_I82596_COMMON) += i82596.o
 common-obj-$(CONFIG_SUNHME) += sunhme.o
 common-obj-$(CONFIG_FTGMAC100) += ftgmac100.o
 common-obj-$(CONFIG_SUNGEM) += sungem.o
hw/net/i82596.c new file +734 -0

734 lines not on this page · raw message

hw/net/i82596.h new file +55 -0

55 lines not on this page · raw message

hw/net/lasi_i82596.c new file +188 -0

188 lines not on this page · raw message

hw/net/trace-events +14 -0
index e70f12bee1..922be47f71 100644
@@ -381,3 +381,17 @@ tulip_mii_read(int phy, int reg, uint16_t data) "phy 0x%x, reg 0x%x data 0x%04x"
 tulip_reset(void) ""
 tulip_setup_frame(void) ""
 tulip_setup_filter(int n, uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint8_t e, uint8_t f) "%d: %02x:%02x:%02x:%02x:%02x:%02x"
+
+# lasi_i82596.c
+lasi_82596_mem_readw(uint64_t addr, uint32_t ret) "addr=0x%"PRIx64" val=0x%04x"
+lasi_82596_mem_writew(uint64_t addr, uint32_t val) "addr=0x%"PRIx64" val=0x%04x"
+
+# i82596.c
+i82596_s_reset(void *s) "%p Reset chip"
+i82596_transmit(uint32_t size, uint32_t addr) "size %u from addr 0x%04x"
+i82596_receive_analysis(const char *s) "%s"
+i82596_receive_packet(size_t sz) "len=%zu"
+i82596_new_mac(const char *id_with_mac) "New MAC for: %s"
+i82596_set_multicast(uint16_t count) "Added %d multicast entries"
+i82596_channel_attention(void *s) "%p: Received CHANNEL ATTENTION"
+
include/hw/net/lasi_82596.h new file +29 -0
new file mode 100644
index 0000000000..e76ef8308e
@@ -0,0 +1,29 @@
+/*
+ * QEMU LASI i82596 device emulation
+ *
+ * Copyright (c) 201 Helge Deller <[email protected]>
+ *
+ */
+
+#ifndef LASI_82596_H
+#define LASI_82596_H
+
+#include "net/net.h"
+#include "hw/net/i82596.h"
+
+#define TYPE_LASI_82596 "lasi_82596"
+#define SYSBUS_I82596(obj) \
+    OBJECT_CHECK(SysBusI82596State, (obj), TYPE_LASI_82596)
+
+typedef struct {
+    SysBusDevice parent_obj;
+
+    I82596State state;
+    uint16_t last_val;
+    int val_index:1;
+} SysBusI82596State;
+
+SysBusI82596State *lasi_82596_init(MemoryRegion *addr_space,
+                                    hwaddr hpa, qemu_irq irq);
+
+#endif
Signature · 1 line
2.24.0.rc2
#10 lore raw
In reply to Sven Schnelle
Quoted 5 lines · Sven Schnelle

Hi,

these series adds quite a lot to the HPPA emulation in QEMU:
i82596 emulation from Helge, PS/2 and Artist graphics emulation. [..]

Ping? :-)

Regards
Sven

#11 lore raw
Quoted 8 lines · Sven Schnelle
Quoted 5 lines · Sven Schnelle

Hi,

these series adds quite a lot to the HPPA emulation in QEMU:
i82596 emulation from Helge, PS/2 and Artist graphics emulation. [..]

Ping? :-)

Version 1 missed the 4.2 cutoff by few days. We'll get this merged for 5.0 once development opens.

r~

#12 lore raw
Quoted 4 lines · Richard Henderson
Quoted 3 lines · Sven Schnelle
Quoted 2 lines · Sven Schnelle

Hi,

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

these series adds quite a lot to the HPPA emulation in QEMU:
i82596 emulation from Helge, PS/2 and Artist graphics emulation. [..]

Ping? :-)

Version 1 missed the 4.2 cutoff by few days. We'll get this merged for 5.0 once development opens.

To avoid confusion because we missed qemu 4.2, I've deleted the parisc-qemu-4.2 branch at the parisc-seabios git repo [1]. Instead I've created a parisc-qemu-5.0 branch.
Please use that instead if you push the prebuilt seabios rom and git submodule references.

Helge

[1] https://github.com/hdeller/seabios-hppa/tree/parisc-qemu-5.0

#6 lore raw

Re: [PATCH v4 5/6] hppa: Add emulation of Artist graphics

In reply to Sven Schnelle
Quoted 5 lines · Sven Schnelle

This adds emulation of Artist graphics good enough to get a Text console on both Linux and HP-UX. The X11 server from HP-UX also works.

Quoted 10 lines
---
 hw/display/Kconfig       |    4 +
 hw/display/Makefile.objs |    1 +
 hw/display/artist.c      | 1449 ++++++++++++++++++++++++++++++++++++++
 hw/display/trace-events  |    9 +
 hw/hppa/Kconfig          |    1 +
 hw/hppa/hppa_hardware.h  |    1 +
 hw/hppa/machine.c        |    9 +
 7 files changed, 1474 insertions(+)
 create mode 100644 hw/display/artist.c

Seems to have some problems rebased upon master:

Quoted 32 lines

Thread 6 "qemu-system-hpp" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffee3b6700 (LWP 11752)] 0x00005555558bba54 in artist_rop8 (s=s@entry=0x555556105400,

    dst=dst@entry=0x7fffed740000 "", val=0 '\000')
    at /home/rth/qemu/qemu/hw/display/artist.c:288
288	        *dst |= val & plane_mask;
(gdb) where
#0  0x00005555558bba54 in artist_rop8
    (s=s@entry=0x555556105400, dst=dst@entry=0x7fffed740000 "", val=0 '\000')
    at /home/rth/qemu/qemu/hw/display/artist.c:288
#1  0x00005555558bc145 in vram_bit_write
    (s=s@entry=0x555556105400, posx=<optimized out>, posy=<optimized out>, incr_x=incr_x@entry=false, size=size@entry=4, data=<optimized out>, data@entry=0)
    at /home/rth/qemu/qemu/hw/display/artist.c:430
#2  0x00005555558bd33b in artist_reg_write
    (opaque=0x555556105400, addr=1050144, val=0, size=4)
    at /home/rth/qemu/qemu/hw/display/artist.c:862
#3  0x00005555557b271b in memory_region_write_accessor
    (mr=mr@entry=0x5555561058f0, addr=addr@entry=1050144, value=value@entry=0x7fffee3b4f08, size=size@entry=4, shift=shift@entry=0, mask=mask@entry=4294967295, attrs=...) at /home/rth/qemu/qemu/memory.c:483
#4  0x00005555557b03d3 in access_with_adjusted_size
    (addr=addr@entry=1050144, value=value@entry=0x7fffee3b4f08, size=size@entry=4, access_size_min=<optimized out>, access_size_max=<optimized out>, access_fn=access_fn@entry=
    0x5555557b25f0 <memory_region_write_accessor>, mr=0x5555561058f0, attrs=...) at /home/rth/qemu/qemu/memory.c:539
#5  0x00005555557b4b34 in memory_region_dispatch_write
    (mr=mr@entry=0x5555561058f0, addr=addr@entry=1050144, data=<optimized out>, data@entry=0, op=op@entry=MO_BEUL, attrs=...)
    at /home/rth/qemu/qemu/memory.c:1475
#6  0x00005555557c18ed in io_writex
    (env=env@entry=0x5555563a6b60, mmu_idx=mmu_idx@entry=4, val=val@entry=0, addr=addr@entry=4161799712, retaddr=140736415114886, op=MO_BEUL, iotlbentry=<optimized out>, iotlbentry=<optimized out>)
    at /home/rth/qemu/qemu/accel/tcg/cputlb.c:977
#7  0x00005555557c77bc in store_helper
    (op=MO_BEUL, retaddr=140736415114886, oi=<optimized out>, val=0, addr=4161799712, env=0x5555563a6b60) at /home/rth/qemu/qemu/accel/tcg/cputlb.c:1716
#8  0x00005555557c77bc in helper_be_stl_mmu
    (env=0x5555563a6b60, addr=4161799712, val=0, oi=<optimized out>, retaddr=140736415114886) at /home/rth/qemu/qemu/accel/tcg/cputlb.c:1842

#9 0x00007fffc007a686 in code_gen_buffer ()

#7 lore raw

Re: [PATCH v4 5/6] hppa: Add emulation of Artist graphics

In reply to Richard Henderson
Quoted 17 lines · Richard Henderson
Quoted 5 lines · Sven Schnelle

This adds emulation of Artist graphics good enough to get a Text console on both Linux and HP-UX. The X11 server from HP-UX also works.

Quoted 10 lines
---
 hw/display/Kconfig       |    4 +
 hw/display/Makefile.objs |    1 +
 hw/display/artist.c      | 1449 ++++++++++++++++++++++++++++++++++++++
 hw/display/trace-events  |    9 +
 hw/hppa/Kconfig          |    1 +
 hw/hppa/hppa_hardware.h  |    1 +
 hw/hppa/machine.c        |    9 +
 7 files changed, 1474 insertions(+)
 create mode 100644 hw/display/artist.c
Quoted 35 lines

Seems to have some problems rebased upon master:

Quoted 32 lines

Thread 6 "qemu-system-hpp" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffee3b6700 (LWP 11752)] 0x00005555558bba54 in artist_rop8 (s=s@entry=0x555556105400,

    dst=dst@entry=0x7fffed740000 "", val=0 '\000')
    at /home/rth/qemu/qemu/hw/display/artist.c:288
288	        *dst |= val & plane_mask;
(gdb) where
#0  0x00005555558bba54 in artist_rop8
    (s=s@entry=0x555556105400, dst=dst@entry=0x7fffed740000 "", val=0 '\000')
    at /home/rth/qemu/qemu/hw/display/artist.c:288
#1  0x00005555558bc145 in vram_bit_write
    (s=s@entry=0x555556105400, posx=<optimized out>, posy=<optimized out>, incr_x=incr_x@entry=false, size=size@entry=4, data=<optimized out>, data@entry=0)
    at /home/rth/qemu/qemu/hw/display/artist.c:430
#2  0x00005555558bd33b in artist_reg_write
    (opaque=0x555556105400, addr=1050144, val=0, size=4)
    at /home/rth/qemu/qemu/hw/display/artist.c:862
#3  0x00005555557b271b in memory_region_write_accessor
    (mr=mr@entry=0x5555561058f0, addr=addr@entry=1050144, value=value@entry=0x7fffee3b4f08, size=size@entry=4, shift=shift@entry=0, mask=mask@entry=4294967295, attrs=...) at /home/rth/qemu/qemu/memory.c:483
#4  0x00005555557b03d3 in access_with_adjusted_size
    (addr=addr@entry=1050144, value=value@entry=0x7fffee3b4f08, size=size@entry=4, access_size_min=<optimized out>, access_size_max=<optimized out>, access_fn=access_fn@entry=
    0x5555557b25f0 <memory_region_write_accessor>, mr=0x5555561058f0, attrs=...) at /home/rth/qemu/qemu/memory.c:539
#5  0x00005555557b4b34 in memory_region_dispatch_write
    (mr=mr@entry=0x5555561058f0, addr=addr@entry=1050144, data=<optimized out>, data@entry=0, op=op@entry=MO_BEUL, attrs=...)
    at /home/rth/qemu/qemu/memory.c:1475
#6  0x00005555557c18ed in io_writex
    (env=env@entry=0x5555563a6b60, mmu_idx=mmu_idx@entry=4, val=val@entry=0, addr=addr@entry=4161799712, retaddr=140736415114886, op=MO_BEUL, iotlbentry=<optimized out>, iotlbentry=<optimized out>)
    at /home/rth/qemu/qemu/accel/tcg/cputlb.c:977
#7  0x00005555557c77bc in store_helper
    (op=MO_BEUL, retaddr=140736415114886, oi=<optimized out>, val=0, addr=4161799712, env=0x5555563a6b60) at /home/rth/qemu/qemu/accel/tcg/cputlb.c:1716
#8  0x00005555557c77bc in helper_be_stl_mmu
    (env=0x5555563a6b60, addr=4161799712, val=0, oi=<optimized out>, retaddr=140736415114886) at /home/rth/qemu/qemu/accel/tcg/cputlb.c:1842

#9 0x00007fffc007a686 in code_gen_buffer ()

Richard, the attached patch (for seabios-hppa) fixes it for me.
Can you test as well?
It fixes the sti text column to go out-of-range and thus outside the framebuffer memory.

Helge

src/parisc/sti.c +4 -1
index 7935770..eca79da 100644
@@ -168,5 +168,8 @@ void sti_putc(const char c)
         }
         return;
     }
-    sti_putchar(rom, row, col++, c);
+
+    sti_putchar(rom, row, col, c);
+    if (col < ((sti_glob_cfg.onscreen_x / font->width) - 1))
+	col++;
 }
#8 lore raw

Re: [PATCH v4 5/6] hppa: Add emulation of Artist graphics

Quoted 18 lines · Helge Deller
Quoted 17 lines · Richard Henderson
Quoted 15 lines · Sven Schnelle

This adds emulation of Artist graphics good enough to get a Text console on both Linux and HP-UX. The X11 server from HP-UX also works.

---
 hw/display/Kconfig       |    4 +
 hw/display/Makefile.objs |    1 +
 hw/display/artist.c      | 1449 ++++++++++++++++++++++++++++++++++++++
 hw/display/trace-events  |    9 +
 hw/hppa/Kconfig          |    1 +
 hw/hppa/hppa_hardware.h  |    1 +
 hw/hppa/machine.c        |    9 +
 7 files changed, 1474 insertions(+)
 create mode 100644 hw/display/artist.c
Quoted 7 lines
Quoted 3 lines

Seems to have some problems rebased upon master:

...

Richard, the attached patch (for seabios-hppa) fixes it for me.
Can you test as well?
It fixes the sti text column to go out-of-range and thus outside the framebuffer memory.

The attached patch is even better.
It always wraps to the next line (or scrolls the screen if necessary) if the end of the line has been reached.

Helge

src/parisc/sti.c +5 -0
index 7935770..61e7002 100644
@@ -168,5 +168,10 @@ void sti_putc(const char c)
         }
         return;
     }
+
+    /* wrap to next line or scroll screen if EOL reached */
+    if (col >= ((sti_glob_cfg.onscreen_x / font->width) - 1))
+	sti_putc('\n');
+
     sti_putchar(rom, row, col++, c);
 }
#9 lore raw

Re: [PATCH v4 5/6] hppa: Add emulation of Artist graphics

Hi,

Quoted 38 lines · Helge Deller
Quoted 18 lines · Helge Deller
Quoted 17 lines · Richard Henderson
Quoted 15 lines · Sven Schnelle

This adds emulation of Artist graphics good enough to get a Text console on both Linux and HP-UX. The X11 server from HP-UX also works.

---
 hw/display/Kconfig       |    4 +
 hw/display/Makefile.objs |    1 +
 hw/display/artist.c      | 1449 ++++++++++++++++++++++++++++++++++++++
 hw/display/trace-events  |    9 +
 hw/hppa/Kconfig          |    1 +
 hw/hppa/hppa_hardware.h  |    1 +
 hw/hppa/machine.c        |    9 +
 7 files changed, 1474 insertions(+)
 create mode 100644 hw/display/artist.c
Quoted 7 lines
Quoted 3 lines

Seems to have some problems rebased upon master:

...

Richard, the attached patch (for seabios-hppa) fixes it for me.
Can you test as well?
It fixes the sti text column to go out-of-range and thus outside the framebuffer memory.

The attached patch is even better.
It always wraps to the next line (or scrolls the screen if necessary) if the end of the line has been reached.

Helge

src/parisc/sti.c +0 -0
index 7935770..61e7002 100644

src/parisc/sti.c void sti_putc(const char c) · line 177

Quoted 10 lines
src/parisc/sti.c +5 -0
@@ -168,5 +168,10 @@ void sti_putc(const char c)
         }
         return;
     }
+
+    /* wrap to next line or scroll screen if EOL reached */
+    if (col >= ((sti_glob_cfg.onscreen_x / font->width) - 1))
+	sti_putc('\n');
+
     sti_putchar(rom, row, col++, c);
 }

Besides this, the root cause is the out-of-bounds check in vram_bit_write():
This fixes the crash for me. I'll resend an updated version later. Thanks for helping debugging this issue!

hw/display/artist.c +1 -1
index 1d6c7d5d76..13c770e795 100644
@@ -360,7 +360,7 @@ static void vram_bit_write(ARTISTState *s, int posx, int posy, bool incr_x,
         return;
     }
 
-    if (posy * width + posx > buf->size) {
+    if (posy * width + posx >= buf->size) {
         qemu_log("write outside bounds: wants %dx%d, max size %dx%d\n",
                 posx, posy, width, height);
         return;

Regards
Sven