[PULL 18/21] vfio/common: Introduce a per container device list

2023-10-06 Thread Cédric Le Goater
From: Zhenzhong Duan Several functions need to iterate over the VFIO devices attached to a given container. This is currently achieved by iterating over the groups attached to the container and then over the devices in the group. Let's introduce a per container device list that simplifies this

[PULL 21/21] vfio/common: Move legacy VFIO backend code into separate container.c

2023-10-06 Thread Cédric Le Goater
From: Yi Liu Move all the code really dependent on the legacy VFIO container/group into a separate file: container.c. What does remain in common.c is the code related to VFIOAddressSpace, MemoryListeners, migration and all other general operations. Signed-off-by: Eric Auger Signed-off-by: Yi

[PULL 00/21] vfio queue

2023-10-06 Thread Cédric Le Goater
-20231006 for you to fetch changes up to 6e86aaef9ac57066aa923211a164df95b7b3cdf7: vfio/common: Move legacy VFIO backend code into separate container.c (2023-10-05 22:04:52 +0200) vfio queue: * Fix for VFIO display when using Intel

[PULL 04/21] vfio/pci: enable vector on dynamic MSI-X allocation

2023-10-06 Thread Cédric Le Goater
From: Jing Liu The vector_use callback is used to enable vector that is unmasked in guest. The kernel used to only support static MSI-X allocation. When allocating a new interrupt using "static MSI-X allocation" kernels, QEMU first disables all previously allocated vectors and then re-allocates

[PULL 03/21] vfio/pci: detect the support of dynamic MSI-X allocation

2023-10-06 Thread Cédric Le Goater
From: Jing Liu Kernel provides the guidance of dynamic MSI-X allocation support of passthrough device, by clearing the VFIO_IRQ_INFO_NORESIZE flag to guide user space. Fetch the flags from host to determine if dynamic MSI-X allocation is supported. Originally-by: Reinette Chatre

[PULL 17/21] vfio/common: Move VFIO reset handler registration to a group agnostic function

2023-10-06 Thread Cédric Le Goater
From: Zhenzhong Duan Move the reset handler registration/unregistration to a place that is not group specific. vfio_[get/put]_address_space are the best places for that purpose. Signed-off-by: Eric Auger Signed-off-by: Yi Liu Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater

[PULL 01/21] vfio/display: Fix missing update to set backing fields

2023-10-06 Thread Cédric Le Goater
From: Alex Williamson The below referenced commit renames scanout_width/height to backing_width/height, but also promotes these fields in various portions of the egl interface. Meanwhile vfio dmabuf support has never used the previous scanout fields and is therefore missed in the update. This

[PULL 19/21] vfio/common: Store the parent container in VFIODevice

2023-10-06 Thread Cédric Le Goater
From: Zhenzhong Duan let's store the parent contaienr within the VFIODevice. This simplifies the logic in vfio_viommu_preset() and brings the benefice to hide the group specificity which is useful for IOMMUFD migration. Signed-off-by: Eric Auger Signed-off-by: Zhenzhong Duan [ clg: Add test

[PULL 20/21] vfio/common: Introduce a global VFIODevice list

2023-10-06 Thread Cédric Le Goater
From: Zhenzhong Duan Some functions iterate over all the VFIODevices. This is currently achieved by iterating over all groups/devices. Let's introduce a global list of VFIODevices simplifying that scan. This will also be useful while migrating to IOMMUFD by hiding the group specificity.

[PULL 14/21] vfio/platform: Use vfio_[attach/detach]_device

2023-10-06 Thread Cédric Le Goater
From: Eric Auger Let the vfio-platform device use vfio_attach_device() and vfio_detach_device(), hence hiding the details of the used IOMMU backend. Drop the trace event for vfio-platform as we have similar one in vfio_attach_device. Signed-off-by: Eric Auger Signed-off-by: Yi Liu

[PULL 06/21] vfio/pci: enable MSI-X in interrupt restoring on dynamic allocation

2023-10-06 Thread Cédric Le Goater
From: Jing Liu During migration restoring, vfio_enable_vectors() is called to restore enabling MSI-X interrupts for assigned devices. It sets the range from 0 to nr_vectors to kernel to enable MSI-X and the vectors unmasked in guest. During the MSI-X enabling, all the vectors within the range

[PULL 12/21] vfio/common: Extract out vfio_kvm_device_[add/del]_fd

2023-10-06 Thread Cédric Le Goater
From: Zhenzhong Duan Introduce two new helpers, vfio_kvm_device_[add/del]_fd which take as input a file descriptor which can be either a group fd or a cdev fd. This uses the new KVM_DEV_VFIO_FILE VFIO KVM device group, which aliases to the legacy KVM_DEV_VFIO_GROUP.

[PULL 11/21] vfio/common: Introduce vfio_container_add|del_section_window()

2023-10-06 Thread Cédric Le Goater
From: Eric Auger Introduce helper functions that isolate the code used for VFIO_SPAPR_TCE_v2_IOMMU. Those helpers hide implementation details beneath the container object and make the vfio_listener_region_add/del() implementations more readable. No code change intended. Signed-off-by: Eric

[PULL 02/21] vfio/pci: rename vfio_put_device to vfio_pci_put_device

2023-10-06 Thread Cédric Le Goater
From: Zhenzhong Duan vfio_put_device() is a VFIO PCI specific function, rename it with 'vfio_pci' prefix to avoid confusing. No functional change. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Signed-off-by: Cédric Le Goater --- hw/vfio/pci.c | 4 ++-- 1 file changed, 2

[PULL 09/21] vfio/common: Move IOMMU agnostic helpers to a separate file

2023-10-06 Thread Cédric Le Goater
From: Yi Liu Move low-level iommu agnostic helpers to a separate helpers.c file. They relate to regions, interrupts, device/region capabilities and etc. Signed-off-by: Eric Auger Signed-off-by: Yi Sun Signed-off-by: Yi Liu Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater

[PULL 08/21] linux-headers: Add iommufd.h

2023-10-06 Thread Cédric Le Goater
From: Zhenzhong Duan Since commit da3c22c74a3c ("linux-headers: Update to Linux v6.6-rc1"), linux-headers has been updated to v6.6-rc1. As previous patch added iommufd.h to update-linux-headers.sh, run the script again against TAG v6.6-rc1 to have iommufd.h included. Signed-off-by: Zhenzhong

[PULL 07/21] scripts/update-linux-headers: Add iommufd.h

2023-10-06 Thread Cédric Le Goater
From: Eric Auger Update the script to import iommufd.h Signed-off-by: Eric Auger Signed-off-by: Yi Liu Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- scripts/update-linux-headers.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)

[PULL 05/21] vfio/pci: use an invalid fd to enable MSI-X

2023-10-06 Thread Cédric Le Goater
From: Jing Liu Guests typically enable MSI-X with all of the vectors masked in the MSI-X vector table. To match the guest state of device, QEMU enables MSI-X by enabling vector 0 with userspace triggering and immediately release. However the release function actually does not release it due to

<    1   2   3   4