qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/9] Fixes 20210326 patches
@ 2021-03-26 12:49 Gerd Hoffmann
  2021-03-26 12:49 ` [PULL 1/9] usb: Remove "-usbdevice ccid" Gerd Hoffmann
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2021-03-26 12:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, David Hildenbrand, Cornelia Huck, Richard Henderson,
	Halil Pasic, Christian Borntraeger, qemu-s390x,
	Michael S. Tsirkin, Gerd Hoffmann, Marc-André Lureau

The following changes since commit 9e2e9fe3df9f539f8b6941ceb96d25355fdae47e:

  Update version for v6.0.0-rc0 release (2021-03-24 19:50:49 +0000)

are available in the Git repository at:

  git://git.kraxel.org/qemu tags/fixes-20210326-pull-request

for you to fetch changes up to db0b034185824ac33e1a85ba62ab2030eb17b00d:

  hw/usb/hcd-ehci: Fix crash when showing help of EHCI devices (2021-03-26 11:10:49 +0100)

----------------------------------------------------------------
fixes for usb, virtio-gpu and vhost-gpu

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

Gerd Hoffmann (3):
  s390x: move S390_ADAPTER_SUPPRESSIBLE
  s390x: add have_virtio_ccw
  s390x: modularize virtio-gpu-ccw

Marc-André Lureau (3):
  vhost-user-gpu: glFlush before notifying clients
  vhost-user-gpu: fix vugbm_device_init fallback
  vhost-user-gpu: fix cursor move/update

Philippe Mathieu-Daudé (1):
  hw/usb/hcd-ehci-sysbus: Free USBPacket on instance finalize()

Thomas Huth (2):
  usb: Remove "-usbdevice ccid"
  hw/usb/hcd-ehci: Fix crash when showing help of EHCI devices

 contrib/vhost-user-gpu/vugbm.h          |  2 +-
 hw/s390x/virtio-ccw.h                   |  5 +++
 include/hw/s390x/css.h                  |  7 ----
 include/hw/s390x/s390_flic.h            |  3 ++
 target/s390x/cpu.h                      |  9 +++--
 contrib/vhost-user-gpu/vhost-user-gpu.c | 24 +++++++-------
 contrib/vhost-user-gpu/virgl.c          |  3 ++
 contrib/vhost-user-gpu/vugbm.c          | 44 +++++++++++--------------
 hw/s390x/virtio-ccw-gpu.c               |  4 ++-
 hw/s390x/virtio-ccw.c                   |  2 ++
 hw/usb/dev-smartcard-reader.c           |  1 -
 hw/usb/hcd-ehci-sysbus.c                |  9 +++++
 hw/usb/hcd-ehci.c                       | 10 +++---
 util/module.c                           |  1 +
 contrib/vhost-user-gpu/meson.build      |  2 +-
 docs/system/removed-features.rst        |  6 ++++
 hw/s390x/meson.build                    |  8 ++++-
 qemu-options.hx                         |  3 --
 18 files changed, 85 insertions(+), 58 deletions(-)

-- 
2.30.2




^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PULL 1/9] usb: Remove "-usbdevice ccid"
  2021-03-26 12:49 [PULL 0/9] Fixes 20210326 patches Gerd Hoffmann
@ 2021-03-26 12:49 ` Gerd Hoffmann
  2021-03-26 12:49 ` [PULL 2/9] vhost-user-gpu: glFlush before notifying clients Gerd Hoffmann
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2021-03-26 12:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, David Hildenbrand, Cornelia Huck, Richard Henderson,
	Halil Pasic, Christian Borntraeger, qemu-s390x,
	Michael S. Tsirkin, Gerd Hoffmann, Marc-André Lureau

From: Thomas Huth <thuth@redhat.com>

"-usbdevice ccid" was not documented and -usbdevice itself was marked
as deprecated before QEMU v6.0. And searching for "-usbdevice ccid"
in the internet does not show any useful results, so likely nobody
was using the ccid device via the -usbdevice option. Remove it now.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20210311092829.1479051-1-thuth@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/dev-smartcard-reader.c    | 1 -
 docs/system/removed-features.rst | 6 ++++++
 qemu-options.hx                  | 3 ---
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c
index 80109fa55168..bc3d94092a23 100644
--- a/hw/usb/dev-smartcard-reader.c
+++ b/hw/usb/dev-smartcard-reader.c
@@ -1492,7 +1492,6 @@ static void ccid_register_types(void)
     type_register_static(&ccid_bus_info);
     type_register_static(&ccid_card_type_info);
     type_register_static(&ccid_info);
-    usb_legacy_register(TYPE_USB_CCID_DEV, "ccid", NULL);
 }
 
 type_init(ccid_register_types)
diff --git a/docs/system/removed-features.rst b/docs/system/removed-features.rst
index f28387f183cc..29e90601a51a 100644
--- a/docs/system/removed-features.rst
+++ b/docs/system/removed-features.rst
@@ -120,6 +120,12 @@ Drives with interface types other than ``if=none`` are for onboard
 devices.  Drives the board doesn't pick up can no longer be used with
 -device.  Use ``if=none`` instead.
 
+``-usbdevice ccid`` (removed in 6.0)
+'''''''''''''''''''''''''''''''''''''
+
+This option was undocumented and not used in the field.
+Use `-device usb-ccid`` instead.
+
 
 QEMU Machine Protocol (QMP) commands
 ------------------------------------
