[PULL 03/17] vfio/container: Initialize VFIOIOMMUOps under vfio_init_container()

2024-01-07 Thread Cédric Le Goater
-by: Cédric Le Goater --- hw/vfio/container.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/vfio/container.c b/hw/vfio/container.c index afcfe8048805c58291d1104ff0ef20bdc457f99c..f4a0434a5239bfb6a17b91c8879cb98e686afccc 100644 --- a/hw/vfio/container.c +++ b/hw/vfio

[PULL 00/17] vfio queue

2024-01-07 Thread Cédric Le Goater
, including the removal of the iommufd backend mutex * Introduced VFIOIOMMUClass, to avoid compiling spapr when !CONFIG_PSERIES Avihai Horon (1): vfio/migration: Add helper function to set state or reset device Cédric Le Goater (14

[PULL 14/17] vfio/container: Rename vfio_init_container to vfio_set_iommu

2024-01-07 Thread Cédric Le Goater
. vfio_init_container() operates on legacy container and setup IOMMU context with ioctl(VFIO_SET_IOMMU). So choose to rename vfio_init_container to vfio_set_iommu to avoid the confusion. No functional change intended. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le

[PULL 02/17] vfio/container: Introduce vfio_legacy_setup() for further cleanups

2024-01-07 Thread Cédric Le Goater
This will help subsequent patches to unify the initialization of type1 and sPAPR IOMMU backends. Reviewed-by: Zhenzhong Duan Tested-by: Eric Farman Signed-off-by: Cédric Le Goater --- hw/vfio/container.c | 63 + 1 file changed, 35 insertions(+), 28

[PULL 07/17] vfio/spapr: Introduce a sPAPR VFIOIOMMU QOM interface

2024-01-07 Thread Cédric Le Goater
specific to the sPAPR IOMMU. This allows reuse and provides better abstraction of the backends. It will be useful to avoid compiling the sPAPR IOMMU backend on targets not supporting it. Reviewed-by: Zhenzhong Duan Tested-by: Eric Farman Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio

[PULL 10/17] vfio/iommufd: Remove CONFIG_IOMMUFD usage

2024-01-07 Thread Cédric Le Goater
Availability of the IOMMUFD backend can now be fully determined at runtime and the ifdef check was a build time protection (for PPC not supporting it mostly). Reviewed-by: Zhenzhong Duan Tested-by: Eric Farman Signed-off-by: Cédric Le Goater --- hw/vfio/common.c | 3 --- 1 file changed, 3

Re: [PATCH 0/2] backends/iommufd: Remove mutex

2024-01-04 Thread Cédric Le Goater
On 1/2/24 13:32, Cédric Le Goater wrote: Hello ! Coverity has some reports regarding the IOMMUFDBackend mutex. Since the IOMMUFDBackend routines are called from the QEMU main thread, this series simply suggests removing the mutex and rely on the BQL to handle concurrent access. Thanks, C

Re: [PATCH 1/2] backends/iommufd: Remove check on number of backend users

2024-01-03 Thread Cédric Le Goater
Hello Zhenzhong, On 1/3/24 02:40, Duan, Zhenzhong wrote: Hi Cédric, -Original Message- From: Cédric Le Goater Sent: Tuesday, January 2, 2024 8:32 PM To: qemu-devel@nongnu.org Cc: Liu, Yi L ; Eric Auger ; Duan, Zhenzhong ; Cédric Le Goater Subject: [PATCH 1/2] backends/iommufd

Re: [PATCH 00/33] hw/cpu/arm: Remove one use of qemu_get_cpu() in A7/A15 MPCore priv

2024-01-02 Thread Cédric Le Goater
On 1/2/24 17:15, Philippe Mathieu-Daudé wrote: Hi Cédric, On 2/1/24 15:55, Cédric Le Goater wrote: On 12/12/23 17:29, Philippe Mathieu-Daudé wrote: Hi, When a MPCore cluster is used, the Cortex-A cores belong the the cluster container, not to the board/soc layer. This series move

Re: [PATCH v3 5/5] Rename "QEMU global mutex" to "BQL" in comments and docs

2024-01-02 Thread Cédric Le Goater
i Acked-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C.

Re: [PATCH v3 4/5] Replace "iothread lock" with "BQL" in comments

2024-01-02 Thread Cédric Le Goater
On 1/2/24 16:35, Stefan Hajnoczi wrote: The term "iothread lock" is obsolete. The APIs use Big QEMU Lock (BQL) in their names. Update the code comments to use "BQL" instead of "iothread lock". Signed-off-by: Stefan Hajnoczi Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH 00/33] hw/cpu/arm: Remove one use of qemu_get_cpu() in A7/A15 MPCore priv

2024-01-02 Thread Cédric Le Goater
On 12/12/23 17:29, Philippe Mathieu-Daudé wrote: Hi, When a MPCore cluster is used, the Cortex-A cores belong the the cluster container, not to the board/soc layer. This series move the creation of vCPUs to the MPCore private container. Doing so we consolidate the QOM model, moving common code

Re: [PATCH 11/33] hw/cpu/arm: Have A9MPCORE/A15MPCORE inheritate common CORTEX_MPCORE_PRIV

2024-01-02 Thread Cédric Le Goater
On 12/12/23 17:29, Philippe Mathieu-Daudé wrote: TYPE_CORTEX_MPCORE_PRIV becomes the common parent to TYPE_A9MPCORE_PRIV and TYPE_A15MPCORE_PRIV. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C.

Re: [PATCH 12/33] hw/cpu/arm: Create MPCore container in QOM parent

2024-01-02 Thread Cédric Le Goater
On 12/12/23 17:29, Philippe Mathieu-Daudé wrote: Move the memory region container creation to the abstract QOM parent. Children set the region size via the class 'container_size' field. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C.

Re: [PATCH 10/33] hw/cpu/arm: Introduce abstract CORTEX_MPCORE_PRIV QOM type

2024-01-02 Thread Cédric Le Goater
On 12/12/23 17:29, Philippe Mathieu-Daudé wrote: This type will be common to A9MPCORE/A15MPCORE devices. Reviewed-by: Cédric Le Goater Thanks, C.

Re: [PATCH 09/33] hw/cpu/arm: Merge {a9mpcore.h, a15mpcore.h} as cortex_mpcore.h

2024-01-02 Thread Cédric Le Goater
On 12/12/23 17:29, Philippe Mathieu-Daudé wrote: Merge Cortex-A{9,15} MPCore devices in the same header. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C.

Re: [PATCH 08/33] hw/cpu/arm: Declare CPU QOM types using DEFINE_TYPES() macro

2024-01-02 Thread Cédric Le Goater
-by: Cédric Le Goater Thanks, C.

Re: [PATCH 07/33] hw/cpu/arm: Alias 'num-cpu' property on TYPE_REALVIEW_MPCORE

2024-01-02 Thread Cédric Le Goater
On 12/12/23 17:29, Philippe Mathieu-Daudé wrote: No need to duplicate and forward the 'num-cpu' property from TYPE_ARM11MPCORE_PRIV to TYPE_REALVIEW_MPCORE, alias it with QOM object_property_add_alias(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C.

Re: [PATCH 06/33] hw/cpu/arm: Rename 'busdev' -> 'gicsbd' in a15mp_priv_realize()

2024-01-02 Thread Cédric Le Goater
-by: Cédric Le Goater Thanks, C.

Re: [PATCH 05/33] hw/cpu: Remove dead Kconfig

2024-01-02 Thread Cédric Le Goater
On 12/12/23 17:29, Philippe Mathieu-Daudé wrote: ARM MPCore Kconfig are defined in hw/arm/Kconfig. hw/cpu/Kconfig is never used, remove it. Fixes: 82f5181777 ("kconfig: introduce kconfig files") Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C.

Re: [PATCH 04/33] hw/arm/fsl-imx7: Add a local 'gic' variable

2024-01-02 Thread Cédric Le Goater
On 12/12/23 17:29, Philippe Mathieu-Daudé wrote: The A7MPCore forward the IRQs from its internal GIC. To make the code clearer, add a 'gic' variable. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C.

Re: [PATCH 03/33] hw/arm/fsl-imx6ul: Add a local 'gic' variable

2024-01-02 Thread Cédric Le Goater
On 12/12/23 17:29, Philippe Mathieu-Daudé wrote: The A7MPCore forward the IRQs from its internal GIC. To make the code clearer, add a 'gic' variable. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C.

Re: [PATCH 02/33] hw/arm/fsl-imx6: Add a local 'gic' variable

2024-01-02 Thread Cédric Le Goater
On 12/12/23 17:29, Philippe Mathieu-Daudé wrote: The A9MPCore forward the IRQs from its internal GIC. To make the code clearer, add a 'gic' variable. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C.

Re: [PATCH 01/33] hw/arm/boot: Propagate vCPU to arm_load_dtb()

2024-01-02 Thread Cédric Le Goater
On 12/12/23 17:29, Philippe Mathieu-Daudé wrote: In heterogeneous setup the first vCPU might not be the one expected, better pass it explicitly. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Thanks, C.

[PATCH 2/2] backends/iommufd: Remove mutex

2024-01-02 Thread Cédric Le Goater
BQL lock and it should be safe to drop the IOMMUFD backend mutex. Simply remove it. Fixes: CID 1531550 Fixes: CID 1531549 Signed-off-by: Cédric Le Goater --- include/sysemu/iommufd.h | 2 -- backends/iommufd.c | 7 --- 2 files changed, 9 deletions(-) diff --git a/include/sysemu/iommuf

[PATCH 0/2] backends/iommufd: Remove mutex

2024-01-02 Thread Cédric Le Goater
Hello ! Coverity has some reports regarding the IOMMUFDBackend mutex. Since the IOMMUFDBackend routines are called from the QEMU main thread, this series simply suggests removing the mutex and rely on the BQL to handle concurrent access. Thanks, C. Cédric Le Goater (2): backends/iommufd

[PATCH 1/2] backends/iommufd: Remove check on number of backend users

2024-01-02 Thread Cédric Le Goater
QOM already has a ref count on objects and it will assert much earlier, when INT_MAX is reached. Signed-off-by: Cédric Le Goater --- backends/iommufd.c | 5 - 1 file changed, 5 deletions(-) diff --git a/backends/iommufd.c b/backends/iommufd.c index ba58a0eb0d0ba9aae625c987eb728547543dba66

Re: [PATCH] vfio/migration: Add helper function to set state or reset device

2024-01-02 Thread Cédric Le Goater
On 12/31/23 11:48, Avihai Horon wrote: There are several places where failure in setting the device state leads to a device reset, which is done by setting ERROR as the recover state. Add a helper function that sets the device state and resets the device in case of failure. This will make the

Re: [PATCH] vfio/migration: Add helper function to set state or reset device

2024-01-02 Thread Cédric Le Goater
the code cleaner and remove duplicate comments. Signed-off-by: Avihai Horon Reviewed-by: Cédric Le Goater Thanks, C.

Re: [PATCH 1/2] hw/s390x/ccw: Replace basename() with g_path_get_basename()

2024-01-02 Thread Cédric Le Goater
], replace basename() with g_path_get_basename(). [1]: https://lore.kernel.org/all/20231212010228.2701544-1-raj.k...@gmail.com/ Suggested-by: Cédric Le Goater Signed-off-by: Zhao Liu Reviewed-by: Cédric Le Goater Thanks, C. --- Suggested by credit: Cédric: Referred his description

Re: [PATCH 2/2] hw/s390x/ccw: Replace dirname() with g_path_get_dirname()

2024-01-02 Thread Cédric Le Goater
g argument. Replace dirname() with g_path_get_dirname(). Suggested-by: Cédric Le Goater Signed-off-by: Zhao Liu Reviewed-by: Cédric Le Goater Thanks, C. --- Suggested by credit: Cédric: Referred his words for g_path_get_basename() and g_path_get_dirname() has the same advantage

Re: [PATCH] vfio/container: Rename vfio_init_container to vfio_set_iommu

2024-01-02 Thread Cédric Le Goater
'VFIOContainerBase *' ops. vfio_init_container() operates on legacy container and setup IOMMU context with ioctl(VFIO_SET_IOMMU). So choose to rename vfio_init_container to vfio_set_iommu to avoid the confusion. No functional change intended. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan

Re: [PATCH] vfio/iommufd: Remove the use of stat() to check file existence

2024-01-02 Thread Cédric Le Goater
On 12/21/23 09:09, Cédric Le Goater wrote: Using stat() before opening a file or a directory can lead to a time-of-check to time-of-use (TOCTOU) filesystem race, which is reported by coverity as a Security best practices violations. The sequence could be replaced by open and fdopendir

Re: [PATCH] hw/vfio: fix iteration over global VFIODevice list

2024-01-02 Thread Cédric Le Goater
On 1/2/24 05:27, Duan, Zhenzhong wrote: -Original Message- From: Volker Rümelin Subject: [PATCH] hw/vfio: fix iteration over global VFIODevice list Commit 3d779abafe ("vfio/common: Introduce a global VFIODevice list") introduced a global VFIODevice list, but forgot to update the

Re: [PATCH] hw/vfio: fix iteration over global VFIODevice list

2024-01-01 Thread Cédric Le Goater
ld. Fixes: 3d779abafe ("vfio/common: Introduce a global VFIODevice list") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2061 Signed-off-by: Volker Rümelin Reviewed-by: Cédric Le Goater Thanks, C. --- hw/vfio/common.c | 8 1 file changed, 4 insertions(+), 4 dele

Re: [PULL 20/47] backends/iommufd: Introduce the iommufd object

