AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexander.deucher@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>
Subject: [PATCH 40/64] drm/amdgpu/amdgpu_psp: convert to IP version checking
Date: Tue, 28 Sep 2021 12:42:13 -0400	[thread overview]
Message-ID: <20210928164237.833132-41-alexander.deucher@amd.com> (raw)
In-Reply-To: <20210928164237.833132-1-alexander.deucher@amd.com>

Use IP versions rather than asic_type to differentiate
IP version specific features.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 101 ++++++++++++++----------
 1 file changed, 58 insertions(+), 43 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index f17a1036f46e..fe25a11a9b1f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -71,17 +71,25 @@ static void psp_check_pmfw_centralized_cstate_management(struct psp_context *psp
 {
 	struct amdgpu_device *adev = psp->adev;
 
-	psp->pmfw_centralized_cstate_management = false;
-
-	if (amdgpu_sriov_vf(adev))
-		return;
-
-	if (adev->flags & AMD_IS_APU)
+	if (amdgpu_sriov_vf(adev)) {
+		psp->pmfw_centralized_cstate_management = false;
 		return;
+	}
 
-	if ((adev->asic_type >= CHIP_ARCTURUS) ||
-	    (adev->asic_type >= CHIP_NAVI12))
+	switch (adev->ip_versions[MP0_HWIP]) {
+	case IP_VERSION(11, 0, 4):
+	case IP_VERSION(11, 0, 7):
+	case IP_VERSION(11, 0, 9):
+	case IP_VERSION(11, 0, 11):
+	case IP_VERSION(11, 0, 12):
+	case IP_VERSION(11, 0, 13):
+	case IP_VERSION(13, 0, 2):
 		psp->pmfw_centralized_cstate_management = true;
+		break;
+	default:
+		psp->pmfw_centralized_cstate_management = false;
+		break;
+	}
 }
 
 static int psp_early_init(void *handle)
@@ -89,43 +97,45 @@ static int psp_early_init(void *handle)
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	struct psp_context *psp = &adev->psp;
 
-	switch (adev->asic_type) {
-	case CHIP_VEGA10:
-	case CHIP_VEGA12:
+	switch (adev->ip_versions[MP0_HWIP]) {
+	case IP_VERSION(9, 0, 0):
 		psp_v3_1_set_psp_funcs(psp);
 		psp->autoload_supported = false;
 		break;
-	case CHIP_RAVEN:
+	case IP_VERSION(10, 0, 0):
+	case IP_VERSION(10, 0, 1):
 		psp_v10_0_set_psp_funcs(psp);
 		psp->autoload_supported = false;
 		break;
-	case CHIP_VEGA20:
-	case CHIP_ARCTURUS:
+	case IP_VERSION(11, 0, 2):
+	case IP_VERSION(11, 0, 4):
 		psp_v11_0_set_psp_funcs(psp);
 		psp->autoload_supported = false;
 		break;
-	case CHIP_NAVI10:
-	case CHIP_NAVI14:
-	case CHIP_NAVI12:
-	case CHIP_SIENNA_CICHLID:
-	case CHIP_NAVY_FLOUNDER:
-	case CHIP_VANGOGH:
-	case CHIP_DIMGREY_CAVEFISH:
-	case CHIP_BEIGE_GOBY:
+	case IP_VERSION(11, 0, 0):
+	case IP_VERSION(11, 0, 5):
+	case IP_VERSION(11, 0, 9):
+	case IP_VERSION(11, 0, 7):
+	case IP_VERSION(11, 0, 11):
+	case IP_VERSION(11, 5, 0):
+	case IP_VERSION(11, 0, 12):
+	case IP_VERSION(11, 0, 13):
 		psp_v11_0_set_psp_funcs(psp);
 		psp->autoload_supported = true;
 		break;
-	case CHIP_RENOIR:
+	case IP_VERSION(11, 0, 3):
+	case IP_VERSION(12, 0, 1):
 		psp_v12_0_set_psp_funcs(psp);
 		break;
-	case CHIP_ALDEBARAN:
+	case IP_VERSION(13, 0, 2):
 		psp_v13_0_set_psp_funcs(psp);
 		break;
-	case CHIP_YELLOW_CARP:
+	case IP_VERSION(13, 0, 1):
+	case IP_VERSION(13, 0, 3):
 		psp_v13_0_set_psp_funcs(psp);
 		psp->autoload_supported = true;
 		break;
-	case CHIP_CYAN_SKILLFISH:
+	case IP_VERSION(11, 0, 8):
 		if (adev->apu_flags & AMD_APU_IS_CYAN_SKILLFISH2) {
 			psp_v11_0_8_set_psp_funcs(psp);
 			psp->autoload_supported = false;
@@ -268,7 +278,8 @@ static int psp_sw_init(void *handle)
 			DRM_ERROR("Failed to load psp firmware!\n");
 			return ret;
 		}
-	} else if (amdgpu_sriov_vf(adev) && adev->asic_type == CHIP_ALDEBARAN) {
+	} else if (amdgpu_sriov_vf(adev) &&
+		   adev->ip_versions[MP0_HWIP] == IP_VERSION(13, 0, 2)) {
 		ret = psp_init_ta_microcode(psp, "aldebaran");
 		if (ret) {
 			DRM_ERROR("Failed to initialize ta microcode!\n");
@@ -311,7 +322,8 @@ static int psp_sw_init(void *handle)
 		}
 	}
 
-	if (adev->asic_type == CHIP_NAVI10 || adev->asic_type == CHIP_SIENNA_CICHLID) {
+	if (adev->ip_versions[MP0_HWIP] == IP_VERSION(11, 0, 0) ||
+	    adev->ip_versions[MP0_HWIP] == IP_VERSION(11, 0, 7)) {
 		ret= psp_sysfs_init(adev);
 		if (ret) {
 			return ret;
@@ -341,8 +353,8 @@ static int psp_sw_fini(void *handle)
 		psp->ta_fw = NULL;
 	}
 
-	if (adev->asic_type == CHIP_NAVI10 ||
-	    adev->asic_type == CHIP_SIENNA_CICHLID)
+	if (adev->ip_versions[MP0_HWIP] == IP_VERSION(11, 0, 0) ||
+	    adev->ip_versions[MP0_HWIP] == IP_VERSION(11, 0, 7))
 		psp_sysfs_fini(adev);
 
 	kfree(cmd);
@@ -601,10 +613,10 @@ static int psp_tmr_init(struct psp_context *psp)
 
 static bool psp_skip_tmr(struct psp_context *psp)
 {
-	switch (psp->adev->asic_type) {
-	case CHIP_NAVI12:
-	case CHIP_SIENNA_CICHLID:
-	case CHIP_ALDEBARAN:
+	switch (psp->adev->ip_versions[MP0_HWIP]) {
+	case IP_VERSION(11, 0, 9):
+	case IP_VERSION(11, 0, 7):
+	case IP_VERSION(13, 0, 2):
 		return true;
 	default:
 		return false;
@@ -998,8 +1010,9 @@ int psp_xgmi_terminate(struct psp_context *psp)
 	struct amdgpu_device *adev = psp->adev;
 
 	/* XGMI TA unload currently is not supported on Arcturus/Aldebaran A+A */
-	if (adev->asic_type == CHIP_ARCTURUS ||
-		(adev->asic_type == CHIP_ALDEBARAN && adev->gmc.xgmi.connected_to_cpu))
+	if (adev->ip_versions[MP0_HWIP] == IP_VERSION(11, 0, 4) ||
+	    (adev->ip_versions[MP0_HWIP] == IP_VERSION(13, 0, 2) &&
+	     adev->gmc.xgmi.connected_to_cpu))
 		return 0;
 
 	if (!psp->xgmi_context.context.initialized)
@@ -1100,8 +1113,8 @@ int psp_xgmi_get_node_id(struct psp_context *psp, uint64_t *node_id)
 
 static bool psp_xgmi_peer_link_info_supported(struct psp_context *psp)
 {
-	return psp->adev->asic_type == CHIP_ALDEBARAN &&
-				psp->xgmi_context.context.bin_desc.feature_version >= 0x2000000b;
+	return psp->adev->ip_versions[MP0_HWIP] == IP_VERSION(13, 0, 2) &&
+		psp->xgmi_context.context.bin_desc.feature_version >= 0x2000000b;
 }
 
 /*
@@ -2219,8 +2232,8 @@ static int psp_load_smu_fw(struct psp_context *psp)
 
 	if ((amdgpu_in_reset(adev) &&
 	     ras && adev->ras_enabled &&
-	     (adev->asic_type == CHIP_ARCTURUS ||
-	      adev->asic_type == CHIP_VEGA20))) {
+	     (adev->ip_versions[MP0_HWIP] == IP_VERSION(11, 0, 4) ||
+	      adev->ip_versions[MP0_HWIP] == IP_VERSION(11, 0, 2)))) {
 		ret = amdgpu_dpm_set_mp1_state(adev, PP_MP1_STATE_UNLOAD);
 		if (ret) {
 			DRM_WARN("Failed to set MP1 state prepare for reload\n");
@@ -2317,8 +2330,9 @@ static int psp_load_non_psp_fw(struct psp_context *psp)
 			continue;
 
 		if (psp->autoload_supported &&
-		    (adev->asic_type >= CHIP_SIENNA_CICHLID &&
-		     adev->asic_type <= CHIP_DIMGREY_CAVEFISH) &&
+		    (adev->ip_versions[MP0_HWIP] == IP_VERSION(11, 0, 7) ||
+		     adev->ip_versions[MP0_HWIP] == IP_VERSION(11, 0, 11) ||
+		     adev->ip_versions[MP0_HWIP] == IP_VERSION(11, 0, 12)) &&
 		    (ucode->ucode_id == AMDGPU_UCODE_ID_SDMA1 ||
 		     ucode->ucode_id == AMDGPU_UCODE_ID_SDMA2 ||
 		     ucode->ucode_id == AMDGPU_UCODE_ID_SDMA3))
@@ -2905,7 +2919,8 @@ static int psp_init_sos_base_fw(struct amdgpu_device *adev)
 	ucode_array_start_addr = (uint8_t *)sos_hdr +
 		le32_to_cpu(sos_hdr->header.ucode_array_offset_bytes);
 
-	if (adev->gmc.xgmi.connected_to_cpu || (adev->asic_type != CHIP_ALDEBARAN)) {
+	if (adev->gmc.xgmi.connected_to_cpu ||
+	    (adev->ip_versions[MP0_HWIP] != IP_VERSION(13, 0, 2))) {
 		adev->psp.sos.fw_version = le32_to_cpu(sos_hdr->header.ucode_version);
 		adev->psp.sos.feature_version = le32_to_cpu(sos_hdr->sos.fw_version);
 
-- 
2.31.1


  parent reply	other threads:[~2021-09-28 16:45 UTC|newest]

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