diff --git a/qemu-options.hx b/qemu-options.hx
index d60a03d3a973..fd21002bd61d 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1743,9 +1743,6 @@ SRST
         corresponding ``braille`` chardev automatically beside the
         ``usb-braille`` USB device).
 
-    ``ccid``
-        Smartcard reader device
-
     ``keyboard``
         Standard USB keyboard. Will override the PS/2 keyboard (if present).
 
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PULL 2/9] vhost-user-gpu: glFlush before notifying clients
  2021-03-26 12:49 [PULL 0/9] Fixes 20210326 patches Gerd Hoffmann
  2021-03-26 12:49 ` [PULL 1/9] usb: Remove "-usbdevice ccid" Gerd Hoffmann
@ 2021-03-26 12:49 ` Gerd Hoffmann
  2021-03-26 12:49 ` [PULL 3/9] vhost-user-gpu: fix vugbm_device_init fallback Gerd Hoffmann
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2021-03-26 12:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, David Hildenbrand, Cornelia Huck, Richard Henderson,
	Halil Pasic, Christian Borntraeger, qemu-s390x,
	Michael S. Tsirkin, Gerd Hoffmann, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

For similar reasons as commit 3af1671852 ("spice: flush on GL update
before notifying client"), vhost-user-gpu must ensure the GL state is
flushed before sharing its rendering result.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210312100108.2706195-3-marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 contrib/vhost-user-gpu/virgl.c     | 3 +++
 contrib/vhost-user-gpu/meson.build | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/contrib/vhost-user-gpu/virgl.c b/contrib/vhost-user-gpu/virgl.c
index 8bb3c563d975..9e6660c7ab87 100644
--- a/contrib/vhost-user-gpu/virgl.c
+++ b/contrib/vhost-user-gpu/virgl.c
@@ -16,6 +16,8 @@
 #include <virglrenderer.h>
 #include "virgl.h"
 
+#include <epoxy/gl.h>
+
 void
 vg_virgl_update_cursor_data(VuGpu *g, uint32_t resource_id,
                             gpointer data)
@@ -372,6 +374,7 @@ virgl_cmd_resource_flush(VuGpu *g,
 
     VUGPU_FILL_CMD(rf);
 
+    glFlush();
     if (!rf.resource_id) {
         g_debug("bad resource id for flush..?");
         return;
diff --git a/contrib/vhost-user-gpu/meson.build b/contrib/vhost-user-gpu/meson.build
index 2fc2320b52fe..0ce1515a10e5 100644
--- a/contrib/vhost-user-gpu/meson.build
+++ b/contrib/vhost-user-gpu/meson.build
@@ -2,7 +2,7 @@ if 'CONFIG_TOOLS' in config_host and 'CONFIG_VIRGL' in config_host \
     and 'CONFIG_GBM' in config_host and 'CONFIG_LINUX' in config_host \
     and pixman.found()
   executable('vhost-user-gpu', files('vhost-user-gpu.c', 'virgl.c', 'vugbm.c'),
-             dependencies: [qemuutil, pixman, gbm, virgl, vhost_user],
+             dependencies: [qemuutil, pixman, gbm, virgl, vhost_user, opengl],
              install: true,
              install_dir: get_option('libexecdir'))
 
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PULL 3/9] vhost-user-gpu: fix vugbm_device_init fallback
  2021-03-26 12:49 [PULL 0/9] Fixes 20210326 patches Gerd Hoffmann
  2021-03-26 12:49 ` [PULL 1/9] usb: Remove "-usbdevice ccid" Gerd Hoffmann
  2021-03-26 12:49 ` [PULL 2/9] vhost-user-gpu: glFlush before notifying clients Gerd Hoffmann
@ 2021-03-26 12:49 ` Gerd Hoffmann
  2021-03-26 12:49 ` [PULL 4/9] vhost-user-gpu: fix cursor move/update Gerd Hoffmann
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2021-03-26 12:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, David Hildenbrand, Cornelia Huck, Richard Henderson,
	Halil Pasic, Christian Borntraeger, qemu-s390x,
	Michael S. Tsirkin, Gerd Hoffmann, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

vugbm implements GBM device wrapping, udmabuf and memory fallback.
However, the fallback/detection logic is flawed, as if "/dev/udmabuf"
failed to be opened, it will not initialize vugbm and crash later.

Rework the vugbm_device_init() logic to initialize correctly in all
cases.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210312100108.2706195-4-marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 contrib/vhost-user-gpu/vugbm.h          |  2 +-
 contrib/vhost-user-gpu/vhost-user-gpu.c |  6 +---
 contrib/vhost-user-gpu/vugbm.c          | 44 +++++++++++--------------
 3 files changed, 22 insertions(+), 30 deletions(-)

diff --git a/contrib/vhost-user-gpu/vugbm.h b/contrib/vhost-user-gpu/vugbm.h
index 66f1520764a6..82bc4934e1ba 100644
--- a/contrib/vhost-user-gpu/vugbm.h
+++ b/contrib/vhost-user-gpu/vugbm.h
@@ -54,7 +54,7 @@ struct vugbm_buffer {
     uint32_t format;
 };
 
-bool vugbm_device_init(struct vugbm_device *dev, int fd);
+void vugbm_device_init(struct vugbm_device *dev, int fd);
 void vugbm_device_destroy(struct vugbm_device *dev);
 
 bool vugbm_buffer_create(struct vugbm_buffer *buffer, struct vugbm_device *dev,
diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c
index b27990ffdbc0..ef40fbccbbd9 100644
--- a/contrib/vhost-user-gpu/vhost-user-gpu.c
+++ b/contrib/vhost-user-gpu/vhost-user-gpu.c
@@ -1186,11 +1186,7 @@ main(int argc, char *argv[])
         exit(EXIT_FAILURE);
     }
 
-    if (g.drm_rnode_fd >= 0) {
-        if (!vugbm_device_init(&g.gdev, g.drm_rnode_fd)) {
-            g_warning("Failed to init DRM device, using fallback path");
-        }
-    }
+    vugbm_device_init(&g.gdev, g.drm_rnode_fd);
 
     if ((!!opt_socket_path + (opt_fdnum != -1)) != 1) {
         g_printerr("Please specify either --fd or --socket-path\n");
diff --git a/contrib/vhost-user-gpu/vugbm.c b/contrib/vhost-user-gpu/vugbm.c
index f5304ada2f1b..fb15d0372c25 100644
--- a/contrib/vhost-user-gpu/vugbm.c
+++ b/contrib/vhost-user-gpu/vugbm.c
@@ -199,55 +199,51 @@ vugbm_device_destroy(struct vugbm_device *dev)
     dev->device_destroy(dev);
 }
 
-bool
+void
 vugbm_device_init(struct vugbm_device *dev, int fd)
 {
-    dev->fd = fd;
+    assert(!dev->inited);
 
 #ifdef CONFIG_GBM
-    dev->dev = gbm_create_device(fd);
-#endif
-
-    if (0) {
-        /* nothing */
+    if (fd >= 0) {
+        dev->dev = gbm_create_device(fd);
     }
-#ifdef CONFIG_GBM
-    else if (dev->dev != NULL) {
+    if (dev->dev != NULL) {
+        dev->fd = fd;
         dev->alloc_bo = alloc_bo;
         dev->free_bo = free_bo;
         dev->get_fd = get_fd;
         dev->map_bo = map_bo;
         dev->unmap_bo = unmap_bo;
         dev->device_destroy = device_destroy;
+        dev->inited = true;
     }
 #endif
 #ifdef CONFIG_MEMFD
-    else if (g_file_test("/dev/udmabuf", G_FILE_TEST_EXISTS)) {
+    if (!dev->inited && g_file_test("/dev/udmabuf", G_FILE_TEST_EXISTS)) {
         dev->fd = open("/dev/udmabuf", O_RDWR);
-        if (dev->fd < 0) {
-            return false;
+        if (dev->fd >= 0) {
+            g_debug("Using experimental udmabuf backend");
+            dev->alloc_bo = udmabuf_alloc_bo;
+            dev->free_bo = udmabuf_free_bo;
+            dev->get_fd = udmabuf_get_fd;
+            dev->map_bo = udmabuf_map_bo;
+            dev->unmap_bo = udmabuf_unmap_bo;
+            dev->device_destroy = udmabuf_device_destroy;
+            dev->inited = true;
         }
-        g_debug("Using experimental udmabuf backend");
-        dev->alloc_bo = udmabuf_alloc_bo;
-        dev->free_bo = udmabuf_free_bo;
-        dev->get_fd = udmabuf_get_fd;
-        dev->map_bo = udmabuf_map_bo;
-        dev->unmap_bo = udmabuf_unmap_bo;
-        dev->device_destroy = udmabuf_device_destroy;
     }
 #endif
-    else {
+    if (!dev->inited) {
         g_debug("Using mem fallback");
         dev->alloc_bo = mem_alloc_bo;
         dev->free_bo = mem_free_bo;
         dev->map_bo = mem_map_bo;
         dev->unmap_bo = mem_unmap_bo;
         dev->device_destroy = mem_device_destroy;
-        return false;
+        dev->inited = true;
     }
-
-    dev->inited = true;
-    return true;
+    assert(dev->inited);
 }
 
 static bool
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PULL 4/9] vhost-user-gpu: fix cursor move/update
  2021-03-26 12:49 [PULL 0/9] Fixes 20210326 patches Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2021-03-26 12:49 ` [PULL 3/9] vhost-user-gpu: fix vugbm_device_init fallback Gerd Hoffmann
@ 2021-03-26 12:49 ` Gerd Hoffmann
  2021-03-26 12:49 ` [PULL 5/9] hw/usb/hcd-ehci-sysbus: Free USBPacket on instance finalize() Gerd Hoffmann
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2021-03-26 12:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, David Hildenbrand, Cornelia Huck, Richard Henderson,
	Halil Pasic, Christian Borntraeger, qemu-s390x,
	Michael S. Tsirkin, Gerd Hoffmann, Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

"move" is incorrectly initialized.

Fix it by using a switch statement and also treating unknown commands
with a fallback.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210312100108.2706195-5-marcandre.lureau@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 contrib/vhost-user-gpu/vhost-user-gpu.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/contrib/vhost-user-gpu/vhost-user-gpu.c b/contrib/vhost-user-gpu/vhost-user-gpu.c
index ef40fbccbbd9..f73f292c9f72 100644
--- a/contrib/vhost-user-gpu/vhost-user-gpu.c
+++ b/contrib/vhost-user-gpu/vhost-user-gpu.c
@@ -892,11 +892,8 @@ update_cursor_data_simple(VuGpu *g, uint32_t resource_id, gpointer data)
 static void
 vg_process_cursor_cmd(VuGpu *g, struct virtio_gpu_update_cursor *cursor)
 {
-    bool move = cursor->hdr.type != VIRTIO_GPU_CMD_MOVE_CURSOR;
-
-    g_debug("%s move:%d\n", G_STRFUNC, move);
-
-    if (move) {
+    switch (cursor->hdr.type) {
+    case VIRTIO_GPU_CMD_MOVE_CURSOR: {
         VhostUserGpuMsg msg = {
             .request = cursor->resource_id ?
                 VHOST_USER_GPU_CURSOR_POS : VHOST_USER_GPU_CURSOR_POS_HIDE,
@@ -907,8 +904,11 @@ vg_process_cursor_cmd(VuGpu *g, struct virtio_gpu_update_cursor *cursor)
                 .y = cursor->pos.y,
             }
         };
+        g_debug("%s: move", G_STRFUNC);
         vg_send_msg(g, &msg, -1);
-    } else {
+        break;
+    }
+    case VIRTIO_GPU_CMD_UPDATE_CURSOR: {
         VhostUserGpuMsg msg = {
             .request = VHOST_USER_GPU_CURSOR_UPDATE,
             .size = sizeof(VhostUserGpuCursorUpdate),
@@ -922,6 +922,7 @@ vg_process_cursor_cmd(VuGpu *g, struct virtio_gpu_update_cursor *cursor)
                 .hot_y = cursor->hot_y,
             }
         };
+        g_debug("%s: update", G_STRFUNC);
         if (g->virgl) {
             vg_virgl_update_cursor_data(g, cursor->resource_id,
                                         msg.payload.cursor_update.data);
@@ -930,6 +931,11 @@ vg_process_cursor_cmd(VuGpu *g, struct virtio_gpu_update_cursor *cursor)
                                       msg.payload.cursor_update.data);
         }
         vg_send_msg(g, &msg, -1);
+        break;
+    }
+    default:
+        g_debug("%s: unknown cmd %d", G_STRFUNC, cursor->hdr.type);
+        break;
     }
 }
 
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PULL 5/9] hw/usb/hcd-ehci-sysbus: Free USBPacket on instance finalize()
  2021-03-26 12:49 [PULL 0/9] Fixes 20210326 patches Gerd Hoffmann
                   ` (3 preceding siblings ...)
  2021-03-26 12:49 ` [PULL 4/9] vhost-user-gpu: fix cursor move/update Gerd Hoffmann
