Skip to contentSkip to conversation

drm/amdgpu: increase HWIP MAX INSTANCE

PATCH In review Alex Deucher 2 participants 3 messages Apr 26, 2022 – Apr 27, 2022

Subsystems (2)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/1 drm/amdgpu: increase HWIP MAX INSTANCE

From: Likun Gao <[email protected]>

Extend HWIP MAX INSTANCE to 11.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
index dfc5b46c6a11..62e295fadc6c 100644
@@ -666,7 +666,7 @@ enum amd_hw_ip_block_type {
 	MAX_HWIP
 };
 
-#define HWIP_MAX_INSTANCE	10
+#define HWIP_MAX_INSTANCE	11
 
 #define HW_ID_MAX		300
 #define IP_VERSION(mj, mn, rv) (((mj) << 16) | ((mn) << 8) | (rv))
Signature · 1 line
2.35.1
author maintainer
#1 lore raw

PATCH 1/1 drm/amdgpu: add function to decode ip version

From: Likun Gao <[email protected]>

Add function to decode IP version.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h       |  3 +++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 33 +++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h |  2 ++
 3 files changed, 38 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3 -0
index 62e295fadc6c..aa5b944956d8 100644
@@ -670,6 +670,9 @@ enum amd_hw_ip_block_type {
 
 #define HW_ID_MAX		300
 #define IP_VERSION(mj, mn, rv) (((mj) << 16) | ((mn) << 8) | (rv))
+#define IP_VERSION_MAJ(ver) ((ver) >> 16)
+#define IP_VERSION_MIN(ver) (((ver) >> 8) & 0xFF)
+#define IP_VERSION_REV(ver) ((ver) & 0xFF)
 
 struct amd_powerplay {
 	void *pp_handle;
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +33 -0
index ca3350502618..016477fa2f90 100644
@@ -760,3 +760,36 @@ int amdgpu_ucode_init_bo(struct amdgpu_device *adev)
 	}
 	return 0;
 }
+
+void amdgpu_ucode_ip_version_decode(struct amdgpu_device *adev, int block_type, char *ucode_prefix, int len)
+{
+	int maj, min, rev;
+	char *ip_name;
+	uint32_t version = adev->ip_versions[block_type][0];
+
+	switch (block_type) {
+	case GC_HWIP:
+		ip_name = "gc";
+		break;
+	case SDMA0_HWIP:
+		ip_name = "sdma";
+		break;
+	case MP0_HWIP:
+		ip_name = "psp";
+		break;
+	case MP1_HWIP:
+		ip_name = "smu";
+		break;
+	case UVD_HWIP:
+		ip_name = "vcn";
+		break;
+	default:
+		BUG();
+	}
+
+	maj = IP_VERSION_MAJ(version);
+	min = IP_VERSION_MIN(version);
+	rev = IP_VERSION_REV(version);
+
+	snprintf(ucode_prefix, len, "%s_%d_%d_%d", ip_name, maj, min, rev);
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +2 -0
index 40dffbac85a0..864984d0d3ef 100644
@@ -463,4 +463,6 @@ amdgpu_ucode_get_load_type(struct amdgpu_device *adev, int load_type);
 
 const char *amdgpu_ucode_name(enum AMDGPU_UCODE_ID ucode_id);
 
+void amdgpu_ucode_ip_version_decode(struct amdgpu_device *adev, int block_type, char *ucode_prefix, int len);
+
 #endif
Signature · 1 line
2.35.1
Acked-by on v1 1/1
#2 lore raw
In reply to Alex Deucher

Am 26.04.22 um 20:25 schrieb Alex Deucher:

Quoted 7 lines

From: Likun Gao <[email protected]>

Extend HWIP MAX INSTANCE to 11.

Quoted 17 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
index dfc5b46c6a11..62e295fadc6c 100644
@@ -666,7 +666,7 @@ enum amd_hw_ip_block_type {
  	MAX_HWIP
  };
 
-#define HWIP_MAX_INSTANCE	10
+#define HWIP_MAX_INSTANCE	11
 
  #define HW_ID_MAX		300
  #define IP_VERSION(mj, mn, rv) (((mj) << 16) | ((mn) << 8) | (rv))