Skip to contentSkip to conversation

Vga 20190311 v2 patches

GIT PULL Applied Gerd Hoffmann 6 participants 13 messages Mar 11, 2019 – Mar 12, 2019

lore
Share & tools
lore
#0 lore raw

The following changes since commit e2a18635a400b0e68679614132e9ef6316105590:

Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-03-08' into staging (2019-03-09 20:55:44 +0000)

are available in the Git repository at:

git://git.kraxel.org/qemu tags/vga-20190311-v2-pull-request

for you to fetch changes up to ff243cff11526c0703cefdd60467dfaa5c5803a0:

mips_fulong2e: Add on-board graphics chip (2019-03-11 08:04:55 +0100)

----------------------------------------------------------------
vga: virtio reset fix, add ati emulation.

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

BALATON Zoltan (2):
hw/display: Add basic ATI VGA emulation
mips_fulong2e: Add on-board graphics chip

Gerd Hoffmann (3):
virtio: add class_size to VirtioPCIDeviceTypeInfo
virtio-vga: fix reset.
virtio-gpu: make virtio_gpu_reset static

 hw/display/ati_int.h           |  96 ++++
 hw/display/ati_regs.h          | 461 ++++++++++++++++++
 hw/virtio/virtio-pci.h         |   1 +
 include/hw/virtio/virtio-gpu.h |   1 -
 hw/display/ati.c               | 865 +++++++++++++++++++++++++++++++++
 hw/display/ati_2d.c            | 167 +++++++
 hw/display/ati_dbg.c           | 259 ++++++++++
 hw/display/virtio-gpu.c        |   2 +-
 hw/display/virtio-vga.c        |  17 +-
 hw/mips/mips_fulong2e.c        |   7 +
 hw/virtio/virtio-pci.c         |   1 +
 vl.c                           |   1 +
 hw/display/Kconfig             |   6 +
 hw/display/Makefile.objs       |   2 +
 hw/display/trace-events        |   4 +
 15 files changed, 1886 insertions(+), 4 deletions(-)
 create mode 100644 hw/display/ati_int.h
 create mode 100644 hw/display/ati_regs.h
 create mode 100644 hw/display/ati.c
 create mode 100644 hw/display/ati_2d.c
 create mode 100644 hw/display/ati_dbg.c
Signature · 1 line
2.18.1
#1 lore raw

[Qemu-devel] [PULL 1/5] virtio: add class_size to VirtioPCIDeviceTypeInfo

Needed when VirtioPCIClass subclasses have their own class struct with some extra fields.

Message-id: [email protected]

---
 hw/virtio/virtio-pci.h | 1 +
 hw/virtio/virtio-pci.c | 1 +
 2 files changed, 2 insertions(+)
hw/virtio/virtio-pci.h +1 -0
index bd223a6e3b0b..18581854cae1 100644
@@ -230,6 +230,7 @@ typedef struct VirtioPCIDeviceTypeInfo {
 
     /* Same as TypeInfo fields: */
     size_t instance_size;
+    size_t class_size;
     void (*instance_init)(Object *obj);
     void (*class_init)(ObjectClass *klass, void *data);
 } VirtioPCIDeviceTypeInfo;
hw/virtio/virtio-pci.c +1 -0
index e978bfe76048..cb44e19b6789 100644
@@ -1935,6 +1935,7 @@ void virtio_pci_types_register(const VirtioPCIDeviceTypeInfo *t)
         .parent        = t->parent ? t->parent : TYPE_VIRTIO_PCI,
         .instance_size = t->instance_size,
         .instance_init = t->instance_init,
+        .class_size    = t->class_size,
         .class_init    = virtio_pci_base_class_init,
         .class_data    = (void *)t,
         .abstract      = true,
Signature · 1 line
2.18.1
#2 lore raw

[Qemu-devel] [PULL 3/5] virtio-gpu: make virtio_gpu_reset static

In reply to Gerd Hoffmann

Message-id: [email protected]

---
 include/hw/virtio/virtio-gpu.h | 1 -
 hw/display/virtio-gpu.c        | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
include/hw/virtio/virtio-gpu.h +0 -1
index 98504f907583..ce0ca7217175 100644
@@ -148,7 +148,6 @@ extern const GraphicHwOps virtio_gpu_ops;
     } while (0)
 
 /* virtio-gpu.c */
-void virtio_gpu_reset(VirtIODevice *vdev);
 void virtio_gpu_ctrl_response(VirtIOGPU *g,
                               struct virtio_gpu_ctrl_command *cmd,
                               struct virtio_gpu_ctrl_hdr *resp,
hw/display/virtio-gpu.c +1 -1
index a3627f58a9dd..4dbf48e42482 100644
@@ -1346,7 +1346,7 @@ static void virtio_gpu_instance_init(Object *obj)
 {
 }
 
-void virtio_gpu_reset(VirtIODevice *vdev)
+static void virtio_gpu_reset(VirtIODevice *vdev)
 {
     VirtIOGPU *g = VIRTIO_GPU(vdev);
     struct virtio_gpu_simple_resource *res, *tmp;
Signature · 1 line
2.18.1
#3 lore raw

[Qemu-devel] [PULL 2/5] virtio-vga: fix reset.

In reply to Gerd Hoffmann

Store reset handler of the parent class and just call that for a complete virtio reset. When taking the shortcut and calling virtio_gpu_reset() directly the generic virtio reset code (for virtqueues etc) will not be executed.

Message-id: [email protected]

---
 hw/display/virtio-vga.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
hw/display/virtio-vga.c +15 -2
index 1e48009b74a6..a2b803b75f94 100644
@@ -12,6 +12,10 @@
 #define TYPE_VIRTIO_VGA "virtio-vga"
 #define VIRTIO_VGA(obj) \
         OBJECT_CHECK(VirtIOVGA, (obj), TYPE_VIRTIO_VGA)
+#define VIRTIO_VGA_GET_CLASS(obj) \
+        OBJECT_GET_CLASS(VirtIOVGAClass, obj, TYPE_VIRTIO_VGA)
+#define VIRTIO_VGA_CLASS(klass) \
+        OBJECT_CLASS_CHECK(VirtIOVGAClass, klass, TYPE_VIRTIO_VGA)
 
 typedef struct VirtIOVGA {
     VirtIOPCIProxy parent_obj;
@@ -20,6 +24,11 @@ typedef struct VirtIOVGA {
     MemoryRegion   vga_mrs[3];
 } VirtIOVGA;
 
+typedef struct VirtIOVGAClass {
+    VirtioPCIClass parent_class;
+    DeviceReset parent_reset;
+} VirtIOVGAClass;
+
 static void virtio_vga_invalidate_display(void *opaque)
 {
     VirtIOVGA *vvga = opaque;
@@ -168,10 +177,11 @@ static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
 
 static void virtio_vga_reset(DeviceState *dev)
 {
+    VirtIOVGAClass *klass = VIRTIO_VGA_GET_CLASS(dev);
     VirtIOVGA *vvga = VIRTIO_VGA(dev);
 
     /* reset virtio-gpu */
-    virtio_gpu_reset(VIRTIO_DEVICE(&vvga->vdev));
+    klass->parent_reset(dev);
 
     /* reset vga */
     vga_common_reset(&vvga->vga);
@@ -187,13 +197,15 @@ static void virtio_vga_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
     VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
+    VirtIOVGAClass *v = VIRTIO_VGA_CLASS(klass);
     PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
 
     set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
     dc->props = virtio_vga_properties;
-    dc->reset = virtio_vga_reset;
     dc->vmsd = &vmstate_virtio_vga;
     dc->hotpluggable = false;
+    device_class_set_parent_reset(dc, virtio_vga_reset,
+                                  &v->parent_reset);
 
     k->realize = virtio_vga_realize;
     pcidev_k->romfile = "vgabios-virtio.bin";
@@ -212,6 +224,7 @@ static VirtioPCIDeviceTypeInfo virtio_vga_info = {
     .generic_name  = TYPE_VIRTIO_VGA,
     .instance_size = sizeof(struct VirtIOVGA),
     .instance_init = virtio_vga_inst_initfn,
+    .class_size    = sizeof(struct VirtIOVGAClass),
     .class_init    = virtio_vga_class_init,
 };
 
Signature · 1 line
2.18.1
#4 lore raw

[Qemu-devel] [PULL 5/5] mips_fulong2e: Add on-board graphics chip

In reply to Gerd Hoffmann

From: BALATON Zoltan <[email protected]>

Add (partial) emulation of the on-board GPU of the machine. This allows the PMON2000 firmware to run and should also work with Linux console but probably not with X yet.

Message-id: da6370b22e0352ee803d25d68a62ff32eebf06e2.1552152100.git.balaton@eik.bme.hu

---
 hw/mips/mips_fulong2e.c | 7 +++++++
 1 file changed, 7 insertions(+)
hw/mips/mips_fulong2e.c +7 -0
index fbbc543eede5..9d7480ed3171 100644
@@ -287,6 +287,7 @@ static void mips_fulong2e_init(MachineState *machine)
     I2CBus *smbus;
     MIPSCPU *cpu;
     CPUMIPSState *env;
+    DeviceState *dev;
 
     /* init CPUs */
     cpu = MIPS_CPU(cpu_create(machine->cpu_type));
@@ -347,6 +348,12 @@ static void mips_fulong2e_init(MachineState *machine)
     vt82c686b_southbridge_init(pci_bus, FULONG2E_VIA_SLOT, env->irq[5],
                                &smbus, &isa_bus);
 
+    /* GPU */
+    dev = DEVICE(pci_create(pci_bus, -1, "ati-vga"));
+    qdev_prop_set_uint32(dev, "vgamem_mb", 16);
+    qdev_prop_set_uint16(dev, "x-device-id", 0x5159);
+    qdev_init_nofail(dev);
+
     /* Populate SPD eeprom data */
     spd_data = spd_data_generate(DDR, ram_size, &err);
     if (err) {
Signature · 1 line
2.18.1
#5 lore raw

[Qemu-devel] [PULL 4/5] hw/display: Add basic ATI VGA emulation

In reply to Gerd Hoffmann

From: BALATON Zoltan <[email protected]>

At least two machines, the PPC mac99 and MIPS fulong2e, have an ATI gfx chip by default (Rage 128 Pro and M6/RV100 respectively) and guests running on these and the PMON2000 firmware of the fulong2e expect this to be available. Fortunately these are very similar chips so they can be mostly emulated in the same device model. This patch adds basic emulation of these ATI VGA chips.

While this is incomplete and currently only enough to run the MIPS firmware and get framebuffer output with Linux, it allows the fulong2e board to work more like the real hardware and having it in QEMU in this state provides a way to experiment with it and allows others to contribute to improve it. It is compiled for all archs but only the fulong2e (which currently has no display output at all) is set to use it by default (in a separate patch).

Message-id: 0b1b7c22873a6e37627261b04fb687412b25ff4f.1552152100.git.balaton@eik.bme.hu

---
 hw/display/ati_int.h     |  96 +++++
 hw/display/ati_regs.h    | 461 +++++++++++++++++++++
 hw/display/ati.c         | 865 +++++++++++++++++++++++++++++++++++++++
 hw/display/ati_2d.c      | 167 ++++++++
 hw/display/ati_dbg.c     | 259 ++++++++++++
 vl.c                     |   1 +
 hw/display/Kconfig       |   6 +
 hw/display/Makefile.objs |   2 +
 hw/display/trace-events  |   4 +
 9 files changed, 1861 insertions(+)
 create mode 100644 hw/display/ati_int.h
 create mode 100644 hw/display/ati_regs.h
 create mode 100644 hw/display/ati.c
 create mode 100644 hw/display/ati_2d.c
 create mode 100644 hw/display/ati_dbg.c
hw/display/ati_int.h new file +96 -0
new file mode 100644
index 000000000000..a6f3e20e6319
@@ -0,0 +1,96 @@
+/*
+ * QEMU ATI SVGA emulation
+ *
+ * Copyright (c) 2019 BALATON Zoltan
+ *
+ * This work is licensed under the GNU GPL license version 2 or later.
+ */
+
+#ifndef ATI_INT_H
+#define ATI_INT_H
+
+#include "qemu/osdep.h"
+#include "hw/pci/pci.h"
+#include "vga_int.h"
+
+/*#define DEBUG_ATI*/
+
+#ifdef DEBUG_ATI
+#define DPRINTF(fmt, ...) printf("%s: " fmt, __func__, ## __VA_ARGS__)
+#else
+#define DPRINTF(fmt, ...) do {} while (0)
+#endif
+
+#define PCI_VENDOR_ID_ATI 0x1002
+/* Rage128 Pro GL */
+#define PCI_DEVICE_ID_ATI_RAGE128_PF 0x5046
+/* Radeon RV100 (VE) */
+#define PCI_DEVICE_ID_ATI_RADEON_QY 0x5159
+
+#define TYPE_ATI_VGA "ati-vga"
+#define ATI_VGA(obj) OBJECT_CHECK(ATIVGAState, (obj), TYPE_ATI_VGA)
+
+typedef struct ATIVGARegs {
+    uint32_t mm_index;
+    uint32_t bios_scratch[8];
+    uint32_t crtc_gen_cntl;
+    uint32_t crtc_ext_cntl;
+    uint32_t dac_cntl;
+    uint32_t crtc_h_total_disp;
+    uint32_t crtc_h_sync_strt_wid;
+    uint32_t crtc_v_total_disp;
+    uint32_t crtc_v_sync_strt_wid;
+    uint32_t crtc_offset;
+    uint32_t crtc_offset_cntl;
+    uint32_t crtc_pitch;
+    uint32_t cur_offset;
+    uint32_t cur_hv_pos;
+    uint32_t cur_hv_offs;
+    uint32_t cur_color0;
+    uint32_t cur_color1;
+    uint32_t dst_offset;
+    uint32_t dst_pitch;
+    uint32_t dst_tile;
+    uint32_t dst_width;
+    uint32_t dst_height;
+    uint32_t src_offset;
+    uint32_t src_pitch;
+    uint32_t src_tile;
+    uint32_t src_x;
+    uint32_t src_y;
+    uint32_t dst_x;
+    uint32_t dst_y;
+    uint32_t dp_gui_master_cntl;
+    uint32_t dp_brush_bkgd_clr;
+    uint32_t dp_brush_frgd_clr;
+    uint32_t dp_src_frgd_clr;
+    uint32_t dp_src_bkgd_clr;
+    uint32_t dp_cntl;
+    uint32_t dp_datatype;
+    uint32_t dp_mix;
+    uint32_t dp_write_mask;
+    uint32_t default_offset;
+    uint32_t default_pitch;
+    uint32_t default_sc_bottom_right;
+} ATIVGARegs;
+
+typedef struct ATIVGAState {
+    PCIDevice dev;
+    VGACommonState vga;
+    char *model;
+    uint16_t dev_id;
+    uint8_t mode;
+    bool cursor_guest_mode;
+    uint16_t cursor_size;
+    uint32_t cursor_offset;
+    QEMUCursor *cursor;
+    MemoryRegion io;
+    MemoryRegion mm;
+    ATIVGARegs regs;
+} ATIVGAState;
+
+const char *ati_reg_name(int num);
+
+void ati_2d_blt(ATIVGAState *s);
+
+#endif /* ATI_INT_H */
hw/display/ati_regs.h new file +461 -0

461 lines not on this page · raw message

hw/display/ati.c new file +865 -0

865 lines not on this page · raw message

hw/display/ati_2d.c new file +167 -0

167 lines not on this page · raw message

hw/display/ati_dbg.c new file +259 -0

259 lines not on this page · raw message

vl.c +1 -0
index 4a350de5cd19..f46f8d769a5c 100644
@@ -237,6 +237,7 @@ static struct {
     { .driver = "vmware-svga",          .flag = &default_vga       },
     { .driver = "qxl-vga",              .flag = &default_vga       },
     { .driver = "virtio-vga",           .flag = &default_vga       },
+    { .driver = "ati-vga",              .flag = &default_vga       },
 };
 
 static QemuOptsList qemu_rtc_opts = {
hw/display/Kconfig +6 -0
index a96ea763a8f5..86c1d544c5ce 100644
@@ -106,3 +106,9 @@ config VIRTIO_VGA
 
 config DPCD
     bool
+
+config ATI_VGA
+    bool
+    default y if PCI_DEVICES
+    depends on PCI
+    select VGA
hw/display/Makefile.objs +2 -0
index 576fca4eb6a3..dbd453ab1b01 100644
@@ -51,3 +51,5 @@ virtio-gpu-3d.o-cflags := $(VIRGL_CFLAGS)
 virtio-gpu-3d.o-libs += $(VIRGL_LIBS)
 obj-$(CONFIG_DPCD) += dpcd.o
 obj-$(CONFIG_XLNX_ZYNQMP_ARM) += xlnx_dp.o
+
+obj-$(CONFIG_ATI_VGA) += ati.o ati_2d.o ati_dbg.o
hw/display/trace-events +4 -0
index 37d3264bb2e6..80993cc4d913 100644
@@ -138,3 +138,7 @@ vga_cirrus_write_blt(uint32_t offset, uint32_t val) "offset 0x%x, val 0x%x"
 sii9022_read_reg(uint8_t addr, uint8_t val) "addr 0x%02x, val 0x%02x"
 sii9022_write_reg(uint8_t addr, uint8_t val) "addr 0x%02x, val 0x%02x"
 sii9022_switch_mode(const char *mode) "mode: %s"
+
+# hw/display/ati*.c
+ati_mm_read(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u 0x%"HWADDR_PRIx " %s -> 0x%"PRIx64
+ati_mm_write(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u 0x%"HWADDR_PRIx " %s <- 0x%"PRIx64
Signature · 1 line
2.18.1
#6 lore raw

Re: [Qemu-devel] [PULL 4/5] hw/display: Add basic ATI VGA emulation

Quoted 23 lines · Gerd Hoffmann

From: BALATON Zoltan <[email protected]>

At least two machines, the PPC mac99 and MIPS fulong2e, have an ATI gfx chip by default (Rage 128 Pro and M6/RV100 respectively) and guests running on these and the PMON2000 firmware of the fulong2e expect this to be available. Fortunately these are very similar chips so they can be mostly emulated in the same device model. This patch adds basic emulation of these ATI VGA chips.

While this is incomplete and currently only enough to run the MIPS firmware and get framebuffer output with Linux, it allows the fulong2e board to work more like the real hardware and having it in QEMU in this state provides a way to experiment with it and allows others to contribute to improve it. It is compiled for all archs but only the fulong2e (which currently has no display output at all) is set to use it by default (in a separate patch).

Message-id: 0b1b7c22873a6e37627261b04fb687412b25ff4f.1552152100.git.balaton@eik.bme.hu

[...]

hw/display/trace-events vga_cirrus_write_blt(uint32_t offset, uint32_t val) "offset 0x%x, val 0x%x" · line 144

Quoted 12 lines
hw/display/trace-events +4 -0
index 37d3264bb2e6..80993cc4d913 100644
@@ -138,3 +138,7 @@ vga_cirrus_write_blt(uint32_t offset, uint32_t val) "offset 0x%x, val 0x%x"
 sii9022_read_reg(uint8_t addr, uint8_t val) "addr 0x%02x, val 0x%02x"
 sii9022_write_reg(uint8_t addr, uint8_t val) "addr 0x%02x, val 0x%02x"
 sii9022_switch_mode(const char *mode) "mode: %s"
+
+# hw/display/ati*.c
+ati_mm_read(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u 0x%"HWADDR_PRIx " %s -> 0x%"PRIx64
+ati_mm_write(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u 0x%"HWADDR_PRIx " %s <- 0x%"PRIx64

Blows up for me:

Traceback (most recent call last):
File "/work/armbru/qemu/scripts/tracetool.py", line 152, in <module>
main(sys.argv)
File "/work/armbru/qemu/scripts/tracetool.py", line 147, in main
binary=binary, probe_prefix=probe_prefix)
File "/work/armbru/qemu/scripts/tracetool/__init__.py", line 472, in generate
tracetool.format.generate(events, format, backend, group)
File "/work/armbru/qemu/scripts/tracetool/format/__init__.py", line 85, in generate
func(events, backend, group)
File "/work/armbru/qemu/scripts/tracetool/format/log_stap.py", line 121, in generate

    fmt_str = "%d@%d " + e.name + " " + c_fmt_to_stap(e.fmt) + "\\n"

File "/work/armbru/qemu/scripts/tracetool/format/log_stap.py", line 64, in c_fmt_to_stap
bits.append(c_macro_to_format(macro))
File "/work/armbru/qemu/scripts/tracetool/format/log_stap.py", line 36, in c_macro_to_format
raise Exception("Unhandled macro '%s'" % macro)
Exception: Unhandled macro 'HWADDR_PRIx'

#7 lore raw

Re: [Qemu-devel] [PULL 4/5] hw/display: Add basic ATI VGA emulation

Quoted 40 lines · Markus Armbruster
Quoted 23 lines · Gerd Hoffmann

From: BALATON Zoltan <[email protected]>

At least two machines, the PPC mac99 and MIPS fulong2e, have an ATI gfx chip by default (Rage 128 Pro and M6/RV100 respectively) and guests running on these and the PMON2000 firmware of the fulong2e expect this to be available. Fortunately these are very similar chips so they can be mostly emulated in the same device model. This patch adds basic emulation of these ATI VGA chips.

While this is incomplete and currently only enough to run the MIPS firmware and get framebuffer output with Linux, it allows the fulong2e board to work more like the real hardware and having it in QEMU in this state provides a way to experiment with it and allows others to contribute to improve it. It is compiled for all archs but only the fulong2e (which currently has no display output at all) is set to use it by default (in a separate patch).

Message-id: 0b1b7c22873a6e37627261b04fb687412b25ff4f.1552152100.git.balaton@eik.bme.hu

[...]

hw/display/trace-events vga_cirrus_write_blt(uint32_t offset, uint32_t val) "offset 0x%x, val 0x%x" · line 144

Quoted 12 lines
hw/display/trace-events +4 -0
index 37d3264bb2e6..80993cc4d913 100644
@@ -138,3 +138,7 @@ vga_cirrus_write_blt(uint32_t offset, uint32_t val) "offset 0x%x, val 0x%x"
 sii9022_read_reg(uint8_t addr, uint8_t val) "addr 0x%02x, val 0x%02x"
 sii9022_write_reg(uint8_t addr, uint8_t val) "addr 0x%02x, val 0x%02x"
 sii9022_switch_mode(const char *mode) "mode: %s"
+
+# hw/display/ati*.c
+ati_mm_read(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u 0x%"HWADDR_PRIx " %s -> 0x%"PRIx64
+ati_mm_write(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u 0x%"HWADDR_PRIx " %s <- 0x%"PRIx64

Blows up for me:

Quoted 16 lines

Traceback (most recent call last):
File "/work/armbru/qemu/scripts/tracetool.py", line 152, in <module>
main(sys.argv)
File "/work/armbru/qemu/scripts/tracetool.py", line 147, in main
binary=binary, probe_prefix=probe_prefix)
File "/work/armbru/qemu/scripts/tracetool/__init__.py", line 472, in generate
tracetool.format.generate(events, format, backend, group)
File "/work/armbru/qemu/scripts/tracetool/format/__init__.py", line 85, in generate
func(events, backend, group)
File "/work/armbru/qemu/scripts/tracetool/format/log_stap.py", line 121, in generate
fmt_str = "%d@%d " + e.name + " " + c_fmt_to_stap(e.fmt) + "\\n"
File "/work/armbru/qemu/scripts/tracetool/format/log_stap.py", line 64, in c_fmt_to_stap
bits.append(c_macro_to_format(macro))
File "/work/armbru/qemu/scripts/tracetool/format/log_stap.py", line 36, in c_macro_to_format
raise Exception("Unhandled macro '%s'" % macro)
Exception: Unhandled macro 'HWADDR_PRIx'

No idea. Nobody else reported a problem with this yet and the above error makes no sense to me. Cc'd some tracetool related people who hopefully can hint what might be wrong. Do you get error during build? What trace backend do you use?

Regards,
BALATON Zoltan

#8 lore raw

Re: [Qemu-devel] [PULL 4/5] hw/display: Add basic ATI VGA emulation

Quoted 64 lines · BALATON Zoltan
Quoted 54 lines · Markus Armbruster
Quoted 24 lines · Gerd Hoffmann

From: BALATON Zoltan <[email protected]>

At least two machines, the PPC mac99 and MIPS fulong2e, have an ATI gfx chip by default (Rage 128 Pro and M6/RV100 respectively) and guests running on these and the PMON2000 firmware of the fulong2e expect this to be available. Fortunately these are very similar chips so they can be mostly emulated in the same device model. This patch adds basic emulation of these ATI VGA chips.

While this is incomplete and currently only enough to run the MIPS firmware and get framebuffer output with Linux, it allows the fulong2e board to work more like the real hardware and having it in QEMU in this state provides a way to experiment with it and allows others to contribute to improve it. It is compiled for all archs but only the fulong2e (which currently has no display output at all) is set to use it by default (in a separate patch).

Message-id:
0b1b7c22873a6e37627261b04fb687412b25ff4f.1552152100.git.balaton@eik.bme.hu

[...]

Quoted 12 lines
hw/display/trace-events +0 -0
index 37d3264bb2e6..80993cc4d913 100644
@@ -138,3 +138,7 @@ vga_cirrus_write_blt(uint32_t offset, uint32_t val) "offset

0x%x, val 0x%x"
 sii9022_read_reg(uint8_t addr, uint8_t val) "addr 0x%02x, val 0x%02x" sii9022_write_reg(uint8_t addr, uint8_t val) "addr 0x%02x, val 0x%02x" sii9022_switch_mode(const char *mode) "mode: %s"

hw/display/trace-events +3 -0
+
+# hw/display/ati*.c
+ati_mm_read(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u
Quoted 3 lines

0x%"HWADDR_PRIx " %s -> 0x%"PRIx64
+ati_mm_write(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u 0x%"HWADDR_PRIx " %s <- 0x%"PRIx64

Blows up for me:

Traceback (most recent call last):
 File "/work/armbru/qemu/scripts/tracetool.py", line 152, in <module> main(sys.argv)
 File "/work/armbru/qemu/scripts/tracetool.py", line 147, in main binary=binary, probe_prefix=probe_prefix)
 File "/work/armbru/qemu/scripts/tracetool/__init__.py", line 472, in generate tracetool.format.generate(events, format, backend, group)
 File "/work/armbru/qemu/scripts/tracetool/format/__init__.py", line 85, in generate func(events, backend, group)
 File "/work/armbru/qemu/scripts/tracetool/format/log_stap.py", line 121, in generate

Quoted 8 lines

   fmt_str = "%d@%d " + e.name + " " + c_fmt_to_stap(e.fmt) + "\\n" File "/work/armbru/qemu/scripts/tracetool/format/log_stap.py", line 64, in c_fmt_to_stap
   bits.append(c_macro_to_format(macro))
 File "/work/armbru/qemu/scripts/tracetool/format/log_stap.py", line 36, in c_macro_to_format
   raise Exception("Unhandled macro '%s'" % macro)
Exception: Unhandled macro 'HWADDR_PRIx'

Quoted 3 lines

No idea. Nobody else reported a problem with this yet and the above error makes no sense to me. Cc'd some tracetool related people who hopefully can hint what might be wrong. Do you get error during build? What trace backend do you use?

You can't use HWADDR_PRIx in trace-events because other non-qemu-based trace backends have no awareness of it (as I also found out). For HWADDR_PRIx you need to use PRIx64 instead. I have a vague recollection of someone posting a patch for checkpatch to detect this - does it pass a local checkpatch run?

ATB,

Mark.

#9 lore raw

Re: [Qemu-devel] [PULL 4/5] hw/display: Add basic ATI VGA emulation

Quoted 66 lines · Mark Cave-Ayland
Quoted 64 lines · BALATON Zoltan
Quoted 62 lines · Markus Armbruster
Quoted 24 lines · Gerd Hoffmann

From: BALATON Zoltan <[email protected]>

At least two machines, the PPC mac99 and MIPS fulong2e, have an ATI gfx chip by default (Rage 128 Pro and M6/RV100 respectively) and guests running on these and the PMON2000 firmware of the fulong2e expect this to be available. Fortunately these are very similar chips so they can be mostly emulated in the same device model. This patch adds basic emulation of these ATI VGA chips.

While this is incomplete and currently only enough to run the MIPS firmware and get framebuffer output with Linux, it allows the fulong2e board to work more like the real hardware and having it in QEMU in this state provides a way to experiment with it and allows others to contribute to improve it. It is compiled for all archs but only the fulong2e (which currently has no display output at all) is set to use it by default (in a separate patch).

Message-id:
0b1b7c22873a6e37627261b04fb687412b25ff4f.1552152100.git.balaton@eik.bme.hu

[...]

Quoted 12 lines
hw/display/trace-events +0 -0
index 37d3264bb2e6..80993cc4d913 100644
@@ -138,3 +138,7 @@ vga_cirrus_write_blt(uint32_t offset, uint32_t val) "offset

0x%x, val 0x%x"
 sii9022_read_reg(uint8_t addr, uint8_t val) "addr 0x%02x, val 0x%02x" sii9022_write_reg(uint8_t addr, uint8_t val) "addr 0x%02x, val 0x%02x" sii9022_switch_mode(const char *mode) "mode: %s"

hw/display/trace-events +3 -0
+
+# hw/display/ati*.c
+ati_mm_read(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u
Quoted 3 lines

0x%"HWADDR_PRIx " %s -> 0x%"PRIx64
+ati_mm_write(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u 0x%"HWADDR_PRIx " %s <- 0x%"PRIx64

Blows up for me:

Traceback (most recent call last):
 File "/work/armbru/qemu/scripts/tracetool.py", line 152, in <module> main(sys.argv)
 File "/work/armbru/qemu/scripts/tracetool.py", line 147, in main binary=binary, probe_prefix=probe_prefix)
 File "/work/armbru/qemu/scripts/tracetool/__init__.py", line 472, in generate tracetool.format.generate(events, format, backend, group)
 File "/work/armbru/qemu/scripts/tracetool/format/__init__.py", line 85, in generate func(events, backend, group)
 File "/work/armbru/qemu/scripts/tracetool/format/log_stap.py", line 121, in generate fmt_str = "%d@%d " + e.name + " " + c_fmt_to_stap(e.fmt) + "\\n" File "/work/armbru/qemu/scripts/tracetool/format/log_stap.py", line 64, in c_fmt_to_stap
   bits.append(c_macro_to_format(macro))
 File "/work/armbru/qemu/scripts/tracetool/format/log_stap.py", line 36, in c_macro_to_format
   raise Exception("Unhandled macro '%s'" % macro)
Exception: Unhandled macro 'HWADDR_PRIx'

Quoted 3 lines
Quoted 3 lines

No idea. Nobody else reported a problem with this yet and the above error makes no sense to me. Cc'd some tracetool related people who hopefully can hint what might be wrong. Do you get error during build? What trace backend do you use?

I enable all trace backends for my integration testing. The error is thrown for the dtrace backend.

Quoted 4 lines

You can't use HWADDR_PRIx in trace-events because other non-qemu-based trace backends have no awareness of it (as I also found out). For HWADDR_PRIx you need to use PRIx64 instead. I have a vague recollection of someone posting a patch for checkpatch to detect this - does it pass a local checkpatch run?

Only unrelated warnings:

$ scripts/checkpatch.pl 0001-hw-display-Add-basic-ATI-VGA-emulation.patch 
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#69: 
new file mode 100644

WARNING: line over 80 characters
#176: FILE: hw/display/ati.c:103:
+ vbe_ioport_write_index(&s->vga, 0, VBE_DISPI_INDEX_Y_OFFSET);

total: 0 errors, 2 warnings, 1876 lines checked

#10 lore raw

Re: [Qemu-devel] [PULL 4/5] hw/display: Add basic ATI VGA emulation

Quoted 66 lines · Markus Armbruster
Quoted 65 lines · Mark Cave-Ayland
Quoted 64 lines · BALATON Zoltan
Quoted 62 lines · Markus Armbruster
Quoted 24 lines · Gerd Hoffmann

From: BALATON Zoltan <[email protected]>

At least two machines, the PPC mac99 and MIPS fulong2e, have an ATI gfx chip by default (Rage 128 Pro and M6/RV100 respectively) and guests running on these and the PMON2000 firmware of the fulong2e expect this to be available. Fortunately these are very similar chips so they can be mostly emulated in the same device model. This patch adds basic emulation of these ATI VGA chips.

While this is incomplete and currently only enough to run the MIPS firmware and get framebuffer output with Linux, it allows the fulong2e board to work more like the real hardware and having it in QEMU in this state provides a way to experiment with it and allows others to contribute to improve it. It is compiled for all archs but only the fulong2e (which currently has no display output at all) is set to use it by default (in a separate patch).

Message-id:
0b1b7c22873a6e37627261b04fb687412b25ff4f.1552152100.git.balaton@eik.bme.hu

[...]

Quoted 12 lines
hw/display/trace-events +0 -0
index 37d3264bb2e6..80993cc4d913 100644
@@ -138,3 +138,7 @@ vga_cirrus_write_blt(uint32_t offset, uint32_t val) "offset

0x%x, val 0x%x"
?sii9022_read_reg(uint8_t addr, uint8_t val) "addr 0x%02x, val 0x%02x" ?sii9022_write_reg(uint8_t addr, uint8_t val) "addr 0x%02x, val 0x%02x" ?sii9022_switch_mode(const char *mode) "mode: %s"

hw/display/trace-events +3 -0
+
+# hw/display/ati*.c
+ati_mm_read(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u
Quoted 3 lines

0x%"HWADDR_PRIx " %s -> 0x%"PRIx64
+ati_mm_write(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u 0x%"HWADDR_PRIx " %s <- 0x%"PRIx64

Blows up for me:

Traceback (most recent call last):
?File "/work/armbru/qemu/scripts/tracetool.py", line 152, in <module> ?? main(sys.argv)
?File "/work/armbru/qemu/scripts/tracetool.py", line 147, in main
?? binary=binary, probe_prefix=probe_prefix)
?File "/work/armbru/qemu/scripts/tracetool/__init__.py", line 472, in generate ?? tracetool.format.generate(events, format, backend, group)
?File "/work/armbru/qemu/scripts/tracetool/format/__init__.py", line 85, in generate ?? func(events, backend, group)
?File "/work/armbru/qemu/scripts/tracetool/format/log_stap.py", line 121, in generate ?? fmt_str = "%d@%d " + e.name + " " + c_fmt_to_stap(e.fmt) + "\\n" ?File "/work/armbru/qemu/scripts/tracetool/format/log_stap.py", line 64, in c_fmt_to_stap
?? bits.append(c_macro_to_format(macro))
?File "/work/armbru/qemu/scripts/tracetool/format/log_stap.py", line 36, in c_macro_to_format
?? raise Exception("Unhandled macro '%s'" % macro)
Exception: Unhandled macro 'HWADDR_PRIx'

Quoted 9 lines
Quoted 3 lines
Quoted 3 lines

No idea. Nobody else reported a problem with this yet and the above error makes no sense to me. Cc'd some tracetool related people who hopefully can hint what might be wrong. Do you get error during build? What trace backend do you use?

I enable all trace backends for my integration testing. The error is thrown for the dtrace backend.

Quoted 2 lines

You can't use HWADDR_PRIx in trace-events because other non-qemu-based trace backends have no awareness of it (as I also found out). For HWADDR_PRIx you need to use PRIx64

OK, does it compile for you if you change that to PRIx64? Should I submit a patch with that fix or do you want to make a patch?

Regards,
BALATON Zoltan

#11 lore raw

Re: [Qemu-devel] [PULL 4/5] hw/display: Add basic ATI VGA emulation

In reply to BALATON Zoltan
Quoted 59 lines · BALATON Zoltan
Quoted 40 lines · Markus Armbruster
Quoted 23 lines · Gerd Hoffmann

From: BALATON Zoltan <[email protected]>

At least two machines, the PPC mac99 and MIPS fulong2e, have an ATI gfx chip by default (Rage 128 Pro and M6/RV100 respectively) and guests running on these and the PMON2000 firmware of the fulong2e expect this to be available. Fortunately these are very similar chips so they can be mostly emulated in the same device model. This patch adds basic emulation of these ATI VGA chips.

While this is incomplete and currently only enough to run the MIPS firmware and get framebuffer output with Linux, it allows the fulong2e board to work more like the real hardware and having it in QEMU in this state provides a way to experiment with it and allows others to contribute to improve it. It is compiled for all archs but only the fulong2e (which currently has no display output at all) is set to use it by default (in a separate patch).

Message-id: 0b1b7c22873a6e37627261b04fb687412b25ff4f.1552152100.git.balaton@eik.bme.hu

[...]

hw/display/trace-events vga_cirrus_write_blt(uint32_t offset, uint32_t val) "offset 0x%x, val 0x%x" · line 144

Quoted 12 lines
hw/display/trace-events +4 -0
index 37d3264bb2e6..80993cc4d913 100644
@@ -138,3 +138,7 @@ vga_cirrus_write_blt(uint32_t offset, uint32_t val) "offset 0x%x, val 0x%x"
 sii9022_read_reg(uint8_t addr, uint8_t val) "addr 0x%02x, val 0x%02x"
 sii9022_write_reg(uint8_t addr, uint8_t val) "addr 0x%02x, val 0x%02x"
 sii9022_switch_mode(const char *mode) "mode: %s"
+
+# hw/display/ati*.c
+ati_mm_read(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u 0x%"HWADDR_PRIx " %s -> 0x%"PRIx64
+ati_mm_write(unsigned int size, uint64_t addr, const char *name, uint64_t val) "%u 0x%"HWADDR_PRIx " %s <- 0x%"PRIx64

Blows up for me:

Quoted 16 lines

Traceback (most recent call last):
File "/work/armbru/qemu/scripts/tracetool.py", line 152, in <module>
main(sys.argv)
File "/work/armbru/qemu/scripts/tracetool.py", line 147, in main
binary=binary, probe_prefix=probe_prefix)
File "/work/armbru/qemu/scripts/tracetool/__init__.py", line 472, in generate
tracetool.format.generate(events, format, backend, group)
File "/work/armbru/qemu/scripts/tracetool/format/__init__.py", line 85, in generate
func(events, backend, group)
File "/work/armbru/qemu/scripts/tracetool/format/log_stap.py", line 121, in generate
fmt_str = "%d@%d " + e.name + " " + c_fmt_to_stap(e.fmt) + "\\n"
File "/work/armbru/qemu/scripts/tracetool/format/log_stap.py", line 64, in c_fmt_to_stap
bits.append(c_macro_to_format(macro))
File "/work/armbru/qemu/scripts/tracetool/format/log_stap.py", line 36, in c_macro_to_format
raise Exception("Unhandled macro '%s'" % macro)
Exception: Unhandled macro 'HWADDR_PRIx'

Quoted 4 lines

No idea. Nobody else reported a problem with this yet and the above error makes no sense to me. Cc'd some tracetool related people who hopefully can hint what might be wrong. Do you get error during build? What trace backend do you use?

I hit the same issue on my daily QEMU builds for Fedora this morning:
https://copr-be.cloud.fedoraproject.org/results/davidlt/latest-qemu/fedora-29-x86_64/00867106-qemu/
build.log.gz contains all the details.

david

#12 lore raw
In reply to Gerd Hoffmann
Quoted 18 lines · Gerd Hoffmann

The following changes since commit e2a18635a400b0e68679614132e9ef6316105590:

Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-03-08' into staging (2019-03-09 20:55:44 +0000)

are available in the Git repository at:

git://git.kraxel.org/qemu tags/vga-20190311-v2-pull-request

for you to fetch changes up to ff243cff11526c0703cefdd60467dfaa5c5803a0:

mips_fulong2e: Add on-board graphics chip (2019-03-11 08:04:55 +0100)

----------------------------------------------------------------
vga: virtio reset fix, add ati emulation.

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

Quoted 9 lines

BALATON Zoltan (2):
hw/display: Add basic ATI VGA emulation
mips_fulong2e: Add on-board graphics chip

Gerd Hoffmann (3):
virtio: add class_size to VirtioPCIDeviceTypeInfo
virtio-vga: fix reset.
virtio-gpu: make virtio_gpu_reset static

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/4.0
for any user-visible changes.

-- PMM