]> TLD Linux GIT Repositories - packages/qemu.git/commitdiff
- updated to 8.2.4, partial merge of PLD spec changes
authorMarcin Krol <hawk@tld-linux.org>
Sun, 9 Jun 2024 21:40:18 +0000 (23:40 +0200)
committerMarcin Krol <hawk@tld-linux.org>
Sun, 9 Jun 2024 21:40:18 +0000 (23:40 +0200)
libvfio-user-alloca.patch [new file with mode: 0644]
libvfio-user-types.patch [new file with mode: 0644]
qemu-cflags.patch [new file with mode: 0644]
qemu.spec

diff --git a/libvfio-user-alloca.patch b/libvfio-user-alloca.patch
new file mode 100644 (file)
index 0000000..5b6931e
--- /dev/null
@@ -0,0 +1,35 @@
+--- qemu-7.2.10/subprojects/libvfio-user/samples/client.c.orig 2024-04-04 06:27:19.254657097 +0200
++++ qemu-7.2.10/subprojects/libvfio-user/samples/client.c      2024-04-04 16:55:35.883734463 +0200
+@@ -310,7 +310,10 @@ get_device_region_info(int sock, uint32_
+     size_t nr_fds = ARRAY_SIZE(fds);
+-    region_info = alloca(size);
++    region_info = malloc(size);
++    if (region_info == NULL) {
++        err(EXIT_FAILURE, "%m\n");
++    }
+     memset(region_info, 0, size);
+     region_info->argsz = size;
+     region_info->index = index;
+@@ -318,7 +321,11 @@ get_device_region_info(int sock, uint32_
+     do_get_device_region_info(sock, region_info, NULL, 0);
+     if (region_info->argsz > size) {
+         size = region_info->argsz;
+-        region_info = alloca(size);
++        free(region_info);
++        region_info = malloc(size);
++        if (region_info == NULL) {
++            err(EXIT_FAILURE, "%m\n");
++        }
+         memset(region_info, 0, size);
+         region_info->argsz = size;
+         region_info->index = index;
+@@ -344,6 +351,7 @@ get_device_region_info(int sock, uint32_
+             }
+         }
+     }
++    free(region_info);
+ }
+ static void
diff --git a/libvfio-user-types.patch b/libvfio-user-types.patch
new file mode 100644 (file)
index 0000000..98c2060
--- /dev/null
@@ -0,0 +1,516 @@
+--- qemu-7.2.10/subprojects/libvfio-user/lib/dma.c.orig        2024-03-04 17:26:53.000000000 +0100
++++ qemu-7.2.10/subprojects/libvfio-user/lib/dma.c     2024-04-03 21:26:55.422317782 +0200
+@@ -249,7 +249,7 @@ dma_map_region(dma_controller_t *dma, dm
+     region->info.vaddr = mmap_base + (region->offset - offset);
+     vfu_log(dma->vfu_ctx, LOG_DEBUG, "mapped DMA region iova=[%p, %p) "
+-            "vaddr=%p page_size=%#lx mapping=[%p, %p)",
++            "vaddr=%p page_size=%#zx mapping=[%p, %p)",
+             region->info.iova.iov_base, iov_end(&region->info.iova),
+             region->info.vaddr, region->info.page_size,
+             region->info.mapping.iov_base, iov_end(&region->info.mapping));
+@@ -300,8 +300,8 @@ MOCK_DEFINE(dma_controller_add_region)(d
+     assert(dma != NULL);
+-    snprintf(rstr, sizeof(rstr), "[%p, %p) fd=%d offset=%#lx prot=%#x",
+-             dma_addr, (char *)dma_addr + size, fd, offset, prot);
++    snprintf(rstr, sizeof(rstr), "[%p, %p) fd=%d offset=%#"PRIx64" prot=%#x",
++             dma_addr, (char *)dma_addr + size, fd, (int64_t)offset, prot);
+     if (size > dma->max_size) {
+         vfu_log(dma->vfu_ctx, LOG_ERR, "DMA region size %zu > max %zu",
+@@ -317,7 +317,7 @@ MOCK_DEFINE(dma_controller_add_region)(d
+             region->info.iova.iov_len == size) {
+             if (offset != region->offset) {
+                 vfu_log(dma->vfu_ctx, LOG_ERR, "bad offset for new DMA region "
+-                        "%s; existing=%#lx", rstr, region->offset);
++                        "%s; existing=%#"PRIx64, rstr, (int64_t)(region->offset));
+                 return ERROR_INT(EINVAL);
+             }
+             if (!fds_are_same_file(region->fd, fd)) {
+@@ -573,7 +573,7 @@ dma_controller_dirty_page_get(dma_contro
+     }
+     if (pgsize != dma->dirty_pgsize) {
+-        vfu_log(dma->vfu_ctx, LOG_ERR, "bad page size %ld", pgsize);
++        vfu_log(dma->vfu_ctx, LOG_ERR, "bad page size %zu", pgsize);
+         return ERROR_INT(EINVAL);
+     }
+@@ -588,7 +588,7 @@ dma_controller_dirty_page_get(dma_contro
+      * receive.
+      */
+     if (size != (size_t)bitmap_size) {
+-        vfu_log(dma->vfu_ctx, LOG_ERR, "bad bitmap size %ld != %ld", size,
++        vfu_log(dma->vfu_ctx, LOG_ERR, "bad bitmap size %zu != %zd", size,
+                 bitmap_size);
+         return ERROR_INT(EINVAL);
+     }
+--- qemu-7.2.10/subprojects/libvfio-user/lib/libvfio-user.c.orig       2024-03-04 17:26:53.000000000 +0100
++++ qemu-7.2.10/subprojects/libvfio-user/lib/libvfio-user.c    2024-04-03 22:01:11.697844648 +0200
+@@ -183,16 +183,16 @@ debug_region_access(vfu_ctx_t *vfu_ctx,
+     case 2: val = *((uint16_t *)buf); break;
+     case 1: val = *((uint8_t *)buf); break;
+     default:
+-            vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: %s %zu bytes at %#lx",
++            vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: %s %zu bytes at %#"PRIx64,
+                     region, verb, count, offset);
+             return;
+     }
+     if (is_write) {
+-        vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: wrote %#zx to (%#lx:%zu)",
++        vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: wrote %#"PRIx64" to (%#"PRIx64":%zu)",
+                 region, val, offset, count);
+     } else {
+-        vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: read %#zx from (%#lx:%zu)",
++        vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: read %#"PRIx64" from (%#"PRIx64":%zu)",
+                 region, val, offset, count);
+     }
+ }
+@@ -235,7 +235,7 @@ region_access(vfu_ctx_t *vfu_ctx, size_t
+ out:
+     if (ret != (ssize_t)count) {
+-        vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: %s (%#lx:%zu) failed: %m",
++        vfu_log(vfu_ctx, LOG_DEBUG, "region%zu: %s (%#"PRIx64":%zu) failed: %m",
+                 region, verb, offset, count);
+     } else {
+         debug_region_access(vfu_ctx, region, buf, count, offset, is_write);
+@@ -266,7 +266,7 @@ is_valid_region_access(vfu_ctx_t *vfu_ct
+     if (cmd == VFIO_USER_REGION_WRITE && size - sizeof(*ra) != ra->count) {
+         vfu_log(vfu_ctx, LOG_ERR, "region write count too small: "
+-                "expected %lu, got %u", size - sizeof(*ra), ra->count);
++                "expected %zu, got %u", size - sizeof(*ra), ra->count);
+         return false;
+     }
+@@ -278,7 +278,7 @@ is_valid_region_access(vfu_ctx_t *vfu_ct
+     }
+     if (satadd_u64(ra->offset, ra->count) > vfu_ctx->reg_info[index].size) {
+-        vfu_log(vfu_ctx, LOG_ERR, "out of bounds region access %#lx-%#lx "
++        vfu_log(vfu_ctx, LOG_ERR, "out of bounds region access %#"PRIx64"-%"PRIx64" "
+                 "(size %u)", ra->offset, ra->offset + ra->count,
+                 vfu_ctx->reg_info[index].size);
+@@ -337,7 +337,7 @@ handle_region_access(vfu_ctx_t *vfu_ctx,
+     ret = region_access(vfu_ctx, in_ra->region, buf, in_ra->count,
+                         in_ra->offset, msg->hdr.cmd == VFIO_USER_REGION_WRITE);
+-    if (ret != in_ra->count) {
++    if ((unsigned long)ret != (unsigned long)(in_ra->count)) {
+         /* FIXME we should return whatever has been accessed, not an error */
+         if (ret >= 0) {
+             ret = ERROR_INT(EINVAL);
+@@ -671,7 +671,7 @@ handle_dma_map(vfu_ctx_t *vfu_ctx, vfu_m
+         return ERROR_INT(EINVAL);
+     }
+-    snprintf(rstr, sizeof(rstr), "[%#lx, %#lx) offset=%#lx flags=%#x",
++    snprintf(rstr, sizeof(rstr), "[%#"PRIx64", %#"PRIx64") offset=%#"PRIx64" flags=%#x",
+              dma_map->addr, dma_map->addr + dma_map->size, dma_map->offset,
+              dma_map->flags);
+@@ -700,7 +700,7 @@ handle_dma_map(vfu_ctx_t *vfu_ctx, vfu_m
+         }
+     }
+-    ret = dma_controller_add_region(vfu_ctx->dma, (void *)dma_map->addr,
++    ret = dma_controller_add_region(vfu_ctx->dma, (void *)(uintptr_t)dma_map->addr,
+                                     dma_map->size, fd, dma_map->offset,
+                                     prot);
+     if (ret < 0) {
+@@ -747,7 +747,7 @@ is_valid_unmap(vfu_ctx_t *vfu_ctx, vfu_m
+     case VFIO_DMA_UNMAP_FLAG_ALL:
+         if (dma_unmap->addr || dma_unmap->size) {
+-            vfu_log(vfu_ctx, LOG_ERR, "bad addr=%#lx or size=%#lx, expected "
++            vfu_log(vfu_ctx, LOG_ERR, "bad addr=%#"PRIx64" or size=%#"PRIx64", expected "
+                     "both to be zero", dma_unmap->addr, dma_unmap->size);
+             errno = EINVAL;
+             return false;
+@@ -791,7 +791,7 @@ handle_dma_unmap(vfu_ctx_t *vfu_ctx, vfu
+         return -1;
+     }
+-    snprintf(rstr, sizeof(rstr), "[%#lx, %#lx) flags=%#x",
++    snprintf(rstr, sizeof(rstr), "[%#"PRIx64", %#"PRIx64") flags=%#x",
+              dma_unmap->addr, dma_unmap->addr + dma_unmap->size, dma_unmap->flags);
+     vfu_log(vfu_ctx, LOG_DEBUG, "removing DMA region %s", rstr);
+@@ -817,7 +817,7 @@ handle_dma_unmap(vfu_ctx_t *vfu_ctx, vfu
+     if (dma_unmap->flags & VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP) {
+         memcpy(msg->out.iov.iov_base + sizeof(*dma_unmap), dma_unmap->bitmap, sizeof(*dma_unmap->bitmap));
+         ret = dma_controller_dirty_page_get(vfu_ctx->dma,
+-                                            (vfu_dma_addr_t)dma_unmap->addr,
++                                            (vfu_dma_addr_t)(uintptr_t)dma_unmap->addr,
+                                             dma_unmap->size,
+                                             dma_unmap->bitmap->pgsize,
+                                             dma_unmap->bitmap->size,
+@@ -829,7 +829,7 @@ handle_dma_unmap(vfu_ctx_t *vfu_ctx, vfu
+     }
+     ret = dma_controller_remove_region(vfu_ctx->dma,
+-                                       (void *)dma_unmap->addr,
++                                       (void *)(uintptr_t)dma_unmap->addr,
+                                        dma_unmap->size,
+                                        vfu_ctx->dma_unregister,
+                                        vfu_ctx);
+@@ -924,7 +924,7 @@ handle_dirty_pages_get(vfu_ctx_t *vfu_ct
+         range_out = msg->out.iov.iov_base + sizeof(*dirty_pages_out);
+         memcpy(range_out, range_in, sizeof(*range_out));
+         ret = dma_controller_dirty_page_get(vfu_ctx->dma,
+-                                            (vfu_dma_addr_t)range_in->iova,
++                                            (vfu_dma_addr_t)(uintptr_t)range_in->iova,
+                                             range_in->size,
+                                             range_in->bitmap.pgsize,
+                                             range_in->bitmap.size, bitmap_out);
+@@ -939,7 +939,7 @@ handle_dirty_pages_get(vfu_ctx_t *vfu_ct
+         }
+     } else {
+         vfu_log(vfu_ctx, LOG_ERR,
+-                "dirty pages: get [%#lx, %#lx): buffer too small (%u < %lu)",
++                "dirty pages: get [%#"PRIx64", %#"PRIx64"): buffer too small (%u < %zu)",
+                 range_in->iova, range_in->iova + range_in->size,
+                 dirty_pages_in->argsz, argsz);
+     }
+@@ -2124,7 +2124,7 @@ vfu_dma_transfer(vfu_ctx_t *vfu_ctx, enu
+     while (remaining > 0) {
+         int ret;
+-        dma_req->addr = (uint64_t)sg->dma_addr + count;
++        dma_req->addr = (uint64_t)(uintptr_t)sg->dma_addr + count;
+         dma_req->count = MIN(remaining, vfu_ctx->client_max_data_xfer_size);
+         if (cmd == VFIO_USER_DMA_WRITE) {
+@@ -2154,7 +2154,7 @@ vfu_dma_transfer(vfu_ctx_t *vfu_ctx, enu
+         if (dma_reply->addr != dma_req->addr ||
+             dma_reply->count != dma_req->count) {
+             vfu_log(vfu_ctx, LOG_ERR, "bad reply to DMA transfer: "
+-                    "request:%#lx,%lu reply:%#lx,%lu",
++                    "request:%#"PRIx64",%"PRIu64" reply:%#"PRIx64",%"PRIu64,
+                     dma_req->addr, dma_req->count,
+                     dma_reply->addr, dma_reply->count);
+             free(rbuf);
+--- qemu-7.2.10/subprojects/libvfio-user/lib/migration.c.orig  2024-03-04 17:26:53.000000000 +0100
++++ qemu-7.2.10/subprojects/libvfio-user/lib/migration.c       2024-04-03 22:17:23.329247535 +0200
+@@ -413,7 +413,7 @@ MOCK_DEFINE(migration_region_access_regi
+     case offsetof(struct vfio_user_migration_info, device_state):
+         if (count != sizeof(migr->info.device_state)) {
+             vfu_log(vfu_ctx, LOG_ERR,
+-                    "bad device_state access size %ld", count);
++                    "bad device_state access size %zd", count);
+             return ERROR_INT(EINVAL);
+         }
+         device_state = (uint32_t *)buf;
+@@ -443,7 +443,7 @@ MOCK_DEFINE(migration_region_access_regi
+     case offsetof(struct vfio_user_migration_info, pending_bytes):
+         if (count != sizeof(migr->info.pending_bytes)) {
+             vfu_log(vfu_ctx, LOG_ERR,
+-                    "bad pending_bytes access size %ld", count);
++                    "bad pending_bytes access size %zd", count);
+             return ERROR_INT(EINVAL);
+         }
+         ret = handle_pending_bytes(vfu_ctx, migr, (uint64_t *)buf, is_write);
+@@ -451,7 +451,7 @@ MOCK_DEFINE(migration_region_access_regi
+     case offsetof(struct vfio_user_migration_info, data_offset):
+         if (count != sizeof(migr->info.data_offset)) {
+             vfu_log(vfu_ctx, LOG_ERR,
+-                    "bad data_offset access size %ld", count);
++                    "bad data_offset access size %zd", count);
+             return ERROR_INT(EINVAL);
+         }
+         ret = handle_data_offset(vfu_ctx, migr, (uint64_t *)buf, is_write);
+@@ -459,14 +459,14 @@ MOCK_DEFINE(migration_region_access_regi
+     case offsetof(struct vfio_user_migration_info, data_size):
+         if (count != sizeof(migr->info.data_size)) {
+             vfu_log(vfu_ctx, LOG_ERR,
+-                    "bad data_size access size %ld", count);
++                    "bad data_size access size %zd", count);
+             return ERROR_INT(EINVAL);
+         }
+         ret = handle_data_size(vfu_ctx, migr, (uint64_t *)buf, is_write);
+         break;
+     default:
+-        vfu_log(vfu_ctx, LOG_ERR, "bad migration region register offset %#lx",
+-               pos);
++        vfu_log(vfu_ctx, LOG_ERR, "bad migration region register offset %#"PRIx64,
++               (int64_t)pos);
+         return ERROR_INT(EINVAL);
+     }
+     return ret;
+@@ -502,8 +502,8 @@ migration_region_access(vfu_ctx_t *vfu_c
+              * any access to the data region properly.
+              */
+             vfu_log(vfu_ctx, LOG_WARNING,
+-                    "bad access to dead space %#lx-%#lx in migration region",
+-                    pos, pos + count - 1);
++                    "bad access to dead space %#"PRIx64"-%#"PRIx64" in migration region",
++                    (int64_t)pos, (int64_t)(pos + count - 1));
+             return ERROR_INT(EINVAL);
+         }
+--- qemu-7.2.10/subprojects/libvfio-user/lib/pci.c.orig        2024-03-04 17:26:53.000000000 +0100
++++ qemu-7.2.10/subprojects/libvfio-user/lib/pci.c     2024-04-03 22:39:07.265516839 +0200
+@@ -264,8 +264,8 @@ pci_hdr_write(vfu_ctx_t *vfu_ctx, const
+         ret = handle_erom_write(vfu_ctx, cfg_space, buf);
+         break;
+     default:
+-        vfu_log(vfu_ctx, LOG_ERR, "PCI config write %#lx not handled",
+-                offset);
++        vfu_log(vfu_ctx, LOG_ERR, "PCI config write %#"PRIx64" not handled",
++                (int64_t)offset);
+         ret = ERROR_INT(EINVAL);
+     }
+@@ -315,7 +315,7 @@ pci_nonstd_access(vfu_ctx_t *vfu_ctx, ch
+     if (is_write) {
+         vfu_log(vfu_ctx, LOG_ERR, "no callback for write to config space "
+-                "offset %lu size %zu", offset, count);
++                "offset %"PRId64" size %zu", (int64_t)offset, count);
+         return ERROR_INT(EINVAL);
+     }
+@@ -429,8 +429,8 @@ pci_config_space_access(vfu_ctx_t *vfu_c
+         size = pci_config_space_next_segment(vfu_ctx, count, offset, is_write,
+                                              &cb);
+         if (cb == NULL) {
+-            vfu_log(vfu_ctx, LOG_ERR, "bad write to PCI config space %#lx-%#lx",
+-                    offset, offset + count - 1);
++            vfu_log(vfu_ctx, LOG_ERR, "bad write to PCI config space %#"PRIx64"-%#"PRIx64,
++                    (int64_t)offset, (int64_t)(offset + count - 1));
+             return size;
+         }
+--- qemu-7.2.10/subprojects/libvfio-user/lib/pci_caps.c.orig   2024-03-04 17:26:53.000000000 +0100
++++ qemu-7.2.10/subprojects/libvfio-user/lib/pci_caps.c        2024-04-03 22:41:43.031339650 +0200
+@@ -483,7 +483,7 @@ cap_place(vfu_ctx_t *vfu_ctx, struct pci
+     if (cap->off != 0) {
+         if (cap->off < PCI_STD_HEADER_SIZEOF) {
+-            vfu_log(vfu_ctx, LOG_ERR, "invalid offset %#lx for capability "
++            vfu_log(vfu_ctx, LOG_ERR, "invalid offset %#zx for capability "
+                     "%u (%s)", cap->off, cap->id, cap->name);
+             return ERROR_INT(EINVAL);
+         }
+@@ -516,7 +516,7 @@ cap_place(vfu_ctx_t *vfu_ctx, struct pci
+     if (cap->off + cap->size > pci_config_space_size(vfu_ctx)) {
+         vfu_log(vfu_ctx, LOG_ERR, "no config space left for capability "
+-                "%u (%s) of size %zu bytes at offset %#lx", cap->id,
++                "%u (%s) of size %zu bytes at offset %#zx", cap->id,
+                 cap->name, cap->size, cap->off);
+         return ERROR_INT(ENOSPC);
+     }
+@@ -547,7 +547,7 @@ ext_cap_place(vfu_ctx_t *vfu_ctx, struct
+     if (cap->off != 0) {
+         if (cap->off < PCI_CFG_SPACE_SIZE) {
+-            vfu_log(vfu_ctx, LOG_ERR, "invalid offset %#lx for capability "
++            vfu_log(vfu_ctx, LOG_ERR, "invalid offset %#zx for capability "
+                     "%u (%s)", cap->off, cap->id, cap->name);
+             return ERROR_INT(EINVAL);
+         }
+@@ -581,7 +581,7 @@ ext_cap_place(vfu_ctx_t *vfu_ctx, struct
+     if (cap->off + cap->size > pci_config_space_size(vfu_ctx)) {
+         vfu_log(vfu_ctx, LOG_ERR, "no config space left for capability "
+-                "%u (%s) of size %zu bytes at offset %#lx", cap->id,
++                "%u (%s) of size %zu bytes at offset %#zx", cap->id,
+                 cap->name, cap->size, cap->off);
+         return ERROR_INT(ENOSPC);
+     }
+@@ -700,7 +700,7 @@ vfu_pci_add_capability(vfu_ctx_t *vfu_ct
+         if (cap.off + cap.size >= pci_config_space_size(vfu_ctx)) {
+                 vfu_log(vfu_ctx, LOG_DEBUG,
+-                        "PCI capability past end of config space, %#lx >= %#lx",
++                        "PCI capability past end of config space, %#zx >= %#zx",
+                         cap.off + cap.size, pci_config_space_size(vfu_ctx));
+             return ERROR_INT(EINVAL);
+         }
+--- qemu-7.2.10/subprojects/libvfio-user/lib/tran.c.orig       2024-03-04 17:26:53.000000000 +0100
++++ qemu-7.2.10/subprojects/libvfio-user/lib/tran.c    2024-04-03 22:42:30.844413958 +0200
+@@ -176,7 +176,7 @@ recv_version(vfu_ctx_t *vfu_ctx, uint16_
+     if (msg.in.iov.iov_len < sizeof(*cversion)) {
+         vfu_log(vfu_ctx, LOG_ERR,
+-                "msg%#hx: VFIO_USER_VERSION: invalid size %lu",
++                "msg%#hx: VFIO_USER_VERSION: invalid size %zu",
+                 *msg_idp, msg.in.iov.iov_len);
+         ret = EINVAL;
+         goto out;
+--- qemu-7.2.10/subprojects/libvfio-user/samples/client.c.orig 2024-03-04 17:26:53.000000000 +0100
++++ qemu-7.2.10/subprojects/libvfio-user/samples/client.c      2024-04-04 06:27:19.254657097 +0200
+@@ -110,7 +110,7 @@ send_version(int sock)
+                 "\"max_msg_fds\":%u,"
+                 "\"max_data_xfer_size\":%u,"
+                 "\"migration\":{"
+-                    "\"pgsize\":%zu"
++                    "\"pgsize\":%lu"
+                 "}"
+             "}"
+          "}", CLIENT_MAX_FDS, CLIENT_MAX_DATA_XFER_SIZE, sysconf(_SC_PAGESIZE));
+@@ -155,7 +155,7 @@ recv_version(int sock, int *server_max_f
+     }
+     if (vlen < sizeof(*sversion)) {
+-        errx(EXIT_FAILURE, "VFIO_USER_VERSION: invalid size %lu", vlen);
++        errx(EXIT_FAILURE, "VFIO_USER_VERSION: invalid size %zu", vlen);
+     }
+     if (sversion->major != LIB_VFIO_USER_MAJOR) {
+@@ -290,7 +290,7 @@ mmap_sparse_areas(int *fds, struct vfio_
+                     sparse->areas[i].offset);
+         if (addr == MAP_FAILED) {
+             err(EXIT_FAILURE,
+-                "failed to mmap sparse region #%lu in %s (%#llx-%#llx)",
++                "failed to mmap sparse region #%zu in %s (%#llx-%#llx)",
+                 i, buf, sparse->areas[i].offset,
+                 sparse->areas[i].offset + sparse->areas[i].size - 1);
+         }
+@@ -330,7 +330,7 @@ get_device_region_info(int sock, uint32_
+     cap_sz = region_info->argsz - sizeof(struct vfio_region_info);
+     printf("client: %s: region_info[%d] offset %#llx flags %#x size %llu "
+-           "cap_sz %lu #FDs %lu\n", __func__, index, region_info->offset,
++           "cap_sz %zu #FDs %zu\n", __func__, index, region_info->offset,
+            region_info->flags, region_info->size, cap_sz, nr_fds);
+     if (cap_sz) {
+         struct vfio_region_info_cap_sparse_mmap *sparse = NULL;
+@@ -487,14 +487,14 @@ access_region(int sock, int region, bool
+                               recv_data, recv_data_len, NULL, 0);
+     pthread_mutex_unlock(&mutex);
+     if (ret != 0) {
+-        warn("failed to %s region %d %#lx-%#lx",
++        warn("failed to %s region %d %#"PRIx64"-%#"PRIx64,
+              is_write ? "write to" : "read from", region, offset,
+              offset + data_len - 1);
+         free(recv_data);
+         return ret;
+     }
+     if (recv_data->count != data_len) {
+-        warnx("bad %s data count, expected=%lu, actual=%d",
++        warnx("bad %s data count, expected=%zu, actual=%d",
+              is_write ? "write" : "read", data_len,
+              recv_data->count);
+         free(recv_data);
+@@ -585,8 +585,8 @@ handle_dma_write(int sock, struct vfio_u
+         c = pwrite(dma_region_fds[i], data, dma_access.count, offset);
+         if (c != (ssize_t)dma_access.count) {
+-            err(EXIT_FAILURE, "failed to write to fd=%d at [%#lx-%#lx)",
+-                    dma_region_fds[i], offset, offset + dma_access.count);
++            err(EXIT_FAILURE, "failed to write to fd=%d at [%#"PRIx64"-%#"PRIx64")",
++                    dma_region_fds[i], (int64_t)offset, (int64_t)(offset + dma_access.count));
+         }
+         break;
+     }
+@@ -640,8 +640,8 @@ handle_dma_read(int sock, struct vfio_us
+         c = pread(dma_region_fds[i], data, dma_access.count, offset);
+         if (c != (ssize_t)dma_access.count) {
+-            err(EXIT_FAILURE, "failed to read from fd=%d at [%#lx-%#lx)",
+-                    dma_region_fds[i], offset, offset + dma_access.count);
++            err(EXIT_FAILURE, "failed to read from fd=%d at [%#"PRIx64"-%#"PRIx64")",
++                    dma_region_fds[i], (int64_t)offset, (int64_t)(offset + dma_access.count));
+         }
+         break;
+     }
+@@ -706,7 +706,7 @@ get_dirty_bitmap(int sock, struct vfio_u
+         err(EXIT_FAILURE, "failed to get dirty page bitmap");
+     }
+-    printf("client: %s: %#lx-%#lx\t%#x\n", __func__, range->iova,
++    printf("client: %s: %#"PRIx64"-%#"PRIx64"\t%#x\n", __func__, range->iova,
+            range->iova + range->size - 1, bitmap[0]);
+     free(data);
+@@ -900,7 +900,7 @@ migrate_from(int sock, size_t *nr_iters,
+     _nr_iters += do_migrate(sock, 1, (*migr_iters) + _nr_iters);
+     if (_nr_iters != 2) {
+         errx(EXIT_FAILURE,
+-             "expected 2 iterations instead of %ld while in stop-and-copy state",
++             "expected 2 iterations instead of %zd while in stop-and-copy state",
+              _nr_iters);
+     }
+@@ -1000,7 +1000,7 @@ migrate_to(char *old_sock_path, int *ser
+          * TODO write half of migration data via regular write and other half via
+          * memopy map.
+          */
+-        printf("client: writing migration device data %#lx-%#lx\n",
++        printf("client: writing migration device data %#"PRIx64"-%#"PRIx64"\n",
+                data_offset, data_offset + migr_iters[i].iov_len - 1);
+         ret = access_region(sock, VFU_PCI_DEV_MIGR_REGION_IDX, true,
+                             data_offset, migr_iters[i].iov_base,
+--- qemu-7.2.10/subprojects/libvfio-user/samples/server.c.orig 2024-03-04 17:26:53.000000000 +0100
++++ qemu-7.2.10/subprojects/libvfio-user/samples/server.c      2024-04-04 16:58:57.346435682 +0200
+@@ -93,8 +93,8 @@ bar0_access(vfu_ctx_t *vfu_ctx, char * c
+     struct server_data *server_data = vfu_get_private(vfu_ctx);
+     if (count != sizeof(time_t) || offset != 0) {
+-        vfu_log(vfu_ctx, LOG_ERR, "bad BAR0 access %#lx-%#lx",
+-                offset, offset + count - 1);
++        vfu_log(vfu_ctx, LOG_ERR, "bad BAR0 access %#"PRIx64"-%#"PRIx64,
++                (int64_t)offset, (int64_t)(offset + count - 1));
+         errno = EINVAL;
+         return -1;
+     }
+@@ -123,8 +123,8 @@ bar1_access(vfu_ctx_t *vfu_ctx, char * c
+     struct server_data *server_data = vfu_get_private(vfu_ctx);
+     if (offset + count > server_data->bar1_size) {
+-        vfu_log(vfu_ctx, LOG_ERR, "bad BAR1 access %#lx-%#lx",
+-                offset, offset + count - 1);
++        vfu_log(vfu_ctx, LOG_ERR, "bad BAR1 access %#"PRIx64"-%#"PRIx64,
++                (int64_t)offset, (int64_t)(offset + count - 1));
+         errno = EINVAL;
+         return -1;
+     }
+@@ -353,7 +353,7 @@ migration_write_data(vfu_ctx_t *vfu_ctx,
+     assert(data != NULL);
+     if (offset != 0 || size < server_data->bar1_size) {
+-        vfu_log(vfu_ctx, LOG_DEBUG, "XXX bad migration data write %#lx-%#lx",
++        vfu_log(vfu_ctx, LOG_DEBUG, "XXX bad migration data write %#"PRIx64"-%#"PRIx64,
+                 offset, offset + size - 1);
+         errno = EINVAL;
+         return -1;
+--- qemu-7.2.10/subprojects/libvfio-user/test/unit-tests.c.orig        2024-03-04 17:26:53.000000000 +0100
++++ qemu-7.2.10/subprojects/libvfio-user/test/unit-tests.c     2024-04-04 16:59:18.846711984 +0200
+@@ -161,8 +161,8 @@ static int
+ check_dma_info(const LargestIntegralType value,
+                const LargestIntegralType cvalue)
+ {
+-    vfu_dma_info_t *info = (vfu_dma_info_t *)value;
+-    vfu_dma_info_t *cinfo = (vfu_dma_info_t *)cvalue;
++    vfu_dma_info_t *info = (vfu_dma_info_t *)(uintptr_t)value;
++    vfu_dma_info_t *cinfo = (vfu_dma_info_t *)(uintptr_t)cvalue;
+     return info->iova.iov_base == cinfo->iova.iov_base &&
+         info->iova.iov_len == cinfo->iova.iov_len &&
+@@ -330,7 +330,7 @@ test_dma_addr_to_sgl(void **state UNUSED
+     assert_int_equal(1, ret);
+     assert_int_equal(r->info.iova.iov_base, sg[0].dma_addr);
+     assert_int_equal(0, sg[0].region);
+-    assert_int_equal(0x2000 - (unsigned long long)r->info.iova.iov_base,
++    assert_int_equal(0x2000 - (unsigned long long)(uintptr_t)r->info.iova.iov_base,
+                      sg[0].offset);
+     assert_int_equal(0x400, sg[0].length);
+     assert_true(vfu_sg_is_mappable(&vfu_ctx, &sg[0]));
+--- qemu-7.2.10/subprojects/libvfio-user/lib/tran_pipe.c.orig  2024-03-04 17:26:53.000000000 +0100
++++ qemu-7.2.10/subprojects/libvfio-user/lib/tran_pipe.c       2024-04-04 17:01:32.872219201 +0200
+@@ -83,7 +83,7 @@ tran_pipe_send_iovec(int fd, uint16_t ms
+             return ERROR_INT(ECONNRESET);
+         }
+         return -1;
+-    } else if (ret < hdr.msg_size) {
++    } else if ((uint32_t)ret < hdr.msg_size) {
+         return ERROR_INT(ECONNRESET);
+     }
diff --git a/qemu-cflags.patch b/qemu-cflags.patch
new file mode 100644 (file)
index 0000000..a2d165f
--- /dev/null
@@ -0,0 +1,13 @@
+--- qemu-8.2.4/include/qemu/osdep.h.orig       2024-05-13 21:19:44.000000000 +0200
++++ qemu-8.2.4/include/qemu/osdep.h    2024-05-28 21:35:11.927464569 +0200
+@@ -27,10 +27,6 @@
+ #ifndef QEMU_OSDEP_H
+ #define QEMU_OSDEP_H
+-#if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ && defined __linux__
+-# define _FORTIFY_SOURCE 2
+-#endif
+-
+ #include "config-host.h"
+ #ifdef NEED_CPU_H
+ #include CONFIG_TARGET
index a5109914bbced2d10e338d0242c679e8f23f745b..99e3bbe8ac55d912ef943655fb787680f00e8841 100644 (file)
--- a/qemu.spec
+++ b/qemu.spec
@@ -4,6 +4,7 @@
 # Conditional build:
 %bcond_without sdl             # SDL UI and audio support
 %bcond_without opengl          # Don't require GL deps
+%bcond_with    canokey         # CanoKey support
 %bcond_with    ceph            # Ceph/RBD support
 %bcond_without glusterfs       # GlusterFS backend
 %bcond_without rdma            # RDMA-based migration support
 %bcond_without iscsi           # iscsi support
 %bcond_without libnfs          # NFS support
 %bcond_without multipath       # Multipath support
+%bcond_with    pipewire        # pipewire support
 %bcond_without pmem            # libpmem (persistent memory) support
 %bcond_without seccomp         # seccomp support
 %bcond_without usbredir        # usb network redirection support
 %bcond_without system_seabios  # system seabios binary
 %bcond_without snappy          # snappy compression library
 %bcond_without user_static     # build linux-user static packages
+%bcond_with    vfio_user       # vfio-user server support
 %bcond_with    lttng           # lttng-ust trace backend support [needs update]
 %bcond_without systemtap       # SystemTap/dtrace trace backend support
 %bcond_without virgl           # build virgl support
 Summary:       QEMU CPU Emulator
 Summary(pl.UTF-8):     QEMU - emulator procesora
 Name:          qemu
-Version:       8.2.2
+Version:       8.2.4
 Release:       1
 License:       GPL v2, BSD (edk2 firmware files)
 Group:         Applications/Emulators
 Source0:       https://download.qemu.org/%{name}-%{version}.tar.xz
-# Source0-md5: e43091262671c1728b09522932b75b1d
+# Source0-md5: aa5c2f004d513b746f25a00cfec8eaa5
 # Loads kvm kernel modules at boot
 Source3:       kvm-modules-load.conf
 # Creates /dev/kvm
@@ -61,10 +64,13 @@ Source10:   ksmtuned.conf
 Source12:      99-%{name}-guest-agent.rules
 Source13:      %{name}-guest-agent.init
 Source14:      %{name}-guest-agent.logrotate
-Patch3:                %{name}-xattr.patch
-Patch4:                libjpeg-boolean.patch
+Patch0:                %{name}-cflags.patch
+Patch2:                %{name}-xattr.patch
+Patch3:                libjpeg-boolean.patch
 Patch5:                %{name}-u2f-emu.patch
 Patch6:                %{name}-linux-mount.patch
+Patch7:                libvfio-user-types.patch
+Patch8:                libvfio-user-alloca.patch
 URL:           https://www.qemu.org/
 %{?with_opengl:BuildRequires:  Mesa-libgbm-devel}
 %{?with_opengl:BuildRequires:  OpenGL-GLX-devel}
@@ -72,24 +78,28 @@ URL:                https://www.qemu.org/
 %{?with_sdl:BuildRequires:     SDL2-devel >= 2.0}
 %{?with_sdl:BuildRequires:     SDL2_image-devel >= 2.0}
 BuildRequires: alsa-lib-devel
+BuildRequires: bison
 %{?with_brlapi:BuildRequires:  brlapi-devel}
 BuildRequires: bzip2-devel
+%{?with_canokey:BuildRequires: canokey-qemu-devel}
 BuildRequires: capstone-devel >= 4.0
 %{?with_ceph:BuildRequires:    ceph-devel >= 12}
 BuildRequires: curl-devel >= 7.29.0
 BuildRequires: cyrus-sasl-devel >= 2
 BuildRequires: daxctl-devel >= 57
+BuildRequires: flex
 BuildRequires: gcc >= 6:7.4
 BuildRequires: gettext-tools
-BuildRequires: glib2-devel >= 1:2.64
+BuildRequires: glib2-devel >= 1:2.75.3
 # minimal is 3.4 but new features are used up to 6
 %{?with_glusterfs:BuildRequires:       glusterfs-devel >= 6}
 BuildRequires: gnutls-devel >= 3.6.14
 %{?with_gtk3:BuildRequires:    gtk+3-devel >= 3.22.0}
 BuildRequires: jack-audio-connection-kit-devel
-# for tests
-#BuildRequires:        keyutils-devel
+%{?with_vfio_user:BuildRequires:       json-c-devel >= 0.11}
+BuildRequires: keyutils-devel
 BuildRequires: libaio-devel
+BuildRequires: libblkio-devel >= 1.3.0
 BuildRequires: libbpf-devel
 %{?with_smartcard:BuildRequires:       libcacard-devel >= 2.5.1}
 BuildRequires: libcap-ng-devel
@@ -107,6 +117,8 @@ BuildRequires:      libpng-devel >= 2:1.6.34
 %{?with_seccomp:BuildRequires: libseccomp-devel >= 2.3.0}
 BuildRequires: libselinux-devel
 BuildRequires: libssh-devel >= 0.8.7
+BuildRequires: libslirp-devel >= 4.7
+BuildRequires: libstdc++-devel >= 6:4.7
 # for tests only
 #BuildRequires:        libtasn1-devel
 BuildRequires: libu2f-emu-devel
@@ -117,32 +129,34 @@ BuildRequires:    libxml2-devel >= 2.0
 %{?with_lttng:BuildRequires:   lttng-ust-devel >= 2.1}
 BuildRequires: lzfse-devel
 BuildRequires: lzo-devel >= 2
-BuildRequires: meson >= 0.59.3
+BuildRequires: meson >= 0.63.0
 %{?with_multipath:BuildRequires:       multipath-tools-devel}
 BuildRequires: ncurses-devel
 # also libgcrypt-devel >= 1.8 possible, but gnutls already pulls nettle
 BuildRequires: nettle-devel >= 3.4
-BuildRequires: ninja
+BuildRequires: ninja >= 1.5
 %{?with_smartcard:BuildRequires:       nss-devel >= 1:3.12.8}
 BuildRequires: numactl-devel
 BuildRequires: pam-devel
 BuildRequires: perl-Encode
 BuildRequires: perl-tools-pod
+%{?with_pipewire:BuildRequires:        pipewire-devel >= 0.3.60}
 BuildRequires: pixman-devel >= 0.21.8
 BuildRequires: pkgconfig
 %{?with_pmem:BuildRequires:    pmdk-devel}
 %{?with_pulseaudio:BuildRequires:      pulseaudio-devel}
-BuildRequires: python3 >= 1:3.6
-BuildRequires: python3-sphinx_rtd_theme
+BuildRequires: python3 >= 1:3.7
+BuildRequires: python3-sphinx_rtd_theme >= 0.5
+BuildRequires: python3-tomli >= 1.2.0
 BuildRequires: rpm-build >= 4.6
 BuildRequires: rpmbuild(macros) >= 1.644
 %{?with_system_seabios:BuildRequires:  seabios}
 BuildRequires: sed >= 4.0
 %{?with_snappy:BuildRequires:  snappy-devel}
-BuildRequires: sphinx-pdg
+BuildRequires: sphinx-pdg >= 1.6
 %if %{with spice}
-BuildRequires: spice-protocol >= 0.12.3
-BuildRequires: spice-server-devel >= 0.12.5
+BuildRequires: spice-protocol >= 0.14.0
+BuildRequires: spice-server-devel >= 0.14.0
 %endif
 %{?with_systemtap:BuildRequires:       systemtap-sdt-devel}
 BuildRequires: tar >= 1:1.22
@@ -168,8 +182,9 @@ BuildRequires:      xz
 BuildRequires: zlib-devel
 BuildRequires: zstd-devel >= 1.4.0
 %if %{with user_static}
-BuildRequires: glib2-static >= 1:2.74
+BuildRequires: glib2-static >= 1:2.75.3
 BuildRequires: glibc-static
+BuildRequires: libstdc++-static >= 6:4.7
 BuildRequires: pcre2-8-static >= 10.32
 BuildRequires: zlib-static
 %endif
@@ -211,11 +226,13 @@ Requires: libpng >= 2:1.6.34 \
 %if %{with seccomp} \
 Requires:      libseccomp >= 2.3.0 \
 %endif \
+Requires:      libslirp >= 4.7 \
 Requires:      liburing >= 0.3 \
 Requires:      libusb >= 1.0.22 \
+Requires:      libxdp >= 1.4.0 \
 Requires:      pixman >= 0.21.8 \
 %if %{with spice} \
-Requires:      spice-server-libs >= 0.12.5 \
+Requires:      spice-server-libs >= 0.14.0 \
 %endif \
 %if %{with usbredir} \
 Requires:      usbredir >= 0.6 \
@@ -266,12 +283,14 @@ Requires(pre):    /bin/id
 Requires(pre): /usr/bin/getgid
 Requires(pre): /usr/sbin/groupadd
 Requires(pre): /usr/sbin/useradd
-Requires:      glib2 >= 1:2.64
+Requires:      glib2 >= 1:2.75.3
 Requires:      gnutls-libs >= 3.6.14
 %{?with_gtk3:Requires: gtk+3 >= 3.22.0}
+Requires:      libblkio >= 1.3.0
 Requires:      nettle >= 3.4
 %{?with_vte:Requires:  vte >= 0.32.0}
 Requires:      zstd >= 1.4.0
+Suggests:      virtiofsd
 Provides:      group(qemu)
 Provides:      user(qemu)
 Obsoletes:     qemu-kvm-common < 2
@@ -491,25 +510,6 @@ dobrą szybkość emulacji dzięki użyciu translacji dynamicznej.
 
 Ten pakiet zawiera emulator systemu z procesorem HP/PA (PA-RISC).
 
-%package system-loongarch
-Summary:       QEMU system emulator for Loongson
-Summary(pl.UTF-8):     QEMU - emulator systemu z procesorem Loongson
-Group:         Applications/Emulators
-Requires:      %{name}-common = %{version}-%{release}
-%systempkg_req
-
-%description system-loongarch
-QEMU is a generic and open source processor emulator which achieves a
-good emulation speed by using dynamic translation.
-
-This package provides the system emulator with Loongson CPU.
-
-%description system-loongarch -l pl.UTF-8
-QEMU to ogólny, mający otwarte źródła emulator procesora, osiągający
-dobrą szybkość emulacji dzięki użyciu translacji dynamicznej.
-
-Ten pakiet zawiera emulator systemu z procesorem Loongson.
-
 %package system-m68k
 Summary:       QEMU system emulator for m68k
 Summary(pl.UTF-8):     QEMU - emulator systemu z procesorem m68k
@@ -773,7 +773,8 @@ Summary:    QEMU system emulator for x86
 Summary(pl.UTF-8):     QEMU - emulator systemu z procesorem x86
 Group:         Applications/Emulators
 Requires:      %{name}-common = %{version}-%{release}
-%{?with_system_seabios:Requires:       seabios}
+%{?with_vfio_user:Requires:    libvfio-user = %{version}-%{release}}
+%{?with_system_seabios:Requires:       seabios >= 1.11.0}
 %systempkg_req
 Obsoletes:     kvm < 89
 Obsoletes:     qemu-kvm-system-x86 < 2
@@ -814,7 +815,7 @@ Ten pakiet zawiera emulator systemu z procesorem Xtensa.
 Summary:       QEMU guest agent
 Summary(pl.UTF-8):     Agent gościa QEMU
 Group:         Daemons
-Requires:      glib2 >= 1:2.64
+Requires:      glib2 >= 1:2.75.3
 Requires:      liburing >= 0.3
 Obsoletes:     qemu-kvm-guest-agent < 2
 Conflicts:     SysVinit < 2.96-2
@@ -851,6 +852,19 @@ QEMU module for JACK audio output.
 %description module-audio-jack -l pl.UTF-8
 Moduł QEMU z wyjściem dźwięku JACK.
 
+%package module-audio-pipewire
+Summary:       QEMU module for PipeWire audio output
+Summary(pl.UTF-8):     Moduł QEMU z wyjściem dźwięku PipeWire
+Group:         Applications/Emulators
+Requires:      %{name}-common = %{version}-%{release}
+Requires:      pipewire-libs >= 0.3.60
+
+%description module-audio-pipewire
+QEMU module for PipeWire audio output.
+
+%description module-audio-pipewire -l pl.UTF-8
+Moduł QEMU z wyjściem dźwięku PipeWire.
+
 %package module-block-curl
 Summary:       QEMU module for 'curl' block devices
 Summary(pl.UTF-8):     Moduł QEMU dla urządeń blokowych typu 'curl'
@@ -986,12 +1000,44 @@ systemtap/dtrace probes for QEMU.
 %description -n systemtap-qemu -l pl.UTF-8
 Sondy systemtap/dtrace dla QEMU.
 
+%package -n libvfio-user
+Summary:       vfio-user library
+Summary(pl.UTF-8):     Biblioteka vfio-user
+Group:         Libraries
+Requires:      json-c >= 0.11
+
+%description -n libvfio-user
+vfio-user is a framework that allows implementing PCI devices in
+userspace. Clients (such as qemu) talk the vfio-user protocol over a
+UNIX socket to a server. This library, libvfio-user, provides an API
+for implementing such servers.
+
+%description -n libvfio-user -l pl.UTF-8
+vfio-user to szkielet pozwalający implementować urządzenia PCI w
+przestrzeni użytkownika. Klienci (jak qemu) komunikują się z serwerem
+protokołem vfio-user przez gniazdo uniksowe.
+
+%package -n libvfio-user-devel
+Summary:       Header files for vfio-user library
+Summary(pl.UTF-8):     Pliki nagłówkowe biblioteki vfio-user
+Group:         Development/Libraries
+Requires:      libvfio-user = %{version}-%{release}
+
+%description -n libvfio-user-devel
+Header files for vfio-user library.
+
+%description -n libvfio-user-devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki vfio-user.
+
 %prep
 %setup -q
+%patch0 -p1
+%patch2 -p1
 %patch3 -p1
-%patch4 -p1
 %patch5 -p1
 %patch6 -p1
+%patch7 -p1
+%patch8 -p1
 
 %{__sed} -i '1s,/usr/bin/env python3,%{__python3},' scripts/qemu-trace-stap
 
@@ -999,6 +1045,18 @@ Sondy systemtap/dtrace dla QEMU.
 # don't require stap binary during build
 %{__sed} -i -e "s/stap.found()/true/" meson.build docs/meson.build scripts/meson.build
 %endif
+
+%if %{without smartcard}
+%{__sed} -i -e '/^config USB_SMARTCARD/,/^$/ s/default y/default n/' hw/usb/Kconfig
+%endif
+%ifarch x32
+# xen-emu supports only LP64 __x86_64__ case
+%{__sed} -i -e '/^config XEN_EMU/,$ s/default y/default n/' hw/i386/Kconfig
+
+# plain x32 doesn't provide __sync_bool_compare_and_swap_16 - fail int128_t/ATOMIC128 tests earlier
+%{__sed} -i -e '/^has_int128_type = / s/$/FAILME/' meson.build
+%endif
+
 %build
 
 build() {
@@ -1024,8 +1082,7 @@ build() {
        "$@"
 
        %{__make} \
-               V=1 \
-               %{!?with_smartcard:CONFIG_USB_SMARTCARD=n}
+               V=1
 
        cd ..
 }
@@ -1036,6 +1093,7 @@ build dynamic \
        --audio-drv-list="alsa,jack%{?with_oss:,oss}%{?with_pulseaudio:,pa}%{?with_sdl:,sdl}" \
        --enable-attr \
        %{__enable_disable brlapi} \
+       %{__enable_disable canokey} \
        --enable-cap-ng \
        --enable-capstone \
        --enable-curl \
@@ -1046,6 +1104,7 @@ build dynamic \
        %{!?with_gtk3:--disable-gtk} \
        %{__enable_disable iscsi libiscsi} \
        %{__enable_disable libnfs} \
+       %{__enable_disable pipewire} \
        %{__enable_disable pmem libpmem} \
        --enable-lzo \
        %{__enable_disable multipath mpath} \
@@ -1056,12 +1115,14 @@ build dynamic \
        %{__enable_disable rdma} \
        %{__enable_disable sdl} \
        %{__enable_disable seccomp} \
+       --enable-slirp \
        %{__enable_disable spice} \
        %{__enable_disable smartcard} \
        %{__enable_disable snappy} \
        --enable-tpm \
        %{__enable_disable usbredir usb-redir} \
        --enable-vde \
+       %{?with_vfio_user:--enable-vfio-user-server} \
        %{__enable_disable virgl virglrenderer} \
        --enable-virtfs \
        --enable-vnc-jpeg \
@@ -1073,6 +1134,7 @@ build dynamic \
 %if %{with user_static}
 build static \
        --disable-brlapi \
+       --disable-canokey \
        --disable-cap-ng \
        --disable-capstone \
        --disable-curl \
@@ -1108,7 +1170,6 @@ install -d \
 
 %if %{with user_static}
 %{__make} -C build-static install \
-       %{!?with_smartcard:CONFIG_USB_SMARTCARD=n} \
        DESTDIR=$RPM_BUILD_ROOT
 
 # Give all QEMU user emulators a -static suffix
@@ -1119,7 +1180,6 @@ done
 %endif
 
 %{__make} -C build-dynamic install \
-       %{!?with_smartcard:CONFIG_USB_SMARTCARD=n} \
        DESTDIR=$RPM_BUILD_ROOT
 
 # let rpm generate dependencies
@@ -1146,7 +1206,6 @@ install -p ksmctl $RPM_BUILD_ROOT%{_sbindir}
 install -p %{SOURCE9} $RPM_BUILD_ROOT%{_sbindir}/ksmtuned
 install -p %{SOURCE10} $RPM_BUILD_ROOT%{_sysconfdir}/ksmtuned.conf
 
-# For the qemu-guest-agent subpackage install the udev rules.
 install -p %{SOURCE12} $RPM_BUILD_ROOT/lib/udev/rules.d
 
 install -p %{SOURCE13} $RPM_BUILD_ROOT/etc/rc.d/init.d/qemu-ga
@@ -1204,6 +1263,9 @@ if [ "$1" = "0" ]; then
        /sbin/chkconfig --del qemu-ga
 fi
 
+%post  -n libvfio-user -p /sbin/ldconfig
+%postun        -n libvfio-user -p /sbin/ldconfig
+
 %files
 %defattr(644,root,root,755)
 
@@ -1233,8 +1295,11 @@ fi
 %attr(755,root,root) %{_libexecdir}/virtfs-proxy-helper
 %dir %{_libdir}/%{name}
 # modules without too many external dependencies
+%attr(755,root,root) %{_libdir}/%{name}/block-blkio.so
 %attr(755,root,root) %{_libdir}/%{name}/block-dmg-bz2.so
 %attr(755,root,root) %{_libdir}/%{name}/block-dmg-lzfse.so
+%attr(755,root,root) %{_libdir}/%{name}/accel-tcg-i386.so
+%attr(755,root,root) %{_libdir}/%{name}/accel-tcg-x86_64.so
 %attr(755,root,root) %{_libdir}/%{name}/audio-alsa.so
 %if %{with oss}
 %attr(755,root,root) %{_libdir}/%{name}/audio-oss.so
@@ -1242,27 +1307,32 @@ fi
 %if %{with pulseaudio}
 %attr(755,root,root) %{_libdir}/%{name}/audio-pa.so
 %endif
-%if %{with spice}
-%attr(755,root,root) %{_libdir}/%{name}/audio-spice.so
-%attr(755,root,root) %{_libdir}/%{name}/chardev-spice.so
-%attr(755,root,root) %{_libdir}/%{name}/hw-display-qxl.so
+%if %{with brlapi}
+%attr(755,root,root) %{_libdir}/%{name}/chardev-baum.so
 %endif
+%attr(755,root,root) %{_libdir}/%{name}/hw-display-qxl.so
 %attr(755,root,root) %{_libdir}/%{name}/hw-display-virtio-gpu.so
-%attr(755,root,root) %{_libdir}/%{name}/hw-display-virtio-gpu-gl.so
+%{?with_virgl:%attr(755,root,root) %{_libdir}/%{name}/hw-display-virtio-gpu-gl.so}
 %attr(755,root,root) %{_libdir}/%{name}/hw-display-virtio-gpu-pci.so
-%attr(755,root,root) %{_libdir}/%{name}/hw-display-virtio-gpu-pci-gl.so
+%{?with_virgl:%attr(755,root,root) %{_libdir}/%{name}/hw-display-virtio-gpu-pci-gl.so}
 %attr(755,root,root) %{_libdir}/%{name}/hw-display-virtio-vga.so
 %attr(755,root,root) %{_libdir}/%{name}/hw-display-virtio-vga-gl.so
 %attr(755,root,root) %{_libdir}/%{name}/hw-s390x-virtio-gpu-ccw.so
 %attr(755,root,root) %{_libdir}/%{name}/hw-usb-host.so
+%attr(755,root,root) %{_libdir}/%{name}/ui-curses.so
+%if %{with usbredir}
 %attr(755,root,root) %{_libdir}/%{name}/hw-usb-redirect.so
+%endif
+%if %{with smartcard}
 %attr(755,root,root) %{_libdir}/%{name}/hw-usb-smartcard.so
-%attr(755,root,root) %{_libdir}/%{name}/ui-curses.so
-%attr(755,root,root) %{_libdir}/%{name}/ui-egl-headless.so
+%endif
 %if %{with opengl}
+%attr(755,root,root) %{_libdir}/%{name}/ui-egl-headless.so
 %attr(755,root,root) %{_libdir}/%{name}/ui-opengl.so
 %endif
 %if %{with spice}
+%attr(755,root,root) %{_libdir}/%{name}/audio-spice.so
+%attr(755,root,root) %{_libdir}/%{name}/chardev-spice.so
 %attr(755,root,root) %{_libdir}/%{name}/ui-spice-app.so
 %attr(755,root,root) %{_libdir}/%{name}/ui-spice-core.so
 %endif
@@ -1270,8 +1340,8 @@ fi
 %dir %{_datadir}/%{name}/firmware
 %{_datadir}/%{name}/keymaps
 %{_datadir}/%{name}/trace-events-all
-%dir %{_datadir}/%{name}/vhost-user
 %if %{with virgl}
+%dir %{_datadir}/%{name}/vhost-user
 %{_datadir}/%{name}/vhost-user/50-qemu-gpu.json
 %endif
 %{_desktopdir}/qemu.desktop
@@ -1380,9 +1450,7 @@ fi
 %attr(755,root,root) %{_bindir}/qemu-x86_64-static
 %attr(755,root,root) %{_bindir}/qemu-xtensa-static
 %attr(755,root,root) %{_bindir}/qemu-xtensaeb-static
-%if %{with systemtap}
-%attr(755,root,root) %{_bindir}/qemu-trace-stap-static
-%endif
+%{?with_systemtap:%attr(755,root,root) %{_bindir}/qemu-trace-stap-static}
 %endif
 
 %files system-aarch64
@@ -1407,6 +1475,7 @@ fi
 %files system-avr
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_bindir}/qemu-system-avr
+
 %files system-cris
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_bindir}/qemu-system-cris
@@ -1416,10 +1485,6 @@ fi
 %attr(755,root,root) %{_bindir}/qemu-system-hppa
 %{_datadir}/%{name}/hppa-firmware.img
 
-%files system-loongarch
-%defattr(644,root,root,755)
-%attr(755,root,root) %{_bindir}/qemu-system-loongarch64
-
 %files system-m68k
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_bindir}/qemu-system-m68k
@@ -1431,6 +1496,7 @@ fi
 
 %files system-mips
 %defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/qemu-system-loongarch64
 %attr(755,root,root) %{_bindir}/qemu-system-mips
 %attr(755,root,root) %{_bindir}/qemu-system-mipsel
 %attr(755,root,root) %{_bindir}/qemu-system-mips64
@@ -1458,6 +1524,8 @@ fi
 %{_datadir}/%{name}/slof.bin
 %{_datadir}/%{name}/u-boot.e500
 %{_datadir}/%{name}/u-boot-sam460-20100605.bin
+%{_datadir}/%{name}/vof.bin
+%{_datadir}/%{name}/vof-nvram.bin
 
 %files system-riscv32
 %defattr(644,root,root,755)
@@ -1501,8 +1569,6 @@ fi
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_bindir}/qemu-system-i386
 %attr(755,root,root) %{_bindir}/qemu-system-x86_64
-%attr(755,root,root) %{_libdir}/%{name}/accel-tcg-i386.so
-%attr(755,root,root) %{_libdir}/%{name}/accel-tcg-x86_64.so
 %ifarch %{ix86} %{x8664} x32
 %config(noreplace) %verify(not md5 mtime size) /etc/modules-load.d/kvm.conf
 /lib/udev/rules.d/80-kvm.rules
@@ -1545,8 +1611,6 @@ fi
 %{_datadir}/%{name}/vgabios-stdvga.bin
 %{_datadir}/%{name}/vgabios-virtio.bin
 %{_datadir}/%{name}/vgabios-vmware.bin
-%{_datadir}/%{name}/vof.bin
-%{_datadir}/%{name}/vof-nvram.bin
 %{_datadir}/%{name}/firmware/50-edk2-i386-secure.json
 %{_datadir}/%{name}/firmware/50-edk2-x86_64-secure.json
 %{_datadir}/%{name}/firmware/60-edk2-i386.json
@@ -1570,6 +1634,12 @@ fi
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_libdir}/%{name}/audio-jack.so
 
+%if %{with pipewire}
+%files module-audio-pipewire
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/%{name}/audio-pipewire.so
+%endif
+
 %files module-block-curl
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_libdir}/%{name}/block-curl.so
@@ -1627,3 +1697,15 @@ fi
 %{_datadir}/systemtap/tapset/qemu-*.stp
 %{_mandir}/man1/qemu-trace-stap.1*
 %endif
+
+%if %{with vfio_user}
+%files -n libvfio-user
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libvfio-user.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libvfio-user.so.0
+
+%files -n libvfio-user-devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libvfio-user.so
+%{_includedir}/vfio-user
+%endif