Lines Matching refs:bcontainer
147 return vbasedev->bcontainer->space->as != &address_space_memory; in vfio_viommu_preset()
173 static bool vfio_devices_all_dirty_tracking(VFIOContainerBase *bcontainer) in vfio_devices_all_dirty_tracking() argument
181 QLIST_FOREACH(vbasedev, &bcontainer->device_list, container_next) { in vfio_devices_all_dirty_tracking()
197 bool vfio_devices_all_device_dirty_tracking(const VFIOContainerBase *bcontainer) in vfio_devices_all_device_dirty_tracking() argument
201 QLIST_FOREACH(vbasedev, &bcontainer->device_list, container_next) { in vfio_devices_all_device_dirty_tracking()
218 vfio_devices_all_running_and_mig_active(const VFIOContainerBase *bcontainer) in vfio_devices_all_running_and_mig_active() argument
226 QLIST_FOREACH(vbasedev, &bcontainer->device_list, container_next) { in vfio_devices_all_running_and_mig_active()
291 VFIOContainerBase *bcontainer = giommu->bcontainer; in vfio_iommu_map_notify() local
323 ret = vfio_container_dma_map(bcontainer, iova, in vfio_iommu_map_notify()
329 bcontainer, iova, in vfio_iommu_map_notify()
333 ret = vfio_container_dma_unmap(bcontainer, iova, in vfio_iommu_map_notify()
338 bcontainer, iova, in vfio_iommu_map_notify()
352 VFIOContainerBase *bcontainer = vrdl->bcontainer; in vfio_ram_discard_notify_discard() local
358 ret = vfio_container_dma_unmap(bcontainer, iova, size , NULL); in vfio_ram_discard_notify_discard()
370 VFIOContainerBase *bcontainer = vrdl->bcontainer; in vfio_ram_discard_notify_populate() local
389 ret = vfio_container_dma_map(bcontainer, iova, next - start, in vfio_ram_discard_notify_populate()
400 static void vfio_register_ram_discard_listener(VFIOContainerBase *bcontainer, in vfio_register_ram_discard_listener() argument
413 vrdl->bcontainer = bcontainer; in vfio_register_ram_discard_listener()
421 g_assert(bcontainer->pgsizes && in vfio_register_ram_discard_listener()
422 vrdl->granularity >= 1ULL << ctz64(bcontainer->pgsizes)); in vfio_register_ram_discard_listener()
428 QLIST_INSERT_HEAD(&bcontainer->vrdl_list, vrdl, next); in vfio_register_ram_discard_listener()
443 if (bcontainer->dma_max_mappings) { in vfio_register_ram_discard_listener()
452 QLIST_FOREACH(vrdl, &bcontainer->vrdl_list, next) { in vfio_register_ram_discard_listener()
464 bcontainer->dma_max_mappings) { in vfio_register_ram_discard_listener()
468 " memslots: %d", __func__, bcontainer->dma_max_mappings, in vfio_register_ram_discard_listener()
474 static void vfio_unregister_ram_discard_listener(VFIOContainerBase *bcontainer, in vfio_unregister_ram_discard_listener() argument
480 QLIST_FOREACH(vrdl, &bcontainer->vrdl_list, next) { in vfio_unregister_ram_discard_listener()
542 static bool vfio_get_section_iova_range(VFIOContainerBase *bcontainer, in vfio_get_section_iova_range() argument
570 VFIOContainerBase *bcontainer = container_of(listener, VFIOContainerBase, in vfio_listener_region_add() local
582 if (!vfio_get_section_iova_range(bcontainer, section, &iova, &end, in vfio_listener_region_add()
594 if (!vfio_container_add_section_window(bcontainer, section, &err)) { in vfio_listener_region_add()
616 giommu->bcontainer = bcontainer; in vfio_listener_region_add()
634 QLIST_INSERT_HEAD(&bcontainer->giommu_list, giommu, giommu_next); in vfio_listener_region_add()
648 vfio_register_ram_discard_listener(bcontainer, section); in vfio_listener_region_add()
661 hwaddr pgmask = (1ULL << ctz64(bcontainer->pgsizes)) - 1; in vfio_listener_region_add()
673 ret = vfio_container_dma_map(bcontainer, iova, int128_get64(llsize), in vfio_listener_region_add()
678 bcontainer, iova, int128_get64(llsize), vaddr, ret, in vfio_listener_region_add()
700 if (!bcontainer->initialized) { in vfio_listener_region_add()
701 if (!bcontainer->error) { in vfio_listener_region_add()
702 error_propagate_prepend(&bcontainer->error, err, in vfio_listener_region_add()
717 VFIOContainerBase *bcontainer = container_of(listener, VFIOContainerBase, in vfio_listener_region_del() local
732 QLIST_FOREACH(giommu, &bcontainer->giommu_list, giommu_next) { in vfio_listener_region_del()
752 if (!vfio_get_section_iova_range(bcontainer, section, &iova, &end, in vfio_listener_region_del()
764 pgmask = (1ULL << ctz64(bcontainer->pgsizes)) - 1; in vfio_listener_region_del()
767 vfio_unregister_ram_discard_listener(bcontainer, section); in vfio_listener_region_del()
776 ret = vfio_container_dma_unmap(bcontainer, iova, in vfio_listener_region_del()
781 bcontainer, iova, int128_get64(llsize), ret, in vfio_listener_region_del()
786 ret = vfio_container_dma_unmap(bcontainer, iova, in vfio_listener_region_del()
791 bcontainer, iova, int128_get64(llsize), ret, in vfio_listener_region_del()
798 vfio_container_del_section_window(bcontainer, section); in vfio_listener_region_del()
811 VFIOContainerBase *bcontainer; member
817 VFIOContainerBase *bcontainer) in vfio_section_is_vfio_pci() argument
825 QLIST_FOREACH(vbasedev, &bcontainer->device_list, container_next) { in vfio_section_is_vfio_pci()
888 !vfio_get_section_iova_range(dirty->bcontainer, section, in vfio_dirty_tracking_update()
894 vfio_section_is_vfio_pci(section, dirty->bcontainer)); in vfio_dirty_tracking_update()
902 static void vfio_dirty_tracking_init(VFIOContainerBase *bcontainer, in vfio_dirty_tracking_init() argument
912 dirty.bcontainer = bcontainer; in vfio_dirty_tracking_init()
915 bcontainer->space->as); in vfio_dirty_tracking_init()
927 static void vfio_devices_dma_logging_stop(VFIOContainerBase *bcontainer) in vfio_devices_dma_logging_stop() argument
938 QLIST_FOREACH(vbasedev, &bcontainer->device_list, container_next) { in vfio_devices_dma_logging_stop()
952 vfio_device_feature_dma_logging_start_create(VFIOContainerBase *bcontainer, in vfio_device_feature_dma_logging_start_create() argument
1025 static bool vfio_devices_dma_logging_start(VFIOContainerBase *bcontainer, in vfio_devices_dma_logging_start() argument
1033 vfio_dirty_tracking_init(bcontainer, &ranges); in vfio_devices_dma_logging_start()
1034 feature = vfio_device_feature_dma_logging_start_create(bcontainer, in vfio_devices_dma_logging_start()
1041 QLIST_FOREACH(vbasedev, &bcontainer->device_list, container_next) { in vfio_devices_dma_logging_start()
1058 vfio_devices_dma_logging_stop(bcontainer); in vfio_devices_dma_logging_start()
1070 VFIOContainerBase *bcontainer = container_of(listener, VFIOContainerBase, in vfio_listener_log_global_start() local
1074 if (vfio_devices_all_device_dirty_tracking(bcontainer)) { in vfio_listener_log_global_start()
1075 ret = vfio_devices_dma_logging_start(bcontainer, errp); in vfio_listener_log_global_start()
1077 ret = vfio_container_set_dirty_page_tracking(bcontainer, true, errp) == 0; in vfio_listener_log_global_start()
1088 VFIOContainerBase *bcontainer = container_of(listener, VFIOContainerBase, in vfio_listener_log_global_stop() local
1093 if (vfio_devices_all_device_dirty_tracking(bcontainer)) { in vfio_listener_log_global_stop()
1094 vfio_devices_dma_logging_stop(bcontainer); in vfio_listener_log_global_stop()
1096 ret = vfio_container_set_dirty_page_tracking(bcontainer, false, in vfio_listener_log_global_stop()
1134 int vfio_devices_query_dirty_bitmap(const VFIOContainerBase *bcontainer, in vfio_devices_query_dirty_bitmap() argument
1140 QLIST_FOREACH(vbasedev, &bcontainer->device_list, container_next) { in vfio_devices_query_dirty_bitmap()
1156 int vfio_get_dirty_bitmap(const VFIOContainerBase *bcontainer, uint64_t iova, in vfio_get_dirty_bitmap() argument
1160 vfio_devices_all_device_dirty_tracking(bcontainer); in vfio_get_dirty_bitmap()
1165 if (!bcontainer->dirty_pages_supported && !all_device_dirty_tracking) { in vfio_get_dirty_bitmap()
1180 ret = vfio_devices_query_dirty_bitmap(bcontainer, &vbmap, iova, size, in vfio_get_dirty_bitmap()
1183 ret = vfio_container_query_dirty_bitmap(bcontainer, &vbmap, iova, size, in vfio_get_dirty_bitmap()
1211 VFIOContainerBase *bcontainer = giommu->bcontainer; in vfio_iommu_map_dirty_notify() local
1231 ret = vfio_get_dirty_bitmap(bcontainer, iova, iotlb->addr_mask + 1, in vfio_iommu_map_dirty_notify()
1236 "0x%"HWADDR_PRIx") failed - ", bcontainer, iova, in vfio_iommu_map_dirty_notify()
1265 ret = vfio_get_dirty_bitmap(vrdl->bcontainer, iova, size, ram_addr, in vfio_ram_discard_get_dirty_bitmap()
1274 vfio_sync_ram_discard_listener_dirty_bitmap(VFIOContainerBase *bcontainer, in vfio_sync_ram_discard_listener_dirty_bitmap() argument
1280 QLIST_FOREACH(vrdl, &bcontainer->vrdl_list, next) { in vfio_sync_ram_discard_listener_dirty_bitmap()
1301 static int vfio_sync_iommu_dirty_bitmap(VFIOContainerBase *bcontainer, in vfio_sync_iommu_dirty_bitmap() argument
1310 QLIST_FOREACH(giommu, &bcontainer->giommu_list, giommu_next) { in vfio_sync_iommu_dirty_bitmap()
1338 static int vfio_sync_dirty_bitmap(VFIOContainerBase *bcontainer, in vfio_sync_dirty_bitmap() argument
1344 return vfio_sync_iommu_dirty_bitmap(bcontainer, section); in vfio_sync_dirty_bitmap()
1348 ret = vfio_sync_ram_discard_listener_dirty_bitmap(bcontainer, section); in vfio_sync_dirty_bitmap()
1359 return vfio_get_dirty_bitmap(bcontainer, in vfio_sync_dirty_bitmap()
1367 VFIOContainerBase *bcontainer = container_of(listener, VFIOContainerBase, in vfio_listener_log_sync() local
1376 if (vfio_devices_all_dirty_tracking(bcontainer)) { in vfio_listener_log_sync()
1377 ret = vfio_sync_dirty_bitmap(bcontainer, section, &local_err); in vfio_listener_log_sync()
1508 VFIOContainerBase *bcontainer) in vfio_address_space_insert() argument
1510 QLIST_INSERT_HEAD(&space->containers, bcontainer, next); in vfio_address_space_insert()
1511 bcontainer->space = space; in vfio_address_space_insert()
1568 if (!vbasedev->bcontainer) { in vfio_detach_device()
1572 VFIO_IOMMU_GET_CLASS(vbasedev->bcontainer)->detach_device(vbasedev); in vfio_detach_device()