Skip to contentSkip to conversation

drm/amd: Adjust output for discovery error handling

PATCH Superseded Mario Limonciello 4 participants 6 messages Jun 13, 2025 – Jun 17, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd: Adjust output for discovery error handling

From: Mario Limonciello <[email protected]>

commit 017fbb6690c22 ("drm/amdgpu/discovery: check ip_discovery fw file available") added support for reading an amdgpu IP discovery bin file for some specific products. If it's not found then it will fallback to hardcoded values. However if it's not found there is also a lot of noise about missing files and errors.

Adjust the error handling to decrease most messages to DEBUG and to show at most one message to a user about the missing file at INFO level.

Fixes 017fbb6690c22 ("drm/amdgpu/discovery: check ip_discovery fw file available")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +6 -11
index a0e9bf9b27108..8e4526a8c2600 100644
@@ -321,10 +321,9 @@ static int amdgpu_discovery_read_binary_from_file(struct amdgpu_device *adev,
 	const struct firmware *fw;
 	int r;
 
-	r = request_firmware(&fw, fw_name, adev->dev);
+	r = firmware_request_nowarn(&fw, fw_name, adev->dev);
 	if (r) {
-		dev_err(adev->dev, "can't load firmware \"%s\"\n",
-			fw_name);
+		drm_info(&adev->ddev, "Optional firmware \"%s\" was not found\n", fw_name);
 		return r;
 	}
 
@@ -459,16 +458,12 @@ static int amdgpu_discovery_init(struct amdgpu_device *adev)
 	/* Read from file if it is the preferred option */
 	fw_name = amdgpu_discovery_get_fw_name(adev);
 	if (fw_name != NULL) {
-		dev_info(adev->dev, "use ip discovery information from file");
+		drm_dbg(&adev->ddev, "use ip discovery information from file");
 		r = amdgpu_discovery_read_binary_from_file(adev, adev->mman.discovery_bin, fw_name);
-
-		if (r) {
-			dev_err(adev->dev, "failed to read ip discovery binary from file\n");
-			r = -EINVAL;
+		if (r)
 			goto out;
-		}
-
 	} else {
+		drm_dbg(&adev->ddev, "use ip discovery information from memory");
 		r = amdgpu_discovery_read_binary_from_mem(
 			adev, adev->mman.discovery_bin);
 		if (r)
@@ -1339,7 +1334,7 @@ static int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)
 
 	r = amdgpu_discovery_init(adev);
 	if (r) {
-		DRM_ERROR("amdgpu_discovery_init failed\n");
+		drm_warn(&adev->ddev, "%s failed: %d\n", __func__, r);
 		return r;
 	}
 
Signature · 1 line
2.43.0
#1 lore raw
Quoted 8 lines · Mario Limonciello

From: Mario Limonciello <[email protected]>

commit 017fbb6690c22 ("drm/amdgpu/discovery: check ip_discovery fw file available") added support for reading an amdgpu IP discovery bin file for some specific products. If it's not found then it will fallback to hardcoded values. However if it's not found there is also a lot of noise about missing files and errors.

Quoted 4 lines

Adjust the error handling to decrease most messages to DEBUG and to show at most one message to a user about the missing file at INFO level.

Reported-and-tested-by Marcus Seyfarth <[email protected]>?

Quoted 52 lines
Fixes 017fbb6690c22 ("drm/amdgpu/discovery: check ip_discovery fw file available")
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 17 ++++++-----------
  1 file changed, 6 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +6 -11
index a0e9bf9b27108..8e4526a8c2600 100644
@@ -321,10 +321,9 @@ static int amdgpu_discovery_read_binary_from_file(struct amdgpu_device *adev,
  	const struct firmware *fw;
  	int r;
 
-	r = request_firmware(&fw, fw_name, adev->dev);
+	r = firmware_request_nowarn(&fw, fw_name, adev->dev);
  	if (r) {
-		dev_err(adev->dev, "can't load firmware \"%s\"\n",
-			fw_name);
+		drm_info(&adev->ddev, "Optional firmware \"%s\" was not found\n", fw_name);
  		return r;
  	}
 
@@ -459,16 +458,12 @@ static int amdgpu_discovery_init(struct amdgpu_device *adev)
  	/* Read from file if it is the preferred option */
  	fw_name = amdgpu_discovery_get_fw_name(adev);
  	if (fw_name != NULL) {
-		dev_info(adev->dev, "use ip discovery information from file");
+		drm_dbg(&adev->ddev, "use ip discovery information from file");
  		r = amdgpu_discovery_read_binary_from_file(adev, adev->mman.discovery_bin, fw_name);
-
-		if (r) {
-			dev_err(adev->dev, "failed to read ip discovery binary from file\n");
-			r = -EINVAL;
+		if (r)
  			goto out;
-		}
-
  	} else {
+		drm_dbg(&adev->ddev, "use ip discovery information from memory");
  		r = amdgpu_discovery_read_binary_from_mem(
  			adev, adev->mman.discovery_bin);
  		if (r)
@@ -1339,7 +1334,7 @@ static int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)
 
  	r = amdgpu_discovery_init(adev);
  	if (r) {
-		DRM_ERROR("amdgpu_discovery_init failed\n");
+		drm_warn(&adev->ddev, "%s failed: %d\n", __func__, r);
  		return r;
  	}
 
#2 lore raw

Thanks for fixing this, Mario! If this optional firmware file could be made available so that Linux distros could pick it up, this would be great.

Am Fr., 13. Juni 2025 um 23:56 Uhr schrieb Mario Limonciello < [email protected]>:

Quoted 79 lines · Mario Limonciello
Quoted 8 lines

From: Mario Limonciello <[email protected]>

commit 017fbb6690c22 ("drm/amdgpu/discovery: check ip_discovery fw file available") added support for reading an amdgpu IP discovery bin file for some specific products. If it's not found then it will fallback to hardcoded values. However if it's not found there is also a lot of noise about missing files and errors.

Quoted 4 lines

Adjust the error handling to decrease most messages to DEBUG and to show at most one message to a user about the missing file at INFO level.

Reported-and-tested-by Marcus Seyfarth <[email protected]>?

Quoted 1 line
Fixes 017fbb6690c22 ("drm/amdgpu/discovery: check ip_discovery fw file

available")

Review

Quoted 6 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 17 ++++++-----------
  1 file changed, 6 insertions(+), 11 deletions(-)
(quoted diff) +0 -0

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

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c static int

Quoted 4 lines

index a0e9bf9b27108..8e4526a8c2600 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +0 -0
@@ -321,10 +321,9 @@ static int

amdgpu_discovery_read_binary_from_file(struct amdgpu_device *adev,

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

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +2 -3
      const struct firmware *fw;
      int r;
 
-     r = request_firmware(&fw, fw_name, adev->dev);
+     r = firmware_request_nowarn(&fw, fw_name, adev->dev);
      if (r) {
-             dev_err(adev->dev, "can't load firmware \"%s\"\n",
-                     fw_name);
+             drm_info(&adev->ddev, "Optional firmware \"%s\" was not

found\n", fw_name);

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c static int amdgpu_discovery_init(struct

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +0 -0
              return r;
      }
 
@@ -459,16 +458,12 @@ static int amdgpu_discovery_init(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c static int amdgpu_discovery_init(struct amdgpu_device *adev)

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +0 -1
      /* Read from file if it is the preferred option */
      fw_name = amdgpu_discovery_get_fw_name(adev);
      if (fw_name != NULL) {
-             dev_info(adev->dev, "use ip discovery information from

file");

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c static int amdgpu_discovery_init(struct · line 461

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -0
+             drm_dbg(&adev->ddev, "use ip discovery information from

file");

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c static int amdgpu_discovery_init(struct · line 462

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +0 -0
              r = amdgpu_discovery_read_binary_from_file(adev,

adev->mman.discovery_bin, fw_name);

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c static int amdgpu_discovery_init(struct amdgpu_device *adev)

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +0 -3
-
-             if (r) {
-                     dev_err(adev->dev, "failed to read ip discovery

binary from file\n");

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c static int amdgpu_discovery_init(struct amdgpu_device *adev)

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +2 -3
-                     r = -EINVAL;
+             if (r)
                      goto out;
-             }
-
      } else {
+             drm_dbg(&adev->ddev, "use ip discovery information from

memory");

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c static int amdgpu_discovery_reg_base_init(struct

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +0 -0
              r = amdgpu_discovery_read_binary_from_mem(
                      adev, adev->mman.discovery_bin);
              if (r)
@@ -1339,7 +1334,7 @@ static int amdgpu_discovery_reg_base_init(struct

amdgpu_device *adev)

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -1
      r = amdgpu_discovery_init(adev);
      if (r) {
-             DRM_ERROR("amdgpu_discovery_init failed\n");
+             drm_warn(&adev->ddev, "%s failed: %d\n", __func__, r);
              return r;
      }
 
#3 lore raw
In reply to Mario Limonciello
Quoted 56 lines · Mario Limonciello

From: Mario Limonciello <[email protected]>

commit 017fbb6690c22 ("drm/amdgpu/discovery: check ip_discovery fw file available") added support for reading an amdgpu IP discovery bin file for some specific products. If it's not found then it will fallback to hardcoded values. However if it's not found there is also a lot of noise about missing files and errors.

Adjust the error handling to decrease most messages to DEBUG and to show at most one message to a user about the missing file at INFO level.

Fixes 017fbb6690c22 ("drm/amdgpu/discovery: check ip_discovery fw file available")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +5 -10
index a0e9bf9b27108..8e4526a8c2600 100644
@@ -321,10 +321,9 @@ static int amdgpu_discovery_read_binary_from_file(struct amdgpu_device *adev,
 	const struct firmware *fw;
 	int r;
 
-	r = request_firmware(&fw, fw_name, adev->dev);
+	r = firmware_request_nowarn(&fw, fw_name, adev->dev);
 	if (r) {
-		dev_err(adev->dev, "can't load firmware \"%s\"\n",
-			fw_name);
+		drm_info(&adev->ddev, "Optional firmware \"%s\" was not found\n", fw_name);
 		return r;
 	}
 
@@ -459,16 +458,12 @@ static int amdgpu_discovery_init(struct amdgpu_device *adev)
 	/* Read from file if it is the preferred option */
 	fw_name = amdgpu_discovery_get_fw_name(adev);
 	if (fw_name != NULL) {
-		dev_info(adev->dev, "use ip discovery information from file");
+		drm_dbg(&adev->ddev, "use ip discovery information from file");
 		r = amdgpu_discovery_read_binary_from_file(adev, adev->mman.discovery_bin, fw_name);
-
-		if (r) {
-			dev_err(adev->dev, "failed to read ip discovery binary from file\n");
-			r = -EINVAL;
+		if (r)
 			goto out;
-		}
-
 	} else {
+		drm_dbg(&adev->ddev, "use ip discovery information from memory");
 		r = amdgpu_discovery_read_binary_from_mem(
 			adev, adev->mman.discovery_bin);
 		if (r)

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c static int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev) · line 1337

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -1
@@ -1339,7 +1334,7 @@ static int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)
 
 	r = amdgpu_discovery_init(adev);
 	if (r) {
-		DRM_ERROR("amdgpu_discovery_init failed\n");
+		drm_warn(&adev->ddev, "%s failed: %d\n", __func__, r);

This indeed is an error. Rest of the changes are fine.

Thanks,
Lijo

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +0 -0
 		return r;
 	}
 
#4 lore raw
Quoted 60 lines · Lijo
Quoted 57 lines · Mario Limonciello

From: Mario Limonciello <[email protected]>

commit 017fbb6690c22 ("drm/amdgpu/discovery: check ip_discovery fw file available") added support for reading an amdgpu IP discovery bin file for some specific products. If it's not found then it will fallback to hardcoded values. However if it's not found there is also a lot of noise about missing files and errors.

Adjust the error handling to decrease most messages to DEBUG and to show at most one message to a user about the missing file at INFO level.

Fixes 017fbb6690c22 ("drm/amdgpu/discovery: check ip_discovery fw file available")
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 17 ++++++-----------
  1 file changed, 6 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +5 -10
index a0e9bf9b27108..8e4526a8c2600 100644
@@ -321,10 +321,9 @@ static int amdgpu_discovery_read_binary_from_file(struct amdgpu_device *adev,
  	const struct firmware *fw;
  	int r;
 
-	r = request_firmware(&fw, fw_name, adev->dev);
+	r = firmware_request_nowarn(&fw, fw_name, adev->dev);
  	if (r) {
-		dev_err(adev->dev, "can't load firmware \"%s\"\n",
-			fw_name);
+		drm_info(&adev->ddev, "Optional firmware \"%s\" was not found\n", fw_name);
  		return r;
  	}
 
@@ -459,16 +458,12 @@ static int amdgpu_discovery_init(struct amdgpu_device *adev)
  	/* Read from file if it is the preferred option */
  	fw_name = amdgpu_discovery_get_fw_name(adev);
  	if (fw_name != NULL) {
-		dev_info(adev->dev, "use ip discovery information from file");
+		drm_dbg(&adev->ddev, "use ip discovery information from file");
  		r = amdgpu_discovery_read_binary_from_file(adev, adev->mman.discovery_bin, fw_name);
-
-		if (r) {
-			dev_err(adev->dev, "failed to read ip discovery binary from file\n");
-			r = -EINVAL;
+		if (r)
  			goto out;
-		}
-
  	} else {
+		drm_dbg(&adev->ddev, "use ip discovery information from memory");
  		r = amdgpu_discovery_read_binary_from_mem(
  			adev, adev->mman.discovery_bin);
  		if (r)
@@ -1339,7 +1334,7 @@ static int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)
 
Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c static int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev) · line 1337

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -1
  	r = amdgpu_discovery_init(adev);
  	if (r) {
-		DRM_ERROR("amdgpu_discovery_init failed\n");
+		drm_warn(&adev->ddev, "%s failed: %d\n", __func__, r);

This indeed is an error. Rest of the changes are fine.

How about pushing this down into amdgpu_discovery_set_ip_blocks()?
I was thinking we can put it in the default case only so that the fallback path doesn't make a lot of noise for vega/raven/arcturus/aldebaran.

Something like this:

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +5 -5
index 3877b43d9f863..d5bd105de1b31 100644
@@ -1333,10 +1333,8 @@ static int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)
        int r;
 
        r = amdgpu_discovery_init(adev);
-       if (r) {
-               DRM_ERROR("amdgpu_discovery_init failed\n");
+       if (r)
                return r;
-       }
 
        wafl_ver = 0;
        adev->gfx.xcc_mask = 0;
@@ -2574,8 +2572,10 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
                break;
        default:
                r = amdgpu_discovery_reg_base_init(adev);
-               if (r)
-                       return -EINVAL;
+               if (r) {
+                       drm_err(&adev->ddev, "discovery failed: %d\n", ret);
+                       return r;
+               }
 
                amdgpu_discovery_harvest_ip(adev);
                amdgpu_discovery_get_gfx_info(adev);
Quoted 8 lines

Thanks,
Lijo

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +0 -0
  		return r;
  	}
 
#5 lore raw
Quoted 103 lines · Mario Limonciello
Quoted 64 lines · Lijo
Quoted 61 lines · Mario Limonciello

From: Mario Limonciello <[email protected]>

commit 017fbb6690c22 ("drm/amdgpu/discovery: check ip_discovery fw file available") added support for reading an amdgpu IP discovery bin file for some specific products. If it's not found then it will fallback to hardcoded values. However if it's not found there is also a lot of noise about missing files and errors.

Adjust the error handling to decrease most messages to DEBUG and to show at most one message to a user about the missing file at INFO level.

Fixes 017fbb6690c22 ("drm/amdgpu/discovery: check ip_discovery fw

file available")

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 17 ++++++-----------

  1 file changed, 6 insertions(+), 11 deletions(-)
drivers/ renamed from drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +0 -0

gpu/drm/amd/amdgpu/amdgpu_discovery.c
index a0e9bf9b27108..8e4526a8c2600 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +2 -2
@@ -321,10 +321,9 @@ static int
 amdgpu_discovery_read_binary_from_file(struct amdgpu_device *adev,
       const struct firmware *fw;
       int r;
   -    r = request_firmware(&fw, fw_name, adev->dev);
+    r = firmware_request_nowarn(&fw, fw_name, adev->dev);
       if (r) {
-        dev_err(adev->dev, "can't load firmware \"%s\"\n",
-            fw_name);
+        drm_info(&adev->ddev, "Optional firmware \"%s\" was not
 found\n", fw_name);
           return r;

      }
  @@ -459,16 +458,12 @@ static int amdgpu_discovery_init(struct amdgpu_device *adev)
      /* Read from file if it is the preferred option */ fw_name = amdgpu_discovery_get_fw_name(adev);
      if (fw_name != NULL) {
-        dev_info(adev->dev, "use ip discovery information from file"); +        drm_dbg(&adev->ddev, "use ip discovery information from file"); r = amdgpu_discovery_read_binary_from_file(adev, adev-

Quoted 1 line

mman.discovery_bin, fw_name);

-
-        if (r) {
-            dev_err(adev->dev, "failed to read ip discovery binary from file\n");
-            r = -EINVAL;
+        if (r)
              goto out;
-        }
-
      } else {
+        drm_dbg(&adev->ddev, "use ip discovery information from memory");
          r = amdgpu_discovery_read_binary_from_mem( adev, adev->mman.discovery_bin);
          if (r)

Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c static int · line 1337

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -1
@@ -1339,7 +1334,7 @@ static int
 amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)
         r = amdgpu_discovery_init(adev);
       if (r) {
-        DRM_ERROR("amdgpu_discovery_init failed\n");
+        drm_warn(&adev->ddev, "%s failed: %d\n", __func__, r);

This indeed is an error. Rest of the changes are fine.

How about pushing this down into amdgpu_discovery_set_ip_blocks()? I was thinking we can put it in the default case only so that the fallback path doesn't make a lot of noise for vega/raven/arcturus/ aldebaran.

Something like this:

drivers/ renamed from drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +0 -0

gpu/drm/amd/amdgpu/amdgpu_discovery.c
index 3877b43d9f863..d5bd105de1b31 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -3
@@ -1333,10 +1333,8 @@ static int amdgpu_discovery_reg_base_init(struct
 amdgpu_device *adev)
         int r;
 
         r = amdgpu_discovery_init(adev);
-       if (r) {
-               DRM_ERROR("amdgpu_discovery_init failed\n");
+       if (r)
                 return r;
-       }
 
         wafl_ver = 0;

        adev->gfx.xcc_mask = 0;

drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +0 -0
@@ -2574,8 +2572,10 @@ int amdgpu_discovery_set_ip_blocks(struct
 amdgpu_device *adev)
                 break;

        default:

Quoted 9 lines

                r = amdgpu_discovery_reg_base_init(adev);
-               if (r)
-                       return -EINVAL;
+               if (r) {
+                       drm_err(&adev->ddev, "discovery failed: %d\n", ret);
+                       return r;
+               }

Yes, looks fine.

Thanks,
Lijo

Quoted 14 lines

                amdgpu_discovery_harvest_ip(adev); amdgpu_discovery_get_gfx_info(adev);

Quoted 8 lines

Thanks,
Lijo

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +0 -0
           return r;
       }