HPPA: i82596, PS/2 and graphics emulation
PATCH v5 1/6 hw/hppa/dino.c: Improve emulation of Dino PCI chip
In reply to Sven SchnelleFrom: 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
@@ -876,7 +876,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
@@ -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
v5 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 v5:
- fix a buffer overrun in vram_bit_write()
- improve STI line wraparound
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 | 1450 +++++++++++++++++++++++++++++++++++ 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 -> 766136 bytes roms/seabios-hppa | 2 +- 29 files changed, 3311 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
PATCH v5 3/6 ps2: accept 'Set Key Make and Break' commands
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
@@ -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
PATCH v5 4/6 hppa: add emulation of LASI PS2 controllers
In reply to Sven Schnelle--- 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
@@ -11,3 +11,4 @@ config DINO select MC146818RTC select LSI_SCSI_PCI select LASI_82596 + select LASIPS2
hw/hppa/lasi.c +9 -1
@@ -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
@@ -41,3 +41,6 @@ config VHOST_USER_INPUT config TSC210X bool + +config LASIPS2 + select PS2
hw/input/Makefile.objs +1 -0
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH v5 2/6 hppa: Add support for LASI chip with i82596 NIC
In reply to Sven SchnelleFrom: 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
@@ -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
@@ -10,3 +10,4 @@ config DINO select IDE_CMD646 select MC146818RTC select LSI_SCSI_PCI + select LASI_82596
hw/hppa/Makefile.objs +1 -1
@@ -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
@@ -12,6 +12,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
@@ -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"
@@ -101,6 +102,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);
@@ -125,7 +129,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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
PATCH v5 5/6 hppa: Add emulation of Artist graphics
In reply to Sven SchnelleThis 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 | 1450 ++++++++++++++++++++++++++++++++++++++ hw/display/trace-events | 9 + hw/hppa/Kconfig | 1 + hw/hppa/hppa_hardware.h | 1 + hw/hppa/machine.c | 9 + 7 files changed, 1475 insertions(+) create mode 100644 hw/display/artist.c
hw/display/Kconfig +4 -0
@@ -91,6 +91,10 @@ config TCX config CG3 bool +config ARTIST + bool + select FRAMEBUFFER + config VGA bool
hw/display/Makefile.objs +1 -0
@@ -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 +1450 -0
1,450 lines not on this page · raw message
hw/display/trace-events +9 -0
@@ -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
@@ -12,3 +12,4 @@ config DINO select LSI_SCSI_PCI select LASI_82596 select LASIPS2 + select ARTIST
hw/hppa/hppa_hardware.h +1 -0
@@ -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
@@ -75,6 +75,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;
@@ -127,6 +128,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
PATCH v5 6/6 seabios-hppa: update to latest version
In reply to Sven SchnelleHelge Deller (13):
Add PDC_MEM_MAP and ENTRY_INIT_SRCH_FRST for OSF/MkLinux
Return non-existant BTLB for PDC_BLOCK_TLB
Add serial, parallel and LAN port support of LASI chip
Implement ENTRY_IO_BBLOCK_IN IODC function
Do not print \r on parisc SeaBIOS
Fix serial ports and add PDC_MODEL functions for special instructions enablement Implement SeaBIOS returning additional addresses. Fixes HP-UX boot. Fix mod_pgs (number of pages) for graphic cards
Merge pull request #3 from svenschnelle/sti
Merge pull request #4 from svenschnelle/parisc-qemu-4.1.0
parisc: Implement PDC rendenzvous
parisc: Improve soft power button emulation
parisc: Fix line wrapping in STI console code
Sven Schnelle (7):
parisc: fix PDC info for graphics adapter
parisc: add missing header guard to hppa.h
parisc: add LASI PS/2 emulation.
parisc: Add STI support
parisc: wire up graphics console
parisc: Add support for setting STI screen resolution
parisc: support LASI RTC register
Required for STI and LASI support. Also adds a few Bugfixes.
--- pc-bios/hppa-firmware.img | Bin 783724 -> 766136 bytes roms/seabios-hppa | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-)
pc-bios/hppa-firmware.img binary +0 -0
roms/seabios-hppa +1 -1
@@ -1 +1 @@ -Subproject commit 0f4fe84658165e96ce35870fd19fc634e182e77b +Subproject commit 1630ac7d65c4a09218cc677f1fa56cd5b3140447
Signature · 1 line
2.24.0
* Sven Schnelle <[email protected]>:
Quoted 5 lines
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.
Sadly those screenshots were dropped by mistake in the last kernel wiki migration. It's being worked on to restore them...
Sven or Richard, can you please on top of the patches sent by Sven, include the next two patches as well? They fix up the serial console when booting into Linux with the "-nographic" qemu option, and the second patch switches to tulip network card instead of the e1000.
Helge
PATCH 1/2 hppa: Do not enable artist graphics with -nographic option
When qemu was started with the -nographic option, do not enable the artist graphic card emulation.
hw/hppa/machine.c +1 -1
@@ -127,7 +127,7 @@ 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 ) { +if (machine->enable_graphics && vga_interface_type !=VGA_NONE ) { dev =qdev_create (NULL ,"artist" );qdev_init_nofail (dev); s =SYS_BUS_DEVICE (dev);
PATCH 2/2 hppa: Switch to tulip NIC by default
In reply to Helge DellerMost HP PA-RISC machines have a Digital DS21142/43 Tulip network card, only some very latest generation machines have an e1000 NIC. Since qemu now provides an emulated tulip card, use that one instead.
hw/hppa/machine.c +2 -2
@@ -135,10 +135,10 @@ static void machine_hppa_init(MachineState *machine)sysbus_mmio_map (s,1 ,ARTIST_FB_ADDR ); } -/* Network setup. e1000 is good enough, failing Tulip support. */ +/* Network setup. */ for (i =0 ; i < nb_nics; i++) {if (!enable_lasi_lan ()) { -pci_nic_init_nofail (&nd_table[i], pci_bus,"e1000" ,NULL ); +pci_nic_init_nofail (&nd_table[i], pci_bus,"tulip" ,NULL ); } }
Re: [PATCH 1/2] hppa: Do not enable artist graphics with -nographic option
In reply to Helge DellerHi Helge,
Quoted 2 lines · Helge Deller
When qemu was started with the -nographic option, do not enable the artist graphic card emulation.
Hmm, isn't '-nographic -vnc' a valid option that wouldn't work anymore in that case? I used '-nographic -vga none' to disable Artist.
Regards
Sven
Re: [PATCH 1/2] hppa: Do not enable artist graphics with -nographic option
Hi Sven,
Quoted 5 lines · Sven Schnelle
Quoted 2 lines · Helge Deller
When qemu was started with the -nographic option, do not enable the artist graphic card emulation.
Hmm, isn't '-nographic -vnc' a valid option that wouldn't work anymore in that case?
You don't need the "-nographic" then, just use the "-vnc" parameter.
Quoted 1 line
I used '-nographic -vga none' to disable Artist.
With my patch "-nographic" is sufficient and behaves as the help says:
-nographic disable graphical output and redirect serial I/Os to console
Helge
Re: [PATCH v5 6/6] seabios-hppa: update to latest version
In reply to Sven SchnelleQuoted 24 lines · Sven Schnelle
Helge Deller (13):
AddPDC_MEM_MAPandENTRY_INIT_SRCH_FRSTfor OSF/MkLinux
Return non-existant BTLB forPDC_BLOCK_TLB
Add serial, parallel and LAN port support of LASI chip
ImplementENTRY_IO_BBLOCK_INIODC function
Do not print \r on parisc SeaBIOS
Fix serial ports and addPDC_MODELfunctions for special instructions enablement Implement SeaBIOS returning additional addresses. Fixes HP-UX boot. Fixmod_pgs(number of pages) for graphic cards
Merge pull request #3 from svenschnelle/sti
Merge pull request #4 from svenschnelle/parisc-qemu-4.1.0
parisc: Implement PDC rendenzvous
parisc: Improve soft power button emulation
parisc: Fix line wrapping in STI console codeSven Schnelle (7):
parisc: fix PDC info for graphics adapter
parisc: add missing header guard tohppa.h
parisc: add LASI PS/2 emulation.
parisc: Add STI support
parisc: wire up graphics console
parisc: Add support for setting STI screen resolution
parisc: support LASI RTC register
Quoted 7 lines
Required for STI and LASI support. Also adds a few Bugfixes.
Signed-off-by Sven Schnelle <[email protected]>--- pc-bios/hppa-firmware.img | Bin 783724 -> 766136 bytes roms/seabios-hppa | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-)
Odd, MTA from work refused to deliver this patch because it "might contains virus" =)
Since you share url of repository with content, you can send your series with git-format-patch --no-binary.
Re: [PATCH v5 5/6] hppa: Add emulation of Artist graphics
In reply to Sven SchnelleQuoted 16 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.
Signed-off-by Sven Schnelle <[email protected]>--- hw/display/Kconfig | 4 + hw/display/Makefile.objs | 1 + hw/display/artist.c | 1450 ++++++++++++++++++++++++++++++++++++++ hw/display/trace-events | 9 + hw/hppa/Kconfig | 1 + hw/hppa/hppa_hardware.h | 1 + hw/hppa/machine.c | 9 + 7 files changed, 1475 insertions(+) create mode 100644 hw/display/artist.c
[...]
Quoted 25 lines
hw/hppa/hppa_hardware.h +1
-0@@ -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 0xfffbf000hw/hppa/machine.c +1
-0@@ -75,6 +75,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;
hw/hppa/machine.c static void machine_hppa_init(MachineState *machine) · line 136
Quoted 9 lines
hw/hppa/machine.c +6
-0@@ -127,6 +128,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 );
How is this chipset connected on the board?
If it is a card you can plug on a bus, you can use a condition. If it is soldered or part of another chipset, then it has to be mapped unconditionally.
IOW I think you should drop the 'if (vga_interface_type != VGA_NONE)' check.
Quoted 6 lines
hw/hppa/machine.c +2
-0+ } +/* Network setup. e1000 is good enough, failing Tulip support. */ for (i =0 ; i < nb_nics; i++) {if (!enable_lasi_lan ()) {
Re: [PATCH v5 5/6] hppa: Add emulation of Artist graphics
Hi Philippe,
Quoted 8 lines · Philippe Mathieu-Daudé
hw/hppa/machine.c static void machine_hppa_init(MachineState *machine) · line 136
Quoted 7 lines
hw/hppa/machine.c +6
-0+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 );
Quoted 4 lines
How is this chipset connected on the board?
If it is a card you can plug on a bus, you can use a condition. If it is soldered or part of another chipset, then it has to be mapped unconditionally.
Depends on the Model. Hp 9000 712 and 715 had it onboard, for the B160L we're emulating and others it was a GSC add-on card.
Regards
Sven
Re: [PATCH v5 5/6] hppa: Add emulation of Artist graphics
Quoted 11 lines · Sven Schnelle
Hi Philippe,
Quoted 8 lines · Philippe Mathieu-Daudé
Quoted 7 lines
hw/hppa/machine.c +6
-0+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 );
Quoted 7 lines
Quoted 4 lines
How is this chipset connected on the board?
If it is a card you can plug on a bus, you can use a condition. If it is soldered or part of another chipset, then it has to be mapped unconditionally.Depends on the Model. Hp 9000 712 and 715 had it onboard, for the B160L we're emulating and others it was a GSC add-on card.
The B160L case is unclear, do you mean this is not the chipset on the machine, but the software is happy if another chipset is available?
Looking at hw/hppa/ I only see one machine:
static void machine_hppa_machine_init(MachineClass *mc)
{
mc->desc = "HPPA generic machine";
...
}
DEFINE_MACHINE("hppa", machine_hppa_machine_init)Are you saying this generic machine is able to run different physical hw? Why not add them? This shouldn't take long and it would be clearer, what do you think?
Adding different machines here in QEMU mostly mean add a class which declare the different properties used by each machine. Igor Mammedov recently suggested to follow the example of aspeed_machine_types[] in hw/arm/aspeed.c.
Re: [PATCH v5 5/6] hppa: Add emulation of Artist graphics
Quoted 30 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Sven Schnelle
Hi Philippe,
Quoted 7 lines · Philippe Mathieu-Daudé
Quoted 6 lines
+ 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);Quoted 7 lines
Quoted 4 lines
How is this chipset connected on the board?
If it is a card you can plug on a bus, you can use a condition. If it is soldered or part of another chipset, then it has to be mapped unconditionally.Depends on the Model. Hp 9000 712 and 715 had it onboard, for the B160L we're emulating and others it was a GSC add-on card.
The B160L case is unclear, do you mean this is not the chipset on the machine, but the software is happy if another chipset is available?
Looking at hw/hppa/ I only see one machine:
static void
machine_hppa_machine_init(MachineClass *mc){
mc->desc= "HPPA generic machine";
...
}
DEFINE_MACHINE("hppa", machine_hppa_machine_init)
Quoted 3 lines
Are you saying this generic machine is able to run different physical hw? Why not add them? This shouldn't take long and it would be clearer, what do you think?
Adding different machines here in QEMU mostly mean add a class which declare the different properties used by each machine. Igor Mammedov recently suggested to follow the example of aspeed_machine_types[] in
hw/arm/aspeed.c.
Yes, we plan to add specific machines like 712 (or 715), and maybe a C3000 or B2000 over time, as needed device emulations (e.g. tulip, artist) gets accepted.
But for that it would be very beneficial if changes (like the Artist emulation here in this thread) would be accepted faster upstream....
Helge
Richard Henderson
AppliedQuoted 32 lines · Sven Schnelle
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 v5:
- fix a buffer overrun invram_bit_write()
- improve STI line wraparoundChanges 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 screenChanges in v3:
- useBIT()macro ingsc_to_pci_forwarding()
- fix version id in vm state
- fix an error in the PS/2KBD_CMD_SET_MAKE_BREAKimplementationChanges in v2:
- dropped 'hppa: remove ISA region' as that patch requires some more work
- added shortlog to seabios update
- use const andMAKE_64BIT_MASKindino.cRegards,
SvenHelge Deller (2):
hw/hppa/dino.c: Improve emulation of Dino PCI chip
hppa: Add support for LASI chip with i82596 NIC
Quoted 5 lines
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
Queued these 6. I squashed Helge's -nographics fix into patch 5.
I cannot get my debian 8 install to boot to a prompt with the artist graphics enabled. I'm not sure if I need a newer kernel or what. But it doesn't do nothing either, so I'm a bit confused.
However, I have validated a boot of hpux-11.11, so any refinements that might be required should be incremental.
r~
Re: [PATCH 1/2] hppa: Do not enable artist graphics with -nographic option
In reply to Helge DellerQuoted 4 lines · Helge Deller
When qemu was started with the -nographic option, do not enable the artist graphic card emulation.
Signed-off-by Helge Deller <[email protected]>
Squashed into Sven's patch.
r~
Richard Henderson
AppliedRe: [PATCH 2/2] hppa: Switch to tulip NIC by default
In reply to Helge DellerQuoted 5 lines · Helge Deller
Most HP PA-RISC machines have a Digital DS21142/43 Tulip network card, only some very latest generation machines have an e1000 NIC. Since qemu now provides an emulated tulip card, use that one instead.
Signed-off-by Helge Deller <[email protected]>
Queued, thanks.
r~
Quoted 33 lines · Richard Henderson
Quoted 32 lines · Sven Schnelle
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 v5:
- fix a buffer overrun invram_bit_write()
- improve STI line wraparoundChanges 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 screenChanges in v3:
- useBIT()macro ingsc_to_pci_forwarding()
- fix version id in vm state
- fix an error in the PS/2KBD_CMD_SET_MAKE_BREAKimplementationChanges in v2:
- dropped 'hppa: remove ISA region' as that patch requires some more work
- added shortlog to seabios update
- use const andMAKE_64BIT_MASKindino.cRegards,
SvenHelge Deller (2):
hw/hppa/dino.c: Improve emulation of Dino PCI chip
hppa: Add support for LASI chip with i82596 NIC
Quoted 7 lines
Quoted 5 lines
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 versionQueued these 6. I squashed Helge's -nographics fix into patch 5.
Thank you Richard!
Quoted 3 lines
I cannot get my debian 8 install to boot to a prompt with the artist graphics enabled. I'm not sure if I need a newer kernel or what. But it doesn't do nothing either, so I'm a bit confused.
I think it should work out of the box and the kernel should be OK, because stifb has been in there for long time.
Do you maybe have "stifb=off or sticon=off" in the kernel commmand line? Did you enabled a getty for tty0 in etc/inittab ?
What does dmesg say?
Is "/proc/fb0" device there ?
I'm happy to look into it, if you can provide me your image for download somewhere...
Helge
Re: [PATCH v5 5/6] hppa: Add emulation of Artist graphics
In reply to Helge DellerQuoted 33 lines · Helge Deller
Quoted 32 lines · Philippe Mathieu-Daudé
Quoted 10 lines · Sven Schnelle
Hi Philippe,
Quoted 7 lines · Philippe Mathieu-Daudé
Quoted 6 lines
+ if (
vga_interface_type!=VGA_NONE) {hw/hppa/machine.c +5
-0+ 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 );Quoted 7 lines
Quoted 4 lines
How is this chipset connected on the board?
If it is a card you can plug on a bus, you can use a condition. If it is soldered or part of another chipset, then it has to be mapped unconditionally.Depends on the Model. Hp 9000 712 and 715 had it onboard, for the B160L we're emulating and others it was a GSC add-on card.
The B160L case is unclear, do you mean this is not the chipset on the machine, but the software is happy if another chipset is available?
Looking at hw/hppa/ I only see one machine:
static void machine_hppa_machine_init(MachineClass *mc) { mc->desc = "HPPA generic machine"; ... } DEFINE_MACHINE("hppa", machine_hppa_machine_init)Are you saying this generic machine is able to run different physical hw? Why not add them? This shouldn't take long and it would be clearer, what do you think?
Quoted 7 lines
Quoted 1 line
Adding different machines here in QEMU mostly mean add a class which declare the different properties used by each machine. Igor Mammedov recently suggested to follow the example of aspeed_machine_types[] in
hw/arm/aspeed.c.Yes, we plan to add specific machines like 712 (or 715), and maybe a C3000 or B2000 over time, as needed device emulations (e.g. tulip, artist) gets accepted.
But for that it would be very beneficial if changes (like the Artist emulation here in this thread) would be accepted faster upstream....
IMHO the HPPA patches are merged quicker than various other subsystems... From the cover, this series contains "3311 insertions". If you do the ratio lines per patch / time for a patch to get accepted, you are not that bad ;)
To be constructive, how do you think we can improve? Looking at the git history, except global refactors, I see only 3 contributors, Richard (who merges your patches), you and Sven. 2 users so far, + Richard as tester.
Re: [PATCH v5 4/6] hppa: add emulation of LASI PS2 controllers
In reply to Sven SchnelleHi Sven,
Quoted 20 lines · Sven Schnelle
Signed-off-by Sven Schnelle <[email protected]>--- 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 100644include/hw/input/lasips2.hhw/hppa/Kconfig +0
-0
hw/hppa/Kconfig config DINO · line 14
Quoted 4 lines
hw/hppa/Kconfig +1
-0@@ -11,3 +11,4 @@ config DINO select MC146818RTC select LSI_SCSI_PCI select LASI_82596 + select LASIPS2
If these components are part of the LASI chipset, you don't need an specific Kconfig entry for each, you can simply use the LASI one.
Add a LASI entry in hw/hppa/Kconfig such:
config LASI
bool
select I82596_COMMON
select PS2If you disagree, can you rename LASIPS2 -> LASI_PS2?
Quoted 88 lines
hw/hppa/lasi.c +9
-1@@ -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@@ -41,3 +41,6 @@ config VHOST_USER_INPUT config TSC210X bool + +config LASIPS2 + select PS2hw/input/Makefile.objs +1
-0@@ -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.ohw/input/lasips2.c new file +26
-0@@ -0,0 +1,289 @@ +/* +* QEMU HP Lasi PS/2 interface emulation +* +* Copyright (c) 2019 Sven Schnelle +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +* THE SOFTWARE. +*/ +#include "qemu/osdep.h" +#include "qemu/log.h" +#include "hw/qdev-properties.h"
hw/input/lasips2.c line 36
Quoted 10 lines
hw/input/lasips2.c new file +10
-0+#include "hw/hw.h" +#include "hw/input/ps2.h" +#include "hw/input/lasips2.h" +#include "hw/sysbus.h" +#include "exec/hwaddr.h" +#include "sysemu/sysemu.h" +#include "trace.h" +#include "exec/address-spaces.h" +#include "migration/vmstate.h" +#include "hw/irq.h"
<newline>
Quoted 11 lines
hw/input/lasips2.c new file +11
-0+struct LASIPS2State ; +typedef struct LASIPS2Port { +struct LASIPS2State *parent; +MemoryRegion reg; +void *dev; +uint8_t id; +uint8_t control; +uint8_t buf; +bool loopback_rbne; +bool irq; +}LASIPS2Port ;
[...]
Re: [PATCH v5 4/6] hppa: add emulation of LASI PS2 controllers
Quoted 29 lines · Philippe Mathieu-Daudé
Quoted 20 lines · Sven Schnelle
Signed-off-by Sven Schnelle <[email protected]>--- 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 100644include/hw/input/lasips2.hhw/hppa/Kconfig +0
-0hw/hppa/Kconfig config DINO · line 14
Quoted 4 lines
hw/hppa/Kconfig +1
-0@@ -11,3 +11,4 @@ config DINO select MC146818RTC select LSI_SCSI_PCI select LASI_82596 + select LASIPS2If these components are part of the LASI chipset, you don't need an specific
Kconfigentry for each, you can simply use the LASI one.
Quoted 7 lines
Add a LASI entry in hw/hppa/Kconfig such:
config LASI
bool select I82596_COMMON select PS2
I'll send a patch as soon as this series is merged - that's easier than resending the whole series.
Regards
Sven
Re: [PATCH v5 1/6] hw/hppa/dino.c: Improve emulation of Dino PCI chip
In reply to Sven SchnelleHi Sven, Helge.
Quoted 51 lines · 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.Signed-off-by Helge Deller <[email protected]>Signed-off-by Sven Schnelle <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>--- MAINTAINERS | 2 +- hw/hppa/dino.c | 97 +++++++++++++++++++++++++++++++++++++------- hw/hppa/trace-events | 5 +++ 3 files changed, 89 insertions(+), 15 deletions(-)MAINTAINERS +1
-1@@ -876,7 +876,7 @@ F: hw/*/etraxfs_*.c HP-PARISC Machines ------------------ -Dino +HP B160L M: Richard Henderson <[email protected]> R: Helge Deller <[email protected]> S: Odd Fixeshw/hppa/dino.c +3
-2@@ -1,7 +1,7 @@/* -* HP-PARISC Dino PCI chipset emulation. +* HP-PARISC Dino PCI chipset emulation, as in B160L and similiar machines * -* (C) 2017 by Helge Deller <[email protected]> +* (C) 2017-2019 by Helge Deller <[email protected]> * * This work is licensed under the GNU GPL license version 2 or later. * @@ -21,6 +21,7 @@#include "migration/vmstate.h" #include "hppa_sys.h" #include "exec/address-spaces.h" +#include "trace.h" #define TYPE_DINO_PCI_HOST_BRIDGE "dino-pcihost"
hw/hppa/dino.c line 86
Quoted 4 lines
hw/hppa/dino.c +1
-0@@ -82,11 +83,28 @@#define DINO_PCI_HOST_BRIDGE (obj) \ OBJECT_CHECK(DinoState, (obj), TYPE_DINO_PCI_HOST_BRIDGE) +#define DINO800_REGS ((DINO_TLTIM - DINO_GMASK) / 4)
Coverity noticed (CID 1419394) this should be '(1 + (DINO_TLTIM - DINO_GMASK) / 4)' (13 registers).
hw/hppa/dino.c line 94
Quoted 8 lines
hw/hppa/dino.c +8
-0+static const uint32_t reg800_keep_bits[DINO800_REGS ] = { +MAKE_64BIT_MASK (0 ,1 ), +MAKE_64BIT_MASK (0 ,7 ), +MAKE_64BIT_MASK (0 ,7 ), +MAKE_64BIT_MASK (0 ,8 ), +MAKE_64BIT_MASK (0 ,7 ), +MAKE_64BIT_MASK (0 ,9 ), +MAKE_64BIT_MASK (0 ,32 ),
Looking at the datasheet pp. 30, this register is 'Undefined'. We should report GUEST_ERROR if it is accessed.
hw/hppa/dino.c line 97
Quoted 3 lines
hw/hppa/dino.c +3
-0+MAKE_64BIT_MASK (0 ,8 ), +MAKE_64BIT_MASK (0 ,30 ), + MAKE_64BIT_MASK(0, 25),
Still looking at the datasheet (pp. 37) PCIROR is 24-bit (not 25).
hw/hppa/dino.c line 98
Quoted 1 line
hw/hppa/dino.c +1
-0+ MAKE_64BIT_MASK(0, 22),
Here you are missing register 0x82c...
hw/hppa/dino.c line 101
Quoted 3 lines
hw/hppa/dino.c +3
-0+ MAKE_64BIT_MASK(0, 9), +}; +
Altogether:
static const uint32_t reg800_keep_bits[DINO800_REGS] = {
MAKE_64BIT_MASK(0, 1), /* GMASK */
MAKE_64BIT_MASK(0, 7), /* PAMR */
MAKE_64BIT_MASK(0, 7), /* PAPR */
MAKE_64BIT_MASK(0, 8), /* DAMODE */
MAKE_64BIT_MASK(0, 7), /* PCICMD */
MAKE_64BIT_MASK(0, 9), /* PCISTS */
MAKE_64BIT_MASK(0, 0), /* Undefined */
MAKE_64BIT_MASK(0, 8), /* MLTIM */
MAKE_64BIT_MASK(0, 30), /* BRDG_FEAT */
MAKE_64BIT_MASK(0, 24), /* PCIROR */
MAKE_64BIT_MASK(0, 22), /* PCIWOR */
MAKE_64BIT_MASK(0, 0), /* Undocumented */
MAKE_64BIT_MASK(0, 9), /* TLTIM */
};Quoted 151 lines
hw/hppa/dino.c +49
-8typedef struct DinoState { PCIHostState parent_obj; /* PCI_CONFIG_ADDR is parent_obj.config_reg, via pci_host_conf_be_ops, so that we can map PCI_CONFIG_DATA to pci_host_data_be_ops. */ + uint32_t config_reg_dino; /* keep original copy, including 2 lowest bits */ uint32_t iar0; uint32_t iar1;@@ -94,8 +112,12 @@ typedef struct DinoState {uint32_t ipr;uint32_t icr;uint32_t ilr; +uint32_t io_fbb_en;uint32_t io_addr_en;uint32_t io_control; +uint32_t toc_addr; + +uint32_t reg800[DINO800_REGS ];MemoryRegion this_mem;MemoryRegion pci_mem;@@ -106,8 +128,6 @@ typedef struct DinoState {MemoryRegion bm_ram_alias;MemoryRegion bm_pci_alias;MemoryRegion bm_cpu_alias; - -MemoryRegion cpu0_eir_mem; } DinoState;/* @@ -122,6 +142,8 @@ static void gsc_to_pci_forwarding(DinoState *s) tmp =extract32 (s->io_control,7 ,2 ); enabled = (tmp ==0x01 ); io_addr_en = s->io_addr_en; +/* Mask out first (=firmware) and last (=Dino) areas. */ + io_addr_en &= ~(BIT (31 ) |BIT (0 ));memory_region_transaction_begin ();for (i =1 ; i <31 ; i++) {@@ -142,6 +164,8 @@ static bool dino_chip_mem_valid(void *opaque, hwaddr addr, unsigned size, bool is_write, MemTxAttrs attrs) { + bool ret = false; +switch (addr) {case DINO_IAR0 :case DINO_IAR1 :@@ -152,16 +176,22 @@ static bool dino_chip_mem_valid(void *opaque, hwaddr addr,case DINO_ICR :case DINO_ILR :case DINO_IO_CONTROL : +case DINO_IO_FBB_EN :case DINO_IO_ADDR_EN :case DINO_PCI_IO_DATA : -return true; +case DINO_TOC_ADDR : + case DINO_GMASK ... DINO_TLTIM: + ret = true; +break ;case DINO_PCI_IO_DATA +2 : -return size <=2 ; + ret = (size <=2 ); +break ;case DINO_PCI_IO_DATA +1 :case DINO_PCI_IO_DATA +3 : -return size ==1 ; + ret = (size ==1 ); } -return false; +trace_dino_chip_mem_valid (addr, ret); +return ret; } static MemTxResult dino_chip_read_with_attrs(void *opaque, hwaddr addr,@@ -194,6 +224,9 @@ static MemTxResult dino_chip_read_with_attrs(void *opaque, hwaddr addr, }break ; +case DINO_IO_FBB_EN : + val = s->io_fbb_en; +break ;case DINO_IO_ADDR_EN : val = s->io_addr_en;break ;@@ -227,12 +260,28 @@ static MemTxResult dino_chip_read_with_attrs(void *opaque, hwaddr addr,case DINO_IRR1 : val = s->ilr & s->imr & s->icr;break ; +case DINO_TOC_ADDR : + val = s->toc_addr; +break ; + case DINO_GMASK ... DINO_TLTIM: + val = s->reg800[(addr -DINO_GMASK ) /4 ]; +if (addr ==DINO_PAMR ) { + val &= ~0x01 ;/* LSB is hardwired to 0 */ + } +if (addr ==DINO_MLTIM ) { + val &= ~0x07 ;/* 3 LSB are hardwired to 0 */ + } +if (addr ==DINO_BRDG_FEAT ) { + val &= ~(0x10710E0ul |8 );/* bits 5-7, 24 & 15 reserved */ + } +break ;default :/* Controlled by dino_chip_mem_valid above. */ g_assert_not_reached (); } +trace_dino_chip_read (addr, val); *data = val;return ret; }@@ -245,6 +294,9 @@ static MemTxResult dino_chip_write_with_attrs(void *opaque, hwaddr addr,AddressSpace *io;MemTxResult ret;uint16_t ioaddr; +int i; + +trace_dino_chip_write (addr, val);switch (addr) { case DINO_IO_DATA ... DINO_PCI_IO_DATA + 3:@@ -266,9 +318,11 @@ static MemTxResult dino_chip_write_with_attrs(void *opaque, hwaddr addr, }return ret; +case DINO_IO_FBB_EN : + s->io_fbb_en = val &0x03 ; +break ;case DINO_IO_ADDR_EN : -/* Never allow first (=firmware) and last (=Dino) areas. */ - s->io_addr_en = val &0x7ffffffe ; + s->io_addr_en = val;gsc_to_pci_forwarding (s);break ;case DINO_IO_CONTROL :@@ -292,6 +346,10 @@ static MemTxResult dino_chip_write_with_attrs(void *opaque, hwaddr addr,/* Any write to IPR clears the register. */ s->ipr =0 ;break ; +case DINO_TOC_ADDR : +/* IO_COMMAND of CPU with client_id bits */ + s->toc_addr =0xFFFA0030 | (val &0x1e000 ); +break ;case DINO_ILR :case DINO_IRR0 :
hw/hppa/dino.c static MemTxResult dino_chip_write_with_attrs(void *opaque, hwaddr addr, · line 362
Quoted 6 lines
hw/hppa/dino.c +3
-0@@ -299,6 +357,12 @@ static MemTxResult dino_chip_write_with_attrs(void *opaque, hwaddr addr,/* These registers are read-only. */ break ; + case DINO_GMASK ... DINO_TLTIM: + i = (addr -DINO_GMASK ) /4 ; + val &= reg800_keep_bits[i];
Due to the missing register, Coverity reports:
Quoted 75 lines
hw/hppa/dino.c +0
-0>> CID 1419394: Memory - illegal accesses (OVERRUN)Quoted 1 line
Quoted 1 line
Overrunning array "
reg800_keep_bits" of 12 4-byte elements at element index 12 (byte offset 48) using index "i" (which evaluates to 12).hw/hppa/dino.c +11
-4+ s->reg800[i] = val; + break; > + default:/* Controlled by dino_chip_mem_valid above. */ g_assert_not_reached ();@@ -323,7 +387,7 @@ static const MemoryRegionOps dino_chip_ops = {static const VMStateDescription vmstate_dino = { .name ="Dino" , - .version_id =1 , + .version_id =2 , .minimum_version_id =1 , .fields = (VMStateField []) {VMSTATE_UINT32 (iar0, DinoState),@@ -332,13 +396,14 @@ static const VMStateDescription vmstate_dino = {VMSTATE_UINT32 (ipr, DinoState),VMSTATE_UINT32 (icr, DinoState),VMSTATE_UINT32 (ilr, DinoState), +VMSTATE_UINT32 (io_fbb_en, DinoState),VMSTATE_UINT32 (io_addr_en, DinoState),VMSTATE_UINT32 (io_control, DinoState), +VMSTATE_UINT32 (toc_addr, DinoState), VMSTATE_END_OF_LIST() } }; -/* Unlike pci_config_data_le_ops, no check of high bit set in config_reg. */ static uint64_t dino_config_data_read (void *opaque,hwaddr addr,unsigned len)@@ -362,14 +427,16 @@ static const MemoryRegionOps dino_config_data_ops = {static uint64_t dino_config_addr_read (void *opaque,hwaddr addr,unsigned len) { -PCIHostState *s = opaque; -return s->config_reg; +DinoState *s = opaque; +return s->config_reg_dino; }static void dino_config_addr_write (void *opaque,hwaddr addr,uint64_t val,unsigned len) {PCIHostState *s = opaque; +DinoState *ds = opaque; + ds->config_reg_dino = val;/* keep a copy of original value */ s->config_reg = val & ~3U ; }@@ -453,6 +520,8 @@ PCIBus *dino_init(MemoryRegion *addr_space, dev =qdev_create (NULL ,TYPE_DINO_PCI_HOST_BRIDGE ); s =DINO_PCI_HOST_BRIDGE (dev); + s->iar0 = s->iar1 =CPU_HPA +3 ; + s->toc_addr =0xFFFA0030 ;/* IO_COMMAND of CPU */ /* Dino PCI access from main memory. */ memory_region_init_io(&s->this_mem, OBJECT(s), &dino_chip_ops,hw/hppa/trace-events +5
-0@@ -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"
Re: [PATCH v5 5/6] hppa: Add emulation of Artist graphics
In reply to Sven SchnelleHi Sven,
Quoted 44 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.
Signed-off-by Sven Schnelle <[email protected]>--- hw/display/Kconfig | 4 + hw/display/Makefile.objs | 1 + hw/display/artist.c | 1450 ++++++++++++++++++++++++++++++++++++++ hw/display/trace-events | 9 + hw/hppa/Kconfig | 1 + hw/hppa/hppa_hardware.h | 1 + hw/hppa/machine.c | 9 + 7 files changed, 1475 insertions(+)create mode 100644
hw/display/artist.chw/display/Kconfig +4
-0@@ -91,6 +91,10 @@ config TCX config CG3 bool +config ARTIST + bool + select FRAMEBUFFER + config VGA boolhw/display/Makefile.objs +1
-0@@ -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.ohw/display/artist.c +0
-0
[...]
Quoted 39 lines
hw/display/artist.c +39
-0+static void draw_line_size (ARTISTState *s,bool update_start) +{ + +int startx =artist_get_x (s->vram_start); +int starty =artist_get_y (s->vram_start); +int endx =artist_get_x (s->line_size); +int endy =artist_get_y (s->line_size); + +trace_artist_draw_line (startx, starty, endx, endy); +draw_line (s, startx, starty, endx, endy, update_start,-1 ,-1 ); +} + +static void draw_line_xy (ARTISTState *s,bool update_start) +{ + +int startx =artist_get_x (s->vram_start); +int starty =artist_get_y (s->vram_start); +int sizex =artist_get_x (s->blockmove_size); +int sizey =artist_get_y (s->blockmove_size); +int linexy = s->line_xy >>16 ; +int endx, endy; + + endx = startx; + endy = starty; + +if (sizex >0 ) { + endx = startx + linexy; + } + +if (sizex <0 ) { + endx = startx; + startx -= linexy; + } + +if (sizey >0 ) { + endy = starty + linexy; + } + +if (sizey <0 ) {
hw/display/artist.c line 725
Quoted 10 lines
hw/display/artist.c +10
-0+ endy = starty; + starty -= linexy; + } + +if (startx <0 ) { + startx =0 ; + } + +if (endx <0 ) { + endx =0 ;
If negative, set to zero.
hw/display/artist.c line 733
Quoted 8 lines
hw/display/artist.c +8
-0+ } + +if (starty <0 ) { + starty =0 ; + } + +if (endy <0 ) { + endy =0 ;
Ditto.
hw/display/artist.c line 738
Quoted 5 lines
hw/display/artist.c +5
-0+ } + + +if (endx <0 ) { +return ;
Here Coverity points:
hw/display/artist.c line 738
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
CID 1419388: Control flow issues (DEADCODE) Execution cannot reach this statement: "return;".
hw/display/artist.c +4
-0+ } + +if (endy <0 ) { +return ;
Here again.
Quoted 17 lines
hw/display/artist.c +17
-0+ } + +trace_artist_draw_line (startx, starty, endx, endy); +draw_line (s, startx, starty, endx, endy, false,-1 ,-1 ); +} + +static void draw_line_end (ARTISTState *s,bool update_start) +{ + +int startx =artist_get_x (s->vram_start); +int starty =artist_get_y (s->vram_start); +int endx =artist_get_x (s->line_end); +int endy =artist_get_y (s->line_end); + +trace_artist_draw_line (startx, starty, endx, endy); +draw_line (s, startx, starty, endx, endy, update_start,-1 ,-1 ); +}
Re: [PATCH v5 1/6] hw/hppa/dino.c: Improve emulation of Dino PCI chip
In reply to Philippe Mathieu-DaudéQuoted 261 lines · Philippe Mathieu-Daudé
Hi Sven, Helge.
Quoted 49 lines · 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.Signed-off-by Helge Deller <[email protected]>Signed-off-by Sven Schnelle <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>---
MAINTAINERS | 2 +-
hw/hppa/dino.c | 97 +++++++++++++++++++++++++++++++++++++------- hw/hppa/trace-events | 5 +++3 files changed, 89 insertions(+), 15 deletions(-)MAINTAINERS +0
-0@@ -876,7 +876,7 @@ F: hw/*/etraxfs_*.cHP-PARISC Machines
------------------MAINTAINERS +1
-1-Dino +HP B160LM: Richard Henderson <[email protected]>
R: Helge Deller <[email protected]>
S: Odd Fixeshw/hppa/dino.c +1
-1@@ -1,7 +1,7 @@ /* -* HP-PARISC Dino PCI chipset emulation. +* HP-PARISC Dino PCI chipset emulation, as in B160L and similiar machines
*
- * (C) 2017 by Helge Deller <[email protected]>
+ * (C) 2017-2019 by Helge Deller <[email protected]>
*
* This work is licensed under the GNU GPL license version 2 or later. *hw/hppa/dino.c +1
-0@@ -21,6 +21,7 @@ #include "migration/vmstate.h" #include "hppa_sys.h" #include "exec/address-spaces.h" +#include "trace.h" #define TYPE_DINO_PCI_HOST_BRIDGE "dino-pcihost"hw/hppa/dino.c line 85
Quoted 3 lines
hw/hppa/dino.c +0
-0@@ -82,11 +83,28 @@ #define DINO_PCI_HOST_BRIDGE(obj) \ OBJECT_CHECK(DinoState, (obj), TYPE_DINO_PCI_HOST_BRIDGE) +#define DINO800_REGS ((DINO_TLTIM - DINO_GMASK) / 4)Coverity noticed (CID 1419394) this should be '(1 + (
DINO_TLTIM-DINO_GMASK) / 4)' (13 registers).hw/hppa/dino.c line 94
Quoted 8 lines
hw/hppa/dino.c +8
-0+static const uint32_t reg800_keep_bits[DINO800_REGS ] = { + MAKE_64BIT_MASK(0, 1), + MAKE_64BIT_MASK(0, 7), + MAKE_64BIT_MASK(0, 7), + MAKE_64BIT_MASK(0, 8), + MAKE_64BIT_MASK(0, 7), + MAKE_64BIT_MASK(0, 9), + MAKE_64BIT_MASK(0, 32),Looking at the datasheet pp. 30, this register is 'Undefined'. We should report
GUEST_ERRORif it is accessed.hw/hppa/dino.c line 97
Quoted 3 lines
hw/hppa/dino.c +3
-0+ MAKE_64BIT_MASK(0, 8), + MAKE_64BIT_MASK(0, 30), + MAKE_64BIT_MASK(0, 25),Still looking at the datasheet (pp. 37) PCIROR is 24-bit (not 25).
hw/hppa/dino.c line 98
Quoted 1 line
hw/hppa/dino.c +1
-0+ MAKE_64BIT_MASK(0, 22),Here you are missing register
0x82c...hw/hppa/dino.c line 101
Quoted 3 lines
hw/hppa/dino.c +3
-0+ MAKE_64BIT_MASK(0, 9), +}; +Altogether:
static const
uint32_treg800_keep_bits[DINO800_REGS] = {MAKE_64BIT_MASK(0, 1), /* GMASK */MAKE_64BIT_MASK(0, 7), /* PAMR */MAKE_64BIT_MASK(0, 7), /* PAPR */MAKE_64BIT_MASK(0, 8), /* DAMODE */MAKE_64BIT_MASK(0, 7), /* PCICMD */MAKE_64BIT_MASK(0, 9), /* PCISTS */MAKE_64BIT_MASK(0, 0), /* Undefined */MAKE_64BIT_MASK(0, 8), /* MLTIM */MAKE_64BIT_MASK(0, 30), /*BRDG_FEAT*/MAKE_64BIT_MASK(0, 24), /* PCIROR */MAKE_64BIT_MASK(0, 22), /* PCIWOR */MAKE_64BIT_MASK(0, 0), /* Undocumented */MAKE_64BIT_MASK(0, 9), /* TLTIM */
};Quoted 152 lines
hw/hppa/dino.c +0
-0typedef struct DinoState { PCIHostState parent_obj; /* PCI_CONFIG_ADDR is parent_obj.config_reg, via pci_host_conf_be_ops,so that we can map
PCI_CONFIG_DATAto pci_host_data_be_ops. */ +uint32_tconfig_reg_dino; /* keep original copy, including 2 lowest bits */
uint32_tiar0;
uint32_tiar1;hw/hppa/dino.c +8
-2@@ -94,8 +112,12 @@ typedef struct DinoState { uint32_t ipr; uint32_t icr; uint32_t ilr; + uint32_t io_fbb_en; uint32_t io_addr_en; uint32_t io_control; + uint32_t toc_addr; + + uint32_t reg800[DINO800_REGS]; MemoryRegion this_mem; MemoryRegion pci_mem;@@ -106,8 +128,6 @@ typedef struct DinoState { MemoryRegion bm_ram_alias; MemoryRegion bm_pci_alias; MemoryRegion bm_cpu_alias; - - MemoryRegion cpu0_eir_mem; } DinoState; /*@@ -122,6 +142,8 @@ static void gsc_to_pci_forwarding(DinoState *s) tmp = extract32(s->io_control, 7, 2); enabled = (tmp == 0x01); io_addr_en = s->io_addr_en; + /* Mask out first (=firmware) and last (=Dino) areas. */ + io_addr_en &= ~(BIT(31) | BIT(0)); memory_region_transaction_begin(); for (i = 1; i < 31; i++) {@@ -142,6 +164,8 @@ static bool dino_chip_mem_valid(void *opaque,hwaddr addr, unsigned size, bool is_write, MemTxAttrs attrs) { + bool ret = false; + switch (addr) {case
DINO_IAR0:
caseDINO_IAR1:hw/hppa/dino.c +0
-0@@ -152,16 +176,22 @@ static bool dino_chip_mem_valid(void *opaque, hwaddr addr,case
DINO_ICR:
caseDINO_ILR:
caseDINO_IO_CONTROL:
+ caseDINO_IO_FBB_EN:
caseDINO_IO_ADDR_EN:
caseDINO_PCI_IO_DATA:
- return true;
+ caseDINO_TOC_ADDR:
+ caseDINO_GMASK...DINO_TLTIM:
+ ret = true;
+ break;
caseDINO_PCI_IO_DATA+ 2:
- return size <= 2;
+ ret = (size <= 2);
+ break;
caseDINO_PCI_IO_DATA+ 1:
caseDINO_PCI_IO_DATA+ 3:
- return size == 1;
+ ret = (size == 1);
}
- return false;
+trace_dino_chip_mem_valid(addr, ret);
+ return ret;
}
static MemTxResult dino_chip_read_with_attrs(void *opaque, hwaddr addr,hw/hppa/dino.c +0
-0@@ -194,6 +224,9 @@ static MemTxResult dino_chip_read_with_attrs(void *opaque, hwaddr addr, } break;+ case
DINO_IO_FBB_EN:
+ val =s->io_fbb_en;
+ break;
caseDINO_IO_ADDR_EN:
val =s->io_addr_en;
break;hw/hppa/dino.c +0
-0@@ -227,12 +260,28 @@ static MemTxResult dino_chip_read_with_attrs(void *opaque, hwaddr addr,case
DINO_IRR1:
val =s->ilr&s->imr&s->icr;
break;
+ caseDINO_TOC_ADDR:
+ val =s->toc_addr;
+ break;
+ caseDINO_GMASK...DINO_TLTIM:
+ val = s->reg800[(addr -DINO_GMASK) / 4];
+ if (addr ==DINO_PAMR) {
+ val &= ~0x01; /* LSB is hardwired to 0 */
+ }
+ if (addr ==DINO_MLTIM) {
+ val &= ~0x07; /* 3 LSB are hardwired to 0 */
+ }
+ if (addr ==DINO_BRDG_FEAT) {
+ val &= ~(0x10710E0ul | 8); /* bits 5-7, 24 & 15 reserved */ + }
+ break;
default:
/* Controlled bydino_chip_mem_validabove. */g_assert_not_reached();
}
+trace_dino_chip_read(addr, val);
*data = val;
return ret;
}hw/hppa/dino.c +3
-0@@ -245,6 +294,9 @@ static MemTxResult dino_chip_write_with_attrs(void *opaque, hwaddr addr, AddressSpace *io; MemTxResult ret; uint16_t ioaddr; + int i; + + trace_dino_chip_write(addr, val); switch (addr) {case
DINO_IO_DATA...DINO_PCI_IO_DATA+ 3:hw/hppa/dino.c +0
-0@@ -266,9 +318,11 @@ static MemTxResult dino_chip_write_with_attrs(void *opaque, hwaddr addr, } return ret;+ case
DINO_IO_FBB_EN:
+s->io_fbb_en= val &0x03;
+ break;
caseDINO_IO_ADDR_EN:
- /* Never allow first (=firmware) and last (=Dino) areas. */ -s->io_addr_en= val &0x7ffffffe;
+s->io_addr_en= val;
gsc_to_pci_forwarding(s);
break;
caseDINO_IO_CONTROL:hw/hppa/dino.c +4
-0@@ -292,6 +346,10 @@ static MemTxResult dino_chip_write_with_attrs(void *opaque, hwaddr addr, /* Any write to IPR clears the register. */ s->ipr = 0; break; + case DINO_TOC_ADDR: + /* IO_COMMAND of CPU with client_id bits */ + s->toc_addr = 0xFFFA0030 | (val & 0x1e000); + break;case
DINO_ILR:
caseDINO_IRR0:hw/hppa/dino.c +0
-0@@ -299,6 +357,12 @@ static MemTxResult dino_chip_write_with_attrs(void *opaque, hwaddr addr, /* These registers are read-only. */ break;Quoted 3 lines
+ case
DINO_GMASK...DINO_TLTIM:
+ i = (addr -DINO_GMASK) / 4;
+ val &= reg800_keep_bits[i];Due to the missing register, Coverity reports:
Quoted 9 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
CID 1419394: Memory - illegal accesses (OVERRUN) Overrunning array "
reg800_keep_bits" of 12 4-byte elements atelement index 12 (byte offset 48) using index "i" (which evaluates to 12).
Quoted 5 lines
+ s->reg800[i] = val;
+ break; > +
default:
/* Controlled bydino_chip_mem_validabove. */g_assert_not_reached();
Easy reproducer:
$ echo writeb 0xfff80830 0x69 \
| hppa-softmmu/qemu-system-hppa -S -accel qtest -qtest stdio -display
none
[I 1581634452.654113] OPENED
[R +4.105415] writeb 0xfff80830 0x69
qemu/hw/hppa/dino.c:362:16: runtime error: index 12 out of bounds for
type 'const uint32_t [12]'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
qemu/hw/hppa/dino.c:362:16 in
=================================================================
==29607==ERROR: AddressSanitizer: global-buffer-overflow on address
0x5577dae32f30 at pc 0x5577d93f2463 bp 0x7ffd97ea11b0 sp 0x7ffd97ea11a8
READ of size 4 at 0x5577dae32f30 thread T0
#0 0x5577d93f2462 in dino_chip_write_with_attrs
qemu/hw/hppa/dino.c:362:16
#1 0x5577d9025664 in memory_region_write_with_attrs_accessor
qemu/memory.c:503:12
#2 0x5577d9024920 in access_with_adjusted_size qemu/memory.c:539:18
#3 0x5577d9023608 in memory_region_dispatch_write qemu/memory.c:1482:13
#4 0x5577d8e3177a in flatview_write_continue qemu/exec.c:3166:23
#5 0x5577d8e20357 in flatview_write qemu/exec.c:3206:14
#6 0x5577d8e1fef4 in address_space_write qemu/exec.c:3296:18
#7 0x5577d8e20693 in address_space_rw qemu/exec.c:3306:16
#8 0x5577d9011595 in qtest_process_command qemu/qtest.c:432:13
#9 0x5577d900d19f in qtest_process_inbuf qemu/qtest.c:705:9
#10 0x5577d900ca22 in qtest_read qemu/qtest.c:717:5
#11 0x5577da8c4254 in qemu_chr_be_write_impl qemu/chardev/char.c:183:9
#12 0x5577da8c430c in qemu_chr_be_write qemu/chardev/char.c:195:9
#13 0x5577da8cf587 in fd_chr_read qemu/chardev/char-fd.c:68:9
#14 0x5577da9836cd in qio_channel_fd_source_dispatch
qemu/io/channel-watch.c:84:12
#15 0x7faf44509ecc in g_main_context_dispatch
(/lib64/libglib-2.0.so.0+0x4fecc)
#16 0x5577dab75f96 in glib_pollfds_poll qemu/util/main-loop.c:219:9
#17 0x5577dab74797 in os_host_main_loop_wait qemu/util/main-loop.c:242:5
#18 0x5577dab7435a in main_loop_wait qemu/util/main-loop.c:518:11
#19 0x5577d9514eb3 in main_loop qemu/vl.c:1682:9
#20 0x5577d950699d in main qemu/vl.c:4450:5
#21 0x7faf41a87f42 in __libc_start_main (/lib64/libc.so.6+0x23f42)
#22 0x5577d8cd4d4d in _start
(qemu/build/sanitizer/hppa-softmmu/qemu-system-hppa+0x1256d4d)0x5577dae32f30 is located 0 bytes to the right of global variable 'reg800_keep_bits' defined in 'qemu/hw/hppa/dino.c:87:23' (0x5577dae32f00) of size 48
SUMMARY: AddressSanitizer: global-buffer-overflow qemu/hw/hppa/dino.c:362:16 in dino_chip_write_with_attrs Shadow bytes around the buggy address:
0x0aaf7b5be590: 00 f9 f9 f9 f9 f9 f9 f9 00 02 f9 f9 f9 f9 f9 f9 0x0aaf7b5be5a0: 07 f9 f9 f9 f9 f9 f9 f9 07 f9 f9 f9 f9 f9 f9 f9 0x0aaf7b5be5b0: 07 f9 f9 f9 f9 f9 f9 f9 00 00 00 00 00 00 00 00 0x0aaf7b5be5c0: 00 00 00 02 f9 f9 f9 f9 00 00 00 00 00 00 00 00 0x0aaf7b5be5d0: 00 00 00 00 00 00 00 00 00 00 00 03 f9 f9 f9 f9
=>0x0aaf7b5be5e0: 00 00 00 00 00 00[f9]f9 f9 f9 f9 f9 00 00 00 00
0x0aaf7b5be5f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0aaf7b5be600: 00 00 01 f9 f9 f9 f9 f9 00 00 00 00 07 f9 f9 f9 0x0aaf7b5be610: f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00 0x0aaf7b5be620: 00 00 00 05 f9 f9 f9 f9 00 00 00 00 07 f9 f9 f9 0x0aaf7b5be630: f9 f9 f9 f9 00 00 f9 f9 f9 f9 f9 f9 07 f9 f9 f9
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb Shadow gap: cc
==29607==ABORTING