Skip to contentSkip to conversation

drm/amdgpu:fix vpost_needed routine

PATCH In review Monk Liu 2 participants 4 messages Nov 11, 2016 – Nov 14, 2016 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Monk Liu

author
#0 lore raw

PATCH 1/1 drm/amdgpu:fix vpost_needed routine

1,cleanup description/comments
2,for FIJI & passthrough, force post when smc fw version below 22.15 3,for other cases, follow regular rules

Change-Id Iecdeec1801a920c1f4ea9c8fd40be9ac2f1f3c51
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7 -20
index 5970c40..dbfe471 100644
@@ -637,12 +637,10 @@ static bool amdgpu_vpost_needed(struct amdgpu_device *adev)
 		return false;
 
 	if (amdgpu_passthrough(adev)) {
-		/* for FIJI: In whole GPU pass-through virtualization case
-		 * old smc fw won't clear some registers (e.g. MEM_SIZE, BIOS_SCRATCH)
-		 * so amdgpu_card_posted return false and driver will incorrectly skip vPost.
-		 * but if we force vPost do in pass-through case, the driver reload will hang.
-		 * whether doing vPost depends on amdgpu_card_posted if smc version is above
-		 * 00160e00 for FIJI.
+		/* for FIJI: In whole GPU pass-through virtualization case, after VM reboot
+		 * some old smc fw still need driver do vPost otherwise gpu hang, while
+		 * those smc fw version above 22.15 doesn't have this flaw, so we force
+		 * vpost executed for smc version below 22.15
 		 */
 		if (adev->asic_type == CHIP_FIJI) {
 			int err;
@@ -653,22 +651,11 @@ static bool amdgpu_vpost_needed(struct amdgpu_device *adev)
 				return true;
 
 			fw_ver = *((uint32_t *)adev->pm.fw->data + 69);
-			if (fw_ver >= 0x00160e00)
-				return !amdgpu_card_posted(adev);
+			if (fw_ver < 0x00160e00)
+				return true;
 		}
-	} else {
-		/* in bare-metal case, amdgpu_card_posted return false
-		 * after system reboot/boot, and return true if driver
-		 * reloaded.
-		 * we shouldn't do vPost after driver reload otherwise GPU
-		 * could hang.
-		 */
-		if (amdgpu_card_posted(adev))
-			return false;
 	}
-
-	/* we assume vPost is neede for all other cases */
-	return true;
+	return !amdgpu_card_posted(adev);
 }
 
 /**
Signature · 6 lines
1.9.1

_______________________________________________
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): 1478858668-9642-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org

#2 lore raw
Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Monk Liu
Sent: Friday, November 11, 2016 5:04 AM
To: [email protected]
Cc: Liu, Monk
Subject: [PATCH] drm/amdgpu:fix vpost_needed routine

Quoted 6 lines

1,cleanup description/comments
2,for FIJI & passthrough, force post when smc fw version below 22.15 3,for other cases, follow regular rules

Change-Id Iecdeec1801a920c1f4ea9c8fd40be9ac2f1f3c51

Can you rebase this against amd-staging-4.7? We reworked this code once we fixed the firmware version tracking in the firmware itself. The firmware prior to that has a fixed version so we can check for that and special case it.

Alex

Quoted 65 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 27 +++++++---------------
-----
 1 file changed, 7 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -3
index 5970c40..dbfe471 100644
@@ -637,12 +637,10 @@ static bool amdgpu_vpost_needed(struct
 amdgpu_device *adev)
 		return false;
 
 	if (amdgpu_passthrough(adev)) {
-		/* for FIJI: In whole GPU pass-through virtualization case
-		 * old smc fw won't clear some registers (e.g. MEM_SIZE,
 BIOS_SCRATCH)
-		 * so amdgpu_card_posted return false and driver will

incorrectly skip vPost.

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -1
-		 * but if we force vPost do in pass-through case, the driver

reload will hang.

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -1
-		 * whether doing vPost depends on amdgpu_card_posted if

smc version is above

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
-		 * 00160e00 for FIJI.
+		/* for FIJI: In whole GPU pass-through virtualization case,

after VM reboot

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
+		 * some old smc fw still need driver do vPost otherwise gpu

hang, while

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
+		 * those smc fw version above 22.15 doesn't have this flaw,

so we force

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -14
+		 * vpost executed for smc version below 22.15
 		 */
 		if (adev->asic_type == CHIP_FIJI) {
 			int err;
@@ -653,22 +651,11 @@ static bool amdgpu_vpost_needed(struct
 amdgpu_device *adev)
 				return true;
 
 			fw_ver = *((uint32_t *)adev->pm.fw->data + 69);
-			if (fw_ver >= 0x00160e00)
-				return !amdgpu_card_posted(adev);
+			if (fw_ver < 0x00160e00)
+				return true;
 		}
-	} else {
-		/* in bare-metal case, amdgpu_card_posted return false
-		 * after system reboot/boot, and return true if driver
-		 * reloaded.
-		 * we shouldn't do vPost after driver reload otherwise GPU
-		 * could hang.
-		 */
-		if (amdgpu_card_posted(adev))
-			return false;
 	}
-
-	/* we assume vPost is neede for all other cases */
-	return true;
+	return !amdgpu_card_posted(adev);
 }
 

/**
--
1.9.1

Quoted 4 lines

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

_______________________________________________
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): MWHPR12MB1694C8C5179C1F2B0207059AF7BB0-Gy0DoCVfaSW4WA4dJ5YXGAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

author
#4 lore raw

Alex, the patch is already rebased against staging-4.7 , it just fixed non-FIJI pass-through bug, which should use regular rules but without this patch it will always do post.

BR Monk

-----邮件原件-----
发件人: Deucher, Alexander
发送时间: Friday, November 11, 2016 11:05 PM 收件人: Liu, Monk; [email protected]
抄送: Liu, Monk
主题: RE: [PATCH] drm/amdgpu:fix vpost_needed routine

Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Monk Liu
Sent: Friday, November 11, 2016 5:04 AM
To: [email protected]
Cc: Liu, Monk
Subject: [PATCH] drm/amdgpu:fix vpost_needed routine

Quoted 6 lines

1,cleanup description/comments
2,for FIJI & passthrough, force post when smc fw version below 22.15 3,for other cases, follow regular rules

Change-Id Iecdeec1801a920c1f4ea9c8fd40be9ac2f1f3c51

Can you rebase this against amd-staging-4.7? We reworked this code once we fixed the firmware version tracking in the firmware itself. The firmware prior to that has a fixed version so we can check for that and special case it.

Alex

Quoted 66 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 27 
+++++++---------------
-----
 1 file changed, 7 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -3
index 5970c40..dbfe471 100644
@@ -637,12 +637,10 @@ static bool amdgpu_vpost_needed(struct 
 amdgpu_device *adev)
 		return false;
 
 	if (amdgpu_passthrough(adev)) {
-		/* for FIJI: In whole GPU pass-through virtualization case
-		 * old smc fw won't clear some registers (e.g. MEM_SIZE,
 BIOS_SCRATCH)
-		 * so amdgpu_card_posted return false and driver will

incorrectly skip vPost.

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -1
-		 * but if we force vPost do in pass-through case, the driver

reload will hang.

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -1
-		 * whether doing vPost depends on amdgpu_card_posted if

smc version is above

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
-		 * 00160e00 for FIJI.
+		/* for FIJI: In whole GPU pass-through virtualization case,

after VM reboot

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
+		 * some old smc fw still need driver do vPost otherwise gpu

hang, while

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
+		 * those smc fw version above 22.15 doesn't have this flaw,

so we force

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -14
+		 * vpost executed for smc version below 22.15
 		 */
 		if (adev->asic_type == CHIP_FIJI) {
 			int err;
@@ -653,22 +651,11 @@ static bool amdgpu_vpost_needed(struct 
 amdgpu_device *adev)
 				return true;
 
 			fw_ver = *((uint32_t *)adev->pm.fw->data + 69);
-			if (fw_ver >= 0x00160e00)
-				return !amdgpu_card_posted(adev);
+			if (fw_ver < 0x00160e00)
+				return true;
 		}
-	} else {
-		/* in bare-metal case, amdgpu_card_posted return false
-		 * after system reboot/boot, and return true if driver
-		 * reloaded.
-		 * we shouldn't do vPost after driver reload otherwise GPU
-		 * could hang.
-		 */
-		if (amdgpu_card_posted(adev))
-			return false;
 	}
-
-	/* we assume vPost is neede for all other cases */
-	return true;
+	return !amdgpu_card_posted(adev);
 }
 

/**
--
1.9.1

Quoted 4 lines

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

_______________________________________________
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): CY4PR12MB13511E2D9B98BF92CCBAFB2E84BC0-rpdhrqHFk04aRV2spazHLQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

Reviewed-by Alex Deucher
#6 lore raw
Quoted 9 lines

-----Original Message-----
From: Liu, Monk
Sent: Sunday, November 13, 2016 10:17 PM
To: Deucher, Alexander; [email protected]
Subject: 答复: [PATCH] drm/amdgpu:fix vpost_needed routine

Alex, the patch is already rebased against staging-4.7 , it just fixed non-FIJI pass-through bug, which should use regular rules but without this patch it will always do post.

Whoops, sorry, I mixed this up with another change. Patch is:

Quoted 93 lines

BR Monk

-----邮件原件-----
发件人: Deucher, Alexander
发送时间: Friday, November 11, 2016 11:05 PM 收件人: Liu, Monk; [email protected]
抄送: Liu, Monk
主题: RE: [PATCH] drm/amdgpu:fix vpost_needed routine

Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Monk Liu
Sent: Friday, November 11, 2016 5:04 AM
To: [email protected]
Cc: Liu, Monk
Subject: [PATCH] drm/amdgpu:fix vpost_needed routine

Quoted 6 lines

1,cleanup description/comments
2,for FIJI & passthrough, force post when smc fw version below 22.15 3,for other cases, follow regular rules

Change-Id Iecdeec1801a920c1f4ea9c8fd40be9ac2f1f3c51

Can you rebase this against amd-staging-4.7? We reworked this code once we fixed the firmware version tracking in the firmware itself. The firmware prior to that has a fixed version so we can check for that and special case it.

Alex

Quoted 62 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 27
+++++++---------------
-----
 1 file changed, 7 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -3
index 5970c40..dbfe471 100644
@@ -637,12 +637,10 @@ static bool amdgpu_vpost_needed(struct
 amdgpu_device *adev)
 		return false;
 
 	if (amdgpu_passthrough(adev)) {
-		/* for FIJI: In whole GPU pass-through virtualization case
-		 * old smc fw won't clear some registers (e.g. MEM_SIZE,
 BIOS_SCRATCH)
-		 * so amdgpu_card_posted return false and driver will

incorrectly skip vPost.

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -1
-		 * but if we force vPost do in pass-through case, the driver

reload will hang.

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -1
-		 * whether doing vPost depends on amdgpu_card_posted if

smc version is above

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
-		 * 00160e00 for FIJI.
+		/* for FIJI: In whole GPU pass-through virtualization case,

after VM reboot

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
+		 * some old smc fw still need driver do vPost otherwise gpu

hang, while

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
+		 * those smc fw version above 22.15 doesn't have this flaw,

so we force

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -14
+		 * vpost executed for smc version below 22.15
 		 */
 		if (adev->asic_type == CHIP_FIJI) {
 			int err;
@@ -653,22 +651,11 @@ static bool amdgpu_vpost_needed(struct
 amdgpu_device *adev)
 				return true;
 
 			fw_ver = *((uint32_t *)adev->pm.fw->data + 69);
-			if (fw_ver >= 0x00160e00)
-				return !amdgpu_card_posted(adev);
+			if (fw_ver < 0x00160e00)
+				return true;
 		}
-	} else {
-		/* in bare-metal case, amdgpu_card_posted return false
-		 * after system reboot/boot, and return true if driver
-		 * reloaded.
-		 * we shouldn't do vPost after driver reload otherwise GPU
-		 * could hang.
-		 */
-		if (amdgpu_card_posted(adev))
-			return false;
 	}
-
-	/* we assume vPost is neede for all other cases */
-	return true;
+	return !amdgpu_card_posted(adev);
 }
 
Quoted 8 lines
Quoted 8 lines

/**
--
1.9.1

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

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