@ 2021-03-26 12:49 ` Gerd Hoffmann
  2021-03-26 12:49 ` [PULL 6/9] s390x: move S390_ADAPTER_SUPPRESSIBLE Gerd Hoffmann
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2021-03-26 12:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, David Hildenbrand, Cornelia Huck, Richard Henderson,
	Philippe Mathieu-Daudé,
	Halil Pasic, Christian Borntraeger, qemu-s390x,
	Michael S. Tsirkin, Gerd Hoffmann, Marc-André Lureau

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

When building with --enable-sanitizers we get:

  Direct leak of 32 byte(s) in 2 object(s) allocated from:
      #0 0x5618479ec7cf in malloc (qemu-system-aarch64+0x233b7cf)
      #1 0x7f675745f958 in g_malloc (/lib64/libglib-2.0.so.0+0x58958)
      #2 0x561847f02ca2 in usb_packet_init hw/usb/core.c:531:5
      #3 0x561848df4df4 in usb_ehci_init hw/usb/hcd-ehci.c:2575:5
      #4 0x561847c119ac in ehci_sysbus_init hw/usb/hcd-ehci-sysbus.c:73:5
      #5 0x56184a5bdab8 in object_init_with_type qom/object.c:375:9
      #6 0x56184a5bd955 in object_init_with_type qom/object.c:371:9
      #7 0x56184a5a2bda in object_initialize_with_type qom/object.c:517:5
      #8 0x56184a5a24d5 in object_initialize qom/object.c:536:5
      #9 0x56184a5a2f6c in object_initialize_child_with_propsv qom/object.c:566:5
      #10 0x56184a5a2e60 in object_initialize_child_with_props qom/object.c:549:10
      #11 0x56184a5a3a1e in object_initialize_child_internal qom/object.c:603:5
      #12 0x561849542d18 in npcm7xx_init hw/arm/npcm7xx.c:427:5

Similarly to commit d710e1e7bd3 ("usb: ehci: fix memory leak in
ehci"), fix by calling usb_ehci_finalize() to free the USBPacket.

Fixes: 7341ea075c0
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20210323183701.281152-1-f4bug@amsat.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/hcd-ehci-sysbus.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c
index e3758db1b18e..a12e21884894 100644
--- a/hw/usb/hcd-ehci-sysbus.c
+++ b/hw/usb/hcd-ehci-sysbus.c
@@ -74,6 +74,14 @@ static void ehci_sysbus_init(Object *obj)
     sysbus_init_mmio(d, &s->mem);
 }
 
+static void ehci_sysbus_finalize(Object *obj)
+{
+    EHCISysBusState *i = SYS_BUS_EHCI(obj);
+    EHCIState *s = &i->ehci;
+
+    usb_ehci_finalize(s);
+}
+
 static void ehci_sysbus_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
@@ -94,6 +102,7 @@ static const TypeInfo ehci_type_info = {
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(EHCISysBusState),
     .instance_init = ehci_sysbus_init,
+    .instance_finalize = ehci_sysbus_finalize,
     .abstract      = true,
     .class_init    = ehci_sysbus_class_init,
     .class_size    = sizeof(SysBusEHCIClass),
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PULL 6/9] s390x: move S390_ADAPTER_SUPPRESSIBLE
  2021-03-26 12:49 [PULL 0/9] Fixes 20210326 patches Gerd Hoffmann
                   ` (4 preceding siblings ...)
  2021-03-26 12:49 ` [PULL 5/9] hw/usb/hcd-ehci-sysbus: Free USBPacket on instance finalize() Gerd Hoffmann
@ 2021-03-26 12:49 ` Gerd Hoffmann
  2021-03-26 12:49 ` [PULL 7/9] s390x: add have_virtio_ccw Gerd Hoffmann
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2021-03-26 12:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, David Hildenbrand, Cornelia Huck, Richard Henderson,
	Halil Pasic, Christian Borntraeger, qemu-s390x,
	Michael S. Tsirkin, Gerd Hoffmann, Marc-André Lureau

The definition S390_ADAPTER_SUPPRESSIBLE was moved to "cpu.h", per
suggestion of Thomas Huth. From interface design perspective, IMHO, not
a good thing as it belongs to the public interface of
css_register_io_adapters(). We did this because CONFIG_KVM requeires
NEED_CPU_H and Thomas, and other commenters did not like the
consequences of that.

Moving the interrupt related declarations to s390_flic.h was suggested
by Cornelia Huck.

Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
Tested-by: Halil Pasic <pasic@linux.ibm.com>
Message-Id: <20210317095622.2839895-2-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 include/hw/s390x/css.h       | 7 -------
 include/hw/s390x/s390_flic.h | 3 +++
 target/s390x/cpu.h           | 9 ++++++---
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h
index 7901ab276ce9..bba7593d2eaa 100644
--- a/include/hw/s390x/css.h
+++ b/include/hw/s390x/css.h
@@ -12,7 +12,6 @@
 #ifndef CSS_H
 #define CSS_H
 
-#include "cpu.h"
 #include "hw/s390x/adapter.h"
 #include "hw/s390x/s390_flic.h"
 #include "hw/s390x/ioinst.h"
@@ -233,12 +232,6 @@ uint32_t css_get_adapter_id(CssIoAdapterType type, uint8_t isc);
 void css_register_io_adapters(CssIoAdapterType type, bool swap, bool maskable,
                               uint8_t flags, Error **errp);
 
-#ifndef CONFIG_KVM
-#define S390_ADAPTER_SUPPRESSIBLE 0x01
-#else
-#define S390_ADAPTER_SUPPRESSIBLE KVM_S390_ADAPTER_SUPPRESSIBLE
-#endif
-
 #ifndef CONFIG_USER_ONLY
 SubchDev *css_find_subch(uint8_t m, uint8_t cssid, uint8_t ssid,
                          uint16_t schid);
diff --git a/include/hw/s390x/s390_flic.h b/include/hw/s390x/s390_flic.h
index e91b15d2d6af..3907a13d0766 100644
--- a/include/hw/s390x/s390_flic.h
+++ b/include/hw/s390x/s390_flic.h
@@ -134,6 +134,9 @@ void s390_flic_init(void);
 S390FLICState *s390_get_flic(void);
 QEMUS390FLICState *s390_get_qemu_flic(S390FLICState *fs);
 S390FLICStateClass *s390_get_flic_class(S390FLICState *fs);
+void s390_crw_mchk(void);
+void s390_io_interrupt(uint16_t subchannel_id, uint16_t subchannel_nr,
+                       uint32_t io_int_parm, uint32_t io_int_word);
 bool ais_needed(void *opaque);
 
 #endif /* HW_S390_FLIC_H */
diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
index 468b4430f339..2464d4076c0a 100644
--- a/target/s390x/cpu.h
+++ b/target/s390x/cpu.h
@@ -40,6 +40,12 @@
 
 #define S390_MAX_CPUS 248
 
+#ifndef CONFIG_KVM
+#define S390_ADAPTER_SUPPRESSIBLE 0x01
+#else
+#define S390_ADAPTER_SUPPRESSIBLE KVM_S390_ADAPTER_SUPPRESSIBLE
+#endif
+
 typedef struct PSW {
     uint64_t mask;
     uint64_t addr;
@@ -811,9 +817,6 @@ int cpu_s390x_signal_handler(int host_signum, void *pinfo, void *puc);
 
 
 /* interrupt.c */
-void s390_crw_mchk(void);
-void s390_io_interrupt(uint16_t subchannel_id, uint16_t subchannel_nr,
-                       uint32_t io_int_parm, uint32_t io_int_word);
 #define RA_IGNORED                  0
 void s390_program_interrupt(CPUS390XState *env, uint32_t code, uintptr_t ra);
 /* service interrupts are floating therefore we must not pass an cpustate */
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PULL 7/9] s390x: add have_virtio_ccw
  2021-03-26 12:49 [PULL 0/9] Fixes 20210326 patches Gerd Hoffmann
                   ` (5 preceding siblings ...)
  2021-03-26 12:49 ` [PULL 6/9] s390x: move S390_ADAPTER_SUPPRESSIBLE Gerd Hoffmann
@ 2021-03-26 12:49 ` Gerd Hoffmann
  2021-03-26 12:49 ` [PULL 8/9] s390x: modularize virtio-gpu-ccw Gerd Hoffmann
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2021-03-26 12:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, David Hildenbrand, Cornelia Huck, Richard Henderson,
	Halil Pasic, Christian Borntraeger, qemu-s390x,
	Michael S. Tsirkin, Gerd Hoffmann, Marc-André Lureau

Introduce a symbol which can be used to prevent ccw modules
being loaded into system emulators without ccw support.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
Tested-by: Halil Pasic <pasic@linux.ibm.com>
Message-Id: <20210317095622.2839895-3-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/s390x/virtio-ccw.h | 5 +++++
 hw/s390x/virtio-ccw.c | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/hw/s390x/virtio-ccw.h b/hw/s390x/virtio-ccw.h
index 49a2b8ca42df..0168232e3b8d 100644
--- a/hw/s390x/virtio-ccw.h
+++ b/hw/s390x/virtio-ccw.h
@@ -63,6 +63,11 @@ typedef struct VirtioBusClass VirtioCcwBusClass;
 DECLARE_OBJ_CHECKERS(VirtioCcwBusState, VirtioCcwBusClass,
                      VIRTIO_CCW_BUS, TYPE_VIRTIO_CCW_BUS)
 
