提交 08d1bdd4 编写于 作者: R Rex Zhu 提交者: Alex Deucher

drm/amdgpu: Limit vm max ctx number to 4096

driver need to reserve resource for each ctx for
some hw features. so add this limitation.
Reviewed-by: NChristian König <christian.koenig@amd.com>
Signed-off-by: NRex Zhu <Rex.Zhu@amd.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 31edd7c0
...@@ -164,6 +164,7 @@ extern int amdgpu_si_support; ...@@ -164,6 +164,7 @@ extern int amdgpu_si_support;
extern int amdgpu_cik_support; extern int amdgpu_cik_support;
#endif #endif
#define AMDGPU_VM_MAX_NUM_CTX 4096
#define AMDGPU_SG_THRESHOLD (256*1024*1024) #define AMDGPU_SG_THRESHOLD (256*1024*1024)
#define AMDGPU_DEFAULT_GTT_SIZE_MB 3072ULL /* 3GB by default */ #define AMDGPU_DEFAULT_GTT_SIZE_MB 3072ULL /* 3GB by default */
#define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS 3000 #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS 3000
......
...@@ -248,7 +248,7 @@ static int amdgpu_ctx_alloc(struct amdgpu_device *adev, ...@@ -248,7 +248,7 @@ static int amdgpu_ctx_alloc(struct amdgpu_device *adev,
return -ENOMEM; return -ENOMEM;
mutex_lock(&mgr->lock); mutex_lock(&mgr->lock);
r = idr_alloc(&mgr->ctx_handles, ctx, 1, 0, GFP_KERNEL); r = idr_alloc(&mgr->ctx_handles, ctx, 1, AMDGPU_VM_MAX_NUM_CTX, GFP_KERNEL);
if (r < 0) { if (r < 0) {
mutex_unlock(&mgr->lock); mutex_unlock(&mgr->lock);
kfree(ctx); kfree(ctx);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册