Skip to content

Commit 7b9a3c9

Browse files
committed
Merge remote-tracking branch 'remotes/kraxel/tags/fixes-20210326-pull-request' into staging
fixes for usb, virtio-gpu and vhost-gpu # gpg: Signature made Fri 26 Mar 2021 12:49:14 GMT # gpg: using RSA key A0328CFFB93A17A79901FE7D4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full] # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full] # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full] # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/fixes-20210326-pull-request: hw/usb/hcd-ehci: Fix crash when showing help of EHCI devices s390x: modularize virtio-gpu-ccw s390x: add have_virtio_ccw s390x: move S390_ADAPTER_SUPPRESSIBLE hw/usb/hcd-ehci-sysbus: Free USBPacket on instance finalize() vhost-user-gpu: fix cursor move/update vhost-user-gpu: fix vugbm_device_init fallback vhost-user-gpu: glFlush before notifying clients usb: Remove "-usbdevice ccid" Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 parents 63ad23f + db0b034 commit 7b9a3c9

File tree

18 files changed

+85
-58
lines changed

18 files changed

+85
-58
lines changed

contrib/vhost-user-gpu/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ if 'CONFIG_TOOLS' in config_host and 'CONFIG_VIRGL' in config_host \
22
and 'CONFIG_GBM' in config_host and 'CONFIG_LINUX' in config_host \
33
and pixman.found()
44
executable('vhost-user-gpu', files('vhost-user-gpu.c', 'virgl.c', 'vugbm.c'),
5-
dependencies: [qemuutil, pixman, gbm, virgl, vhost_user],
5+
dependencies: [qemuutil, pixman, gbm, virgl, vhost_user, opengl],
66
install: true,
77
install_dir: get_option('libexecdir'))
88

contrib/vhost-user-gpu/vhost-user-gpu.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -892,11 +892,8 @@ update_cursor_data_simple(VuGpu *g, uint32_t resource_id, gpointer data)
892892
static void
893893
vg_process_cursor_cmd(VuGpu *g, struct virtio_gpu_update_cursor *cursor)
894894
{
895-
bool move = cursor->hdr.type != VIRTIO_GPU_CMD_MOVE_CURSOR;
896-
897-
g_debug("%s move:%d\n", G_STRFUNC, move);
898-
899-
if (move) {
895+
switch (cursor->hdr.type) {
896+
case VIRTIO_GPU_CMD_MOVE_CURSOR: {
900897
VhostUserGpuMsg msg = {
901898
.request = cursor->resource_id ?
902899
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)
907904
.y = cursor->pos.y,
908905
}
909906
};
907+
g_debug("%s: move", G_STRFUNC);
910908
vg_send_msg(g, &msg, -1);
911-
} else {
909+
break;
910+
}
911+
case VIRTIO_GPU_CMD_UPDATE_CURSOR: {
912912
VhostUserGpuMsg msg = {
913913
.request = VHOST_USER_GPU_CURSOR_UPDATE,
914914
.size = sizeof(VhostUserGpuCursorUpdate),
@@ -922,6 +922,7 @@ vg_process_cursor_cmd(VuGpu *g, struct virtio_gpu_update_cursor *cursor)
922922
.hot_y = cursor->hot_y,
923923
}
924924
};
925+
g_debug("%s: update", G_STRFUNC);
925926
if (g->virgl) {
926927
vg_virgl_update_cursor_data(g, cursor->resource_id,
927928
msg.payload.cursor_update.data);
@@ -930,6 +931,11 @@ vg_process_cursor_cmd(VuGpu *g, struct virtio_gpu_update_cursor *cursor)
930931
msg.payload.cursor_update.data);
931932
}
932933
vg_send_msg(g, &msg, -1);
934+
break;
935+
}
936+
default:
937+
g_debug("%s: unknown cmd %d", G_STRFUNC, cursor->hdr.type);
938+
break;
933939
}
934940
}
935941

@@ -1186,11 +1192,7 @@ main(int argc, char *argv[])
11861192
exit(EXIT_FAILURE);
11871193
}
11881194

