Lines Matching defs:ptdev

29 void panthor_gem_init(struct panthor_device *ptdev)
37 err = drm_gem_huge_mnt_create(&ptdev->base, "within_size");
38 if (drm_gem_get_huge_mnt(&ptdev->base))
39 drm_info(&ptdev->base, "Using Transparent Hugepage\n");
41 drm_warn(&ptdev->base, "Can't use Transparent Hugepage (%d)\n",
53 struct panthor_device *ptdev = container_of(bo->base.dev,
59 mutex_lock(&ptdev->gems.lock);
60 list_add_tail(&bo->debugfs.node, &ptdev->gems.node);
61 mutex_unlock(&ptdev->gems.lock);
66 struct panthor_device *ptdev = container_of(bo->base.dev,
72 mutex_lock(&ptdev->gems.lock);
74 mutex_unlock(&ptdev->gems.lock);
91 struct panthor_device *ptdev = container_of(bo->base.dev, struct panthor_device, base);
110 if (ptdev->coherent)
171 struct panthor_device *ptdev = container_of(bo->base.dev, struct panthor_device, base);
189 ptdev->reclaim.gpu_mapped_count += bo->base.size >> PAGE_SHIFT;
191 ptdev->reclaim.gpu_mapped_count -= bo->base.size >> PAGE_SHIFT;
195 drm_gem_lru_move_tail(&ptdev->reclaim.unused, &bo->base);
198 drm_gem_lru_move_tail(&ptdev->reclaim.mmapped, &bo->base);
204 drm_gem_lru_move_tail(&ptdev->reclaim.gpu_mapped_shared, &bo->base);
210 drm_WARN(&ptdev->base, true, "invalid GEM reclaim state (%d)\n", new_state);
1245 struct panthor_device *ptdev;
1251 ptdev = container_of(bo->obj->dev, struct panthor_device, base);
1259 if (vm == panthor_fw_vm(ptdev))
1268 * @ptdev: Device.
1282 panthor_kernel_bo_create(struct panthor_device *ptdev, struct panthor_vm *vm,
1291 if (drm_WARN_ON(&ptdev->base, !vm))
1298 if (vm == panthor_fw_vm(ptdev))
1301 bo = panthor_gem_create(&ptdev->base, size, bo_flags, vm, debug_flags);
1309 if (vm == panthor_fw_vm(ptdev)) {
1339 if (vm == panthor_fw_vm(ptdev))
1368 struct panthor_device *ptdev = shrinker->private_data;
1382 count = ptdev->reclaim.unused.count;
1383 count += ptdev->reclaim.mmapped.count;
1386 count += ptdev->reclaim.gpu_mapped_count;
1493 struct panthor_device *ptdev = shrinker->private_data;
1500 freed += drm_gem_lru_scan(&ptdev->base, &ptdev->reclaim.unused,
1506 freed += drm_gem_lru_scan(&ptdev->base, &ptdev->reclaim.mmapped,
1515 freed += panthor_mmu_reclaim_priv_bos(ptdev, sc->nr_to_scan - freed,
1520 freed += drm_gem_lru_scan(&ptdev->base, &ptdev->reclaim.gpu_mapped_shared,
1529 ptdev->reclaim.nr_pages_reclaimed_on_last_scan = freed;
1534 atomic_inc_return(&ptdev->reclaim.retry_count) < 2)
1537 atomic_set(&ptdev->reclaim.retry_count, 0);
1546 int panthor_gem_shrinker_init(struct panthor_device *ptdev)
1550 INIT_LIST_HEAD(&ptdev->reclaim.vms);
1551 drm_gem_lru_init(&ptdev->reclaim.unused);
1552 drm_gem_lru_init(&ptdev->reclaim.mmapped);
1553 drm_gem_lru_init(&ptdev->reclaim.gpu_mapped_shared);
1554 ptdev->reclaim.gpu_mapped_count = 0;
1558 might_lock(&ptdev->base.gem_lru_mutex);
1567 shrinker->private_data = ptdev;
1568 ptdev->reclaim.shrinker = shrinker;
1574 void panthor_gem_shrinker_unplug(struct panthor_device *ptdev)
1576 if (ptdev->reclaim.shrinker)
1577 shrinker_free(ptdev->reclaim.shrinker);
1669 static void panthor_gem_debugfs_print_bos(struct panthor_device *ptdev,
1680 scoped_guard(mutex, &ptdev->gems.lock) {
1681 list_for_each_entry(bo, &ptdev->gems.node, debugfs.node) {
1695 struct panthor_device *ptdev =
1698 panthor_gem_debugfs_print_bos(ptdev, m);
1709 struct panthor_device *ptdev =
1712 *val = ptdev->reclaim.nr_pages_reclaimed_on_last_scan;
1718 struct panthor_device *ptdev =
1726 if (ptdev->reclaim.shrinker)
1727 panthor_gem_shrinker_scan(ptdev->reclaim.shrinker, &sc);