1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* Copyright(c) 2023 Advanced Micro Devices, Inc. */ 3 4 #ifndef _DIRTY_H_ 5 #define _DIRTY_H_ 6 7 struct pds_vfio_region { 8 unsigned long *host_seq; 9 unsigned long *host_ack; 10 u64 bmp_bytes; 11 u64 size; 12 u64 start; 13 u64 page_size; 14 struct pds_lm_sg_elem *sgl; 15 dma_addr_t sgl_addr; 16 u32 dev_bmp_offset_start_byte; 17 u16 num_sge; 18 }; 19 20 struct pds_vfio_dirty { 21 struct pds_vfio_region *regions; 22 u8 num_regions; 23 bool is_enabled; 24 }; 25 26 struct pds_vfio_pci_device; 27 28 bool pds_vfio_dirty_is_enabled(struct pds_vfio_pci_device *pds_vfio); 29 void pds_vfio_dirty_set_enabled(struct pds_vfio_pci_device *pds_vfio); 30 void pds_vfio_dirty_set_disabled(struct pds_vfio_pci_device *pds_vfio); 31 void pds_vfio_dirty_disable(struct pds_vfio_pci_device *pds_vfio, 32 bool send_cmd); 33 34 int pds_vfio_dma_logging_report(struct vfio_device *vdev, unsigned long iova, 35 unsigned long length, 36 struct iova_bitmap *dirty); 37 int pds_vfio_dma_logging_start(struct vfio_device *vdev, 38 struct rb_root_cached *ranges, u32 nnodes, 39 u64 *page_size); 40 int pds_vfio_dma_logging_stop(struct vfio_device *vdev); 41 #endif /* _DIRTY_H_ */ 42