All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/8] drm/amd/swSMU: add callback to set AC/DC power source
@ 2020-03-20 18:27 Alex Deucher
  2020-03-20 18:27 ` [PATCH 2/8] drm/amdgpu/smu11: add a helper to set the " Alex Deucher
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Alex Deucher @ 2020-03-20 18:27 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher, mcoffin13, Evan Quan

From: Evan Quan <evan.quan@amd.com>

This is needed to tell the SMU firmware what state is in
in certain cases.  DC mode does not allow overclocking
for example.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 1 +
 drivers/gpu/drm/amd/powerplay/smu_internal.h   | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
index 657a6f17e91f..323e7e61493b 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
@@ -570,6 +570,7 @@ struct pptable_funcs {
 	int (*override_pcie_parameters)(struct smu_context *smu);
 	uint32_t (*get_pptable_power_limit)(struct smu_context *smu);
 	int (*disable_umc_cdr_12gbps_workaround)(struct smu_context *smu);
+	int (*set_power_source)(struct smu_context *smu, enum smu_power_src_type power_src);
 };
 
 int smu_load_microcode(struct smu_context *smu);
diff --git a/drivers/gpu/drm/amd/powerplay/smu_internal.h b/drivers/gpu/drm/amd/powerplay/smu_internal.h
index 6900877de845..40c35bcc5a0a 100644
--- a/drivers/gpu/drm/amd/powerplay/smu_internal.h
+++ b/drivers/gpu/drm/amd/powerplay/smu_internal.h
@@ -211,4 +211,7 @@ static inline int smu_send_smc_msg(struct smu_context *smu, enum smu_message_typ
 #define smu_disable_umc_cdr_12gbps_workaround(smu) \
 	((smu)->ppt_funcs->disable_umc_cdr_12gbps_workaround ? (smu)->ppt_funcs->disable_umc_cdr_12gbps_workaround((smu)) : 0)
 
+#define smu_set_power_source(smu, power_src) \
+	((smu)->ppt_funcs->set_power_source ? (smu)->ppt_funcs->set_power_source((smu), (power_src)) : 0)
+
 #endif
-- 
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/8] drm/amdgpu/smu11: add a helper to set the power source
  2020-03-20 18:27 [PATCH 1/8] drm/amd/swSMU: add callback to set AC/DC power source Alex Deucher
@ 2020-03-20 18:27 ` Alex Deucher
  2020-03-20 18:27 ` [PATCH 3/8] drm/amdgpu/swSMU: use the smu11 power source helper for navi1x Alex Deucher
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Alex Deucher @ 2020-03-20 18:27 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher, mcoffin13

Add a common smu11 helper to set the AC/DC power source.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h |  3 +++
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c     | 15 +++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h b/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h
index 1c88219fe403..674e426ed59b 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h
@@ -267,4 +267,7 @@ uint32_t smu_v11_0_get_max_power_limit(struct smu_context *smu);
 int smu_v11_0_set_performance_level(struct smu_context *smu,
 				    enum amd_dpm_forced_level level);
 
+int smu_v11_0_set_power_source(struct smu_context *smu,
+			       enum smu_power_src_type power_src);
+
 #endif
diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
index 4fd77c7cfc80..20174bed11ce 100644
--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
@@ -1939,3 +1939,18 @@ int smu_v11_0_set_performance_level(struct smu_context *smu,
 	return ret;
 }
 
+int smu_v11_0_set_power_source(struct smu_context *smu,
+			       enum smu_power_src_type power_src)
+{
+	int pwr_source;
+
+	pwr_source = smu_power_get_index(smu, (uint32_t)power_src);
+	if (pwr_source < 0)
+		return -EINVAL;
+
+	return smu_send_smc_msg_with_param(smu,
+					SMU_MSG_NotifyPowerSource,
+					pwr_source,
+					NULL);
+}
+
-- 
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/8] drm/amdgpu/swSMU: use the smu11 power source helper for navi1x
  2020-03-20 18:27 [PATCH 1/8] drm/amd/swSMU: add callback to set AC/DC power source Alex Deucher
  2020-03-20 18:27 ` [PATCH 2/8] drm/amdgpu/smu11: add a helper to set the " Alex Deucher
@ 2020-03-20 18:27 ` Alex Deucher
  2020-03-20 18:27 ` [PATCH 4/8] drm/amdgpu/swSMU: correct the bootup power source for Navi1X Alex Deucher
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Alex Deucher @ 2020-03-20 18:27 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher, mcoffin13

The smu_v11_0 version works for navi1x.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
index d66dfa7410b6..a23eaac28095 100644
--- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
@@ -2369,6 +2369,7 @@ static const struct pptable_funcs navi10_ppt_funcs = {
 	.get_pptable_power_limit = navi10_get_pptable_power_limit,
 	.run_btc = navi10_run_btc,
 	.disable_umc_cdr_12gbps_workaround = navi10_disable_umc_cdr_12gbps_workaround,
+	.set_power_source = smu_v11_0_set_power_source,
 };
 
 void navi10_set_ppt_funcs(struct smu_context *smu)
-- 
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/8] drm/amdgpu/swSMU: correct the bootup power source for Navi1X
  2020-03-20 18:27 [PATCH 1/8] drm/amd/swSMU: add callback to set AC/DC power source Alex Deucher
  2020-03-20 18:27 ` [PATCH 2/8] drm/amdgpu/smu11: add a helper to set the " Alex Deucher
  2020-03-20 18:27 ` [PATCH 3/8] drm/amdgpu/swSMU: use the smu11 power source helper for navi1x Alex Deucher
@ 2020-03-20 18:27 ` Alex Deucher
  2020-03-20 18:27 ` [PATCH 5/8] drm/amdgpu/swSMU: set AC/DC mode based on the current system state Alex Deucher
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Alex Deucher @ 2020-03-20 18:27 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher, mcoffin13, Evan Quan

From: Evan Quan <evan.quan@amd.com>

PMFW may boots those ASICs with DC mode. Need to set it back
to AC mode.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index f6d4b0ef46ad..2cfb911ab370 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -1154,6 +1154,21 @@ static int smu_smc_table_hw_init(struct smu_context *smu,
 				}
 			}
 		}
+
+		if (adev->asic_type >= CHIP_NAVI10 &&
+		    adev->asic_type <= CHIP_NAVI12) {
+			/*
+			 * For Navi1X, manually switch it to AC mode as PMFW
+			 * may boot it with DC mode.
+			 * TODO: should check whether we are indeed under AC
+			 * mode before doing this.
+			 */
+			ret = smu_set_power_source(smu, SMU_POWER_SOURCE_AC);
+			if (ret) {
+				pr_err("Failed to switch to AC mode!\n");
+				return ret;
+			}
+		}
 	}
 	if (adev->asic_type != CHIP_ARCTURUS) {
 		ret = smu_notify_display_change(smu);
-- 
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/8] drm/amdgpu/swSMU: set AC/DC mode based on the current system state
  2020-03-20 18:27 [PATCH 1/8] drm/amd/swSMU: add callback to set AC/DC power source Alex Deucher
                   ` (2 preceding siblings ...)
  2020-03-20 18:27 ` [PATCH 4/8] drm/amdgpu/swSMU: correct the bootup power source for Navi1X Alex Deucher
@ 2020-03-20 18:27 ` Alex Deucher
  2020-03-20 18:27 ` [PATCH 6/8] drm/amdgpu/swSMU: handle DC controlled by GPIO for navi1x Alex Deucher
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Alex Deucher @ 2020-03-20 18:27 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher, mcoffin13

Check of the pointer exists and we are actually on AC power.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 2cfb911ab370..54d156bbc0f3 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -1155,15 +1155,15 @@ static int smu_smc_table_hw_init(struct smu_context *smu,
 			}
 		}
 
-		if (adev->asic_type >= CHIP_NAVI10 &&
-		    adev->asic_type <= CHIP_NAVI12) {
+		if (smu->ppt_funcs->set_power_source) {
 			/*
 			 * For Navi1X, manually switch it to AC mode as PMFW
 			 * may boot it with DC mode.
-			 * TODO: should check whether we are indeed under AC
-			 * mode before doing this.
 			 */
-			ret = smu_set_power_source(smu, SMU_POWER_SOURCE_AC);
+			if (adev->pm.ac_power)
+				ret = smu_set_power_source(smu, SMU_POWER_SOURCE_AC);
+			else
+				ret = smu_set_power_source(smu, SMU_POWER_SOURCE_DC);
 			if (ret) {
 				pr_err("Failed to switch to AC mode!\n");
 				return ret;
-- 
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 6/8] drm/amdgpu/swSMU: handle DC controlled by GPIO for navi1x
  2020-03-20 18:27 [PATCH 1/8] drm/amd/swSMU: add callback to set AC/DC power source Alex Deucher
                   ` (3 preceding siblings ...)
  2020-03-20 18:27 ` [PATCH 5/8] drm/amdgpu/swSMU: set AC/DC mode based on the current system state Alex Deucher
@ 2020-03-20 18:27 ` Alex Deucher
  2020-03-20 18:27 ` [PATCH 7/8] drm/amdgpu/swSMU: handle manual AC/DC notifications Alex Deucher
  2020-03-20 18:27 ` [PATCH 8/8] drm/amdgpu/smu11: add support for SMU AC/DC interrupts Alex Deucher
  6 siblings, 0 replies; 11+ messages in thread
From: Alex Deucher @ 2020-03-20 18:27 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher, mcoffin13

Check the platform caps in the vbios pptable to decide
whether to enable automatic AC/DC transitions.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 1 +
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c     | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
index 323e7e61493b..18172dfec947 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
@@ -408,6 +408,7 @@ struct smu_context
 	uint32_t smc_if_version;
 
 	bool uploading_custom_pp_table;
+	bool dc_controlled_by_gpio;
 };
 
 struct i2c_adapter;
diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
index a23eaac28095..9c60b38ab53a 100644
--- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
@@ -347,7 +347,6 @@ navi10_get_allowed_feature_mask(struct smu_context *smu,
 				| FEATURE_MASK(FEATURE_DS_DCEFCLK_BIT)
 				| FEATURE_MASK(FEATURE_FW_DSTATE_BIT)
 				| FEATURE_MASK(FEATURE_BACO_BIT)
-				| FEATURE_MASK(FEATURE_ACDC_BIT)
 				| FEATURE_MASK(FEATURE_GFX_SS_BIT)
 				| FEATURE_MASK(FEATURE_APCC_DFLL_BIT)
 				| FEATURE_MASK(FEATURE_FW_CTF_BIT)
@@ -391,6 +390,9 @@ navi10_get_allowed_feature_mask(struct smu_context *smu,
 	if (smu->adev->pg_flags & AMD_PG_SUPPORT_JPEG)
 		*(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_JPEG_PG_BIT);
 
+	if (smu->dc_controlled_by_gpio)
+		*(uint64_t *)feature_mask |= FEATURE_MASK(FEATURE_ACDC_BIT);
+
 	/* disable DPM UCLK and DS SOCCLK on navi10 A0 secure board */
 	if (is_asic_secure(smu)) {
 		/* only for navi10 A0 */
@@ -525,6 +527,9 @@ static int navi10_store_powerplay_table(struct smu_context *smu)
 
 	table_context->thermal_controller_type = powerplay_table->thermal_controller_type;
 
+	if (powerplay_table->platform_caps & SMU_11_0_PP_PLATFORM_CAP_HARDWAREDC)
+		smu->dc_controlled_by_gpio = true;
+
 	mutex_lock(&smu_baco->mutex);
 	if (powerplay_table->platform_caps & SMU_11_0_PP_PLATFORM_CAP_BACO ||
 	    powerplay_table->platform_caps & SMU_11_0_PP_PLATFORM_CAP_MACO)
-- 
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 7/8] drm/amdgpu/swSMU: handle manual AC/DC notifications
  2020-03-20 18:27 [PATCH 1/8] drm/amd/swSMU: add callback to set AC/DC power source Alex Deucher
                   ` (4 preceding siblings ...)
  2020-03-20 18:27 ` [PATCH 6/8] drm/amdgpu/swSMU: handle DC controlled by GPIO for navi1x Alex Deucher
@ 2020-03-20 18:27 ` Alex Deucher
  2020-03-20 18:27 ` [PATCH 8/8] drm/amdgpu/smu11: add support for SMU AC/DC interrupts Alex Deucher
  6 siblings, 0 replies; 11+ messages in thread
From: Alex Deucher @ 2020-03-20 18:27 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher, mcoffin13

For boards that do not support automatic AC/DC transitions
in firmware, manually tell the firmware when the status
changes.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c        |  3 +++
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    | 23 +++++++++++++++++++
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |  1 +
 3 files changed, 27 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index bc3cf04a1a94..f197f1be0969 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -92,6 +92,9 @@ void amdgpu_pm_acpi_event_handler(struct amdgpu_device *adev)
 		if (adev->powerplay.pp_funcs->enable_bapm)
 			amdgpu_dpm_enable_bapm(adev, adev->pm.ac_power);
 		mutex_unlock(&adev->pm.mutex);
+
+		if (is_support_sw_smu(adev))
+			smu_set_ac_dc(&adev->smu);
 	}
 }
 
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 54d156bbc0f3..6f4015f87781 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -2087,6 +2087,29 @@ int smu_set_watermarks_for_clock_ranges(struct smu_context *smu,
 	return 0;
 }
 
+int smu_set_ac_dc(struct smu_context *smu)
+{
+	int ret = 0;
+
+	/* controlled by firmware */
+	if (smu->dc_controlled_by_gpio)
+		return 0;
+
+	mutex_lock(&smu->mutex);
+	if (smu->ppt_funcs->set_power_source) {
+		if (smu->adev->pm.ac_power)
+			ret = smu_set_power_source(smu, SMU_POWER_SOURCE_AC);
+		else
+			ret = smu_set_power_source(smu, SMU_POWER_SOURCE_DC);
+		if (ret)
+			pr_err("Failed to switch to %s mode!\n",
+			       smu->adev->pm.ac_power ? "AC" : "DC");
+	}
+	mutex_unlock(&smu->mutex);
+
+	return ret;
+}
+
 const struct amd_ip_funcs smu_ip_funcs = {
 	.name = "smu",
 	.early_init = smu_early_init,
diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
index 18172dfec947..ae2c318dd6fa 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
@@ -720,6 +720,7 @@ int smu_get_dpm_level_range(struct smu_context *smu, enum smu_clk_type clk_type,
 enum amd_dpm_forced_level smu_get_performance_level(struct smu_context *smu);
 int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_level level);
 int smu_set_display_count(struct smu_context *smu, uint32_t count);
+int smu_set_ac_dc(struct smu_context *smu);
 bool smu_clk_dpm_is_enabled(struct smu_context *smu, enum smu_clk_type clk_type);
 const char *smu_get_message_name(struct smu_context *smu, enum smu_message_type type);
 const char *smu_get_feature_name(struct smu_context *smu, enum smu_feature_mask feature);
-- 
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 8/8] drm/amdgpu/smu11: add support for SMU AC/DC interrupts
  2020-03-20 18:27 [PATCH 1/8] drm/amd/swSMU: add callback to set AC/DC power source Alex Deucher
                   ` (5 preceding siblings ...)
  2020-03-20 18:27 ` [PATCH 7/8] drm/amdgpu/swSMU: handle manual AC/DC notifications Alex Deucher
@ 2020-03-20 18:27 ` Alex Deucher
  2020-03-23  3:54   ` Quan, Evan
  6 siblings, 1 reply; 11+ messages in thread
From: Alex Deucher @ 2020-03-20 18:27 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher, mcoffin13

Driver needs to send the ack message when it receives the
AC/DC interrupt from the SMU.

TODO: verify the client and src ids.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
index 20174bed11ce..d19e1d0d56c0 100644
--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
@@ -1525,6 +1525,13 @@ int smu_v11_0_set_xgmi_pstate(struct smu_context *smu,
 	return ret;
 }
 
+static int smu_v11_0_ack_ac_dc_interrupt(struct smu_context *smu)
+{
+	return smu_send_smc_msg(smu,
+				SMU_MSG_ReenableAcDcInterrupt,
+				NULL);
+}
+
 #define THM_11_0__SRCID__THM_DIG_THERM_L2H		0		/* ASIC_TEMP > CG_THERMAL_INT.DIG_THERM_INTH  */
 #define THM_11_0__SRCID__THM_DIG_THERM_H2L		1		/* ASIC_TEMP < CG_THERMAL_INT.DIG_THERM_INTL  */
 
@@ -1558,6 +1565,9 @@ static int smu_v11_0_irq_process(struct amdgpu_device *adev,
 		break;
 
 		}
+	} else if (client_id == SOC15_IH_CLIENTID_MP1) {
+		if (src_id == 0xfe)
+			smu_v11_0_ack_ac_dc_interrupt(&adev->smu);
 	}
 
 	return 0;
@@ -1597,6 +1607,12 @@ int smu_v11_0_register_irq_handler(struct smu_context *smu)
 	if (ret)
 		return ret;
 
+	ret = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
+				0xfe,
+				irq_src);
+	if (ret)
+		return ret;
+
 	return ret;
 }
 
-- 
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* RE: [PATCH 8/8] drm/amdgpu/smu11: add support for SMU AC/DC interrupts
  2020-03-20 18:27 ` [PATCH 8/8] drm/amdgpu/smu11: add support for SMU AC/DC interrupts Alex Deucher
@ 2020-03-23  3:54   ` Quan, Evan
  2020-03-23 14:46     ` Alex Deucher
  0 siblings, 1 reply; 11+ messages in thread
From: Quan, Evan @ 2020-03-23  3:54 UTC (permalink / raw)
  To: Alex Deucher, amd-gfx; +Cc: Deucher, Alexander, mcoffin13

Thanks Alex. The series is reviewed-by: Evan Quan <evan.quan@amd.com>

-----Original Message-----
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex Deucher
Sent: Saturday, March 21, 2020 2:27 AM
To: amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; mcoffin13@gmail.com
Subject: [PATCH 8/8] drm/amdgpu/smu11: add support for SMU AC/DC interrupts

Driver needs to send the ack message when it receives the AC/DC interrupt from the SMU.

TODO: verify the client and src ids.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
index 20174bed11ce..d19e1d0d56c0 100644
--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
@@ -1525,6 +1525,13 @@ int smu_v11_0_set_xgmi_pstate(struct smu_context *smu,
 	return ret;
 }
 
+static int smu_v11_0_ack_ac_dc_interrupt(struct smu_context *smu) {
+	return smu_send_smc_msg(smu,
+				SMU_MSG_ReenableAcDcInterrupt,
+				NULL);
+}
+
 #define THM_11_0__SRCID__THM_DIG_THERM_L2H		0		/* ASIC_TEMP > CG_THERMAL_INT.DIG_THERM_INTH  */
 #define THM_11_0__SRCID__THM_DIG_THERM_H2L		1		/* ASIC_TEMP < CG_THERMAL_INT.DIG_THERM_INTL  */
 
@@ -1558,6 +1565,9 @@ static int smu_v11_0_irq_process(struct amdgpu_device *adev,
 		break;
 
 		}
+	} else if (client_id == SOC15_IH_CLIENTID_MP1) {
+		if (src_id == 0xfe)
+			smu_v11_0_ack_ac_dc_interrupt(&adev->smu);
 	}
 
 	return 0;
@@ -1597,6 +1607,12 @@ int smu_v11_0_register_irq_handler(struct smu_context *smu)
 	if (ret)
 		return ret;
 
+	ret = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
+				0xfe,
+				irq_src);
+	if (ret)
+		return ret;
+
 	return ret;
 }
 
--
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cevan.quan%40amd.com%7C659315d457244e756adc08d7ccfc6dab%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637203256919711120&amp;sdata=YM6rLmsPSMvUxiSxS4b4qH72I9xojvwi5QKhVnmqk0s%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 8/8] drm/amdgpu/smu11: add support for SMU AC/DC interrupts
  2020-03-23  3:54   ` Quan, Evan
@ 2020-03-23 14:46     ` Alex Deucher
  2020-03-24  2:53       ` Quan, Evan
  0 siblings, 1 reply; 11+ messages in thread
From: Alex Deucher @ 2020-03-23 14:46 UTC (permalink / raw)
  To: Quan, Evan; +Cc: Deucher, Alexander, mcoffin13, amd-gfx

On Sun, Mar 22, 2020 at 11:54 PM Quan, Evan <Evan.Quan@amd.com> wrote:
>
> Thanks Alex. The series is reviewed-by: Evan Quan <evan.quan@amd.com>

Thanks Evan.  Can you verify that the client and source id are correct
for the interrupt?  I wasn't able to find them.

Alex

>
> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex Deucher
> Sent: Saturday, March 21, 2020 2:27 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; mcoffin13@gmail.com
> Subject: [PATCH 8/8] drm/amdgpu/smu11: add support for SMU AC/DC interrupts
>
> Driver needs to send the ack message when it receives the AC/DC interrupt from the SMU.
>
> TODO: verify the client and src ids.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>  drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> index 20174bed11ce..d19e1d0d56c0 100644
> --- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> +++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> @@ -1525,6 +1525,13 @@ int smu_v11_0_set_xgmi_pstate(struct smu_context *smu,
>         return ret;
>  }
>
> +static int smu_v11_0_ack_ac_dc_interrupt(struct smu_context *smu) {
> +       return smu_send_smc_msg(smu,
> +                               SMU_MSG_ReenableAcDcInterrupt,
> +                               NULL);
> +}
> +
>  #define THM_11_0__SRCID__THM_DIG_THERM_L2H             0               /* ASIC_TEMP > CG_THERMAL_INT.DIG_THERM_INTH  */
>  #define THM_11_0__SRCID__THM_DIG_THERM_H2L             1               /* ASIC_TEMP < CG_THERMAL_INT.DIG_THERM_INTL  */
>
> @@ -1558,6 +1565,9 @@ static int smu_v11_0_irq_process(struct amdgpu_device *adev,
>                 break;
>
>                 }
> +       } else if (client_id == SOC15_IH_CLIENTID_MP1) {
> +               if (src_id == 0xfe)
> +                       smu_v11_0_ack_ac_dc_interrupt(&adev->smu);
>         }
>
>         return 0;
> @@ -1597,6 +1607,12 @@ int smu_v11_0_register_irq_handler(struct smu_context *smu)
>         if (ret)
>                 return ret;
>
> +       ret = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
> +                               0xfe,
> +                               irq_src);
> +       if (ret)
> +               return ret;
> +
>         return ret;
>  }
>
> --
> 2.25.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cevan.quan%40amd.com%7C659315d457244e756adc08d7ccfc6dab%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637203256919711120&amp;sdata=YM6rLmsPSMvUxiSxS4b4qH72I9xojvwi5QKhVnmqk0s%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH 8/8] drm/amdgpu/smu11: add support for SMU AC/DC interrupts
  2020-03-23 14:46     ` Alex Deucher
@ 2020-03-24  2:53       ` Quan, Evan
  0 siblings, 0 replies; 11+ messages in thread
From: Quan, Evan @ 2020-03-24  2:53 UTC (permalink / raw)
  To: Alex Deucher; +Cc: Deucher, Alexander, mcoffin13, amd-gfx

I have no target to verify that. The only nv10 board on my hand has no dc/ac automatic switch support.
But it should be correct as windows uses the same client and source id per my confirmation.

Regards,
Evan
-----Original Message-----
From: Alex Deucher <alexdeucher@gmail.com> 
Sent: Monday, March 23, 2020 10:47 PM
To: Quan, Evan <Evan.Quan@amd.com>
Cc: amd-gfx@lists.freedesktop.org; Deucher, Alexander <Alexander.Deucher@amd.com>; mcoffin13@gmail.com
Subject: Re: [PATCH 8/8] drm/amdgpu/smu11: add support for SMU AC/DC interrupts

On Sun, Mar 22, 2020 at 11:54 PM Quan, Evan <Evan.Quan@amd.com> wrote:
>
> Thanks Alex. The series is reviewed-by: Evan Quan <evan.quan@amd.com>

Thanks Evan.  Can you verify that the client and source id are correct for the interrupt?  I wasn't able to find them.

Alex

>
> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of 
> Alex Deucher
> Sent: Saturday, March 21, 2020 2:27 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; 
> mcoffin13@gmail.com
> Subject: [PATCH 8/8] drm/amdgpu/smu11: add support for SMU AC/DC 
> interrupts
>
> Driver needs to send the ack message when it receives the AC/DC interrupt from the SMU.
>
> TODO: verify the client and src ids.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>  drivers/gpu/drm/amd/powerplay/smu_v11_0.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c 
> b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> index 20174bed11ce..d19e1d0d56c0 100644
> --- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> +++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
> @@ -1525,6 +1525,13 @@ int smu_v11_0_set_xgmi_pstate(struct smu_context *smu,
>         return ret;
>  }
>
> +static int smu_v11_0_ack_ac_dc_interrupt(struct smu_context *smu) {
> +       return smu_send_smc_msg(smu,
> +                               SMU_MSG_ReenableAcDcInterrupt,
> +                               NULL); }
> +
>  #define THM_11_0__SRCID__THM_DIG_THERM_L2H             0               /* ASIC_TEMP > CG_THERMAL_INT.DIG_THERM_INTH  */
>  #define THM_11_0__SRCID__THM_DIG_THERM_H2L             1               /* ASIC_TEMP < CG_THERMAL_INT.DIG_THERM_INTL  */
>
> @@ -1558,6 +1565,9 @@ static int smu_v11_0_irq_process(struct amdgpu_device *adev,
>                 break;
>
>                 }
> +       } else if (client_id == SOC15_IH_CLIENTID_MP1) {
> +               if (src_id == 0xfe)
> +                       smu_v11_0_ack_ac_dc_interrupt(&adev->smu);
>         }
>
>         return 0;
> @@ -1597,6 +1607,12 @@ int smu_v11_0_register_irq_handler(struct smu_context *smu)
>         if (ret)
>                 return ret;
>
> +       ret = amdgpu_irq_add_id(adev, SOC15_IH_CLIENTID_MP1,
> +                               0xfe,
> +                               irq_src);
> +       if (ret)
> +               return ret;
> +
>         return ret;
>  }
>
> --
> 2.25.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
> s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CEv
> an.Quan%40amd.com%7C0738875d4cae44f1574908d7cf3907c6%7C3dd8961fe4884e6
> 08e11a82d994e183d%7C0%7C0%7C637205716159695922&amp;sdata=Yct4d%2ByJkHL
> TXhL9ihK1jr65V8k2CJLlQrDGI4hjJx0%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-03-24  2:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-20 18:27 [PATCH 1/8] drm/amd/swSMU: add callback to set AC/DC power source Alex Deucher
2020-03-20 18:27 ` [PATCH 2/8] drm/amdgpu/smu11: add a helper to set the " Alex Deucher
2020-03-20 18:27 ` [PATCH 3/8] drm/amdgpu/swSMU: use the smu11 power source helper for navi1x Alex Deucher
2020-03-20 18:27 ` [PATCH 4/8] drm/amdgpu/swSMU: correct the bootup power source for Navi1X Alex Deucher
2020-03-20 18:27 ` [PATCH 5/8] drm/amdgpu/swSMU: set AC/DC mode based on the current system state Alex Deucher
2020-03-20 18:27 ` [PATCH 6/8] drm/amdgpu/swSMU: handle DC controlled by GPIO for navi1x Alex Deucher
2020-03-20 18:27 ` [PATCH 7/8] drm/amdgpu/swSMU: handle manual AC/DC notifications Alex Deucher
2020-03-20 18:27 ` [PATCH 8/8] drm/amdgpu/smu11: add support for SMU AC/DC interrupts Alex Deucher
2020-03-23  3:54   ` Quan, Evan
2020-03-23 14:46     ` Alex Deucher
2020-03-24  2:53       ` Quan, Evan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.