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

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

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

[PATCH v5 01/13] vfio/pci: Extract mdev check into an helper

2024-07-19 Thread Joao Martins
In preparation to skip initialization of the HostIOMMUDevice for mdev, extract the checks that validate if a device is an mdev into helpers. A vfio_device_is_mdev() is created, and subsystems consult VFIODevice::mdev to check if it's mdev or not. Signed-off-by: Joao Martins --- include/hw

[PATCH v5 02/13] vfio/iommufd: Don't initialize nor set a HOST_IOMMU_DEVICE with mdev

2024-07-19 Thread Joao Martins
ong Duan Fixes: 930589520128 ("vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler") Signed-off-by: Joao Martins Reviewed-by: Eric Auger Reviewed-by: Zhenzhong Duan --- hw/vfio/common.c | 4 hw/vfio/pci.c| 11 --- 2 files changed, 12 insertions(+), 3 deletions

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

2024-07-19 Thread Joao Martins
(). Suggested-by: Zhenzhong Duan Signed-off-by: Joao Martins Reviewed-by: Cédric Le Goater #include @@ -270,7 +271,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 v5 12/13] vfio/migration: Don't block migration device dirty tracking is unsupported

2024-07-19 Thread Joao Martins
. Signed-off-by: Joao Martins --- include/hw/vfio/vfio-common.h | 1 + hw/vfio/iommufd.c | 2 +- hw/vfio/migration.c | 11 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index

[PATCH v5 11/13] vfio/iommufd: Implement VFIOIOMMUClass::query_dirty_bitmap support

2024-07-19 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 v5 08/13] vfio/{iommufd, container}: Invoke HostIOMMUDevice::realize() during attach_device()

2024-07-19 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 --- include/hw/vfio/vfio-common.h | 1 + hw/vfio/common.c | 16 ++-- hw/vfio/contai

[PATCH v5 10/13] vfio/iommufd: Implement VFIOIOMMUClass::set_dirty_tracking support

2024-07-19 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 v5 07/13] vfio/iommufd: Add hw_caps field to HostIOMMUDeviceCaps

2024-07-19 Thread Joao Martins
during attach_device(). Signed-off-by: Joao Martins --- 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 cdeeccec7671..fd03ce766522

Re: [PATCH v4 05/12] vfio/iommufd: Introduce auto domain creation

2024-07-18 Thread Joao Martins
On 17/07/2024 10:31, Joao Martins wrote: > On 17/07/2024 10:28, Cédric Le Goater wrote: >>>>>>>> @@ -224,6 +300,11 @@ static void >>>>> iommufd_cdev_detach_container(VFIODevice *vbasedev, >>>>>>>>   { >>&

Re: [PATCH v4 05/12] vfio/iommufd: Introduce auto domain creation

2024-07-18 Thread Joao Martins
On 18/07/2024 08:44, Duan, Zhenzhong wrote: > If existing hwpt doesn't support dirty tracking. > Another device supporting dirty tracking attaches to that hwpt, what >> will happen? > Hmm, It succeeds as there's no incompatbility. At the very least I plan on blocking

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

2024-07-18 Thread Joao Martins
On 18/07/2024 08:20, Duan, Zhenzhong wrote: > > >> -Original Message----- >> From: Joao Martins >> Subject: Re: [PATCH v4 11/12] vfio/migration: Don't block migration device >> dirty tracking is unsupported >> >> On 17/07/2024 03:38, Duan, Zhen

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

2024-07-17 Thread Joao Martins
On 17/07/2024 17:02, Joao Martins wrote: > On 17/07/2024 16:35, Joao Martins wrote: >> On 17/07/2024 10:20, Joao Martins wrote: >>> On 17/07/2024 03:38, Duan, Zhenzhong wrote: >>>>> diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c >>>>> index

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

2024-07-17 Thread Joao Martins
On 17/07/2024 16:35, Joao Martins wrote: > On 17/07/2024 10:20, Joao Martins wrote: >> On 17/07/2024 03:38, Duan, Zhenzhong wrote: >>>> diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c >>>> index 34d4be2ce1b1..ce3d1b6e9a25 100644 >>>> --- a/hw/vf

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

2024-07-17 Thread Joao Martins
On 17/07/2024 10:20, Joao Martins wrote: > On 17/07/2024 03:38, Duan, Zhenzhong wrote: >> >> >>> -Original Message- >>> From: Joao Martins >>> Subject: [PATCH v4 11/12] vfio/migration: Don't block migration device dirty >>> tracking

Re: [PATCH v4 07/12] vfio/{iommufd,container}: Initialize HostIOMMUDeviceCaps during attach_device()

2024-07-17 Thread Joao Martins
On 17/07/2024 14:41, Eric Auger wrote: > On 7/17/24 14:33, Joao Martins wrote: >> On 17/07/2024 13:19, Eric Auger wrote: >>> Hi Joao, >>> >>> On 7/12/24 13:46, Joao Martins wrote: >>>> Fetch IOMMU hw raw caps behind the device and thus move the &g

Re: [PATCH v4 09/12] vfio/iommufd: Implement VFIOIOMMUClass::set_dirty_tracking support

2024-07-17 Thread Joao Martins
On 17/07/2024 14:34, Eric Auger wrote: > On 7/17/24 14:41, Joao Martins wrote: >> On 17/07/2024 13:36, Eric Auger wrote: >>> On 7/12/24 13:47, Joao Martins wrote: >>>> The checking of hwpt::flags is introduced here as a second user >>> ?? -> introduce iom

Re: [PATCH v4 09/12] vfio/iommufd: Implement VFIOIOMMUClass::set_dirty_tracking support

2024-07-17 Thread Joao Martins
On 17/07/2024 13:36, Eric Auger wrote: > > > On 7/12/24 13:47, Joao Martins wrote: >> ioctl(iommufd, IOMMU_HWPT_SET_DIRTY_TRACKING, arg) is the UAPI that >> enables or disables dirty page tracking. It is used if the hwpt >> has been created with dirty tracking supporte

Re: [PATCH v4 08/12] vfio/iommufd: Probe and request hwpt dirty tracking capability

2024-07-17 Thread Joao Martins
On 17/07/2024 13:27, Eric Auger wrote: > Hi Joao, > > On 7/12/24 13:47, Joao Martins wrote: >> Probe hardware dirty tracking support by querying device hw capabilities via >> IOMMUFD_GET_HW_INFO. > this is not what the patch brings. GET_HW_INFO is always in place. Ye

Re: [PATCH v4 07/12] vfio/{iommufd,container}: Initialize HostIOMMUDeviceCaps during attach_device()

2024-07-17 Thread Joao Martins
On 17/07/2024 13:19, Eric Auger wrote: > Hi Joao, > > On 7/12/24 13:46, Joao Martins wrote: >> Fetch IOMMU hw raw caps behind the device and thus move the > what does mean "Fetch IOMMU hw raw caps behind the device'" Fetching the out_capabilities field from GET_

Re: [PATCH v4 05/12] vfio/iommufd: Introduce auto domain creation

2024-07-17 Thread Joao Martins
On 17/07/2024 11:05, Duan, Zhenzhong wrote: >> -Original Message- >> From: Joao Martins >> Subject: Re: [PATCH v4 05/12] vfio/iommufd: Introduce auto domain >> creation >> >> On 17/07/2024 03:18, Duan, Zhenzhong wrote: >>> >>> &

Re: [PATCH v4 05/12] vfio/iommufd: Introduce auto domain creation

2024-07-17 Thread Joao Martins
On 17/07/2024 10:48, Duan, Zhenzhong wrote: > > >> -Original Message----- >> From: Joao Martins >> Subject: Re: [PATCH v4 05/12] vfio/iommufd: Introduce auto domain >> creation >> >> On 17/07/2024 03:52, Duan, Zhenzhong wrote: >>> >>

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

2024-07-17 Thread Joao Martins
On 17/07/2024 03:38, Duan, Zhenzhong wrote: > > >> -Original Message----- >> From: Joao Martins >> Subject: [PATCH v4 11/12] vfio/migration: Don't block migration device dirty >> tracking is unsupported >> >> By default VFIO migration is set t

Re: [PATCH v4 05/12] vfio/iommufd: Introduce auto domain creation

2024-07-17 Thread Joao Martins
On 17/07/2024 10:28, Cédric Le Goater wrote: >>> @@ -224,6 +300,11 @@ static void iommufd_cdev_detach_container(VFIODevice *vbasedev, >>>   { >>>   Error *err = NULL; >>> >>> +    if (vbasedev->hwpt) { >>> +    iommufd_cdev_autodomains_put(vbasedev, container);

Re: [PATCH v4 09/12] vfio/iommufd: Implement VFIOIOMMUClass::set_dirty_tracking support

2024-07-17 Thread Joao Martins
On 17/07/2024 03:24, Duan, Zhenzhong wrote: > > >> -Original Message----- >> From: Joao Martins >> Subject: [PATCH v4 09/12] vfio/iommufd: Implement >> VFIOIOMMUClass::set_dirty_tracking support >> >> ioctl(iommufd, IOMMU_HWPT_SET_DIRTY_TRACKING, ar

Re: [PATCH v4 05/12] vfio/iommufd: Introduce auto domain creation

2024-07-17 Thread Joao Martins
On 17/07/2024 03:52, Duan, Zhenzhong wrote: > > >> -Original Message----- >> From: Joao Martins >> Subject: Re: [PATCH v4 05/12] vfio/iommufd: Introduce auto domain >> creation >> >> On 16/07/2024 17:44, Joao Martins wrote: >>>

Re: [PATCH v4 05/12] vfio/iommufd: Introduce auto domain creation

2024-07-17 Thread Joao Martins
On 17/07/2024 03:18, Duan, Zhenzhong wrote: > > >> -Original Message----- >> From: Joao Martins >> Subject: [PATCH v4 05/12] vfio/iommufd: Introduce auto domain creation >> >> There's generally two modes of operation for IOMMUFD: >> &g

Re: [PATCH v4 07/12] vfio/{iommufd,container}: Initialize HostIOMMUDeviceCaps during attach_device()

2024-07-17 Thread Joao Martins
On 17/07/2024 03:05, Duan, Zhenzhong wrote: > > >> -Original Message----- >> From: Joao Martins >> Subject: [PATCH v4 07/12] vfio/{iommufd,container}: Initialize >> HostIOMMUDeviceCaps during attach_device() >> >> Fetch IOMMU hw ra

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

2024-07-16 Thread Joao Martins
On 16/07/2024 18:40, Eric Auger wrote: > Hi Joao, > > On 7/12/24 13:46, Joao Martins wrote: >> In preparation to moving HostIOMMUDevice realize() being able to called >> early during attach_device(), remove properties that rely on container >> being initialized. >

Re: [PATCH v4 05/12] vfio/iommufd: Introduce auto domain creation

2024-07-16 Thread Joao Martins
On 16/07/2024 17:44, Joao Martins wrote: > On 16/07/2024 17:04, Eric Auger wrote: >> Hi Joao, >> >> On 7/12/24 13:46, Joao Martins wrote: >>> There's generally two modes of operation for IOMMUFD: >>> >>> * The simple user API which intends to

Re: [PATCH v4 05/12] vfio/iommufd: Introduce auto domain creation

2024-07-16 Thread Joao Martins
On 16/07/2024 17:04, Eric Auger wrote: > Hi Joao, > > On 7/12/24 13:46, Joao Martins wrote: >> There's generally two modes of operation for IOMMUFD: >> >> * The simple user API which intends to perform relatively simple things >> with IOMMUs e.g. DPDK. It g

Re: [PATCH v4 07/12] vfio/{iommufd,container}: Initialize HostIOMMUDeviceCaps during attach_device()

2024-07-16 Thread Joao Martins
On 16/07/2024 11:20, Cédric Le Goater wrote: > On 7/12/24 13:46, Joao Martins wrote: >> Fetch IOMMU hw raw caps behind the device and thus move the >> HostIOMMUDevice::realize() to be done during the attach of the device. It >> allows it to cache the information obtained f

Re: [PATCH v4 05/12] vfio/iommufd: Introduce auto domain creation

2024-07-16 Thread Joao Martins
On 16/07/2024 10:39, Cédric Le Goater wrote: > On 7/12/24 13:46, Joao Martins wrote: >> There's generally two modes of operation for IOMMUFD: >> >> * The simple user API which intends to perform relatively simple things >> with IOMMUs e.g. DPDK. It generally cr

Re: [PATCH v4 01/12] vfio/pci: Extract mdev check into an helper

2024-07-16 Thread Joao Martins
On 16/07/2024 10:21, Cédric Le Goater wrote: > Hello Joao > > On 7/12/24 13:46, Joao Martins wrote: >> In preparation to skip initialization of the HostIOMMUDevice for mdev, >> extract the checks that validate if a device is an mdev into helpers. >> >> A vfio_set_

Re: [PATCH v4 00/12] hw/iommufd: IOMMUFD Dirty Tracking

2024-07-16 Thread Joao Martins
On 16/07/2024 09:20, Duan, Zhenzhong wrote: > > >> -Original Message----- >> From: Joao Martins >> Subject: [PATCH v4 00/12] hw/iommufd: IOMMUFD Dirty Tracking >> >> This small series adds support for IOMMU dirty tracking support via the >> I

[PATCH v4 09/12] vfio/iommufd: Implement VFIOIOMMUClass::set_dirty_tracking support

2024-07-12 Thread Joao Martins
rolls it back. The checking of hwpt::flags is introduced here as a second user and thus consolidate such check into a helper function iommufd_hwpt_dirty_tracking(). Signed-off-by: Joao Martins --- include/sysemu/iommufd.h | 3 +++ backends/iommufd.c | 23 +++ hw/vfio

[PATCH v4 11/12] vfio/migration: Don't block migration device dirty tracking is unsupported

2024-07-12 Thread Joao Martins
purposes. So starting with IOMMU dirty tracking it can use to acomodate the lack of VF dirty page tracking allowing us to minimize the VF requirements for migration and thus enabling migration by default for those too. Signed-off-by: Joao Martins --- hw/vfio/migration.c | 3 ++- 1 file changed

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

2024-07-12 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 --- include/sysemu/iommufd.h | 2 +- backends/iommufd.c | 4 +++- hw/vfio

[PATCH v4 10/12] vfio/iommufd: Implement VFIOIOMMUClass::query_dirty_bitmap support

2024-07-12 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 v4 05/12] vfio/iommufd: Introduce auto domain creation

2024-07-12 Thread Joao Martins
ach 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/vfio/iommufd.c | 82 +++

[PATCH v4 01/12] vfio/pci: Extract mdev check into an helper

2024-07-12 Thread Joao Martins
In preparation to skip initialization of the HostIOMMUDevice for mdev, extract the checks that validate if a device is an mdev into helpers. A vfio_set_mdev() is created, and subsystems consult VFIODevice::mdev to check if it's mdev or not. Signed-off-by: Joao Martins --- include/hw/vfio

[PATCH v4 07/12] vfio/{iommufd, container}: Initialize HostIOMMUDeviceCaps during attach_device()

2024-07-12 Thread Joao Martins via
fetch parse hw capabilities and understand if dirty tracking is supported by device backing IOMMU without necessarily duplicating the amount of calls we do to IOMMU_GET_HW_INFO. Suggested-by: Cédric Le Goater Signed-off-by: Joao Martins --- include/sysemu/host_iommu_device.h | 1 + hw/vfio/com

[PATCH v4 04/12] vfio/iommufd: Return errno in iommufd_cdev_attach_ioas_hwpt()

2024-07-12 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 --- hw/vfio/iommufd.c | 8

[PATCH v4 02/12] vfio/iommufd: Don't initialize nor set a HOST_IOMMU_DEVICE with mdev

2024-07-12 Thread Joao Martins
ong Duan Fixes: 930589520128 ("vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler") Signed-off-by: Joao Martins --- hw/vfio/common.c | 4 hw/vfio/pci.c| 10 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/hw/vfio/common.c b/hw/vfio/co

[PATCH v4 06/12] vfio/{iommufd,container}: Remove caps::aw_bits

2024-07-12 Thread Joao Martins
. Instead defer that to .get_cap() and call vfio_device_get_aw_bits() directly. Suggested-by: Zhenzhong Duan Signed-off-by: Joao Martins --- include/sysemu/host_iommu_device.h | 1 - backends/iommufd.c | 3 ++- hw/vfio/container.c| 5 + hw/vfio/iommufd.c

[PATCH v4 12/12] vfio/common: Allow disabling device dirty page tracking

2024-07-12 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 v4 08/12] vfio/iommufd: Probe and request hwpt dirty tracking capability

2024-07-12 Thread Joao Martins
when DMA dirty tracking is not desired (and VF can provide it) while others doesn't have it and want the IOMMU capability. This is not used in this way here given how VFIODevice migration capability checking takes place *after* the device attachment. Signed-off-by: Joao Martins --- include/hw

[PATCH v4 00/12] hw/iommufd: IOMMUFD Dirty Tracking

2024-07-12 Thread Joao Martins
/ [5] https://lore.kernel.org/qemu-devel/20240708143420.16953-1-joao.m.mart...@oracle.com/ Joao Martins (12): vfio/pci: Extract mdev check into an helper vfio/iommufd: Don't initialize nor set a HOST_IOMMU_DEVICE with mdev backends/iommufd: Extend iommufd_backend_get_device_info() to

Re: [PATCH v3 00/10] hw/vfio: IOMMUFD Dirty Tracking

2024-07-11 Thread Joao Martins
On 11/07/2024 11:22, Duan, Zhenzhong wrote: > > >> -Original Message----- >> From: Joao Martins >> Subject: Re: [PATCH v3 00/10] hw/vfio: IOMMUFD Dirty Tracking >> >> On 11/07/2024 08:41, Cédric Le Goater wrote: >>> Hello Joao, >>> >

Re: [PATCH v3 00/10] hw/vfio: IOMMUFD Dirty Tracking

2024-07-11 Thread Joao Martins
On 11/07/2024 08:41, Cédric Le Goater wrote: > Hello Joao, > > On 7/8/24 4:34 PM, 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. The

Re: [PATCH v3 09/10] vfio/migration: Don't block migration device dirty tracking is unsupported

2024-07-10 Thread Joao Martins
On 10/07/2024 11:38, Duan, Zhenzhong wrote: > > >> -Original Message----- >> From: Joao Martins >> Subject: [PATCH v3 09/10] vfio/migration: Don't block migration device dirty >> tracking is unsupported >> >> By default VFIO migration is set t

Re: [PATCH v3 10/10] vfio/common: Allow disabling device dirty page tracking

2024-07-10 Thread Joao Martins
On 10/07/2024 11:42, Duan, Zhenzhong wrote: > > >> -Original Message----- >> From: Joao Martins >> Subject: [PATCH v3 10/10] vfio/common: Allow disabling device dirty page >> tracking >> >> The property 'x-pre-copy-dirty-page-tracking' a

Re: [PATCH v3 01/10] vfio/iommufd: Don't fail to realize on IOMMU_GET_HW_INFO failure

2024-07-10 Thread Joao Martins
On 10/07/2024 10:54, Duan, Zhenzhong wrote: > > >> -Original Message----- >> From: Joao Martins >> Subject: Re: [PATCH v3 01/10] vfio/iommufd: Don't fail to realize on >> IOMMU_GET_HW_INFO failure >> >> On 10/07/2024 03:53, Duan, Zhen

Re: [PATCH v3 01/10] vfio/iommufd: Don't fail to realize on IOMMU_GET_HW_INFO failure

2024-07-10 Thread Joao Martins
On 10/07/2024 03:53, Duan, Zhenzhong wrote: > > >> -Original Message----- >> From: Joao Martins >> Subject: Re: [PATCH v3 01/10] vfio/iommufd: Don't fail to realize on >> IOMMU_GET_HW_INFO failure >> >> On 09/07/2024 12:45, Joao Martins wro

Re: [PATCH v3 05/10] vfio/iommufd: Probe and request hwpt dirty tracking capability

2024-07-09 Thread Joao Martins
On 09/07/2024 13:47, Joao Martins wrote: > On 09/07/2024 10:04, Joao Martins wrote: >> On 09/07/2024 07:28, Cédric Le Goater wrote: >>> On 7/8/24 4:34 PM, Joao Martins wrote: >>>> diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c >>>> index 2ca9a32cc7

  1   2   3   4   5   6   7   >