Misc HW patches for 2026-07-14
The following changes since commit 191489ba750f13357ac677fb3b059f6f89ee4287:
Merge tag 'pull-riscv-to-apply-20260714' of https://github.com/alistair23/qemu into staging (2026-07-14 07:26:45 +0100)
are available in the Git repository at:
https://github.com/philmd/qemu.git tags/hw-misc-20260714
for you to fetch changes up to a38455cf9368e7370b0cfea809ef228ffa2e8209:
net: only advertise passt in netdev help when CONFIG_PASST (2026-07-14 21:33:53 +0200)
----------------------------------------------------------------
Misc HW patches
Various fixes mostly related to misc hardware devices.
----------------------------------------------------------------
Bin Meng (1):
docs/devel: Document SSI dummy-cycle ownership
Dmitry Pimenov (1):
hw/sparc64/niagara: use int64_t for vdisk size to avoid truncation
Haotian Jiang (1):
hw/misc/ivshmem: clear chardev handlers before freeing peers
Marc-André Lureau (2):
hw/display/qxl: fix TOCTOU in cursor chunk data_size handling hw/display/virtio-gpu: fix dmabuf_fd leak on remap failure
Miao Wang (2):
hw/scsi/vmw_pvscsi: translate data endianness hw/scsi/vmw_pvscsi: add a comment to explain the endianness
Rohitashv Kumar (1):
net: only advertise passt in netdev help when CONFIG_PASST
Thomas Huth (5):
hw/sparc64/sun4u: Mark unusable PCI busses as full to ease device
plugging
hw/usb/hcd-ohci: Make sure that ohci_service_ed_list() cannot loop
forever
hw/usb/hcd-xhci: Turn guest-triggerable abort() into qemu_log_mask() hw/usb/hcd-xhci: Remove the FIXME macro
hw/usb/hcd-xhci: Use qemu_log_mask() instead of fprintf() statement
MAINTAINERS | 1 + docs/devel/index-internals.rst | 1 + docs/devel/ssi.rst | 132 ++++++++++++++++++++++++++++++++ hw/scsi/vmw_pvscsi.h | 14 ++++ hw/display/qxl-render.c | 28 ++++--- hw/display/virtio-gpu-udmabuf.c | 1 + hw/misc/ivshmem-pci.c | 6 ++ hw/scsi/vmw_pvscsi.c | 57 +++++++++++++- hw/sparc64/niagara.c | 2 +- hw/sparc64/sun4u.c | 7 ++ hw/usb/hcd-ohci.c | 10 +++ hw/usb/hcd-xhci.c | 15 ++-- net/net.c | 2 + 13 files changed, 255 insertions(+), 21 deletions(-) create mode 100644 docs/devel/ssi.rst
Signature · 1 line
2.53.0
[PULL 01/13] hw/sparc64/sun4u: Mark unusable PCI busses as full to ease device plugging
From: Thomas Huth <[email protected]>
When trying to plug a PCI device to a Sparc64 machine, you currently have to specify the right bus ("bus=pciB"), otherwise you get this error:
$ qemu-system-sparc64 -device virtio-scsi-pci qemu-system-sparc64: -device virtio-scsi-pci: PCI: no slot/function available for virtio-scsi-pci, all in use or reserved
This is quite annoying for the unexperienced users, and it also breaks e.g. the iotests ("make check-block") when running with qemu-system-sparc64.
Mark the non-usable PCI busses as full now, so that QEMU can automatically plug new PCI devices to the right "pciB" bus.
Message-ID: <[email protected]>
--- hw/sparc64/sun4u.c | 7 +++++++ 1 file changed, 7 insertions(+)
hw/sparc64/sun4u.c +7 -0
@@ -719,6 +719,13 @@ static void sun4uv_init(MemoryRegion *address_space_mem,fw_cfg_add_i16 (fw_cfg,FW_CFG_SPARC64_DEPTH , graphic_depth);qemu_register_boot_set (fw_cfg_boot_set, fw_cfg); + +/* +* Mark internal PCI busses as full so that the plugging of additional +* PCI devices happens on the right bus that still has free slots: +*/ +qbus_mark_full (&pci_bus->qbus); +qbus_mark_full (&pci_busA->qbus); }enum {
Signature · 1 line
2.53.0
[PULL 04/13] hw/scsi/vmw_pvscsi: translate data endianness
In reply to Philippe Mathieu-DaudéFrom: Miao Wang <[email protected]>
This patch improves the implementation of the pvscsi device by translating the endianness of the data sent or received from the guest. This ensures pvscsi can work on big-endian hosts with little-endian guests.
This patch assumes, although not having found any specifications, that the pvscsi device is little-endian, since pvscsi seems to be used only on x86 platforms, which are little-endian.
Message-ID: <[email protected]>
--- hw/scsi/vmw_pvscsi.c | 57 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-)
hw/scsi/vmw_pvscsi.c +56 -1
@@ -392,9 +392,18 @@ static void pvscsi_cmp_ring_put(PVSCSIState *s, struct PVSCSIRingCmpDesc *cmp_desc) {hwaddr cmp_descr_pa; +PVSCSIRingCmpDesc cmp_desc_conv; cmp_descr_pa =pvscsi_ring_pop_cmp_descr (&s->rings);trace_pvscsi_cmp_ring_put (cmp_descr_pa); + cmp_desc_conv = (struct PVSCSIRingCmpDesc ) { + .context =cpu_to_le64 (cmp_desc->context), + .dataLen =cpu_to_le64 (cmp_desc->dataLen), + .senseLen =cpu_to_le32 (cmp_desc->senseLen), + .hostStatus =cpu_to_le16 (cmp_desc->hostStatus), + .scsiStatus =cpu_to_le16 (cmp_desc->scsiStatus), + }; + cmp_desc = &cmp_desc_conv;physical_memory_write (cmp_descr_pa, cmp_desc,sizeof (*cmp_desc)); }
@@ -402,9 +411,18 @@ static void pvscsi_msg_ring_put(PVSCSIState *s, struct PVSCSIRingMsgDesc *msg_desc) {hwaddr msg_descr_pa; +PVSCSIRingMsgDesc msg_desc_conv; +int i; msg_descr_pa =pvscsi_ring_pop_msg_descr (&s->rings);trace_pvscsi_msg_ring_put (msg_descr_pa); + msg_desc_conv = (PVSCSIRingMsgDesc ) { + .type =cpu_to_le32 (msg_desc->type), + }; +for (i =0 ; i <ARRAY_SIZE (msg_desc->args); i++) { + msg_desc_conv.args[i] =cpu_to_le32 (msg_desc->args[i]); + } + msg_desc = &msg_desc_conv;physical_memory_write (msg_descr_pa, msg_desc,sizeof (*msg_desc)); }
@@ -481,6 +499,9 @@ pvscsi_get_next_sg_elem(PVSCSISGState *sg)struct PVSCSISGElement elem;physical_memory_read (sg->elemAddr, &elem,sizeof (elem)); + elem.addr =le64_to_cpu (elem.addr); + elem.length =le32_to_cpu (elem.length); + elem.flags =le32_to_cpu (elem.flags);if ((elem.flags & ~PVSCSI_KNOWN_FLAGS ) !=0 ) {/* * There is PVSCSI_SGE_FLAG_CHAIN_ELEMENT flag described in
@@ -759,6 +780,12 @@ pvscsi_process_io(PVSCSIState *s)trace_pvscsi_process_io (next_descr_pa);physical_memory_read (next_descr_pa, &descr,sizeof (descr)); + descr.context =le64_to_cpu (descr.context); + descr.dataAddr =le64_to_cpu (descr.dataAddr); + descr.dataLen =le64_to_cpu (descr.dataLen); + descr.senseAddr =le64_to_cpu (descr.senseAddr); + descr.senseLen =le32_to_cpu (descr.senseLen); + descr.flags =le32_to_cpu (descr.flags);pvscsi_process_request_descriptor (s, &descr); }
@@ -808,6 +835,17 @@ pvscsi_on_cmd_setup_rings(PVSCSIState *s) {PVSCSICmdDescSetupRings *rc = (PVSCSICmdDescSetupRings *) s->curr_cmd_data; +PVSCSICmdDescSetupRings translated; +int i; + + translated.reqRingNumPages =le32_to_cpu (rc->reqRingNumPages); + translated.cmpRingNumPages =le32_to_cpu (rc->cmpRingNumPages); + translated.ringsStatePPN =le64_to_cpu (rc->ringsStatePPN); +for (i =0 ; i <PVSCSI_SETUP_RINGS_MAX_NUM_PAGES ; i++) { + translated.reqRingPPNs[i] =le64_to_cpu (rc->reqRingPPNs[i]); + translated.cmpRingPPNs[i] =le64_to_cpu (rc->cmpRingPPNs[i]); + } + rc = &translated;trace_pvscsi_on_cmd_arrived ("PVSCSI_CMD_SETUP_RINGS" );
@@ -831,6 +869,11 @@ pvscsi_on_cmd_abort(PVSCSIState *s)PVSCSICmdDescAbortCmd *cmd = (PVSCSICmdDescAbortCmd *) s->curr_cmd_data;PVSCSIRequest *r, *next; +PVSCSICmdDescAbortCmd translated = *cmd; + translated.context =le32_to_cpu (cmd->context); + translated.target =le32_to_cpu (cmd->target); + cmd = &translated; +trace_pvscsi_on_cmd_abort (cmd->context, cmd->target); QTAILQ_FOREACH_SAFE(r, &s->pending_queue, next, next) {
@@ -862,6 +905,10 @@ pvscsi_on_cmd_reset_device(PVSCSIState *s) (struct PVSCSICmdDescResetDevice *) s->curr_cmd_data;SCSIDevice *sdev; +PVSCSICmdDescResetDevice translated = *cmd; + translated.target =le32_to_cpu (cmd->target); + cmd = &translated; + sdev =pvscsi_device_find (s,0 , cmd->target, cmd->lun, &target_lun);trace_pvscsi_on_cmd_reset_dev (cmd->target, (int ) target_lun, sdev);
@@ -892,6 +939,14 @@ pvscsi_on_cmd_setup_msg_ring(PVSCSIState *s) {PVSCSICmdDescSetupMsgRing *rc = (PVSCSICmdDescSetupMsgRing *) s->curr_cmd_data; +PVSCSICmdDescSetupMsgRing translated = *rc; +int i; + + translated.numPages =le32_to_cpu (rc->numPages); +for (i =0 ; i <PVSCSI_SETUP_MSG_RING_MAX_NUM_PAGES ; i++) { + translated.ringPPNs[i] =le64_to_cpu (rc->ringPPNs[i]); + } + rc = &translated;trace_pvscsi_on_cmd_arrived ("PVSCSI_CMD_SETUP_MSG_RING" );
@@ -994,7 +1049,7 @@ pvscsi_on_command_data(PVSCSIState *s, uint32_t value)size_t bytes_arrived = s->curr_cmd_data_cntr *sizeof (uint32_t );assert (bytes_arrived <sizeof (s->curr_cmd_data)); - s->curr_cmd_data[s->curr_cmd_data_cntr++] = value; + s->curr_cmd_data[s->curr_cmd_data_cntr++] =cpu_to_le32 (value);pvscsi_do_command_processing (s); }
Signature · 1 line
2.53.0
[PULL 05/13] hw/scsi/vmw_pvscsi: add a comment to explain the endianness
In reply to Philippe Mathieu-DaudéFrom: Miao Wang <[email protected]>
Add a comment to explain the endianness of the pvscsi device. We have no information about the endianness should be little-endian or CPU native endian because the current driver code is designed to work only on x86 and is not endianness aware. We assume that the pvscsi device is implicitly little-endian.
Message-ID: <[email protected]>
--- hw/scsi/vmw_pvscsi.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
hw/scsi/vmw_pvscsi.h +14 -0
@@ -108,6 +108,20 @@ enum PVSCSICommands {#define PVSCSI_COMMAND_PROCESSING_FAILED (-1)#define PVSCSI_COMMAND_NOT_ENOUGH_DATA (-2) +/* +* About endianess for the below structs: +* +* These structs are used to describe the data that is exchanged between the +* guest and the PVSCSI device. The endianess of the fields in these structs +* is not defined by any standard. The current implemented drivers are designed +* to only work on x86 architecture, so there is no endianess awareness in the +* drivers and thus we have no idea whether the fields should be in little- +* endian or target native endian format. +* +* Considering the above, we assume that PVSCSI is implicitly little-endian and +* expect the fields in these structs to be in little-endian format. +*/ +/* * Command descriptor for PVSCSI_CMD_RESET_DEVICE -- */
Signature · 1 line
2.53.0
[PULL 07/13] hw/sparc64/niagara: use int64_t for vdisk size to avoid truncation
In reply to Philippe Mathieu-DaudéFrom: Dmitry Pimenov <[email protected]>
blk_getlength() returns int64_t, but niagara_init() stored it in an int, truncating the if=pflash virtual-ramdisk size for images >= 2 GiB. A ~4 GiB image truncated to 0/negative, failed the size > 0 check, and exit(1)'d before the CPU ran, ending with:
qemu-system-sparc64: could not load ram disk
Message-ID: <[email protected]>
--- hw/sparc64/niagara.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/sparc64/niagara.c +1 -1
@@ -137,7 +137,7 @@ static void niagara_init(MachineState *machine)outside of the partition RAM */ if (dinfo) {BlockBackend *blk =blk_by_legacy_dinfo (dinfo); -int size =blk_getlength (blk); +int64_t size =blk_getlength (blk);if (size >0 ) {memory_region_init_ram (&s->vdisk_ram,NULL ,"sun4v_vdisk.ram" , size, &error_fatal);
Signature · 1 line
2.53.0
[PULL 02/13] hw/misc/ivshmem: clear chardev handlers before freeing peers
In reply to Philippe Mathieu-DaudéFrom: Haotian Jiang <[email protected]>
ivshmem_exit() frees s->peers and s->msi_vectors but does not clear the chardev handlers registered in ivshmem_common_realize(). Those handlers are only removed later in object_finalize() via release_chr, which runs after ivshmem_exit().
Between exit and finalize, ivshmem_read() can fire on pending chardev data and process_msg_connect() dereferences the freed s->peers. Additionally, s->peers, s->nb_peers, and s->msi_vectors are not zeroed after free, leaving dangling pointers that make the UAF code paths reachable.
Fix by clearing chardev handlers at the beginning of ivshmem_exit(), before any resources they access are freed, and nullifying freed pointers.
Message-ID: <[email protected]>
--- hw/misc/ivshmem-pci.c | 6 ++++++ 1 file changed, 6 insertions(+)
hw/misc/ivshmem-pci.c +6 -0
@@ -938,6 +938,9 @@ static void ivshmem_exit(PCIDevice *dev)IVShmemState *s =IVSHMEM_COMMON (dev);int i; +qemu_chr_fe_set_handlers (&s->server_chr, +NULL ,NULL ,NULL ,NULL ,NULL ,NULL , true); +migrate_del_blocker (&s->migration_blocker);if (memory_region_is_mapped (s->ivshmem_bar2)) {
@@ -966,6 +969,8 @@ static void ivshmem_exit(PCIDevice *dev)close_peer_eventfds (s, i); }g_free (s->peers); + s->peers =NULL ; + s->nb_peers =0 ; }if (ivshmem_has_feature (s,IVSHMEM_MSI )) {
@@ -973,6 +978,7 @@ static void ivshmem_exit(PCIDevice *dev) }g_free (s->msi_vectors); + s->msi_vectors =NULL ; }static int ivshmem_pre_load (void *opaque)
Signature · 1 line
2.53.0
[PULL 03/13] docs/devel: Document SSI dummy-cycle ownership
In reply to Philippe Mathieu-DaudéFrom: Bin Meng <[email protected]>
Document the boundary between SPI/SSI controller models and SPI flash models when representing fast-read dummy cycles. It explains that flash models own command semantics, while controllers own hardware-generated dummy transfers and cycle-to-byte conversion.
Message-ID: <[email protected]>
--- MAINTAINERS | 1 + docs/devel/index-internals.rst | 1 + docs/devel/ssi.rst | 132 +++++++++++++++++++++++++++++++++ 3 files changed, 134 insertions(+) create mode 100644 docs/devel/ssi.rst
MAINTAINERS +1 -0
@@ -2350,6 +2350,7 @@ T: git https://github.com/bonzini/qemu.git scsi-next SSI M: Alistair Francis <[email protected]> S: Maintained +F: docs/devel/ssi.rst F: hw/ssi/* F: hw/block/m25p80* F: include/hw/ssi/ssi.h
docs/devel/index-internals.rst +1 -0
@@ -20,6 +20,7 @@ Details about QEMU's various subsystems including how to add features to them. reset s390-cpu-topology s390-dasd-ipl + ssi tracing uefi-vars vfio-iommufd
docs/devel/ssi.rst new file +132 -0
132 lines not on this page · raw message
Signature · 1 line
2.53.0
[PULL 08/13] hw/display/virtio-gpu: fix dmabuf_fd leak on remap failure
In reply to Philippe Mathieu-DaudéFrom: Marc-André Lureau <[email protected]>
When virtio_gpu_create_udmabuf() succeeds but virtio_gpu_remap_udmabuf() fails (mmap returns MAP_FAILED), virtio_gpu_init_udmabuf() returns early without closing the dmabuf fd. Since res->blob is never set in this path, later cleanup via virtio_gpu_cleanup_mapping() skips virtio_gpu_fini_udmabuf() entirely, leaking the file descriptor.
Call virtio_gpu_destroy_udmabuf() before the early return to close the fd. This function already handles partial state correctly: it skips the munmap when res->remapped is NULL and closes the fd when res->dmabuf_fd >= 0.
Message-ID: <[email protected]>
--- hw/display/virtio-gpu-udmabuf.c | 1 + 1 file changed, 1 insertion(+)
hw/display/virtio-gpu-udmabuf.c +1 -0
@@ -143,6 +143,7 @@ void virtio_gpu_init_udmabuf(struct virtio_gpu_simple_resource *res) }virtio_gpu_remap_udmabuf (res);if (!res->remapped) { +virtio_gpu_destroy_udmabuf (res);return ; } pdata = res->remapped;
Signature · 1 line
2.53.0
[PULL 10/13] hw/usb/hcd-xhci: Turn guest-triggerable abort() into qemu_log_mask()
In reply to Philippe Mathieu-DaudéFrom: Thomas Huth <[email protected]>
The FIXME macros in xhci_alloc_device_streams() can be triggered by a (malicious) guest. Since the macro also contains an abort() statement, this terminates QEMU. Turn the FIXME statements into a qemu_log_mask() instead to avoid that a guest can shoot itself this way.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3784
Message-ID: <[email protected]>
--- hw/usb/hcd-xhci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
hw/usb/hcd-xhci.c +4 -2
@@ -965,11 +965,13 @@ static TRBCCode xhci_alloc_device_streams(XHCIState *xhci, unsigned int slotid,* together and make an usb_device_alloc_streams call per group. */ if (epctxs[i]->nr_pstreams != req_nr_streams) { -FIXME ("guest streams config not identical for all eps" ); +qemu_log_mask (LOG_UNIMP , +"guest streams config not identical for all eps\n" );return CC_RESOURCE_ERROR ; }if (eps[i]->max_streams != dev_max_streams) { -FIXME ("device streams config not identical for all eps" ); +qemu_log_mask (LOG_UNIMP , +"device streams config not identical for all eps\n" );return CC_RESOURCE_ERROR ; } }
Signature · 1 line
2.53.0
[PULL 09/13] hw/usb/hcd-ohci: Make sure that ohci_service_ed_list() cannot loop forever
In reply to Philippe Mathieu-DaudéFrom: Thomas Huth <[email protected]>
The inner while loop in ohci_service_ed_list() could theoretically loop forever if a malicious guest prepares a set of bad descriptors. Add a check to the loop to avoid this situation.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3781
Message-ID: <[email protected]>
--- hw/usb/hcd-ohci.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
hw/usb/hcd-ohci.c +10 -0
@@ -28,6 +28,7 @@#include "qemu/osdep.h" #include "hw/core/irq.h" #include "qapi/error.h" +#include "qemu/log.h" #include "qemu/module.h" #include "qemu/timer.h" #include "hw/usb/usb.h"
@@ -1129,6 +1130,8 @@ static int ohci_service_ed_list(OHCIState *ohci, uint32_t head)return 0 ; }for (cur = head; cur && link_cnt++ <ED_LINK_LIMIT ; cur = next_ed) { +unsigned int ed_cnt =0 ; +if (ohci_read_ed (ohci, cur, &ed)) {trace_usb_ohci_ed_read_error (cur);ohci_die (ohci);
@@ -1172,6 +1175,13 @@ static int ohci_service_ed_list(OHCIState *ohci, uint32_t head)break ; } } + +if (ed_cnt++ >ED_LINK_LIMIT ) { +qemu_log_mask (LOG_GUEST_ERROR , +"ohci: Too many endpoint descriptors in loop\n" ); +ohci_die (ohci); +return 0 ; + } }if (ohci_put_ed (ohci, cur, &ed)) {
Signature · 1 line
2.53.0
[PULL 13/13] net: only advertise passt in netdev help when CONFIG_PASST
In reply to Philippe Mathieu-DaudéFrom: Rohitashv Kumar <[email protected]>
show_netdevs() lists each conditionally-compiled netdev backend behind its CONFIG_* guard (CONFIG_SLIRP for "user", CONFIG_L2TPV3 for "l2tpv3", CONFIG_NET_BRIDGE for "bridge", ...). The "passt" entry was added unconditionally, so "-netdev help" advertises passt even in builds configured with --disable-passt. Trying to use it then fails with "Parameter 'type' does not accept value 'passt'", since the QAPI NetClientDriver enum member "passt" is gated by 'if': 'CONFIG_PASST'.
Guard the help entry with CONFIG_PASST so the advertised backends match those actually compiled into the binary.
Message-ID: <[email protected]>
--- net/net.c | 2 ++ 1 file changed, 2 insertions(+)
net/net.c +2 -0
@@ -1385,7 +1385,9 @@ void show_netdevs(void)"dgram" ,"hubport" ,"tap" , +#ifdef CONFIG_PASST"passt" , +#endif #ifdef CONFIG_SLIRP "user", #endif
Signature · 1 line
2.53.0
[PULL 06/13] hw/display/qxl: fix TOCTOU in cursor chunk data_size handling
In reply to Philippe Mathieu-DaudéFrom: Marc-André Lureau <[email protected]>
Snapshot chunk.data_size into a host-local variable before passing it to qxl_phys2virt() for validation, and pass it through qxl_cursor() and qxl_unpack_chunks() so that no subsequent code re-reads the field.
Without this, a racing vCPU can inflate data_size between the qxl_phys2virt() validation and the memcpy in qxl_unpack_chunks(), causing a source read past the validated region. In practice the read stays within the guest's own VRAM mmap, so the impact is limited.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3757
Message-ID: <[email protected]>
--- hw/display/qxl-render.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-)
hw/display/qxl-render.c +17 -11
@@ -217,7 +217,8 @@ void qxl_render_update_area_done(PCIQXLDevice *qxl, QXLCookie *cookie) }static void qxl_unpack_chunks (void *dest,size_t size,PCIQXLDevice *qxl, -QXLDataChunk *chunk,uint32_t group_id) +QXLDataChunk *chunk,uint32_t group_id, +uint32_t chunk_data_size) {uint32_t max_chunks =32 ;size_t offset =0 ;
@@ -225,22 +226,21 @@ static void qxl_unpack_chunks(void *dest, size_t size, PCIQXLDevice *qxl,QXLPHYSICAL next_chunk_phys =0 ;for (;;) { - bytes =MIN (size - offset, chunk->data_size); + bytes =MIN (size - offset, chunk_data_size);memcpy (dest + offset, chunk->data, bytes); offset += bytes;if (offset == size) {return ; } next_chunk_phys = chunk->next_chunk; -/* fist time, only get the next chunk's data size */ chunk =qxl_phys2virt (qxl, next_chunk_phys, group_id,sizeof (QXLDataChunk));if (!chunk) {return ; } -/* second time, check data size and get data */ + chunk_data_size = chunk->data_size; chunk =qxl_phys2virt (qxl, next_chunk_phys, group_id, -sizeof (QXLDataChunk) + chunk->data_size); +sizeof (QXLDataChunk) + chunk_data_size);if (!chunk) {return ; }
@@ -252,7 +252,7 @@ static void qxl_unpack_chunks(void *dest, size_t size, PCIQXLDevice *qxl, }static QEMUCursor *qxl_cursor (PCIQXLDevice *qxl,QXLCursor *cursor, -uint32_t group_id) +uint32_t group_id,uint32_t chunk_data_size) {QEMUCursor *c;uint8_t *and_mask, *xor_mask;
@@ -272,11 +272,11 @@ static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCursor *cursor,case SPICE_CURSOR_TYPE_MONO :/* Assume that the full cursor is available in a single chunk. */ size =2 *cursor_get_mono_bpl (c) * c->height; -if (size != cursor->data_size || cursor->chunk.data_size < size) { +if (size != cursor->data_size || chunk_data_size < size) {qxl_set_guest_bug (qxl,"%s: bad monochrome cursor %ux%u" " data_size %u chunk_size %u" , __func__, c->width, c->height, - cursor->data_size, cursor->chunk.data_size); + cursor->data_size, chunk_data_size); goto fail; } and_mask = cursor->chunk.data;
@@ -288,7 +288,8 @@ static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCursor *cursor,break ;case SPICE_CURSOR_TYPE_ALPHA : size =sizeof (uint32_t ) * c->width * c->height; -qxl_unpack_chunks (c->data, size, qxl, &cursor->chunk, group_id); +qxl_unpack_chunks (c->data, size, qxl, &cursor->chunk, group_id, + chunk_data_size);if (qxl->debug >2 ) {cursor_print_ascii_art (c,"qxl/alpha" ); }
@@ -325,19 +326,23 @@ int qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext) }switch (cmd->type) {case QXL_CURSOR_SET : + { +uint32_t chunk_data_size; +/* First read the QXLCursor to get QXLDataChunk::data_size ... */ cursor =qxl_phys2virt (qxl, cmd->u.set.shape, ext->group_id,sizeof (QXLCursor));if (!cursor) {return 1 ; } + chunk_data_size = cursor->chunk.data_size;/* Then read including the chunked data following QXLCursor. */ cursor =qxl_phys2virt (qxl, cmd->u.set.shape, ext->group_id, -sizeof (QXLCursor) + cursor->chunk.data_size); +sizeof (QXLCursor) + chunk_data_size);if (!cursor) {return 1 ; } - c =qxl_cursor (qxl, cursor, ext->group_id); + c =qxl_cursor (qxl, cursor, ext->group_id, chunk_data_size);if (c ==NULL ) { c =cursor_builtin_left_ptr (); }
@@ -351,6 +356,7 @@ int qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt *ext)qemu_mutex_unlock (&qxl->ssd.lock);qemu_bh_schedule (qxl->ssd.cursor_bh);break ; + }case QXL_CURSOR_MOVE :qemu_mutex_lock (&qxl->ssd.lock); qxl->ssd.mouse_x = cmd->u.position.x;
Signature · 1 line
2.53.0
[PULL 12/13] hw/usb/hcd-xhci: Use qemu_log_mask() instead of fprintf() statement
In reply to Philippe Mathieu-DaudéFrom: Thomas Huth <[email protected]>
We've got a proper way for logging unimplemented hardware features, so use qemu_log_mask() instead of the fprintf() here now.
Message-ID: <[email protected]>
--- hw/usb/hcd-xhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/usb/hcd-xhci.c +2 -1
@@ -1017,7 +1017,8 @@ static XHCIStreamContext *xhci_find_stream(XHCIEPContext *epctx, } sctx = epctx->pstreams + streamid; }else { -fprintf (stderr,"xhci: FIXME: secondary streams not implemented yet" ); +qemu_log_mask (LOG_UNIMP , +"xhci: secondary streams not implemented yet\n" ); *cc_error =CC_INVALID_STREAM_TYPE_ERROR ;return NULL ; }
Signature · 1 line
2.53.0
[PULL 11/13] hw/usb/hcd-xhci: Remove the FIXME macro
In reply to Philippe Mathieu-DaudéFrom: Thomas Huth <[email protected]>
The FIXME macro is only used in one case, which should hopefully never trigger: The containing function handles all the USB_RET_* values except for USB_RET_ADD_TO_QUEUE and USB_RET_REMOVE_FROM_QUEUE, which are both internal return values for when an async packet needs to be queued or dequeued, and which shouldn't still be the status by the time we get to this function. Thus let's simplify this spot and use a g_assert_not_reached() instead (and remove the DPRINT() in front of it to avoid that code analyzers trip over unreachable code here).
Message-ID: <[email protected]>
--- hw/usb/hcd-xhci.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
hw/usb/hcd-xhci.c +1 -5
@@ -39,8 +39,6 @@#else #define DPRINTF (...) do {} while (0)#endif -#define FIXME (_msg) do { fprintf(stderr, "FIXME %s:%d %s\n", \ - __func__, __LINE__, _msg); abort(); } while (0)#define TRB_LINK_LIMIT 32#define COMMAND_LIMIT 256
@@ -1673,9 +1671,7 @@ static int xhci_try_complete_packet(XHCITransfer *xfer)xhci_stall_ep (xfer);break ;default : -DPRINTF ("%s: FIXME: status = %d\n" , __func__, - xfer->packet.status); -FIXME ("unhandled USB_RET_*" ); +g_assert_not_reached (); }return 0 ; }
Signature · 1 line
2.53.0
Stefan Hajnoczi
AppliedApplied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/11.1 for any user-visible changes.