Skip to contentSkip to conversation

vfio queue

GIT PULL Applied Cédric Le Goater 2 participants 9 messages Jan 26 RISC-V

lore
Share & tools
lore
#0 lore raw

The following changes since commit fea2d7a784fc3627a8aa72875f51fe7634b04b81:

Merge tag 'linux-user-for-v11-pull-request' of https://github.com/hdeller/qemu-hppa into staging (2026-01-24 21:31:17 +1100)

are available in the Git repository at:

https://github.com/legoater/qemu/ tags/pull-vfio-20260126

for you to fetch changes up to 4c5e5d66f991599bd34a65fc243d3c513e6b1e81:

vfio-user: update VFIOProxy flag constants to use the BIT() macro (2026-01-26 08:30:04 +0100)

----------------------------------------------------------------
vfio queue:

* Fixes for vfio-user and CPR
* Fixes issues detected by Coverity
* Updates linux-headers to Linux v6.19-rc1
* Adds support for the creation of dma-buf objects for PCI BARs. This allows safe P2P DMA operations when using iommufd host backend.

----------------------------------------------------------------
Jim Shu (1):
hw/vfio: cpr-iommufd: Fix wrong usage of migrate_add_blocker_modes

Mark Cave-Ayland (2):
vfio-user: fix VFIO_PROXY_USE_MULTI constant value
vfio-user: update VFIOProxy flag constants to use the BIT() macro

Nicolin Chen (1):
hw/vfio/region: Create dmabuf for PCI BAR per region

Shameer Kolothum (2):
linux-headers: Update to Linux v6.19-rc1 hw/vfio: Add helper to retrieve device feature

Zhenzhong Duan (1):
vfio/migration: Fix page size calculation

 hw/vfio-user/proxy.h                               |   8 +-
 include/hw/vfio/vfio-device.h                      |   3 +
 include/standard-headers/drm/drm_fourcc.h          |  25 +++--
 include/standard-headers/linux/ethtool.h           |   5 +
 include/standard-headers/linux/input-event-codes.h |  14 ++-
 include/standard-headers/linux/pci_regs.h          |  89 ++++++++++++++++
 include/standard-headers/linux/virtio_net.h        |   3 +-
 include/standard-headers/linux/virtio_pci.h        |   2 +-
 linux-headers/asm-arm64/kvm.h                      |   2 +-
 linux-headers/asm-arm64/unistd_64.h                |   1 +
 linux-headers/asm-generic/unistd.h                 |   4 +-
 linux-headers/asm-loongarch/kvm.h                  |   1 +
 linux-headers/asm-loongarch/unistd.h               |   6 ++
 linux-headers/asm-loongarch/unistd_64.h            |   1 +
 linux-headers/asm-mips/unistd_n32.h                |   1 +
 linux-headers/asm-mips/unistd_n64.h                |   1 +
 linux-headers/asm-mips/unistd_o32.h                |   1 +
 linux-headers/asm-powerpc/unistd_32.h              |   1 +
 linux-headers/asm-powerpc/unistd_64.h              |   1 +
 linux-headers/asm-riscv/kvm.h                      |   3 +
 linux-headers/asm-riscv/unistd_32.h                |   1 +
 linux-headers/asm-riscv/unistd_64.h                |   1 +
 linux-headers/asm-s390/bitsperlong.h               |   4 -
 linux-headers/asm-s390/unistd.h                    |   4 -
 linux-headers/asm-s390/unistd_64.h                 |   9 +-
 linux-headers/asm-x86/kvm.h                        |   1 +
 linux-headers/asm-x86/unistd_32.h                  |   1 +
 linux-headers/asm-x86/unistd_64.h                  |   1 +
 linux-headers/asm-x86/unistd_x32.h                 |   1 +
 linux-headers/linux/iommufd.h                      |  10 ++
 linux-headers/linux/kvm.h                          |  11 ++
 linux-headers/linux/mshv.h                         | 116 ++++++++++++++++++++-
 linux-headers/linux/psp-sev.h                      |  66 +++++++-----
 linux-headers/linux/vfio.h                         |  28 +++++
 hw/net/virtio-net.c                                |  11 +-
 hw/vfio/container.c                                |   2 +-
 hw/vfio/cpr-iommufd.c                              |   4 +-
 hw/vfio/device.c                                   |   9 ++
 hw/vfio/listener.c                                 |   4 +-
 hw/vfio/migration.c                                |   2 +-
 hw/vfio/region.c                                   |  65 +++++++++++-
 hw/vfio/trace-events                               |   1 +
 42 files changed, 457 insertions(+), 67 deletions(-)
#1 lore raw

[PULL 4/7] hw/vfio: Add helper to retrieve device feature

From: Shameer Kolothum <[email protected]>

Add vfio_device_get_feature() as a common helper to retrieve VFIO device features.

No functional change intended.

---
 include/hw/vfio/vfio-device.h | 3 +++
 hw/vfio/container.c           | 2 +-
 hw/vfio/device.c              | 9 +++++++++
 hw/vfio/listener.c            | 4 ++--
 4 files changed, 15 insertions(+), 3 deletions(-)
include/hw/vfio/vfio-device.h +3 -0
index f6f3d0e3786cf85553d75674828391e16f9fa250..35a5ec6d9224df515c354fe50fcf7c80c1241c8c 100644
@@ -272,6 +272,9 @@ bool vfio_device_get_host_iommu_quirk_bypass_ro(VFIODevice *vbasedev,
                                                 uint32_t type, void *caps,
                                                 uint32_t size);
 
