Skip to contentSkip to conversation

drm/amdgpu: support polaris10/11/12 new cp firmwares

PATCH In review Evan Quan 2 participants 4 messages Aug 21, 2017 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 2/2 drm/amdgpu: support polaris10/11/12 new cp firmwares

Newer versions of the CP firmware require changes in how the driver initializes the hw block.
Change the firmware name for new firmware to maintain compatibility with older kernels.

Change-Id I32e3382768a2d9ff1e2978bcadb3bd44afb3db01
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 65 +++++++++++++++++++++++++++++------
 1 file changed, 55 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +55 -10
index 38f70a1..6f2901a 100644
@@ -918,8 +918,17 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 		BUG();
 	}
 
-	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name);
-	err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
+	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp_2.bin", chip_name);
+		err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
+		if (err == -ENOENT) {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name);
+			err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
+		}
+	} else {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name);
+		err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
+	}
 	if (err)
 		goto out;
 	err = amdgpu_ucode_validate(adev->gfx.pfp_fw);
@@ -929,8 +938,17 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 	adev->gfx.pfp_fw_version = le32_to_cpu(cp_hdr->header.ucode_version);
 	adev->gfx.pfp_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
-	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);
-	err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
+	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me_2.bin", chip_name);
+		err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
+		if (err == -ENOENT) {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);
+			err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
+		}
+	} else {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);
+		err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
+	}
 	if (err)
 		goto out;
 	err = amdgpu_ucode_validate(adev->gfx.me_fw);
@@ -941,8 +959,17 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 
 	adev->gfx.me_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
-	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);
-	err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
+	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce_2.bin", chip_name);
+		err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
+		if (err == -ENOENT) {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);
+			err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
+		}
+	} else {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);
+		err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
+	}
 	if (err)
 		goto out;
 	err = amdgpu_ucode_validate(adev->gfx.ce_fw);
@@ -1012,8 +1039,17 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 	for (i = 0 ; i < (rlc_hdr->reg_list_size_bytes >> 2); i++)
 		adev->gfx.rlc.register_restore[i] = le32_to_cpu(tmp[i]);
 
-	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
-	err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
+	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec_2.bin", chip_name);
+		err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
+		if (err == -ENOENT) {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
+			err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
+		}
+	} else {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
+		err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
+	}
 	if (err)
 		goto out;
 	err = amdgpu_ucode_validate(adev->gfx.mec_fw);
@@ -1025,8 +1061,17 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 
 	if ((adev->asic_type != CHIP_STONEY) &&
 	    (adev->asic_type != CHIP_TOPAZ)) {
-		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name);
-		err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);
+		if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2_2.bin", chip_name);
+			err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);
+			if (err == -ENOENT) {
+				snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name);
+				err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);
+			}
+		} else {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name);
+			err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);
+		}
 		if (!err) {
 			err = amdgpu_ucode_validate(adev->gfx.mec2_fw);
 			if (err)
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1503279549-5007-1-git-send-email-evan.quan-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Am 21.08.2017 um 03:39 schrieb Evan Quan:

Quoted 97 lines

Newer versions of the CP firmware require changes in how the driver initializes the hw block.
Change the firmware name for new firmware to maintain compatibility with older kernels.

Change-Id I32e3382768a2d9ff1e2978bcadb3bd44afb3db01
---
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 65 +++++++++++++++++++++++++++++------
  1 file changed, 55 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +44 -8
index 38f70a1..6f2901a 100644
@@ -918,8 +918,17 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
  		BUG();
  	}
 
-	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name);
-	err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
+	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp_2.bin", chip_name);
+		err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
+		if (err == -ENOENT) {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name);
+			err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
+		}
+	} else {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name);
+		err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
+	}
  	if (err)
  		goto out;
  	err = amdgpu_ucode_validate(adev->gfx.pfp_fw);
@@ -929,8 +938,17 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
  	adev->gfx.pfp_fw_version = le32_to_cpu(cp_hdr->header.ucode_version);
  	adev->gfx.pfp_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
-	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);
-	err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
+	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me_2.bin", chip_name);
+		err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
+		if (err == -ENOENT) {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);
+			err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
+		}
+	} else {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);
+		err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
+	}
  	if (err)
  		goto out;
  	err = amdgpu_ucode_validate(adev->gfx.me_fw);
@@ -941,8 +959,17 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 
  	adev->gfx.me_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
-	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);
-	err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
+	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce_2.bin", chip_name);
+		err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
+		if (err == -ENOENT) {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);
+			err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
+		}
+	} else {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);
+		err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
+	}
  	if (err)
  		goto out;
  	err = amdgpu_ucode_validate(adev->gfx.ce_fw);
@@ -1012,8 +1039,17 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
  	for (i = 0 ; i < (rlc_hdr->reg_list_size_bytes >> 2); i++)
  		adev->gfx.rlc.register_restore[i] = le32_to_cpu(tmp[i]);
 
-	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
-	err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
+	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec_2.bin", chip_name);
+		err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
+		if (err == -ENOENT) {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
+			err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
+		}
+	} else {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
+		err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
+	}
  	if (err)
  		goto out;
  	err = amdgpu_ucode_validate(adev->gfx.mec_fw);
@@ -1025,8 +1061,17 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) · line 1069

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +6 -2
  	if ((adev->asic_type != CHIP_STONEY) &&
  	    (adev->asic_type != CHIP_TOPAZ)) {
-		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name);
-		err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);
+		if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12) {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2_2.bin", chip_name);
+			err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);
+			if (err == -ENOENT) {
+				snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name);
+				err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);

That chunk above looks incorrect to me. You just query "amdgpu/%s_mec2.bin" twice.

Apart from that do we really need that? Couldn't we just push back on the firmware guys to start the MEC after loading like in older versions?

Regards,
Christian.

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) · line 1077

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +5 -0
+			}
+		} else {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name);
+			err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);
+		}
  		if (!err) {
  			err = amdgpu_ucode_validate(adev->gfx.mec2_fw);
  			if (err)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): b2c07ee6-201e-c28a-3877-77d334c1aa90-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

author
#4 lore raw

Hi Christian,

On the 1st run, it goes for amdgpu/%s_mec2_2.bin. Then it will goes for amdgpu/%s_mec2.bin if failed. So, i did not see any problem with it.

Actually i talked with firmware guys. There is no change for the firmware loading way.
The new firmwares depends on a critical feature(unhalt MEC) which we lost before. We added that feature. But considering the possible use case: old kernel + new firmwares, we decide to give the new firmwares other names.

Regards,
Evan

Quoted 144 lines

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Monday, August 21, 2017 4:18 PM
To: Quan, Evan <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] drm/amdgpu: support polaris10/11/12 new cp firmwares

Am 21.08.2017 um 03:39 schrieb Evan Quan:

Quoted 9 lines

Newer versions of the CP firmware require changes in how the driver initializes the hw block.
Change the firmware name for new firmware to maintain compatibility with older kernels.

Change-Id I32e3382768a2d9ff1e2978bcadb3bd44afb3db01
---
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 65 +++++++++++++++++++++++++++++-

-----

Review

Quoted 3 lines
  1 file changed, 55 insertions(+), 10 deletions(-)
(quoted diff) +0 -0

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

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) · line 921

Quoted 10 lines

index 38f70a1..6f2901a 100644

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -2
@@ -918,8 +918,17 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
  		BUG();
  	}
 
-	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name);
-	err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
+	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12)

{

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

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4 -0
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp_2.bin", chip_name);
+		err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
+		if (err == -ENOENT) {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin",

chip_name);

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +6 -0
+			err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
+		}
+	} else {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name);
+		err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
+	}
  	if (err)
  		goto out;
  	err = amdgpu_ucode_validate(adev->gfx.pfp_fw);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) · line 941

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -2
@@ -929,8 +938,17 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
  	adev->gfx.pfp_fw_version = le32_to_cpu(cp_hdr->header.ucode_version);
  	adev->gfx.pfp_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
-	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);
-	err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
+	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12)

{

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

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4 -0
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me_2.bin", chip_name);
+		err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
+		if (err == -ENOENT) {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin",

chip_name);

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +6 -0
+			err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
+		}
+	} else {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);
+		err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
+	}
  	if (err)
  		goto out;
  	err = amdgpu_ucode_validate(adev->gfx.me_fw);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) · line 962

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -2
@@ -941,8 +959,17 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 
  	adev->gfx.me_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
-	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);
-	err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
+	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12)

{

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

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4 -0
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce_2.bin", chip_name);
+		err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
+		if (err == -ENOENT) {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin",

chip_name);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_microcode(struct amdgpu_device

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +6 -0
+			err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
+		}
+	} else {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);
+		err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
+	}
  	if (err)
  		goto out;
  	err = amdgpu_ucode_validate(adev->gfx.ce_fw);
@@ -1012,8 +1039,17 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device

*adev)

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

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -2
  	for (i = 0 ; i < (rlc_hdr->reg_list_size_bytes >> 2); i++)
  		adev->gfx.rlc.register_restore[i] = le32_to_cpu(tmp[i]);
 
-	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
-	err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
+	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12)

{

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

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4 -0
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec_2.bin", chip_name);
+		err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
+		if (err == -ENOENT) {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin",

chip_name);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_microcode(struct amdgpu_device

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +6 -0
+			err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
+		}
+	} else {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
+		err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
+	}
  	if (err)
  		goto out;
  	err = amdgpu_ucode_validate(adev->gfx.mec_fw);
@@ -1025,8 +1061,17 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device

*adev)

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

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -2
  	if ((adev->asic_type != CHIP_STONEY) &&
  	    (adev->asic_type != CHIP_TOPAZ)) {
-		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name);
-		err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);
+		if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <=

CHIP_POLARIS12) {

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_microcode(struct amdgpu_device · line 1064

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2_2.bin",

chip_name);

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

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -0
+			err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);
+			if (err == -ENOENT) {
+				snprintf(fw_name, sizeof(fw_name),

"amdgpu/%s_mec2.bin", chip_name);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_microcode(struct amdgpu_device · line 1068

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
+				err = request_firmware(&adev->gfx.mec2_fw, fw_name,

adev->dev);

That chunk above looks incorrect to me. You just query "amdgpu/%s_mec2.bin" twice.

Apart from that do we really need that? Couldn't we just push back on the firmware guys to start the MEC after loading like in older versions?

Regards,
Christian.

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

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -0
+			}
+		} else {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin",

chip_name);

Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) · line 1077

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -0
+			err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);
+		}
  		if (!err) {
  			err = amdgpu_ucode_validate(adev->gfx.mec2_fw);
  			if (err)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): DM5PR1201MB248905C6C3154B9420E1DB84E4870-grEf7a3NxMAAZHT/xKzwlGrFom/aUZj6nBOFsp37pqbUKgpGm//BTAC/[email protected]

#6 lore raw

Am 21.08.2017 um 11:35 schrieb Quan, Evan:

Quoted 4 lines

Hi Christian,

On the 1st run, it goes for amdgpu/%s_mec2_2.bin. Then it will goes for amdgpu/%s_mec2.bin if failed. So, i did not see any problem with it.

Ah, now I see. The naming of the firmware files is a bit confusing, but should indeed work.

Quoted 3 lines

Actually i talked with firmware guys. There is no change for the firmware loading way.
The new firmwares depends on a critical feature(unhalt MEC) which we lost before. We added that feature. But considering the possible use case: old kernel + new firmwares, we decide to give the new firmwares other names.

Makes sense. In this case the patch is Acked-by: Christian König <[email protected]>.

Regards,
Christian.

Quoted 146 lines

Regards,
Evan

Quoted 143 lines

-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Monday, August 21, 2017 4:18 PM
To: Quan, Evan <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] drm/amdgpu: support polaris10/11/12 new cp firmwares

Am 21.08.2017 um 03:39 schrieb Evan Quan:

Quoted 9 lines

Newer versions of the CP firmware require changes in how the driver initializes the hw block.
Change the firmware name for new firmware to maintain compatibility with older kernels.

Change-Id I32e3382768a2d9ff1e2978bcadb3bd44afb3db01
---
   drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 65 +++++++++++++++++++++++++++++-

-----

Review

Quoted 3 lines
   1 file changed, 55 insertions(+), 10 deletions(-)
(quoted diff) +0 -0

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

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) · line 921

Quoted 10 lines

index 38f70a1..6f2901a 100644

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -2
@@ -918,8 +918,17 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
   		BUG();
   	}
 
-	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name);
-	err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
+	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12)

{

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

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4 -0
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp_2.bin", chip_name);
+		err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
+		if (err == -ENOENT) {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin",

chip_name);

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +6 -0
+			err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
+		}
+	} else {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name);
+		err = request_firmware(&adev->gfx.pfp_fw, fw_name, adev->dev);
+	}
   	if (err)
   		goto out;
   	err = amdgpu_ucode_validate(adev->gfx.pfp_fw);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) · line 941

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -2
@@ -929,8 +938,17 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
   	adev->gfx.pfp_fw_version = le32_to_cpu(cp_hdr->header.ucode_version);
   	adev->gfx.pfp_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
-	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);
-	err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
+	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12)

{

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

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4 -0
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me_2.bin", chip_name);
+		err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
+		if (err == -ENOENT) {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin",

chip_name);

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +6 -0
+			err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
+		}
+	} else {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);
+		err = request_firmware(&adev->gfx.me_fw, fw_name, adev->dev);
+	}
   	if (err)
   		goto out;
   	err = amdgpu_ucode_validate(adev->gfx.me_fw);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) · line 962

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -2
@@ -941,8 +959,17 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device *adev)
 
   	adev->gfx.me_feature_version = le32_to_cpu(cp_hdr->ucode_feature_version);
 
-	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);
-	err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
+	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12)

{

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

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4 -0
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce_2.bin", chip_name);
+		err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
+		if (err == -ENOENT) {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin",

chip_name);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_microcode(struct amdgpu_device

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +6 -0
+			err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
+		}
+	} else {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);
+		err = request_firmware(&adev->gfx.ce_fw, fw_name, adev->dev);
+	}
   	if (err)
   		goto out;
   	err = amdgpu_ucode_validate(adev->gfx.ce_fw);
@@ -1012,8 +1039,17 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device

*adev)

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

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -2
   	for (i = 0 ; i < (rlc_hdr->reg_list_size_bytes >> 2); i++)
   		adev->gfx.rlc.register_restore[i] = le32_to_cpu(tmp[i]);
 
-	snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
-	err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
+	if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <= CHIP_POLARIS12)

{

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

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +4 -0
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec_2.bin", chip_name);
+		err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
+		if (err == -ENOENT) {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin",

chip_name);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_microcode(struct amdgpu_device

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +6 -0
+			err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
+		}
+	} else {
+		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
+		err = request_firmware(&adev->gfx.mec_fw, fw_name, adev->dev);
+	}
   	if (err)
   		goto out;
   	err = amdgpu_ucode_validate(adev->gfx.mec_fw);
@@ -1025,8 +1061,17 @@ static int gfx_v8_0_init_microcode(struct amdgpu_device

*adev)

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

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -2
   	if ((adev->asic_type != CHIP_STONEY) &&
   	    (adev->asic_type != CHIP_TOPAZ)) {
-		snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name);
-		err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);
+		if (adev->asic_type >= CHIP_POLARIS10 && adev->asic_type <=

CHIP_POLARIS12) {

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_microcode(struct amdgpu_device · line 1064

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2_2.bin",

chip_name);

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

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -0
+			err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);
+			if (err == -ENOENT) {
+				snprintf(fw_name, sizeof(fw_name),

"amdgpu/%s_mec2.bin", chip_name);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_microcode(struct amdgpu_device · line 1068

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
+				err = request_firmware(&adev->gfx.mec2_fw, fw_name,

adev->dev);

That chunk above looks incorrect to me. You just query "amdgpu/%s_mec2.bin" twice.

Apart from that do we really need that? Couldn't we just push back on the firmware guys to start the MEC after loading like in older versions?

Regards,
Christian.

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

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -0
+			}
+		} else {
+			snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin",

chip_name);

Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_microcode(struct amdgpu_device *adev) · line 1077

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -0
+			err = request_firmware(&adev->gfx.mec2_fw, fw_name, adev->dev);
+		}
   		if (!err) {
   			err = amdgpu_ucode_validate(adev->gfx.mec2_fw);
   			if (err)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx