Skip to contentSkip to conversation

Misc TCG & HW patches for 2026-11-17

GIT PULL Applied Philippe Mathieu-Daudé 2 participants 3 messages Nov 17

lore
Share & tools
lore
#0 lore raw

v2: Fixed mangled UTF8 in R-b tag (Marc-Andr=C3=A9 Lureau)

The following changes since commit 97c88c61d45dee6e1f9bc160a338048189846d28:

Merge tag 'docs-security-devices-pull-request' of https://gitlab.com/berrange/qemu into staging (2026-11-16 15:48:48 -0800)

are available in the Git repository at:

https://github.com/philmd/qemu.git tags/hw-misc-20261117

for you to fetch changes up to f445ebd9d7fc1ea229821646d8d84c41b856da40:

hw/virtio/virtio-iommu: Fix IOVA address lookup (2026-11-17 10:02:52 +0100)

Ignoring usual spurious checkpatch errors.

----------------------------------------------------------------
Misc fixes for 11.2

- Build system (obsolete Kconfig, QGA, illumos, macOS pvg)
- Fix wrong constant encoding in the vector .vi immediate emitters on RISC-V TCG
- USB device fixes (CCID card, U2F, MTP)
- m25p80, virtio-iommu, Xen
----------------------------------------------------------------

Bin Guo (1):
hw/usb/u2f: validate ring buffer indices on migration load

Brad Smith (1):
qga: fix uname() return value check in guest-get-osinfo

Chao Liu (1):
hw/block/m25p80: fix write enable latch after WRSR2

Eric Auger (1):
hw/virtio/virtio-iommu: Fix IOVA address lookup

John Snow (3):
build: remove vestigial CONFIG_SGA
build: update CONFIG_PVPANIC
hw/i386: move bios functions into x86-bios.c

Mohamed Mediouni (1):
pvg: disable by default

Peng Fan (1):
hw/xen: Mark legacy Xen backends as hotpluggable

Peter Maydell (1):
hw/usb/ccid-card: Use QemuSemaphore rather than QemuCond

Philippe Mathieu-Daudé (7):
tcg/riscv64: Factor encode_vi_raw() out of encode_vi() tcg/riscv64: Use a uimm5 encoder for vector shift immediates tcg/riscv64: Extract elements for vector arithmetic immediates tcg/riscv64: Fix constant handling in vector comparisons and selects tcg/riscv64: Fix logical vector immediate matching and emission tests/tcg/aarch64: Add vector immediate regression tests hw/usb/u2f: Use QemuSemaphore rather than QemuCond

Roman Bogorodskiy (2):
meson.build: fix getifaddrs() detection on illumos
qga: fix build on illumos

Tommaso Califano (3):
hw/usb/dev-mtp: Fix recursive delete of directories hw/usb/dev-mtp: Check length of class control request hw/usb/dev-mtp: Stop processing SendObjectInfo after an error

 configs/devices/i386-softmmu/default.mak |   6 +-
 meson.build                              |   2 +-
 tcg/riscv64/tcg-target-con-set.h         |   1 +
 tcg/riscv64/tcg-target-con-str.h         |   1 +
 hw/block/m25p80.c                        |   1 +
 hw/i386/x86-bios.c                       | 143 ++++++++++++++
 hw/i386/x86-common.c                     | 125 ------------
 hw/i386/x86.c                            |   1 -
 hw/usb/ccid-card-emulated.c              |  22 +--
 hw/usb/dev-mtp.c                         |  24 ++-
 hw/usb/u2f-emulated.c                    |  19 +-
 hw/usb/u2f.c                             |  31 +++
 hw/virtio/virtio-iommu.c                 |   2 +-
 hw/xen/xen-legacy-backend.c              |   7 +
 qga/commands-posix.c                     |   8 +-
 tests/tcg/aarch64/sve-vec-imm.c          | 233 +++++++++++++++++++++++
 tcg/riscv64/tcg-target.c.inc             | 116 ++++++++---
 hw/i386/meson.build                      |   1 +
 meson_options.txt                        |   2 +-
 tests/qtest/meson.build                  |   2 +-
 tests/tcg/aarch64/meson.build            |   1 +
 21 files changed, 555 insertions(+), 193 deletions(-)
 create mode 100644 hw/i386/x86-bios.c
 create mode 100644 tests/tcg/aarch64/sve-vec-imm.c
Signature · 1 line
2.55.0
#1 lore raw

[PULL v2 15/22] hw/usb/ccid-card: Use QemuSemaphore rather than QemuCond

From: Peter Maydell <[email protected]>

The emulated CCID card uses a QemuMutex and QemuCond to communicate with its helper thread, but all it's trying to do here is "make the helper thread loop wait until is signalled that it has more work to do". The existing code functions correctly, but "wait until the other thread signals you" is more simply implemented with a QemuSemaphore.

This avoids a Coverity complaint that we're not using the condition variable in the standard

   lock mutex;
   while (!some_predicate) {
       cond_wait(condvar, mutex);
   }
   do stuff;
   unlock mutex;

pattern.

Resolves: Coverity CID 1547639

Message-ID: <[email protected]>

---
 hw/usb/ccid-card-emulated.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)
hw/usb/ccid-card-emulated.c +7 -15
index 4083cf8f4be0..4bd5399fb6e0 100644
@@ -129,8 +129,7 @@ struct EmulatedState {
     VReader *reader;
     QSIMPLEQ_HEAD(, EmulEvent) guest_apdu_list;
     QemuMutex vreader_mutex; /* and guest_apdu_list mutex */
-    QemuMutex handle_apdu_mutex;
-    QemuCond handle_apdu_cond;
+    QemuSemaphore handle_apdu_sem;
     EventNotifier notifier;
     int      quit_apdu_thread;
     QemuThread apdu_thread_id;
@@ -149,9 +148,7 @@ static void emulated_apdu_from_guest(CCIDCardState *base,
     qemu_mutex_lock(&card->vreader_mutex);
     QSIMPLEQ_INSERT_TAIL(&card->guest_apdu_list, event, entry);
     qemu_mutex_unlock(&card->vreader_mutex);
-    qemu_mutex_lock(&card->handle_apdu_mutex);
-    qemu_cond_signal(&card->handle_apdu_cond);
-    qemu_mutex_unlock(&card->handle_apdu_mutex);
+    qemu_sem_post(&card->handle_apdu_sem);
 }
 
 static const uint8_t *emulated_get_atr(CCIDCardState *base, uint32_t *len)
@@ -238,9 +235,7 @@ static void *handle_apdu_thread(void* arg)
     EmulEvent *event;
 
     while (1) {
-        qemu_mutex_lock(&card->handle_apdu_mutex);
-        qemu_cond_wait(&card->handle_apdu_cond, &card->handle_apdu_mutex);
-        qemu_mutex_unlock(&card->handle_apdu_mutex);
+        qemu_sem_wait(&card->handle_apdu_sem);
         if (card->quit_apdu_thread) {
             card->quit_apdu_thread = 0; /* debugging */
             break;
@@ -496,8 +491,7 @@ static void emulated_realize(CCIDCardState *base, Error **errp)
     QSIMPLEQ_INIT(&card->guest_apdu_list);
     qemu_mutex_init(&card->event_list_mutex);
     qemu_mutex_init(&card->vreader_mutex);
-    qemu_mutex_init(&card->handle_apdu_mutex);
-    qemu_cond_init(&card->handle_apdu_cond);
+    qemu_sem_init(&card->handle_apdu_sem, 0);
     card->reader = NULL;
     card->quit_apdu_thread = 0;
     if (init_event_notifier(card, errp) < 0) {
@@ -556,8 +550,7 @@ static void emulated_realize(CCIDCardState *base, Error **errp)
 out2:
     clean_event_notifier(card);
 out1:
-    qemu_cond_destroy(&card->handle_apdu_cond);
-    qemu_mutex_destroy(&card->handle_apdu_mutex);
+    qemu_sem_destroy(&card->handle_apdu_sem);
     qemu_mutex_destroy(&card->vreader_mutex);
     qemu_mutex_destroy(&card->event_list_mutex);
 }
@@ -571,13 +564,12 @@ static void emulated_unrealize(CCIDCardState *base)
     qemu_thread_join(&card->event_thread_id);
 
     card->quit_apdu_thread = 1; /* stop handle_apdu thread */
-    qemu_cond_signal(&card->handle_apdu_cond);
+    qemu_sem_post(&card->handle_apdu_sem);
     qemu_thread_join(&card->apdu_thread_id);
 
     clean_event_notifier(card);
     /* threads exited, can destroy all condvars/mutexes */
-    qemu_cond_destroy(&card->handle_apdu_cond);
-    qemu_mutex_destroy(&card->handle_apdu_mutex);
+    qemu_sem_destroy(&card->handle_apdu_sem);
     qemu_mutex_destroy(&card->vreader_mutex);
     qemu_mutex_destroy(&card->event_list_mutex);
 
Signature · 1 line
2.55.0
#2 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 16 lines · Philippe Mathieu-Daudé

v2: Fixed mangled UTF8 in R-b tag (Marc-Andr=C3=A9 Lureau)

The following changes since commit 97c88c61d45dee6e1f9bc160a338048189846d28:

   Merge tag 'docs-security-devices-pull-request' ofhttps://gitlab.com/berrange/qemu into staging (2026-11-16 15:48:48 -0800)

are available in the Git repository at:

   https://github.com/philmd/qemu.git tags/hw-misc-20261117

for you to fetch changes up to f445ebd9d7fc1ea229821646d8d84c41b856da40:

   hw/virtio/virtio-iommu: Fix IOVA address lookup (2026-11-17 10:02:52 +0100)

Ignoring usual spurious checkpatch errors.

Quoted 7 lines

----------------------------------------------------------------
Misc fixes for 11.2

- Build system (obsolete Kconfig, QGA, illumos, macOS pvg)
- Fix wrong constant encoding in the vector .vi immediate emitters on RISC-V TCG
- USB device fixes (CCID card, U2F, MTP)
- m25p80, virtio-iommu, Xen

Applied, thanks.

r~