]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amdgpu: Add cgroups implementation
authorMaarten Lankhorst <dev@lankhorst.se>
Thu, 27 Mar 2025 19:51:28 +0000 (20:51 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 7 Apr 2025 19:18:30 +0000 (15:18 -0400)
Similar to xe, enable some simple management of VRAM only.

Reviewed-by: Christian König <christian.koenig@amd.com>
Co-developed-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c

index 6da8994e0469afd646e8f8acd4214b076c117ec2..2d7f82e98df92c95b5cb3fb78486c19314163aa8 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <linux/dma-mapping.h>
 #include <drm/ttm/ttm_range_manager.h>
+#include <drm/drm_drv.h>
 
 #include "amdgpu.h"
 #include "amdgpu_vm.h"
@@ -907,6 +908,9 @@ int amdgpu_vram_mgr_init(struct amdgpu_device *adev)
        struct ttm_resource_manager *man = &mgr->manager;
        int err;
 
+       man->cg = drmm_cgroup_register_region(adev_to_drm(adev), "vram", adev->gmc.real_vram_size);
+       if (IS_ERR(man->cg))
+               return PTR_ERR(man->cg);
        ttm_resource_manager_init(man, &adev->mman.bdev,
                                  adev->gmc.real_vram_size);