mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:46:10 +00:00
Merge tag 'pull-vfio-20260520' of https://github.com/legoater/qemu into staging
vfio queue: * Fix IRQ notifier return value in vfio/ap and vfio/ccw * Fix vfio-user: reject malformed migration capabilities and avoid leaking a duplicate device name * Report overflow in migration size queries * Fix s390x cpu_models build regression * Update libvfio-user subproject to fix compilation on newer compilers * Update update-linux-headers.sh to support typelimits.h and inject VIRTIO_RING_NO_LEGACY in virtio_ring.h to fix the Windows build * Replace abort() with g_assert_not_reached() in the vfio/pci interrupt handling path * Drop superfluous inclusion of hw-error.h from vfio device files # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCAAdFiEEoPZlSPBIlev+awtgUaNDx8/77KEFAmoNsysACgkQUaNDx8/7 # 7KH5sw//UmO9Ky70NWk2g4DqzRi+92DQsjcS9cw/LTSmou6uemFWfF9SAun93u9V # I7Sf8JZLP5pNkVBJqmPsXq6MAvg+fJCJx579vyKcTZvwK+SzPNkcU/Bh1Yie0Bsc # Al45kXtewBsXDgEHIt+GXvpW6Z9kkn2fd3YWNj19Yy4FkTW56/CTDaILWdetRUx7 # OU+i9AN0qjdxBYVgFuiY+IN1GL2Mt6IPrwmqN2S52wch7d4vmC+VXKbggaiXdpg4 # G8vb8/Xr6LYWxhEN+yIoBXMpPZy7PnfRLATYX9tFkMwJsBJPpb3yat7CACOhavfT # EWW29nRzPbSDp9vJDUWNRjrjPSe0FCm9ZNGJwx3+Gv8+d1A/KUTy1Ka01TQVGCif # ljj4N8xFC65AC54pIeOlA1D+8wZYgQcA4+j10dSxgB+ab+WbnD47Q5NwpLqdrZHg # C/w6Zqq4JPBR3WfYCv1+vTFjtaEhrS3WUzHYtLXt8GXHr9RPUw65DLcTvBUQdSpu # 2TmCufpyByI1hb9xbqZKIxGx8CAUvPT1wrLFRH23RPo0pNFhR61gMBstMVppJuQ5 # E9sbAOYCMKM1rR/rI38tSF7WuWm2YwQFE0phTUycmW9e4Vdjxjy0Ej/zW41RteZB # hWltClx9gcM6Trhcr0e0sbQVMX8GyvKK30jO+Fph4vqbEdkL4yE= # =Ge56 # -----END PGP SIGNATURE----- # gpg: Signature made Wed 20 May 2026 09:12:11 EDT # gpg: using RSA key A0F66548F04895EBFE6B0B6051A343C7CFFBECA1 # gpg: Good signature from "Cédric Le Goater <clg@redhat.com>" [full] # gpg: aka "Cédric Le Goater <clg@kaod.org>" [full] # Primary key fingerprint: A0F6 6548 F048 95EB FE6B 0B60 51A3 43C7 CFFB ECA1 * tag 'pull-vfio-20260520' of https://github.com/legoater/qemu: scripts/update-linux-headers: Add typelimits.h vfio/migration: Detect and report overflow in migration size queries update-linux-headers: Inject VIRTIO_RING_NO_LEGACY in virtio_ring.h vfio/ccw: Return false when IRQ notifier setup fails vfio/ap: Return false when IRQ notifier setup fails vfio/pci: Replace abort() with g_assert_not_reached() hw/remote: update libvfio-user subproject vfio-user: reject malformed migration capabilities vfio-user: avoid leaking duplicate device name hw/vfio: Drop superfluous inclusion of hw-error.h target/s390x: restore cpu_models for system builds Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
@@ -800,7 +800,8 @@ static void vfu_object_init_ctx(VfuObject *o, Error **errp)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ret = vfu_setup_device_dma(o->vfu_ctx, &dma_register, &dma_unregister);
|
||||
ret = vfu_setup_device_dma(o->vfu_ctx, LIBVFIO_USER_MAX_DMA_REGIONS,
|
||||
&dma_register, &dma_unregister);
|
||||
if (ret < 0) {
|
||||
error_setg(errp, "vfu: Failed to setup DMA handlers for %s",
|
||||
o->device);
|
||||
|
||||
@@ -280,8 +280,6 @@ static void vfio_user_pci_realize(PCIDevice *pdev, Error **errp)
|
||||
vbasedev->proxy = proxy;
|
||||
vfio_user_set_handler(vbasedev, vfio_user_pci_process_req, vdev);
|
||||
|
||||
vbasedev->name = g_strdup_printf("vfio-user:%s", sock_name);
|
||||
|
||||
if (udev->send_queued) {
|
||||
proxy->flags |= VFIO_PROXY_FORCE_QUEUED;
|
||||
}
|
||||
|
||||
@@ -1190,8 +1190,8 @@ static bool check_migr(VFIOUserProxy *proxy, QObject *qobj, Error **errp)
|
||||
QDict *qdict = qobject_to(QDict, qobj);
|
||||
|
||||
if (qdict == NULL) {
|
||||
error_setg(errp, "malformed %s", VFIO_USER_CAP_MAX_FDS);
|
||||
return true;
|
||||
error_setg(errp, "malformed %s", VFIO_USER_CAP_MIGR);
|
||||
return false;
|
||||
}
|
||||
return caps_parse(proxy, qdict, caps_migr, errp);
|
||||
}
|
||||
|
||||
@@ -193,6 +193,7 @@ static bool vfio_ap_register_irq_notifier(VFIOAPDevice *vapdev,
|
||||
errp)) {
|
||||
qemu_set_fd_handler(fd, NULL, NULL, vapdev);
|
||||
event_notifier_cleanup(notifier);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -431,6 +431,7 @@ static bool vfio_ccw_register_irq_notifier(VFIOCCWDevice *vcdev,
|
||||
VFIO_IRQ_SET_ACTION_TRIGGER, fd, errp)) {
|
||||
qemu_set_fd_handler(fd, NULL, NULL, vcdev);
|
||||
event_notifier_cleanup(notifier);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "hw/vfio/vfio-device.h"
|
||||
#include "hw/vfio/pci.h"
|
||||
#include "hw/core/iommu.h"
|
||||
#include "hw/core/hw-error.h"
|
||||
#include "trace.h"
|
||||
#include "qapi/error.h"
|
||||
#include "qemu/error-report.h"
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "exec/cpu-common.h"
|
||||
#include "hw/vfio/vfio-device.h"
|
||||
#include "hw/core/hw-error.h"
|
||||
#include "qapi/error.h"
|
||||
#include "vfio-helpers.h"
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "qapi/error.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "hw/core/boards.h"
|
||||
#include "hw/core/hw-error.h"
|
||||
#include "hw/nvram/fw_cfg.h"
|
||||
#include "pci.h"
|
||||
#include "pci-quirks.h"
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "system/kvm.h"
|
||||
#include "exec/cpu-common.h"
|
||||
#include "hw/vfio/vfio-device.h"
|
||||
#include "hw/core/hw-error.h"
|
||||
#include "qapi/error.h"
|
||||
#include "vfio-helpers.h"
|
||||
|
||||
|
||||
@@ -320,6 +320,18 @@ static void vfio_migration_cleanup(VFIODevice *vbasedev)
|
||||
migration->data_fd = -1;
|
||||
}
|
||||
|
||||
static bool vfio_migration_check_overflow(VFIODevice *vbasedev, uint64_t size,
|
||||
const char *name)
|
||||
{
|
||||
if (size > INT64_MAX) {
|
||||
error_report("%s: Estimated %s size overflow: 0x%"PRIx64,
|
||||
vbasedev->name, name, size);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static int vfio_query_stop_copy_size(VFIODevice *vbasedev)
|
||||
{
|
||||
uint64_t buf[DIV_ROUND_UP(sizeof(struct vfio_device_feature) +
|
||||
@@ -329,7 +341,7 @@ static int vfio_query_stop_copy_size(VFIODevice *vbasedev)
|
||||
struct vfio_device_feature_mig_data_size *mig_data_size =
|
||||
(struct vfio_device_feature_mig_data_size *)feature->data;
|
||||
VFIOMigration *migration = vbasedev->migration;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
feature->argsz = sizeof(buf);
|
||||
feature->flags =
|
||||
@@ -347,7 +359,10 @@ static int vfio_query_stop_copy_size(VFIODevice *vbasedev)
|
||||
vbasedev->name, ret);
|
||||
} else {
|
||||
migration->stopcopy_size = mig_data_size->stop_copy_length;
|
||||
ret = 0;
|
||||
if (vfio_migration_check_overflow(vbasedev, migration->stopcopy_size,
|
||||
"stop copy size")) {
|
||||
ret = -ERANGE;
|
||||
}
|
||||
}
|
||||
|
||||
trace_vfio_query_stop_copy_size(vbasedev->name,
|
||||
@@ -361,7 +376,7 @@ static int vfio_query_precopy_size(VFIOMigration *migration)
|
||||
struct vfio_precopy_info precopy = {
|
||||
.argsz = sizeof(precopy),
|
||||
};
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
if (ioctl(migration->data_fd, VFIO_MIG_GET_PRECOPY_INFO, &precopy)) {
|
||||
migration->precopy_init_size = 0;
|
||||
@@ -370,9 +385,18 @@ static int vfio_query_precopy_size(VFIOMigration *migration)
|
||||
warn_report_once("VFIO device %s ioctl(VFIO_MIG_GET_PRECOPY_INFO) "
|
||||
"failed (%d)", migration->vbasedev->name, ret);
|
||||
} else {
|
||||
bool overflow;
|
||||
|
||||
migration->precopy_init_size = precopy.initial_bytes;
|
||||
migration->precopy_dirty_size = precopy.dirty_bytes;
|
||||
ret = 0;
|
||||
|
||||
overflow = vfio_migration_check_overflow(migration->vbasedev,
|
||||
migration->precopy_init_size, "precopy init size");
|
||||
overflow |= vfio_migration_check_overflow(migration->vbasedev,
|
||||
migration->precopy_dirty_size, "precopy dirty size");
|
||||
if (overflow) {
|
||||
ret = -ERANGE;
|
||||
}
|
||||
}
|
||||
|
||||
trace_vfio_query_precopy_size(migration->vbasedev->name,
|
||||
|
||||
@@ -451,7 +451,12 @@ static void vfio_msi_interrupt(void *opaque)
|
||||
get_msg = msi_get_message;
|
||||
notify = msi_notify;
|
||||
} else {
|
||||
abort();
|
||||
/*
|
||||
* Interrupt state transitions (MSI/MSI-X -> NONE/INTx) are
|
||||
* protected by the BQL, and eventfd handlers are strictly
|
||||
* unregistered before vdev->interrupt is modified.
|
||||
*/
|
||||
g_assert_not_reached();
|
||||
}
|
||||
|
||||
msg = get_msg(pdev, nr);
|
||||
|
||||
@@ -60,6 +60,7 @@ cp_portable() {
|
||||
-e 'drm.h' \
|
||||
-e 'limits' \
|
||||
-e 'linux/const' \
|
||||
-e 'linux/typelimits' \
|
||||
-e 'linux/kernel' \
|
||||
-e 'linux/sysinfo' \
|
||||
-e 'asm/setup_data.h' \
|
||||
@@ -103,6 +104,7 @@ cp_portable() {
|
||||
-e 's/__kernel_ulong_t/unsigned long/' \
|
||||
-e 's/struct ethhdr/struct eth_header/' \
|
||||
-e '/\#define _LINUX_ETHTOOL_H/a \\n\#include "net/eth.h"' \
|
||||
-e '/\#define _LINUX_VIRTIO_RING_H/a \\n\#define VIRTIO_RING_NO_LEGACY' \
|
||||
"$f" > "$to/$header";
|
||||
}
|
||||
|
||||
@@ -250,6 +252,7 @@ for i in "$hdrdir"/include/linux/*virtio*.h \
|
||||
"$hdrdir/include/linux/pci_regs.h" \
|
||||
"$hdrdir/include/linux/ethtool.h" \
|
||||
"$hdrdir/include/linux/const.h" \
|
||||
"$hdrdir/include/linux/typelimits.h" \
|
||||
"$hdrdir/include/linux/kernel.h" \
|
||||
"$hdrdir/include/linux/kvm_para.h" \
|
||||
"$hdrdir/include/linux/vhost_types.h" \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[wrap-git]
|
||||
url = https://gitlab.com/qemu-project/libvfio-user.git
|
||||
revision = 0b28d205572c80b568a1003db2c8f37ca333e4d7
|
||||
revision = 4d9f663450fa80ff375612dbbafe073700e3d3d8
|
||||
depth = 1
|
||||
|
||||
@@ -22,7 +22,6 @@ gen_features_h = custom_target('gen-features.h',
|
||||
|
||||
s390x_common_ss.add(gen_features_h)
|
||||
s390x_common_ss.add(files(
|
||||
'cpu_models_user.c',
|
||||
'gdbstub.c',
|
||||
))
|
||||
|
||||
@@ -39,6 +38,11 @@ s390x_common_system_ss.add(files(
|
||||
'mmu_helper.c',
|
||||
'sigp.c',
|
||||
'cpu-system.c',
|
||||
'cpu_models_system.c',
|
||||
))
|
||||
|
||||
s390x_user_ss.add(files(
|
||||
'cpu_models_user.c',
|
||||
))
|
||||
|
||||
subdir('tcg')
|
||||
|
||||
Reference in New Issue
Block a user