1189-
if (g.drm_rnode_fd >= 0) {
1190-
if (!vugbm_device_init(&g.gdev, g.drm_rnode_fd)) {
1191-
g_warning("Failed to init DRM device, using fallback path");
1192-
}
1193-
}
1195+
vugbm_device_init(&g.gdev, g.drm_rnode_fd);
11941196

11951197
if ((!!opt_socket_path + (opt_fdnum != -1)) != 1) {
11961198
g_printerr("Please specify either --fd or --socket-path\n");

contrib/vhost-user-gpu/virgl.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include <virglrenderer.h>
1717
#include "virgl.h"
1818

19+
#include <epoxy/gl.h>
20+
1921
void
2022
vg_virgl_update_cursor_data(VuGpu *g, uint32_t resource_id,
2123
gpointer data)
@@ -372,6 +374,7 @@ virgl_cmd_resource_flush(VuGpu *g,
372374

373375
VUGPU_FILL_CMD(rf);
374376

377+
glFlush();
375378
if (!rf.resource_id) {
376379
g_debug("bad resource id for flush..?");
377380
return;

contrib/vhost-user-gpu/vugbm.c

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -199,55 +199,51 @@ vugbm_device_destroy(struct vugbm_device *dev)
199199
dev->device_destroy(dev);
200200
}
201201

202-
bool
202+
void
203203
vugbm_device_init(struct vugbm_device *dev, int fd)
204204
{
205-
dev->fd = fd;
205+
assert(!dev->inited);
206206

207207
#ifdef CONFIG_GBM
208-
dev->dev = gbm_create_device(fd);
209-
#endif
210-
211-
if (0) {
212-
/* nothing */
208+
if (fd >= 0) {
209+
dev->dev = gbm_create_device(fd);
213210
}
214-
#ifdef CONFIG_GBM
215-
else if (dev->dev != NULL) {
211+
if (dev->dev != NULL) {
212+
dev->fd = fd;
216213
dev->alloc_bo = alloc_bo;
217214
dev->free_bo = free_bo;
218215
dev->get_fd = get_fd;
219216
dev->map_bo = map_bo;
220217
dev->unmap_bo = unmap_bo;
221218
dev->device_destroy = device_destroy;
219+
dev->inited = true;
222220
}
223221
#endif
224222
#ifdef CONFIG_MEMFD
225-
else if (g_file_test("/dev/udmabuf", G_FILE_TEST_EXISTS)) {
223+
if (!dev->inited && g_file_test("/dev/udmabuf", G_FILE_TEST_EXISTS)) {
226224
dev->fd = open("/dev/udmabuf", O_RDWR);
227-
if (dev->fd < 0) {
228-
return false;
225+
if (dev->fd >= 0) {
226+
g_debug("Using experimental udmabuf backend");
227+
dev->alloc_bo = udmabuf_alloc_bo;
228+
dev->free_bo = udmabuf_free_bo;
229+
dev->get_fd = udmabuf_get_fd;
230+
dev->map_bo = udmabuf_map_bo;
231+
dev->unmap_bo = udmabuf_unmap_bo;
232+
dev->device_destroy = udmabuf_device_destroy;
233+
dev->inited = true;
229234
}
230-
g_debug("Using experimental udmabuf backend");
231-
dev->alloc_bo = udmabuf_alloc_bo;
232-
dev->free_bo = udmabuf_free_bo;
233-
dev->get_fd = udmabuf_get_fd;
234-
dev->map_bo = udmabuf_map_bo;
235-
dev->unmap_bo = udmabuf_unmap_bo;
236-
dev->device_destroy = udmabuf_device_destroy;
237235
}
238236
#endif
239-
else {
237+
if (!dev->inited) {
240238
g_debug("Using mem fallback");
241239
dev->alloc_bo = mem_alloc_bo;
242240
dev->free_bo = mem_free_bo;
243241
dev->map_bo = mem_map_bo;
244242
dev->unmap_bo = mem_unmap_bo;
245243
dev->device_destroy = mem_device_destroy;
246-
return false;
244+
dev->inited = true;
247245
}
248-
249-
dev->inited = true;
250-
return true;
246+
assert(dev->inited);
251247
}
252248

253249
static bool

contrib/vhost-user-gpu/vugbm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ struct vugbm_buffer {
5454
uint32_t format;
5555
};
5656

57-
bool vugbm_device_init(struct vugbm_device *dev, int fd);
57+
void vugbm_device_init(struct vugbm_device *dev, int fd);
5858
void vugbm_device_destroy(struct vugbm_device *dev);
5959

6060
bool vugbm_buffer_create(struct vugbm_buffer *buffer, struct vugbm_device *dev,

docs/system/removed-features.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ Drives with interface types other than ``if=none`` are for onboard
120120
devices. Drives the board doesn't pick up can no longer be used with
121121
-device. Use ``if=none`` instead.
122122

123+
``-usbdevice ccid`` (removed in 6.0)
124+
'''''''''''''''''''''''''''''''''''''
125+
126+
This option was undocumented and not used in the field.
127+
Use `-device usb-ccid`` instead.
128+
123129

124130
QEMU Machine Protocol (QMP) commands
125131
------------------------------------

hw/s390x/meson.build

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ virtio_ss.add(files('virtio-ccw.c'))
3434
virtio_ss.add(when: 'CONFIG_VIRTIO_BALLOON', if_true: files('virtio-ccw-balloon.c'))
3535
virtio_ss.add(when: 'CONFIG_VIRTIO_BLK', if_true: files('virtio-ccw-blk.c'))
3636
virtio_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('virtio-ccw-crypto.c'))
37-
virtio_ss.add(when: 'CONFIG_VIRTIO_GPU', if_true: files('virtio-ccw-gpu.c'))
3837
virtio_ss.add(when: 'CONFIG_VIRTIO_INPUT', if_true: files('virtio-ccw-input.c'))
3938
virtio_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('virtio-ccw-net.c'))
4039
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'
4847
s390x_ss.add_all(when: 'CONFIG_VIRTIO_CCW', if_true: virtio_ss)
4948

5049
hw_arch += {'s390x': s390x_ss}
50+
51+
hw_s390x_modules = {}
52+
virtio_gpu_ccw_ss = ss.source_set()
53+
virtio_gpu_ccw_ss.add(when: ['CONFIG_VIRTIO_GPU', 'CONFIG_VIRTIO_CCW'],
54+
if_true: [files('virtio-ccw-gpu.c'), pixman])
55+
hw_s390x_modules += {'virtio-gpu-ccw': virtio_gpu_ccw_ss}
56+
modules += {'hw-s390x': hw_s390x_modules}

hw/s390x/virtio-ccw-gpu.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ static const TypeInfo virtio_ccw_gpu = {
6262

6363
static void virtio_ccw_gpu_register(void)
6464
{
65-
type_register_static(&virtio_ccw_gpu);
65+
if (have_virtio_ccw) {
66+
type_register_static(&virtio_ccw_gpu);
67+
}
6668
}
6769

6870
type_init(virtio_ccw_gpu_register)

hw/s390x/virtio-ccw.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636
#define NR_CLASSIC_INDICATOR_BITS 64
3737

38+
bool have_virtio_ccw = true;
39+
3840
static int virtio_ccw_dev_post_load(void *opaque, int version_id)
3941
{
4042
VirtioCcwDevice *dev = VIRTIO_CCW_DEVICE(opaque);

hw/s390x/virtio-ccw.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ typedef struct VirtioBusClass VirtioCcwBusClass;
6363
DECLARE_OBJ_CHECKERS(VirtioCcwBusState, VirtioCcwBusClass,
6464
VIRTIO_CCW_BUS, TYPE_VIRTIO_CCW_BUS)
6565

66+
/*
67+
* modules can reference this symbol to avoid being loaded
68+
* into system emulators without ccw support
69+
*/
70+
extern bool have_virtio_ccw;
6671

6772
struct VirtIOCCWDeviceClass {
6873
CCWDeviceClass parent_class;

0 commit comments

Comments
 (0)