[PATCH v2 ] drm/amdgpu: fix discovery ip failed

Zhang, Jesse(Jie) Jesse.Zhang at amd.com
Mon Apr 11 15:25:05 UTC 2022


[AMD Official Use Only]

+ Deucher, Alexander

From: Zhang, Jesse(Jie)
Sent: Monday, 11 April 2022 11:15 pm
To: amd-gfx at lists.freedesktop.org
Cc: Huang, Ray <Ray.Huang at amd.com>; Zhang, Yifan <Yifan1.Zhang at amd.com>
Subject: [PATCH ] drm/amdgpu: fix discovery ip failed


[AMD Official Use Only]

Fix discovery ip failed, and the log:
   56.129549] [drm:amdgpu_discovery_validate_ip [amdgpu]] *ERROR* Unexpected number_instance (64) from ip discovery blob
[   56.130129] [drm:amdgpu_discovery_validate_ip [amdgpu]] *ERROR* Unexpected hw_id (45056) from ip discovery blob
[   56.130701] [drm:amdgpu_discovery_validate_ip [amdgpu]] *ERROR* Unexpected number_instance (66) from ip discovery blob
[   56.131283] [drm:amdgpu_discovery_validate_ip [amdgpu]] *ERROR* Unexpected hw_id (45568) from ip discovery blob
[   56.131855] [drm:amdgpu_discovery_validate_ip [amdgpu]] *ERROR* Unexpected number_instance (66) from ip discovery blob
[   56.132436] [drm:amdgpu_discovery_validate_ip [amdgpu]] *ERROR* Unexpected hw_id (480) from ip discovery blob
[   56.133053] [drm:amdgpu_discovery_validate_ip [amdgpu]] *ERROR* Unexpected hw_id (608) from ip discovery blob
[   56.133626] [drm:amdgpu_discovery_validate_ip [amdgpu]] *ERROR* Unexpected hw_id (640) from ip discovery blob
[   56.134207] [drm:amdgpu_discovery_validate_ip [amdgpu]] *ERROR* Unexpected number_instance (64) from ip discovery blob
[   56.134780] [drm:amdgpu_discovery_validate_ip [amdgpu]] *ERROR* Unexpected number_instance (64) from ip discovery blob
[   56.135360] [drm:amdgpu_discovery_validate_ip [amdgpu]] *ERROR* Unexpected hw_id (28672) from ip discovery blob

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
index 766006a075ec..a778b0392e9f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
@@ -798,7 +798,7 @@ static int amdgpu_discovery_sysfs_ips(struct amdgpu_device *adev,
                        res = kobject_add(&ip_hw_instance->kobj, NULL,
                                          "%d", ip_hw_instance->num_instance);
next_ip:
-                       ip_offset += sizeof(*ip) + 4 * (ip->num_base_address - 1);
+                       ip_offset += struct_size(ip, base_address, ip->num_base_address);
                }
        }

@@ -1063,7 +1063,7 @@ int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)
                        }

next_ip:
-                       ip_offset += sizeof(*ip) + 4 * (ip->num_base_address - 1);
+                       ip_offset += struct_size(ip, base_address, ip->num_base_address);
                }
        }

@@ -1113,7 +1113,7 @@ int amdgpu_discovery_get_ip_version(struct amdgpu_device *adev, int hw_id, int n
                                        *revision = ip->revision;
                                return 0;
                        }
-                       ip_offset += sizeof(*ip) + 4 * (ip->num_base_address - 1);
+                       ip_offset += struct_size(ip, base_address, ip->num_base_address);
                }
        }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20220411/0597502c/attachment-0001.htm>


More information about the amd-gfx mailing list