+/*
+ * modules can reference this symbol to avoid being loaded
+ * into system emulators without ccw support
+ */
+extern bool have_virtio_ccw;
 
 struct VirtIOCCWDeviceClass {
     CCWDeviceClass parent_class;
diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c
index 06c06056814b..314ed7b24566 100644
--- a/hw/s390x/virtio-ccw.c
+++ b/hw/s390x/virtio-ccw.c
@@ -35,6 +35,8 @@
 
 #define NR_CLASSIC_INDICATOR_BITS 64
 
+bool have_virtio_ccw = true;
+
 static int virtio_ccw_dev_post_load(void *opaque, int version_id)
 {
     VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(opaque);
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PULL 8/9] s390x: modularize virtio-gpu-ccw
  2021-03-26 12:49 [PULL 0/9] Fixes 20210326 patches Gerd Hoffmann
                   ` (6 preceding siblings ...)
  2021-03-26 12:49 ` [PULL 7/9] s390x: add have_virtio_ccw Gerd Hoffmann
@ 2021-03-26 12:49 ` Gerd Hoffmann
  2021-03-26 12:49 ` [PULL 9/9] hw/usb/hcd-ehci: Fix crash when showing help of EHCI devices Gerd Hoffmann
  2021-03-26 17:50 ` [PULL 0/9] Fixes 20210326 patches Peter Maydell
  9 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2021-03-26 12:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, David Hildenbrand, Cornelia Huck, Richard Henderson,
	Halil Pasic, Christian Borntraeger, qemu-s390x,
	Michael S. Tsirkin, Gerd Hoffmann, Marc-André Lureau

Since the virtio-gpu-ccw device depends on the hw-display-virtio-gpu
module, which provides the type virtio-gpu-device, packaging the
hw-display-virtio-gpu module as a separate package that may or may not
be installed along with the qemu package leads to problems. Namely if
the hw-display-virtio-gpu is absent, qemu continues to advertise
virtio-gpu-ccw, but it aborts not only when one attempts using
virtio-gpu-ccw, but also when libvirtd's capability probing tries
to instantiate the type to introspect it.

Let us thus introduce a module named hw-s390x-virtio-gpu-ccw that
is going to provide the virtio-gpu-ccw device. The hw-s390x prefix
was chosen because it is not a portable device.

With virtio-gpu-ccw built as a module, the correct way to package a
modularized qemu is to require that hw-display-virtio-gpu must be
installed whenever the module hw-s390x-virtio-gpu-ccw.

Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
Tested-by: Halil Pasic <pasic@linux.ibm.com>
Message-Id: <20210317095622.2839895-4-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/s390x/virtio-ccw-gpu.c | 4 +++-
 util/module.c             | 1 +
 hw/s390x/meson.build      | 8 +++++++-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/hw/s390x/virtio-ccw-gpu.c b/hw/s390x/virtio-ccw-gpu.c
index c301e2586bde..75a9e4bb3908 100644
--- a/hw/s390x/virtio-ccw-gpu.c
+++ b/hw/s390x/virtio-ccw-gpu.c
@@ -62,7 +62,9 @@ static const TypeInfo virtio_ccw_gpu = {
 
 static void virtio_ccw_gpu_register(void)
 {
-    type_register_static(&virtio_ccw_gpu);
+    if (have_virtio_ccw) {
+        type_register_static(&virtio_ccw_gpu);
+    }
 }
 
 type_init(virtio_ccw_gpu_register)
diff --git a/util/module.c b/util/module.c
index c65060c167df..cbe89fede628 100644
--- a/util/module.c
+++ b/util/module.c
@@ -304,6 +304,7 @@ static struct {
     { "virtio-gpu-pci-base",   "hw-", "display-virtio-gpu-pci" },
     { "virtio-gpu-pci",        "hw-", "display-virtio-gpu-pci" },
     { "vhost-user-gpu-pci",    "hw-", "display-virtio-gpu-pci" },
+    { "virtio-gpu-ccw",        "hw-", "s390x-virtio-gpu-ccw"   },
     { "virtio-vga-base",       "hw-", "display-virtio-vga"    },
     { "virtio-vga",            "hw-", "display-virtio-vga"    },
     { "vhost-user-vga",        "hw-", "display-virtio-vga"    },
diff --git a/hw/s390x/meson.build b/hw/s390x/meson.build
index 91495b563146..327e9c93afa9 100644
--- a/hw/s390x/meson.build
+++ b/hw/s390x/meson.build
@@ -34,7 +34,6 @@ virtio_ss.add(files('virtio-ccw.c'))
 virtio_ss.add(when: 'CONFIG_VIRTIO_BALLOON', if_true: files('virtio-ccw-balloon.c'))
 virtio_ss.add(when: 'CONFIG_VIRTIO_BLK', if_true: files('virtio-ccw-blk.c'))
 virtio_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('virtio-ccw-crypto.c'))
-virtio_ss.add(when: 'CONFIG_VIRTIO_GPU', if_true: files('virtio-ccw-gpu.c'))
 virtio_ss.add(when: 'CONFIG_VIRTIO_INPUT', if_true: files('virtio-ccw-input.c'))
 virtio_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('virtio-ccw-net.c'))
 virtio_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files('virtio-ccw-rng.c'))
@@ -48,3 +47,10 @@ virtio_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost-user-fs-ccw.c'
 s390x_ss.add_all(when: 'CONFIG_VIRTIO_CCW', if_true: virtio_ss)
 
 hw_arch += {'s390x': s390x_ss}
+
+hw_s390x_modules = {}
+virtio_gpu_ccw_ss = ss.source_set()
+virtio_gpu_ccw_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRTIO_CCW'],
+                      if_true: [files('virtio-ccw-gpu.c'), pixman])
+hw_s390x_modules += {'virtio-gpu-ccw': virtio_gpu_ccw_ss}
+modules += {'hw-s390x': hw_s390x_modules}
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PULL 9/9] hw/usb/hcd-ehci: Fix crash when showing help of EHCI devices
  2021-03-26 12:49 [PULL 0/9] Fixes 20210326 patches Gerd Hoffmann
                   ` (7 preceding siblings ...)
  2021-03-26 12:49 ` [PULL 8/9] s390x: modularize virtio-gpu-ccw Gerd Hoffmann
@ 2021-03-26 12:49 ` Gerd Hoffmann
  2021-03-26 17:50 ` [PULL 0/9] Fixes 20210326 patches Peter Maydell
  9 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2021-03-26 12:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, David Hildenbrand, Cornelia Huck, Richard Henderson,
	Halil Pasic, Christian Borntraeger, qemu-s390x,
	Michael S. Tsirkin, Gerd Hoffmann, Marc-André Lureau

From: Thomas Huth <thuth@redhat.com>

QEMU crashes with certain targets when trying to show the help
output of EHCI devices:

$ ./qemu-system-aarch64 -device ich9-usb-ehci1,help
qemu-system-aarch64: ../../devel/qemu/softmmu/physmem.c:1154: phys_section_add:
 Assertion `map->sections_nb < TARGET_PAGE_SIZE' failed.
Aborted (core dumped)

This happens because the device is doing things at "instance_init" time
that should be done at "realize" time instead. So move the related code
to the realize() function instead. (NB: This now also matches the
memory_region_del_subregion() calls which are done in usb_ehci_unrealize(),
and not during finalize()).

Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20210326095155.1994604-1-thuth@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/hcd-ehci.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index f71af0ad2d8f..6caa7ac6c28f 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -2514,6 +2514,11 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp)
         return;
     }
 
+    memory_region_add_subregion(&s->mem, s->capsbase, &s->mem_caps);
+    memory_region_add_subregion(&s->mem, s->opregbase, &s->mem_opreg);
+    memory_region_add_subregion(&s->mem, s->opregbase + s->portscbase,
+                                &s->mem_ports);
+
     usb_bus_new(&s->bus, sizeof(s->bus), s->companion_enable ?
                 &ehci_bus_ops_companion : &ehci_bus_ops_standalone, dev);
     for (i = 0; i < s->portnr; i++) {
@@ -2581,11 +2586,6 @@ void usb_ehci_init(EHCIState *s, DeviceState *dev)
                           "operational", s->portscbase);
     memory_region_init_io(&s->mem_ports, OBJECT(dev), &ehci_mmio_port_ops, s,
                           "ports", 4 * s->portnr);
-
-    memory_region_add_subregion(&s->mem, s->capsbase, &s->mem_caps);
-    memory_region_add_subregion(&s->mem, s->opregbase, &s->mem_opreg);
-    memory_region_add_subregion(&s->mem, s->opregbase + s->portscbase,
-                                &s->mem_ports);
 }
 
 void usb_ehci_finalize(EHCIState *s)
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PULL 0/9] Fixes 20210326 patches
  2021-03-26 12:49 [PULL 0/9] Fixes 20210326 patches Gerd Hoffmann
                   ` (8 preceding siblings ...)
  2021-03-26 12:49 ` [PULL 9/9] hw/usb/hcd-ehci: Fix crash when showing help of EHCI devices Gerd Hoffmann
@ 2021-03-26 17:50 ` Peter Maydell
  9 siblings, 0 replies; 11+ messages in thread
From: Peter Maydell @ 2021-03-26 17:50 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Thomas Huth, David Hildenbrand, Cornelia Huck, Richard Henderson,
	QEMU Developers, Halil Pasic, Christian Borntraeger, qemu-s390x,
	Michael S. Tsirkin, Marc-André Lureau

On Fri, 26 Mar 2021 at 12:53, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> The following changes since commit 9e2e9fe3df9f539f8b6941ceb96d25355fdae47e:
>
>   Update version for v6.0.0-rc0 release (2021-03-24 19:50:49 +0000)
>
> are available in the Git repository at:
>
>   git://git.kraxel.org/qemu tags/fixes-20210326-pull-request
>
> for you to fetch changes up to db0b034185824ac33e1a85ba62ab2030eb17b00d:
>
>   hw/usb/hcd-ehci: Fix crash when showing help of EHCI devices (2021-03-26 11:10:49 +0100)
>
> ----------------------------------------------------------------
> fixes for usb, virtio-gpu and vhost-gpu
>
> ----------------------------------------------------------------

Applied, thanks.

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

-- PMM


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-03-26 17:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-26 12:49 [PULL 0/9] Fixes 20210326 patches Gerd Hoffmann
2021-03-26 12:49 ` [PULL 1/9] usb: Remove "-usbdevice ccid" Gerd Hoffmann
2021-03-26 12:49 ` [PULL 2/9] vhost-user-gpu: glFlush before notifying clients Gerd Hoffmann
2021-03-26 12:49 ` [PULL 3/9] vhost-user-gpu: fix vugbm_device_init fallback Gerd Hoffmann
2021-03-26 12:49 ` [PULL 4/9] vhost-user-gpu: fix cursor move/update Gerd Hoffmann
2021-03-26 12:49 ` [PULL 5/9] hw/usb/hcd-ehci-sysbus: Free USBPacket on instance finalize() Gerd Hoffmann
2021-03-26 12:49 ` [PULL 6/9] s390x: move S390_ADAPTER_SUPPRESSIBLE Gerd Hoffmann
2021-03-26 12:49 ` [PULL 7/9] s390x: add have_virtio_ccw Gerd Hoffmann
2021-03-26 12:49 ` [PULL 8/9] s390x: modularize virtio-gpu-ccw Gerd Hoffmann
2021-03-26 12:49 ` [PULL 9/9] hw/usb/hcd-ehci: Fix crash when showing help of EHCI devices Gerd Hoffmann
2021-03-26 17:50 ` [PULL 0/9] Fixes 20210326 patches Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).