Skip to contentSkip to conversation

drm/amdgpu: add amdgpu_device reference in ip block

PATCH In review Sunil Khatri 2 participants 2 messages Sep 24, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: add amdgpu_device reference in ip block

To handle amdgpu_device reference for different GPUs we add it's reference in each ip block which can be used to differentiate between difference gpu devices.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 ++
 2 files changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 5b06c052ffbc..c83207a01763 100644
@@ -391,6 +391,7 @@ struct amdgpu_ip_block_version {
 struct amdgpu_ip_block {
 	struct amdgpu_ip_block_status status;
 	const struct amdgpu_ip_block_version *version;
+	struct amdgpu_device *adev;
 };
 
 int amdgpu_device_ip_block_version_cmp(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
index dee57f15719e..c4d4fbcfca7a 100644
@@ -2337,6 +2337,8 @@ int amdgpu_device_ip_block_add(struct amdgpu_device *adev,
 	DRM_INFO("add ip block number %d <%s>\n", adev->num_ip_blocks,
 		  ip_block_version->funcs->name);
 
+	adev->ip_blocks[adev->num_ip_blocks].adev = adev;
+
 	adev->ip_blocks[adev->num_ip_blocks++].version = ip_block_version;
 
 	return 0;
Signature · 1 line
2.34.1
maintainer Reviewed-by on v1 1/1
#1 lore raw

Am 24.09.24 um 14:57 schrieb Sunil Khatri:

Quoted 5 lines

To handle amdgpu_device reference for different GPUs we add it's reference in each ip block which can be used to differentiate between difference gpu devices.

Quoted 30 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 1 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 ++
  2 files changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 5b06c052ffbc..c83207a01763 100644
@@ -391,6 +391,7 @@ struct amdgpu_ip_block_version {
  struct amdgpu_ip_block {
  	struct amdgpu_ip_block_status status;
  	const struct amdgpu_ip_block_version *version;
+	struct amdgpu_device *adev;
  };
 
  int amdgpu_device_ip_block_version_cmp(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
index dee57f15719e..c4d4fbcfca7a 100644
@@ -2337,6 +2337,8 @@ int amdgpu_device_ip_block_add(struct amdgpu_device *adev,
  	DRM_INFO("add ip block number %d <%s>\n", adev->num_ip_blocks,
  		  ip_block_version->funcs->name);
 
+	adev->ip_blocks[adev->num_ip_blocks].adev = adev;
+
  	adev->ip_blocks[adev->num_ip_blocks++].version = ip_block_version;
 
  	return 0;