@@ -66,6 +66,8 @@ int amdgpu_umc_page_retirement_mca(struct amdgpu_device *adev,
66
66
goto out_fini_err_data ;
67
67
}
68
68
69
+ err_data .err_addr_len = adev -> umc .max_ras_err_cnt_per_query ;
70
+
69
71
/*
70
72
* Translate UMC channel address to Physical address
71
73
*/
@@ -121,6 +123,8 @@ void amdgpu_umc_handle_bad_pages(struct amdgpu_device *adev,
121
123
if (!err_data -> err_addr )
122
124
dev_warn (adev -> dev , "Failed to alloc memory for "
123
125
"umc error address record!\n" );
126
+ else
127
+ err_data -> err_addr_len = adev -> umc .max_ras_err_cnt_per_query ;
124
128
125
129
/* umc query_ras_error_address is also responsible for clearing
126
130
* error status
@@ -146,6 +150,8 @@ void amdgpu_umc_handle_bad_pages(struct amdgpu_device *adev,
146
150
if (!err_data -> err_addr )
147
151
dev_warn (adev -> dev , "Failed to alloc memory for "
148
152
"umc error address record!\n" );
153
+ else
154
+ err_data -> err_addr_len = adev -> umc .max_ras_err_cnt_per_query ;
149
155
150
156
/* umc query_ras_error_address is also responsible for clearing
151
157
* error status
@@ -389,14 +395,20 @@ int amdgpu_umc_process_ecc_irq(struct amdgpu_device *adev,
389
395
return 0 ;
390
396
}
391
397
392
- void amdgpu_umc_fill_error_record (struct ras_err_data * err_data ,
398
+ int amdgpu_umc_fill_error_record (struct ras_err_data * err_data ,
393
399
uint64_t err_addr ,
394
400
uint64_t retired_page ,
395
401
uint32_t channel_index ,
396
402
uint32_t umc_inst )
397
403
{
398
- struct eeprom_table_record * err_rec =
399
- & err_data -> err_addr [err_data -> err_addr_cnt ];
404
+ struct eeprom_table_record * err_rec ;
405
+
406
+ if (!err_data ||
407
+ !err_data -> err_addr ||
408
+ (err_data -> err_addr_cnt >= err_data -> err_addr_len ))
409
+ return - EINVAL ;
410
+
411
+ err_rec = & err_data -> err_addr [err_data -> err_addr_cnt ];
400
412
401
413
err_rec -> address = err_addr ;
402
414
/* page frame address is saved */
@@ -408,6 +420,8 @@ void amdgpu_umc_fill_error_record(struct ras_err_data *err_data,
408
420
err_rec -> mcumc_id = umc_inst ;
409
421
410
422
err_data -> err_addr_cnt ++ ;
423
+
424
+ return 0 ;
411
425
}
412
426
413
427
int amdgpu_umc_loop_channels (struct amdgpu_device * adev ,
0 commit comments