Skip to contentSkip to conversation

drm/amdgpu: add the IP discovery IP versions for HW INFO data

PATCH In review Alex Deucher 3 participants 4 messages Jul 8, 2022 – Jul 20, 2022

Subsystems (3)
lore
Share & tools
lore

Alex Deucher

author maintainer
#0 lore raw

PATCH 1/2 drm/amdgpu: add the IP discovery IP versions for HW INFO data

Use the former pad element to store the IP versions from the IP discovery table. This allows userspace to get the IP version from the kernel to better align with hardware IP versions.

Proposed mesa patch:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17411/diffs?commit_id=c8a63590dfd0d64e6e6a634dcfed993f135dd075

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 24 ++++++++++++++++++++++++
 include/uapi/drm/amdgpu_drm.h           |  3 ++-
 2 files changed, 26 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +24 -0
index 4b44a4bc2fb3..7e03f3719d11 100644
@@ -473,6 +473,30 @@ static int amdgpu_hw_ip_info(struct amdgpu_device *adev,
 
 	result->hw_ip_version_major = adev->ip_blocks[i].version->major;
 	result->hw_ip_version_minor = adev->ip_blocks[i].version->minor;
+
+	if (adev->asic_type >= CHIP_VEGA10) {
+		switch (type) {
+		case AMD_IP_BLOCK_TYPE_GFX:
+			result->ip_discovery_version = adev->ip_versions[GC_HWIP][0];
+			break;
+		case AMD_IP_BLOCK_TYPE_SDMA:
+			result->ip_discovery_version = adev->ip_versions[SDMA0_HWIP][0];
+			break;
+		case AMD_IP_BLOCK_TYPE_UVD:
+		case AMD_IP_BLOCK_TYPE_VCN:
+		case AMD_IP_BLOCK_TYPE_JPEG:
+			result->ip_discovery_version = adev->ip_versions[UVD_HWIP][0];
+			break;
+		case AMD_IP_BLOCK_TYPE_VCE:
+			result->ip_discovery_version = adev->ip_versions[VCE_HWIP][0];
+			break;
+		default:
+			result->ip_discovery_version = 0;
+			break;
+		}
+	} else {
+		result->ip_discovery_version = 0;
+	}
 	result->capabilities_flags = 0;
 	result->available_rings = (1 << num_rings) - 1;
 	result->ib_start_alignment = ib_start_alignment;
include/uapi/drm/amdgpu_drm.h +2 -1
index 18d3246d636e..3a2674b4a2d9 100644
@@ -1093,7 +1093,8 @@ struct drm_amdgpu_info_hw_ip {
 	__u32  ib_size_alignment;
 	/** Bitmask of available rings. Bit 0 means ring 0, etc. */
 	__u32  available_rings;
-	__u32  _pad;
+	/** version info: bits 23:16 major, 15:8 minor, 7:0 revision */
+	__u32  ip_discovery_version;
 };
 
 struct drm_amdgpu_info_num_handles {
Signature · 1 line
2.35.3
author maintainer
#1 lore raw

PATCH 2/2 drm/amdgpu: bump driver version for IP discovery info in HW INFO

So userspace knows when it is available.

Proposed mesa patch:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17411/diffs?commit_id=c8a63590dfd0d64e6e6a634dcfed993f135dd075

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -2
index d6a5d0f424da..c716cea0675a 100644
@@ -100,10 +100,11 @@
  * - 3.44.0 - DCN3 supports DCC independent block settings: !64B && 128B, 64B && 128B
  * - 3.45.0 - Add context ioctl stable pstate interface
  * - 3.46.0 - To enable hot plug amdgpu tests in libdrm
- * * 3.47.0 - Add AMDGPU_GEM_CREATE_DISCARDABLE and AMDGPU_VM_NOALLOC flags
+ * - 3.47.0 - Add AMDGPU_GEM_CREATE_DISCARDABLE and AMDGPU_VM_NOALLOC flags
+ * - 3.48.0 - Add IP discovery version info to HW INFO
  */
 #define KMS_DRIVER_MAJOR	3
-#define KMS_DRIVER_MINOR	47
+#define KMS_DRIVER_MINOR	48
 #define KMS_DRIVER_PATCHLEVEL	0
 
 int amdgpu_vram_limit;
Signature · 1 line
2.35.3
#2 lore raw
In reply to Alex Deucher

Ping on this series.

Alex

Quoted 67 lines · Alex Deucher

Use the former pad element to store the IP versions from the IP discovery table. This allows userspace to get the IP version from the kernel to better align with hardware IP versions.

Proposed mesa patch:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17411/diffs?commit_id=c8a63590dfd0d64e6e6a634dcfed993f135dd075

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 24 ++++++++++++++++++++++++
 include/uapi/drm/amdgpu_drm.h           |  3 ++-
 2 files changed, 26 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +24 -0
index 4b44a4bc2fb3..7e03f3719d11 100644
@@ -473,6 +473,30 @@ static int amdgpu_hw_ip_info(struct amdgpu_device *adev,
 
        result->hw_ip_version_major = adev->ip_blocks[i].version->major;
        result->hw_ip_version_minor = adev->ip_blocks[i].version->minor;
+
+       if (adev->asic_type >= CHIP_VEGA10) {
+               switch (type) {
+               case AMD_IP_BLOCK_TYPE_GFX:
+                       result->ip_discovery_version = adev->ip_versions[GC_HWIP][0];
+                       break;
+               case AMD_IP_BLOCK_TYPE_SDMA:
+                       result->ip_discovery_version = adev->ip_versions[SDMA0_HWIP][0];
+                       break;
+               case AMD_IP_BLOCK_TYPE_UVD:
+               case AMD_IP_BLOCK_TYPE_VCN:
+               case AMD_IP_BLOCK_TYPE_JPEG:
+                       result->ip_discovery_version = adev->ip_versions[UVD_HWIP][0];
+                       break;
+               case AMD_IP_BLOCK_TYPE_VCE:
+                       result->ip_discovery_version = adev->ip_versions[VCE_HWIP][0];
+                       break;
+               default:
+                       result->ip_discovery_version = 0;
+                       break;
+               }
+       } else {
+               result->ip_discovery_version = 0;
+       }
        result->capabilities_flags = 0;
        result->available_rings = (1 << num_rings) - 1;
        result->ib_start_alignment = ib_start_alignment;
include/uapi/drm/amdgpu_drm.h +2 -2
index 18d3246d636e..3a2674b4a2d9 100644
@@ -1093,7 +1093,8 @@ struct drm_amdgpu_info_hw_ip {
        __u32  ib_size_alignment;
        /** Bitmask of available rings. Bit 0 means ring 0, etc. */
        __u32  available_rings;
-       __u32  _pad;
+       /** version info: bits 23:16 major, 15:8 minor, 7:0 revision */
+       __u32  ip_discovery_version;
 };
 
 struct drm_amdgpu_info_num_handles {
--

2.35.3

Reviewed-by
#3 lore raw

for the series.

Marek

Quoted 82 lines · Alex Deucher

Ping on this series.

Alex

Quoted 8 lines · Alex Deucher

Use the former pad element to store the IP versions from the IP discovery table. This allows userspace to get the IP version from the kernel to better align with hardware IP versions.

Proposed mesa patch:

https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17411/diffs?commit_id=c8a63590dfd0d64e6e6a634dcfed993f135dd075

Review

Quoted 8 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 24 ++++++++++++++++++++++++
 include/uapi/drm/amdgpu_drm.h           |  3 ++-
 2 files changed, 26 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c static int amdgpu_hw_ip_info(struct amdgpu_device

Quoted 4 lines

index 4b44a4bc2fb3..7e03f3719d11 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
@@ -473,6 +473,30 @@ static int amdgpu_hw_ip_info(struct amdgpu_device

*adev,

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c static int amdgpu_hw_ip_info(struct amdgpu_device *adev,

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +5 -0
        result->hw_ip_version_major = adev->ip_blocks[i].version->major;
        result->hw_ip_version_minor = adev->ip_blocks[i].version->minor;
+
+       if (adev->asic_type >= CHIP_VEGA10) {
+               switch (type) {
+               case AMD_IP_BLOCK_TYPE_GFX:
+                       result->ip_discovery_version =

adev->ip_versions[GC_HWIP][0];

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c static int amdgpu_hw_ip_info(struct amdgpu_device *adev,

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3 -0
+                       break;
+               case AMD_IP_BLOCK_TYPE_SDMA:
+                       result->ip_discovery_version =

adev->ip_versions[SDMA0_HWIP][0];

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c static int amdgpu_hw_ip_info(struct amdgpu_device *adev,

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +5 -0
+                       break;
+               case AMD_IP_BLOCK_TYPE_UVD:
+               case AMD_IP_BLOCK_TYPE_VCN:
+               case AMD_IP_BLOCK_TYPE_JPEG:
+                       result->ip_discovery_version =

adev->ip_versions[UVD_HWIP][0];

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c static int amdgpu_hw_ip_info(struct amdgpu_device *adev,

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3 -0
+                       break;
+               case AMD_IP_BLOCK_TYPE_VCE:
+                       result->ip_discovery_version =

adev->ip_versions[VCE_HWIP][0];

Review

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +8 -0
+                       break;
+               default:
+                       result->ip_discovery_version = 0;
+                       break;
+               }
+       } else {
+               result->ip_discovery_version = 0;
+       }
        result->capabilities_flags = 0;
        result->available_rings = (1 << num_rings) - 1;
        result->ib_start_alignment = ib_start_alignment;
(quoted diff) +0 -0

b/include/uapi/drm/amdgpu_drm.h

Quoted 16 lines

index 18d3246d636e..3a2674b4a2d9 100644

include/uapi/drm/amdgpu_drm.h +2 -2
@@ -1093,7 +1093,8 @@ struct drm_amdgpu_info_hw_ip {
        __u32  ib_size_alignment;
        /** Bitmask of available rings. Bit 0 means ring 0, etc. */
        __u32  available_rings;
-       __u32  _pad;
+       /** version info: bits 23:16 major, 15:8 minor, 7:0 revision */
+       __u32  ip_discovery_version;
 };
 
 struct drm_amdgpu_info_num_handles {
--

2.35.3