@@ -176,6 +176,7 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
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 ))
@@ -189,6 +190,11 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
189
190
return r ;
190
191
}
191
192
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
+
192
198
if (adev -> vcn .indirect_sram ) {
193
199
r = amdgpu_bo_create_kernel (adev , 64 * 2 * 4 , PAGE_SIZE ,
194
200
AMDGPU_GEM_DOMAIN_VRAM , & adev -> vcn .inst [i ].dpg_sram_bo ,
@@ -198,14 +204,6 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
198
204
return r ;
199
205
}
200
206
}
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
- }
209
207
}
210
208
211
209
return 0 ;
@@ -221,10 +219,6 @@ int amdgpu_vcn_sw_fini(struct amdgpu_device *adev)
221
219
if (adev -> vcn .harvest_config & (1 << j ))
222
220
continue ;
223
221
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
-
228
222
if (adev -> vcn .indirect_sram ) {
229
223
amdgpu_bo_free_kernel (& adev -> vcn .inst [j ].dpg_sram_bo ,
230
224
& adev -> vcn .inst [j ].dpg_sram_gpu_addr ,
0 commit comments