Lines Matching refs:pds_vfio

19 bool pds_vfio_dirty_is_enabled(struct pds_vfio_pci_device *pds_vfio)  in pds_vfio_dirty_is_enabled()  argument
21 return pds_vfio->dirty.is_enabled; in pds_vfio_dirty_is_enabled()
24 void pds_vfio_dirty_set_enabled(struct pds_vfio_pci_device *pds_vfio) in pds_vfio_dirty_set_enabled() argument
26 pds_vfio->dirty.is_enabled = true; in pds_vfio_dirty_set_enabled()
29 void pds_vfio_dirty_set_disabled(struct pds_vfio_pci_device *pds_vfio) in pds_vfio_dirty_set_disabled() argument
31 pds_vfio->dirty.is_enabled = false; in pds_vfio_dirty_set_disabled()
35 pds_vfio_print_guest_region_info(struct pds_vfio_pci_device *pds_vfio, in pds_vfio_print_guest_region_info() argument
39 struct pci_dev *pdev = pds_vfio->vfio_coredev.pdev; in pds_vfio_print_guest_region_info()
57 err = pds_vfio_dirty_status_cmd(pds_vfio, regions_dma, &max_regions, in pds_vfio_print_guest_region_info()
112 static void __pds_vfio_dirty_free_sgl(struct pds_vfio_pci_device *pds_vfio, in __pds_vfio_dirty_free_sgl() argument
115 struct pci_dev *pdev = pds_vfio->vfio_coredev.pdev; in __pds_vfio_dirty_free_sgl()
128 static void pds_vfio_dirty_free_sgl(struct pds_vfio_pci_device *pds_vfio) in pds_vfio_dirty_free_sgl() argument
130 struct pds_vfio_dirty *dirty = &pds_vfio->dirty; in pds_vfio_dirty_free_sgl()
139 __pds_vfio_dirty_free_sgl(pds_vfio, region); in pds_vfio_dirty_free_sgl()
143 static int pds_vfio_dirty_alloc_sgl(struct pds_vfio_pci_device *pds_vfio, in pds_vfio_dirty_alloc_sgl() argument
147 struct pci_dev *pdev = pds_vfio->vfio_coredev.pdev; in pds_vfio_dirty_alloc_sgl()
181 static int pds_vfio_dirty_alloc_regions(struct pds_vfio_pci_device *pds_vfio, in pds_vfio_dirty_alloc_regions() argument
185 struct pci_dev *pdev = pds_vfio->vfio_coredev.pdev; in pds_vfio_dirty_alloc_regions()
186 struct pds_vfio_dirty *dirty = &pds_vfio->dirty; in pds_vfio_dirty_alloc_regions()
214 err = pds_vfio_dirty_alloc_sgl(pds_vfio, region, page_count); in pds_vfio_dirty_alloc_regions()
238 pds_vfio_dirty_free_sgl(pds_vfio); in pds_vfio_dirty_alloc_regions()
244 static int pds_vfio_dirty_enable(struct pds_vfio_pci_device *pds_vfio, in pds_vfio_dirty_enable() argument
248 struct pci_dev *pdev = pds_vfio->vfio_coredev.pdev; in pds_vfio_dirty_enable()
260 pds_vfio->vf_id); in pds_vfio_dirty_enable()
262 if (pds_vfio_dirty_is_enabled(pds_vfio)) in pds_vfio_dirty_enable()
266 err = pds_vfio_dirty_status_cmd(pds_vfio, 0, &max_regions, in pds_vfio_dirty_enable()
324 err = pds_vfio_dirty_enable_cmd(pds_vfio, regions_dma, num_ranges); in pds_vfio_dirty_enable()
329 err = pds_vfio_dirty_alloc_regions(pds_vfio, region_info, in pds_vfio_dirty_enable()
338 pds_vfio_dirty_set_enabled(pds_vfio); in pds_vfio_dirty_enable()
340 pds_vfio_print_guest_region_info(pds_vfio, max_regions); in pds_vfio_dirty_enable()
347 pds_vfio_dirty_disable_cmd(pds_vfio); in pds_vfio_dirty_enable()
353 void pds_vfio_dirty_disable(struct pds_vfio_pci_device *pds_vfio, bool send_cmd) in pds_vfio_dirty_disable() argument
355 if (pds_vfio_dirty_is_enabled(pds_vfio)) { in pds_vfio_dirty_disable()
356 pds_vfio_dirty_set_disabled(pds_vfio); in pds_vfio_dirty_disable()
358 pds_vfio_dirty_disable_cmd(pds_vfio); in pds_vfio_dirty_disable()
359 pds_vfio_dirty_free_sgl(pds_vfio); in pds_vfio_dirty_disable()
360 pds_vfio_dirty_free_bitmaps(&pds_vfio->dirty); in pds_vfio_dirty_disable()
361 pds_vfio_dirty_free_regions(&pds_vfio->dirty); in pds_vfio_dirty_disable()
365 pds_vfio_send_host_vf_lm_status_cmd(pds_vfio, PDS_LM_STA_NONE); in pds_vfio_dirty_disable()
368 static int pds_vfio_dirty_seq_ack(struct pds_vfio_pci_device *pds_vfio, in pds_vfio_dirty_seq_ack() argument
375 struct pci_dev *pdev = pds_vfio->vfio_coredev.pdev; in pds_vfio_dirty_seq_ack()
434 err = pds_vfio_dirty_seq_ack_cmd(pds_vfio, region->sgl_addr, num_sge, in pds_vfio_dirty_seq_ack()
452 static int pds_vfio_dirty_write_ack(struct pds_vfio_pci_device *pds_vfio, in pds_vfio_dirty_write_ack() argument
457 return pds_vfio_dirty_seq_ack(pds_vfio, region, region->host_ack, in pds_vfio_dirty_write_ack()
461 static int pds_vfio_dirty_read_seq(struct pds_vfio_pci_device *pds_vfio, in pds_vfio_dirty_read_seq() argument
465 return pds_vfio_dirty_seq_ack(pds_vfio, region, region->host_seq, in pds_vfio_dirty_read_seq()
469 static int pds_vfio_dirty_process_bitmaps(struct pds_vfio_pci_device *pds_vfio, in pds_vfio_dirty_process_bitmaps() argument
506 pds_vfio_get_region(struct pds_vfio_pci_device *pds_vfio, unsigned long iova) in pds_vfio_get_region() argument
508 struct pds_vfio_dirty *dirty = &pds_vfio->dirty; in pds_vfio_get_region()
521 static int pds_vfio_dirty_sync(struct pds_vfio_pci_device *pds_vfio, in pds_vfio_dirty_sync() argument
525 struct device *dev = &pds_vfio->vfio_coredev.pdev->dev; in pds_vfio_dirty_sync()
531 dev_dbg(dev, "vf%u: Get dirty page bitmap\n", pds_vfio->vf_id); in pds_vfio_dirty_sync()
533 if (!pds_vfio_dirty_is_enabled(pds_vfio)) { in pds_vfio_dirty_sync()
535 pds_vfio->vf_id); in pds_vfio_dirty_sync()
539 region = pds_vfio_get_region(pds_vfio, iova); in pds_vfio_dirty_sync()
542 pds_vfio->vf_id, iova, length); in pds_vfio_dirty_sync()
552 pds_vfio->vf_id, iova, length, region->page_size, in pds_vfio_dirty_sync()
585 err = pds_vfio_dirty_read_seq(pds_vfio, region, bmp_offset, bmp_bytes); in pds_vfio_dirty_sync()
589 err = pds_vfio_dirty_process_bitmaps(pds_vfio, region, dirty_bitmap, in pds_vfio_dirty_sync()
594 err = pds_vfio_dirty_write_ack(pds_vfio, region, bmp_offset, bmp_bytes); in pds_vfio_dirty_sync()
604 struct pds_vfio_pci_device *pds_vfio = in pds_vfio_dma_logging_report() local
609 mutex_lock(&pds_vfio->state_mutex); in pds_vfio_dma_logging_report()
610 err = pds_vfio_dirty_sync(pds_vfio, dirty, iova, length); in pds_vfio_dma_logging_report()
611 mutex_unlock(&pds_vfio->state_mutex); in pds_vfio_dma_logging_report()
620 struct pds_vfio_pci_device *pds_vfio = in pds_vfio_dma_logging_start() local
625 mutex_lock(&pds_vfio->state_mutex); in pds_vfio_dma_logging_start()
626 pds_vfio_send_host_vf_lm_status_cmd(pds_vfio, PDS_LM_STA_IN_PROGRESS); in pds_vfio_dma_logging_start()
627 err = pds_vfio_dirty_enable(pds_vfio, ranges, nnodes, page_size); in pds_vfio_dma_logging_start()
628 mutex_unlock(&pds_vfio->state_mutex); in pds_vfio_dma_logging_start()
635 struct pds_vfio_pci_device *pds_vfio = in pds_vfio_dma_logging_stop() local
639 mutex_lock(&pds_vfio->state_mutex); in pds_vfio_dma_logging_stop()
640 pds_vfio_dirty_disable(pds_vfio, true); in pds_vfio_dma_logging_stop()
641 mutex_unlock(&pds_vfio->state_mutex); in pds_vfio_dma_logging_stop()