All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] drm/amd/powerplay: introduce the cgs print helpers
@ 2016-12-08  5:23 Huang Rui
       [not found] ` <1481174591-2187-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Huang Rui @ 2016-12-08  5:23 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Alex Deucher,
	Christian König
  Cc: Arindam Nath, Huang Rui

From: Huang Rui <Ray.Huang@amd.com>

Hi all,

These patch set adds the helpers of print in CGS. Powerplay will be
used them instead of raw printk, and we can dynamic change the debug
level with it.

The prefix is like below:

[  310.200991] amdgpu 0000:01:00.0: [powerplay] ...

Thanks,
Rui

Huang Rui (4):
  drm/amdgpu: introduce the cgs print helpers
  drm/amd/powerplay: update printk to cgs debug prints for smumgr
  drm/amd/powerplay: update printk to cgs debug prints for common part
  drm/amd/powerplay: update printk to cgs debug prints for hwmgr

 drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c            | 26 +++++++++++-
 drivers/gpu/drm/amd/include/cgs_common.h           | 24 +++++++++++
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c      | 49 +++++++++++-----------
 drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c |  2 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     | 26 ++++++------
 .../gpu/drm/amd/powerplay/hwmgr/functiontables.c   | 14 +++----
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c        |  8 ++--
 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c   |  6 +--
 .../amd/powerplay/hwmgr/process_pptables_v1_0.c    |  4 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 26 ++++++------
 .../gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c   |  2 +-
 drivers/gpu/drm/amd/powerplay/inc/pp_debug.h       | 14 +++----
 drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c   | 28 ++++++-------
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c    |  4 +-
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c |  8 ++--
 drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c | 16 +++----
 .../gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c  |  2 +-
 .../gpu/drm/amd/powerplay/smumgr/polaris10_smc.c   |  4 +-
 .../drm/amd/powerplay/smumgr/polaris10_smumgr.c    |  8 ++--
 drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c | 16 +++----
 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c   | 14 +++----
 .../gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c    |  2 +-
 22 files changed, 176 insertions(+), 127 deletions(-)

-- 
2.7.4

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

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

* [PATCH 1/4] drm/amdgpu: introduce the cgs print helpers
       [not found] ` <1481174591-2187-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>
@ 2016-12-08  5:23   ` Huang Rui
  2016-12-08  5:23   ` [PATCH 2/4] drm/amd/powerplay: update printk to cgs debug prints for smumgr Huang Rui
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Huang Rui @ 2016-12-08  5:23 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Alex Deucher,
	Christian König
  Cc: Arindam Nath, Huang Rui

This patch introduces cgs print helpers, this helpers will be used on
powerplay part instead of raw printk. Then we can dynamic adjust
powerplay print level. The prefix of print is like below:

[  310.200991] amdgpu 0000:01:00.0: [powerplay] ...

Signed-off-by: Huang Rui <ray.huang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c  | 26 +++++++++++++++++++++++++-
 drivers/gpu/drm/amd/include/cgs_common.h | 24 ++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
index 9ada56c..aade225 100755
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
@@ -42,6 +42,26 @@ struct amdgpu_cgs_device {
 	struct amdgpu_device *adev =					\
 		((struct amdgpu_cgs_device *)cgs_device)->adev
 
+#define DECLARE_CGS_PRINT(level) 			 \
+static void						 \
+amdgpu_cgs_##level(struct cgs_device *cgs_device,	 \
+		   const char *fmt, ...)		 \
+{							 \
+	CGS_FUNC_ADEV;					 \
+	struct va_format vaf;				 \
+	va_list args;					 \
+	va_start(args, fmt);				 \
+	vaf.fmt = fmt;					 \
+	vaf.va = &args;					 \
+	dev_##level(adev->dev, "[powerplay] %pV", &vaf); \
+	va_end(args);					 \
+}
+
+DECLARE_CGS_PRINT(err);
+DECLARE_CGS_PRINT(warn);
+DECLARE_CGS_PRINT(info);
+DECLARE_CGS_PRINT(dbg);
+
 static int amdgpu_cgs_gpu_mem_info(struct cgs_device *cgs_device, enum cgs_gpu_mem_type type,
 				   uint64_t *mc_start, uint64_t *mc_size,
 				   uint64_t *mem_size)
@@ -1235,7 +1255,11 @@ static const struct cgs_ops amdgpu_cgs_ops = {
 	amdgpu_cgs_notify_dpm_enabled,
 	amdgpu_cgs_call_acpi_method,
 	amdgpu_cgs_query_system_info,
-	amdgpu_cgs_is_virtualization_enabled
+	amdgpu_cgs_is_virtualization_enabled,
+	amdgpu_cgs_err,
+	amdgpu_cgs_warn,
+	amdgpu_cgs_info,
+	amdgpu_cgs_dbg,
 };
 
 static const struct cgs_os_ops amdgpu_cgs_os_ops = {
diff --git a/drivers/gpu/drm/amd/include/cgs_common.h b/drivers/gpu/drm/amd/include/cgs_common.h
index e4a1697..242be9f 100755
--- a/drivers/gpu/drm/amd/include/cgs_common.h
+++ b/drivers/gpu/drm/amd/include/cgs_common.h
@@ -620,6 +620,15 @@ typedef int (*cgs_call_acpi_method)(struct cgs_device *cgs_device,
 typedef int (*cgs_query_system_info)(struct cgs_device *cgs_device,
 				struct cgs_system_info *sys_info);
 
+typedef void (*cgs_err)(struct cgs_device *cgs_device,
+			const char *format, ...);
+typedef void (*cgs_warn)(struct cgs_device *cgs_device,
+			 const char *format, ...);
+typedef void (*cgs_info)(struct cgs_device *cgs_device,
+			 const char *format, ...);
+typedef void (*cgs_dbg)(struct cgs_device *cgs_device,
+			const char *format, ...);
+
 typedef int (*cgs_is_virtualization_enabled_t)(void *cgs_device);
 
 struct cgs_ops {
@@ -674,6 +683,11 @@ struct cgs_ops {
 	/* get system info */
 	cgs_query_system_info query_system_info;
 	cgs_is_virtualization_enabled_t is_virtualization_enabled;
+	/* cgs prints */
+	cgs_err err;
+	cgs_warn warn;
+	cgs_info info;
+	cgs_dbg dbg;
 };
 
 struct cgs_os_ops; /* To be define in OS-specific CGS header */
@@ -772,6 +786,16 @@ struct cgs_device
 	CGS_CALL(call_acpi_method, dev, acpi_method, acpi_function, pintput, poutput, output_count, input_size, output_size)
 #define cgs_query_system_info(dev, sys_info)	\
 	CGS_CALL(query_system_info, dev, sys_info)
+
+#define cgs_err(dev, format, ...)     \
+	CGS_CALL(err, dev, format, ##__VA_ARGS__)
+#define cgs_warn(dev, format, ...)     \
+	CGS_CALL(warn, dev, format, ##__VA_ARGS__)
+#define cgs_info(dev, format, ...)     \
+	CGS_CALL(info, dev, format, ##__VA_ARGS__)
+#define cgs_dbg(dev, format, ...)     \
+	CGS_CALL(dbg, dev, format, ##__VA_ARGS__)
+
 #define cgs_get_pci_resource(cgs_device, resource_type, size, offset, \
 	resource_base) \
 	CGS_CALL(get_pci_resource, cgs_device, resource_type, size, offset, \
-- 
2.7.4

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

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

* [PATCH 2/4] drm/amd/powerplay: update printk to cgs debug prints for smumgr
       [not found] ` <1481174591-2187-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>
  2016-12-08  5:23   ` [PATCH 1/4] drm/amdgpu: " Huang Rui
@ 2016-12-08  5:23   ` Huang Rui
  2016-12-08  5:23   ` [PATCH 3/4] drm/amd/powerplay: update printk to cgs debug prints for common part Huang Rui
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Huang Rui @ 2016-12-08  5:23 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Alex Deucher,
	Christian König
  Cc: Arindam Nath, Huang Rui

Most of printk are replaced by cgs prints, but some functions doesn't
have device obj for some of them. So use pr_* instead at that cases.

Signed-off-by: Huang Rui <ray.huang@amd.com>
---
 drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c   | 28 +++++++++++-----------
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c    |  4 ++--
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c |  8 +++----
 drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c | 16 ++++++-------
 .../gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c  |  2 +-
 .../gpu/drm/amd/powerplay/smumgr/polaris10_smc.c   |  4 ++--
 .../drm/amd/powerplay/smumgr/polaris10_smumgr.c    |  8 +++----
 drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c | 16 ++++++-------
 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c   | 14 +++++------
 .../gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c    |  2 +-
 10 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c
index 5a44485..9b7297a 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c
@@ -70,7 +70,7 @@ static int cz_send_msg_to_smc_async(struct pp_smumgr *smumgr,
 	result = SMUM_WAIT_FIELD_UNEQUAL(smumgr,
 					SMU_MP1_SRBM2P_RESP_0, CONTENT, 0);
 	if (result != 0) {
-		printk(KERN_ERR "[ powerplay ] cz_send_msg_to_smc_async failed\n");
+		cgs_err(smumgr->device, "cz_send_msg_to_smc_async failed\n");
 		return result;
 	}
 
@@ -100,12 +100,12 @@ static int cz_set_smc_sram_address(struct pp_smumgr *smumgr,
 		return -EINVAL;
 
 	if (0 != (3 & smc_address)) {
-		printk(KERN_ERR "[ powerplay ] SMC address must be 4 byte aligned\n");
+		cgs_err(smumgr->device, "SMC address must be 4 byte aligned\n");
 		return -EINVAL;
 	}
 
 	if (limit <= (smc_address + 3)) {
-		printk(KERN_ERR "[ powerplay ] SMC address beyond the SMC RAM area\n");
+		cgs_err(smumgr->device, "SMC address beyond the SMC RAM area\n");
 		return -EINVAL;
 	}
 
@@ -147,7 +147,7 @@ static int cz_request_smu_load_fw(struct pp_smumgr *smumgr)
 	uint32_t smc_address;
 
 	if (!smumgr->reload_fw) {
-		printk(KERN_INFO "[ powerplay ] skip reloading...\n");
+		cgs_info(smumgr->device, "skip reloading...\n");
 		return 0;
 	}
 
@@ -198,7 +198,7 @@ static int cz_check_fw_load_finish(struct pp_smumgr *smumgr,
 	}
 
 	if (i >= smumgr->usec_timeout) {
-		printk(KERN_ERR "[ powerplay ] SMU check loaded firmware failed.\n");
+		cgs_err(smumgr->device, "SMU check loaded firmware failed.\n");
 		return -EINVAL;
 	}
 
@@ -267,13 +267,13 @@ static int cz_start_smu(struct pp_smumgr *smumgr)
 
 	ret = cz_request_smu_load_fw(smumgr);
 	if (ret)
-		printk(KERN_ERR "[ powerplay] SMU firmware load failed\n");
+		cgs_err(smumgr->device, "SMU firmware load failed\n");
 
 	cz_check_fw_load_finish(smumgr, fw_to_check);
 
 	ret = cz_load_mec_firmware(smumgr);
 	if (ret)
-		printk(KERN_ERR "[ powerplay ] Mec Firmware load failed\n");
+		cgs_err(smumgr->device, "Mec Firmware load failed\n");
 
 	return ret;
 }
@@ -406,7 +406,7 @@ static int cz_smu_populate_single_scratch_task(
 			break;
 
 	if (i >= cz_smu->scratch_buffer_length) {
-		printk(KERN_ERR "[ powerplay ] Invalid Firmware Type\n");
+		cgs_err(smumgr->device, "Invalid Firmware Type\n");
 		return -EINVAL;
 	}
 
@@ -443,7 +443,7 @@ static int cz_smu_populate_single_ucode_load_task(
 			break;
 
 	if (i >= cz_smu->driver_buffer_length) {
-		printk(KERN_ERR "[ powerplay ] Invalid Firmware Type\n");
+		cgs_err(smumgr->device, "Invalid Firmware Type\n");
 		return -EINVAL;
 	}
 
@@ -774,7 +774,7 @@ static int cz_smu_init(struct pp_smumgr *smumgr)
 		CZ_SCRATCH_ENTRY_UCODE_ID_RLC_SCRATCH,
 		UCODE_ID_RLC_SCRATCH_SIZE_BYTE,
 		&cz_smu->scratch_buffer[cz_smu->scratch_buffer_length++])) {
-		printk(KERN_ERR "[ powerplay ] Error when Populate Firmware Entry.\n");
+		cgs_err(smumgr->device, "Error when Populate Firmware Entry.\n");
 		return -1;
 	}
 
@@ -782,14 +782,14 @@ static int cz_smu_init(struct pp_smumgr *smumgr)
 		CZ_SCRATCH_ENTRY_UCODE_ID_RLC_SRM_ARAM,
 		UCODE_ID_RLC_SRM_ARAM_SIZE_BYTE,
 		&cz_smu->scratch_buffer[cz_smu->scratch_buffer_length++])) {
-		printk(KERN_ERR "[ powerplay ] Error when Populate Firmware Entry.\n");
+		cgs_err(smumgr->device, "Error when Populate Firmware Entry.\n");
 		return -1;
 	}
 	if (0 != cz_smu_populate_single_scratch_entry(smumgr,
 		CZ_SCRATCH_ENTRY_UCODE_ID_RLC_SRM_DRAM,
 		UCODE_ID_RLC_SRM_DRAM_SIZE_BYTE,
 		&cz_smu->scratch_buffer[cz_smu->scratch_buffer_length++])) {
-		printk(KERN_ERR "[ powerplay ] Error when Populate Firmware Entry.\n");
+		cgs_err(smumgr->device, "Error when Populate Firmware Entry.\n");
 		return -1;
 	}
 
@@ -797,7 +797,7 @@ static int cz_smu_init(struct pp_smumgr *smumgr)
 		CZ_SCRATCH_ENTRY_UCODE_ID_POWER_PROFILING,
 		sizeof(struct SMU8_MultimediaPowerLogData),
 		&cz_smu->scratch_buffer[cz_smu->scratch_buffer_length++])) {
-		printk(KERN_ERR "[ powerplay ] Error when Populate Firmware Entry.\n");
+		cgs_err(smumgr->device, "Error when Populate Firmware Entry.\n");
 		return -1;
 	}
 
@@ -805,7 +805,7 @@ static int cz_smu_init(struct pp_smumgr *smumgr)
 		CZ_SCRATCH_ENTRY_SMU8_FUSION_CLKTABLE,
 		sizeof(struct SMU8_Fusion_ClkTable),
 		&cz_smu->scratch_buffer[cz_smu->scratch_buffer_length++])) {
-		printk(KERN_ERR "[ powerplay ] Error when Populate Firmware Entry.\n");
+		cgs_err(smumgr->device, "Error when Populate Firmware Entry.\n");
 		return -1;
 	}
 	cz_smu_construct_toc(smumgr);
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c
index 6aeb1d2..252e2b9 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c
@@ -2131,7 +2131,7 @@ uint32_t fiji_get_offsetof(uint32_t type, uint32_t member)
 			return offsetof(SMU73_Discrete_DpmTable, LowSclkInterruptThreshold);
 		}
 	}
-	printk(KERN_WARNING "can't get the offset of type %x member %x\n", type, member);
+	pr_warning("can't get the offset of type %x member %x\n", type, member);
 	return 0;
 }
 
@@ -2156,7 +2156,7 @@ uint32_t fiji_get_mac_definition(uint32_t value)
 		return SMU73_MAX_LEVELS_MVDD;
 	}
 
-	printk(KERN_WARNING "can't get the mac of %x\n", value);
+	pr_warning("can't get the mac of %x\n", value);
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
index 26eff56..9939146 100755
--- a/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c
@@ -179,7 +179,7 @@ static int fiji_setup_pwr_virus(struct pp_smumgr *smumgr)
 			result = 0;
 			break;
 		default:
-			printk(KERN_ERR "Table Exit with Invalid Command!");
+			cgs_err(smumgr->device,  "Table Exit with Invalid Command!");
 			priv->avfs.AvfsBtcStatus = AVFS_BTC_VIRUS_FAIL;
 			result = -1;
 			break;
@@ -202,13 +202,13 @@ static int fiji_start_avfs_btc(struct pp_smumgr *smumgr)
 				priv->avfs.AvfsBtcStatus = AVFS_BTC_COMPLETED_UNSAVED;
 				result = 0;
 			} else {
-				printk(KERN_ERR "[AVFS][fiji_start_avfs_btc] Attempt"
+				cgs_err(smumgr->device,  "[AVFS][fiji_start_avfs_btc] Attempt"
 						" to Enable AVFS Failed!");
 				smum_send_msg_to_smc(smumgr, PPSMC_MSG_DisableAvfs);
 				result = -1;
 			}
 		} else {
-			printk(KERN_ERR "[AVFS][fiji_start_avfs_btc] "
+			cgs_err(smumgr->device,  "[AVFS][fiji_start_avfs_btc] "
 					"PerformBTC SMU msg failed");
 			result = -1;
 		}
@@ -384,7 +384,7 @@ static int fiji_avfs_event_mgr(struct pp_smumgr *smumgr, bool smu_started)
 	case AVFS_BTC_NOTSUPPORTED: /* Do nothing */
 		break;
 	default:
-		printk(KERN_ERR "[AVFS] Something is broken. See log!");
+		cgs_err(smumgr->device,  "[AVFS] Something is broken. See log!");
 		break;
 	}
 	return 0;
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c
index a24971a..cef8338 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c
@@ -378,7 +378,7 @@ static int iceland_get_std_voltage_value_sidd(struct pp_hwmgr *hwmgr,
 			return -EINVAL);
 
 	if (NULL == hwmgr->dyn_state.cac_leakage_table) {
-		pr_warning("CAC Leakage Table does not exist, using vddc.\n");
+		cgs_warn(hwmgr->device, "CAC Leakage Table does not exist, using vddc.\n");
 		return 0;
 	}
 
@@ -394,7 +394,7 @@ static int iceland_get_std_voltage_value_sidd(struct pp_hwmgr *hwmgr,
 				*lo = hwmgr->dyn_state.cac_leakage_table->entries[v_index].Vddc * VOLTAGE_SCALE;
 				*hi = (uint16_t)(hwmgr->dyn_state.cac_leakage_table->entries[v_index].Leakage * VOLTAGE_SCALE);
 			} else {
-				pr_warning("Index from SCLK/VDDC Dependency Table exceeds the CAC Leakage Table index, using maximum index from CAC table.\n");
+				cgs_warn(hwmgr->device, "Index from SCLK/VDDC Dependency Table exceeds the CAC Leakage Table index, using maximum index from CAC table.\n");
 				*lo = hwmgr->dyn_state.cac_leakage_table->entries[hwmgr->dyn_state.cac_leakage_table->count - 1].Vddc * VOLTAGE_SCALE;
 				*hi = (uint16_t)(hwmgr->dyn_state.cac_leakage_table->entries[hwmgr->dyn_state.cac_leakage_table->count - 1].Leakage * VOLTAGE_SCALE);
 			}
@@ -414,7 +414,7 @@ static int iceland_get_std_voltage_value_sidd(struct pp_hwmgr *hwmgr,
 					*lo = hwmgr->dyn_state.cac_leakage_table->entries[v_index].Vddc * VOLTAGE_SCALE;
 					*hi = (uint16_t)(hwmgr->dyn_state.cac_leakage_table->entries[v_index].Leakage) * VOLTAGE_SCALE;
 				} else {
-					pr_warning("Index from SCLK/VDDC Dependency Table exceeds the CAC Leakage Table index in second look up, using maximum index from CAC table.");
+					cgs_warn(hwmgr->device, "Index from SCLK/VDDC Dependency Table exceeds the CAC Leakage Table index in second look up, using maximum index from CAC table.");
 					*lo = hwmgr->dyn_state.cac_leakage_table->entries[hwmgr->dyn_state.cac_leakage_table->count - 1].Vddc * VOLTAGE_SCALE;
 					*hi = (uint16_t)(hwmgr->dyn_state.cac_leakage_table->entries[hwmgr->dyn_state.cac_leakage_table->count - 1].Leakage * VOLTAGE_SCALE);
 				}
@@ -423,7 +423,7 @@ static int iceland_get_std_voltage_value_sidd(struct pp_hwmgr *hwmgr,
 		}
 
 		if (!vol_found)
-			pr_warning("Unable to get std_vddc from SCLK/VDDC Dependency Table, using vddc.\n");
+			cgs_warn(hwmgr->device, "Unable to get std_vddc from SCLK/VDDC Dependency Table, using vddc.\n");
 	}
 
 	return 0;
@@ -1545,7 +1545,7 @@ static int iceland_populate_smc_boot_level(struct pp_hwmgr *hwmgr,
 
 	if (0 != result) {
 		smu_data->smc_state_table.GraphicsBootLevel = 0;
-		printk(KERN_ERR "[ powerplay ] VBIOS did not find boot engine clock value \
+		cgs_err(hwmgr->device, "[ powerplay ] VBIOS did not find boot engine clock value \
 			in dependency table. Using Graphics DPM level 0!");
 		result = 0;
 	}
@@ -1556,7 +1556,7 @@ static int iceland_populate_smc_boot_level(struct pp_hwmgr *hwmgr,
 
 	if (0 != result) {
 		smu_data->smc_state_table.MemoryBootLevel = 0;
-		printk(KERN_ERR "[ powerplay ] VBIOS did not find boot engine clock value \
+		cgs_err(hwmgr->device, "[ powerplay ] VBIOS did not find boot engine clock value \
 			in dependency table. Using Memory DPM level 0!");
 		result = 0;
 	}
@@ -2146,7 +2146,7 @@ uint32_t iceland_get_offsetof(uint32_t type, uint32_t member)
 			return offsetof(SMU71_Discrete_DpmTable, LowSclkInterruptThreshold);
 		}
 	}
-	printk(KERN_WARNING "can't get the offset of type %x member %x\n", type, member);
+	pr_warning("can't get the offset of type %x member %x\n", type, member);
 	return 0;
 }
 
@@ -2169,7 +2169,7 @@ uint32_t iceland_get_mac_definition(uint32_t value)
 		return SMU71_MAX_LEVELS_MVDD;
 	}
 
-	printk(KERN_WARNING "can't get the mac of %x\n", value);
+	pr_warning("can't get the mac of %x\n", value);
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c
index eeafefc..3f7781b 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c
@@ -176,7 +176,7 @@ static int iceland_start_smu(struct pp_smumgr *smumgr)
 		return result;
 
 	if (!smu7_is_smc_ram_running(smumgr)) {
-		printk("smu not running, upload firmware again \n");
+		cgs_info(smumgr->device, "smu not running, upload firmware again \n");
 		result = iceland_smu_upload_firmware_image(smumgr);
 		if (result)
 			return result;
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c
index 5190e82..58881e9 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c
@@ -2180,7 +2180,7 @@ uint32_t polaris10_get_offsetof(uint32_t type, uint32_t member)
 			return offsetof(SMU74_Discrete_DpmTable, LowSclkInterruptThreshold);
 		}
 	}
-	printk(KERN_WARNING "can't get the offset of type %x member %x\n", type, member);
+	pr_warning("can't get the offset of type %x member %x\n", type, member);
 	return 0;
 }
 
@@ -2207,7 +2207,7 @@ uint32_t polaris10_get_mac_definition(uint32_t value)
 		return SMU7_UVD_MCLK_HANDSHAKE_DISABLE;
 	}
 
-	printk(KERN_WARNING "can't get the mac of %x\n", value);
+	pr_warning("can't get the mac of %x\n", value);
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
index f38a687..a62d1c3 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
@@ -84,7 +84,7 @@ static int polaris10_setup_pwr_virus(struct pp_smumgr *smumgr)
 			break;
 
 		default:
-			printk("Table Exit with Invalid Command!");
+			cgs_info(smumgr->device, "Table Exit with Invalid Command!");
 			smu_data->avfs.avfs_btc_status = AVFS_BTC_VIRUS_FAIL;
 			result = -1;
 			break;
@@ -102,7 +102,7 @@ static int polaris10_perform_btc(struct pp_smumgr *smumgr)
 
 	if (0 != smu_data->avfs.avfs_btc_param) {
 		if (0 != smu7_send_msg_to_smc_with_parameter(smumgr, PPSMC_MSG_PerformBtc, smu_data->avfs.avfs_btc_param)) {
-			printk("[AVFS][SmuPolaris10_PerformBtc] PerformBTC SMU msg failed");
+			cgs_info(smumgr->device, "[AVFS][SmuPolaris10_PerformBtc] PerformBTC SMU msg failed");
 			result = -1;
 		}
 	}
@@ -189,7 +189,7 @@ polaris10_avfs_event_mgr(struct pp_smumgr *smumgr, bool SMU_VFT_INTACT)
 		return -1);
 
 		if (smu_data->avfs.avfs_btc_param > 1) {
-			printk("[AVFS][Polaris10_AVFSEventMgr] AC BTC has not been successfully verified on Fiji. There may be in this setting.");
+			cgs_info(smumgr->device, "[AVFS][Polaris10_AVFSEventMgr] AC BTC has not been successfully verified on Fiji. There may be in this setting.");
 			smu_data->avfs.avfs_btc_status = AVFS_BTC_VIRUS_FAIL;
 			PP_ASSERT_WITH_CODE(-1 == polaris10_setup_pwr_virus(smumgr),
 			"[AVFS][Polaris10_AVFSEventMgr] Could not setup Pwr Virus for AVFS ",
@@ -208,7 +208,7 @@ polaris10_avfs_event_mgr(struct pp_smumgr *smumgr, bool SMU_VFT_INTACT)
 		break;
 
 	default:
-		printk("[AVFS] Something is broken. See log!");
+		cgs_info(smumgr->device, "[AVFS] Something is broken. See log!");
 		break;
 	}
 
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c
index f49b548..f3101a1 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c
@@ -175,7 +175,7 @@ int smu7_send_msg_to_smc(struct pp_smumgr *smumgr, uint16_t msg)
 	ret = SMUM_READ_FIELD(smumgr->device, SMC_RESP_0, SMC_RESP);
 
 	if (ret != 1)
-		printk("\n failed to send pre message %x ret is %d \n",  msg, ret);
+		cgs_warn(smumgr->device, "\n failed to send pre message %x ret is %d \n",  msg, ret);
 
 	cgs_write_register(smumgr->device, mmSMC_MESSAGE_0, msg);
 
@@ -184,7 +184,7 @@ int smu7_send_msg_to_smc(struct pp_smumgr *smumgr, uint16_t msg)
 	ret = SMUM_READ_FIELD(smumgr->device, SMC_RESP_0, SMC_RESP);
 
 	if (ret != 1)
-		printk("\n failed to send message %x ret is %d \n",  msg, ret);
+		cgs_warn(smumgr->device, "\n failed to send message %x ret is %d \n",  msg, ret);
 
 	return 0;
 }
@@ -225,7 +225,7 @@ int smu7_send_msg_to_smc_offset(struct pp_smumgr *smumgr)
 	SMUM_WAIT_FIELD_UNEQUAL(smumgr, SMC_RESP_0, SMC_RESP, 0);
 
 	if (1 != SMUM_READ_FIELD(smumgr->device, SMC_RESP_0, SMC_RESP))
-		printk("Failed to send Message.\n");
+		cgs_warn(smumgr->device, "Failed to send Message.\n");
 
 	return 0;
 }
@@ -318,7 +318,7 @@ int smu7_write_smc_sram_dword(struct pp_smumgr *smumgr, uint32_t smc_addr, uint3
 
 /* Convert the firmware type to SMU type mask. For MEC, we need to check all MEC related type */
 
-static uint32_t smu7_get_mask_for_firmware_type(uint32_t fw_type)
+static uint32_t smu7_get_mask_for_firmware_type(struct pp_smumgr *smumgr, uint32_t fw_type)
 {
 	uint32_t result = 0;
 
@@ -347,7 +347,7 @@ static uint32_t smu7_get_mask_for_firmware_type(uint32_t fw_type)
 		result = UCODE_ID_RLC_G_MASK;
 		break;
 	default:
-		printk("UCode type is out of range! \n");
+		cgs_warn(smumgr->device,"UCode type is out of range! \n");
 		result = 0;
 	}
 
@@ -396,7 +396,7 @@ int smu7_request_smu_load_fw(struct pp_smumgr *smumgr)
 	struct SMU_DRAMData_TOC *toc;
 
 	if (!smumgr->reload_fw) {
-		printk(KERN_INFO "[ powerplay ] skip reloading...\n");
+		cgs_info(smumgr->device, "skip reloading...\n");
 		return 0;
 	}
 
@@ -474,7 +474,7 @@ int smu7_request_smu_load_fw(struct pp_smumgr *smumgr)
 	smu7_send_msg_to_smc_with_parameter(smumgr, PPSMC_MSG_DRV_DRAM_ADDR_LO, smu_data->header_buffer.mc_addr_low);
 
 	if (smu7_send_msg_to_smc_with_parameter(smumgr, PPSMC_MSG_LoadUcodes, fw_to_load))
-		printk(KERN_ERR "Fail to Request SMU Load uCode");
+		cgs_err(smumgr->device, "Fail to Request SMU Load uCode");
 
 	return result;
 }
@@ -483,7 +483,7 @@ int smu7_request_smu_load_fw(struct pp_smumgr *smumgr)
 int smu7_check_fw_load_finish(struct pp_smumgr *smumgr, uint32_t fw_type)
 {
 	struct smu7_smumgr *smu_data = (struct smu7_smumgr *)(smumgr->backend);
-	uint32_t fw_mask = smu7_get_mask_for_firmware_type(fw_type);
+	uint32_t fw_mask = smu7_get_mask_for_firmware_type(smumgr, fw_type);
 	uint32_t ret;
 
 	ret = smum_wait_on_indirect_register(smumgr, mmSMC_IND_INDEX_11,
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c
index 2e1493c..c3c8d7e 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c
@@ -656,7 +656,7 @@ int tonga_populate_all_graphic_levels(struct pp_hwmgr *hwmgr)
 		}
 	} else {
 		if (0 == data->dpm_level_enable_mask.pcie_dpm_enable_mask)
-			printk(KERN_ERR "[ powerplay ] Pcie Dpm Enablemask is 0 !");
+			cgs_err(hwmgr->device, "Pcie Dpm Enablemask is 0 !");
 
 		while (data->dpm_level_enable_mask.pcie_dpm_enable_mask &&
 				((data->dpm_level_enable_mask.pcie_dpm_enable_mask &
@@ -1503,7 +1503,7 @@ static int tonga_populate_smc_boot_level(struct pp_hwmgr *hwmgr,
 
 	if (result != 0) {
 		smu_data->smc_state_table.GraphicsBootLevel = 0;
-		printk(KERN_ERR "[powerplay] VBIOS did not find boot engine "
+		cgs_err(hwmgr->device,  "VBIOS did not find boot engine "
 				"clock value in dependency table. "
 				"Using Graphics DPM level 0 !");
 		result = 0;
@@ -1515,7 +1515,7 @@ static int tonga_populate_smc_boot_level(struct pp_hwmgr *hwmgr,
 
 	if (result != 0) {
 		smu_data->smc_state_table.MemoryBootLevel = 0;
-		printk(KERN_ERR "[powerplay] VBIOS did not find boot "
+		cgs_err(hwmgr->device,  "VBIOS did not find boot "
 				"engine clock value in dependency table."
 				"Using Memory DPM level 0 !");
 		result = 0;
@@ -1739,7 +1739,7 @@ static int tonga_populate_vr_config(struct pp_hwmgr *hwmgr,
 			config = VR_SVI2_PLANE_2;
 			table->VRConfig |= config;
 		} else {
-			printk(KERN_ERR "[ powerplay ] VDDC and VDDGFX should "
+			cgs_err(hwmgr->device, "VDDC and VDDGFX should "
 				"be both on SVI2 control in splitted mode !\n");
 		}
 	} else {
@@ -1752,7 +1752,7 @@ static int tonga_populate_vr_config(struct pp_hwmgr *hwmgr,
 			config = VR_SVI2_PLANE_1;
 			table->VRConfig |= config;
 		} else {
-			printk(KERN_ERR "[ powerplay ] VDDC should be on "
+			cgs_err(hwmgr->device, "VDDC should be on "
 					"SVI2 control in merged mode !\n");
 		}
 	}
@@ -2657,7 +2657,7 @@ uint32_t tonga_get_offsetof(uint32_t type, uint32_t member)
 			return offsetof(SMU72_Discrete_DpmTable, LowSclkInterruptThreshold);
 		}
 	}
-	printk(KERN_WARNING "can't get the offset of type %x member %x\n", type, member);
+	pr_warning("can't get the offset of type %x member %x\n", type, member);
 	return 0;
 }
 
@@ -2681,7 +2681,7 @@ uint32_t tonga_get_mac_definition(uint32_t value)
 	case SMU_MAX_LEVELS_MVDD:
 		return SMU72_MAX_LEVELS_MVDD;
 	}
-	printk(KERN_WARNING "can't get the mac value %x\n", value);
+	pr_warning("can't get the mac value %x\n", value);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
index eff9a232..7046ac7 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c
@@ -84,7 +84,7 @@ static int tonga_start_in_protection_mode(struct pp_smumgr *smumgr)
 	/* Check pass/failed indicator */
 	if (1 != SMUM_READ_VFPF_INDIRECT_FIELD(smumgr->device,
 				CGS_IND_REG__SMC, SMU_STATUS, SMU_PASS)) {
-		printk(KERN_ERR "[ powerplay ] SMU Firmware start failed\n");
+		cgs_err(smumgr->device, "SMU Firmware start failed\n");
 		return -EINVAL;
 	}
 
-- 
2.7.4

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

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

* [PATCH 3/4] drm/amd/powerplay: update printk to cgs debug prints for common part
       [not found] ` <1481174591-2187-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>
  2016-12-08  5:23   ` [PATCH 1/4] drm/amdgpu: " Huang Rui
  2016-12-08  5:23   ` [PATCH 2/4] drm/amd/powerplay: update printk to cgs debug prints for smumgr Huang Rui
@ 2016-12-08  5:23   ` Huang Rui
  2016-12-08  5:23   ` [PATCH 4/4] drm/amd/powerplay: update printk to cgs debug prints for hwmgr Huang Rui
  2016-12-08  8:41   ` [PATCH 0/4] drm/amd/powerplay: introduce the cgs print helpers Christian König
  4 siblings, 0 replies; 13+ messages in thread
From: Huang Rui @ 2016-12-08  5:23 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Alex Deucher,
	Christian König
  Cc: Arindam Nath, Huang Rui

Most of printk are replaced by cgs prints, but some functions doesn't
have device obj for some of them. So use pr_* instead at that cases.

Signed-off-by: Huang Rui <ray.huang@amd.com>
---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c      | 49 +++++++++++-----------
 drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c |  2 +-
 drivers/gpu/drm/amd/powerplay/inc/pp_debug.h       | 14 +++----
 3 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index c81cf14..c30ab68 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -30,6 +30,7 @@
 #include "power_state.h"
 #include "eventmanager.h"
 #include "pp_debug.h"
+#include "cgs_common.h"
 
 
 #define PP_CHECK(handle)						\
@@ -76,14 +77,14 @@ static int pp_sw_init(void *handle)
 	if (ret)
 		goto err1;
 
-	pr_info("amdgpu: powerplay initialized\n");
+	cgs_info(hwmgr->device, "powerplay initialized\n");
 
 	return 0;
 err1:
 	if (hwmgr->pptable_func->pptable_fini)
 		hwmgr->pptable_func->pptable_fini(hwmgr);
 err:
-	pr_err("amdgpu: powerplay initialization failed\n");
+	cgs_err(hwmgr->device, "powerplay initialization failed\n");
 	return ret;
 }
 
@@ -132,13 +133,13 @@ static int pp_hw_init(void *handle)
 
 	ret = smumgr->smumgr_funcs->smu_init(smumgr);
 	if (ret) {
-		printk(KERN_ERR "[ powerplay ] smc initialization failed\n");
+		cgs_err(smumgr->device, "smc initialization failed\n");
 		return ret;
 	}
 
 	ret = smumgr->smumgr_funcs->start_smu(smumgr);
 	if (ret) {
-		printk(KERN_ERR "[ powerplay ] smc start failed\n");
+		cgs_err(smumgr->device, "smc start failed\n");
 		smumgr->smumgr_funcs->smu_fini(smumgr);
 		return ret;
 	}
@@ -207,7 +208,7 @@ int amd_set_clockgating_by_smu(void *handle, uint32_t msg_id)
 	PP_CHECK_HW(hwmgr);
 
 	if (hwmgr->hwmgr_func->update_clock_gatings == NULL) {
-		printk(KERN_INFO "%s was not implemented.\n", __func__);
+		cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
 		return 0;
 	}
 
@@ -227,7 +228,7 @@ static int pp_set_powergating_state(void *handle,
 	PP_CHECK_HW(hwmgr);
 
 	if (hwmgr->hwmgr_func->enable_per_cu_power_gating == NULL) {
-		printk(KERN_INFO "%s was not implemented.\n", __func__);
+		cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
 		return 0;
 	}
 
@@ -273,7 +274,7 @@ static int pp_resume(void *handle)
 
 	ret = smumgr->smumgr_funcs->start_smu(smumgr);
 	if (ret) {
-		printk(KERN_ERR "[ powerplay ] smc start failed\n");
+		cgs_err(smumgr->device, "smc start failed\n");
 		smumgr->smumgr_funcs->smu_fini(smumgr);
 		return ret;
 	}
@@ -328,7 +329,7 @@ static int pp_dpm_force_performance_level(void *handle,
 	PP_CHECK_HW(hwmgr);
 
 	if (hwmgr->hwmgr_func->force_dpm_level == NULL) {
-		printk(KERN_INFO "%s was not implemented.\n", __func__);
+		cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
 		return 0;
 	}
 
@@ -364,7 +365,7 @@ static int pp_dpm_get_sclk(void *handle, bool low)
 	PP_CHECK_HW(hwmgr);
 
 	if (hwmgr->hwmgr_func->get_sclk == NULL) {
-		printk(KERN_INFO "%s was not implemented.\n", __func__);
+		cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
 		return 0;
 	}
 
@@ -383,7 +384,7 @@ static int pp_dpm_get_mclk(void *handle, bool low)
 	PP_CHECK_HW(hwmgr);
 
 	if (hwmgr->hwmgr_func->get_mclk == NULL) {
-		printk(KERN_INFO "%s was not implemented.\n", __func__);
+		cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
 		return 0;
 	}
 
@@ -402,7 +403,7 @@ static int pp_dpm_powergate_vce(void *handle, bool gate)
 	PP_CHECK_HW(hwmgr);
 
 	if (hwmgr->hwmgr_func->powergate_vce == NULL) {
-		printk(KERN_INFO "%s was not implemented.\n", __func__);
+		cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
 		return 0;
 	}
 
@@ -421,7 +422,7 @@ static int pp_dpm_powergate_uvd(void *handle, bool gate)
 	PP_CHECK_HW(hwmgr);
 
 	if (hwmgr->hwmgr_func->powergate_uvd == NULL) {
-		printk(KERN_INFO "%s was not implemented.\n", __func__);
+		cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
 		return 0;
 	}
 
@@ -527,7 +528,7 @@ static int pp_dpm_set_fan_control_mode(void *handle, uint32_t mode)
 	PP_CHECK_HW(hwmgr);
 
 	if (hwmgr->hwmgr_func->set_fan_control_mode == NULL) {
-		printk(KERN_INFO "%s was not implemented.\n", __func__);
+		cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
 		return 0;
 	}
 
@@ -546,7 +547,7 @@ static int pp_dpm_get_fan_control_mode(void *handle)
 	PP_CHECK_HW(hwmgr);
 
 	if (hwmgr->hwmgr_func->get_fan_control_mode == NULL) {
-		printk(KERN_INFO "%s was not implemented.\n", __func__);
+		cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
 		return 0;
 	}
 
@@ -565,7 +566,7 @@ static int pp_dpm_set_fan_speed_percent(void *handle, uint32_t percent)
 	PP_CHECK_HW(hwmgr);
 
 	if (hwmgr->hwmgr_func->set_fan_speed_percent == NULL) {
-		printk(KERN_INFO "%s was not implemented.\n", __func__);
+		cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
 		return 0;
 	}
 
@@ -584,7 +585,7 @@ static int pp_dpm_get_fan_speed_percent(void *handle, uint32_t *speed)
 	PP_CHECK_HW(hwmgr);
 
 	if (hwmgr->hwmgr_func->get_fan_speed_percent == NULL) {
-		printk(KERN_INFO "%s was not implemented.\n", __func__);
+		cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
 		return 0;
 	}
 
@@ -620,7 +621,7 @@ static int pp_dpm_get_temperature(void *handle)
 	PP_CHECK_HW(hwmgr);
 
 	if (hwmgr->hwmgr_func->get_temperature == NULL) {
-		printk(KERN_INFO "%s was not implemented.\n", __func__);
+		cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
 		return 0;
 	}
 
@@ -726,7 +727,7 @@ static int pp_dpm_force_clock_level(void *handle,
 	PP_CHECK_HW(hwmgr);
 
 	if (hwmgr->hwmgr_func->force_clock_level == NULL) {
-		printk(KERN_INFO "%s was not implemented.\n", __func__);
+		cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
 		return 0;
 	}
 
@@ -746,7 +747,7 @@ static int pp_dpm_print_clock_levels(void *handle,
 	PP_CHECK_HW(hwmgr);
 
 	if (hwmgr->hwmgr_func->print_clock_levels == NULL) {
-		printk(KERN_INFO "%s was not implemented.\n", __func__);
+		cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
 		return 0;
 	}
 	return hwmgr->hwmgr_func->print_clock_levels(hwmgr, type, buf);
@@ -764,7 +765,7 @@ static int pp_dpm_get_sclk_od(void *handle)
 	PP_CHECK_HW(hwmgr);
 
 	if (hwmgr->hwmgr_func->get_sclk_od == NULL) {
-		printk(KERN_INFO "%s was not implemented.\n", __func__);
+		cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
 		return 0;
 	}
 
@@ -783,7 +784,7 @@ static int pp_dpm_set_sclk_od(void *handle, uint32_t value)
 	PP_CHECK_HW(hwmgr);
 
 	if (hwmgr->hwmgr_func->set_sclk_od == NULL) {
-		printk(KERN_INFO "%s was not implemented.\n", __func__);
+		cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
 		return 0;
 	}
 
@@ -802,7 +803,7 @@ static int pp_dpm_get_mclk_od(void *handle)
 	PP_CHECK_HW(hwmgr);
 
 	if (hwmgr->hwmgr_func->get_mclk_od == NULL) {
-		printk(KERN_INFO "%s was not implemented.\n", __func__);
+		cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
 		return 0;
 	}
 
@@ -821,7 +822,7 @@ static int pp_dpm_set_mclk_od(void *handle, uint32_t value)
 	PP_CHECK_HW(hwmgr);
 
 	if (hwmgr->hwmgr_func->set_mclk_od == NULL) {
-		printk(KERN_INFO "%s was not implemented.\n", __func__);
+		cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
 		return 0;
 	}
 
@@ -840,7 +841,7 @@ static int pp_dpm_read_sensor(void *handle, int idx, int32_t *value)
 	PP_CHECK_HW(hwmgr);
 
 	if (hwmgr->hwmgr_func->read_sensor == NULL) {
-		printk(KERN_INFO "%s was not implemented.\n", __func__);
+		cgs_info(hwmgr->device, "%s was not implemented.\n", __func__);
 		return 0;
 	}
 
diff --git a/drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c b/drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c
index d5ec8cc..a3cd230 100644
--- a/drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c
+++ b/drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c
@@ -151,7 +151,7 @@ static int thermal_interrupt_callback(void *private_data,
 				      unsigned src_id, const uint32_t *iv_entry)
 {
 	/* TO DO hanle PEM_Event_ThermalNotification (struct pp_eventmgr *)private_data*/
-	printk("current thermal is out of range \n");
+	pr_info("current thermal is out of range \n");
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/amd/powerplay/inc/pp_debug.h b/drivers/gpu/drm/amd/powerplay/inc/pp_debug.h
index bfdbec1..7e1129f 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/pp_debug.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/pp_debug.h
@@ -28,18 +28,18 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 
-#define PP_ASSERT_WITH_CODE(cond, msg, code)	\
-	do {					\
-		if (!(cond)) {			\
-			printk("%s\n", msg);	\
-			code;			\
-		}				\
+#define PP_ASSERT_WITH_CODE(cond, msg, code)		  \
+	do {						  \
+		if (!(cond)) {				  \
+			pr_info("[powerplay] %s\n", msg); \
+			code;				  \
+		}					  \
 	} while (0)
 
 
 #define PP_DBG_LOG(fmt, ...) \
 	do { \
-		if(0)printk(KERN_INFO "[ pp_dbg ] " fmt, ##__VA_ARGS__); \
+		if(0)pr_info("[pp_dbg] " fmt, ##__VA_ARGS__); \
 	} while (0)
 
 
-- 
2.7.4

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

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

* [PATCH 4/4] drm/amd/powerplay: update printk to cgs debug prints for hwmgr
       [not found] ` <1481174591-2187-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>
                     ` (2 preceding siblings ...)
  2016-12-08  5:23   ` [PATCH 3/4] drm/amd/powerplay: update printk to cgs debug prints for common part Huang Rui
@ 2016-12-08  5:23   ` Huang Rui
  2016-12-08  8:41   ` [PATCH 0/4] drm/amd/powerplay: introduce the cgs print helpers Christian König
  4 siblings, 0 replies; 13+ messages in thread
From: Huang Rui @ 2016-12-08  5:23 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Alex Deucher,
	Christian König
  Cc: Arindam Nath, Huang Rui

Most of printk are replaced by cgs prints, but some functions doesn't
have device obj for some of them. So use pr_* instead at that cases.

Signed-off-by: Huang Rui <ray.huang@amd.com>
---
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     | 26 +++++++++++-----------
 .../gpu/drm/amd/powerplay/hwmgr/functiontables.c   | 14 ++++++------
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c        |  8 +++----
 drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c   |  6 ++---
 .../amd/powerplay/hwmgr/process_pptables_v1_0.c    |  4 ++--
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 26 +++++++++++-----------
 .../gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c   |  2 +-
 7 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c
index 4b14f25..a1dc1c6 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c
@@ -288,7 +288,7 @@ static int cz_init_dynamic_state_adjustment_rule_settings(
 					kzalloc(table_size, GFP_KERNEL);
 
 	if (NULL == table_clk_vlt) {
-		printk(KERN_ERR "[ powerplay ] Can not allocate memory!\n");
+		cgs_err(hwmgr->device, "Can not allocate memory!\n");
 		return -ENOMEM;
 	}
 
@@ -329,12 +329,12 @@ static int cz_get_system_info_data(struct pp_hwmgr *hwmgr)
 			&size, &frev, &crev);
 
 	if (crev != 9) {
-		printk(KERN_ERR "[ powerplay ] Unsupported IGP table: %d %d\n", frev, crev);
+		cgs_err(hwmgr->device, "Unsupported IGP table: %d %d\n", frev, crev);
 		return -EINVAL;
 	}
 
 	if (info == NULL) {
-		printk(KERN_ERR "[ powerplay ] Could not retrieve the Integrated System Info Table!\n");
+		cgs_err(hwmgr->device, "Could not retrieve the Integrated System Info Table!\n");
 		return -EINVAL;
 	}
 
@@ -361,7 +361,7 @@ static int cz_get_system_info_data(struct pp_hwmgr *hwmgr)
 
 	if (cz_hwmgr->sys_info.htc_tmp_lmt <=
 			cz_hwmgr->sys_info.htc_hyst_lmt) {
-		printk(KERN_ERR "[ powerplay ] The htcTmpLmt should be larger than htcHystLmt.\n");
+		cgs_err(hwmgr->device, "The htcTmpLmt should be larger than htcHystLmt.\n");
 		return -EINVAL;
 	}
 
@@ -723,7 +723,7 @@ static int cz_tf_update_sclk_limit(struct pp_hwmgr *hwmgr,
 
 	clock = hwmgr->display_config.min_core_set_clock;
 	if (clock == 0)
-		printk(KERN_INFO "[ powerplay ] min_core_set_clock not set\n");
+		cgs_info(hwmgr->device, "min_core_set_clock not set\n");
 
 	if (cz_hwmgr->sclk_dpm.hard_min_clk != clock) {
 		cz_hwmgr->sclk_dpm.hard_min_clk = clock;
@@ -1162,13 +1162,13 @@ static int cz_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
 
 	result = cz_initialize_dpm_defaults(hwmgr);
 	if (result != 0) {
-		printk(KERN_ERR "[ powerplay ] cz_initialize_dpm_defaults failed\n");
+		cgs_err(hwmgr->device, "cz_initialize_dpm_defaults failed\n");
 		return result;
 	}
 
 	result = cz_get_system_info_data(hwmgr);
 	if (result != 0) {
-		printk(KERN_ERR "[ powerplay ] cz_get_system_info_data failed\n");
+		cgs_err(hwmgr->device, "cz_get_system_info_data failed\n");
 		return result;
 	}
 
@@ -1177,40 +1177,40 @@ static int cz_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
 	result = phm_construct_table(hwmgr, &cz_setup_asic_master,
 				&(hwmgr->setup_asic));
 	if (result != 0) {
-		printk(KERN_ERR "[ powerplay ] Fail to construct setup ASIC\n");
+		cgs_err(hwmgr->device, "Fail to construct setup ASIC\n");
 		return result;
 	}
 
 	result = phm_construct_table(hwmgr, &cz_power_down_asic_master,
 				&(hwmgr->power_down_asic));
 	if (result != 0) {
-		printk(KERN_ERR "[ powerplay ] Fail to construct power down ASIC\n");
+		cgs_err(hwmgr->device, "Fail to construct power down ASIC\n");
 		return result;
 	}
 
 	result = phm_construct_table(hwmgr, &cz_disable_dpm_master,
 				&(hwmgr->disable_dynamic_state_management));
 	if (result != 0) {
-		printk(KERN_ERR "[ powerplay ] Fail to disable_dynamic_state\n");
+		cgs_err(hwmgr->device, "Fail to disable_dynamic_state\n");
 		return result;
 	}
 	result = phm_construct_table(hwmgr, &cz_enable_dpm_master,
 				&(hwmgr->enable_dynamic_state_management));
 	if (result != 0) {
-		printk(KERN_ERR "[ powerplay ] Fail to enable_dynamic_state\n");
+		cgs_err(hwmgr->device, "Fail to enable_dynamic_state\n");
 		return result;
 	}
 	result = phm_construct_table(hwmgr, &cz_set_power_state_master,
 				&(hwmgr->set_power_state));
 	if (result != 0) {
-		printk(KERN_ERR "[ powerplay ] Fail to construct set_power_state\n");
+		cgs_err(hwmgr->device, "Fail to construct set_power_state\n");
 		return result;
 	}
 	hwmgr->platform_descriptor.hardwareActivityPerformanceLevels =  CZ_MAX_HARDWARE_POWERLEVELS;
 
 	result = phm_construct_table(hwmgr, &cz_phm_enable_clock_power_gatings_master, &(hwmgr->enable_clock_power_gatings));
 	if (result != 0) {
-		printk(KERN_ERR "[ powerplay ] Fail to construct enable_clock_power_gatings\n");
+		cgs_err(hwmgr->device, "Fail to construct enable_clock_power_gatings\n");
 		return result;
 	}
 	return result;
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/functiontables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/functiontables.c
index a6abe81..ab751a9 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/functiontables.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/functiontables.c
@@ -35,7 +35,7 @@ static int phm_run_table(struct pp_hwmgr *hwmgr,
 	phm_table_function *function;
 
 	if (rt_table->function_list == NULL) {
-		printk(KERN_INFO "[ powerplay ] this function not implement!\n");
+		cgs_info(hwmgr->device, "this function not implement!\n");
 		return 0;
 	}
 
@@ -63,14 +63,14 @@ int phm_dispatch_table(struct pp_hwmgr *hwmgr,
 	void *temp_storage;
 
 	if (hwmgr == NULL || rt_table == NULL) {
-		printk(KERN_ERR "[ powerplay ] Invalid Parameter!\n");
+		cgs_err(hwmgr->device, "Invalid Parameter!\n");
 		return -EINVAL;
 	}
 
 	if (0 != rt_table->storage_size) {
 		temp_storage = kzalloc(rt_table->storage_size, GFP_KERNEL);
 		if (temp_storage == NULL) {
-			printk(KERN_ERR "[ powerplay ] Could not allocate table temporary storage\n");
+			cgs_err(hwmgr->device, "Could not allocate table temporary storage\n");
 			return -ENOMEM;
 		}
 	} else {
@@ -95,7 +95,7 @@ int phm_construct_table(struct pp_hwmgr *hwmgr,
 	phm_table_function *rtf;
 
 	if (hwmgr == NULL || master_table == NULL || rt_table == NULL) {
-		printk(KERN_ERR "[ powerplay ] Invalid Parameter!\n");
+		cgs_err(hwmgr->device, "Invalid Parameter!\n");
 		return -EINVAL;
 	}
 
@@ -116,7 +116,7 @@ int phm_construct_table(struct pp_hwmgr *hwmgr,
 	for (table_item = master_table->master_list;
 		NULL != table_item->tableFunction; table_item++) {
 		if ((rtf - run_time_list) > function_count) {
-			printk(KERN_ERR "[ powerplay ] Check function results have changed\n");
+			cgs_err(hwmgr->device, "Check function results have changed\n");
 			kfree(run_time_list);
 			return -EINVAL;
 		}
@@ -128,7 +128,7 @@ int phm_construct_table(struct pp_hwmgr *hwmgr,
 	}
 
 	if ((rtf - run_time_list) > function_count) {
-		printk(KERN_ERR "[ powerplay ] Check function results have changed\n");
+		cgs_err(hwmgr->device, "Check function results have changed\n");
 		kfree(run_time_list);
 		return -EINVAL;
 	}
@@ -144,7 +144,7 @@ int phm_destroy_table(struct pp_hwmgr *hwmgr,
 		      struct phm_runtime_table_header *rt_table)
 {
 	if (hwmgr == NULL || rt_table == NULL) {
-		printk(KERN_ERR "[ powerplay ] Invalid Parameter\n");
+		cgs_err(hwmgr->device,  "Invalid Parameter\n");
 		return -EINVAL;
 	}
 
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
index dc6700a..4a7d846 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
@@ -196,7 +196,7 @@ int phm_wait_on_register(struct pp_hwmgr *hwmgr, uint32_t index,
 	uint32_t cur_value;
 
 	if (hwmgr == NULL || hwmgr->device == NULL) {
-		printk(KERN_ERR "[ powerplay ] Invalid Hardware Manager!");
+		cgs_err(hwmgr->device, "Invalid Hardware Manager!");
 		return -EINVAL;
 	}
 
@@ -226,7 +226,7 @@ void phm_wait_on_indirect_register(struct pp_hwmgr *hwmgr,
 				uint32_t mask)
 {
 	if (hwmgr == NULL || hwmgr->device == NULL) {
-		printk(KERN_ERR "[ powerplay ] Invalid Hardware Manager!");
+		cgs_err(hwmgr->device, "Invalid Hardware Manager!");
 		return;
 	}
 
@@ -548,7 +548,7 @@ int phm_initializa_dynamic_state_adjustment_rule_settings(struct pp_hwmgr *hwmgr
 	table_clk_vlt = kzalloc(table_size, GFP_KERNEL);
 
 	if (NULL == table_clk_vlt) {
-		printk(KERN_ERR "[ powerplay ] Can not allocate space for vddc_dep_on_dal_pwrl! \n");
+		cgs_err(hwmgr->device, "Can not allocate space for vddc_dep_on_dal_pwrl! \n");
 		return -ENOMEM;
 	} else {
 		table_clk_vlt->count = 4;
@@ -624,7 +624,7 @@ void phm_apply_dal_min_voltage_request(struct pp_hwmgr *hwmgr)
 			return;
 		}
 	}
-	printk(KERN_ERR "DAL requested level can not"
+	cgs_err(hwmgr->device, "DAL requested level can not"
 			" found a available voltage in VDDC DPM Table \n");
 }
 
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
index ddaea1d..c88c892 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
@@ -146,10 +146,10 @@ int atomctrl_initialize_mc_reg_table(
 				GetIndexIntoMasterTable(DATA, VRAM_Info), &size, &frev, &crev);
 
 	if (module_index >= vram_info->ucNumOfVRAMModule) {
-		printk(KERN_ERR "[ powerplay ] Invalid VramInfo table.");
+		cgs_err(hwmgr->device, "Invalid VramInfo table.");
 		result = -1;
 	} else if (vram_info->sHeader.ucTableFormatRevision < 2) {
-		printk(KERN_ERR "[ powerplay ] Invalid VramInfo table.");
+		cgs_err(hwmgr->device, "Invalid VramInfo table.");
 		result = -1;
 	}
 
@@ -689,7 +689,7 @@ int atomctrl_calculate_voltage_evv_on_sclk(
 		fDerateTDP = GetScaledFraction(le32_to_cpu(getASICProfilingInfo->ulTdpDerateDPM7), 1000);
 		break;
 	default:
-		printk(KERN_ERR "DPM Level not supported\n");
+		cgs_err(hwmgr->device, "DPM Level not supported\n");
 		fPowerDPMx = Convert_ULONG_ToFraction(1);
 		fDerateTDP = GetScaledFraction(le32_to_cpu(getASICProfilingInfo->ulTdpDerateDPM0), 1000);
 	}
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c b/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c
index 7925185..94666ce 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c
@@ -536,7 +536,7 @@ static int get_pcie_table(
 		if ((uint32_t)atom_pcie_table->ucNumEntries <= pcie_count)
 			pcie_count = (uint32_t)atom_pcie_table->ucNumEntries;
 		else
-			printk(KERN_ERR "[ powerplay ] Number of Pcie Entries exceed the number of SCLK Dpm Levels! \
+			cgs_err(hwmgr->device, "Number of Pcie Entries exceed the number of SCLK Dpm Levels! \
 			Disregarding the excess entries... \n");
 
 		pcie_table->count = pcie_count;
@@ -578,7 +578,7 @@ static int get_pcie_table(
 		if ((uint32_t)atom_pcie_table->ucNumEntries <= pcie_count)
 			pcie_count = (uint32_t)atom_pcie_table->ucNumEntries;
 		else
-			printk(KERN_ERR "[ powerplay ] Number of Pcie Entries exceed the number of SCLK Dpm Levels! \
+			cgs_err(hwmgr->device, "Number of Pcie Entries exceed the number of SCLK Dpm Levels! \
 			Disregarding the excess entries... \n");
 
 		pcie_table->count = pcie_count;
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
index 6583870..d0861cd 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
@@ -994,7 +994,7 @@ static int smu7_start_dpm(struct pp_hwmgr *hwmgr)
 			SWRST_COMMAND_1, RESETLC, 0x0);
 
 	if (smu7_enable_sclk_mclk_dpm(hwmgr)) {
-		printk(KERN_ERR "Failed to enable Sclk DPM and Mclk DPM!");
+		cgs_err(hwmgr->device, "Failed to enable Sclk DPM and Mclk DPM!\n");
 		return -EINVAL;
 	}
 
@@ -1079,7 +1079,7 @@ static void smu7_set_dpm_event_sources(struct pp_hwmgr *hwmgr, uint32_t sources)
 
 	switch (sources) {
 	default:
-		printk(KERN_ERR "Unknown throttling event sources.");
+		cgs_err(hwmgr->device, "Unknown throttling event sources.");
 		/* fall through */
 	case 0:
 		protection = false;
@@ -1501,7 +1501,7 @@ static int smu7_get_evv_voltages(struct pp_hwmgr *hwmgr)
 						data->vddcgfx_leakage.count++;
 					}
 				} else {
-					printk("Error retrieving EVV voltage value!\n");
+					cgs_info(hwmgr->device, "Error retrieving EVV voltage value!\n");
 				}
 			}
 		} else {
@@ -1529,7 +1529,7 @@ static int smu7_get_evv_voltages(struct pp_hwmgr *hwmgr)
 					if (vddc >= 2000 || vddc == 0)
 						return -EINVAL;
 				} else {
-					printk(KERN_WARNING "failed to retrieving EVV voltage!\n");
+					cgs_warn(hwmgr->device, "failed to retrieving EVV voltage!\n");
 					continue;
 				}
 
@@ -1569,7 +1569,7 @@ static void smu7_patch_ppt_v1_with_vdd_leakage(struct pp_hwmgr *hwmgr,
 	}
 
 	if (*voltage > ATOM_VIRTUAL_VOLTAGE_ID0)
-		printk(KERN_ERR "Voltage value looks like a Leakage ID but it's not patched \n");
+		cgs_err(hwmgr->device, "Voltage value looks like a Leakage ID but it's not patched \n");
 }
 
 /**
@@ -2034,7 +2034,7 @@ static void smu7_patch_ppt_v0_with_vdd_leakage(struct pp_hwmgr *hwmgr,
 	}
 
 	if (*voltage > ATOM_VIRTUAL_VOLTAGE_ID0)
-		printk(KERN_ERR "Voltage value looks like a Leakage ID but it's not patched \n");
+		cgs_err(hwmgr->device, "Voltage value looks like a Leakage ID but it's not patched \n");
 }
 
 
@@ -2287,7 +2287,7 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr)
 	result = smu7_get_evv_voltages(hwmgr);
 
 	if (result) {
-		printk("Get EVV Voltage Failed.  Abort Driver loading!\n");
+		cgs_info(hwmgr->device, "Get EVV Voltage Failed.  Abort Driver loading!\n");
 		return -EINVAL;
 	}
 
@@ -2900,11 +2900,11 @@ static int smu7_get_pp_table_entry_v1(struct pp_hwmgr *hwmgr,
 	if (dep_mclk_table != NULL && dep_mclk_table->count == 1) {
 		if (dep_mclk_table->entries[0].clk !=
 				data->vbios_boot_state.mclk_bootup_value)
-			printk(KERN_ERR "Single MCLK entry VDDCI/MCLK dependency table "
+			cgs_err(hwmgr->device, "Single MCLK entry VDDCI/MCLK dependency table "
 					"does not match VBIOS boot MCLK level");
 		if (dep_mclk_table->entries[0].vddci !=
 				data->vbios_boot_state.vddci_bootup_value)
-			printk(KERN_ERR "Single VDDCI entry VDDCI/MCLK dependency table "
+			cgs_err(hwmgr->device, "Single VDDCI entry VDDCI/MCLK dependency table "
 					"does not match VBIOS boot VDDCI level");
 	}
 
@@ -3048,11 +3048,11 @@ static int smu7_get_pp_table_entry_v0(struct pp_hwmgr *hwmgr,
 	if (dep_mclk_table != NULL && dep_mclk_table->count == 1) {
 		if (dep_mclk_table->entries[0].clk !=
 				data->vbios_boot_state.mclk_bootup_value)
-			printk(KERN_ERR "Single MCLK entry VDDCI/MCLK dependency table "
+			cgs_err(hwmgr->device, "Single MCLK entry VDDCI/MCLK dependency table "
 					"does not match VBIOS boot MCLK level");
 		if (dep_mclk_table->entries[0].v !=
 				data->vbios_boot_state.vddci_bootup_value)
-			printk(KERN_ERR "Single VDDCI entry VDDCI/MCLK dependency table "
+			cgs_err(hwmgr->device, "Single VDDCI entry VDDCI/MCLK dependency table "
 					"does not match VBIOS boot VDDCI level");
 	}
 
@@ -3592,9 +3592,9 @@ static int smu7_notify_link_speed_change_after_state_change(
 
 		if (acpi_pcie_perf_request(hwmgr->device, request, false)) {
 			if (PP_PCIEGen2 == target_link_speed)
-				printk("PSPP request to switch to Gen2 from Gen3 Failed!");
+				cgs_info(hwmgr->device, "PSPP request to switch to Gen2 from Gen3 Failed!");
 			else
-				printk("PSPP request to switch to Gen1 from Gen2 Failed!");
+				cgs_info(hwmgr->device, "PSPP request to switch to Gen1 from Gen2 Failed!");
 		}
 	}
 
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c
index 26477f0..5b41270 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c
@@ -651,7 +651,7 @@ int smu7_enable_power_containment(struct pp_hwmgr *hwmgr)
 						POWERCONTAINMENT_FEATURE_PkgPwrLimit;
 
 				if (smu7_set_power_limit(hwmgr, default_limit))
-					printk(KERN_ERR "Failed to set Default Power Limit in SMC!");
+					cgs_err(hwmgr->device, "Failed to set Default Power Limit in SMC!");
 			}
 		}
 	}
-- 
2.7.4

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

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

* Re: [PATCH 0/4] drm/amd/powerplay: introduce the cgs print helpers
       [not found] ` <1481174591-2187-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>
                     ` (3 preceding siblings ...)
  2016-12-08  5:23   ` [PATCH 4/4] drm/amd/powerplay: update printk to cgs debug prints for hwmgr Huang Rui
@ 2016-12-08  8:41   ` Christian König
       [not found]     ` <9672b4c9-a905-8fef-9fa4-cd0cbe94a67b-5C7GfCeVMHo@public.gmane.org>
  4 siblings, 1 reply; 13+ messages in thread
From: Christian König @ 2016-12-08  8:41 UTC (permalink / raw)
  To: Huang Rui, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Alex Deucher
  Cc: Arindam Nath

Sorry, but that just sounds like OS abstraction code which isn't allowed.

There is no benefit except routing all messages through CGS which makes 
things much harder to follow.

Regards,
Christian.

Am 08.12.2016 um 06:23 schrieb Huang Rui:
> From: Huang Rui <Ray.Huang@amd.com>
>
> Hi all,
>
> These patch set adds the helpers of print in CGS. Powerplay will be
> used them instead of raw printk, and we can dynamic change the debug
> level with it.
>
> The prefix is like below:
>
> [  310.200991] amdgpu 0000:01:00.0: [powerplay] ...
>
> Thanks,
> Rui
>
> Huang Rui (4):
>    drm/amdgpu: introduce the cgs print helpers
>    drm/amd/powerplay: update printk to cgs debug prints for smumgr
>    drm/amd/powerplay: update printk to cgs debug prints for common part
>    drm/amd/powerplay: update printk to cgs debug prints for hwmgr
>
>   drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c            | 26 +++++++++++-
>   drivers/gpu/drm/amd/include/cgs_common.h           | 24 +++++++++++
>   drivers/gpu/drm/amd/powerplay/amd_powerplay.c      | 49 +++++++++++-----------
>   drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c |  2 +-
>   drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     | 26 ++++++------
>   .../gpu/drm/amd/powerplay/hwmgr/functiontables.c   | 14 +++----
>   drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c        |  8 ++--
>   drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c   |  6 +--
>   .../amd/powerplay/hwmgr/process_pptables_v1_0.c    |  4 +-
>   drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 26 ++++++------
>   .../gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c   |  2 +-
>   drivers/gpu/drm/amd/powerplay/inc/pp_debug.h       | 14 +++----
>   drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c   | 28 ++++++-------
>   drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c    |  4 +-
>   drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c |  8 ++--
>   drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c | 16 +++----
>   .../gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c  |  2 +-
>   .../gpu/drm/amd/powerplay/smumgr/polaris10_smc.c   |  4 +-
>   .../drm/amd/powerplay/smumgr/polaris10_smumgr.c    |  8 ++--
>   drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c | 16 +++----
>   drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c   | 14 +++----
>   .../gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c    |  2 +-
>   22 files changed, 176 insertions(+), 127 deletions(-)
>

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

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

* Re: [PATCH 0/4] drm/amd/powerplay: introduce the cgs print helpers
       [not found]     ` <9672b4c9-a905-8fef-9fa4-cd0cbe94a67b-5C7GfCeVMHo@public.gmane.org>
@ 2016-12-08  9:02       ` Huang Rui
  2016-12-08  9:27         ` Christian König
  0 siblings, 1 reply; 13+ messages in thread
From: Huang Rui @ 2016-12-08  9:02 UTC (permalink / raw)
  To: Koenig, Christian
  Cc: Deucher, Alexander, Nath, Arindam,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org

On Thu, Dec 08, 2016 at 04:41:04PM +0800, Koenig, Christian wrote:
> Sorry, but that just sounds like OS abstraction code which isn't allowed.
> 
> There is no benefit except routing all messages through CGS which makes 
> things much harder to follow.
> 

There isn't COS part at current driver. But it seems to be not good to
introduce COS just for prints. Actually, most of drivers prefer to use
dev_* prints, and it's able to dynamic control the print level when we
debug it.

Thanks,
Ray

> Regards,
> Christian.
> 
> Am 08.12.2016 um 06:23 schrieb Huang Rui:
> > From: Huang Rui <Ray.Huang@amd.com>
> >
> > Hi all,
> >
> > These patch set adds the helpers of print in CGS. Powerplay will be
> > used them instead of raw printk, and we can dynamic change the debug
> > level with it.
> >
> > The prefix is like below:
> >
> > [  310.200991] amdgpu 0000:01:00.0: [powerplay] ...
> >
> > Thanks,
> > Rui
> >
> > Huang Rui (4):
> >    drm/amdgpu: introduce the cgs print helpers
> >    drm/amd/powerplay: update printk to cgs debug prints for smumgr
> >    drm/amd/powerplay: update printk to cgs debug prints for common part
> >    drm/amd/powerplay: update printk to cgs debug prints for hwmgr
> >
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c            | 26 +++++++++++-
> >   drivers/gpu/drm/amd/include/cgs_common.h           | 24 +++++++++++
> >   drivers/gpu/drm/amd/powerplay/amd_powerplay.c      | 49 +++++++++++-----------
> >   drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c |  2 +-
> >   drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     | 26 ++++++------
> >   .../gpu/drm/amd/powerplay/hwmgr/functiontables.c   | 14 +++----
> >   drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c        |  8 ++--
> >   drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c   |  6 +--
> >   .../amd/powerplay/hwmgr/process_pptables_v1_0.c    |  4 +-
> >   drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 26 ++++++------
> >   .../gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c   |  2 +-
> >   drivers/gpu/drm/amd/powerplay/inc/pp_debug.h       | 14 +++----
> >   drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c   | 28 ++++++-------
> >   drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c    |  4 +-
> >   drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c |  8 ++--
> >   drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c | 16 +++----
> >   .../gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c  |  2 +-
> >   .../gpu/drm/amd/powerplay/smumgr/polaris10_smc.c   |  4 +-
> >   .../drm/amd/powerplay/smumgr/polaris10_smumgr.c    |  8 ++--
> >   drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c | 16 +++----
> >   drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c   | 14 +++----
> >   .../gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c    |  2 +-
> >   22 files changed, 176 insertions(+), 127 deletions(-)
> >
> 
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH 0/4] drm/amd/powerplay: introduce the cgs print helpers
  2016-12-08  9:02       ` Huang Rui
@ 2016-12-08  9:27         ` Christian König
       [not found]           ` <752e5cbf-0bcb-d42f-8542-6f7a788d9299-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Christian König @ 2016-12-08  9:27 UTC (permalink / raw)
  To: Huang Rui, Koenig, Christian
  Cc: Deucher, Alexander, Nath, Arindam,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org

Am 08.12.2016 um 10:02 schrieb Huang Rui:
> On Thu, Dec 08, 2016 at 04:41:04PM +0800, Koenig, Christian wrote:
>> Sorry, but that just sounds like OS abstraction code which isn't allowed.
>>
>> There is no benefit except routing all messages through CGS which makes
>> things much harder to follow.
>>
> There isn't COS part at current driver. But it seems to be not good to
> introduce COS just for prints. Actually, most of drivers prefer to use
> dev_* prints, and it's able to dynamic control the print level when we
> debug it.

Well I'm not sure if you have understood what I wanted to say.

The reason that there isn't any COS abstraction is that it isn't allowed 
upstream.

Using the dev_* prints in the powerplay code is fine, but don't use the 
CGS or any other abstraction layer for them.

So a clear NAK on those patches from my side.

Regards,
Christian.

>
> Thanks,
> Ray
>
>> Regards,
>> Christian.
>>
>> Am 08.12.2016 um 06:23 schrieb Huang Rui:
>>> From: Huang Rui <Ray.Huang@amd.com>
>>>
>>> Hi all,
>>>
>>> These patch set adds the helpers of print in CGS. Powerplay will be
>>> used them instead of raw printk, and we can dynamic change the debug
>>> level with it.
>>>
>>> The prefix is like below:
>>>
>>> [  310.200991] amdgpu 0000:01:00.0: [powerplay] ...
>>>
>>> Thanks,
>>> Rui
>>>
>>> Huang Rui (4):
>>>     drm/amdgpu: introduce the cgs print helpers
>>>     drm/amd/powerplay: update printk to cgs debug prints for smumgr
>>>     drm/amd/powerplay: update printk to cgs debug prints for common part
>>>     drm/amd/powerplay: update printk to cgs debug prints for hwmgr
>>>
>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c            | 26 +++++++++++-
>>>    drivers/gpu/drm/amd/include/cgs_common.h           | 24 +++++++++++
>>>    drivers/gpu/drm/amd/powerplay/amd_powerplay.c      | 49 +++++++++++-----------
>>>    drivers/gpu/drm/amd/powerplay/eventmgr/eventinit.c |  2 +-
>>>    drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     | 26 ++++++------
>>>    .../gpu/drm/amd/powerplay/hwmgr/functiontables.c   | 14 +++----
>>>    drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c        |  8 ++--
>>>    drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c   |  6 +--
>>>    .../amd/powerplay/hwmgr/process_pptables_v1_0.c    |  4 +-
>>>    drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 26 ++++++------
>>>    .../gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c   |  2 +-
>>>    drivers/gpu/drm/amd/powerplay/inc/pp_debug.h       | 14 +++----
>>>    drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c   | 28 ++++++-------
>>>    drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c    |  4 +-
>>>    drivers/gpu/drm/amd/powerplay/smumgr/fiji_smumgr.c |  8 ++--
>>>    drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c | 16 +++----
>>>    .../gpu/drm/amd/powerplay/smumgr/iceland_smumgr.c  |  2 +-
>>>    .../gpu/drm/amd/powerplay/smumgr/polaris10_smc.c   |  4 +-
>>>    .../drm/amd/powerplay/smumgr/polaris10_smumgr.c    |  8 ++--
>>>    drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c | 16 +++----
>>>    drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c   | 14 +++----
>>>    .../gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c    |  2 +-
>>>    22 files changed, 176 insertions(+), 127 deletions(-)
>>>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


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

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

* Re: [PATCH 0/4] drm/amd/powerplay: introduce the cgs print helpers
       [not found]           ` <752e5cbf-0bcb-d42f-8542-6f7a788d9299-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
@ 2016-12-08  9:50             ` Huang Rui
  2016-12-08 13:04               ` Grazvydas Ignotas
  0 siblings, 1 reply; 13+ messages in thread
From: Huang Rui @ 2016-12-08  9:50 UTC (permalink / raw)
  To: Christian König
  Cc: Deucher, Alexander, Nath, Arindam, Koenig, Christian,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org

On Thu, Dec 08, 2016 at 05:27:30PM +0800, Christian König wrote:
> Am 08.12.2016 um 10:02 schrieb Huang Rui:
> > On Thu, Dec 08, 2016 at 04:41:04PM +0800, Koenig, Christian wrote:
> >> Sorry, but that just sounds like OS abstraction code which isn't allowed.
> >>
> >> There is no benefit except routing all messages through CGS which makes
> >> things much harder to follow.
> >>
> > There isn't COS part at current driver. But it seems to be not good to
> > introduce COS just for prints. Actually, most of drivers prefer to use
> > dev_* prints, and it's able to dynamic control the print level when we
> > debug it.
> 
> Well I'm not sure if you have understood what I wanted to say.
> 
> The reason that there isn't any COS abstraction is that it isn't allowed 
> upstream.
> 

OK, I see.

> Using the dev_* prints in the powerplay code is fine, but don't use the 
> CGS or any other abstraction layer for them.
> 

Powerplay is quite independent component without amdgpu object, it is
hard to use dev_* prints without any abstraction layer.

Anyway, it's small update, I'm fine to drop it.

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

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

* Re: [PATCH 0/4] drm/amd/powerplay: introduce the cgs print helpers
  2016-12-08  9:50             ` Huang Rui
@ 2016-12-08 13:04               ` Grazvydas Ignotas
       [not found]                 ` <CANOLnOOqGWKw5XdR-d=3GRrqWQ45KT_NJymWQW39kb0RtfK5Qw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Grazvydas Ignotas @ 2016-12-08 13:04 UTC (permalink / raw)
  To: Huang Rui
  Cc: Deucher, Alexander, Nath, Arindam, Christian König,
	Koenig, Christian,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org

On Thu, Dec 8, 2016 at 11:50 AM, Huang Rui <ray.huang@amd.com> wrote:
> On Thu, Dec 08, 2016 at 05:27:30PM +0800, Christian König wrote:
>> Am 08.12.2016 um 10:02 schrieb Huang Rui:
>> > On Thu, Dec 08, 2016 at 04:41:04PM +0800, Koenig, Christian wrote:
>> >> Sorry, but that just sounds like OS abstraction code which isn't allowed.
>> >>
>> >> There is no benefit except routing all messages through CGS which makes
>> >> things much harder to follow.
>> >>
>> > There isn't COS part at current driver. But it seems to be not good to
>> > introduce COS just for prints. Actually, most of drivers prefer to use
>> > dev_* prints, and it's able to dynamic control the print level when we
>> > debug it.
>>
>> Well I'm not sure if you have understood what I wanted to say.
>>
>> The reason that there isn't any COS abstraction is that it isn't allowed
>> upstream.
>>
>
> OK, I see.
>
>> Using the dev_* prints in the powerplay code is fine, but don't use the
>> CGS or any other abstraction layer for them.
>>
>
> Powerplay is quite independent component without amdgpu object, it is
> hard to use dev_* prints without any abstraction layer.

Maybe you could use dev_set_name() with something powerplay related on
relevant devices and then dev_* will print what you want?

Alternatively you could do

#define pr_fmt(fmt) "[powerplay] " fmt

before #include <linux/...> and then all pr_* functions will prefix
their messages.

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

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

* Re: [PATCH 0/4] drm/amd/powerplay: introduce the cgs print helpers
       [not found]                 ` <CANOLnOOqGWKw5XdR-d=3GRrqWQ45KT_NJymWQW39kb0RtfK5Qw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2016-12-09  2:29                   ` Huang Rui
  2016-12-22 10:52                   ` Huang Rui
  1 sibling, 0 replies; 13+ messages in thread
From: Huang Rui @ 2016-12-09  2:29 UTC (permalink / raw)
  To: Grazvydas Ignotas
  Cc: Deucher, Alexander, Nath, Arindam, Christian König,
	Koenig, Christian,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org

On Thu, Dec 08, 2016 at 09:04:13PM +0800, Grazvydas Ignotas wrote:
> On Thu, Dec 8, 2016 at 11:50 AM, Huang Rui <ray.huang@amd.com> wrote:
> > On Thu, Dec 08, 2016 at 05:27:30PM +0800, Christian König wrote:
> >> Am 08.12.2016 um 10:02 schrieb Huang Rui:
> >> > On Thu, Dec 08, 2016 at 04:41:04PM +0800, Koenig, Christian wrote:
> >> >> Sorry, but that just sounds like OS abstraction code which isn't allowed.
> >> >>
> >> >> There is no benefit except routing all messages through CGS which makes
> >> >> things much harder to follow.
> >> >>
> >> > There isn't COS part at current driver. But it seems to be not good to
> >> > introduce COS just for prints. Actually, most of drivers prefer to use
> >> > dev_* prints, and it's able to dynamic control the print level when we
> >> > debug it.
> >>
> >> Well I'm not sure if you have understood what I wanted to say.
> >>
> >> The reason that there isn't any COS abstraction is that it isn't allowed
> >> upstream.
> >>
> >
> > OK, I see.
> >
> >> Using the dev_* prints in the powerplay code is fine, but don't use the
> >> CGS or any other abstraction layer for them.
> >>
> >
> > Powerplay is quite independent component without amdgpu object, it is
> > hard to use dev_* prints without any abstraction layer.
> 
> Maybe you could use dev_set_name() with something powerplay related on
> relevant devices and then dev_* will print what you want?
> 

Garzvydas, thanks to your comments. dev_set_name function needs "struct
device" object in powerplay. But powerplay uses CGS layer to call into
"amdgpu" or "struct device". I think the intention is to make code porting
easier. So we won't bring any OS abstraction code into powerplay.

> Alternatively you could do
> 
> #define pr_fmt(fmt) "[powerplay] " fmt
> 
> before #include <linux/...> and then all pr_* functions will prefix
> their messages.
> 

pr_* actually is almost the same with printk, but it seems fine here to
just add a prefix.

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

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

* Re: [PATCH 0/4] drm/amd/powerplay: introduce the cgs print helpers
       [not found]                 ` <CANOLnOOqGWKw5XdR-d=3GRrqWQ45KT_NJymWQW39kb0RtfK5Qw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2016-12-09  2:29                   ` Huang Rui
@ 2016-12-22 10:52                   ` Huang Rui
  2016-12-23  2:38                     ` Huang Rui
  1 sibling, 1 reply; 13+ messages in thread
From: Huang Rui @ 2016-12-22 10:52 UTC (permalink / raw)
  To: Grazvydas Ignotas
  Cc: Deucher, Alexander, Nath, Arindam, Christian König,
	Koenig, Christian,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org

On Thu, Dec 08, 2016 at 09:04:13PM +0800, Grazvydas Ignotas wrote:
> On Thu, Dec 8, 2016 at 11:50 AM, Huang Rui <ray.huang@amd.com> wrote:
> > On Thu, Dec 08, 2016 at 05:27:30PM +0800, Christian König wrote:
> >> Am 08.12.2016 um 10:02 schrieb Huang Rui:
> >> > On Thu, Dec 08, 2016 at 04:41:04PM +0800, Koenig, Christian wrote:
> >
> >> Using the dev_* prints in the powerplay code is fine, but don't use the
> >> CGS or any other abstraction layer for them.
> >>
> >
> > Powerplay is quite independent component without amdgpu object, it is
> > hard to use dev_* prints without any abstraction layer.
> 
> Maybe you could use dev_set_name() with something powerplay related on
> relevant devices and then dev_* will print what you want?
> 
> Alternatively you could do
> 
> #define pr_fmt(fmt) "[powerplay] " fmt
> 
> before #include <linux/...> and then all pr_* functions will prefix
> their messages.
> 

Hi Grazvydas,

I tried to put that macro before all #include <linux/...>, but complier always get a redefined warnning.

  CC [M]  /home/ray/gpu/BUILD/x86_64/linux/drivers/gpu/drm/amd/amdgpu//../powerplay/amd_powerplay.o
/home/ray/gpu/BUILD/x86_64/linux/drivers/gpu/drm/amd/amdgpu//../powerplay/amd_powerplay.c:24:0: warning: "pr_fmt" redefined
 #define pr_fmt(fmt) "[powerplay] " fmt
 ^
In file included from include/linux/kernel.h:13:0,
                 from include/linux/list.h:8,
                 from include/linux/agp_backend.h:33,
                 from include/drm/drmP.h:35,
                 from <command-line>:0:
include/linux/printk.h:248:0: note: this is the location of the previous definition
 #define pr_fmt(fmt) fmt
 ^

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

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

* Re: [PATCH 0/4] drm/amd/powerplay: introduce the cgs print helpers
  2016-12-22 10:52                   ` Huang Rui
@ 2016-12-23  2:38                     ` Huang Rui
  0 siblings, 0 replies; 13+ messages in thread
From: Huang Rui @ 2016-12-23  2:38 UTC (permalink / raw)
  To: Grazvydas Ignotas
  Cc: Deucher, Alexander, Nath, Arindam, Christian K�nig,
	Koenig, Christian,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org

On Thu, Dec 22, 2016 at 06:52:41PM +0800, Huang Rui wrote:
> On Thu, Dec 08, 2016 at 09:04:13PM +0800, Grazvydas Ignotas wrote:
> > On Thu, Dec 8, 2016 at 11:50 AM, Huang Rui <ray.huang@amd.com> wrote:
> > > On Thu, Dec 08, 2016 at 05:27:30PM +0800, Christian König wrote:
> > >> Am 08.12.2016 um 10:02 schrieb Huang Rui:
> > >> > On Thu, Dec 08, 2016 at 04:41:04PM +0800, Koenig, Christian wrote:
> > >
> > >> Using the dev_* prints in the powerplay code is fine, but don't use the
> > >> CGS or any other abstraction layer for them.
> > >>
> > >
> > > Powerplay is quite independent component without amdgpu object, it is
> > > hard to use dev_* prints without any abstraction layer.
> > 
> > Maybe you could use dev_set_name() with something powerplay related on
> > relevant devices and then dev_* will print what you want?
> > 
> > Alternatively you could do
> > 
> > #define pr_fmt(fmt) "[powerplay] " fmt
> > 
> > before #include <linux/...> and then all pr_* functions will prefix
> > their messages.
> > 
> 
> Hi Grazvydas,
> 
> I tried to put that macro before all #include <linux/...>, but complier always get a redefined warnning.
> 
>   CC [M]  /home/ray/gpu/BUILD/x86_64/linux/drivers/gpu/drm/amd/amdgpu//../powerplay/amd_powerplay.o
> /home/ray/gpu/BUILD/x86_64/linux/drivers/gpu/drm/amd/amdgpu//../powerplay/amd_powerplay.c:24:0: warning: "pr_fmt" redefined
>  #define pr_fmt(fmt) "[powerplay] " fmt
>  ^
> In file included from include/linux/kernel.h:13:0,
>                  from include/linux/list.h:8,
>                  from include/linux/agp_backend.h:33,
>                  from include/drm/drmP.h:35,
>                  from <command-line>:0:
> include/linux/printk.h:248:0: note: this is the location of the previous definition
>  #define pr_fmt(fmt) fmt
>  ^
> 

OK, I already find a way to avoid this warning, thanks.

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

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

end of thread, other threads:[~2016-12-23  2:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-08  5:23 [PATCH 0/4] drm/amd/powerplay: introduce the cgs print helpers Huang Rui
     [not found] ` <1481174591-2187-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>
2016-12-08  5:23   ` [PATCH 1/4] drm/amdgpu: " Huang Rui
2016-12-08  5:23   ` [PATCH 2/4] drm/amd/powerplay: update printk to cgs debug prints for smumgr Huang Rui
2016-12-08  5:23   ` [PATCH 3/4] drm/amd/powerplay: update printk to cgs debug prints for common part Huang Rui
2016-12-08  5:23   ` [PATCH 4/4] drm/amd/powerplay: update printk to cgs debug prints for hwmgr Huang Rui
2016-12-08  8:41   ` [PATCH 0/4] drm/amd/powerplay: introduce the cgs print helpers Christian König
     [not found]     ` <9672b4c9-a905-8fef-9fa4-cd0cbe94a67b-5C7GfCeVMHo@public.gmane.org>
2016-12-08  9:02       ` Huang Rui
2016-12-08  9:27         ` Christian König
     [not found]           ` <752e5cbf-0bcb-d42f-8542-6f7a788d9299-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-12-08  9:50             ` Huang Rui
2016-12-08 13:04               ` Grazvydas Ignotas
     [not found]                 ` <CANOLnOOqGWKw5XdR-d=3GRrqWQ45KT_NJymWQW39kb0RtfK5Qw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-12-09  2:29                   ` Huang Rui
2016-12-22 10:52                   ` Huang Rui
2016-12-23  2:38                     ` Huang Rui

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.