amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Lazar, Lijo" <lijo.lazar@amd.com>
To: Alex Deucher <alexander.deucher@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 23/66] drm/amdgpu/amdgpu_smu: convert to IP version checking
Date: Wed, 22 Sep 2021 13:02:40 +0530	[thread overview]
Message-ID: <e82086c7-3740-2140-f23b-773e687aa85d@amd.com> (raw)
In-Reply-To: <20210921180725.1985552-24-alexander.deucher@amd.com>



On 9/21/2021 11:36 PM, Alex Deucher wrote:
> Use IP versions rather than asic_type to differentiate
> IP version specific features.
> 
> v2: rebase
> 
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>   drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 94 +++++++++++++----------
>   1 file changed, 55 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> index 04863a797115..5f372d353d9d 100644
> --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
> @@ -455,7 +455,8 @@ static int smu_get_power_num_states(void *handle,
>   
>   bool is_support_sw_smu(struct amdgpu_device *adev)
>   {
> -	if (adev->asic_type >= CHIP_ARCTURUS)
> +	if ((adev->asic_type >= CHIP_ARCTURUS) ||
> +	    (adev->ip_versions[MP1_HWIP] >= IP_VERSION(11, 0, 0)))
>   		return true;
>   
>   	return false;
> @@ -575,43 +576,47 @@ static int smu_set_funcs(struct amdgpu_device *adev)
>   	if (adev->pm.pp_feature & PP_OVERDRIVE_MASK)
>   		smu->od_enabled = true;
>   
> -	switch (adev->asic_type) {
> -	case CHIP_NAVI10:
> -	case CHIP_NAVI14:
> -	case CHIP_NAVI12:
> +	switch (adev->ip_versions[MP1_HWIP]) {
> +	case IP_VERSION(11, 0, 0):
> +	case IP_VERSION(11, 0, 5):
> +	case IP_VERSION(11, 0, 9):
>   		navi10_set_ppt_funcs(smu);
>   		break;
> -	case CHIP_ARCTURUS:
> -		adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
> -		arcturus_set_ppt_funcs(smu);
> -		/* OD is not supported on Arcturus */
> -		smu->od_enabled =false;
> -		break;
> -	case CHIP_SIENNA_CICHLID:
> -	case CHIP_NAVY_FLOUNDER:
> -	case CHIP_DIMGREY_CAVEFISH:
> -	case CHIP_BEIGE_GOBY:
> +	case IP_VERSION(11, 0, 7):
> +	case IP_VERSION(11, 0, 11):
> +	case IP_VERSION(11, 0, 12):
> +	case IP_VERSION(11, 0, 13):
>   		sienna_cichlid_set_ppt_funcs(smu);
>   		break;
> -	case CHIP_ALDEBARAN:
> -		aldebaran_set_ppt_funcs(smu);
> -		/* Enable pp_od_clk_voltage node */
> -		smu->od_enabled = true;
> -		break;
> -	case CHIP_RENOIR:
> +	case IP_VERSION(12, 0, 0):
>   		renoir_set_ppt_funcs(smu);
>   		break;
> -	case CHIP_VANGOGH:
> +	case IP_VERSION(11, 5, 0):
>   		vangogh_set_ppt_funcs(smu);
>   		break;
> -	case CHIP_YELLOW_CARP:
> +	case IP_VERSION(13, 0, 1):
>   		yellow_carp_set_ppt_funcs(smu);
>   		break;
> -	case CHIP_CYAN_SKILLFISH:
> +	case IP_VERSION(11, 0, 8):
>   		cyan_skillfish_set_ppt_funcs(smu);
>   		break;
>   	default:
> -		return -EINVAL;
> +		switch (adev->asic_type) {
> +		case CHIP_ARCTURUS:
> +			adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
> +			arcturus_set_ppt_funcs(smu);
> +			/* OD is not supported on Arcturus */
> +			smu->od_enabled =false;
> +			break;
> +		case CHIP_ALDEBARAN:
> +			aldebaran_set_ppt_funcs(smu);
> +			/* Enable pp_od_clk_voltage node */
> +			smu->od_enabled = true;
> +			break;
> +		default:
> +			return -EINVAL;
> +		}
> +		break;
>   	}
>   
>   	return 0;
> @@ -694,7 +699,7 @@ static int smu_late_init(void *handle)
>   		return ret;
>   	}
>   
> -	if (adev->asic_type == CHIP_YELLOW_CARP)
> +	if (adev->ip_versions[MP1_HWIP] == IP_VERSION(13, 0, 1))
>   		return 0;
>   
>   	if (!amdgpu_sriov_vf(adev) || smu->od_enabled) {
> @@ -1140,8 +1145,10 @@ static int smu_smc_hw_setup(struct smu_context *smu)
>   	if (adev->in_suspend && smu_is_dpm_running(smu)) {
>   		dev_info(adev->dev, "dpm has been enabled\n");
>   		/* this is needed specifically */
> -		if ((adev->asic_type >= CHIP_SIENNA_CICHLID) &&
> -		    (adev->asic_type <= CHIP_DIMGREY_CAVEFISH))
> +		if ((adev->ip_versions[MP1_HWIP] == IP_VERSION(11, 0, 7)) ||
> +		    (adev->ip_versions[MP1_HWIP] == IP_VERSION(11, 0, 11)) ||
> +		    (adev->ip_versions[MP1_HWIP] == IP_VERSION(11, 5, 0)) ||
> +		    (adev->ip_versions[MP1_HWIP] == IP_VERSION(11, 0, 12)))

switch...case looks better here

>   			ret = smu_system_features_control(smu, true);
>   		return ret;
>   	}
> @@ -1284,7 +1291,7 @@ static int smu_start_smc_engine(struct smu_context *smu)
>   	int ret = 0;
>   
>   	if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) {
> -		if (adev->asic_type < CHIP_NAVI10) {
> +		if (adev->ip_versions[MP1_HWIP] < IP_VERSION(11, 0, 0)) {
>   			if (smu->ppt_funcs->load_microcode) {
>   				ret = smu->ppt_funcs->load_microcode(smu);
>   				if (ret)
> @@ -1403,8 +1410,14 @@ static int smu_disable_dpms(struct smu_context *smu)
>   	 *     properly.
>   	 */
>   	if (smu->uploading_custom_pp_table &&
> -	    (adev->asic_type >= CHIP_NAVI10) &&
> -	    (adev->asic_type <= CHIP_BEIGE_GOBY))
> +	    ((adev->ip_versions[MP1_HWIP] == IP_VERSION(11, 0, 0)) ||
> +	     (adev->ip_versions[MP1_HWIP] == IP_VERSION(11, 0, 5)) ||
> +	     (adev->ip_versions[MP1_HWIP] == IP_VERSION(11, 0, 9)) ||
> +	     (adev->ip_versions[MP1_HWIP] == IP_VERSION(11, 0, 7)) ||
> +	     (adev->ip_versions[MP1_HWIP] == IP_VERSION(11, 0, 11)) ||
> +	     (adev->ip_versions[MP1_HWIP] == IP_VERSION(11, 5, 0)) ||
> +	     (adev->ip_versions[MP1_HWIP] == IP_VERSION(11, 0, 12)) ||
> +	     (adev->ip_versions[MP1_HWIP] == IP_VERSION(11, 0, 13))))

Same - switch...case

>   		return smu_disable_all_features_with_exception(smu,
>   							       true,
>   							       SMU_FEATURE_COUNT);
> @@ -1413,9 +1426,11 @@ static int smu_disable_dpms(struct smu_context *smu)
>   	 * For Sienna_Cichlid, PMFW will handle the features disablement properly
>   	 * on BACO in. Driver involvement is unnecessary.
>   	 */
> -	if (((adev->asic_type == CHIP_SIENNA_CICHLID) ||
> -	     ((adev->asic_type >= CHIP_NAVI10) && (adev->asic_type <= CHIP_NAVI12))) &&
> -	     use_baco)
> +	if (((adev->ip_versions[MP1_HWIP] == IP_VERSION(11, 0, 7)) ||
> +	     (adev->ip_versions[MP1_HWIP] == IP_VERSION(11, 0, 0)) ||
> +	     (adev->ip_versions[MP1_HWIP] == IP_VERSION(11, 0, 5)) ||
> +	     (adev->ip_versions[MP1_HWIP] == IP_VERSION(11, 0, 9))) &&
> +	    use_baco)

Here as well.

Thanks,
Lijo

>   		return smu_disable_all_features_with_exception(smu,
>   							       true,
>   							       SMU_FEATURE_BACO_BIT);
> @@ -1436,7 +1451,7 @@ static int smu_disable_dpms(struct smu_context *smu)
>   			dev_err(adev->dev, "Failed to disable smu features.\n");
>   	}
>   
> -	if (adev->asic_type >= CHIP_NAVI10 &&
> +	if (adev->ip_versions[MP1_HWIP] >= IP_VERSION(11, 0, 0) &&
>   	    adev->gfx.rlc.funcs->stop)
>   		adev->gfx.rlc.funcs->stop(adev);
>   
> @@ -2229,6 +2244,7 @@ int smu_get_power_limit(void *handle,
>   			enum pp_power_type pp_power_type)
>   {
>   	struct smu_context *smu = handle;
> +	struct amdgpu_device *adev = smu->adev;
>   	enum smu_ppt_limit_level limit_level;
>   	uint32_t limit_type;
>   	int ret = 0;
> @@ -2273,10 +2289,10 @@ int smu_get_power_limit(void *handle,
>   		switch (limit_level) {
>   		case SMU_PPT_LIMIT_CURRENT:
>   			if ((smu->adev->asic_type == CHIP_ALDEBARAN) ||
> -			     (smu->adev->asic_type == CHIP_SIENNA_CICHLID) ||
> -			     (smu->adev->asic_type == CHIP_NAVY_FLOUNDER) ||
> -			     (smu->adev->asic_type == CHIP_DIMGREY_CAVEFISH) ||
> -			     (smu->adev->asic_type == CHIP_BEIGE_GOBY))
> +			     (adev->ip_versions[MP1_HWIP] == IP_VERSION(11, 0, 7)) ||
> +			     (adev->ip_versions[MP1_HWIP] == IP_VERSION(11, 0, 11)) ||
> +			     (adev->ip_versions[MP1_HWIP] == IP_VERSION(11, 0, 12)) ||
> +			     (adev->ip_versions[MP1_HWIP] == IP_VERSION(11, 0, 13)))
>   				ret = smu_get_asic_power_limits(smu,
>   								&smu->current_power_limit,
>   								NULL,
> 

  reply	other threads:[~2021-09-22  7:32 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-21 18:06 [PATCH 00/66] Move to IP driven device enumeration Alex Deucher
2021-09-21 18:06 ` [PATCH 01/66] drm/amdgpu: move headless sku check into harvest function Alex Deucher
2021-09-21 18:06 ` [PATCH 02/66] drm/amdgpu: add debugfs access to the IP discovery table Alex Deucher
2021-09-21 18:06 ` [PATCH 03/66] drm/amdgpu: store HW IP versions in the driver structure Alex Deucher
2021-09-21 18:06 ` [PATCH 04/66] drm/amdgpu: fill in IP versions from IP discovery table Alex Deucher
2021-09-22 16:58   ` Felix Kuehling
2021-09-22 20:43     ` Deucher, Alexander
2021-09-21 18:06 ` [PATCH 05/66] drm/amdgpu: add XGMI HWIP Alex Deucher
2021-09-21 18:06 ` [PATCH 06/66] drm/amdgpu/nv: export common IP functions Alex Deucher
2021-09-21 18:06 ` [PATCH 07/66] drm/amdgpu: add initial IP enumeration via IP discovery table Alex Deucher
2021-09-21 18:06 ` [PATCH 08/66] drm/amdgpu/sdma5.0: convert to IP version checking Alex Deucher
2021-09-21 18:06 ` [PATCH 09/66] drm/amdgpu/sdma5.2: " Alex Deucher
2021-09-22  5:55   ` Lazar, Lijo
2021-09-22  6:08     ` Chen, Guchun
2021-09-22  9:18       ` Lazar, Lijo
2021-09-21 18:06 ` [PATCH 10/66] drm/amdgpu/gfx10: " Alex Deucher
2021-09-21 18:06 ` [PATCH 11/66] drm/amdgpu: filter out radeon PCI device IDs Alex Deucher
2021-09-22  4:41   ` Lazar, Lijo
2021-09-22 15:19     ` Deucher, Alexander
2021-09-22 16:16   ` Felix Kuehling
2021-09-22 17:07     ` Alex Deucher
2021-09-21 18:06 ` [PATCH 12/66] drm/amdgpu: bind to any 0x1002 PCI diplay class device Alex Deucher
2021-09-21 18:06 ` [PATCH 13/66] drm/amdgpu/gmc10.0: convert to IP version checking Alex Deucher
2021-09-21 18:06 ` [PATCH 14/66] drm/amdgpu: Use IP discovery to drive setting IP blocks by default Alex Deucher
2021-09-21 18:06 ` [PATCH 15/66] drm/amdgpu: drive nav10 from the IP discovery table Alex Deucher
2021-09-21 18:06 ` [PATCH 16/66] drm/amdgpu/gfxhub2.1: convert to IP version checking Alex Deucher
2021-09-21 18:06 ` [PATCH 17/66] drm/amdgpu/mmhub2.0: " Alex Deucher
2021-09-21 18:06 ` [PATCH 18/66] drm/amdgpu/mmhub2.1: " Alex Deucher
2021-09-21 18:06 ` [PATCH 19/66] drm/amdgpu/vcn3.0: " Alex Deucher
2021-09-21 18:06 ` [PATCH 20/66] drm/amdgpu/athub2.0: " Alex Deucher
2021-09-21 18:06 ` [PATCH 21/66] drm/amdgpu/athub2.1: " Alex Deucher
2021-09-21 18:06 ` [PATCH 22/66] drm/amdgpu/navi10_ih: " Alex Deucher
2021-09-21 18:06 ` [PATCH 23/66] drm/amdgpu/amdgpu_smu: " Alex Deucher
2021-09-22  7:32   ` Lazar, Lijo [this message]
2021-09-22 15:40     ` Deucher, Alexander
2021-09-21 18:06 ` [PATCH 24/66] drm/amdgpu/smu11.0: " Alex Deucher
2021-09-21 18:06 ` [PATCH 25/66] drm/amdgpu/navi10_ppt: " Alex Deucher
2021-09-21 18:06 ` [PATCH 26/66] drm/amdgpu/sienna_cichlid_ppt: " Alex Deucher
2021-09-21 18:06 ` [PATCH 27/66] drm/amdgpu: drive all navi asics from the IP discovery table Alex Deucher
2021-09-21 18:06 ` [PATCH 28/66] drm/amdgpu/nv: convert to IP version checking Alex Deucher
2021-09-22  7:31   ` Lazar, Lijo
2021-09-22 15:21     ` Alex Deucher
2021-09-21 18:06 ` [PATCH 29/66] drm/amdgpu/display/dm: " Alex Deucher
2021-09-22  7:37   ` Lazar, Lijo
2021-09-22 15:53     ` Deucher, Alexander
2021-09-21 18:06 ` [PATCH 30/66] drm/amdgpu: add DCI HWIP Alex Deucher
2021-09-23 15:43   ` Harry Wentland
2021-09-24 19:58     ` Alex Deucher
2021-09-24 20:40       ` Harry Wentland
2021-09-21 18:06 ` [PATCH 31/66] drm/amdgpu: make soc15_common_ip_funcs static Alex Deucher
2021-09-21 18:06 ` [PATCH 32/66] drm/amdgpu/soc15: export common IP functions Alex Deucher
2021-09-21 18:06 ` [PATCH 33/66] drm/amdgpu: add initial IP discovery support for vega based parts Alex Deucher
2021-09-22  7:48   ` Lazar, Lijo
2021-09-22  7:54   ` Lazar, Lijo
2021-09-22 15:58     ` Alex Deucher
2021-09-21 18:06 ` [PATCH 34/66] drm/amdgpu/soc15: get rev_id in soc15_common_early_init Alex Deucher
2021-09-21 18:06 ` [PATCH 35/66] drm/amdgpu: drive all vega asics from the IP discovery table Alex Deucher
2021-09-21 18:06 ` [PATCH 36/66] drm/amdgpu: default to true in amdgpu_device_asic_has_dc_support Alex Deucher
2021-09-23 15:58   ` Harry Wentland
2021-09-21 18:06 ` [PATCH 37/66] drm/amdgpu/display/dm: convert RAVEN to IP version checking Alex Deucher
2021-09-21 18:06 ` [PATCH 38/66] drm/amdgpu/sdma4.0: convert " Alex Deucher
2021-09-21 18:06 ` [PATCH 39/66] drm/amdgpu/hdp4.0: " Alex Deucher
2021-09-21 18:06 ` [PATCH 40/66] drm/amdgpu/gfx9.0: " Alex Deucher
2021-09-21 18:07 ` [PATCH 41/66] drm/amdgpu/amdgpu_psp: " Alex Deucher
2021-09-21 18:07 ` [PATCH 42/66] drm/amdgpu/psp_v11.0: " Alex Deucher
2021-09-21 18:07 ` [PATCH 43/66] drm/amdgpu/psp_v13.0: " Alex Deucher
2021-09-21 18:07 ` [PATCH 44/66] drm/amdgpu/pm/smu_v11.0: update " Alex Deucher
2021-09-21 18:07 ` [PATCH 45/66] drm/amdgpu/pm/smu_v13.0: convert " Alex Deucher
2021-09-22  8:18   ` Lazar, Lijo
2021-09-21 18:07 ` [PATCH 46/66] drm/amdgpu/pm/amdgpu_smu: convert more " Alex Deucher
2021-09-22  8:16   ` Lazar, Lijo
2021-09-22 16:06     ` Deucher, Alexander
2021-09-21 18:07 ` [PATCH 47/66] drm/amdgpu/amdgpu_vcn: convert to " Alex Deucher
2021-09-21 18:07 ` [PATCH 48/66] drm/amdgpu/vcn2.5: " Alex Deucher
2021-09-21 18:07 ` [PATCH 49/66] drm/amdgpu/soc15: " Alex Deucher
2021-09-21 18:07 ` [PATCH 50/66] drm/amd/display: fix error case handling Alex Deucher
2021-09-21 18:07 ` [PATCH 51/66] drm/amdgpu: add VCN1 hardware IP Alex Deucher
2021-09-21 18:07 ` [PATCH 52/66] drm/amdgpu: store all instances of IPs in the IP version table Alex Deucher
2021-09-22  8:36   ` Lazar, Lijo
2021-09-22  8:45     ` Lazar, Lijo
2021-09-21 18:07 ` [PATCH 53/66] drm/amdgpu: add HWID of SDMA instance 2 and 3 Alex Deucher
2021-09-21 18:07 ` [PATCH 54/66] drm/amdgpu: get VCN and SDMA instances from IP discovery table Alex Deucher
2021-09-21 18:07 ` [PATCH 55/66] drm/amdgpu/sdma: remove manual instance setting Alex Deucher
2021-09-21 18:07 ` [PATCH 56/66] drm/amdgpu/vcn: " Alex Deucher
2021-09-21 18:07 ` [PATCH 57/66] drm/amdgpu: get VCN harvest information from IP discovery table Alex Deucher
2021-09-21 18:07 ` [PATCH 58/66] drm/amdgpu/ucode: add default behavior Alex Deucher
2021-09-21 18:07 ` [PATCH 59/66] drm/amdgpu: add new asic_type for IP discovery Alex Deucher
2021-09-21 18:07 ` [PATCH 60/66] drm/amdgpu: set CHIP_IP_DISCOVERY as the asic type by default Alex Deucher
2021-09-23  6:47   ` Lazar, Lijo
2021-09-23 21:46     ` Alex Deucher
2021-09-21 18:07 ` [PATCH 61/66] drm/amdgpu: convert IP version array to include instances Alex Deucher
2021-09-22  9:08   ` Lazar, Lijo
2021-09-22 16:17     ` Alex Deucher
2021-09-23  4:58       ` Lazar, Lijo
2021-09-23 21:42         ` Alex Deucher
2021-09-21 18:07 ` [PATCH 62/66] drm/amdgpu: clean up set IP function Alex Deucher
2021-09-21 18:07 ` [PATCH 63/66] drm/amdgpu: add support for SRIOV in IP discovery path Alex Deucher
2021-09-21 18:07 ` [PATCH 64/66] drm/amdkfd: clean up parameters in kgd2kfd_probe Alex Deucher
2021-09-21 18:07 ` [PATCH 65/66] drm/amdkfd: convert kfd_device.c to use GC IP version Alex Deucher
2021-09-21 21:00   ` ernstp
2021-09-22  1:44     ` Alex Deucher
2021-09-22 16:55   ` Felix Kuehling
2021-09-21 18:07 ` [PATCH 66/66] drm/amdgpu: add an option to override IP discovery table from a file Alex Deucher
2021-09-22  7:54 ` [PATCH 00/66] Move to IP driven device enumeration Christian König
2021-09-22 20:25   ` Alex Deucher
2021-09-23  6:43     ` Christian König

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=e82086c7-3740-2140-f23b-773e687aa85d@amd.com \
    --to=lijo.lazar@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /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;
as well as URLs for NNTP newsgroup(s).