Re: [PATCH v2 2/2] hw/i386/amd_iommu: Fix xtsup when vcpus < 255

2025-05-12 Thread Joao Martins
=on and <= 255 vCPUs is > broken as it fails to call kvm_enable_x2apic(). > > Fix this by adding back kvm_enable_x2apic() call when xtsup=on. > > Fixes: 8c6619f3e692 ("hw/i386/amd_iommu: Simplify non-KVM checks on XTSup > feature") > Reported-by: Alejandro Jimen

Re: [PATCH 00/18] AMD vIOMMU: DMA remapping support for VFIO devices

2025-04-24 Thread Joao Martins
On 23/04/2025 11:56, Sairaj Kodilkar wrote: > On 4/23/2025 4:15 PM, Sairaj Kodilkar wrote: >> On 4/14/2025 7:32 AM, Alejandro Jimenez wrote: >>> This series adds support for guests using the AMD vIOMMU to enable DMA >>> remapping for VFIO devices. In addition to the currently supported >>> passthro

Re: [PATCH v2 2/5] vfio/iommufd: Move realize() after attachment

2025-04-23 Thread Joao Martins
racking support, there > is no dependency any more, move realize() call after attachment > succeed. > > Suggested-by: Cédric Le Goater > Suggested-by: Donald Dutile > Signed-off-by: Zhenzhong Duan Reviewed-by: Joao Martins > --- > hw/vfio/iommufd.c | 17 ++

Re: [PATCH v2 1/5] vfio/iommufd: Make a separate call to get IOMMU capabilities

2025-04-23 Thread Joao Martins
g device attach, it's not a hot path. > > Suggested-by: Cédric Le Goater > Signed-off-by: Zhenzhong Duan I think this looks right now as it's placed in the auto domains path where mdevs aren't involved: Reviewed-by: Joao Martins > --- > hw/vfio/i

Re: [PATCH 1/5] vfio/iommufd: Save host iommu capabilities in VFIODevice.caps

2025-04-11 Thread Joao Martins
On 11/04/2025 11:17, Zhenzhong Duan wrote: > The saved caps copy can be used to check dirty tracking capability. > > The capabilities is gotten through IOMMUFD interface, so define a > new structure HostIOMMUDeviceIOMMUFDCaps which contains vendor > caps raw data in "include/system/iommufd.h". >

Re: [PATCH 2/2] hw/i386/amd_iommu: Fix xtsup when vcpus < 255

2025-04-10 Thread Joao Martins
quot;) > Reported-by: Alejandro Jimenez > Cc: Philippe Mathieu-Daudé > Cc: Joao Martins > Signed-off-by: Vasant Hegde Reviewed-by: Joao Martins > --- > hw/i386/amd_iommu.c | 8 > 1 file changed, 8 insertions(+) > > diff --git a/hw/i386/amd_iommu.c b

Re: [PATCH for-10.1 05/32] vfio: Make vfio_viommu_preset() static

2025-04-05 Thread Joao Martins
On 18/03/2025 09:53, Cédric Le Goater wrote: > This routine is only used in file "migration.c". Move it there. > > Signed-off-by: Cédric Le Goater Reviewed-by: Joao Martins > --- > include/hw/vfio/vfio-common.h | 1 - > hw/vfio/common.c | 6 -

Re: [PATCH for-10.1 v2 34/37] vfio: Introduce vfio_listener_un/register() routines

2025-04-05 Thread Joao Martins
On 26/03/2025 07:51, Cédric Le Goater wrote: > This hides the MemoryListener implementation and makes the code common > to both IOMMU backends, legacy and IOMMUFD. > > Signed-off-by: Cédric Le Goater Reviewed-by: Joao Martins > --- > hw/vfio/vfio-listener.h | 3 ++- >

Re: [PATCH for-10.1 28/32] vfio: Make vfio_devices_query_dirty_bitmap() static

2025-04-04 Thread Joao Martins
On 18/03/2025 09:54, Cédric Le Goater wrote: > vfio_devices_query_dirty_bitmap() is only used in "dirty-tracking.c". > > Signed-off-by: Cédric Le Goater Reviewed-by: Joao Martins > --- > hw/vfio/dirty-tracking.h | 3 --- > hw/vfio/dirty-tracking.c | 2 +- > 2 f

Re: [PATCH for-10.1 30/32] vfio: Rename VFIO dirty tracking services

2025-04-04 Thread Joao Martins
On 20/03/2025 11:45, Avihai Horon wrote: > > On 20/03/2025 13:18, Joao Martins wrote: >> External email: Use caution opening links or attachments >> >> >> On 20/03/2025 11:13, Avihai Horon wrote: >>> On 19/03/2025 14:21, Joao Martins wrote: >>&g

Re: [PATCH for-10.1 30/32] vfio: Rename VFIO dirty tracking services

2025-04-04 Thread Joao Martins
ystem:file as a C namespace. Every once and a while me and Avihai use the acronym DPT (Dirty Page Tracking) when talking about this stuff, but it seems a detour from the code style to abbreviate namespaces into acronyms. Having said that: Reviewed-by: Joao Martins P.S. We could also re

Re: [PATCH for-10.1 v2 28/37] vfio: Make vfio_container_query_dirty_bitmap() static

2025-04-02 Thread Joao Martins
ng style With that: Reviewed-by: Joao Martins Joao > --- > include/hw/vfio/vfio-container-base.h | 2 -- > hw/vfio/container-base.c | 24 > 2 files changed, 12 insertions(+), 14 deletions(-) > > diff --git a/include/hw/vfio/v

Re: [PATCH for-10.1 v2 10/37] vfio: Introduce a new header file for VFIOIOMMUFD declarations

2025-04-02 Thread Joao Martins
ommufd.h". This to reduce exposure of VFIO internals in > "hw/vfio/vfio-common.h". > > Cc: Joao Martins > Cc: Yi Liu > Reviewed-by: John Levon > Link: > https://lore.kernel.org/qemu-devel/20250318095415.670319-10-...@redhat.com > Signed-off-by: Cédric Le Goat

Re: [PATCH for-10.1 v2 32/37] vfio: Introduce new files for VFIO MemoryListener

2025-04-02 Thread Joao Martins
ociated "vfio-listener.h" header file for the declarations. > > Cleanup a little the includes while at it. > > Signed-off-by: Cédric Le Goater Reviewed-by: Joao Martins > --- > hw/vfio/vfio-listener.h | 14 ++ > include/hw/vfio/vfio-common.h

Re: [PATCH for-10.1 v2 27/37] vfio: Make vfio_devices_query_dirty_bitmap() static

2025-04-02 Thread Joao Martins
> the container's device list. > > This rename also frees the vfio_devices_query_dirty_bitmap() name > which we will reuse in the next changes. > > Signed-off-by: Cédric Le Goater Reviewed-by: Joao Martins > --- > include/hw/vfio/vfio-container-base.h | 3 --- > hw/vfi

Re: [PATCH for-10.1 v2 31/37] vfio: Rename vfio_get_dirty_bitmap()

2025-04-02 Thread Joao Martins
On 26/03/2025 07:51, Cédric Le Goater wrote: > vfio_container_query_dirty_bitmap() is consistent the VFIO container > routine naming scheme and is now free to use. > > Signed-off-by: Cédric Le Goater Reviewed-by: Joao Martins > --- > include/hw/vfio/vfio-container-base.h |

Re: [PATCH for-10.1 v2 29/37] vfio: Rename vfio_devices_all_dirty_tracking_started()

2025-04-02 Thread Joao Martins
ater Much better name indeed: Reviewed-by: Joao Martins > --- > include/hw/vfio/vfio-container-base.h | 3 ++- > hw/vfio/common.c | 2 +- > hw/vfio/container-base.c | 6 +++--- > hw/vfio/container.c | 2 +- > 4 files ch

Re: [PATCH for-10.1 v2 26/37] vfio: Move dirty tracking related services into container-base.c

2025-04-02 Thread Joao Martins
the container level > or at the container device level. Naming is a bit confusing. We will > propose new names in the following changes. > > Signed-off-by: Cédric Le Goater Reviewed-by: Joao Martins > --- > include/hw/vfio/vfio-common.h | 9 -- > include/hw/v

Re: [PATCH for-10.1 30/32] vfio: Rename VFIO dirty tracking services

2025-03-31 Thread Joao Martins
On 21/03/2025 11:22, Cédric Le Goater wrote: > On 3/19/25 13:21, Joao Martins wrote: >> On 18/03/2025 09:54, Cédric Le Goater wrote: >>> Rename these routines : >>> >>>    vfio_devices_all_device_dirty_tracking_started -> >>

Re: [PATCH for-10.1 31/32] vfio: Introduce vfio_dirty_tracking_un/register() routines

2025-03-20 Thread Joao Martins
On 19/03/2025 13:24, Joao Martins wrote: > On 18/03/2025 09:54, Cédric Le Goater wrote: >> This hides the MemoryListener implementation and makes the code common >> to both IOMMU backends, legacy and IOMMUFD. >> >> Signed-off-by: Cédric Le Goater > > Rev

Re: [PATCH for-10.1 30/32] vfio: Rename VFIO dirty tracking services

2025-03-20 Thread Joao Martins
On 20/03/2025 11:13, Avihai Horon wrote: > > On 19/03/2025 14:21, Joao Martins wrote: >> External email: Use caution opening links or attachments >> >> >> On 18/03/2025 09:54, Cédric Le Goater wrote: >>> Rename these routines : >>> >&

Re: [PATCH for-10.1 24/32] vfio: Introduce new files for dirty tracking definitions and declarations

2025-03-20 Thread Joao Martins
On 20/03/2025 09:52, Duan, Zhenzhong wrote: >> -Original Message- >> From: Cédric Le Goater >> Subject: [PATCH for-10.1 24/32] vfio: Introduce new files for dirty tracking >> definitions and declarations >> >> File "common.c" has been emptied of most of its definitions by the >> previous c

Re: [PATCH for-10.1 24/32] vfio: Introduce new files for dirty tracking definitions and declarations

2025-03-19 Thread Joao Martins
dirty-tracking.h" header file for the declarations. > > Cleanup a little the includes while at it. > > Signed-off-by: Cédric Le Goater Reviewed-by: Joao Martins > --- > hw/vfio/dirty-tracking.h | 22 ++ > include/hw/vfi

Re: [PATCH for-10.1 31/32] vfio: Introduce vfio_dirty_tracking_un/register() routines

2025-03-19 Thread Joao Martins
On 18/03/2025 09:54, Cédric Le Goater wrote: > This hides the MemoryListener implementation and makes the code common > to both IOMMU backends, legacy and IOMMUFD. > > Signed-off-by: Cédric Le Goater Reviewed-by: Joao Martins > --- > hw/vfio/dirty-tracking.h | 4 ++-- >

Re: [PATCH for-10.1 04/32] vfio: Make vfio_un/block_multiple_devices_migration() static

2025-03-19 Thread Joao Martins
On 18/03/2025 09:53, Cédric Le Goater wrote: > Both of these routines are only used in file "migration.c". Move them > there. > > Signed-off-by: Cédric Le Goater Reviewed-by: Joao Martins > --- > include/hw/vfio/vfio-common.h | 2 -- > hw/

Re: [PATCH v2] vfio: Add property documentation

2025-03-11 Thread Joao Martins
On 11/03/2025 17:43, Cédric Le Goater wrote: > On 3/11/25 17:44, Joao Martins wrote: >> On 05/03/2025 13:13, Cédric Le Goater wrote: >>> Joao, >>> >>> On 3/5/25 12:16, Joao Martins wrote: >>>> On 14/02/2025 13:05, Cédric Le Goater wrote: >>>

[PATCH] vfio/pci: Drop debug comentary from x-device-dirty-page-tracking

2025-03-11 Thread Joao Martins
hesis from the option description. Signed-off-by: Joao Martins --- hw/vfio/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 64629c13b6fb..3496a0b6b099 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -3531,7 +3531,7 @@ static

Re: [PATCH v2] vfio: Add property documentation

2025-03-11 Thread Joao Martins
On 05/03/2025 13:13, Cédric Le Goater wrote: > Joao, > > On 3/5/25 12:16, Joao Martins wrote: >> On 14/02/2025 13:05, Cédric Le Goater wrote: >>> +Kirti >>> +Joao >>> >>> On 2/13/25 22:45, Alex Williamson wrote: &g

Re: [PATCH v4 00/15] vfio: VFIO migration support with vIOMMU

2025-03-05 Thread Joao Martins
On 08/02/2025 02:07, Zhangfei Gao wrote: > On Wed, Jan 22, 2025 at 12:43 AM Joao Martins > wrote: >> >> On 07/01/2025 06:55, Zhangfei Gao wrote: >>> Hi, Joao >>> >>> On Fri, Jun 23, 2023 at 5:51 AM Joao Martins >>> wrote: >>>>

Re: [PATCH v2] vfio: Add property documentation

2025-03-05 Thread Joao Martins
On 14/02/2025 13:05, Cédric Le Goater wrote: > +Kirti > +Joao > > On 2/13/25 22:45, Alex Williamson wrote: >>> + >>> +    /* >>> + * Migration support >>> + */ >>> +    object_class_property_set_description(klass, /* 5.2 */ >>> +  "x-pre-copy-dirty-p

Re: [PATCH] hw/i386/amd_iommu: Allow migration

2025-02-05 Thread Joao Martins
On 05/02/2025 02:45, Suthikulpanit, Suravee wrote: > > > On 11/29/2024 12:14 AM, Joao Martins wrote: >> On 21/11/2024 11:42, Joao Martins wrote:> On 20/11/2024 07:31, Suravee >> Suthikulpanit wrote: >>>> Add migration support for AMD IOMMU model by saving nece

Re: [PATCH v4 00/15] vfio: VFIO migration support with vIOMMU

2025-01-21 Thread Joao Martins
On 07/01/2025 06:55, Zhangfei Gao wrote: > Hi, Joao > > On Fri, Jun 23, 2023 at 5:51 AM Joao Martins > wrote: >> >> Hey, >> >> This series introduces support for vIOMMU with VFIO device migration, >> particurlarly related to how we do the dirty pa

Re: [PATCH v4 00/15] vfio: VFIO migration support with vIOMMU

2025-01-21 Thread Joao Martins
On 28/11/2024 18:29, Joao Martins wrote: > On 28/11/2024 03:19, Zhangfei Gao wrote: >> Hi, Joao >> >> On Fri, Jun 23, 2023 at 5:51 AM Joao Martins >> wrote: >>> >>> Hey, >>> >>> This series introduces support for vIOMMU with VFIO dev

Re: [PATCH v2 0/7] migration: Drop/unexport migration_is_device() and migration_is_active()

2024-12-23 Thread Joao Martins
On 23/12/2024 18:31, Cédric Le Goater wrote: > On 12/23/24 18:55, Joao Martins wrote: >> On 18/12/2024 13:40, Avihai Horon wrote: >>> Hello, >>> >>> This follows up on Peter's series [1] to simplify migration status API >>> to a single migration_i

Re: [PATCH v2 0/7] migration: Drop/unexport migration_is_device() and migration_is_active()

2024-12-23 Thread Joao Martins
On 18/12/2024 13:40, Avihai Horon wrote: > Hello, > > This follows up on Peter's series [1] to simplify migration status API > to a single migration_is_running() function. > > Peter's series tried to drop migration_is_device() and > migration_is_active(), however VFIO used them to check if dirty

Re: [PATCH v2 3/7] vfio/migration: Refactor vfio_devices_all_running_and_mig_active() logic

2024-12-23 Thread Joao Martins
> unmapped. > > Also rename the function to properly reflect its new logic and extract > common code from vfio_devices_all_dirty_tracking(). > > Signed-off-by: Avihai Horon Reviewed-by: Joao Martins > --- > include/hw/vfio/vfio-common.h | 4 ++-- > hw/vfio/com

Re: [PATCH v2 2/7] vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic

2024-12-23 Thread Joao Martins
o include VFIO > dirty pages. > > While at it, as VFIODevice->dirty_tracking is now used to detect dirty > tracking status, add a comment that states how it's protected. > > Signed-off-by: Avihai Horon Reviewed-by: Joao Martins > --- > include/hw/vfio/vfio-c

Re: [PATCH 3/9] vfio/migration: Refactor vfio_devices_all_running_and_mig_active() logic

2024-12-17 Thread Joao Martins
On 17/12/2024 09:38, Avihai Horon wrote: > +bool vfio_dma_unmap_dirty_sync_needed(const VFIOContainerBase > *bcontainer) >    { > -    VFIODevice *vbasedev; > - > -    if (!migration_is_active()) { > +    if (!migration_is_running()) { >    return false; >>>

Re: [PATCH 2/9] vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic

2024-12-16 Thread Joao Martins
On 16/12/2024 16:05, Joao Martins wrote: > On 16/12/2024 15:52, Joao Martins wrote: >> On 16/12/2024 14:52, Avihai Horon wrote: >>> >>> On 16/12/2024 14:32, Joao Martins wrote: >>>> External email: Use caution opening links or attachments >>>>

Re: [PATCH 0/9] migration: Drop/unexport migration_is_device() and migration_is_active()

2024-12-16 Thread Joao Martins
On 16/12/2024 17:33, Cédric Le Goater wrote: > On 12/16/24 16:37, Joao Martins wrote: >> On 16/12/2024 14:45, Avihai Horon wrote: >>> On 16/12/2024 14:00, Joao Martins wrote: >>>> On 16/12/2024 09:46, Avihai Horon wrote: >>>> I also have a much >>&g

Re: [PATCH 3/9] vfio/migration: Refactor vfio_devices_all_running_and_mig_active() logic

2024-12-16 Thread Joao Martins
On 16/12/2024 14:55, Avihai Horon wrote: > > On 16/12/2024 14:45, Joao Martins wrote: >> External email: Use caution opening links or attachments >> >> >> On 16/12/2024 09:46, Avihai Horon wrote: >>> During DMA unmap with vIOMMU, vfio_devices_all_runnin

Re: [PATCH 2/9] vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic

2024-12-16 Thread Joao Martins
On 16/12/2024 15:52, Joao Martins wrote: > On 16/12/2024 14:52, Avihai Horon wrote: >> >> On 16/12/2024 14:32, Joao Martins wrote: >>> External email: Use caution opening links or attachments >>> >>> >>> On 16/12/2024 09:46,

Re: [PATCH 2/9] vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic

2024-12-16 Thread Joao Martins
On 16/12/2024 14:52, Avihai Horon wrote: > > On 16/12/2024 14:32, Joao Martins wrote: >> External email: Use caution opening links or attachments >> >> >> On 16/12/2024 09:46, Avihai Horon wrote: >>> During dirty page log sync, vfio_devices_all_dirty_t

Re: [PATCH 0/9] migration: Drop/unexport migration_is_device() and migration_is_active()

2024-12-16 Thread Joao Martins
On 16/12/2024 14:45, Avihai Horon wrote: > On 16/12/2024 14:00, Joao Martins wrote: >> On 16/12/2024 09:46, Avihai Horon wrote: >> I also have a much >> smaller series for that sort of unblockage that I can give you a pointer. > > Yes, if you have it at hand, that could

Re: [PATCH 6/9] vfio/migration: Rename vfio_devices_all_dirty_tracking()

2024-12-16 Thread Joao Martins
_needed() which reflects its purpose > more accurately and makes the code clearer as there are already several > helpers with similar names. > Yes! :) > Signed-off-by: Avihai Horon Reviewed-by: Joao Martins > --- > hw/vfio/common.c | 4 ++-- > 1 file changed, 2 insertion

Re: [PATCH 5/9] vfio/migration: Drop vfio_dma_unmap_dirty_sync_needed()

2024-12-16 Thread Joao Martins
On 16/12/2024 09:46, Avihai Horon wrote: > There is no need for vfio_dma_unmap_dirty_sync_needed(), as it simply > calls vfio_devices_all_dirty_tracking_started(). > > Drop vfio_dma_unmap_dirty_sync_needed(), export > vfio_devices_all_dirty_tracking_started() and use it instead. > > Signed-off-by

Re: [PATCH 4/9] vfio/migration: Add vfio_devices_all_dirty_tracking_started() helper

2024-12-16 Thread Joao Martins
ned-off-by: Avihai Horon Reviewed-by: Joao Martins > --- > hw/vfio/common.c | 25 + > 1 file changed, 13 insertions(+), 12 deletions(-) > > diff --git a/hw/vfio/common.c b/hw/vfio/common.c > index 81fba81a6f..45783982c9 100644 > --- a/hw/vfio/common.

Re: [PATCH 3/9] vfio/migration: Refactor vfio_devices_all_running_and_mig_active() logic

2024-12-16 Thread Joao Martins
nst VFIOContainerBase > *bcontainer, > int ret; > Error *local_err = NULL; > > -if (iotlb && vfio_devices_all_running_and_mig_active(bcontainer)) { > +if (iotlb && vfio_dma_unmap_dirty_sync_needed(bcontainer)) { > if (!vfio_devices_all_device_dirty_tracking(bcontainer) && > bcontainer->dirty_pages_supported) { > return vfio_dma_unmap_bitmap(container, iova, size, iotlb); Reviewed-by: Joao Martins

Re: [PATCH 2/9] vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic

2024-12-16 Thread Joao Martins
On 16/12/2024 12:32, Joao Martins wrote: > On 16/12/2024 09:46, Avihai Horon wrote: >> During dirty page log sync, vfio_devices_all_dirty_tracking() is used to >> check if dirty tracking has been started in order to avoid errors. The >> current logic checks if migration i

Re: [PATCH 2/9] vfio/migration: Refactor vfio_devices_all_dirty_tracking() logic

2024-12-16 Thread Joao Martins
and migration_is_device(). Instead, > use internal VFIO dirty tracking flags. > > Signed-off-by: Avihai Horon The refactor itself is fine except a pre-existing bug: Reviewed-by: Joao Martins > --- > hw/vfio/common.c | 21 - > 1 file changed, 20 i

Re: [PATCH 1/9] vfio/container: Add dirty tracking started flag

2024-12-16 Thread Joao Martins
; > Signed-off-by: Avihai Horon Reviewed-by: Joao Martins Just a nit below, but it's optional. > --- > include/hw/vfio/vfio-container-base.h | 1 + > hw/vfio/container-base.c | 8 +++- > 2 files changed, 8 insertions(+), 1 deletion(-) > > diff --git

Re: [PATCH 0/9] migration: Drop/unexport migration_is_device() and migration_is_active()

2024-12-16 Thread Joao Martins
On 16/12/2024 09:46, Avihai Horon wrote: > Hello, > > This follows up on Peter's series [1] to simplify migration status API > to a single migration_is_running() function. > > Peter's series tried to drop migration_is_device() and > migration_is_active(), however VFIO used them to check if dirty

Re: [PATCH v4 00/15] vfio: VFIO migration support with vIOMMU

2024-11-28 Thread Joao Martins
On 28/11/2024 03:19, Zhangfei Gao wrote: > Hi, Joao > > On Fri, Jun 23, 2023 at 5:51 AM Joao Martins > wrote: >> >> Hey, >> >> This series introduces support for vIOMMU with VFIO device migration, >> particurlarly related to how we do the dirty pa

Re: [PATCH] hw/i386/amd_iommu: Allow migration

2024-11-28 Thread Joao Martins
On 21/11/2024 11:42, Joao Martins wrote:> On 20/11/2024 07:31, Suravee Suthikulpanit wrote: >> Add migration support for AMD IOMMU model by saving necessary AMDVIState >> parameters for MMIO registers, device table, command buffer, and event >> buffers. >> >> Sig

Re: [PATCH] hw/i386/amd_iommu: Allow migration

2024-11-21 Thread Joao Martins
On 20/11/2024 07:31, Suravee Suthikulpanit wrote: > Add migration support for AMD IOMMU model by saving necessary AMDVIState > parameters for MMIO registers, device table, command buffer, and event > buffers. > > Signed-off-by: Suravee Suthikulpanit > --- > hw/i386/amd_iommu.c | 36 +

Re: [PATCH] vfio/iommufd: no hw_info for mediated devices

2024-09-10 Thread Joao Martins
On 10/09/2024 18:40, Steve Sistare wrote: > IOMMU_GET_HW_INFO fails for a vfio mediated device (aka mdev), because > the devid is associated with kernel type IOMMUFD_OBJ_ACCESS, not > IOMMUFD_OBJ_DEVICE. Assume IOMMU_HW_INFO_TYPE_NONE and proceed. > > Signed-off-by: Steve Sistare > --- > hw/vf

Re: [PATCH v6 0/9] hw/iommufd: IOMMUFD Dirty Tracking

2024-07-23 Thread Joao Martins
On 23/07/2024 15:23, Yi Liu wrote: > On 2024/7/23 05:13, Joao Martins wrote: >> This small series adds support for IOMMU dirty tracking support via the >> IOMMUFD backend. The hardware capability is available on most recent x86 >> hardware (and these SMMUv3 in upcoming

Re: [PATCH v6 0/9] hw/iommufd: IOMMUFD Dirty Tracking

2024-07-23 Thread Joao Martins
On 23/07/2024 09:35, Cédric Le Goater wrote: > On 7/22/24 23:13, Joao Martins wrote: >> This small series adds support for IOMMU dirty tracking support via the >> IOMMUFD backend. The hardware capability is available on most recent x86 >> hardware (and these SMMUv3 in upcomi

Re: [PATCH v6 9/9] vfio/common: Allow disabling device dirty page tracking

2024-07-23 Thread Joao Martins
On 23/07/2024 09:31, Eric Auger wrote: > > > On 7/22/24 23:13, Joao Martins wrote: >> The property 'x-pre-copy-dirty-page-tracking' allows disabling the whole >> tracking of VF pre-copy phase of dirty page tracking, though it means >> that it will only b

Re: [PATCH v6 4/9] vfio/{iommufd,container}: Invoke HostIOMMUDevice::realize() during attach_device()

2024-07-23 Thread Joao Martins
On 23/07/2024 09:24, Eric Auger wrote: > > > On 7/23/24 10:20, Duan, Zhenzhong wrote: >> >>> -Original Message- >>> From: Joao Martins >>> Subject: Re: [PATCH v6 4/9] vfio/{iommufd,container}: Invoke >>> HostIOMMUDevice::realize() durin

Re: [PATCH v6 5/9] vfio/iommufd: Probe and request hwpt dirty tracking capability

2024-07-23 Thread Joao Martins
On 23/07/2024 09:09, Eric Auger wrote: > > > On 7/23/24 10:00, Joao Martins wrote: >> On 23/07/2024 08:50, Eric Auger wrote: >>> Hi Joao, >>> >>> On 7/22/24 23:13, Joao Martins wrote: >>>> In preparation to using the dirty tracking UAPI, prob

Re: [PATCH v6 6/9] vfio/iommufd: Implement VFIOIOMMUClass::set_dirty_tracking support

2024-07-23 Thread Joao Martins
On 23/07/2024 09:03, Eric Auger wrote: > Hi Joao, > > On 7/22/24 23:13, Joao Martins wrote: >> ioctl(iommufd, IOMMU_HWPT_SET_DIRTY_TRACKING, arg) is the UAPI that >> enables or disables dirty page tracking. The ioctl is used if the hwpt >> has been created with dirt

Re: [PATCH v6 4/9] vfio/{iommufd,container}: Invoke HostIOMMUDevice::realize() during attach_device()

2024-07-23 Thread Joao Martins
On 23/07/2024 08:55, Eric Auger wrote: > > > On 7/23/24 09:44, Cédric Le Goater wrote: >> On 7/23/24 09:38, Eric Auger wrote: >>> Hi Joao, >>> >>> On 7/22/24 23:13, Joao Martins wrote: >>>> Move the HostIOMMUDevice::realize() to be invok

Re: [PATCH v6 5/9] vfio/iommufd: Probe and request hwpt dirty tracking capability

2024-07-23 Thread Joao Martins
On 23/07/2024 08:50, Eric Auger wrote: > Hi Joao, > > On 7/22/24 23:13, Joao Martins wrote: >> In preparation to using the dirty tracking UAPI, probe whether the IOMMU >> supports dirty tracking. This is done via the data stored in >> hiod::caps::hw_caps initialized f

Re: [PATCH v6 4/9] vfio/{iommufd,container}: Invoke HostIOMMUDevice::realize() during attach_device()

2024-07-23 Thread Joao Martins
On 23/07/2024 08:38, Eric Auger wrote: > Hi Joao, > > On 7/22/24 23:13, Joao Martins wrote: >> Move the HostIOMMUDevice::realize() to be invoked during the attach of the >> device >> before we allocate IOMMUFD hardware pagetable objects (HWPT). This allows >> t

Re: [PATCH v6 5/9] vfio/iommufd: Probe and request hwpt dirty tracking capability

2024-07-22 Thread Joao Martins
On 23/07/2024 06:11, Duan, Zhenzhong wrote: > > >> -Original Message----- >> From: Joao Martins >> Subject: [PATCH v6 5/9] vfio/iommufd: Probe and request hwpt dirty >> tracking capability >> >> In preparation to using the dirty tracking UAPI,

[PATCH v6 7/9] vfio/iommufd: Implement VFIOIOMMUClass::query_dirty_bitmap support

2024-07-22 Thread Joao Martins
ioctl(iommufd, IOMMU_HWPT_GET_DIRTY_BITMAP, arg) is the UAPI that fetches the bitmap that tells what was dirty in an IOVA range. A single bitmap is allocated and used across all the hwpts sharing an IOAS which is then used in log_sync() to set Qemu global bitmaps. Signed-off-by: Joao Martins

[PATCH v6 5/9] vfio/iommufd: Probe and request hwpt dirty tracking capability

2024-07-22 Thread Joao Martins
cides to use VF dirty tracking instead. Signed-off-by: Joao Martins --- include/hw/vfio/vfio-common.h | 2 ++ hw/vfio/iommufd.c | 20 2 files changed, 22 insertions(+) diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index 4e44b26d3c4

[PATCH v6 0/9] hw/iommufd: IOMMUFD Dirty Tracking

2024-07-22 Thread Joao Martins
g/qemu-devel/20240708143420.16953-1-joao.m.mart...@oracle.com/ [6] https://lore.kernel.org/qemu-devel/20240719120501.81279-1-joao.m.mart...@oracle.com/ Joao Martins (9): vfio/iommufd: Introduce auto domain creation vfio/{iommufd,container}: Remove caps::aw_bits vfio/iommufd: Add hw_caps

[PATCH v6 6/9] vfio/iommufd: Implement VFIOIOMMUClass::set_dirty_tracking support

2024-07-22 Thread Joao Martins
ioctl(iommufd, IOMMU_HWPT_SET_DIRTY_TRACKING, arg) is the UAPI that enables or disables dirty page tracking. The ioctl is used if the hwpt has been created with dirty tracking supported domain (stored in hwpt::flags) and it is called on the whole list of iommu domains. Signed-off-by: Joao Martins

[PATCH v6 4/9] vfio/{iommufd, container}: Invoke HostIOMMUDevice::realize() during attach_device()

2024-07-22 Thread Joao Martins via
means vfio_device_hiod_realize() is called in different places within the backend .attach_device() implementation. Suggested-by: Cédric Le Goater Signed-off-by: Joao Martins Reviewed-by: Zhenzhong Duan --- include/hw/vfio/vfio-common.h | 1 + hw/vfio/common.c | 16 ++-

[PATCH v6 2/9] vfio/{iommufd,container}: Remove caps::aw_bits

2024-07-22 Thread Joao Martins
(). Suggested-by: Zhenzhong Duan Signed-off-by: Joao Martins Reviewed-by: Cédric Le Goater #include @@ -269,7 +270,7 @@ static int hiod_iommufd_get_cap(HostIOMMUDevice *hiod, int cap, Error **errp) case HOST_IOMMU_DEVICE_CAP_IOMMU_TYPE: return caps->type; c

[PATCH v6 9/9] vfio/common: Allow disabling device dirty page tracking

2024-07-22 Thread Joao Martins
iner-based dirty page tracking. This also allows to use IOMMU dirty tracking even on VFs with their own dirty tracker scheme. Signed-off-by: Joao Martins --- include/hw/vfio/vfio-common.h | 1 + hw/vfio/common.c | 3 +++ hw/vfio/migration.c | 4 +++- hw/vfio/pci.c

[PATCH v6 3/9] vfio/iommufd: Add hw_caps field to HostIOMMUDeviceCaps

2024-07-22 Thread Joao Martins
during attach_device(). Signed-off-by: Joao Martins Reviewed-by: Cédric Le Goater --- include/sysemu/host_iommu_device.h | 4 hw/vfio/iommufd.c | 1 + 2 files changed, 5 insertions(+) diff --git a/include/sysemu/host_iommu_device.h b/include/sysemu/host_iommu_device.h index

[PATCH v6 8/9] vfio/migration: Don't block migration device dirty tracking is unsupported

2024-07-22 Thread Joao Martins
. Signed-off-by: Joao Martins --- hw/vfio/migration.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index 34d4be2ce1b1..cbfaef7afffe 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -1036,16 +1036,16 @@ bool

[PATCH v6 1/9] vfio/iommufd: Introduce auto domain creation

2024-07-22 Thread Joao Martins
of type1 approach that we have been using so far between container vs device dirty tracking. Signed-off-by: Joao Martins --- include/hw/vfio/vfio-common.h | 9 include/sysemu/iommufd.h | 5 +++ backends/iommufd.c| 30 + hw/v

Re: [PATCH v5 12/13] vfio/migration: Don't block migration device dirty tracking is unsupported

2024-07-22 Thread Joao Martins
On 22/07/2024 18:15, Cédric Le Goater wrote: > On 7/22/24 19:04, Cédric Le Goater wrote: >> On 7/22/24 18:29, Joao Martins wrote: >>> On 22/07/2024 16:58, Cédric Le Goater wrote: >>>> On 7/22/24 17:42, Joao Martins wrote: >>>>> On 22/07/2024 16:13, Cé

Re: [PATCH v5 12/13] vfio/migration: Don't block migration device dirty tracking is unsupported

2024-07-22 Thread Joao Martins
On 22/07/2024 18:04, Cédric Le Goater wrote: > On 7/22/24 18:29, Joao Martins wrote: >> On 22/07/2024 16:58, Cédric Le Goater wrote: >>> On 7/22/24 17:42, Joao Martins wrote: >>>> On 22/07/2024 16:13, Cédric Le Goater wrote: >>>>> On 7/22/24 17:01, J

Re: [PATCH v5 12/13] vfio/migration: Don't block migration device dirty tracking is unsupported

2024-07-22 Thread Joao Martins
On 22/07/2024 16:58, Cédric Le Goater wrote: > On 7/22/24 17:42, Joao Martins wrote: >> On 22/07/2024 16:13, Cédric Le Goater wrote: >>> On 7/22/24 17:01, Joao Martins wrote: >>>> On 22/07/2024 15:53, Cédric Le Goater wrote: >>>>> On 7/19/24 19:26, J

Re: [PATCH 1/2] vfio/ap: Don't initialize HOST_IOMMU_DEVICE with mdev

2024-07-22 Thread Joao Martins
On 22/07/2024 16:46, Anthony Krowiak wrote: > > On 7/22/24 5:18 AM, Joao Martins wrote: >> On 22/07/2024 08:07, Zhenzhong Duan wrote: >>> mdevs aren't "physical" devices and when asking for backing IOMMU info, >>> it fails the entire provisioning o

Re: [PATCH v5 12/13] vfio/migration: Don't block migration device dirty tracking is unsupported

2024-07-22 Thread Joao Martins
On 22/07/2024 16:13, Cédric Le Goater wrote: > On 7/22/24 17:01, Joao Martins wrote: >> On 22/07/2024 15:53, Cédric Le Goater wrote: >>> On 7/19/24 19:26, Joao Martins wrote: >>>> On 19/07/2024 15:24, Joao Martins wrote: >>>>> On 19/07/2024 15:17, Cé

Re: [PATCH 2/2] vfio/ccw: Don't initialize HOST_IOMMU_DEVICE with mdev

2024-07-22 Thread Joao Martins
On 22/07/2024 15:57, Eric Farman wrote: > On Mon, 2024-07-22 at 15:07 +0800, Zhenzhong Duan wrote: >> mdevs aren't "physical" devices and when asking for backing IOMMU info, >> it fails the entire provisioning of the guest. Fix that by setting >> vbasedev->mdev true so skipping HostIOMMUDevice init

Re: [PATCH v5 12/13] vfio/migration: Don't block migration device dirty tracking is unsupported

2024-07-22 Thread Joao Martins
On 22/07/2024 15:53, Cédric Le Goater wrote: > On 7/19/24 19:26, Joao Martins wrote: >> On 19/07/2024 15:24, Joao Martins wrote: >>> On 19/07/2024 15:17, Cédric Le Goater wrote: >>>> On 7/19/24 14:05, Joao Martins wrote: >>>>> By default VFIO migr

Re: [PATCH v5 09/13] vfio/iommufd: Probe and request hwpt dirty tracking capability

2024-07-22 Thread Joao Martins
On 22/07/2024 15:09, Joao Martins wrote: > On 22/07/2024 09:58, Joao Martins wrote: >> On 22/07/2024 07:05, Duan, Zhenzhong wrote: >>> >>> >>>> -----Original Message- >>>> From: Joao Martins >>>> Subject: [PATCH v5 09/13] vfio

Re: [PATCH v5 09/13] vfio/iommufd: Probe and request hwpt dirty tracking capability

2024-07-22 Thread Joao Martins
On 22/07/2024 09:58, Joao Martins wrote: > On 22/07/2024 07:05, Duan, Zhenzhong wrote: >> >> >>> -Original Message- >>> From: Joao Martins >>> Subject: [PATCH v5 09/13] vfio/iommufd: Probe and request hwpt dirty >>> tracking capability

Re: [PATCH 1/2] vfio/ap: Don't initialize HOST_IOMMU_DEVICE with mdev

2024-07-22 Thread Joao Martins
presence of mdevs. > > Fixes: 930589520128 ("vfio/iommufd: Implement HostIOMMUDeviceClass::realize() > handler") > Signed-off-by: Zhenzhong Duan Reviewed-by: Joao Martins > --- > hw/vfio/ap.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/hw/vfio/a

Re: [PATCH 2/2] vfio/ccw: Don't initialize HOST_IOMMU_DEVICE with mdev

2024-07-22 Thread Joao Martins
presence of mdevs. > > Fixes: 930589520128 ("vfio/iommufd: Implement HostIOMMUDeviceClass::realize() > handler") > Signed-off-by: Zhenzhong Duan Reviewed-by: Joao Martins > --- > hw/vfio/ccw.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/hw/vfio/

Re: [PATCH v5 09/13] vfio/iommufd: Probe and request hwpt dirty tracking capability

2024-07-22 Thread Joao Martins
On 22/07/2024 07:05, Duan, Zhenzhong wrote: > > >> -Original Message----- >> From: Joao Martins >> Subject: [PATCH v5 09/13] vfio/iommufd: Probe and request hwpt dirty >> tracking capability >> >> In preparation to using the dirty tracking UAPI,

Re: [PATCH v5 06/13] vfio/{iommufd,container}: Remove caps::aw_bits

2024-07-22 Thread Joao Martins
On 22/07/2024 06:22, Duan, Zhenzhong wrote: > > >> -Original Message----- >> From: Joao Martins >> Subject: [PATCH v5 06/13] vfio/{iommufd,container}: Remove caps::aw_bits >> >> Remove caps::aw_bits which requires the bcontainer::iova_ranges being >

Re: [PATCH v5 05/13] vfio/iommufd: Introduce auto domain creation

2024-07-22 Thread Joao Martins
On 22/07/2024 06:16, Duan, Zhenzhong wrote: >> -Original Message- >> From: Joao Martins >> Subject: [PATCH v5 05/13] vfio/iommufd: Introduce auto domain creation >> >> There's generally two modes of operation for IOMMUFD: >> >> 1) The simp

[PATCH v5.1 12/13] vfio/migration: Don't block migration device dirty tracking is unsupported

2024-07-19 Thread Joao Martins
. Signed-off-by: Joao Martins --- Same patch as v5, but fixes builds that have CONFIG_IOMMUFD=n Sending just this one as it doesn't justify sending the whole series again. --- hw/vfio/iommufd.c | 2 +- hw/vfio/migration.c | 11 ++- include/hw/vfio/vfio-common.h

Re: [PATCH v5 12/13] vfio/migration: Don't block migration device dirty tracking is unsupported

2024-07-19 Thread Joao Martins
On 19/07/2024 15:24, Joao Martins wrote: > On 19/07/2024 15:17, Cédric Le Goater wrote: >> On 7/19/24 14:05, Joao Martins wrote: >>> By default VFIO migration is set to auto, which will support live >>> migration if the migration capability is set *and* also dirty pag

Re: [PATCH v5 12/13] vfio/migration: Don't block migration device dirty tracking is unsupported

2024-07-19 Thread Joao Martins
On 19/07/2024 15:24, Joao Martins wrote: > On 19/07/2024 15:17, Cédric Le Goater wrote: >> On 7/19/24 14:05, Joao Martins wrote: >>> By default VFIO migration is set to auto, which will support live >>> migration if the migration capability is set *and* also dirty pag

Re: [PATCH v5 12/13] vfio/migration: Don't block migration device dirty tracking is unsupported

2024-07-19 Thread Joao Martins
On 19/07/2024 15:17, Cédric Le Goater wrote: > On 7/19/24 14:05, Joao Martins wrote: >> By default VFIO migration is set to auto, which will support live >> migration if the migration capability is set *and* also dirty page >> tracking is supported. >> >> For test

[PATCH v5 05/13] vfio/iommufd: Introduce auto domain creation

2024-07-19 Thread Joao Martins
of type1 approach that we have been using so far between container vs device dirty tracking. Signed-off-by: Joao Martins --- include/hw/vfio/vfio-common.h | 9 include/sysemu/iommufd.h | 5 +++ backends/iommufd.c| 30 + hw/v

Re: [PATCH v5 00/13] hw/iommufd: IOMMUFD Dirty Tracking

2024-07-19 Thread Joao Martins
Hey Cedric, On 19/07/2024 13:04, Joao Martins wrote: > The unmap case is deferred until further vIOMMU support with migration > is added[3] which will then introduce the usage of > IOMMU_HWPT_GET_DIRTY_BITMAP_NO_CLEAR in GET_DIRTY_BITMAP ioctl in the > dma unmap bitmap flow. >

[PATCH v5 03/13] backends/iommufd: Extend iommufd_backend_get_device_info() to fetch HW capabilities

2024-07-19 Thread Joao Martins
The helper will be able to fetch vendor agnostic IOMMU capabilities supported both by hardware and software. Right now it is only iommu dirty tracking. Signed-off-by: Joao Martins Reviewed-by: Zhenzhong Duan Reviewed-by: Cédric Le Goater --- include/sysemu/iommufd.h | 2 +- backends/iommufd.c

[PATCH v5 00/13] hw/iommufd: IOMMUFD Dirty Tracking

2024-07-19 Thread Joao Martins
0.16953-1-joao.m.mart...@oracle.com/ [6] https://lore.kernel.org/qemu-devel/20240712114704.8708-1-joao.m.mart...@oracle.com/#t Joao Martins (13): vfio/pci: Extract mdev check into an helper vfio/iommufd: Don't initialize nor set a HOST_IOMMU_DEVICE with mdev backends/iommufd: Extend io

[PATCH v5 13/13] vfio/common: Allow disabling device dirty page tracking

2024-07-19 Thread Joao Martins
iner-based dirty page tracking. This also allows to use IOMMU dirty tracking even on VFs with their own dirty tracker scheme. Signed-off-by: Joao Martins --- include/hw/vfio/vfio-common.h | 1 + hw/vfio/common.c | 3 +++ hw/vfio/migration.c | 3 ++- hw/vfio/pci.c

[PATCH v5 04/13] vfio/iommufd: Return errno in iommufd_cdev_attach_ioas_hwpt()

2024-07-19 Thread Joao Martins
In preparation to implement auto domains have the attach function return the errno it got during domain attach instead of a bool. -EINVAL is tracked to track domain incompatibilities, and decide whether to create a new IOMMU domain. Signed-off-by: Joao Martins Reviewed-by: Cédric Le Goater

  1   2   3   4   5   6   7   >