+int vfio_device_get_feature(VFIODevice *vbasedev,
+                            struct vfio_device_feature *feature);
+
 int vfio_device_get_region_info(VFIODevice *vbasedev, int index,
                                 struct vfio_region_info **info);
 int vfio_device_get_region_info_type(VFIODevice *vbasedev, uint32_t type,
hw/vfio/container.c +1 -1
index af16cd14db069882cc5fcf6349b433af3867f40c..4c2816b5741fa5232f104fb16fe919f7642f2a36 100644
@@ -205,7 +205,7 @@ static int vfio_device_dma_logging_report(VFIODevice *vbasedev, hwaddr iova,
     feature->flags = VFIO_DEVICE_FEATURE_GET |
                      VFIO_DEVICE_FEATURE_DMA_LOGGING_REPORT;
 
-    return vbasedev->io_ops->device_feature(vbasedev, feature);
+    return vfio_device_get_feature(vbasedev, feature);
 }
 
 static int vfio_container_iommu_query_dirty_bitmap(
hw/vfio/device.c +9 -0
index 086f20f6762a3a86f52bbab840ef67f603850a01..973fc35b59d4bdaa34c0f2773ec78df0f151dfa2 100644
@@ -547,6 +547,15 @@ bool vfio_device_get_host_iommu_quirk_bypass_ro(VFIODevice *vbasedev,
     return false;
 }
 
+int vfio_device_get_feature(VFIODevice *vbasedev,
+                            struct vfio_device_feature *feature)
+{
+    if (!vbasedev->io_ops || !vbasedev->io_ops->device_feature) {
+        return -EINVAL;
+    }
+    return vbasedev->io_ops->device_feature(vbasedev, feature);
+}
+
 /*
  * Traditional ioctl() based io
  */
hw/vfio/listener.c +2 -2
index 8ba1cd255d146ab8055ab73c71eac640eafa1bdd..1087fdc142e05ecd7890b68a08bb562e161c501b 100644
@@ -909,7 +909,7 @@ static void vfio_devices_dma_logging_stop(VFIOContainer *bcontainer)
             continue;
         }
 
-        ret = vbasedev->io_ops->device_feature(vbasedev, feature);
+        ret = vfio_device_get_feature(vbasedev, feature);
 
         if (ret != 0) {
             warn_report("%s: Failed to stop DMA logging, err %d (%s)",
@@ -1014,7 +1014,7 @@ static bool vfio_devices_dma_logging_start(VFIOContainer *bcontainer,
             continue;
         }
 
-        ret = vbasedev->io_ops->device_feature(vbasedev, feature);
+        ret = vfio_device_get_feature(vbasedev, feature);
         if (ret) {
             error_setg_errno(errp, -ret, "%s: Failed to start DMA logging",
                              vbasedev->name);
Signature · 1 line
2.52.0
#2 lore raw

[PULL 5/7] hw/vfio/region: Create dmabuf for PCI BAR per region

In reply to Cédric Le Goater

From: Nicolin Chen <[email protected]>

Linux now provides a VFIO dmabuf exporter to expose PCI BAR memory for P2P use cases. Create a dmabuf for each mapped BAR region after the mmap is set up, and store the returned fd in the region’s RAMBlock. This allows QEMU to pass the fd to dma_map_file(), enabling iommufd to import the dmabuf and map the BAR correctly in the host IOMMU page table.

If the kernel lacks support or dmabuf setup fails, QEMU skips the setup and continues with normal mmap handling.

---
 hw/vfio/region.c     | 65 +++++++++++++++++++++++++++++++++++++++++++-
 hw/vfio/trace-events |  1 +
 2 files changed, 65 insertions(+), 1 deletion(-)
hw/vfio/region.c +64 -1
index ca75ab1be4d601f5371c929a7784c8ba264df9ae..ab39d77574ccef0ca8d393435979db97bcbd882b 100644
@@ -29,6 +29,7 @@
 #include "qemu/error-report.h"
 #include "qemu/units.h"
 #include "monitor/monitor.h"
+#include "system/ramblock.h"
 #include "vfio-helpers.h"
 
 /*
@@ -238,13 +239,71 @@ static void vfio_subregion_unmap(VFIORegion *region, int index)
     region->mmaps[index].mmap = NULL;
 }
 
+static bool vfio_region_create_dma_buf(VFIORegion *region, Error **errp)
+{
+    g_autofree struct vfio_device_feature *feature = NULL;
+    VFIODevice *vbasedev = region->vbasedev;
+    struct vfio_device_feature_dma_buf *dma_buf;
+    size_t total_size;
+    int i, ret;
+
+    total_size = sizeof(*feature) + sizeof(*dma_buf) +
+                 sizeof(struct vfio_region_dma_range) * region->nr_mmaps;
+    feature = g_malloc0(total_size);
+    *feature = (struct vfio_device_feature) {
+        .argsz = total_size,
+        .flags = VFIO_DEVICE_FEATURE_GET | VFIO_DEVICE_FEATURE_DMA_BUF,
+    };
+
+    dma_buf = (void *)feature->data;
+    *dma_buf = (struct vfio_device_feature_dma_buf) {
+        .region_index = region->nr,
+        .open_flags = O_RDWR,
+        .nr_ranges = region->nr_mmaps,
+    };
+
+    for (i = 0; i < region->nr_mmaps; i++) {
+        dma_buf->dma_ranges[i].offset = region->mmaps[i].offset;
+        dma_buf->dma_ranges[i].length = region->mmaps[i].size;
+    }
+
+    ret = vfio_device_get_feature(vbasedev, feature);
+    if (ret < 0) {
+        if (ret == -ENOTTY) {
+            warn_report_once("VFIO dma-buf not supported in kernel: "
+                             "PCI BAR IOMMU mappings may fail");
+            return true;
+        }
+        /* P2P DMA or exposing device memory use cases are not supported. */
+        error_setg_errno(errp, -ret, "%s: failed to create dma-buf: "
+                         "PCI BAR IOMMU mappings may fail",
+                         memory_region_name(region->mem));
+        return false;
+    }
+
+    /* Assign the dmabuf fd to associated RAMBlock */
+    for (i = 0; i < region->nr_mmaps; i++) {
+        MemoryRegion *mr = &region->mmaps[i].mem;
+        RAMBlock *ram_block = mr->ram_block;
+
+        ram_block->fd = ret;
+        ram_block->fd_offset = region->mmaps[i].offset;
+        trace_vfio_region_dmabuf(region->vbasedev->name, ret, region->nr,
+                                 memory_region_name(region->mem),
+                                 region->mmaps[i].offset,
+                                 region->mmaps[i].size);
+    }
+    return true;
+}
+
 int vfio_region_mmap(VFIORegion *region)
 {
     int i, ret, prot = 0;
+    Error *local_err = NULL;
     char *name;
     int fd;
 
-    if (!region->mem) {
+    if (!region->mem || !region->nr_mmaps) {
         return 0;
     }
 
@@ -305,6 +364,10 @@ int vfio_region_mmap(VFIORegion *region)
                                region->mmaps[i].size - 1);
     }
 
+    if (!vfio_region_create_dma_buf(region, &local_err)) {
+        error_report_err(local_err);
+    }
+
     return 0;
 
 no_mmap:
hw/vfio/trace-events +1 -0
index 180e3d526b80bd43d18bbfb9332833df4fbeb720..466695507b77c974ba0e4e61109c0abe2d06c71c 100644
@@ -118,6 +118,7 @@ vfio_device_put(int fd) "close vdev->fd=%d"
 vfio_region_write(const char *name, int index, uint64_t addr, uint64_t data, unsigned size) " (%s:region%d+0x%"PRIx64", 0x%"PRIx64 ", %d)"
 vfio_region_read(char *name, int index, uint64_t addr, unsigned size, uint64_t data) " (%s:region%d+0x%"PRIx64", %d) = 0x%"PRIx64
 vfio_region_setup(const char *dev, int index, const char *name, unsigned long flags, unsigned long offset, unsigned long size) "Device %s, region %d \"%s\", flags: 0x%lx, offset: 0x%lx, size: 0x%lx"
+vfio_region_dmabuf(const char *dev, int fd, int index,  const char *name, unsigned long offset, unsigned long size) "Device %s, dmabuf fd %d region %d \"%s\", offset: 0x%lx, size: 0x%lx"
 vfio_region_mmap_fault(const char *name, int index, unsigned long offset, unsigned long size, int fault) "Region %s mmaps[%d], [0x%lx - 0x%lx], fault: %d"
 vfio_region_mmap(const char *name, unsigned long offset, unsigned long end) "Region %s [0x%lx - 0x%lx]"
 vfio_region_exit(const char *name, int index) "Device %s, region %d"
Signature · 1 line
2.52.0
#3 lore raw

[PULL 3/7] linux-headers: Update to Linux v6.19-rc1

In reply to Cédric Le Goater

From: Shameer Kolothum <[email protected]>

Mainly for adding support for VFIO DMABUF. While at it, update all headers.

The header update breaks virtio-net due to virtio_net_hdr_v1_hash changes. Include the virtio-net changes to avoid build and bisect failures.

---
 include/standard-headers/drm/drm_fourcc.h     |  25 ++--
 include/standard-headers/linux/ethtool.h      |   5 +
 .../linux/input-event-codes.h                 |  14 ++-
 include/standard-headers/linux/pci_regs.h     |  89 ++++++++++++++
 include/standard-headers/linux/virtio_net.h   |   3 +-
 include/standard-headers/linux/virtio_pci.h   |   2 +-
 linux-headers/asm-arm64/kvm.h                 |   2 +-
 linux-headers/asm-arm64/unistd_64.h           |   1 +
 linux-headers/asm-generic/unistd.h            |   4 +-
 linux-headers/asm-loongarch/kvm.h             |   1 +
 linux-headers/asm-loongarch/unistd.h          |   6 +
 linux-headers/asm-loongarch/unistd_64.h       |   1 +
 linux-headers/asm-mips/unistd_n32.h           |   1 +
 linux-headers/asm-mips/unistd_n64.h           |   1 +
 linux-headers/asm-mips/unistd_o32.h           |   1 +
 linux-headers/asm-powerpc/unistd_32.h         |   1 +
 linux-headers/asm-powerpc/unistd_64.h         |   1 +
 linux-headers/asm-riscv/kvm.h                 |   3 +
 linux-headers/asm-riscv/unistd_32.h           |   1 +
 linux-headers/asm-riscv/unistd_64.h           |   1 +
 linux-headers/asm-s390/bitsperlong.h          |   4 -
 linux-headers/asm-s390/unistd.h               |   4 -
 linux-headers/asm-s390/unistd_64.h            |   9 +-
 linux-headers/asm-x86/kvm.h                   |   1 +
 linux-headers/asm-x86/unistd_32.h             |   1 +
 linux-headers/asm-x86/unistd_64.h             |   1 +
 linux-headers/asm-x86/unistd_x32.h            |   1 +
 linux-headers/linux/iommufd.h                 |  10 ++
 linux-headers/linux/kvm.h                     |  11 ++
 linux-headers/linux/mshv.h                    | 116 +++++++++++++++++-
 linux-headers/linux/psp-sev.h                 |  66 ++++++----
 linux-headers/linux/vfio.h                    |  28 +++++
 hw/net/virtio-net.c                           |  11 +-
 33 files changed, 370 insertions(+), 56 deletions(-)
include/standard-headers/drm/drm_fourcc.h +16 -9
index cef077dfb35a6d1e8221b44ac1c23ee51b257c73..b39e197cc79f687966e40b78a955d3d0834efcc4 100644
@@ -978,14 +978,20 @@ extern "C" {
  *               2 = Gob Height 8, Turing+ Page Kind mapping
  *               3 = Reserved for future use.
  *
- * 22:22 s     Sector layout.  On Tegra GPUs prior to Xavier, there is a further
- *             bit remapping step that occurs at an even lower level than the
- *             page kind and block linear swizzles.  This causes the layout of
- *             surfaces mapped in those SOC's GPUs to be incompatible with the
- *             equivalent mapping on other GPUs in the same system.
- *
- *               0 = Tegra K1 - Tegra Parker/TX2 Layout.
- *               1 = Desktop GPU and Tegra Xavier+ Layout
+ * 22:22 s     Sector layout.  There is a further bit remapping step that occurs
+ * 26:27       at an even lower level than the page kind and block linear
+ *             swizzles.  This causes the bit arrangement of surfaces in memory
+ *             to differ subtly, and prevents direct sharing of surfaces between
+ *             GPUs with different layouts.
+ *
+ *               0 = Tegra K1 - Tegra Parker/TX2 Layout
+ *               1 = Pre-GB20x, GB20x 32+ bpp, GB10, Tegra Xavier-Orin Layout
+ *               2 = GB20x(Blackwell 2)+ 8 bpp surface layout
+ *               3 = GB20x(Blackwell 2)+ 16 bpp surface layout
+ *               4 = Reserved for future use.
+ *               5 = Reserved for future use.
+ *               6 = Reserved for future use.
+ *               7 = Reserved for future use.
  *
  * 25:23 c     Lossless Framebuffer Compression type.
  *
@@ -1000,7 +1006,7 @@ extern "C" {
  *               6 = Reserved for future use
  *               7 = Reserved for future use
  *
- * 55:25 -     Reserved for future use.  Must be zero.
+ * 55:28 -     Reserved for future use.  Must be zero.
  */
 #define DRM_FORMAT_MOD_NVIDIA_BLOCK_LINEAR_2D(c, s, g, k, h) \
 	fourcc_mod_code(NVIDIA, (0x10 | \
@@ -1008,6 +1014,7 @@ extern "C" {
 				 (((k) & 0xff) << 12) | \
 				 (((g) & 0x3) << 20) | \
 				 (((s) & 0x1) << 22) | \
+				 (((s) & 0x6) << 25) | \
 				 (((c) & 0x7) << 23)))
 
 /* To grandfather in prior block linear format modifiers to the above layout,
include/standard-headers/linux/ethtool.h +5 -0
index dc24512d287538cb590435152cc8aba5979ad5c7..d0f7a63f1099c2e53d92a3ed608f495f3b64b5ff 100644
@@ -2077,6 +2077,10 @@ enum ethtool_link_mode_bit_indices {
 	ETHTOOL_LINK_MODE_800000baseDR4_2_Full_BIT	 = 118,
 	ETHTOOL_LINK_MODE_800000baseSR4_Full_BIT	 = 119,
 	ETHTOOL_LINK_MODE_800000baseVR4_Full_BIT	 = 120,
+	ETHTOOL_LINK_MODE_1600000baseCR8_Full_BIT	 = 121,
+	ETHTOOL_LINK_MODE_1600000baseKR8_Full_BIT	 = 122,
+	ETHTOOL_LINK_MODE_1600000baseDR8_Full_BIT	 = 123,
+	ETHTOOL_LINK_MODE_1600000baseDR8_2_Full_BIT	 = 124,
 
 	/* must be last entry */
 	__ETHTOOL_LINK_MODE_MASK_NBITS
@@ -2190,6 +2194,7 @@ enum ethtool_link_mode_bit_indices {
 #define SPEED_200000		200000
 #define SPEED_400000		400000
 #define SPEED_800000		800000
+#define SPEED_1600000		1600000
 
 #define SPEED_UNKNOWN		-1
 
include/standard-headers/linux/input-event-codes.h +13 -1
index c914ccd7237ab00aa19f92d42a36d01c3f12e3ce..ede79c6ae4f538bf18e80eedd7bab56dc1959115 100644
@@ -27,7 +27,7 @@
 #define INPUT_PROP_TOPBUTTONPAD		0x04	/* softbuttons at top of pad */
 #define INPUT_PROP_POINTING_STICK	0x05	/* is a pointing stick */
 #define INPUT_PROP_ACCELEROMETER	0x06	/* has accelerometer */
-#define INPUT_PROP_HAPTIC_TOUCHPAD	0x07	/* is a haptic touchpad */
+#define INPUT_PROP_PRESSUREPAD		0x07	/* pressure triggers clicks */
 
 #define INPUT_PROP_MAX			0x1f
 #define INPUT_PROP_CNT			(INPUT_PROP_MAX + 1)
@@ -631,6 +631,18 @@
 #define KEY_BRIGHTNESS_MIN		0x250	/* Set Brightness to Minimum */
 #define KEY_BRIGHTNESS_MAX		0x251	/* Set Brightness to Maximum */
 
+/*
+ * Keycodes for hotkeys toggling the electronic privacy screen found on some
+ * laptops on/off. Note when the embedded-controller turns on/off the eprivacy
+ * screen itself then the state should be reported through drm connecter props:
+ * https://www.kernel.org/doc/html/latest/gpu/drm-kms.html#standard-connector-properties
+ * Except when implementing the drm connecter properties API is not possible
+ * because e.g. the firmware does not allow querying the presence and/or status
+ * of the eprivacy screen at boot.
+ */
+#define KEY_EPRIVACY_SCREEN_ON		0x252
+#define KEY_EPRIVACY_SCREEN_OFF		0x253
+
 #define KEY_KBDINPUTASSIST_PREV		0x260
 #define KEY_KBDINPUTASSIST_NEXT		0x261
 #define KEY_KBDINPUTASSIST_PREVGROUP		0x262
include/standard-headers/linux/pci_regs.h +89 -0

110 lines not on this page · raw message

include/standard-headers/linux/virtio_net.h +2 -1
index 93abaae0b9079bc10a441caa41d7ce1815cdee06..17a0174d6ca7b727068b1002365435dd8c29a3ee 100644
@@ -193,7 +193,8 @@ struct virtio_net_hdr_v1 {
 
 struct virtio_net_hdr_v1_hash {
 	struct virtio_net_hdr_v1 hdr;
-	uint32_t hash_value;
+	uint16_t hash_value_lo;
+	uint16_t hash_value_hi;
 #define VIRTIO_NET_HASH_REPORT_NONE            0
 #define VIRTIO_NET_HASH_REPORT_IPv4            1
 #define VIRTIO_NET_HASH_REPORT_TCPv4           2
include/standard-headers/linux/virtio_pci.h +1 -1
index 09e964e6eeea4f41d7d8b884bdfd3e5142da3cbb..4c82513df2800c2154f9939e490abee7982a954a 100644
@@ -40,7 +40,7 @@
 #define _LINUX_VIRTIO_PCI_H
 
 #include "standard-headers/linux/types.h"
-#include "standard-headers/linux/kernel.h"
+#include "standard-headers/linux/const.h"
 
 #ifndef VIRTIO_PCI_NO_LEGACY
 
linux-headers/asm-arm64/kvm.h +1 -1
index f4d9baafa1c5fa7d19abb4b7bdc37f47a9414e6c..46ffbddab54bc4248c9a22db3a06395ff93338db 100644
@@ -31,7 +31,7 @@
 #define KVM_SPSR_FIQ	4
 #define KVM_NR_SPSR	5
 
-#ifndef __ASSEMBLY__
+#ifndef __ASSEMBLER__
 #include <linux/psci.h>
 #include <linux/types.h>
 #include <asm/ptrace.h>
linux-headers/asm-arm64/unistd_64.h +1 -0
index 4ae25c2b91685f9a3653e04d9027312bfe9aecab..1ef9c408135b2be7e6943e1a8927e9a11c2b38a1 100644
@@ -326,6 +326,7 @@
 #define __NR_open_tree_attr 467
 #define __NR_file_getattr 468
 #define __NR_file_setattr 469
+#define __NR_listns 470
 
 
 #endif /* _ASM_UNISTD_64_H */
linux-headers/asm-generic/unistd.h +3 -1
index 04e0077fb4c97a4d565da86d3d0d1d243f32336e..942370b3f5d252305832d105615f1628fa0ad304 100644
@@ -857,9 +857,11 @@ __SYSCALL(__NR_open_tree_attr, sys_open_tree_attr)
 __SYSCALL(__NR_file_getattr, sys_file_getattr)
 #define __NR_file_setattr 469
 __SYSCALL(__NR_file_setattr, sys_file_setattr)
+#define __NR_listns 470
+__SYSCALL(__NR_listns, sys_listns)
 
 #undef __NR_syscalls
-#define __NR_syscalls 470
+#define __NR_syscalls 471
 
 /*
  * 32 bit systems traditionally used different
linux-headers/asm-loongarch/kvm.h +1 -0
index 57ba1a563bb1a2563f77f1317b1d60b60866e52a..de6c3f18e40ab13f9f56daeeed9b6d3c7a9fe17b 100644
@@ -104,6 +104,7 @@ struct kvm_fpu {
 #define  KVM_LOONGARCH_VM_FEAT_PV_IPI		6
 #define  KVM_LOONGARCH_VM_FEAT_PV_STEALTIME	7
 #define  KVM_LOONGARCH_VM_FEAT_PTW		8
+#define  KVM_LOONGARCH_VM_FEAT_MSGINT		9
 
 /* Device Control API on vcpu fd */
 #define KVM_LOONGARCH_VCPU_CPUCFG	0
linux-headers/asm-loongarch/unistd.h +6 -0
index 1f01980f9c94826957c9729c09c550cd090e4850..e19c7f2f9f87a49a49a6425506508f5c0efc3315 100644
@@ -1,3 +1,9 @@
 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
 
+#include <asm/bitsperlong.h>
+
+#if __BITS_PER_LONG == 32
+#include <asm/unistd_32.h>
+#else
 #include <asm/unistd_64.h>
+#endif
linux-headers/asm-loongarch/unistd_64.h +1 -0
index 5033fc8f2fe9ef0193aa85370848e80fc23562e9..aa5daac4ef9020807a1bc7bb60e3005857ac8206 100644
@@ -322,6 +322,7 @@
 #define __NR_open_tree_attr 467
 #define __NR_file_getattr 468
 #define __NR_file_setattr 469
+#define __NR_listns 470
 
 
 #endif /* _ASM_UNISTD_64_H */
linux-headers/asm-mips/unistd_n32.h +1 -0
index c99c10e5bf45da1eea82202e0c0362ac70b4aa8d..a33d106dca769262119aba6924394cbc90430042 100644
@@ -398,5 +398,6 @@
 #define __NR_open_tree_attr (__NR_Linux + 467)
 #define __NR_file_getattr (__NR_Linux + 468)
 #define __NR_file_setattr (__NR_Linux + 469)
+#define __NR_listns (__NR_Linux + 470)
 
 #endif /* _ASM_UNISTD_N32_H */
linux-headers/asm-mips/unistd_n64.h +1 -0
index 0d975bb1856054334b649f4aab472e549d02326b..1bc251e4507c3a86b31fe80a7d2788853a1abc73 100644
@@ -374,5 +374,6 @@
 #define __NR_open_tree_attr (__NR_Linux + 467)
 #define __NR_file_getattr (__NR_Linux + 468)
 #define __NR_file_setattr (__NR_Linux + 469)
+#define __NR_listns (__NR_Linux + 470)
 
 #endif /* _ASM_UNISTD_N64_H */
linux-headers/asm-mips/unistd_o32.h +1 -0
index 86ac0ac84b39d79e63177b86390bd2f41c2dfca2..c57175d496c080cebb8414c91b5a93c96e7725c3 100644
@@ -444,5 +444,6 @@
 #define __NR_open_tree_attr (__NR_Linux + 467)
 #define __NR_file_getattr (__NR_Linux + 468)
 #define __NR_file_setattr (__NR_Linux + 469)
+#define __NR_listns (__NR_Linux + 470)
 
 #endif /* _ASM_UNISTD_O32_H */
linux-headers/asm-powerpc/unistd_32.h +1 -0
index d7a32c5e069039634bac2f83f6ca53a130aa7a56..a3f4aa2fe20f2ff30cc825174c0d0c3df50c1425 100644
@@ -451,6 +451,7 @@
 #define __NR_open_tree_attr 467
 #define __NR_file_getattr 468
 #define __NR_file_setattr 469
+#define __NR_listns 470
 
 
 #endif /* _ASM_UNISTD_32_H */
linux-headers/asm-powerpc/unistd_64.h +1 -0
index ff35c51fc65660a037b72e0fb4970d45bc45a028..d4444557f1ce4bf0d0ed2fdfdd60432cff9c677e 100644
@@ -423,6 +423,7 @@
 #define __NR_open_tree_attr 467
 #define __NR_file_getattr 468
 #define __NR_file_setattr 469
+#define __NR_listns 470
 
 
 #endif /* _ASM_UNISTD_64_H */
linux-headers/asm-riscv/kvm.h +3 -0
index 759a4852c09a564a150d58f0a6b9095bfa5001ce..54f3ad7ed2e4bf2580c1659758bd9f89f7a451c8 100644
@@ -23,6 +23,8 @@
 #define KVM_INTERRUPT_SET	-1U
 #define KVM_INTERRUPT_UNSET	-2U
 
+#define KVM_EXIT_FAIL_ENTRY_NO_VSFILE	(1ULL << 0)
+
 /* for KVM_GET_REGS and KVM_SET_REGS */
 struct kvm_regs {
 };
@@ -211,6 +213,7 @@ enum KVM_RISCV_SBI_EXT_ID {
 	KVM_RISCV_SBI_EXT_STA,
 	KVM_RISCV_SBI_EXT_SUSP,
 	KVM_RISCV_SBI_EXT_FWFT,
+	KVM_RISCV_SBI_EXT_MPXY,
 	KVM_RISCV_SBI_EXT_MAX,
 };
 
linux-headers/asm-riscv/unistd_32.h +1 -0
index 6083373e884ca3010397917fc7e3cace41db82f2..9f33956246392da58bdfc1e4ceafd97cdfee221b 100644
@@ -317,6 +317,7 @@
 #define __NR_open_tree_attr 467
 #define __NR_file_getattr 468
 #define __NR_file_setattr 469
+#define __NR_listns 470
 
 
 #endif /* _ASM_UNISTD_32_H */
linux-headers/asm-riscv/unistd_64.h +1 -0
index f0c7585c60edf18a788fb877dde33d1064fbd28a..c2e7258916470221e354f83d6e3c8237b7bfb36c 100644
@@ -327,6 +327,7 @@
 #define __NR_open_tree_attr 467
 #define __NR_file_getattr 468
 #define __NR_file_setattr 469
+#define __NR_listns 470
 
 
 #endif /* _ASM_UNISTD_64_H */
linux-headers/asm-s390/bitsperlong.h +0 -4
index cceaf47b021ad59687e7e71a37f5a79747581707..7af27a985f25d80956ca9c92929feedfb0c654d8 100644
@@ -2,11 +2,7 @@
 #ifndef __ASM_S390_BITSPERLONG_H
 #define __ASM_S390_BITSPERLONG_H
 
-#ifndef __s390x__
-#define __BITS_PER_LONG 32
-#else
 #define __BITS_PER_LONG 64
-#endif
 
 #include <asm-generic/bitsperlong.h>
 
linux-headers/asm-s390/unistd.h +0 -4
index 27b8b211c8eaf15db869a81d235e31eb9272a504..14846188770b7328dc3bf1c86c3e3151bb1fcdb7 100644
@@ -8,10 +8,6 @@
 #ifndef _ASM_S390_UNISTD_H_
 #define _ASM_S390_UNISTD_H_
 
-#ifdef __s390x__
 #include <asm/unistd_64.h>
-#else
-#include <asm/unistd_32.h>
-#endif
 
 #endif /* _ASM_S390_UNISTD_H_ */
linux-headers/asm-s390/unistd_64.h +5 -4
index 0652ba63318b0eb908d68633d73021f31b35b1ac..8d9e579ef50d46cb27ff1f0694f74083e285c17c 100644
@@ -1,6 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-#ifndef _ASM_S390_UNISTD_64_H
-#define _ASM_S390_UNISTD_64_H
+#ifndef _ASM_UNISTD_64_H
+#define _ASM_UNISTD_64_H
 
 #define __NR_exit 1
 #define __NR_fork 2
@@ -390,5 +389,7 @@
 #define __NR_open_tree_attr 467
 #define __NR_file_getattr 468
 #define __NR_file_setattr 469
+#define __NR_listns 470
 
-#endif /* _ASM_S390_UNISTD_64_H */
+
+#endif /* _ASM_UNISTD_64_H */
linux-headers/asm-x86/kvm.h +1 -0
index 3bb38f6c3a4129c8b18f6c77e0093a50d215b706..b804fd25a2b861327c2be7a30f14b2dbb2df1944 100644
@@ -500,6 +500,7 @@ struct kvm_sync_regs {
 /* vendor-specific groups and attributes for system fd */
 #define KVM_X86_GRP_SEV			1
 #  define KVM_X86_SEV_VMSA_FEATURES	0
+#  define KVM_X86_SNP_POLICY_BITS	1
 
 struct kvm_vmx_nested_state_data {
 	__u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
linux-headers/asm-x86/unistd_32.h +1 -0
index 8f784a56347d86bf0fb751d87aea640997ef2ef9..34255aac64f020864107bdd72b017d51ce321a02 100644
@@ -460,6 +460,7 @@
 #define __NR_open_tree_attr 467
 #define __NR_file_getattr 468
 #define __NR_file_setattr 469
+#define __NR_listns 470
 
 
 #endif /* _ASM_UNISTD_32_H */
linux-headers/asm-x86/unistd_64.h +1 -0
index 26c258d1a609f03029e955de64a1e8a6e065164e..07f242a5fa435cc1fead96e84328b0512a1c0645 100644
@@ -384,6 +384,7 @@
 #define __NR_open_tree_attr 467
 #define __NR_file_getattr 468
 #define __NR_file_setattr 469
+#define __NR_listns 470
 
 
 #endif /* _ASM_UNISTD_64_H */
linux-headers/asm-x86/unistd_x32.h +1 -0
index 65c2aed94623f987c0efa57eb9831be6117760da..08fc9da2fab506d13713f0b56998004b269ba831 100644
@@ -337,6 +337,7 @@
 #define __NR_open_tree_attr (__X32_SYSCALL_BIT + 467)
 #define __NR_file_getattr (__X32_SYSCALL_BIT + 468)
 #define __NR_file_setattr (__X32_SYSCALL_BIT + 469)
+#define __NR_listns (__X32_SYSCALL_BIT + 470)
 #define __NR_rt_sigaction (__X32_SYSCALL_BIT + 512)
 #define __NR_rt_sigreturn (__X32_SYSCALL_BIT + 513)
 #define __NR_ioctl (__X32_SYSCALL_BIT + 514)
linux-headers/linux/iommufd.h +10 -0
index 2105a039551e982dea31e243a7c6c53fae98635e..384183a40393cb5a5cde875fdfc60496eec5699e 100644
@@ -450,6 +450,16 @@ struct iommu_hwpt_vtd_s1 {
  * nested domain will translate the same as the nesting parent. The S1 will
  * install a Context Descriptor Table pointing at userspace memory translated
  * by the nesting parent.
+ *
+ * It's suggested to allocate a vDEVICE object carrying vSID and then re-attach
+ * the nested domain, as soon as the vSID is available in the VMM level:
+ *
+ * - when Cfg=translate, a vDEVICE must be allocated prior to attaching to the
+ *   allocated nested domain, as CD/ATS invalidations and vevents need a vSID.
+ * - when Cfg=bypass/abort, a vDEVICE is not enforced during the nested domain
+ *   attachment, to support a GBPA case where VM sets CR0.SMMUEN=0. However, if
+ *   VM sets CR0.SMMUEN=1 while missing a vDEVICE object, kernel would fail to
+ *   report events to the VM. E.g. F_TRANSLATION when guest STE.Cfg=abort.
  */
 struct iommu_hwpt_arm_smmuv3 {
 	__aligned_le64 ste[2];
linux-headers/linux/kvm.h +11 -0
index 4ea28ef7cac1942f3e4d88119dea1ac5f6ef88f9..a4ab42dcba977797f20fad2375ab7e428f873f5e 100644
@@ -179,6 +179,7 @@ struct kvm_xen_exit {
 #define KVM_EXIT_LOONGARCH_IOCSR  38
 #define KVM_EXIT_MEMORY_FAULT     39
 #define KVM_EXIT_TDX              40
+#define KVM_EXIT_ARM_SEA          41
 
 /* For KVM_EXIT_INTERNAL_ERROR */
 /* Emulate instruction failed. */
@@ -465,6 +466,14 @@ struct kvm_run {
 				} setup_event_notify;
 			};
 		} tdx;
+		/* KVM_EXIT_ARM_SEA */
+		struct {
+#define KVM_EXIT_ARM_SEA_FLAG_GPA_VALID	(1ULL << 0)
+			__u64 flags;
+			__u64 esr;
+			__u64 gva;
+			__u64 gpa;
+		} arm_sea;
 		/* Fix the size of the union. */
 		char padding[256];
 	};
@@ -955,6 +964,8 @@ struct kvm_enable_cap {
 #define KVM_CAP_RISCV_MP_STATE_RESET 242
 #define KVM_CAP_ARM_CACHEABLE_PFNMAP_SUPPORTED 243
 #define KVM_CAP_GUEST_MEMFD_FLAGS 244
+#define KVM_CAP_ARM_SEA_TO_USER 245
+#define KVM_CAP_S390_USER_OPEREXEC 246
 
 struct kvm_irq_routing_irqchip {
 	__u32 irqchip;
linux-headers/linux/mshv.h +115 -1

144 lines not on this page · raw message

linux-headers/linux/psp-sev.h +41 -25

79 lines not on this page · raw message

linux-headers/linux/vfio.h +28 -0
index 4d96d1fc12faf3d4fc1de687781e4dfa5fe4069d..720edfee7af6adcba70361b94278024b860a1547 100644
@@ -14,6 +14,7 @@
 
 #include <linux/types.h>
 #include <linux/ioctl.h>
+#include <linux/stddef.h>
 
 #define VFIO_API_VERSION	0
 
@@ -1478,6 +1479,33 @@ struct vfio_device_feature_bus_master {
 };
 #define VFIO_DEVICE_FEATURE_BUS_MASTER 10
 
+/**
+ * Upon VFIO_DEVICE_FEATURE_GET create a dma_buf fd for the
+ * regions selected.
+ *
+ * open_flags are the typical flags passed to open(2), eg O_RDWR, O_CLOEXEC,
+ * etc. offset/length specify a slice of the region to create the dmabuf from.
+ * nr_ranges is the total number of (P2P DMA) ranges that comprise the dmabuf.
+ *
+ * flags should be 0.
+ *
+ * Return: The fd number on success, -1 and errno is set on failure.
+ */
+#define VFIO_DEVICE_FEATURE_DMA_BUF 11
+
+struct vfio_region_dma_range {
+	__u64 offset;
+	__u64 length;
+};
+
+struct vfio_device_feature_dma_buf {
+	__u32	region_index;
+	__u32	open_flags;
+	__u32   flags;
+	__u32   nr_ranges;
+	struct vfio_region_dma_range dma_ranges[] __counted_by(nr_ranges);
+};
+
 /* -------- API for Type1 VFIO IOMMU -------- */
 
 /**
hw/net/virtio-net.c +7 -4
index 317f1ad23b14d200ce4fefe91c1726c469a44b0e..512a7c02c936a46cd333aa1293a6440dd08d9664 100644
@@ -1879,7 +1879,8 @@ static int virtio_net_process_rss(NetClientState *nc, const uint8_t *buf,
                                              n->rss_data.runtime_hash_types);
     if (net_hash_type > NetPktRssIpV6UdpEx) {
         if (n->rss_data.populate_hash) {
-            hdr->hash_value = VIRTIO_NET_HASH_REPORT_NONE;
+            hdr->hash_value_lo = VIRTIO_NET_HASH_REPORT_NONE;
+            hdr->hash_value_hi = VIRTIO_NET_HASH_REPORT_NONE;
             hdr->hash_report = 0;
         }
         return n->rss_data.redirect ? n->rss_data.default_queue : -1;
@@ -1888,7 +1889,8 @@ static int virtio_net_process_rss(NetClientState *nc, const uint8_t *buf,
     hash = net_rx_pkt_calc_rss_hash(pkt, net_hash_type, n->rss_data.key);
 
     if (n->rss_data.populate_hash) {
-        hdr->hash_value = hash;
+        hdr->hash_value_lo = cpu_to_le16(hash & 0xffff);
+        hdr->hash_value_hi = cpu_to_le16((hash >> 16) & 0xffff);
         hdr->hash_report = reports[net_hash_type];
     }
 
@@ -1990,10 +1992,11 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
 
             receive_header(n, sg, elem->in_num, buf, size);
             if (n->rss_data.populate_hash) {
-                offset = offsetof(typeof(extra_hdr), hash_value);
+                offset = offsetof(typeof(extra_hdr), hash_value_lo);
                 iov_from_buf(sg, elem->in_num, offset,
                              (char *)&extra_hdr + offset,
-                             sizeof(extra_hdr.hash_value) +
+                             sizeof(extra_hdr.hash_value_lo) +
+                             sizeof(extra_hdr.hash_value_hi) +
                              sizeof(extra_hdr.hash_report));
             }
             offset = n->host_hdr_len;
Signature · 1 line
2.52.0
#4 lore raw

[PULL 1/7] vfio/migration: Fix page size calculation

In reply to Cédric Le Goater

From: Zhenzhong Duan <[email protected]>

Coverity detected an issue of left shifting int by more than 31 bits leading to undefined behavior.

In practice bcontainer->dirty_pgsizes always have some common page sizes when dirty tracking is supported.

Resolves: Coverity CID 1644186
Resolves: Coverity CID 1644187
Resolves: Coverity CID 1644188

Fixes 46c763311419 ("vfio/migration: Add migration blocker if VM memory is too large to cause unmap_bitmap failure").
---
 hw/vfio/migration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio/migration.c +1 -1
index f857dc25ed4d0f824bdabc168228a5e925ac7dbe..b4695030c7295f318faf1d12ac48ba951aa943c7 100644
@@ -1173,7 +1173,7 @@ static bool vfio_dirty_tracking_exceed_limit(VFIODevice *vbasedev)
      * can also switch to use IOMMUFD backend if there is a need to migrate
      * large VM.
      */
-    page_size = 1 << ctz64(bcontainer->dirty_pgsizes);
+    page_size = 1ULL << ctz64(bcontainer->dirty_pgsizes);
     max_size = bcontainer->max_dirty_bitmap_size * BITS_PER_BYTE * page_size;
 
     return current_machine->ram_size > max_size;
Signature · 1 line
2.52.0
#5 lore raw

[PULL 2/7] hw/vfio: cpr-iommufd: Fix wrong usage of migrate_add_blocker_modes

In reply to Cédric Le Goater

From: Jim Shu <[email protected]>

The return value of API is 0 for success and negative error code for failure. We'll check if the return value equals to 0. Also, the MIG_MODE should be CPR_TRANSFER and CPR_EXEC instead of 2 same bits.

The API usage is aligned with 'hw/vfio/cpr-legacy.c' after these 2 changes.

Fixes 3ca0a0ab05c ("migration: Use bitset of MigMode instead of variable arguments")
---
 hw/vfio/cpr-iommufd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/vfio/cpr-iommufd.c +2 -2
index c244db88fbbb4ae5c5c876a610f9187edda904c9..6758c73b6b96a32170ced8b18aebf8212d9542cd 100644
@@ -159,8 +159,8 @@ bool vfio_iommufd_cpr_register_iommufd(IOMMUFDBackend *be, Error **errp)
 
     if (!vfio_cpr_supported(be, cpr_blocker)) {
         return migrate_add_blocker_modes(cpr_blocker,
-                    BIT(MIG_MODE_CPR_TRANSFER) | BIT(MIG_MODE_CPR_TRANSFER),
-                    errp);
+                    BIT(MIG_MODE_CPR_TRANSFER) | BIT(MIG_MODE_CPR_EXEC),
+                    errp) == 0;
     }
 
     vmstate_register(NULL, -1, &iommufd_cpr_vmstate, be);
Signature · 1 line
2.52.0
#6 lore raw

[PULL 7/7] vfio-user: update VFIOProxy flag constants to use the BIT() macro

In reply to Cédric Le Goater

From: Mark Cave-Ayland <[email protected]>

This should help avoid incorrect constant values being used in future. At the same time we can remove the gap left for BIT(1) which was originally intended for the VFIO_PROXY_NO_MMAP feature which was removed from later versions of the vfio-user series.

---
 hw/vfio-user/proxy.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/vfio-user/proxy.h +4 -4
index b09fd886f17f24abcf8d99e5520a39501c0486f1..7b97460cc504a408e8e4299fa84fd56a2d674aa0 100644
@@ -91,10 +91,10 @@ typedef struct VFIOUserProxy {
 } VFIOUserProxy;
 
 /* VFIOProxy flags */
-#define VFIO_PROXY_CLIENT        0x1
-#define VFIO_PROXY_FORCE_QUEUED  0x4
-#define VFIO_PROXY_NO_POST       0x8
-#define VFIO_PROXY_USE_MULTI     0x10
+#define VFIO_PROXY_CLIENT        BIT(0)
+#define VFIO_PROXY_FORCE_QUEUED  BIT(1)
+#define VFIO_PROXY_NO_POST       BIT(2)
+#define VFIO_PROXY_USE_MULTI     BIT(3)
 
 /* coalescing high and low water marks for VFIOProxy num_outgoing */
 #define VFIO_USER_OUT_HIGH       1024
Signature · 1 line
2.52.0
#7 lore raw

[PULL 6/7] vfio-user: fix VFIO_PROXY_USE_MULTI constant value

In reply to Cédric Le Goater

From: Mark Cave-Ayland <[email protected]>

The constant value should represent the next bit in the VFIOProxy flags which is 0x10 and not 0x16.

---
 hw/vfio-user/proxy.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio-user/proxy.h +1 -1
index 61e64a0020fcd3a12e6cf846682bb0c8e4352c07..b09fd886f17f24abcf8d99e5520a39501c0486f1 100644
@@ -94,7 +94,7 @@ typedef struct VFIOUserProxy {
 #define VFIO_PROXY_CLIENT        0x1
 #define VFIO_PROXY_FORCE_QUEUED  0x4
 #define VFIO_PROXY_NO_POST       0x8
-#define VFIO_PROXY_USE_MULTI     0x16
+#define VFIO_PROXY_USE_MULTI     0x10
 
 /* coalescing high and low water marks for VFIOProxy num_outgoing */
 #define VFIO_USER_OUT_HIGH       1024
Signature · 1 line
2.52.0
#8 lore raw
In reply to Cédric Le Goater
Quoted 12 lines · Cédric Le Goater

The following changes since commit fea2d7a784fc3627a8aa72875f51fe7634b04b81:

   Merge tag 'linux-user-for-v11-pull-request' ofhttps://github.com/hdeller/qemu-hppa into staging (2026-01-24 21:31:17 +1100)

are available in the Git repository at:

   https://github.com/legoater/qemu/ tags/pull-vfio-20260126

for you to fetch changes up to 4c5e5d66f991599bd34a65fc243d3c513e6b1e81:

vfio-user: update VFIOProxy flag constants to use the BIT() macro (2026-01-26 08:30:04 +0100)

Quoted 8 lines

----------------------------------------------------------------
vfio queue:

* Fixes for vfio-user and CPR
* Fixes issues detected by Coverity
* Updates linux-headers to Linux v6.19-rc1
* Adds support for the creation of dma-buf objects for PCI BARs. This allows safe P2P DMA operations when using iommufd host backend.

Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/11.0 as appropriate.

r~