xref: /openbmc/linux/drivers/vfio/pci/pds/dirty.h (revision 046b212a)
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_bmp_info {
8 	unsigned long *bmp;
9 	u32 bmp_bytes;
10 	struct pds_lm_sg_elem *sgl;
11 	dma_addr_t sgl_addr;
12 	u16 num_sge;
13 };
14 
15 struct pds_vfio_dirty {
16 	struct pds_vfio_bmp_info host_seq;
17 	struct pds_vfio_bmp_info host_ack;
18 	u64 region_size;
19 	u64 region_start;
20 	u64 region_page_size;
21 	bool is_enabled;
22 };
23 
24 struct pds_vfio_pci_device;
25 
26 bool pds_vfio_dirty_is_enabled(struct pds_vfio_pci_device *pds_vfio);
27 void pds_vfio_dirty_set_enabled(struct pds_vfio_pci_device *pds_vfio);
28 void pds_vfio_dirty_set_disabled(struct pds_vfio_pci_device *pds_vfio);
29 void pds_vfio_dirty_disable(struct pds_vfio_pci_device *pds_vfio,
30 			    bool send_cmd);
31 
32 int pds_vfio_dma_logging_report(struct vfio_device *vdev, unsigned long iova,
33 				unsigned long length,
34 				struct iova_bitmap *dirty);
35 int pds_vfio_dma_logging_start(struct vfio_device *vdev,
36 			       struct rb_root_cached *ranges, u32 nnodes,
37 			       u64 *page_size);
38 int pds_vfio_dma_logging_stop(struct vfio_device *vdev);
39 #endif /* _DIRTY_H_ */
40