Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu/vcn: merge shared memory into vcpu

Merge vcn firmware shared memory bo into vcn vcpu bo.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

James Zhu and committed by
Alex Deucher
4908d026 d10985f4

+6 -13
+6 -12
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
··· 176 176 bo_size = AMDGPU_VCN_STACK_SIZE + AMDGPU_VCN_CONTEXT_SIZE; 177 177 if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) 178 178 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)); 179 180 180 181 for (i = 0; i < adev->vcn.num_vcn_inst; i++) { 181 182 if (adev->vcn.harvest_config & (1 << i)) ··· 190 189 return r; 191 190 } 192 191 192 + adev->vcn.inst[i].fw_shared_cpu_addr = adev->vcn.inst[i].cpu_addr + 193 + bo_size - AMDGPU_GPU_PAGE_ALIGN(sizeof(struct amdgpu_fw_shared)); 194 + adev->vcn.inst[i].fw_shared_gpu_addr = adev->vcn.inst[i].gpu_addr + 195 + bo_size - AMDGPU_GPU_PAGE_ALIGN(sizeof(struct amdgpu_fw_shared)); 196 + 193 197 if (adev->vcn.indirect_sram) { 194 198 r = amdgpu_bo_create_kernel(adev, 64 * 2 * 4, PAGE_SIZE, 195 199 AMDGPU_GEM_DOMAIN_VRAM, &adev->vcn.inst[i].dpg_sram_bo, ··· 203 197 dev_err(adev->dev, "VCN %d (%d) failed to allocate DPG bo\n", i, r); 204 198 return r; 205 199 } 206 - } 207 - 208 - r = amdgpu_bo_create_kernel(adev, AMDGPU_GPU_PAGE_ALIGN(sizeof(struct amdgpu_fw_shared)), 209 - PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM, &adev->vcn.inst[i].fw_shared_bo, 210 - &adev->vcn.inst[i].fw_shared_gpu_addr, &adev->vcn.inst[i].fw_shared_cpu_addr); 211 - if (r) { 212 - dev_err(adev->dev, "VCN %d (%d) failed to allocate firmware shared bo\n", i, r); 213 - return r; 214 200 } 215 201 } 216 202 ··· 218 220 for (j = 0; j < adev->vcn.num_vcn_inst; ++j) { 219 221 if (adev->vcn.harvest_config & (1 << j)) 220 222 continue; 221 - 222 - amdgpu_bo_free_kernel(&adev->vcn.inst[j].fw_shared_bo, 223 - &adev->vcn.inst[j].fw_shared_gpu_addr, 224 - (void **)&adev->vcn.inst[j].fw_shared_cpu_addr); 225 223 226 224 if (adev->vcn.indirect_sram) { 227 225 amdgpu_bo_free_kernel(&adev->vcn.inst[j].dpg_sram_bo,
-1
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h
··· 199 199 struct amdgpu_irq_src irq; 200 200 struct amdgpu_vcn_reg external; 201 201 struct amdgpu_bo *dpg_sram_bo; 202 - struct amdgpu_bo *fw_shared_bo; 203 202 struct dpg_pause_state pause_state; 204 203 void *dpg_sram_cpu_addr; 205 204 uint64_t dpg_sram_gpu_addr;