]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amdgpu/discovery: fix fw based ip discovery
authorAlex Deucher <alexander.deucher@amd.com>
Wed, 30 Jul 2025 15:16:05 +0000 (11:16 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:31:02 +0000 (16:31 +0200)
commit 514678da56da089b756b4d433efd964fa22b2079 upstream.

We only need the fw based discovery table for sysfs.  No
need to parse it.  Additionally parsing some of the board
specific tables may result in incorrect data on some boards.
just load the binary and don't parse it on those boards.

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4441
Fixes: 80a0e8282933 ("drm/amdgpu/discovery: optionally use fw based ip discovery")
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 62eedd150fa11aefc2d377fc746633fdb1baeb55)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c

index 8cf224fd4ff28a42e604415bca05d3935d148e88..373c626247a1a86fe3b74410d5df6eb6afdb4a5c 100644 (file)
@@ -2387,9 +2387,6 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
 
        adev->firmware.gpu_info_fw = NULL;
 
-       if (adev->mman.discovery_bin)
-               return 0;
-
        switch (adev->asic_type) {
        default:
                return 0;
@@ -2411,6 +2408,8 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
                chip_name = "arcturus";
                break;
        case CHIP_NAVI12:
+               if (adev->mman.discovery_bin)
+                       return 0;
                chip_name = "navi12";
                break;
        }
index 60398a2579e3ce7dcb2047b2cbf18e65e43caf1a..6042956cd5c3c10e102fd79163ae3dafcdca3763 100644 (file)
@@ -2455,40 +2455,11 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
 
        switch (adev->asic_type) {
        case CHIP_VEGA10:
-       case CHIP_VEGA12:
-       case CHIP_RAVEN:
-       case CHIP_VEGA20:
-       case CHIP_ARCTURUS:
-       case CHIP_ALDEBARAN:
-               /* this is not fatal.  We have a fallback below
-                * if the new firmwares are not present. some of
-                * this will be overridden below to keep things
-                * consistent with the current behavior.
+               /* This is not fatal.  We only need the discovery
+                * binary for sysfs.  We don't need it for a
+                * functional system.
                 */
-               r = amdgpu_discovery_reg_base_init(adev);
-               if (!r) {
-                       amdgpu_discovery_harvest_ip(adev);
-                       amdgpu_discovery_get_gfx_info(adev);
-                       amdgpu_discovery_get_mall_info(adev);
-                       amdgpu_discovery_get_vcn_info(adev);
-               }
-               break;
-       default:
-               r = amdgpu_discovery_reg_base_init(adev);
-               if (r) {
-                       drm_err(&adev->ddev, "discovery failed: %d\n", r);
-                       return r;
-               }
-
-               amdgpu_discovery_harvest_ip(adev);
-               amdgpu_discovery_get_gfx_info(adev);
-               amdgpu_discovery_get_mall_info(adev);
-               amdgpu_discovery_get_vcn_info(adev);
-               break;
-       }
-
-       switch (adev->asic_type) {
-       case CHIP_VEGA10:
+               amdgpu_discovery_init(adev);
                vega10_reg_base_init(adev);
                adev->sdma.num_instances = 2;
                adev->gmc.num_umc = 4;
@@ -2511,6 +2482,11 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
                adev->ip_versions[DCI_HWIP][0] = IP_VERSION(12, 0, 0);
                break;
        case CHIP_VEGA12:
+               /* This is not fatal.  We only need the discovery
+                * binary for sysfs.  We don't need it for a
+                * functional system.
+                */
+               amdgpu_discovery_init(adev);
                vega10_reg_base_init(adev);
                adev->sdma.num_instances = 2;
                adev->gmc.num_umc = 4;
@@ -2533,6 +2509,11 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
                adev->ip_versions[DCI_HWIP][0] = IP_VERSION(12, 0, 1);
                break;
        case CHIP_RAVEN:
+               /* This is not fatal.  We only need the discovery
+                * binary for sysfs.  We don't need it for a
+                * functional system.
+                */
+               amdgpu_discovery_init(adev);
                vega10_reg_base_init(adev);
                adev->sdma.num_instances = 1;
                adev->vcn.num_vcn_inst = 1;
@@ -2572,6 +2553,11 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
                }
                break;
        case CHIP_VEGA20:
+               /* This is not fatal.  We only need the discovery
+                * binary for sysfs.  We don't need it for a
+                * functional system.
+                */
+               amdgpu_discovery_init(adev);
                vega20_reg_base_init(adev);
                adev->sdma.num_instances = 2;
                adev->gmc.num_umc = 8;
@@ -2595,6 +2581,11 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
                adev->ip_versions[DCI_HWIP][0] = IP_VERSION(12, 1, 0);
                break;
        case CHIP_ARCTURUS:
+               /* This is not fatal.  We only need the discovery
+                * binary for sysfs.  We don't need it for a
+                * functional system.
+                */
+               amdgpu_discovery_init(adev);
                arct_reg_base_init(adev);
                adev->sdma.num_instances = 8;
                adev->vcn.num_vcn_inst = 2;
@@ -2623,6 +2614,11 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
                adev->ip_versions[UVD_HWIP][1] = IP_VERSION(2, 5, 0);
                break;
        case CHIP_ALDEBARAN:
+               /* This is not fatal.  We only need the discovery
+                * binary for sysfs.  We don't need it for a
+                * functional system.
+                */
+               amdgpu_discovery_init(adev);
                aldebaran_reg_base_init(adev);
                adev->sdma.num_instances = 5;
                adev->vcn.num_vcn_inst = 2;
@@ -2649,6 +2645,16 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
                adev->ip_versions[XGMI_HWIP][0] = IP_VERSION(6, 1, 0);
                break;
        default:
+               r = amdgpu_discovery_reg_base_init(adev);
+               if (r) {
+                       drm_err(&adev->ddev, "discovery failed: %d\n", r);
+                       return r;
+               }
+
+               amdgpu_discovery_harvest_ip(adev);
+               amdgpu_discovery_get_gfx_info(adev);
+               amdgpu_discovery_get_mall_info(adev);
+               amdgpu_discovery_get_vcn_info(adev);
                break;
        }