Commit 52d6bb12 authored by Jack Xiao's avatar Jack Xiao Committed by Alex Deucher

drm/amdgpu/mes10.1: allocate mqd buffer

Allocate mqd buffer preparing for mes queue setup.
Signed-off-by: default avatarJack Xiao <Jack.Xiao@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 1513e24a
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "nv.h" #include "nv.h"
#include "gc/gc_10_1_0_offset.h" #include "gc/gc_10_1_0_offset.h"
#include "gc/gc_10_1_0_sh_mask.h" #include "gc/gc_10_1_0_sh_mask.h"
#include "v10_structs.h"
MODULE_FIRMWARE("amdgpu/navi10_mes.bin"); MODULE_FIRMWARE("amdgpu/navi10_mes.bin");
...@@ -375,6 +376,32 @@ static int mes_v10_1_ring_init(struct amdgpu_device *adev) ...@@ -375,6 +376,32 @@ static int mes_v10_1_ring_init(struct amdgpu_device *adev)
return 0; return 0;
} }
static int mes_v10_1_mqd_sw_init(struct amdgpu_device *adev)
{
int r, mqd_size = sizeof(struct v10_compute_mqd);
struct amdgpu_ring *ring = &adev->mes.ring;
if (ring->mqd_obj)
return 0;
r = amdgpu_bo_create_kernel(adev, mqd_size, PAGE_SIZE,
AMDGPU_GEM_DOMAIN_GTT, &ring->mqd_obj,
&ring->mqd_gpu_addr, &ring->mqd_ptr);
if (r) {
dev_warn(adev->dev, "failed to create ring mqd bo (%d)", r);
return r;
}
/* prepare MQD backup */
adev->mes.mqd_backup = kmalloc(mqd_size, GFP_KERNEL);
if (!adev->mes.mqd_backup)
dev_warn(adev->dev,
"no memory to create MQD backup for ring %s\n",
ring->name);
return 0;
}
static int mes_v10_1_sw_init(void *handle) static int mes_v10_1_sw_init(void *handle)
{ {
int r; int r;
...@@ -390,6 +417,10 @@ static int mes_v10_1_sw_init(void *handle) ...@@ -390,6 +417,10 @@ static int mes_v10_1_sw_init(void *handle)
if (r) if (r)
return r; return r;
r = mes_v10_1_mqd_sw_init(adev);
if (r)
return r;
return 0; return 0;
} }
...@@ -397,6 +428,12 @@ static int mes_v10_1_sw_fini(void *handle) ...@@ -397,6 +428,12 @@ static int mes_v10_1_sw_fini(void *handle)
{ {
struct amdgpu_device *adev = (struct amdgpu_device *)handle; struct amdgpu_device *adev = (struct amdgpu_device *)handle;
kfree(adev->mes.mqd_backup);
amdgpu_bo_free_kernel(&adev->mes.ring.mqd_obj,
&adev->mes.ring.mqd_gpu_addr,
&adev->mes.ring.mqd_ptr);
amdgpu_bo_free_kernel(&adev->mes.eop_gpu_obj, amdgpu_bo_free_kernel(&adev->mes.eop_gpu_obj,
&adev->mes.eop_gpu_addr, &adev->mes.eop_gpu_addr,
NULL); NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment