AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher@gmail.com>
To: amd-gfx@lists.freedesktop.org
Cc: Alex Deucher <alexander.deucher@amd.com>,
	Likun Gao <Likun.Gao@amd.com>,
	Kenneth Feng <kenneth.feng@amd.com>
Subject: [PATCH 037/207] drm/amd/powerplay: support pcie value set and update for sienna_cichlid
Date: Mon,  1 Jun 2020 13:59:49 -0400	[thread overview]
Message-ID: <20200601180239.1267430-34-alexander.deucher@amd.com> (raw)
In-Reply-To: <20200601180239.1267430-1-alexander.deucher@amd.com>

From: Likun Gao <Likun.Gao@amd.com>

Add support to set default pcie parameters for sienna_cichlid.
Add support to update pcie parameters for sienna_cichlid.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 .../drm/amd/powerplay/sienna_cichlid_ppt.c    | 42 +++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c
index 852c364fd7a3..5b4319b0da6c 100644
--- a/drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c
@@ -407,6 +407,7 @@ static int sienna_cichlid_set_default_dpm_table(struct smu_context *smu)
 	struct smu_table_context *table_context = &smu->smu_table;
 	struct smu_11_0_dpm_context *dpm_context = smu_dpm->dpm_context;
 	PPTable_t *driver_ppt = NULL;
+	int i;
 
         driver_ppt = table_context->driver_pptable;
 
@@ -437,6 +438,11 @@ static int sienna_cichlid_set_default_dpm_table(struct smu_context *smu)
         dpm_context->dpm_tables.phy_table.min = driver_ppt->FreqTablePhyclk[0];
         dpm_context->dpm_tables.phy_table.max = driver_ppt->FreqTablePhyclk[NUM_PHYCLK_DPM_LEVELS - 1];
 
+	for (i = 0; i < MAX_PCIE_CONF; i++) {
+		dpm_context->dpm_tables.pcie_table.pcie_gen[i] = driver_ppt->PcieGenSpeed[i];
+		dpm_context->dpm_tables.pcie_table.pcie_lane[i] = driver_ppt->PcieLaneCount[i];
+	}
+
 	return 0;
 }
 
@@ -1430,6 +1436,41 @@ static int sienna_cichlid_get_power_limit(struct smu_context *smu,
 	return 0;
 }
 
+static int sienna_cichlid_update_pcie_parameters(struct smu_context *smu,
+					 uint32_t pcie_gen_cap,
+					 uint32_t pcie_width_cap)
+{
+	PPTable_t *pptable = smu->smu_table.driver_pptable;
+	int ret, i;
+	uint32_t smu_pcie_arg;
+
+	struct smu_dpm_context *smu_dpm = &smu->smu_dpm;
+	struct smu_11_0_dpm_context *dpm_context = smu_dpm->dpm_context;
+
+	for (i = 0; i < NUM_LINK_LEVELS; i++) {
+		smu_pcie_arg = (i << 16) |
+			((pptable->PcieGenSpeed[i] <= pcie_gen_cap) ?
+					(pptable->PcieGenSpeed[i] << 8) :
+					(pcie_gen_cap << 8)) |
+			((pptable->PcieLaneCount[i] <= pcie_width_cap) ?
+					pptable->PcieLaneCount[i] :
+					pcie_width_cap);
+
+		ret = smu_send_smc_msg_with_param(smu,
+						  SMU_MSG_OverridePcieParameters,
+						  smu_pcie_arg, NULL);
+		if (ret)
+			return ret;
+
+		if (pptable->PcieGenSpeed[i] > pcie_gen_cap)
+			dpm_context->dpm_tables.pcie_table.pcie_gen[i] = pcie_gen_cap;
+		if (pptable->PcieLaneCount[i] > pcie_width_cap)
+			dpm_context->dpm_tables.pcie_table.pcie_lane[i] = pcie_width_cap;
+	}
+
+	return 0;
+}
+
 static void sienna_cichlid_dump_pptable(struct smu_context *smu)
 {
 	struct smu_table_context *table_context = &smu->smu_table;
@@ -2134,6 +2175,7 @@ static const struct pptable_funcs sienna_cichlid_ppt_funcs = {
 	.get_thermal_temperature_range = sienna_cichlid_get_thermal_temperature_range,
 	.display_disable_memory_clock_switch = sienna_cichlid_display_disable_memory_clock_switch,
 	.get_power_limit = sienna_cichlid_get_power_limit,
+	.update_pcie_parameters = sienna_cichlid_update_pcie_parameters,
 	.dump_pptable = sienna_cichlid_dump_pptable,
 	.init_microcode = smu_v11_0_init_microcode,
 	.load_microcode = smu_v11_0_load_microcode,
-- 
2.25.4

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

  parent reply	other threads:[~2020-06-01 18:03 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-01 17:59 [PATCH 000/207] Add Support for Sienna Cichlid Alex Deucher
2020-06-01 17:59 ` [PATCH 005/207] drm/amdgpu: add sienna_cichlid asic type Alex Deucher
2020-06-01 17:59 ` [PATCH 006/207] drm/amdgpu: add sienna_cichlid gpu info firmware v2 Alex Deucher
2020-06-01 17:59 ` [PATCH 007/207] drm/amdgpu: set fw load type for sienna_cichlid Alex Deucher
2020-06-01 17:59 ` [PATCH 008/207] drm/amdgpu: set asic family and ip blocks " Alex Deucher
2020-06-01 17:59 ` [PATCH 009/207] drm/amdgpu/gfx10: add support for sienna_cichlid firmware Alex Deucher
2020-06-01 17:59 ` [PATCH 010/207] drm/amdgpu/gmc10: add sienna_cichlid support Alex Deucher
2020-06-01 17:59 ` [PATCH 011/207] drm/amdgpu/gfx10: add clockgating support for sienna_cichlid Alex Deucher
2020-06-01 17:59 ` [PATCH 012/207] drm/amdgpu/soc15: add " Alex Deucher
2020-06-01 17:59 ` [PATCH 013/207] drm/amdgpu: initialize IP offset for sienna_cichlid (v2) Alex Deucher
2020-06-01 17:59 ` [PATCH 014/207] drm/amdgpu/soc15: add common ip block for sienna_cichlid Alex Deucher
2020-06-01 17:59 ` [PATCH 015/207] drm/amdgpu: add support on mmhub " Alex Deucher
2020-06-01 17:59 ` [PATCH 016/207] drm/amdgpu: add support gfxhub for sienna_cichlid (v3) Alex Deucher
2020-06-01 17:59 ` [PATCH 017/207] drm/amdgpu: add gmc ip block for sienna_cichlid Alex Deucher
2020-06-01 17:59 ` [PATCH 018/207] drm/amdgpu: add ih " Alex Deucher
2020-06-01 17:59 ` [PATCH 019/207] drm/amdgpu: add gfx ip block for sienna_cichlid (v3) Alex Deucher
2020-06-01 17:59 ` [PATCH 020/207] drm/amdgpu: add sdma2 and sdma3 irqsrc header files for sienna_cichlid (v2) Alex Deucher
2020-06-01 17:59 ` [PATCH 021/207] drm/amdgpu: add sdma ip block for sienna_cichlid (v5) Alex Deucher
2020-06-01 17:59 ` [PATCH 022/207] drm/amdgpu: correct SDMA3 IH clinet id for sienna_cichlid Alex Deucher
2020-06-01 17:59 ` [PATCH 023/207] drm/amdgpu/gfx10: change register configure " Alex Deucher
2020-06-01 17:59 ` [PATCH 024/207] drm/amdgpu: add virtual display support " Alex Deucher
2020-06-01 17:59 ` [PATCH 025/207] drm/amdgpu/powerplay: add initial swSMU support for sienna_cichlid (v2) Alex Deucher
2020-06-01 17:59 ` [PATCH 026/207] drm/amd/powerplay: add support to set performance level for sienna_cichlid Alex Deucher
2020-06-01 17:59 ` [PATCH 027/207] drm/amd/powerplay: set SOCCLK DPM " Alex Deucher
2020-06-01 17:59 ` [PATCH 028/207] drm/amd/powerplay: set FCLK " Alex Deucher
2020-06-01 17:59 ` [PATCH 029/207] drm/amd/powerplay: enable Ultra Low Voltage " Alex Deucher
2020-06-01 17:59 ` [PATCH 030/207] drm/amd/powerplay: enable Graphics Clock Deep Sleep " Alex Deucher
2020-06-01 17:59 ` [PATCH 031/207] drm/amd/powerplay: enable SOC " Alex Deucher
2020-06-01 17:59 ` [PATCH 032/207] drm/amdgpu/powerplay: set Thermal control " Alex Deucher
2020-06-01 17:59 ` [PATCH 033/207] drm/amdgpu/powerplay: set UCLK DPM " Alex Deucher
2020-06-01 17:59 ` [PATCH 034/207] drm/amd/powerplay: make gfx ds can be configure " Alex Deucher
2020-06-01 17:59 ` [PATCH 035/207] drm/amd/powerplay: Enable SOCCLK ULV " Alex Deucher
2020-06-01 17:59 ` [PATCH 036/207] drm/amd/powerplay: enable DCEFCLK DPM and DS " Alex Deucher
2020-06-01 17:59 ` Alex Deucher [this message]
2020-06-01 17:59 ` [PATCH 038/207] drm/amd/powerplay: support to print pcie levels " Alex Deucher
2020-06-01 17:59 ` [PATCH 039/207] drm/amd/powerplay: enable LCLK DPM " Alex Deucher
2020-06-01 17:59 ` [PATCH 040/207] drm/amd/powerplay: enable GFX SS " Alex Deucher
2020-06-01 17:59 ` [PATCH 041/207] drm/amd/powerplay: enable Fan control " Alex Deucher
2020-06-01 17:59 ` [PATCH 042/207] drm/amd/powerplay: support to get power index " Alex Deucher
2020-06-01 17:59 ` [PATCH 043/207] drm/amd/powerplay: enable PPT and TDC " Alex Deucher
2020-06-01 17:59 ` [PATCH 044/207] drm/amdgpu/powerplay: add smu block " Alex Deucher
2020-06-01 17:59 ` [PATCH 045/207] drm/amdgpu: skip ASD fw load " Alex Deucher
2020-06-01 17:59 ` [PATCH 046/207] drm/amdgpu/psp: add psp support " Alex Deucher
2020-06-01 17:59 ` [PATCH 047/207] drm/amdgpu: skip for reroute ih for sienna_cichlid psp ring init currently Alex Deucher
2020-06-01 18:00 ` [PATCH 048/207] drm/amdgpu: enable psp ip block for sienna_cichlid Alex Deucher
2020-06-01 18:00 ` [PATCH 049/207] drm/amdgpu: update SDMA 5.2 microcode init Alex Deucher
2020-06-01 18:00 ` [PATCH 050/207] drm/amdgpu: Use variable instead of constant for sdma doorbell range Alex Deucher
2020-06-01 18:00 ` [PATCH 051/207] drm/amdgpu: add support for athub v2.1 Alex Deucher
2020-06-01 18:00 ` [PATCH 052/207] drm/amdgpu: add gmc cg support for sienna_cichlid Alex Deucher
2020-06-01 18:00 ` [PATCH 053/207] drm/amdgpu: add psp block load condition " Alex Deucher
2020-06-01 18:00 ` [PATCH 054/207] drm/amdgpu: add 2rd VCN instance doorbell support Alex Deucher
2020-06-01 18:00 ` [PATCH 055/207] drm/amdgpu: assign the doorbell index to mes ring Alex Deucher
2020-06-01 18:00 ` [PATCH 056/207] drm/amdgpu: add the ring type definition of MES Alex Deucher
2020-06-01 18:00 ` [PATCH 057/207] drm/amdgpu: avoid dereferencing a NULL pointer Alex Deucher
2020-06-01 18:00 ` [PATCH 058/207] drm/amdgpu/mes: update some mes definitions Alex Deucher
2020-06-01 18:00 ` [PATCH 059/207] drm/amdgpu/mes10.1: allocate the eop buffer Alex Deucher
2020-06-01 18:00 ` [PATCH 060/207] drm/amdgpu/mes10.1: initialize the software part of mes ring Alex Deucher
2020-06-01 18:00 ` [PATCH 061/207] drm/amdgpu/mes10.1: implement the ring functions of mes specific Alex Deucher
2020-06-02 10:00   ` Christian König
2020-06-02 18:59     ` Alex Deucher
2020-06-01 18:00 ` [PATCH 062/207] drm/amdgpu/mes10.1: allocate mqd buffer Alex Deucher
2020-06-01 18:00 ` [PATCH 063/207] drm/amdgpu/mes10.1: initialize the mqd Alex Deucher
2020-06-01 18:00 ` [PATCH 064/207] drm/amdgpu/mes10.1: install mes queue by register programming Alex Deucher
2020-06-01 18:00 ` [PATCH 065/207] drm/amdgpu/mes10.1: install mes queue via kiq Alex Deucher
2020-06-01 18:00 ` [PATCH 066/207] drm/amdgpu/mes10.1: enable the mes ring during initialization Alex Deucher
2020-06-01 18:00 ` [PATCH 067/207] drm/amdgpu/mes10.1: add the mes fw api Alex Deucher
2020-06-01 18:00 ` [PATCH 068/207] drm/amdgpu/mes10.1: add the helper function for mes command submission Alex Deucher
2020-06-01 18:00 ` [PATCH 069/207] drm/amdgpu/mes10.1: implement adding hardware queue Alex Deucher
2020-06-01 18:00 ` [PATCH 070/207] drm/amdgpu/mes10.1: implement removing " Alex Deucher
2020-06-01 18:00 ` [PATCH 071/207] drm/amdgpu/mes10.1: implement querying the scheduler status Alex Deucher
2020-06-01 18:00 ` [PATCH 072/207] drm/amdgpu/mes10.1: implement setting hardware resources Alex Deucher
2020-06-01 18:00 ` [PATCH 073/207] drm/amdgpu/mes10.1: add sienna_cichlid mes firmware support Alex Deucher
2020-06-01 18:00 ` [PATCH 074/207] drm/amdgpu/mes10.1: copy mes fw info into global fw array Alex Deucher
2020-06-01 18:00 ` [PATCH 075/207] drm/amdgpu: upload mes firmware to gpu buffer Alex Deucher
2020-06-01 18:00 ` [PATCH 076/207] drm/amdgpu/psp: convert amdgpu mes ucode type Alex Deucher
2020-06-01 18:00 ` [PATCH 077/207] drm/amdgpu: no need to set up GPU scheduler for mes ring Alex Deucher
2020-06-02  9:30   ` Christian König
2020-06-02 18:51     ` Alex Deucher
2020-06-01 18:00 ` [PATCH 078/207] drm/amdgpu/mes10.1: update mes initialization Alex Deucher
2020-06-01 18:00 ` [PATCH 079/207] drm/amdgpu: add mes block to sienna_cichlid Alex Deucher
2020-06-01 18:00 ` [PATCH 080/207] drm/amdgpu: update the num of queue per pipe for mec on sienna_cichlid Alex Deucher
2020-06-01 18:00 ` [PATCH 081/207] drm/amdgpu/mes: correct register offset for sienna_cichlid Alex Deucher
2020-06-01 18:00 ` [PATCH 082/207] drm/amdgpu: add VCN3.0 support for Sienna_Cichlid Alex Deucher
2020-06-01 18:00 ` [PATCH 083/207] drm/amdgpu: add Sienna_Cichlid VCN PG and CG support (v2) Alex Deucher
2020-06-01 18:00 ` [PATCH 084/207] drm/amdgpu: enable VCN3.0 PG and CG for Sienna_Cichlid Alex Deucher
2020-06-01 18:00 ` [PATCH 085/207] drm/amdgpu: add Sienna_Cichlid VCN to the VCN family Alex Deucher
2020-06-01 18:00 ` [PATCH 086/207] drm/amdgpu: enable VCN3.0 for Sienna_Cichlid Alex Deucher
2020-06-01 18:00 ` [PATCH 087/207] drm/amdgpu: add JPEG3.0 support " Alex Deucher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200601180239.1267430-34-alexander.deucher@amd.com \
    --to=alexdeucher@gmail.com \
    --cc=Likun.Gao@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=kenneth.feng@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox