162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* Copyright(c) 2023 Advanced Micro Devices, Inc. */ 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci#ifndef _DIRTY_H_ 562306a36Sopenharmony_ci#define _DIRTY_H_ 662306a36Sopenharmony_ci 762306a36Sopenharmony_cistruct pds_vfio_bmp_info { 862306a36Sopenharmony_ci unsigned long *bmp; 962306a36Sopenharmony_ci u32 bmp_bytes; 1062306a36Sopenharmony_ci struct pds_lm_sg_elem *sgl; 1162306a36Sopenharmony_ci dma_addr_t sgl_addr; 1262306a36Sopenharmony_ci u16 num_sge; 1362306a36Sopenharmony_ci}; 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_cistruct pds_vfio_dirty { 1662306a36Sopenharmony_ci struct pds_vfio_bmp_info host_seq; 1762306a36Sopenharmony_ci struct pds_vfio_bmp_info host_ack; 1862306a36Sopenharmony_ci u64 region_size; 1962306a36Sopenharmony_ci u64 region_start; 2062306a36Sopenharmony_ci u64 region_page_size; 2162306a36Sopenharmony_ci bool is_enabled; 2262306a36Sopenharmony_ci}; 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_cistruct pds_vfio_pci_device; 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_cibool pds_vfio_dirty_is_enabled(struct pds_vfio_pci_device *pds_vfio); 2762306a36Sopenharmony_civoid pds_vfio_dirty_set_enabled(struct pds_vfio_pci_device *pds_vfio); 2862306a36Sopenharmony_civoid pds_vfio_dirty_set_disabled(struct pds_vfio_pci_device *pds_vfio); 2962306a36Sopenharmony_civoid pds_vfio_dirty_disable(struct pds_vfio_pci_device *pds_vfio, 3062306a36Sopenharmony_ci bool send_cmd); 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ciint pds_vfio_dma_logging_report(struct vfio_device *vdev, unsigned long iova, 3362306a36Sopenharmony_ci unsigned long length, 3462306a36Sopenharmony_ci struct iova_bitmap *dirty); 3562306a36Sopenharmony_ciint pds_vfio_dma_logging_start(struct vfio_device *vdev, 3662306a36Sopenharmony_ci struct rb_root_cached *ranges, u32 nnodes, 3762306a36Sopenharmony_ci u64 *page_size); 3862306a36Sopenharmony_ciint pds_vfio_dma_logging_stop(struct vfio_device *vdev); 3962306a36Sopenharmony_ci#endif /* _DIRTY_H_ */ 40