Skip to contentSkip to conversation

drm/amd/powerplay: add set_power_profile_mode for raven1_refresh

PATCH In review Prike Liang 3 participants 6 messages May 31, 2019 – Jun 3, 2019 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/amd/powerplay: add set_power_profile_mode for raven1_refresh

From: Chengming Gui <[email protected]>

add gfxoff_state_changed_by_workload to control gfxoff when set power_profile_mode

---
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c       |  1 +
 drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | 31 ++++++++++++++++++++---
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h         |  1 +
 3 files changed, 30 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +1 -0
index 6cd6497..f1d326c 100644
@@ -92,6 +92,7 @@ int hwmgr_early_init(struct pp_hwmgr *hwmgr)
 	hwmgr_set_user_specify_caps(hwmgr);
 	hwmgr->fan_ctrl_is_in_default_mode = true;
 	hwmgr_init_workload_prority(hwmgr);
+	hwmgr->gfxoff_state_changed_by_workload = false;
 
 	switch (hwmgr->chip_family) {
 	case AMDGPU_FAMILY_CI:
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c +28 -3
index 9a595f7..e32ae9d 100644
@@ -1258,21 +1258,46 @@ static int smu10_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)
 	return size;
 }
 
+static bool smu10_is_raven1_refresh(struct pp_hwmgr *hwmgr)
+{
+	struct amdgpu_device *adev = hwmgr->adev;
+	if ((adev->asic_type == CHIP_RAVEN) &&
+	    (adev->rev_id != 0x15d8) &&
+	    (hwmgr->smu_version >= 0x41e2b))
+		return true;
+	else
+		return false;
+}
+
 static int smu10_set_power_profile_mode(struct pp_hwmgr *hwmgr, long *input, uint32_t size)
 {
 	int workload_type = 0;
+	int result = 0;
 
 	if (input[size] > PP_SMC_POWER_PROFILE_COMPUTE) {
 		pr_err("Invalid power profile mode %ld\n", input[size]);
 		return -EINVAL;
 	}
-	hwmgr->power_profile_mode = input[size];
+	if (hwmgr->power_profile_mode == input[size])
+		return 0;
 
 	/* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
 	workload_type =
-		conv_power_profile_to_pplib_workload(hwmgr->power_profile_mode);
-	smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_ActiveProcessNotify,
+		conv_power_profile_to_pplib_workload(input[size]);
+	if (workload_type &&
+	    smu10_is_raven1_refresh(hwmgr) &&
+	    !hwmgr->gfxoff_state_changed_by_workload) {
+		smu10_gfx_off_control(hwmgr, false);
+		hwmgr->gfxoff_state_changed_by_workload = true;
+	}
+	result = smum_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_ActiveProcessNotify,
 						1 << workload_type);
+	if (!result)
+		hwmgr->power_profile_mode = input[size];
+	if (workload_type && hwmgr->gfxoff_state_changed_by_workload) {
+		smu10_gfx_off_control(hwmgr, true);
+		hwmgr->gfxoff_state_changed_by_workload = false;
+	}
 
 	return 0;
 }
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1 -0
index bac3d85..c92999a 100644
@@ -782,6 +782,7 @@ struct pp_hwmgr {
 	uint32_t workload_mask;
 	uint32_t workload_prority[Workload_Policy_Max];
 	uint32_t workload_setting[Workload_Policy_Max];
+	bool gfxoff_state_changed_by_workload;
 };
 
 int hwmgr_early_init(struct pp_hwmgr *hwmgr);
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1559308246-11211-1-git-send-email-Prike.Liang-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 2/2 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.

Change-Id I7aaa67d8b59cfec03355d9199f7fb2c30ce39856
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 +++---------
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c     | 15 +++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h     |  1 +
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c      | 14 +++++++++++++-
 4 files changed, 32 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -9
index 6fea2d1..44dd9d8 100644
@@ -1620,6 +1620,7 @@ static int amdgpu_device_fw_loading(struct amdgpu_device *adev)
 {
 	int r = 0;
 	int i;
+	uint32_t smu_version;
 
 	if (adev->asic_type >= CHIP_VEGA10) {
 		for (i = 0; i < adev->num_ip_blocks; i++) {
@@ -1645,16 +1646,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 0;
+	return r;
 }
 
 /**
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +15 -0
index bd40d5d..dae9a58 100644
@@ -2668,6 +2668,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;
+
+	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)
 {
 	struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h +1 -0
index f21a771..7ff0e76 100644
@@ -34,6 +34,7 @@ void amdgpu_pm_acpi_event_handler(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_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_dpm_thermal_work_handler(struct work_struct *work);
 void amdgpu_dpm_enable_uvd(struct amdgpu_device *adev, bool enable);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +13 -1
index c763733..e233872 100644
@@ -28,6 +28,7 @@
 #include "soc15.h"
 #include "soc15d.h"
 #include "amdgpu_atomfirmware.h"
+#include "amdgpu_pm.h"
 
 #include "gc/gc_9_0_offset.h"
 #include "gc/gc_9_0_sh_mask.h"
@@ -97,6 +98,7 @@ MODULE_FIRMWARE("amdgpu/raven2_me.bin");
 MODULE_FIRMWARE("amdgpu/raven2_mec.bin");
 MODULE_FIRMWARE("amdgpu/raven2_mec2.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[] =
 {
@@ -591,7 +593,8 @@ static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev)
 	case CHIP_RAVEN:
 		if (adev->rev_id >= 0x8 || adev->pdev->device == 0x15d8)
 			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_feature_version < 1) ||
 		    !adev->gfx.rlc.is_rlc_v2_1)
@@ -615,6 +618,8 @@ static int gfx_v9_0_init_microcode(struct amdgpu_device *adev)
 	unsigned int i = 0;
 	uint16_t version_major;
 	uint16_t version_minor;
+	uint32_t smu_version;
+
 
 	DRM_DEBUG("\n");
 
@@ -681,10 +686,17 @@ static int gfx_v9_0_init_microcode(struct amdgpu_device *adev)
 	 *          or revision >= 0xD8 && revision <= 0xDF
 	 * otherwise is PCO FP5
 	 */
+
 	if (!strcmp(chip_name, "picasso") &&
 		(((adev->pdev->revision >= 0xC8) && (adev->pdev->revision <= 0xCF)) ||
 		((adev->pdev->revision >= 0xD8) && (adev->pdev->revision <= 0xDF))))
 		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) &&
+		(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
 		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
 	err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1559308246-11211-2-git-send-email-Prike.Liang-5C7GfCeVMHo@public.gmane.org

#4 lore raw

RE: [PATCH 2/2] drm/amd/amdgpu: add RLC firmware to support raven1 refresh

Ping for patches review.

Quoted 174 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Prike Liang
Sent: Friday, May 31, 2019 9:11 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Liang, Prike <[email protected]>; Huang, Ray <[email protected]>
Subject: [PATCH 2/2] 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.

Change-Id I7aaa67d8b59cfec03355d9199f7fb2c30ce39856
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 +++---------
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c     | 15 +++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h     |  1 +
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c      | 14 +++++++++++++-
 4 files changed, 32 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
index 6fea2d1..44dd9d8 100644
@@ -1620,6 +1620,7 @@ static int amdgpu_device_fw_loading(struct
 amdgpu_device *adev)  {
 	int r = 0;
 	int i;
+	uint32_t smu_version;
 
 	if (adev->asic_type >= CHIP_VEGA10) {
 		for (i = 0; i < adev->num_ip_blocks; i++) { @@ -1645,16
+1646,9 @@ static int amdgpu_device_fw_loading(struct amdgpu_device

*adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
 			}
 		}
 	}
+	r = amdgpu_pm_load_smu_firmware(adev, &smu_version);
 
-	if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs-
Quoted 1 line

load_firmware) {

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -1
-		r = adev->powerplay.pp_funcs->load_firmware(adev-
Quoted 1 line

powerplay.pp_handle);

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -7
-		if (r) {
-			pr_err("firmware loading failed\n");
-			return r;
-		}
-	}
-
-	return 0;
+	return r;
 }
 
 /**
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -0
index bd40d5d..dae9a58 100644
@@ -2668,6 +2668,21 @@ void amdgpu_pm_print_power_states(struct
 amdgpu_device *adev)
 
 }
 
+int amdgpu_pm_load_smu_firmware(struct amdgpu_device *adev,

uint32_t

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +4 -0
+*smu_version) {
+	int r;
+
+	if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs-
Quoted 1 line

load_firmware) {

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +1 -0
+		r = adev->powerplay.pp_funcs->load_firmware(adev-
Quoted 1 line

powerplay.pp_handle);

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +9 -0
+		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)  {
 	struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; diff --git

a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h
b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h
index f21a771..7ff0e76 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h +0 -0
@@ -34,6 +34,7 @@ void amdgpu_pm_acpi_event_handler(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_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_dpm_thermal_work_handler(struct work_struct *work); void amdgpu_dpm_enable_uvd(struct amdgpu_device *adev, bool enable); diff - -git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index c763733..e233872 100644

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -0
@@ -28,6 +28,7 @@
 #include "soc15.h"
 #include "soc15d.h"
 #include "amdgpu_atomfirmware.h"
+#include "amdgpu_pm.h"
 
 #include "gc/gc_9_0_offset.h"
 #include "gc/gc_9_0_sh_mask.h"
@@ -97,6 +98,7 @@ MODULE_FIRMWARE("amdgpu/raven2_me.bin");
 MODULE_FIRMWARE("amdgpu/raven2_mec.bin");
 MODULE_FIRMWARE("amdgpu/raven2_mec2.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[] =  { @@ -

591,7 +593,8 @@ static void gfx_v9_0_check_if_need_gfxoff(struct amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +5 -1
 	case CHIP_RAVEN:
 		if (adev->rev_id >= 0x8 || adev->pdev->device == 0x15d8)
 			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_feature_version < 1) ||
 		    !adev->gfx.rlc.is_rlc_v2_1)
@@ -615,6 +618,8 @@ static int gfx_v9_0_init_microcode(struct
 amdgpu_device *adev)
 	unsigned int i = 0;
 	uint16_t version_major;
 	uint16_t version_minor;
+	uint32_t smu_version;
+
 
 	DRM_DEBUG("\n");
@@ -681,10 +686,17 @@ static int gfx_v9_0_init_microcode(struct
 amdgpu_device *adev)
 	 *          or revision >= 0xD8 && revision <= 0xDF
 	 * otherwise is PCO FP5
 	 */
+
 	if (!strcmp(chip_name, "picasso") &&
 		(((adev->pdev->revision >= 0xC8) && (adev->pdev->revision

<= 0xCF)) ||
((adev->pdev->revision >= 0xD8) && (adev->pdev->revision
<= 0xDF))))
snprintf(fw_name, sizeof(fw_name),
"amdgpu/%s_rlc_am4.bin", chip_name);

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -0
+	else if (!strcmp(chip_name, "raven")

&& !amdgpu_pm_load_smu_firmware(adev, &smu_version) &&

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -0
+		(smu_version >= 0x41e2b))
+	/**
+	 *SMC is loaded by SBIOS on APU and it's able to get the SMU version

directly.

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -0
+	 */
+		snprintf(fw_name, sizeof(fw_name),

"amdgpu/%s_kicker_rlc.bin",

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -0
+chip_name);
 	else
 		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin",

chip_name);
err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
--
2.7.4

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#5 lore raw

RE: [PATCH 2/2] drm/amd/amdgpu: add RLC firmware to support raven1 refresh

In reply to a message not in the archive
Quoted 166 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Prike Liang
Sent: Friday, May 31, 2019 9:11 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Liang, Prike <[email protected]>; Huang, Ray <[email protected]>
Subject: [PATCH 2/2] 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.

Change-Id I7aaa67d8b59cfec03355d9199f7fb2c30ce39856
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 +++---------
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c     | 15 +++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h     |  1 +
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c      | 14 +++++++++++++-
 4 files changed, 32 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
index 6fea2d1..44dd9d8 100644
@@ -1620,6 +1620,7 @@ static int amdgpu_device_fw_loading(struct
 amdgpu_device *adev)
 {
 	int r = 0;
 	int i;
+	uint32_t smu_version;
 
 	if (adev->asic_type >= CHIP_VEGA10) {
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -9
 		for (i = 0; i < adev->num_ip_blocks; i++) {
@@ -1645,16 +1646,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 0;
+	return r;

}

/**

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +6 -0
index bd40d5d..dae9a58 100644
@@ -2668,6 +2668,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;
+
+	if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs-
 >load_firmware) {
+		r = adev->powerplay.pp_funcs->load_firmware(adev-
Quoted 1 line

powerplay.pp_handle);

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +9 -0
+		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)
 {
 	struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h +1 -0
index f21a771..7ff0e76 100644
@@ -34,6 +34,7 @@ void amdgpu_pm_acpi_event_handler(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_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_dpm_thermal_work_handler(struct work_struct *work); void amdgpu_dpm_enable_uvd(struct amdgpu_device *adev, bool enable);

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4 -1
index c763733..e233872 100644
@@ -28,6 +28,7 @@
 #include "soc15.h"
 #include "soc15d.h"
 #include "amdgpu_atomfirmware.h"
+#include "amdgpu_pm.h"
 
 #include "gc/gc_9_0_offset.h"
 #include "gc/gc_9_0_sh_mask.h"
@@ -97,6 +98,7 @@ MODULE_FIRMWARE("amdgpu/raven2_me.bin");
 MODULE_FIRMWARE("amdgpu/raven2_mec.bin");
 MODULE_FIRMWARE("amdgpu/raven2_mec2.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[] =
 {
@@ -591,7 +593,8 @@ static void gfx_v9_0_check_if_need_gfxoff(struct
 amdgpu_device *adev)
 	case CHIP_RAVEN:
 		if (adev->rev_id >= 0x8 || adev->pdev->device == 0x15d8)
 			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_feature_version < 1) ||
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -0
 		    !adev->gfx.rlc.is_rlc_v2_1)
@@ -615,6 +618,8 @@ static int gfx_v9_0_init_microcode(struct
 amdgpu_device *adev)
 	unsigned int i = 0;
 	uint16_t version_major;
 	uint16_t version_minor;
+	uint32_t smu_version;
+
 
 	DRM_DEBUG("\n");
@@ -681,10 +686,17 @@ static int gfx_v9_0_init_microcode(struct
 amdgpu_device *adev)
 	 *          or revision >= 0xD8 && revision <= 0xDF
 	 * otherwise is PCO FP5
 	 */
+
 	if (!strcmp(chip_name, "picasso") &&
 		(((adev->pdev->revision >= 0xC8) && (adev->pdev->revision

<= 0xCF)) ||
((adev->pdev->revision >= 0xD8) && (adev->pdev->revision
<= 0xDF))))
snprintf(fw_name, sizeof(fw_name),
"amdgpu/%s_rlc_am4.bin", chip_name);

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -0
+	else if (!strcmp(chip_name, "raven")

&& !amdgpu_pm_load_smu_firmware(adev, &smu_version) &&

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -0
+		(smu_version >= 0x41e2b))
+	/**
+	 *SMC is loaded by SBIOS on APU and it's able to get the SMU version

directly.

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -0
+	 */
+		snprintf(fw_name, sizeof(fw_name),

Please align the space of the comments with "snprintf".

With this fixed, the series are Reviewed-by: Huang Rui <[email protected]>

Quoted 8 lines

"amdgpu/%s_kicker_rlc.bin", chip_name);

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
 	else
 		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin",

chip_name);
err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
--
2.7.4

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#6 lore raw

RE: [PATCH 2/2] drm/amd/amdgpu: add RLC firmware to support raven1 refresh

In reply to a message not in the archive
Quoted 80 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Prike Liang
Sent: 2019年5月31日 21:11
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Liang, Prike <[email protected]>; Huang, Ray <[email protected]>
Subject: [PATCH 2/2] 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.

Change-Id I7aaa67d8b59cfec03355d9199f7fb2c30ce39856
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 +++---------
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c     | 15 +++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h     |  1 +
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c      | 14 +++++++++++++-
 4 files changed, 32 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
index 6fea2d1..44dd9d8 100644
@@ -1620,6 +1620,7 @@ static int amdgpu_device_fw_loading(struct
 amdgpu_device *adev)
 {
 	int r = 0;
 	int i;
+	uint32_t smu_version;
 
 	if (adev->asic_type >= CHIP_VEGA10) {
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -9
 		for (i = 0; i < adev->num_ip_blocks; i++) {
@@ -1645,16 +1646,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 0;
+	return r;

}

/**

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +6 -0
index bd40d5d..dae9a58 100644
@@ -2668,6 +2668,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;
+
+	if (adev->powerplay.pp_funcs && adev->powerplay.pp_funcs-
 >load_firmware) {
+		r = adev->powerplay.pp_funcs->load_firmware(adev-
Quoted 1 line

powerplay.pp_handle);

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c void amdgpu_pm_print_power_states(struct amdgpu_device *adev) · line 2683

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +7 -0
+		if (r) {
+			pr_err("smu firmware loading failed\n");
+			return r;
+		}
+		*smu_version = adev->pm.fw_version;
+                return r ;
+	}

[Quan, Evan] there is no return value on the else branch. There should be some compile warnings.

Quoted 76 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +2 -0
+}
+
 int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
 {
 	struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.h +1 -0
index f21a771..7ff0e76 100644
@@ -34,6 +34,7 @@ void amdgpu_pm_acpi_event_handler(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_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_dpm_thermal_work_handler(struct work_struct *work); void amdgpu_dpm_enable_uvd(struct amdgpu_device *adev, bool enable);

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4 -1
index c763733..e233872 100644
@@ -28,6 +28,7 @@
 #include "soc15.h"
 #include "soc15d.h"
 #include "amdgpu_atomfirmware.h"
+#include "amdgpu_pm.h"
 
 #include "gc/gc_9_0_offset.h"
 #include "gc/gc_9_0_sh_mask.h"
@@ -97,6 +98,7 @@ MODULE_FIRMWARE("amdgpu/raven2_me.bin");
 MODULE_FIRMWARE("amdgpu/raven2_mec.bin");
 MODULE_FIRMWARE("amdgpu/raven2_mec2.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[] =
 {
@@ -591,7 +593,8 @@ static void gfx_v9_0_check_if_need_gfxoff(struct
 amdgpu_device *adev)
 	case CHIP_RAVEN:
 		if (adev->rev_id >= 0x8 || adev->pdev->device == 0x15d8)
 			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_feature_version < 1) ||
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -0
 		    !adev->gfx.rlc.is_rlc_v2_1)
@@ -615,6 +618,8 @@ static int gfx_v9_0_init_microcode(struct
 amdgpu_device *adev)
 	unsigned int i = 0;
 	uint16_t version_major;
 	uint16_t version_minor;
+	uint32_t smu_version;
+
 
 	DRM_DEBUG("\n");
@@ -681,10 +686,17 @@ static int gfx_v9_0_init_microcode(struct
 amdgpu_device *adev)
 	 *          or revision >= 0xD8 && revision <= 0xDF
 	 * otherwise is PCO FP5
 	 */
+
 	if (!strcmp(chip_name, "picasso") &&
 		(((adev->pdev->revision >= 0xC8) && (adev->pdev->revision

<= 0xCF)) ||
((adev->pdev->revision >= 0xD8) && (adev->pdev->revision
<= 0xDF))))
snprintf(fw_name, sizeof(fw_name),
"amdgpu/%s_rlc_am4.bin", chip_name);

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -0
+	else if (!strcmp(chip_name, "raven")
Quoted 1 line

&& !amdgpu_pm_load_smu_firmware(adev, &smu_version) &&

[Quan, Evan] I cannot get the purpose to call amdgpu_pm_load_smu_firmware here. Can you use adev->pm.fw_version directly?

Quoted 14 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -0
+		(smu_version >= 0x41e2b))
+	/**
+	 *SMC is loaded by SBIOS on APU and it's able to get the SMU version

directly.

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -0
+	 */
+		snprintf(fw_name, sizeof(fw_name),

"amdgpu/%s_kicker_rlc.bin", chip_name);

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
 	else
 		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin",

chip_name);
err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
--
2.7.4

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by Evan Quan
#7 lore raw
In reply to a message not in the archive
Quoted 111 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Prike Liang
Sent: 2019年5月31日 21:11
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>; Gui, Jack <[email protected]>
Subject: [PATCH 1/2] drm/amd/powerplay: add set_power_profile_mode for raven1_refresh

From: Chengming Gui <[email protected]>

add gfxoff_state_changed_by_workload to control gfxoff when set power_profile_mode

---
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c       |  1 +
 drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | 31
++++++++++++++++++++---
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h         |  1 +
 3 files changed, 30 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +1 -0
index 6cd6497..f1d326c 100644
@@ -92,6 +92,7 @@ int hwmgr_early_init(struct pp_hwmgr *hwmgr)
 	hwmgr_set_user_specify_caps(hwmgr);
 	hwmgr->fan_ctrl_is_in_default_mode = true;
 	hwmgr_init_workload_prority(hwmgr);
+	hwmgr->gfxoff_state_changed_by_workload = false;
 
 	switch (hwmgr->chip_family) {
 	case AMDGPU_FAMILY_CI:
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c +25 -3
index 9a595f7..e32ae9d 100644
@@ -1258,21 +1258,46 @@ static int
 smu10_get_power_profile_mode(struct pp_hwmgr *hwmgr, char *buf)
 	return size;
 }
 
+static bool smu10_is_raven1_refresh(struct pp_hwmgr *hwmgr) {
+	struct amdgpu_device *adev = hwmgr->adev;
+	if ((adev->asic_type == CHIP_RAVEN) &&
+	    (adev->rev_id != 0x15d8) &&
+	    (hwmgr->smu_version >= 0x41e2b))
+		return true;
+	else
+		return false;
+}
+
 static int smu10_set_power_profile_mode(struct pp_hwmgr *hwmgr, long
 *input, uint32_t size)  {
 	int workload_type = 0;
+	int result = 0;
 
 	if (input[size] > PP_SMC_POWER_PROFILE_COMPUTE) {
 		pr_err("Invalid power profile mode %ld\n", input[size]);
 		return -EINVAL;
 	}
-	hwmgr->power_profile_mode = input[size];
+	if (hwmgr->power_profile_mode == input[size])
+		return 0;
 
 	/* conv PP_SMC_POWER_PROFILE* to WORKLOAD_PPLIB_*_BIT */
 	workload_type =
-		conv_power_profile_to_pplib_workload(hwmgr-
 >power_profile_mode);
-	smum_send_msg_to_smc_with_parameter(hwmgr,
 PPSMC_MSG_ActiveProcessNotify,
+		conv_power_profile_to_pplib_workload(input[size]);
+	if (workload_type &&
+	    smu10_is_raven1_refresh(hwmgr) &&
+	    !hwmgr->gfxoff_state_changed_by_workload) {
+		smu10_gfx_off_control(hwmgr, false);
+		hwmgr->gfxoff_state_changed_by_workload = true;
+	}
+	result = smum_send_msg_to_smc_with_parameter(hwmgr,
+PPSMC_MSG_ActiveProcessNotify,
 						1 << workload_type);
+	if (!result)
+		hwmgr->power_profile_mode = input[size];
+	if (workload_type && hwmgr->gfxoff_state_changed_by_workload)

{

drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c +3 -0
+		smu10_gfx_off_control(hwmgr, true);
+		hwmgr->gfxoff_state_changed_by_workload = false;
+	}
 
 	return 0;
 }
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1 -1
index bac3d85..c92999a 100644
@@ -782,6 +782,7 @@ struct pp_hwmgr {
 	uint32_t workload_mask;
 	uint32_t workload_prority[Workload_Policy_Max];
 	uint32_t workload_setting[Workload_Policy_Max];
+	bool gfxoff_state_changed_by_workload;
 };
 
 int hwmgr_early_init(struct pp_hwmgr *hwmgr);
--

2.7.4

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx