mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	drm/amd/amdgpu: add RLC firmware to support raven1 refresh
Use SMU firmware version to indentify the raven1 refresh device and then load homologous RLC FW. Signed-off-by: Prike Liang <Prike.Liang@amd.com> Suggested-by: Huang Rui<Ray.Huang@amd.com> Reviewed-by: Huang Rui <ray.huang@amd.com> Reviewed-by: Evan Quan <evan.quan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
		
							parent
							
								
									1019fe047a
								
							
						
					
					
						commit
						1929059893
					
				
					 4 changed files with 30 additions and 10 deletions
				
			
		| 
						 | 
					@ -1589,6 +1589,7 @@ static int amdgpu_device_fw_loading(struct amdgpu_device *adev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int r = 0;
 | 
						int r = 0;
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
 | 
						uint32_t smu_version;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (adev->asic_type >= CHIP_VEGA10) {
 | 
						if (adev->asic_type >= CHIP_VEGA10) {
 | 
				
			||||||
		for (i = 0; i < adev->num_ip_blocks; i++) {
 | 
							for (i = 0; i < adev->num_ip_blocks; i++) {
 | 
				
			||||||
| 
						 | 
					@ -1614,16 +1615,9 @@ static int amdgpu_device_fw_loading(struct amdgpu_device *adev)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						r = amdgpu_pm_load_smu_firmware(adev, &smu_version);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->load_firmware) {
 | 
					 | 
				
			||||||
		r = adev->powerplay.pp_funcs->load_firmware(adev->powerplay.pp_handle);
 | 
					 | 
				
			||||||
		if (r) {
 | 
					 | 
				
			||||||
			pr_err("firmware loading failed\n");
 | 
					 | 
				
			||||||
	return r;
 | 
						return r;
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return 0;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2490,6 +2490,21 @@ void amdgpu_pm_print_power_states(struct amdgpu_device *adev)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int amdgpu_pm_load_smu_firmware(struct amdgpu_device *adev, uint32_t *smu_version)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						int r = -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs->load_firmware) {
 | 
				
			||||||
 | 
							r = adev->powerplay.pp_funcs->load_firmware(adev->powerplay.pp_handle);
 | 
				
			||||||
 | 
							if (r) {
 | 
				
			||||||
 | 
								pr_err("smu firmware loading failed\n");
 | 
				
			||||||
 | 
								return r;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							*smu_version = adev->pm.fw_version;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return r;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
 | 
					int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
 | 
						struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,6 +34,7 @@ void amdgpu_pm_acpi_event_handler(struct amdgpu_device *adev);
 | 
				
			||||||
int amdgpu_pm_sysfs_init(struct amdgpu_device *adev);
 | 
					int amdgpu_pm_sysfs_init(struct amdgpu_device *adev);
 | 
				
			||||||
void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev);
 | 
					void amdgpu_pm_sysfs_fini(struct amdgpu_device *adev);
 | 
				
			||||||
void amdgpu_pm_print_power_states(struct amdgpu_device *adev);
 | 
					void amdgpu_pm_print_power_states(struct amdgpu_device *adev);
 | 
				
			||||||
 | 
					int amdgpu_pm_load_smu_firmware(struct amdgpu_device *adev, uint32_t *smu_version);
 | 
				
			||||||
void amdgpu_pm_compute_clocks(struct amdgpu_device *adev);
 | 
					void amdgpu_pm_compute_clocks(struct amdgpu_device *adev);
 | 
				
			||||||
void amdgpu_dpm_thermal_work_handler(struct work_struct *work);
 | 
					void amdgpu_dpm_thermal_work_handler(struct work_struct *work);
 | 
				
			||||||
void amdgpu_dpm_enable_uvd(struct amdgpu_device *adev, bool enable);
 | 
					void amdgpu_dpm_enable_uvd(struct amdgpu_device *adev, bool enable);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,6 +28,7 @@
 | 
				
			||||||
#include "soc15.h"
 | 
					#include "soc15.h"
 | 
				
			||||||
#include "soc15d.h"
 | 
					#include "soc15d.h"
 | 
				
			||||||
#include "amdgpu_atomfirmware.h"
 | 
					#include "amdgpu_atomfirmware.h"
 | 
				
			||||||
 | 
					#include "amdgpu_pm.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "gc/gc_9_0_offset.h"
 | 
					#include "gc/gc_9_0_offset.h"
 | 
				
			||||||
#include "gc/gc_9_0_sh_mask.h"
 | 
					#include "gc/gc_9_0_sh_mask.h"
 | 
				
			||||||
| 
						 | 
					@ -96,6 +97,7 @@ MODULE_FIRMWARE("amdgpu/raven2_me.bin");
 | 
				
			||||||
MODULE_FIRMWARE("amdgpu/raven2_mec.bin");
 | 
					MODULE_FIRMWARE("amdgpu/raven2_mec.bin");
 | 
				
			||||||
MODULE_FIRMWARE("amdgpu/raven2_mec2.bin");
 | 
					MODULE_FIRMWARE("amdgpu/raven2_mec2.bin");
 | 
				
			||||||
MODULE_FIRMWARE("amdgpu/raven2_rlc.bin");
 | 
					MODULE_FIRMWARE("amdgpu/raven2_rlc.bin");
 | 
				
			||||||
 | 
					MODULE_FIRMWARE("amdgpu/raven_kicker_rlc.bin");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct soc15_reg_golden golden_settings_gc_9_0[] =
 | 
					static const struct soc15_reg_golden golden_settings_gc_9_0[] =
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -588,7 +590,8 @@ static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev)
 | 
				
			||||||
	case CHIP_RAVEN:
 | 
						case CHIP_RAVEN:
 | 
				
			||||||
		if (adev->rev_id >= 0x8 || adev->pdev->device == 0x15d8)
 | 
							if (adev->rev_id >= 0x8 || adev->pdev->device == 0x15d8)
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		if ((adev->gfx.rlc_fw_version < 531) ||
 | 
							if ((adev->gfx.rlc_fw_version != 106 &&
 | 
				
			||||||
 | 
							     adev->gfx.rlc_fw_version < 531) ||
 | 
				
			||||||
		    (adev->gfx.rlc_fw_version == 53815) ||
 | 
							    (adev->gfx.rlc_fw_version == 53815) ||
 | 
				
			||||||
		    (adev->gfx.rlc_feature_version < 1) ||
 | 
							    (adev->gfx.rlc_feature_version < 1) ||
 | 
				
			||||||
		    !adev->gfx.rlc.is_rlc_v2_1)
 | 
							    !adev->gfx.rlc.is_rlc_v2_1)
 | 
				
			||||||
| 
						 | 
					@ -612,6 +615,7 @@ static int gfx_v9_0_init_microcode(struct amdgpu_device *adev)
 | 
				
			||||||
	unsigned int i = 0;
 | 
						unsigned int i = 0;
 | 
				
			||||||
	uint16_t version_major;
 | 
						uint16_t version_major;
 | 
				
			||||||
	uint16_t version_minor;
 | 
						uint16_t version_minor;
 | 
				
			||||||
 | 
						uint32_t smu_version;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	DRM_DEBUG("\n");
 | 
						DRM_DEBUG("\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -682,6 +686,12 @@ static int gfx_v9_0_init_microcode(struct amdgpu_device *adev)
 | 
				
			||||||
		(((adev->pdev->revision >= 0xC8) && (adev->pdev->revision <= 0xCF)) ||
 | 
							(((adev->pdev->revision >= 0xC8) && (adev->pdev->revision <= 0xCF)) ||
 | 
				
			||||||
		((adev->pdev->revision >= 0xD8) && (adev->pdev->revision <= 0xDF))))
 | 
							((adev->pdev->revision >= 0xD8) && (adev->pdev->revision <= 0xDF))))
 | 
				
			||||||
		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc_am4.bin", chip_name);
 | 
							snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc_am4.bin", chip_name);
 | 
				
			||||||
 | 
						else if (!strcmp(chip_name, "raven") && (amdgpu_pm_load_smu_firmware(adev, &smu_version) == 0) &&
 | 
				
			||||||
 | 
							(smu_version >= 0x41e2b))
 | 
				
			||||||
 | 
							/**
 | 
				
			||||||
 | 
							*SMC is loaded by SBIOS on APU and it's able to get the SMU version directly.
 | 
				
			||||||
 | 
							*/
 | 
				
			||||||
 | 
							snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_kicker_rlc.bin", chip_name);
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
 | 
							snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
 | 
				
			||||||
	err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
 | 
						err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue