All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Alex Deucher <alexander.deucher@amd.com>, <linux-kernel@vger.kernel.org>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>,
	Lazar Lijo <Lijo.Lazar@amd.com>,
	Javier Martinez Canillas <javierm@redhat.com>,
	dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
	Carlos Soriano Sanchez <csoriano@redhat.com>,
	christian.koenig@amd.com,
	Mario Limonciello <mario.limonciello@amd.com>
Subject: [PATCH v4 18/27] drm/amd: Use `amdgpu_ucode_load` helper for GFX11
Date: Tue, 3 Jan 2023 16:18:37 -0600	[thread overview]
Message-ID: <20230103221852.22813-19-mario.limonciello@amd.com> (raw)
In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com>

The `amdgpu_ucode_load` helper will ensure that the return code for
missing firmware is -ENODEV so that early_init can fail.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v3->v4:
 * New patch
---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
index a56c6e106d00..0c77d165caf7 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
@@ -457,10 +457,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 	amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
 
 	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", ucode_prefix);
-	err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
-	if (err)
-		goto out;
-	err = amdgpu_ucode_validate(adev->gfx.pfp_fw);
+	err = amdgpu_ucode_load(adev, &adev->gfx.pfp_fw, fw_name);
 	if (err)
 		goto out;
 	/* check pfp fw hdr version to decide if enable rs64 for gfx11.*/
@@ -477,10 +474,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 	}
 
 	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", ucode_prefix);
-	err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
-	if (err)
-		goto out;
-	err = amdgpu_ucode_validate(adev->gfx.me_fw);
+	err = amdgpu_ucode_load(adev, &adev->gfx.me_fw, fw_name);
 	if (err)
 		goto out;
 	if (adev->gfx.rs64_enable) {
@@ -493,10 +487,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 
 	if (!amdgpu_sriov_vf(adev)) {
 		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", ucode_prefix);
-		err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
-		if (err)
-			goto out;
-		err = amdgpu_ucode_validate(adev->gfx.rlc_fw);
+		err = amdgpu_ucode_load(adev, &adev->gfx.rlc_fw, fw_name);
 		if (err)
 			goto out;
 		rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;
@@ -508,10 +499,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 	}
 
 	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", ucode_prefix);
-	err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
-	if (err)
-		goto out;
-	err = amdgpu_ucode_validate(adev->gfx.mec_fw);
+	err = amdgpu_ucode_load(adev, &adev->gfx.mec_fw, fw_name);
 	if (err)
 		goto out;
 	if (adev->gfx.rs64_enable) {
@@ -530,9 +518,6 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 
 out:
 	if (err) {
-		dev_err(adev->dev,
-			"gfx11: Failed to init firmware \"%s\"\n",
-			fw_name);
 		release_firmware(adev->gfx.pfp_fw);
 		adev->gfx.pfp_fw = NULL;
 		release_firmware(adev->gfx.me_fw);
-- 
2.34.1


WARNING: multiple messages have this Message-ID (diff)
From: Mario Limonciello <mario.limonciello@amd.com>
To: Alex Deucher <alexander.deucher@amd.com>, <linux-kernel@vger.kernel.org>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>,
	Lazar Lijo <Lijo.Lazar@amd.com>,
	Javier Martinez Canillas <javierm@redhat.com>,
	dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
	Daniel Vetter <daniel@ffwll.ch>,
	Carlos Soriano Sanchez <csoriano@redhat.com>,
	David Airlie <airlied@gmail.com>,
	christian.koenig@amd.com,
	Mario Limonciello <mario.limonciello@amd.com>
Subject: [PATCH v4 18/27] drm/amd: Use `amdgpu_ucode_load` helper for GFX11
Date: Tue, 3 Jan 2023 16:18:37 -0600	[thread overview]
Message-ID: <20230103221852.22813-19-mario.limonciello@amd.com> (raw)
In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com>

The `amdgpu_ucode_load` helper will ensure that the return code for
missing firmware is -ENODEV so that early_init can fail.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v3->v4:
 * New patch
---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
index a56c6e106d00..0c77d165caf7 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
@@ -457,10 +457,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 	amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
 
 	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", ucode_prefix);
-	err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
-	if (err)
-		goto out;
-	err = amdgpu_ucode_validate(adev->gfx.pfp_fw);
+	err = amdgpu_ucode_load(adev, &adev->gfx.pfp_fw, fw_name);
 	if (err)
 		goto out;
 	/* check pfp fw hdr version to decide if enable rs64 for gfx11.*/
@@ -477,10 +474,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 	}
 
 	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", ucode_prefix);
-	err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
-	if (err)
-		goto out;
-	err = amdgpu_ucode_validate(adev->gfx.me_fw);
+	err = amdgpu_ucode_load(adev, &adev->gfx.me_fw, fw_name);
 	if (err)
 		goto out;
 	if (adev->gfx.rs64_enable) {
@@ -493,10 +487,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 
 	if (!amdgpu_sriov_vf(adev)) {
 		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", ucode_prefix);
-		err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
-		if (err)
-			goto out;
-		err = amdgpu_ucode_validate(adev->gfx.rlc_fw);
+		err = amdgpu_ucode_load(adev, &adev->gfx.rlc_fw, fw_name);
 		if (err)
 			goto out;
 		rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;
@@ -508,10 +499,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 	}
 
 	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", ucode_prefix);
-	err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
-	if (err)
-		goto out;
-	err = amdgpu_ucode_validate(adev->gfx.mec_fw);
+	err = amdgpu_ucode_load(adev, &adev->gfx.mec_fw, fw_name);
 	if (err)
 		goto out;
 	if (adev->gfx.rs64_enable) {
@@ -530,9 +518,6 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 
 out:
 	if (err) {
-		dev_err(adev->dev,
-			"gfx11: Failed to init firmware \"%s\"\n",
-			fw_name);
 		release_firmware(adev->gfx.pfp_fw);
 		adev->gfx.pfp_fw = NULL;
 		release_firmware(adev->gfx.me_fw);
-- 
2.34.1


WARNING: multiple messages have this Message-ID (diff)
From: Mario Limonciello <mario.limonciello@amd.com>
To: Alex Deucher <alexander.deucher@amd.com>, <linux-kernel@vger.kernel.org>
Cc: Javier Martinez Canillas <javierm@redhat.com>,
	Carlos Soriano Sanchez <csoriano@redhat.com>,
	<amd-gfx@lists.freedesktop.org>,
	<dri-devel@lists.freedesktop.org>,
	David Airlie <airlied@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>, <christian.koenig@amd.com>,
	Lazar Lijo <Lijo.Lazar@amd.com>,
	Mario Limonciello <mario.limonciello@amd.com>,
	"Pan, Xinhui" <Xinhui.Pan@amd.com>
Subject: [PATCH v4 18/27] drm/amd: Use `amdgpu_ucode_load` helper for GFX11
Date: Tue, 3 Jan 2023 16:18:37 -0600	[thread overview]
Message-ID: <20230103221852.22813-19-mario.limonciello@amd.com> (raw)
In-Reply-To: <20230103221852.22813-1-mario.limonciello@amd.com>

The `amdgpu_ucode_load` helper will ensure that the return code for
missing firmware is -ENODEV so that early_init can fail.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v3->v4:
 * New patch
---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
index a56c6e106d00..0c77d165caf7 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
@@ -457,10 +457,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 	amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
 
 	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", ucode_prefix);
-	err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
-	if (err)
-		goto out;
-	err = amdgpu_ucode_validate(adev->gfx.pfp_fw);
+	err = amdgpu_ucode_load(adev, &adev->gfx.pfp_fw, fw_name);
 	if (err)
 		goto out;
 	/* check pfp fw hdr version to decide if enable rs64 for gfx11.*/
@@ -477,10 +474,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 	}
 
 	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", ucode_prefix);
-	err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
-	if (err)
-		goto out;
-	err = amdgpu_ucode_validate(adev->gfx.me_fw);
+	err = amdgpu_ucode_load(adev, &adev->gfx.me_fw, fw_name);
 	if (err)
 		goto out;
 	if (adev->gfx.rs64_enable) {
@@ -493,10 +487,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 
 	if (!amdgpu_sriov_vf(adev)) {
 		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", ucode_prefix);
-		err = request_firmware(&adev->gfx.rlc_fw, fw_name, adev->dev);
-		if (err)
-			goto out;
-		err = amdgpu_ucode_validate(adev->gfx.rlc_fw);
+		err = amdgpu_ucode_load(adev, &adev->gfx.rlc_fw, fw_name);
 		if (err)
 			goto out;
 		rlc_hdr = (const struct rlc_firmware_header_v2_0 *)adev->gfx.rlc_fw->data;
@@ -508,10 +499,7 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 	}
 
 	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", ucode_prefix);
-	err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
-	if (err)
-		goto out;
-	err = amdgpu_ucode_validate(adev->gfx.mec_fw);
+	err = amdgpu_ucode_load(adev, &adev->gfx.mec_fw, fw_name);
 	if (err)
 		goto out;
 	if (adev->gfx.rs64_enable) {
@@ -530,9 +518,6 @@ static int gfx_v11_0_init_microcode(struct amdgpu_device *adev)
 
 out:
 	if (err) {
-		dev_err(adev->dev,
-			"gfx11: Failed to init firmware \"%s\"\n",
-			fw_name);
 		release_firmware(adev->gfx.pfp_fw);
 		adev->gfx.pfp_fw = NULL;
 		release_firmware(adev->gfx.me_fw);
-- 
2.34.1


  parent reply	other threads:[~2023-01-03 22:20 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-03 22:18 [PATCH v4 00/27] Recover from failure to probe GPU Mario Limonciello
2023-01-03 22:18 ` Mario Limonciello
2023-01-03 22:18 ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 01/27] drm/amd: Delay removal of the firmware framebuffer Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 02/27] drm/amd: Add a legacy mapping to "amdgpu_ucode_ip_version_decode" Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 03/27] drm/amd: Convert SMUv11 microcode to use `amdgpu_ucode_ip_version_decode` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 04/27] drm/amd: Convert SMUv13 " Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 05/27] drm/amd: Add a new helper for loading/validating microcode Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-04  4:53   ` Lazar, Lijo
2023-01-04  4:53     ` Lazar, Lijo
2023-01-04  4:53     ` Lazar, Lijo
2023-01-04  9:37     ` Christian König
2023-01-04  9:37       ` Christian König
2023-01-04  9:37       ` Christian König
2023-01-03 22:18 ` [PATCH v4 06/27] drm/amd: Use `amdgpu_ucode_load` helper for SDMA Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 07/27] drm/amd: Convert SDMA to use `amdgpu_ucode_ip_version_decode` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-04  4:54   ` Lazar, Lijo
2023-01-04  4:54     ` Lazar, Lijo
2023-01-04  4:54     ` Lazar, Lijo
2023-01-03 22:18 ` [PATCH v4 08/27] drm/amd: Make SDMA firmware load failures less noisy Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 09/27] drm/amd: Use `amdgpu_ucode_load` helper for VCN Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 10/27] drm/amd: Load VCN microcode during early_init Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 11/27] drm/amd: Load MES " Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 12/27] drm/amd: Use `amdgpu_ucode_load` helper for MES Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 13/27] drm/amd: Remove superfluous assignment for `adev->mes.adev` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 14/27] drm/amd: Use `amdgpu_ucode_load` helper for GFX9 Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 15/27] drm/amd: Load GFX9 microcode during early_init Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 16/27] drm/amd: Use `amdgpu_ucode_load` helper for GFX10 Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 17/27] drm/amd: Load GFX10 microcode during early_init Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` Mario Limonciello [this message]
2023-01-03 22:18   ` [PATCH v4 18/27] drm/amd: Use `amdgpu_ucode_load` helper for GFX11 Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 19/27] drm/amd: Load GFX11 microcode during early_init Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 20/27] drm/amd: Parse both v1 and v2 TA microcode headers using same function Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 21/27] drm/amd: Avoid BUG() for case of SRIOV missing IP version Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 22/27] drm/amd: Load PSP microcode during early_init Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 23/27] drm/amd: Use `amdgpu_ucode_load` helper for PSP Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 24/27] drm/amd/display: Load DMUB microcode during early_init Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-04 15:52   ` Harry Wentland
2023-01-04 15:52     ` Harry Wentland
2023-01-04 15:52     ` Harry Wentland
2023-01-03 22:18 ` [PATCH v4 25/27] drm/amd: Use `amdgpu_ucode_load` helper for SMU Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 26/27] drm/amd: Load SMU microcode during early_init Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18 ` [PATCH v4 27/27] drm/amd: Optimize SRIOV switch/case for PSP microcode load Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-03 22:18   ` Mario Limonciello
2023-01-04 13:18   ` Christian König
2023-01-04 13:18     ` Christian König
2023-01-04 13:18     ` Christian König
2023-01-04 15:42     ` Limonciello, Mario
2023-01-04 15:42       ` Limonciello, Mario
2023-01-04 15:42       ` Limonciello, Mario

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230103221852.22813-19-mario.limonciello@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=Lijo.Lazar@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=csoriano@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.