2023-12-22 Thread Cédric Le Goater
On 12/22/23 11:09, Eric Auger wrote: Hi Cédric, On 12/21/23 22:23, Cédric Le Goater wrote: On 12/21/23 18:14, Eric Auger wrote: Hi Cédric, On 12/21/23 17:00, Cédric Le Goater wrote: [ ... ] +static void iommufd_backend_init(Object *obj) +{ +    IOMMUFDBackend *be = IOMMUFD_BACKEND(obj

Re: [PULL 20/47] backends/iommufd: Introduce the iommufd object

2023-12-21 Thread Cédric Le Goater
On 12/21/23 18:14, Eric Auger wrote: Hi Cédric, On 12/21/23 17:00, Cédric Le Goater wrote: [ ... ] +static void iommufd_backend_init(Object *obj) +{ +    IOMMUFDBackend *be = IOMMUFD_BACKEND(obj); + +    be->fd = -1; +    be->users = 0; +    be->owned = true; +    qemu_mutex_i

Re: [PULL 20/47] backends/iommufd: Introduce the iommufd object

2023-12-21 Thread Cédric Le Goater
[ ... ] +static void iommufd_backend_init(Object *obj) +{ +IOMMUFDBackend *be = IOMMUFD_BACKEND(obj); + +be->fd = -1; +be->users = 0; +be->owned = true; +qemu_mutex_init(>lock);> +} + +static void iommufd_backend_finalize(Object *obj) +{ +IOMMUFDBackend *be =

Re: [PATCH] vfio/iommufd: Remove the use of stat() to check file existence

2023-12-21 Thread Cédric Le Goater
Hello Zhenzhong On 12/21/23 09:55, Duan, Zhenzhong wrote: -Original Message- From: Cédric Le Goater Sent: Thursday, December 21, 2023 4:10 PM Subject: [PATCH] vfio/iommufd: Remove the use of stat() to check file existence Using stat() before opening a file or a directory can lead

Re: [PATCH] vfio/container: Rename vfio_init_container to vfio_set_iommu

2023-12-21 Thread Cédric Le Goater
'VFIOContainerBase *' ops. vfio_init_container() operates on legacy container and setup IOMMU context with ioctl(VFIO_SET_IOMMU). So choose to rename vfio_init_container to vfio_set_iommu to avoid the confusion. No functional change intended. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan

Re: [PATCH v2 59/71] hw/vfio: Constify VMState

2023-12-21 Thread Cédric Le Goater
On 12/21/23 04:16, Richard Henderson wrote: Signed-off-by: Richard Henderson Reviewed-by: Cédric Le Goater I suppose you will include the patch in : https://lore.kernel.org/qemu-devel/20231221031652.119827-1-richard.hender...@linaro.org/ Thanks, C. --- hw/vfio/display.c | 2

[PATCH] vfio/iommufd: Remove the use of stat() to check file existence

2023-12-21 Thread Cédric Le Goater
opendir to avoid the race. Fixes: CID 1531551 Signed-off-by: Cédric Le Goater --- hw/vfio/iommufd.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c index d4c586e842def8f04d3a914843f5eece2c75ea30..9bfddc1360895413176a9f170e29e89027384a66 100644 --- a/hw

Re: [PATCH for-9.0 v2 00/10] vfio: Introduce a VFIOIOMMUClass

2023-12-21 Thread Cédric Le Goater
On 12/20/23 21:35, Eric Farman wrote: On Tue, 2023-12-19 at 07:58 +0100, Cédric Le Goater wrote: Hello, The VFIO object hierarchy has some constraints because each VFIO type has a dual nature: a VFIO nature for passthrough support and a bus nature (PCI, AP, CCW, Platform) for its initial

Re: [PATCH] vfio/container: Replace basename with g_path_get_basename

2023-12-20 Thread Cédric Le Goater
Hello, On 12/20/23 16:09, Zhao Liu wrote: Hi Cédric, On Wed, Dec 20, 2023 at 02:53:02PM +0100, Cédric Le Goater wrote: Date: Wed, 20 Dec 2023 14:53:02 +0100 From: Cédric Le Goater Subject: [PATCH] vfio/container: Replace basename with g_path_get_basename X-Mailer: git-send-email 2.43.0

Re: [PATCH] vfio/container: Replace basename with g_path_get_basename

2023-12-20 Thread Cédric Le Goater
On 12/20/23 14:53, Cédric Le Goater wrote: g_path_get_basename() is a portable utility function that has the advantage of not modifing the string argument. It also fixes a compile breakage with the Musl C library reported in [1]. [1] https://lore.kernel.org/all/20231212010228.2701544-1-raj.k

Re: [PATCH for-9.0 v2 00/10] vfio: Introduce a VFIOIOMMUClass

2023-12-20 Thread Cédric Le Goater
On 12/19/23 07:58, Cédric Le Goater wrote: Hello, The VFIO object hierarchy has some constraints because each VFIO type has a dual nature: a VFIO nature for passthrough support and a bus nature (PCI, AP, CCW, Platform) for its initial presentation. It seemed the best approach made because multi

[PATCH] vfio/container: Replace basename with g_path_get_basename

2023-12-20 Thread Cédric Le Goater
-off-by: Cédric Le Goater --- hw/vfio/container.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/vfio/container.c b/hw/vfio/container.c index 688cf23bab88f85246378bc5a7da3c51ea6b79d9..8d334f52f2438d05f632502e07ffd4dc2ec76cb5 100644 --- a/hw/vfio/container.c +++ b/hw

[PULL 03/47] vfio/container: Switch to dma_map|unmap API

2023-12-19 Thread Cédric Le Goater
From: Eric Auger No functional change intended. Signed-off-by: Eric Auger Signed-off-by: Yi Liu Signed-off-by: Yi Sun Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-common.h | 4 --- include/hw/vfio/vfio

[PULL 44/47] vfio/ccw: Move VFIODevice initializations in vfio_ccw_instance_init

2023-12-19 Thread Cédric Le Goater
From: Zhenzhong Duan Some of the VFIODevice initializations is in vfio_ccw_realize, move all of them in vfio_ccw_instance_init. No functional change intended. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Eric Farman Tested

[PULL 36/47] vfio/ccw: Make vfio cdev pre-openable by passing a file handle

2023-12-19 Thread Cédric Le Goater
Goater Reviewed-by: Eric Farman Tested-by: Nicolin Chen Signed-off-by: Cédric Le Goater --- hw/vfio/ccw.c | 25 ++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/hw/vfio/ccw.c b/hw/vfio/ccw.c index d2d58bb677cfad38a6965ea6a43783256407207b

[PULL 29/47] vfio/pci: Allow the selection of a given iommu backend

2023-12-19 Thread Cédric Le Goater
Suggested-by: Alex Williamson Signed-off-by: Eric Auger Signed-off-by: Yi Liu Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Tested-by: Eric Auger Tested-by: Nicolin Chen Signed-off-by: Cédric Le Goater --- hw/vfio/pci.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/hw

[PULL 28/47] vfio/iommufd: Enable pci hot reset through iommufd cdev interface

2023-12-19 Thread Cédric Le Goater
From: Zhenzhong Duan Implement the newly introduced pci_hot_reset callback named iommufd_cdev_pci_hot_reset to do iommufd specific check and reset operation. Signed-off-by: Zhenzhong Duan Reviewed-by: Eric Auger Tested-by: Eric Auger Tested-by: Nicolin Chen Signed-off-by: Cédric Le Goater

[PULL 30/47] vfio/pci: Make vfio cdev pre-openable by passing a file handle

2023-12-19 Thread Cédric Le Goater
Cédric Le Goater Tested-by: Eric Auger Tested-by: Nicolin Chen Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-common.h | 4 hw/vfio/helpers.c | 43 +++ hw/vfio/iommufd.c | 12 ++ hw/vfio/pci.c

[PULL 46/47] docs/devel: Add VFIO iommufd backend documentation

2023-12-19 Thread Cédric Le Goater
From: Zhenzhong Duan Suggested-by: Cédric Le Goater Signed-off-by: Eric Auger Signed-off-by: Yi Liu Signed-off-by: Zhenzhong Duan Tested-by: Nicolin Chen Signed-off-by: Cédric Le Goater --- MAINTAINERS| 1 + docs/devel/index-internals.rst | 1 + docs/devel/vfio

[PULL 39/47] kconfig: Activate IOMMUFD for s390x machines

2023-12-19 Thread Cédric Le Goater
Signed-off-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Matthew Rosato Reviewed-by: Eric Farman Tested-by: Nicolin Chen Signed-off-by: Cédric Le Goater --- hw/s390x/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/s390x/Kconfig b/hw/s390x/Kconfig index

[PULL 17/47] vfio/spapr: switch to spapr IOMMU BE add/del_section_window

2023-12-19 Thread Cédric Le Goater
From: Zhenzhong Duan No functional change intended. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater --- include/hw/vfio/vfio-common.h | 5 - include/hw/vfio/vfio-container-base.h | 5 + hw/vfio/common.c | 8 ++-- hw/vfio/container

[PULL 41/47] vfio/pci: Move VFIODevice initializations in vfio_instance_init

2023-12-19 Thread Cédric Le Goater
From: Zhenzhong Duan Some of the VFIODevice initializations is in vfio_realize, move all of them in vfio_instance_init. No functional change intended. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Philippe Mathieu-Daudé Tested-by: Nicolin Chen Signed-off

[PULL 25/47] vfio/iommufd: Add support for iova_ranges and pgsizes

2023-12-19 Thread Cédric Le Goater
backend, if this fails, fallback to 64bit IOVA range. Also use out_iova_alignment returned from uAPI as pgsizes instead of qemu_real_host_page_size() as a fallback. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Reviewed-by: Eric Auger Tested-by: Eric Auger Tested-by: Nicolin Chen

[PULL 43/47] vfio/ap: Move VFIODevice initializations in vfio_ap_instance_init

2023-12-19 Thread Cédric Le Goater
From: Zhenzhong Duan Some of the VFIODevice initializations is in vfio_ap_realize, move all of them in vfio_ap_instance_init. No functional change intended. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Eric Farman Tested

[PULL 18/47] vfio/spapr: Move prereg_listener into spapr container

2023-12-19 Thread Cédric Le Goater
From: Zhenzhong Duan No functional changes intended. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-common.h | 1 - hw/vfio/spapr.c | 24 2 files changed, 16 insertions(+), 9

[PULL 26/47] vfio/pci: Extract out a helper vfio_pci_get_pci_hot_reset_info

2023-12-19 Thread Cédric Le Goater
From: Zhenzhong Duan This helper will be used by both legacy and iommufd backends. No functional changes intended. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Reviewed-by: Eric Auger Tested-by: Eric Auger Tested-by: Nicolin Chen Signed-off-by: Cédric Le Goater --- hw

[PULL 22/47] vfio/common: return early if space isn't empty

2023-12-19 Thread Cédric Le Goater
From: Zhenzhong Duan This is a trivial optimization. If there is active container in space, vfio_reset_handler will never be unregistered. So revert the check of space->containers and return early. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Reviewed-by: Eric Auger Tes

[PULL 02/47] vfio/container: Introduce a empty VFIOIOMMUOps

2023-12-19 Thread Cédric Le Goater
From: Zhenzhong Duan This empty VFIOIOMMUOps named vfio_legacy_ops will hold all general IOMMU ops of legacy container. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-common.h | 2 +- hw/vfio/container.c | 5

[PULL 15/47] vfio/container: Implement attach/detach_device

2023-12-19 Thread Cédric Le Goater
From: Eric Auger No functional change intended. Signed-off-by: Eric Auger Signed-off-by: Yi Liu Signed-off-by: Yi Sun Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- hw/vfio/common.c| 16 hw/vfio/container.c | 12

[PULL 47/47] hw/ppc/Kconfig: Imply VFIO_PCI

2023-12-19 Thread Cédric Le Goater
Duan Signed-off-by: Cédric Le Goater --- hw/ppc/spapr_pci_vfio.c | 36 hw/ppc/Kconfig | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr_pci_vfio.c b/hw/ppc/spapr_pci_vfio.c index

[PULL 32/47] vfio/platform: Make vfio cdev pre-openable by passing a file handle

2023-12-19 Thread Cédric Le Goater
From: Zhenzhong Duan This gives management tools like libvirt a chance to open the vfio cdev with privilege and pass FD to qemu. This way qemu never needs to have privilege to open a VFIO or iommu cdev node. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Tested-by: Nicolin Chen

[PULL 09/47] vfio/container: Convert functions to base container

2023-12-19 Thread Cédric Le Goater
vfio_get_dirty_bitmap Signed-off-by: Eric Auger Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-common.h | 9 hw/vfio/common.c | 42 +++ hw/vfio/container.c | 6

[PULL 21/47] util/char_dev: Add open_cdev()

2023-12-19 Thread Cédric Le Goater
From: Yi Liu /dev/vfio/devices/vfioX may not exist. In that case it is still possible to open /dev/char/$major:$minor instead. Add helper function to abstract the cdev open. Suggested-by: Jason Gunthorpe Signed-off-by: Yi Liu Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater

[PULL 45/47] vfio: Introduce a helper function to initialize VFIODevice

2023-12-19 Thread Cédric Le Goater
From: Zhenzhong Duan Introduce a helper function to replace the common code to initialize VFIODevice in pci, platform, ap and ccw VFIO device. No functional change intended. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Tested-by: Nicolin Chen Signed-off-by: Cédric Le Goater

[PULL 08/47] vfio/container: Move per container device list in base container

2023-12-19 Thread Cédric Le Goater
From: Zhenzhong Duan VFIO Device is also changed to point to base container instead of legacy container. No functional change intended. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-common.h | 3 +-- include/hw

[PULL 38/47] hw/arm: Activate IOMMUFD for virt machines

2023-12-19 Thread Cédric Le Goater
Signed-off-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Eric Auger Tested-by: Eric Auger Tested-by: Nicolin Chen Signed-off-by: Cédric Le Goater --- hw/arm/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index

[PULL 37/47] vfio: Make VFIOContainerBase poiner parameter const in VFIOIOMMUOps callbacks

2023-12-19 Thread Cédric Le Goater
callbacks also need same changes to avoid build error. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Reviewed-by: Eric Auger Tested-by: Eric Auger Tested-by: Nicolin Chen Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-common.h

[PULL 42/47] vfio/platform: Move VFIODevice initializations in vfio_platform_instance_init

2023-12-19 Thread Cédric Le Goater
From: Zhenzhong Duan Some of the VFIODevice initializations is in vfio_platform_realize, move all of them in vfio_platform_instance_init. No functional change intended. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Philippe Mathieu-Daudé Tested-by: Nicolin Chen

[PULL 40/47] hw/i386: Activate IOMMUFD for q35 machines

2023-12-19 Thread Cédric Le Goater
Signed-off-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Eric Auger Tested-by: Nicolin Chen Signed-off-by: Cédric Le Goater --- hw/i386/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig index

[PULL 12/47] vfio/container: Move listener to base container

2023-12-19 Thread Cédric Le Goater
From: Eric Auger Move listener to base container. Also error and initialized fields are moved at the same time. No functional change intended. Signed-off-by: Eric Auger Signed-off-by: Yi Liu Signed-off-by: Yi Sun Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off

[PULL 31/47] vfio/platform: Allow the selection of a given iommu backend

2023-12-19 Thread Cédric Le Goater
=iommufd0 Suggested-by: Alex Williamson Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Reviewed-by: Eric Auger Tested-by: Nicolin Chen Signed-off-by: Cédric Le Goater --- hw/vfio/platform.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/hw/vfio/platform.c b/hw/vfio

[PULL 05/47] vfio/common: Move giommu_list in base container

2023-12-19 Thread Cédric Le Goater
From: Eric Auger Move the giommu_list field in the base container and store the base container in the VFIOGuestIOMMU. No functional change intended. Signed-off-by: Eric Auger Signed-off-by: Yi Liu Signed-off-by: Yi Sun Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off

[PULL 35/47] vfio/ccw: Allow the selection of a given iommu backend

2023-12-19 Thread Cédric Le Goater
/mdev/devices/XXX,iommufd=iommufd0 Suggested-by: Alex Williamson Signed-off-by: Zhenzhong Duan Reviewed-by: Matthew Rosato Reviewed-by: Cédric Le Goater Reviewed-by: Eric Farman Tested-by: Nicolin Chen Signed-off-by: Cédric Le Goater --- hw/vfio/ccw.c | 6 ++ 1 file changed, 6 insertions

[PULL 27/47] vfio/pci: Introduce a vfio pci hot reset interface

2023-12-19 Thread Cédric Le Goater
to vfio_legacy_pci_hot_reset and move it into container.c. vfio_pci_[pre/post]_reset and vfio_pci_host_match are exported so they could be called in legacy and iommufd pci_hot_reset callback. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Eric Auger Tested-by: Eric Auger Tested-by: Nicolin

[PULL 33/47] vfio/ap: Allow the selection of a given iommu backend

2023-12-19 Thread Cédric Le Goater
/devices/XXX,iommufd=iommufd0 Suggested-by: Alex Williamson Signed-off-by: Zhenzhong Duan Reviewed-by: Matthew Rosato Reviewed-by: Cédric Le Goater Tested-by: Nicolin Chen Signed-off-by: Cédric Le Goater --- hw/vfio/ap.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/hw/vfio/ap.c b/hw

[PULL 10/47] vfio/container: Move pgsizes and dma_max_mappings to base container

2023-12-19 Thread Cédric Le Goater
From: Eric Auger No functional change intended. Signed-off-by: Eric Auger Signed-off-by: Yi Liu Signed-off-by: Yi Sun Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-common.h | 2 -- include/hw/vfio/vfio

[PULL 23/47] vfio/iommufd: Implement the iommufd backend

2023-12-19 Thread Cédric Le Goater
-by: Cédric Le Goater Tested-by: Eric Auger Tested-by: Nicolin Chen Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-common.h | 11 + hw/vfio/common.c | 6 + hw/vfio/iommufd.c | 422 ++ hw/vfio/meson.build | 3 + hw

[PULL 16/47] vfio/spapr: Introduce spapr backend and target interface

2023-12-19 Thread Cédric Le Goater
it to bcontainer->ops. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-container-base.h | 6 ++ hw/vfio/spapr.c | 14 ++ 2 files changed, 20 insertions(+) diff --git a/include/hw/vfio/v

[PULL 20/47] backends/iommufd: Introduce the iommufd object

2023-12-19 Thread Cédric Le Goater
Duan Reviewed-by: Cédric Le Goater Tested-by: Eric Auger Tested-by: Nicolin Chen Signed-off-by: Cédric Le Goater --- MAINTAINERS | 8 ++ qapi/qom.json| 19 +++ include/sysemu/iommufd.h | 38 ++ backends/iommufd.c | 245

[PULL 34/47] vfio/ap: Make vfio cdev pre-openable by passing a file handle

2023-12-19 Thread Cédric Le Goater
Goater Tested-by: Nicolin Chen Signed-off-by: Cédric Le Goater --- hw/vfio/ap.c | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/hw/vfio/ap.c b/hw/vfio/ap.c index 80629609aebbff9156f78c9bbde5dc6c293ac84e..f180e4a32aa00f391f02e49b6c1bc2e8ebd2fecb 100644

[PULL 24/47] vfio/iommufd: Relax assert check for iommufd backend

2023-12-19 Thread Cédric Le Goater
page sync isn't supported, query_dirty_bitmap will never be called. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Reviewed-by: Eric Auger Tested-by: Eric Auger Tested-by: Nicolin Chen Signed-off-by: Cédric Le Goater --- hw/vfio/container-base.c | 4

[PULL 01/47] vfio: Introduce base object for VFIOContainer and targeted interface

2023-12-19 Thread Cédric Le Goater
. No functional change intended. Signed-off-by: Eric Auger Signed-off-by: Yi Liu Signed-off-by: Yi Sun Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-common.h | 8 ++--- include/hw/vfio/vfio-container-base.h | 50

[PULL 04/47] vfio/common: Introduce vfio_container_init/destroy helper

2023-12-19 Thread Cédric Le Goater
From: Zhenzhong Duan This adds two helper functions vfio_container_init/destroy which will be used by both legacy and iommufd containers to do base container specific initialization and release. No functional change intended. Suggested-by: Cédric Le Goater Signed-off-by: Zhenzhong Duan

[PULL 00/47] vfio queue

2023-12-19 Thread Cédric Le Goater
backend for ARM, x86_64 and s390x platforms Cédric Le Goater (4): hw/arm: Activate IOMMUFD for virt machines kconfig: Activate IOMMUFD for s390x machines hw/i386: Activate IOMMUFD for q35 machines hw/ppc/Kconfig

[PULL 19/47] vfio/spapr: Move hostwin_list into spapr container

2023-12-19 Thread Cédric Le Goater
From: Zhenzhong Duan No functional changes intended. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-common.h | 1 - hw/vfio/spapr.c | 36 +++ 2 files changed, 20 insertions

[PULL 06/47] vfio/container: Move space field to base container

2023-12-19 Thread Cédric Le Goater
From: Eric Auger Move the space field to the base object. Also the VFIOAddressSpace now contains a list of base containers. No functional change intended. Signed-off-by: Eric Auger Signed-off-by: Yi Liu Signed-off-by: Yi Sun Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater

[PULL 14/47] vfio/container: Move iova_ranges to base container

2023-12-19 Thread Cédric Le Goater
From: Zhenzhong Duan Meanwhile remove the helper function vfio_free_container as it only calls g_free now. No functional change intended. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-common.h | 1 - include/hw

[PULL 13/47] vfio/container: Move dirty_pgsizes and max_dirty_bitmap_size to base container

2023-12-19 Thread Cédric Le Goater
From: Eric Auger No functional change intended. Signed-off-by: Eric Auger Signed-off-by: Yi Liu Signed-off-by: Yi Sun Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-common.h | 2 -- include/hw/vfio/vfio

[PULL 07/47] vfio/container: Switch to IOMMU BE set_dirty_page_tracking/query_dirty_bitmap API

2023-12-19 Thread Cédric Le Goater
From: Eric Auger dirty_pages_supported field is also moved to the base container No functional change intended. Signed-off-by: Eric Auger Signed-off-by: Yi Liu Signed-off-by: Yi Sun Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- include

[PULL 11/47] vfio/container: Move vrdl_list to base container

2023-12-19 Thread Cédric Le Goater
From: Zhenzhong Duan No functional change intended. Signed-off-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-common.h | 11 include/hw/vfio/vfio-container-base.h | 11 hw/vfio/common.c

[PATCH for-9.0 v2 05/10] vfio/container: Introduce a VFIOIOMMU legacy QOM interface

2023-12-18 Thread Cédric Le Goater
Convert the legacy VFIOIOMMUOps struct to the new VFIOIOMMU QOM interface. The set of of operations for this backend can be referenced with a literal typename instead of a C struct. This will simplify support of multiple backends. Reviewed-by: Zhenzhong Duan Signed-off-by: Cédric Le Goater

[PATCH for-9.0 v2 00/10] vfio: Introduce a VFIOIOMMUClass

2023-12-18 Thread Cédric Le Goater
not needing it. This saves some text in QEMU. Applies on vfio-next. Thanks, C. Changes in v2: - Removed superfluous define and struct definitions - Improved comments and commit log - Removed NULL initialization of vioc - Removed class_size initialization Cédric Le Goater (10): vfio/spapr

[PATCH for-9.0 v2 07/10] vfio/spapr: Introduce a sPAPR VFIOIOMMU QOM interface

2023-12-18 Thread Cédric Le Goater
specific to the sPAPR IOMMU. This allows reuse and provides better abstraction of the backends. It will be useful to avoid compiling the sPAPR IOMMU backend on targets not supporting it. Reviewed-by: Zhenzhong Duan Signed-off-by: Cédric Le Goater --- v2: - Removed class_size initialization

[PATCH for-9.0 v2 01/10] vfio/spapr: Extend VFIOIOMMUOps with a release handler

2023-12-18 Thread Cédric Le Goater
This allows to abstract a bit more the sPAPR IOMMU support in the legacy IOMMU backend. Reviewed-by: Zhenzhong Duan Signed-off-by: Cédric Le Goater --- include/hw/vfio/vfio-container-base.h | 1 + hw/vfio/container.c | 10 +++- hw/vfio/spapr.c | 35

[PATCH for-9.0 v2 02/10] vfio/container: Introduce vfio_legacy_setup() for further cleanups

2023-12-18 Thread Cédric Le Goater
This will help subsequent patches to unify the initialization of type1 and sPAPR IOMMU backends. Reviewed-by: Zhenzhong Duan Signed-off-by: Cédric Le Goater --- hw/vfio/container.c | 63 + 1 file changed, 35 insertions(+), 28 deletions(-) diff --git

<    2   3   4   5   6   7   8   9   10   11   >