Skip to contentSkip to conversation

drm/nouveau/pmu: fix timeout on GP108

PATCH In review Diego Viola 3 participants 6 messages Feb 16, 2021 – Feb 25, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/nouveau/pmu: fix timeout on GP108

This code times out on GP108, probably because the BIOS puts it into a bad state.

Since we reset the PMU on driver load anyway, we are at no risk from missing a response from it since we are not waiting for one to begin with.

---
 drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c +1 -5
index a0fe607c9c07..5c802f2d00cb 100644
@@ -102,12 +102,8 @@ nvkm_pmu_reset(struct nvkm_pmu *pmu)
 	if (!pmu->func->enabled(pmu))
 		return 0;
 
-	/* Inhibit interrupts, and wait for idle. */
+	/* Inhibit interrupts. */
 	nvkm_wr32(device, 0x10a014, 0x0000ffff);
-	nvkm_msec(device, 2000,
-		if (!nvkm_rd32(device, 0x10a04c))
-			break;
-	);
 
 	/* Reset. */
 	if (pmu->func->reset)
Signature · 6 lines
2.30.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 7 lines · Diego Viola

This code times out on GP108, probably because the BIOS puts it into a bad state.

Since we reset the PMU on driver load anyway, we are at no risk from missing a response from it since we are not waiting for one to begin with.

This looks safe to me, provided indeed that the PMU's reset is not called outside of initialization (which for GP108 is shouldn't be IIRC?).

Quoted 25 lines
---
 drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c +1 -6
index a0fe607c9c07..5c802f2d00cb 100644
@@ -102,12 +102,8 @@ nvkm_pmu_reset(struct nvkm_pmu *pmu)
        if (!pmu->func->enabled(pmu))
                return 0;
 
-       /* Inhibit interrupts, and wait for idle. */
+       /* Inhibit interrupts. */
        nvkm_wr32(device, 0x10a014, 0x0000ffff);
-       nvkm_msec(device, 2000,
-               if (!nvkm_rd32(device, 0x10a04c))
-                       break;
-       );
 
        /* Reset. */
        if (pmu->func->reset)
--
Quoted 2 lines

2.30.1

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

#2 lore raw
Quoted 6 lines · Alexandre Courbot
Quoted 4 lines · Diego Viola

This code times out on GP108, probably because the BIOS puts it into a bad state.

Quoted 7 lines
Quoted 3 lines

Since we reset the PMU on driver load anyway, we are at no risk from missing a response from it since we are not waiting for one to begin with.

This looks safe to me, provided indeed that the PMU's reset is not called outside of initialization (which for GP108 is shouldn't be IIRC?).

ISTR that the PMU FW we use prior to GM200 might depend on that being there.

I've posted a proposed alternate fix here[1], as we probably shouldn't have been touching PMU there anyway on those GPUs.

Ben.

[1] https://github.com/skeggsb/linux/commit/90224a17437b1f39dbecbb385567c1fce958f992

Quoted 23 lines
Quoted 23 lines
---
 drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c +1 -5
index a0fe607c9c07..5c802f2d00cb 100644
@@ -102,12 +102,8 @@ nvkm_pmu_reset(struct nvkm_pmu *pmu)
        if (!pmu->func->enabled(pmu))
                return 0;
 
-       /* Inhibit interrupts, and wait for idle. */
+       /* Inhibit interrupts. */
        nvkm_wr32(device, 0x10a014, 0x0000ffff);
-       nvkm_msec(device, 2000,
-               if (!nvkm_rd32(device, 0x10a04c))
-                       break;
-       );
 
Quoted 9 lines
Quoted 5 lines
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c +0 -1
        /* Reset. */
        if (pmu->func->reset)
--

2.30.1

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

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

#3 lore raw

Hi Ben,

Quoted 15 lines · Ben Skeggs
Quoted 6 lines · Alexandre Courbot
Quoted 4 lines · Diego Viola

This code times out on GP108, probably because the BIOS puts it into a bad state.

Quoted 7 lines
Quoted 3 lines

Since we reset the PMU on driver load anyway, we are at no risk from missing a response from it since we are not waiting for one to begin with.

This looks safe to me, provided indeed that the PMU's reset is not called outside of initialization (which for GP108 is shouldn't be IIRC?).

Quoted 41 lines

ISTR that the PMU FW we use prior to GM200 might depend on that being there.

I've posted a proposed alternate fix here[1], as we probably shouldn't have been touching PMU there anyway on those GPUs.

Ben.

[1] https://github.com/skeggsb/linux/commit/90224a17437b1f39dbecbb385567c1fce958f992

Quoted 32 lines
Quoted 26 lines
---
 drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c +1 -6
index a0fe607c9c07..5c802f2d00cb 100644
@@ -102,12 +102,8 @@ nvkm_pmu_reset(struct nvkm_pmu *pmu)
        if (!pmu->func->enabled(pmu))
                return 0;
 
