On 07/03/2023 10:08, Cédric Le Goater wrote: > On 3/7/23 03:57, Alex Williamson wrote: >> On Tue, 7 Mar 2023 02:02:52 +0000 >> Joao Martins <joao.m.mart...@oracle.com> wrote: >>> +static void vfio_dirty_tracking_init(VFIOContainer *container, >>> + VFIODirtyRanges *dirty) >>> +{ >>> + memset(dirty, 0, sizeof(*dirty)); >>> + dirty->ranges.min32 = UINT32_MAX; >>> + dirty->ranges.min64 = UINT64_MAX; >>> + dirty->listener = vfio_dirty_tracking_listener; >>> + dirty->container = container; >>> + >> >> I was actually thinking the caller would just pass >> VFIODirtyTrackingRange and VFIODirtyRanges would be allocated on the >> stack here, perhaps both are defined private to this file, but this >> works and we can refine later if we so decide. > > It is true that vfio_devices_dma_logging_start() only needs > a VFIODirtyTrackingRange struct and not the VFIODirtyRanges struct > which is a temporary structure for the dirty ranges calculation. > That would be nicer to have if you respin a v5. > I can.
> I would rename VFIODirtyRanges to VFIODirtyRangesListener and > VFIODirtyTrackingRange to VFIODirtyRanges. > Better naming indeed. > I am not sure they need to be in include/hw/vfio/vfio-common.h but > that seems to be the VFIO practice. > I can move as Alex also suggested it. There's already have vfio_giommu_dirty_notifier and VFIOBitmap as private structures. I don't expect that this will be used by other files