vfio queue
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(-)
[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
@@ -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
@@ -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
@@ -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
@@ -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
[PULL 5/7] hw/vfio/region: Create dmabuf for PCI BAR per region
In reply to Cédric Le GoaterFrom: 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
@@ -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 = ®ion->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
@@ -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
[PULL 3/7] linux-headers: Update to Linux v6.19-rc1
In reply to Cédric Le GoaterFrom: 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 1struct kvm_vmx_nested_state_data {__u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE ];
linux-headers/asm-x86/unistd_32.h +1 -0
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 246struct 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
@@ -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
@@ -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
[PULL 1/7] vfio/migration: Fix page size calculation
In reply to Cédric Le GoaterFrom: 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
--- hw/vfio/migration.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio/migration.c +1 -1
@@ -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
[PULL 2/7] hw/vfio: cpr-iommufd: Fix wrong usage of migrate_add_blocker_modes
In reply to Cédric Le GoaterFrom: 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.
--- hw/vfio/cpr-iommufd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/vfio/cpr-iommufd.c +2 -2
@@ -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
[PULL 7/7] vfio-user: update VFIOProxy flag constants to use the BIT() macro
In reply to Cédric Le GoaterFrom: 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
@@ -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
[PULL 6/7] vfio-user: fix VFIO_PROXY_USE_MULTI constant value
In reply to Cédric Le GoaterFrom: 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
@@ -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
Richard Henderson
AppliedQuoted 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-20260126for 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~