Re: [PATCH for 7.2? V2] vhost: fix vq dirty bitmap syncing when vIOMMU is enabled

2022-11-29 Thread Eric Auger
* For vhost, VIRTIO_F_IOMMU_PLATFORM means the backend support > - * incremental memory mapping API via IOTLB API. For platform that > - * does not have IOMMU, there's no need to enable this feature > - * which may cause unnecessary IOTLB miss/update transactions. > - */ > -if (vdev) { > -return virtio_bus_device_iommu_enabled(vdev) && > -virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM); > -} else { > -return false; > -} > -} > - > static void *vhost_memory_map(struct vhost_dev *dev, hwaddr addr, >hwaddr *plen, bool is_write) > { Besides, Tested-by: Eric Auger Eric

Re: [PATCH for 7.2? V2] vhost: fix vq dirty bitmap syncing when vIOMMU is enabled

2022-11-29 Thread Eric Auger
Hi Michael, On 11/29/22 16:44, Michael S. Tsirkin wrote: > On Tue, Nov 29, 2022 at 10:52:29AM +0100, Eric Auger wrote: >> Hi Jason, >> >> On 11/29/22 05:02, Jason Wang wrote: >>> When vIOMMU is enabled, the vq->used_phys is actually the IOVA not >>> GPA

Re: [PATCH] intel-iommu: Document iova_tree

2022-12-01 Thread Eric Auger
Hi Peter On 12/1/22 17:25, Peter Xu wrote: > It seems not super clear on when iova_tree is used, and why. Add a rich > comment above iova_tree to track why we needed the iova_tree, and when we > need it. > > Suggested-by: Jason Wang > Signed-off-by: Peter Xu > --- > include/hw/i386/intel_iommu

Re: [PATCH] intel-iommu: Document iova_tree

2022-12-06 Thread Eric Auger
Hi Peter, On 12/1/22 20:22, Peter Xu wrote: > On Thu, Dec 01, 2022 at 07:17:41PM +0100, Eric Auger wrote: >> Hi Peter > Hi, Eric, > >> On 12/1/22 17:25, Peter Xu wrote: >>> It seems not super clear on when iova_tree is used, and why. Add a rich >>> comment

Re: [PATCH] intel-iommu: Document iova_tree

2022-12-06 Thread Eric Auger
Hi Peter, On 12/6/22 00:28, Peter Xu wrote: > On Mon, Dec 05, 2022 at 12:23:20PM +0800, Jason Wang wrote: >> On Fri, Dec 2, 2022 at 12:25 AM Peter Xu wrote: >>> It seems not super clear on when iova_tree is used, and why. Add a rich >>> comment above iova_tree to track why we needed the iova_tree

Re: [PATCH 1/3] intel-iommu: fail MAP notifier without caching mode

2022-12-06 Thread Eric Auger
silently. > > Signed-off-by: Jason Wang Reviewed-by: Eric Auger Thanks Eric > --- > hw/i386/intel_iommu.c | 7 +++ > 1 file changed, 7 insertions(+) > > diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c > index a08ee85edf..9143376677 100644 > ---

Re: [PATCH 2/3] intel-iommu: fail DEVIOTLB_UNMAP without dt mode

2022-12-06 Thread Eric Auger
y? While thinking about those error handlings (including the SMMU ones) nothing should really prevent you from registering a notifier that is not signalled. Maybe we should add in the documentation that any attempt to register an IOMMU notifier to an IOMMU MR that is not able to signal it

Re: [PATCH] intel-iommu: Document iova_tree

2022-12-06 Thread Eric Auger
On 12/6/22 17:05, Peter Xu wrote: > On Tue, Dec 06, 2022 at 02:16:32PM +0100, Eric Auger wrote: >> Hi Peter, >> On 12/6/22 00:28, Peter Xu wrote: >>> On Mon, Dec 05, 2022 at 12:23:20PM +0800, Jason Wang wrote: >>>> On Fri, Dec 2, 2022 at 12:25 AM Peter Xu w

Re: [PATCH 1/2] hw/arm/virt: Improve address assignment for highmem IO regions

2022-08-02 Thread Eric Auger
Hi Gavin, On 8/2/22 08:45, Gavin Shan wrote: > There are 3 highmem IO regions as below. They can be disabled in > two situations: (a) The specific region is disabled by user. (b) > The specific region doesn't fit in the PA space. However, the base > address and highest_gpa are still updated no mat

Re: [PATCH 2/2] hw/arm/virt: Warn when high memory region is disabled

2022-08-02 Thread Eric Auger
Hi Gavin, On 8/2/22 08:45, Gavin Shan wrote: > When one specific high memory region is disabled due to the PA > limit, it'd better to warn user about that. The warning messages > help to identify the cause in some cases. For example, PCIe device > that has large MMIO bar, to be covered by PCIE_MMI

Re: [PATCH 1/2] hw/arm/virt: Improve address assignment for highmem IO regions

2022-08-03 Thread Eric Auger
Hi, On 8/3/22 09:01, Marc Zyngier wrote: > On Wed, 03 Aug 2022 04:01:04 +0100, > Gavin Shan wrote: >> Hi Eric, >> >> On 8/2/22 7:41 PM, Eric Auger wrote: >>> On 8/2/22 08:45, Gavin Shan wrote: >>>> There are 3 highmem IO regions as below. They ca

Re: [PATCH 1/2] hw/arm/virt: Improve address assignment for highmem IO regions

2022-08-03 Thread Eric Auger
Hi Gavin, On 8/3/22 05:01, Gavin Shan wrote: > Hi Eric, > > On 8/2/22 7:41 PM, Eric Auger wrote: >> On 8/2/22 08:45, Gavin Shan wrote: >>> There are 3 highmem IO regions as below. They can be disabled in >>> two situations: (a) The specific region is disabled by

Re: [PATCH 1/2] hw/arm/virt: Improve address assignment for highmem IO regions

2022-08-03 Thread Eric Auger
Hi, On 8/3/22 15:02, Gavin Shan wrote: > Hi Marc, > > On 8/3/22 5:01 PM, Marc Zyngier wrote: >> On Wed, 03 Aug 2022 04:01:04 +0100, >> Gavin Shan wrote: >>> On 8/2/22 7:41 PM, Eric Auger wrote: >>>> On 8/2/22 08:45, Gavin Shan wrote: >>>>

Re: [PATCH 1/2] hw/arm/virt: Improve address assignment for highmem IO regions

2022-08-04 Thread Eric Auger
On 8/4/22 04:47, Gavin Shan wrote: > Hi Eric, > > On 8/3/22 10:52 PM, Eric Auger wrote: >> On 8/3/22 15:02, Gavin Shan wrote: >>> On 8/3/22 5:01 PM, Marc Zyngier wrote: >>>> On Wed, 03 Aug 2022 04:01:04 +0100, >>>> Gavin Shan wrote: >>>

Re: [PATCH 1/2] hw/arm/virt: Improve address assignment for highmem IO regions

2022-08-05 Thread Eric Auger
Hi Gavin, On 8/5/22 10:36, Gavin Shan wrote: > Hi Eric, > > On 8/4/22 5:19 PM, Eric Auger wrote: >> On 8/4/22 04:47, Gavin Shan wrote: >>> On 8/3/22 10:52 PM, Eric Auger wrote: >>>> On 8/3/22 15:02, Gavin Shan wrote: >>>>> On 8/3/22 5:01 PM, Marc

[PATCH for-8.1] virtio-iommu: Standardize granule extraction and formatting

2023-07-18 Thread Eric Auger
a new mask being null. So if Coverity complains round those ctz64/BIT_ULL with CID 1517772 this is a false positive Signed-off-by: Eric Auger Fixes: 94df5b2180 ("virtio-iommu: Fix 64kB host page size VFIO device assignment") --- hw/virtio/virtio-iommu.c | 8 +--- 1 file changed, 5 i

[PATCH v5 1/3] qdev: Add a granule_mode property

2024-02-26 Thread Eric Auger
Introduce a new enum type property allowing to set an IOMMU granule. Values are 4k, 8k, 16k, 64k and host. This latter indicates the vIOMMU granule will match the host page size. A subsequent patch will add such a property to the virtio-iommu device. Signed-off-by: Eric Auger Signed-off-by

[PATCH v5 0/3] VIRTIO-IOMMU: Set default granule to host page size

2024-02-26 Thread Eric Auger
History: v4 -> v5: - use -(n * KiB) (Philippe) - remove code that can be automatically generated and add the new enum in qapi/virtio.json (Philippe). - Improve commit msg on last patch and collected Philippe's R-b v3 -> v4: - Add 8K granule (Richard) v2 -> v3 - introduce a dedicated g

[PATCH v5 3/3] virtio-iommu: Change the default granule to the host page size

2024-02-26 Thread Eric Auger
granule. But until we get this upgraded, this new default is probably better because I don't think anyone is currently interested in running a 4KB page size guest with virtio-iommu on a 64KB host. However supporting 64kB guest on 64kB host with virtio-iommu and VFIO looks a more important

[PATCH v5 2/3] virtio-iommu: Add a granule property

2024-02-26 Thread Eric Auger
This allows to choose which granule will be used by default by the virtio-iommu. Current page size mask default is qemu_target_page_mask so this translates into a 4K granule. Signed-off-by: Eric Auger --- v4 -> v5: - use -(n * KiB) (Phild) v3 -> v4: - granule_mode introduction moved t

[PATCH v6 0/3] VIRTIO-IOMMU: Set default granule to host page size

2024-02-27 Thread Eric Auger
pe's R-b v3 -> v4: - Add 8K granule (Richard) v2 -> v3 - introduce a dedicated granule option to handle the compat Eric Auger (3): qdev: Add a granule_mode property virtio-iommu: Add a granule property virtio-iommu: Change the default granule to the host page size qapi/virti

[PATCH v6 1/3] qdev: Add a granule_mode property

2024-02-27 Thread Eric Auger
Introduce a new enum type property allowing to set an IOMMU granule. Values are 4k, 8k, 16k, 64k and host. This latter indicates the vIOMMU granule will match the host page size. A subsequent patch will add such a property to the virtio-iommu device. Signed-off-by: Eric Auger Signed-off-by

[PATCH v6 2/3] virtio-iommu: Add a granule property

2024-02-27 Thread Eric Auger
This allows to choose which granule will be used by default by the virtio-iommu. Current page size mask default is qemu_target_page_mask so this translates into a 4K granule. Signed-off-by: Eric Auger Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Zhenzhong Duan --- v4 -> v5: - use

[PATCH v6 3/3] virtio-iommu: Change the default granule to the host page size

2024-02-27 Thread Eric Auger
granule. But until we get this upgraded, this new default is probably better because I don't think anyone is currently interested in running a 4KB page size guest with virtio-iommu on a 64KB host. However supporting 64kB guest on 64kB host with virtio-iommu and VFIO looks a more important

Re: [PATCH rfcv2 14/18] intel_iommu: Add a framework to check and sync host IOMMU cap/ecap

2024-02-27 Thread Eric Auger
Hi Zhenzhong, On 2/26/24 08:36, Duan, Zhenzhong wrote: > >> -Original Message- >> From: Eric Auger >> Subject: Re: [PATCH rfcv2 14/18] intel_iommu: Add a framework to check >> and sync host IOMMU cap/ecap >> >> >> >> On 2/1/24 08:28, Zh

Re: [PATCH v5 3/4] hw: Set virtio-iommu aw-bits default value on pc_q35 and arm virt

2024-02-27 Thread Eric Auger
Hi Cédric, On 2/27/24 18:17, Cédric Le Goater wrote: > Hello Eric, > > On 2/15/24 09:42, Eric Auger wrote: >> Currently the default input range can extend to 64 bits. On x86, >> when the virtio-iommu protects vfio devices, the physical iommu >> may support only 39 bit

Re: [PATCH v5 3/4] hw: Set virtio-iommu aw-bits default value on pc_q35 and arm virt

2024-02-27 Thread Eric Auger
Hi, On 2/27/24 18:17, Cédric Le Goater wrote: > Hello Eric, > > On 2/15/24 09:42, Eric Auger wrote: >> Currently the default input range can extend to 64 bits. On x86, >> when the virtio-iommu protects vfio devices, the physical iommu >> may support only 39 bits. Let&

Re: [PATCH v5 3/4] hw: Set virtio-iommu aw-bits default value on pc_q35 and arm virt

2024-03-04 Thread Eric Auger
Hi Igor, On 2/29/24 10:20, Igor Mammedov wrote: > On Thu, 15 Feb 2024 09:42:13 +0100 > Eric Auger wrote: > >> Currently the default input range can extend to 64 bits. On x86, >> when the virtio-iommu protects vfio devices, the physical iommu >> may support only 39 bit

[PATCH v6 3/9] virtio-iommu: Change the default granule to the host page size

2024-03-05 Thread Eric Auger
granule. But until we get this upgraded, this new default is probably better because I don't think anyone is currently interested in running a 4KB page size guest with virtio-iommu on a 64KB host. However supporting 64kB guest on 64kB host with virtio-iommu and VFIO looks a more important

[PATCH v6 2/9] virtio-iommu: Add a granule property

2024-03-05 Thread Eric Auger
This allows to choose which granule will be used by default by the virtio-iommu. Current page size mask default is qemu_target_page_mask so this translates into a 4k granule on ARM and x86_64 where virtio-iommu is supported. Signed-off-by: Eric Auger Reviewed-by: Philippe Mathieu-Daudé Reviewed

[PATCH v6 6/9] virtio-iommu: Add an option to define the input range width

2024-03-05 Thread Eric Auger
aw-bits is a new option that allows to set the bit width of the input address range. This value will be used as a default for the device config input_range.end. By default it is set to 64 bits which is the current value. Signed-off-by: Eric Auger Reviewed-by: Zhenzhong Duan Reviewed-by: Cédric

[PATCH v6 9/9] qemu-options.hx: Document the virtio-iommu-pci aw-bits option

2024-03-05 Thread Eric Auger
Document the new aw-bits option. Signed-off-by: Eric Auger Reviewed-by: Cédric Le Goater --- v4 -> v5 - tweek the aw-bits option description according to Cédric's suggestion --- qemu-options.hx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qemu-options.hx b/qemu-options.

[PATCH v6 5/9] virtio-iommu: Trace domain range limits as unsigned int

2024-03-05 Thread Eric Auger
Use %u format to trace domain_range limits. Signed-off-by: Eric Auger Reviewed-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater --- hw/virtio/trace-events | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events index 77905d1994

[PATCH v6 1/9] qdev: Add a granule_mode property

2024-03-05 Thread Eric Auger
Introduce a new enum type property allowing to set an IOMMU granule. Values are 4k, 8k, 16k, 64k and host. This latter indicates the vIOMMU granule will match the host page size. A subsequent patch will add such a property to the virtio-iommu device. Signed-off-by: Eric Auger Signed-off-by

[PATCH v6 0/9] VIRTIO-IOMMU: Introduce aw-bits and granule options

2024-03-05 Thread Eric Auger
r instance on VTD). New default usually match the host HW capability. For more details please see the cover letter of [1] and [2]. This series can be found at: https://github.com/eauger/qemu/tree/granule_aw_bits_v4 Eric Auger (9): qdev: Add a granule_mode property virtio-iommu: Add

[PATCH v6 4/9] qemu-options.hx: Document the virtio-iommu-pci granule option

2024-03-05 Thread Eric Auger
We are missing an entry for the virtio-iommu-pci device. Add the information on which machine it is currently supported and document the new granule option. Signed-off-by: Eric Auger --- qemu-options.hx | 8 1 file changed, 8 insertions(+) diff --git a/qemu-options.hx b/qemu

[PATCH v6 7/9] hw/i386/q35: Set virtio-iommu aw-bits default value to 39

2024-03-05 Thread Eric Auger
used to have a virtio-iommu default input range of 64 bits. Of course if aw-bits is set from the command line, the default is overriden. Signed-off-by: Eric Auger --- v5 -> v6: - split pc/arm settings v3 -> v4: - update the qos test to relax the check on the max input IOVA v2 -> v

[PATCH v6 8/9] hw/arm/virt: Set virtio-iommu aw-bits default value to 48

2024-03-05 Thread Eric Auger
On ARM we set 48b as a default (matching SMMUv3 SMMU_IDR5.VAX == 0). hw_compat_8_2 is used to handle the compatibility for machine types before 9.0 (default was 64 bits). Signed-off-by: Eric Auger --- hw/arm/virt.c | 17 + 1 file changed, 17 insertions(+) diff --git a/hw/arm

Re: [PATCH v6 7/9] hw/i386/q35: Set virtio-iommu aw-bits default value to 39

2024-03-06 Thread Eric Auger
Hi Zhenzhong, On 3/6/24 04:15, Duan, Zhenzhong wrote: > Hi Eric, > >> -Original Message----- >> From: Eric Auger >> Subject: [PATCH v6 7/9] hw/i386/q35: Set virtio-iommu aw-bits default >> value to 39 >> >> Currently the default input range can ext

Re: [PATCH v6 8/9] hw/arm/virt: Set virtio-iommu aw-bits default value to 48

2024-03-06 Thread Eric Auger
On 3/6/24 04:25, Duan, Zhenzhong wrote: > >> -Original Message- >> From: Eric Auger >> Subject: [PATCH v6 8/9] hw/arm/virt: Set virtio-iommu aw-bits default value >> to 48 >> >> On ARM we set 48b as a default (matching SMMUv3 SMMU_IDR5.VAX == 0)

[PATCH v7 8/9] hw/arm/virt: Set virtio-iommu aw-bits default value to 48

2024-03-06 Thread Eric Auger
On ARM we set 48b as a default (matching SMMUv3 SMMU_IDR5.VAX == 0). hw_compat_8_2 is used to handle the compatibility for machine types before 9.0 (default was 64 bits). Signed-off-by: Eric Auger Reviewed-by: Zhenzhong Duan --- v6 -> v7 turn arm_virt_compat and arm_virt_compat_len sta

[PATCH v7 1/9] qdev: Add a granule_mode property

2024-03-06 Thread Eric Auger
Introduce a new enum type property allowing to set an IOMMU granule. Values are 4k, 8k, 16k, 64k and host. This latter indicates the vIOMMU granule will match the host page size. A subsequent patch will add such a property to the virtio-iommu device. Signed-off-by: Eric Auger Signed-off-by

[PATCH v7 5/9] virtio-iommu: Trace domain range limits as unsigned int

2024-03-06 Thread Eric Auger
Use %u format to trace domain_range limits. Signed-off-by: Eric Auger Reviewed-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater --- hw/virtio/trace-events | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events index 77905d1994

[PATCH v7 2/9] virtio-iommu: Add a granule property

2024-03-06 Thread Eric Auger
This allows to choose which granule will be used by default by the virtio-iommu. Current page size mask default is qemu_target_page_mask so this translates into a 4k granule on ARM and x86_64 where virtio-iommu is supported. Signed-off-by: Eric Auger Reviewed-by: Philippe Mathieu-Daudé Reviewed

[PATCH v7 4/9] qemu-options.hx: Document the virtio-iommu-pci granule option

2024-03-06 Thread Eric Auger
We are missing an entry for the virtio-iommu-pci device. Add the information on which machine it is currently supported and document the new granule option. Signed-off-by: Eric Auger --- qemu-options.hx | 8 1 file changed, 8 insertions(+) diff --git a/qemu-options.hx b/qemu

[PATCH v7 7/9] hw/i386/q35: Set virtio-iommu aw-bits default value to 39

2024-03-06 Thread Eric Auger
used to have a virtio-iommu default input range of 64 bits. Of course if aw-bits is set from the command line, the default is overriden. Signed-off-by: Eric Auger --- v6 -> v7: - use static pc_q35_compat_defaults - remove spurious header addition - s/32/UINT32_MAX in the qtest v5 -> v6:

[PATCH v7 6/9] virtio-iommu: Add an option to define the input range width

2024-03-06 Thread Eric Auger
aw-bits is a new option that allows to set the bit width of the input address range. This value will be used as a default for the device config input_range.end. By default it is set to 64 bits which is the current value. Signed-off-by: Eric Auger Reviewed-by: Zhenzhong Duan Reviewed-by: Cédric

[PATCH v7 9/9] qemu-options.hx: Document the virtio-iommu-pci aw-bits option

2024-03-06 Thread Eric Auger
Document the new aw-bits option. Signed-off-by: Eric Auger Reviewed-by: Cédric Le Goater --- v4 -> v5 - tweek the aw-bits option description according to Cédric's suggestion --- qemu-options.hx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qemu-options.hx b/qemu-options.

[PATCH v7 3/9] virtio-iommu: Change the default granule to the host page size

2024-03-06 Thread Eric Auger
granule. But until we get this upgraded, this new default is probably better because I don't think anyone is currently interested in running a 4KB page size guest with virtio-iommu on a 64KB host. However supporting 64kB guest on 64kB host with virtio-iommu and VFIO looks a more important

[PATCH v7 0/9] VIRTIO-IOMMU: Introduce aw-bits and granule options

2024-03-06 Thread Eric Auger
r instance on VTD). New default usually match the host HW capability. For more details please see the cover letter of [1] and [2]. This series can be found at: https://github.com/eauger/qemu/tree/granule_aw_bits_v7 History: v6 -> v7: - Made property static in virt and pc_q35. Fix qtest 32

Re: [PATCH v7 4/9] qemu-options.hx: Document the virtio-iommu-pci granule option

2024-03-06 Thread Eric Auger
Hi Philippe, On 3/6/24 21:44, Philippe Mathieu-Daudé wrote: > On 6/3/24 21:32, Eric Auger wrote: >> We are missing an entry for the virtio-iommu-pci device. Add the >> information on which machine it is currently supported and document >> the new granule option. >> &

Re: [PATCH v7 6/9] virtio-iommu: Add an option to define the input range width

2024-03-06 Thread Eric Auger
On 3/6/24 21:45, Philippe Mathieu-Daudé wrote: > On 6/3/24 21:32, Eric Auger wrote: >> aw-bits is a new option that allows to set the bit width of >> the input address range. This value will be used as a default for >> the device config input_range.end. By default it is se

Re: [PATCH v7 9/9] qemu-options.hx: Document the virtio-iommu-pci aw-bits option

2024-03-06 Thread Eric Auger
On 3/6/24 21:48, Philippe Mathieu-Daudé wrote: > On 6/3/24 21:32, Eric Auger wrote: >> Document the new aw-bits option. >> >> Signed-off-by: Eric Auger >> Reviewed-by: Cédric Le Goater >> >> --- >> >> v4 -> v5 >> - tweek the aw-bi

Re: [PATCH v4 16/25] vfio: Add Error** argument to .set_dirty_page_tracking() handler

2024-03-07 Thread Eric Auger
Hi Cédric, On 3/6/24 14:34, Cédric Le Goater wrote: > We will use the Error object to improve error reporting in the > .log_global*() handlers of VFIO. Add documentation while at it. > > Reviewed-by: Philippe Mathieu-Daudé > Signed-off-by: Cédric Le Goater > --- > > Changes in v3: > > - Use

Re: [PATCH v4 17/25] vfio: Add Error** argument to vfio_devices_dma_logging_start()

2024-03-07 Thread Eric Auger
Hi Cédric, On 3/6/24 14:34, Cédric Le Goater wrote: > This allows to update the Error argument of the VFIO log_global_start() > handler. Errors detected when device level logging is started will be > propagated up to qemu_savevm_state_setup() when the ram save_setup() > handler is executed. > > T

Re: [PATCH v4 18/25] vfio: Add Error** argument to vfio_devices_dma_logging_stop()

2024-03-07 Thread Eric Auger
On 3/6/24 14:34, Cédric Le Goater wrote: > This improves error reporting in the log_global_stop() VFIO handler. > > Reviewed-by: Philippe Mathieu-Daudé > Signed-off-by: Cédric Le Goater > --- > > Changes in v4: > > - Dropped log_global_stop() and log_global_sync() changes > > Changes

Re: [PATCH v4 19/25] vfio: Use new Error** argument in vfio_save_setup()

2024-03-07 Thread Eric Auger
Hi Cédric, On 3/6/24 14:34, Cédric Le Goater wrote: > Add an Error** argument to vfio_migration_set_state() and adjust > callers, including vfio_save_setup(). The error will be propagated up > to qemu_savevm_state_setup() where the save_setup() handler is > executed. > > Modify vfio_vmstate_chang

Re: [PATCH v4 20/25] vfio: Add Error** argument to .vfio_save_config() handler

2024-03-07 Thread Eric Auger
On 3/6/24 14:34, Cédric Le Goater wrote: > Use vmstate_save_state_with_err() to improve error reporting in the > callers and store a reported error under the migration stream. Add > documentation while at it. > > Reviewed-by: Philippe Mathieu-Daudé > Signed-off-by: Cédric Le Goater > --- > i

Re: [PATCH v4 23/25] vfio: Add Error** argument to .get_dirty_bitmap() handler

2024-03-07 Thread Eric Auger
On 3/6/24 14:34, Cédric Le Goater wrote: > Let the callers do the error reporting. Add documentation while at it. > > Signed-off-by: Cédric Le Goater > --- > include/hw/vfio/vfio-common.h | 4 +- > include/hw/vfio/vfio-container-base.h | 17 +++- > hw/vfio/common.c

Re: [PATCH v4 24/25] vfio: Also trace event failures in vfio_save_complete_precopy()

2024-03-07 Thread Eric Auger
On 3/6/24 14:34, Cédric Le Goater wrote: > vfio_save_complete_precopy() currently returns before doing the trace > event. Change that. > > Signed-off-by: Cédric Le Goater > --- > hw/vfio/migration.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/hw/vfio/migration.c b/hw/vfio/migr

Re: [PATCH v4 25/25] vfio: Extend vfio_set_migration_error() with Error* argument

2024-03-07 Thread Eric Auger
Hi Cédric, On 3/6/24 14:34, Cédric Le Goater wrote: > vfio_set_migration_error() sets the 'return' error on the migration > stream if a migration is in progress. To improve error reporting, add > a new Error* argument to also set the Error object on the migration > stream, if a migration is progre

Re: [PATCH v4 06/25] vfio: Always report an error in vfio_save_setup()

2024-03-07 Thread Eric Auger
: Cédric Le Goater Reviewed-by: Eric Auger Eric > --- > > Changes in v4: > > - Fixed state name printed out in error returned by vfio_save_setup() > - Fixed test on error returned by qemu_file_get_error() > > hw/vfio/migration.c | 15 --- >

Re: [PATCH v7 4/9] qemu-options.hx: Document the virtio-iommu-pci granule option

2024-03-07 Thread Eric Auger
On 3/7/24 11:21, Philippe Mathieu-Daudé wrote: > On 7/3/24 08:32, Eric Auger wrote: >> Hi Philippe, >> >> On 3/6/24 21:44, Philippe Mathieu-Daudé wrote: >>> On 6/3/24 21:32, Eric Auger wrote: >>>> We are missing an entry for the virtio-iommu-pci device.

[PATCH v8 1/9] qdev: Add a granule_mode property

2024-03-07 Thread Eric Auger
Introduce a new enum type property allowing to set an IOMMU granule. Values are 4k, 8k, 16k, 64k and host. This latter indicates the vIOMMU granule will match the host page size. A subsequent patch will add such a property to the virtio-iommu device. Signed-off-by: Eric Auger Signed-off-by

[PATCH v8 6/9] virtio-iommu: Add an option to define the input range width

2024-03-07 Thread Eric Auger
aw-bits is a new option that allows to set the bit width of the input address range. This value will be used as a default for the device config input_range.end. By default it is set to 64 bits which is the current value. Signed-off-by: Eric Auger Reviewed-by: Zhenzhong Duan Reviewed-by: Cédric

[PATCH v8 2/9] virtio-iommu: Add a granule property

2024-03-07 Thread Eric Auger
This allows to choose which granule will be used by default by the virtio-iommu. Current page size mask default is qemu_target_page_mask so this translates into a 4k granule on ARM and x86_64 where virtio-iommu is supported. Signed-off-by: Eric Auger Reviewed-by: Philippe Mathieu-Daudé Reviewed

[PATCH v8 7/9] hw/i386/q35: Set virtio-iommu aw-bits default value to 39

2024-03-07 Thread Eric Auger
used to have a virtio-iommu default input range of 64 bits. Of course if aw-bits is set from the command line, the default is overriden. Signed-off-by: Eric Auger --- v6 -> v7: - use static pc_q35_compat_defaults - remove spurious header addition - s/32/UINT32_MAX in the qtest v5 -> v6:

[PATCH v8 4/9] qemu-options.hx: Document the virtio-iommu-pci granule option

2024-03-07 Thread Eric Auger
We are missing an entry for the virtio-iommu-pci device. Add the information on which machine it is currently supported and document the new granule option. Signed-off-by: Eric Auger --- v7 -> v8 - precise x86_64 and ARM --- qemu-options.hx | 8 1 file changed, 8 insertions(+) d

[PATCH v8 0/9] VIRTIO-IOMMU: Introduce aw-bits and granule options

2024-03-07 Thread Eric Auger
bad aw-bits, doc improvement v6 -> v7: - Made property static in virt and pc_q35. Fix qtest 32 limit. Eric Auger (9): qdev: Add a granule_mode property virtio-iommu: Add a granule property virtio-iommu: Change the default granule to the host page size qemu-options.hx: Document the virtio-iom

[PATCH v8 5/9] virtio-iommu: Trace domain range limits as unsigned int

2024-03-07 Thread Eric Auger
Use %u format to trace domain_range limits. Signed-off-by: Eric Auger Reviewed-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater --- hw/virtio/trace-events | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events index 77905d1994

[PATCH v8 9/9] qemu-options.hx: Document the virtio-iommu-pci aw-bits option

2024-03-07 Thread Eric Auger
Document the new aw-bits option. Signed-off-by: Eric Auger --- v7 -> v8: - remove "it defaults" - removed Cedric's R-b v4 -> v5 - tweek the aw-bits option description according to Cédric's suggestion --- qemu-options.hx | 3 +++ 1 file changed, 3 insertions(+) di

[PATCH v8 3/9] virtio-iommu: Change the default granule to the host page size

2024-03-07 Thread Eric Auger
granule. But until we get this upgraded, this new default is probably better because I don't think anyone is currently interested in running a 4KB page size guest with virtio-iommu on a 64KB host. However supporting 64kB guest on 64kB host with virtio-iommu and VFIO looks a more important

[PATCH v8 8/9] hw/arm/virt: Set virtio-iommu aw-bits default value to 48

2024-03-07 Thread Eric Auger
On ARM we set 48b as a default (matching SMMUv3 SMMU_IDR5.VAX == 0). hw_compat_8_2 is used to handle the compatibility for machine types before 9.0 (default was 64 bits). Signed-off-by: Eric Auger Reviewed-by: Zhenzhong Duan --- v6 -> v7 turn arm_virt_compat and arm_virt_compat_len sta

[PATCH v4 0/4] VIRTIO-IOMMU: Introduce an aw-bits option

2024-02-13 Thread Eric Auger
object_property_get_uint() call (Cédric) - use VTD_HOST_AW_39BIT (Cédric) v1 -> v2 - Limit aw to 48b on ARM - Check aw is within [32,64] - Use hw_compat_8_2 Eric Auger (4): virtio-iommu: Add an option to define the input range width virtio-iommu: Trace domain range limits as unsigned int

[PATCH v4 2/4] virtio-iommu: Trace domain range limits as unsigned int

2024-02-13 Thread Eric Auger
Use %u format to trace domain_range limits. Signed-off-by: Eric Auger Reviewed-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater --- hw/virtio/trace-events | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events index 77905d1994

[PATCH v4 3/4] hw: Set virtio-iommu aw-bits default value on pc_q35 and arm virt

2024-02-13 Thread Eric Auger
e use hw_compat_8_2 to handle the compatibility for machines before 9.0 which used to have a virtio-iommu default input range of 64 bits. Of course if aw-bits is set from the command line, the default is overriden. Signed-off-by: Eric Auger Reviewed-by: Zhenzhong Duan Tested-by: Yanghang Liu --- v3

[PATCH v4 4/4] qemu-options.hx: Add an entry for virtio-iommu-pci and document aw-bits

2024-02-13 Thread Eric Auger
We are missing an entry for the virtio-iommu-pci device. Add the information on which machine it is currently supported and document the new aw-bits option. Signed-off-by: Eric Auger --- qemu-options.hx | 8 1 file changed, 8 insertions(+) diff --git a/qemu-options.hx b/qemu

[PATCH v4 1/4] virtio-iommu: Add an option to define the input range width

2024-02-13 Thread Eric Auger
aw-bits is a new option that allows to set the bit width of the input address range. This value will be used as a default for the device config input_range.end. By default it is set to 64 bits which is the current value. Signed-off-by: Eric Auger Reviewed-by: Zhenzhong Duan Reviewed-by: Cédric

Re: [PATCH v2] hw/arm/smmuv3: add support for stage 1 access fault

2024-02-14 Thread Eric Auger
static int decode_cd(SMMUTransCfg *cfg, CD *cd, > SMMUEventInfo *event) > > cfg->oas = oas2bits(CD_IPS(cd)); > cfg->oas = MIN(oas2bits(SMMU_IDR5_OAS), cfg->oas); > cfg->tbi = CD_TBI(cd); > cfg->asid = CD_ASID(cd); > +cfg->affd = CD_AFFD(cd); > > trace_smmuv3_decode_cd(cfg->oas); > > /* decode data dependent on TT */ > for (i = 0; i <= 1; i++) { Besides, looks good to me Reviewed-by: Eric Auger Eric

[PATCH v5 4/4] qemu-options.hx: Add an entry for virtio-iommu-pci and document aw-bits

2024-02-15 Thread Eric Auger
We are missing an entry for the virtio-iommu-pci device. Add the information on which machine it is currently supported and document the new aw-bits option. Signed-off-by: Eric Auger --- v4 -> v5 - tweek the aw-bits option description according to Cédric's suggestion --- qemu-option

[PATCH v5 3/4] hw: Set virtio-iommu aw-bits default value on pc_q35 and arm virt

2024-02-15 Thread Eric Auger
e use hw_compat_8_2 to handle the compatibility for machines before 9.0 which used to have a virtio-iommu default input range of 64 bits. Of course if aw-bits is set from the command line, the default is overriden. Signed-off-by: Eric Auger Reviewed-by: Zhenzhong Duan Tested-by: Yanghang Liu --- v3

[PATCH v5 0/4] VIRTIO-IOMMU: Introduce an aw-bits option

2024-02-15 Thread Eric Auger
on object_property_get_uint() call (Cédric) - use VTD_HOST_AW_39BIT (Cédric) v1 -> v2 - Limit aw to 48b on ARM - Check aw is within [32,64] - Use hw_compat_8_2 Eric Auger (4): virtio-iommu: Add an option to define the input range width virtio-iommu: Trace domain range limits as unsigned int

[PATCH v5 1/4] virtio-iommu: Add an option to define the input range width

2024-02-15 Thread Eric Auger
aw-bits is a new option that allows to set the bit width of the input address range. This value will be used as a default for the device config input_range.end. By default it is set to 64 bits which is the current value. Signed-off-by: Eric Auger Reviewed-by: Zhenzhong Duan Reviewed-by: Cédric

[PATCH v5 2/4] virtio-iommu: Trace domain range limits as unsigned int

2024-02-15 Thread Eric Auger
Use %u format to trace domain_range limits. Signed-off-by: Eric Auger Reviewed-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater --- hw/virtio/trace-events | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events index 77905d1994

Re: [PATCH v6] arm/kvm: Enable support for KVM_ARM_VCPU_PMU_V3_FILTER

2024-02-15 Thread Eric Auger
Hi Shaoqin, On 2/1/24 09:51, Shaoqin Huang wrote: > The KVM_ARM_VCPU_PMU_V3_FILTER provides the ability to let the VMM decide > which PMU events are provided to the guest. Add a new option > `kvm-pmu-filter` as -cpu sub-option to set the PMU Event Filtering. > Without the filter, all PMU events ar

Re: [PATCH v5 4/4] qemu-options.hx: Add an entry for virtio-iommu-pci and document aw-bits

2024-02-15 Thread Eric Auger
On 2/15/24 09:42, Eric Auger wrote: > We are missing an entry for the virtio-iommu-pci device. Add the > information on which machine it is currently supported and document > the new aw-bits option. > > Signed-off-by: Eric Auger argh forgot to add Cédric R-b collected on

Re: [PATCH RFCv2 0/8] vfio/iommufd: IOMMUFD Dirty Tracking

2024-02-15 Thread Eric Auger
Hi, On 2/14/24 17:25, Joao Martins wrote: > On 14/02/2024 15:40, Cédric Le Goater wrote: >> Hello Joao, >> >> On 2/13/24 12:59, Joao Martins wrote: >>> On 12/02/2024 13:56, Joao Martins wrote: This small series adds support for Dirty Tracking in IOMMUFD backend. The sole reason I still m

Re: [PATCH rfcv2 04/18] vfio: Add host iommu device instance into VFIODevice

2024-02-19 Thread Eric Auger
Hi Zhenzhong, On 2/1/24 08:28, Zhenzhong Duan wrote: > Either IOMMULegacyDevice or IOMMUFDDevice into VFIODevice, neither > both. > > Signed-off-by: Zhenzhong Duan > --- > include/hw/vfio/vfio-common.h | 11 +++ > 1 file changed, 11 insertions(+) > > diff --git a/include/hw/vfio/vfio-com

Re: [PATCH rfcv2 04/18] vfio: Add host iommu device instance into VFIODevice

2024-02-19 Thread Eric Auger
On 2/1/24 08:28, Zhenzhong Duan wrote: > Either IOMMULegacyDevice or IOMMUFDDevice into VFIODevice, neither > both. > > Signed-off-by: Zhenzhong Duan > --- > include/hw/vfio/vfio-common.h | 11 +++ > 1 file changed, 11 insertions(+) > > diff --git a/include/hw/vfio/vfio-common.h b/incl

Re: [PATCH rfcv2 07/18] vfio/container: Implement host_iommu_device_init callback in legacy mode

2024-02-19 Thread Eric Auger
Hi Zhenzhong, On 2/1/24 08:28, Zhenzhong Duan wrote: > This callback will be used to initialize base and public elements > in IOMMULegacyDevice. > > Signed-off-by: Zhenzhong Duan > --- > hw/vfio/container.c | 7 +++ > 1 file changed, 7 insertions(+) > > diff --git a/hw/vfio/container.c b/hw/v

Re: [PATCH rfcv2 10/18] hw/pci: Introduce pci_device_set/unset_iommu_device()

2024-02-19 Thread Eric Auger
Hi Zhenzhong, On 2/1/24 08:28, Zhenzhong Duan wrote: > From: Yi Liu > > This adds pci_device_set/unset_iommu_device() to set/unset > HostIOMMUDevice for a given PCIe device. Caller of set > should fail if set operation fails. > > Extract out pci_device_get_iommu_bus_devfn() to facilitate > implem

Re: [PATCH rfcv2 11/18] intel_iommu: Add set/unset_iommu_device callback

2024-02-19 Thread Eric Auger
On 2/1/24 08:28, Zhenzhong Duan wrote: > From: Yi Liu > > This adds set/unset_iommu_device() implementation in Intel vIOMMU. > In set call, a pointer to host IOMMU device info is stored in hash > table indexed by PCI BDF. > > Signed-off-by: Yi Liu > Signed-off-by: Yi Sun > Signed-off-by: Zhen

Re: [PATCH rfcv2 14/18] intel_iommu: Add a framework to check and sync host IOMMU cap/ecap

2024-02-19 Thread Eric Auger
On 2/1/24 08:28, Zhenzhong Duan wrote: > From: Yi Liu > > Add a framework to check and synchronize host IOMMU cap/ecap with > vIOMMU cap/ecap. > > The sequence will be: > > vtd_cap_init() initializes iommu->cap/ecap. > vtd_check_hdev() update iommu->cap/ecap based on host cap/ecap. > iommu->cap

Re: [PATCH v2] virtio-iommu: Use qemu_real_host_page_mask as default page_size_mask

2024-02-21 Thread Eric Auger
On 2/21/24 12:31, Jean-Philippe Brucker wrote: > On Wed, Feb 21, 2024 at 11:41:57AM +0100, Eric Auger wrote: >> Hi, >> >> On 2/13/24 13:00, Michael S. Tsirkin wrote: >>> On Tue, Feb 13, 2024 at 12:24:22PM +0100, Eric Auger wrote: >>>> Hi Michael, >&

Re: [PATCH v2] virtio-iommu: Use qemu_real_host_page_mask as default page_size_mask

2024-02-21 Thread Eric Auger
Hi, On 2/13/24 13:00, Michael S. Tsirkin wrote: > On Tue, Feb 13, 2024 at 12:24:22PM +0100, Eric Auger wrote: >> Hi Michael, >> On 2/13/24 12:09, Michael S. Tsirkin wrote: >>> On Tue, Feb 13, 2024 at 11:32:13AM +0100, Eric Auger wrote: >>>> Do you have an o

[PATCH v3 3/3] virtio-iommu: Change the default granule to the host page size

2024-02-21 Thread Eric Auger
orting 64kB guest on 64kB host with virtio-iommu and VFIO looks a more important feature. Signed-off-by: Eric Auger --- hw/core/machine.c| 1 + hw/virtio/virtio-iommu.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 70ac9695

[PATCH v3 2/3] virtio-iommu: Add a granule property

2024-02-21 Thread Eric Auger
This allows to choose which granule will be used by default by the virtio-iommu. Current default is 4K. Signed-off-by: Eric Auger --- hw/virtio/virtio-iommu.c | 24 +--- qemu-options.hx | 3 +++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/hw

[PATCH v3 1/3] qdev: Add a granule_mode property

2024-02-21 Thread Eric Auger
Introduce a new enum type property allowing to set an IOMMU granule. Values are 4K, 16K, 64K and host. This latter indicates the vIOMMU granule will matches the host page size. A subsequent patch will add such a property to the virtio-iommu device. Signed-off-by: Eric Auger --- include/hw/qdev

[PATCH v3 0/3] VIRTIO-IOMMU: Set default granule to host page size

2024-02-21 Thread Eric Auger
ze_mask https://lore.kernel.org/all/20240117132039.332273-1-eric.au...@redhat.com/ Applied on top of [PATCH v5 0/4] VIRTIO-IOMMU: Introduce an aw-bits option https://lore.kernel.org/all/20240215084315.863897-1-eric.au...@redhat.com/ History: v2 -> v3 - introduce a dedicated granule option to handle the

Re: [PATCH v3 1/3] qdev: Add a granule_mode property

2024-02-21 Thread Eric Auger
Hi Richard, On 2/21/24 22:58, Richard Henderson wrote: > On 2/21/24 10:58, Eric Auger wrote: >> Introduce a new enum type property allowing to set an >> IOMMU granule. Values are 4K, 16K, 64K and host. This >> latter indicates the vIOMMU granule will matches the >&

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