-       /* Inhibit interrupts, and wait for idle. */
+       /* Inhibit interrupts. */
        nvkm_wr32(device, 0x10a014, 0x0000ffff);
-       nvkm_msec(device, 2000,
-               if (!nvkm_rd32(device, 0x10a04c))
-                       break;
-       );
 
        /* Reset. */
        if (pmu->func->reset)
--
Quoted 2 lines

2.30.1

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

I tested your patch and can confirm that the timeout is gone after booting my system, but unfortunately it's back after doing a suspend/resume.

Any ideas about that?

Thanks,
Diego
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author Tested-by
#4 lore raw
In reply to Ben Skeggs

Hi Ben,

I can confirm that your last two patches[0][1] fix the timeout issues (those from a normal boot and from suspend/resume).

[0] https://github.com/skeggsb/linux/commit/90224a17437b1f39dbecbb385567c1fce958f992
[1] https://github.com/skeggsb/linux/commit/0ee6dc49601359042fd254bbd8ba6b4685b4d0d7

on both patches.

Thanks, I appreciate it a lot.

Diego

Quoted 15 lines · Ben Skeggs
Quoted 6 lines · Alexandre Courbot
Quoted 4 lines · Diego Viola

This code times out on GP108, probably because the BIOS puts it into a bad state.

Quoted 7 lines
Quoted 3 lines

Since we reset the PMU on driver load anyway, we are at no risk from missing a response from it since we are not waiting for one to begin with.

This looks safe to me, provided indeed that the PMU's reset is not called outside of initialization (which for GP108 is shouldn't be IIRC?).

Quoted 41 lines

ISTR that the PMU FW we use prior to GM200 might depend on that being there.

I've posted a proposed alternate fix here[1], as we probably shouldn't have been touching PMU there anyway on those GPUs.

Ben.

[1] https://github.com/skeggsb/linux/commit/90224a17437b1f39dbecbb385567c1fce958f992

Quoted 32 lines
Quoted 26 lines
---
 drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c +1 -6
index a0fe607c9c07..5c802f2d00cb 100644
@@ -102,12 +102,8 @@ nvkm_pmu_reset(struct nvkm_pmu *pmu)
        if (!pmu->func->enabled(pmu))
                return 0;
 
-       /* Inhibit interrupts, and wait for idle. */
+       /* Inhibit interrupts. */
        nvkm_wr32(device, 0x10a014, 0x0000ffff);
-       nvkm_msec(device, 2000,
-               if (!nvkm_rd32(device, 0x10a04c))
-                       break;
-       );
 
        /* Reset. */
        if (pmu->func->reset)
--
Quoted 2 lines

2.30.1

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

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

#5 lore raw
Quoted 11 lines · Diego Viola

Hi Ben,

I can confirm that your last two patches[0][1] fix the timeout issues (those from a normal boot and from suspend/resume).

[0] https://github.com/skeggsb/linux/commit/90224a17437b1f39dbecbb385567c1fce958f992
[1] https://github.com/skeggsb/linux/commit/0ee6dc49601359042fd254bbd8ba6b4685b4d0d7

Quoted 63 lines

on both patches.

Thanks, I appreciate it a lot.

Diego

Quoted 56 lines · Ben Skeggs
Quoted 6 lines · Alexandre Courbot
Quoted 4 lines · Diego Viola

This code times out on GP108, probably because the BIOS puts it into a bad state.

Quoted 7 lines
Quoted 3 lines

Since we reset the PMU on driver load anyway, we are at no risk from missing a response from it since we are not waiting for one to begin with.

This looks safe to me, provided indeed that the PMU's reset is not called outside of initialization (which for GP108 is shouldn't be IIRC?).

ISTR that the PMU FW we use prior to GM200 might depend on that being there.

I've posted a proposed alternate fix here[1], as we probably shouldn't have been touching PMU there anyway on those GPUs.

Ben.

[1] https://github.com/skeggsb/linux/commit/90224a17437b1f39dbecbb385567c1fce958f992

Quoted 32 lines
Quoted 26 lines
---
 drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c +1 -6
index a0fe607c9c07..5c802f2d00cb 100644
@@ -102,12 +102,8 @@ nvkm_pmu_reset(struct nvkm_pmu *pmu)
        if (!pmu->func->enabled(pmu))
                return 0;
 
-       /* Inhibit interrupts, and wait for idle. */
+       /* Inhibit interrupts. */
        nvkm_wr32(device, 0x10a014, 0x0000ffff);
-       nvkm_msec(device, 2000,
-               if (!nvkm_rd32(device, 0x10a04c))
-                       break;
-       );
 
        /* Reset. */
        if (pmu->func->reset)
--
Quoted 2 lines

2.30.1

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

Ugh, sorry for breaking the regular email flow/order. Damn you gmail!

Regards,
Diego
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel