Skip to content

Commit 4908d02

Browse files
jameszhu-amdalexdeucher
authored andcommitted
drm/amdgpu/vcn: merge shared memory into vcpu
Merge vcn firmware shared memory bo into vcn vcpu bo. Signed-off-by: James Zhu <[email protected]> Reviewed-by: Leo Liu <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent d10985f commit 4908d02

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
176176
bo_size = AMDGPU_VCN_STACK_SIZE + AMDGPU_VCN_CONTEXT_SIZE;
177177
if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP)
178178
bo_size += AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes) + 8);
179+
bo_size += AMDGPU_GPU_PAGE_ALIGN(sizeof(struct amdgpu_fw_shared));
179180

180181
for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
181182
if (adev->vcn.harvest_config & (1 << i))
@@ -189,6 +190,11 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
189190
return r;
190191
}
191192

193+
adev->vcn.inst[i].fw_shared_cpu_addr = adev->vcn.inst[i].cpu_addr +
194+
bo_size - AMDGPU_GPU_PAGE_ALIGN(sizeof(struct amdgpu_fw_shared));
195+
adev->vcn.inst[i].fw_shared_gpu_addr = adev->vcn.inst[i].gpu_addr +
196+
bo_size - AMDGPU_GPU_PAGE_ALIGN(sizeof(struct amdgpu_fw_shared));
197+
192198
if (adev->vcn.indirect_sram) {
193199
r = amdgpu_bo_create_kernel(adev, 64 * 2 * 4, PAGE_SIZE,
194200
AMDGPU_GEM_DOMAIN_VRAM, &adev->vcn.inst[i].dpg_sram_bo,
@@ -198,14 +204,6 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
198204
return r;
199205
}
200206
}
201-
202-
r = amdgpu_bo_create_kernel(adev, AMDGPU_GPU_PAGE_ALIGN(sizeof(struct amdgpu_fw_shared)),
203-
PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM, &adev->vcn.inst[i].fw_shared_bo,
204-
&adev->vcn.inst[i].fw_shared_gpu_addr, &adev->vcn.inst[i].fw_shared_cpu_addr);
205-
if (r) {
206-
dev_err(adev->dev, "VCN %d (%d) failed to allocate firmware shared bo\n", i, r);
207-
return r;
208-
}
209207
}
210208

211209
return 0;
@@ -221,10 +219,6 @@ int amdgpu_vcn_sw_fini(struct amdgpu_device *adev)
221219
if (adev->vcn.harvest_config & (1 << j))
222220
continue;
223221

224-
amdgpu_bo_free_kernel(&adev->vcn.inst[j].fw_shared_bo,
225-
&adev->vcn.inst[j].fw_shared_gpu_addr,
226-
(void **)&adev->vcn.inst[j].fw_shared_cpu_addr);
227-
228222
if (adev->vcn.indirect_sram) {
229223
amdgpu_bo_free_kernel(&adev->vcn.inst[j].dpg_sram_bo,
230224
&adev->vcn.inst[j].dpg_sram_gpu_addr,

drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ struct amdgpu_vcn_inst {
199199
struct amdgpu_irq_src irq;
200200
struct amdgpu_vcn_reg external;
201201
struct amdgpu_bo *dpg_sram_bo;
202-
struct amdgpu_bo *fw_shared_bo;
203202
struct dpg_pause_state pause_state;
204203
void *dpg_sram_cpu_addr;
205204
uint64_t dpg_sram_gpu_addr;

0 commit comments

Comments
 (0)