File tree Expand file tree Collapse file tree
drivers/gpu/drm/amd/amdgpu Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3767,6 +3767,8 @@ int amdgpu_ras_init_badpage_info(struct amdgpu_device *adev)
37673767 return 0 ;
37683768
37693769 control = & con -> eeprom_control ;
3770+ con -> ras_smu_drv = amdgpu_dpm_get_ras_smu_driver (adev );
3771+
37703772 ret = amdgpu_ras_eeprom_init (control );
37713773 control -> is_eeprom_valid = !ret ;
37723774
Original file line number Diff line number Diff line change @@ -1546,7 +1546,8 @@ void amdgpu_ras_eeprom_check_and_recover(struct amdgpu_device *adev)
15461546 struct amdgpu_ras_eeprom_control * control ;
15471547 int res ;
15481548
1549- if (!__is_ras_eeprom_supported (adev ) || !ras )
1549+ if (!__is_ras_eeprom_supported (adev ) || !ras ||
1550+ amdgpu_ras_smu_eeprom_supported (adev ))
15501551 return ;
15511552 control = & ras -> eeprom_control ;
15521553 if (!control -> is_eeprom_valid )
@@ -1566,4 +1567,45 @@ void amdgpu_ras_eeprom_check_and_recover(struct amdgpu_device *adev)
15661567 control -> is_eeprom_valid = false;
15671568 }
15681569 return ;
1569- }
1570+ }
1571+
1572+ static const struct ras_smu_drv * amdgpu_ras_get_smu_ras_drv (struct amdgpu_device * adev )
1573+ {
1574+ struct amdgpu_ras * ras = amdgpu_ras_get_context (adev );
1575+
1576+ if (!ras )
1577+ return NULL ;
1578+
1579+ return ras -> ras_smu_drv ;
1580+ }
1581+
1582+ static uint64_t amdgpu_ras_smu_get_feature_flags (struct amdgpu_device * adev )
1583+ {
1584+ const struct ras_smu_drv * ras_smu_drv = amdgpu_ras_get_smu_ras_drv (adev );
1585+ uint64_t flags = 0ULL ;
1586+
1587+ if (!ras_smu_drv )
1588+ goto out ;
1589+
1590+ if (ras_smu_drv -> ras_smu_feature_flags )
1591+ ras_smu_drv -> ras_smu_feature_flags (adev , & flags );
1592+
1593+ out :
1594+ return flags ;
1595+ }
1596+
1597+ bool amdgpu_ras_smu_eeprom_supported (struct amdgpu_device * adev )
1598+ {
1599+ const struct ras_smu_drv * smu_ras_drv = amdgpu_ras_get_smu_ras_drv (adev );
1600+ uint64_t flags = 0ULL ;
1601+
1602+ if (!__is_ras_eeprom_supported (adev ) || !smu_ras_drv )
1603+ return false;
1604+
1605+ if (!smu_ras_drv -> smu_eeprom_funcs )
1606+ return false;
1607+
1608+ flags = amdgpu_ras_smu_get_feature_flags (adev );
1609+
1610+ return !!(flags & RAS_SMU_FEATURE_BIT__RAS_EEPROM );
1611+ }
Original file line number Diff line number Diff line change @@ -163,6 +163,8 @@ int amdgpu_ras_eeprom_check(struct amdgpu_ras_eeprom_control *control);
163163
164164void amdgpu_ras_eeprom_check_and_recover (struct amdgpu_device * adev );
165165
166+ bool amdgpu_ras_smu_eeprom_supported (struct amdgpu_device * adev );
167+
166168extern const struct file_operations amdgpu_ras_debugfs_eeprom_size_ops ;
167169extern const struct file_operations amdgpu_ras_debugfs_eeprom_table_ops ;
168170
You can’t perform that action at this time.
0 commit comments