Skip to contentSkip to conversation

drm/nouveau/gsp/r570: Fix runtime PM

PATCH Superseded Lyude Paul 4 participants 12 messages Jun 29 – Jul 1

Subsystems (4)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Lyude Paul

author maintainer
#0 lore raw

v2 cover drm/nouveau/gsp/r570: Fix runtime PM

Runtime PM has been kind of unreliable with GSP for a while. It works well enough to shut the GPU off and turn it back on, but more often then not it ends up leaving the GPU in a broken state on resume - which makes it impossible to really do anything else with it.

Recently however, I discovered that it's been failing much harder on some ampere systems. This lead me down a rabbit hole that lead me to figure out one of our previous fixes for runtime PM wasn't correct. After fixing that and combining it with some fixes we had tried in the past without success, I finally managed to get nouveau to handle runtime PM with the GSP perfectly. These are those fixes.

Tested on a Lenovo P16 G1 (100 runtime PM cycles!), and RTX4000.

Lyude Paul (4):
Revert "nouveau/gsp: fix suspend/resume regression on r570 firmware" drm/nouveau/gsp/r570: Never enter Gcoff state drm/nouveau/gsp/r570: Set oldLevel correctly in GSP resume arguments drm/nouveau/gsp/r570: Add missing state flags to GSP resume arguments

 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fbsr.c |  2 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c  |  2 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/fbsr.c |  8 ++++----
 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c  |  5 +++--
 .../gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/nvrm/gsp.h | 10 +++++++++-
 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/rm.h        |  2 +-
 6 files changed, 19 insertions(+), 10 deletions(-)

base-commit: 8fca3d8dbebf8d960dad7b10db3cb4a61139454b

Signature · 1 line
2.54.0
author maintainer
#1 lore raw

PATCH v2 1/4 Revert "nouveau/gsp: fix suspend/resume regression on r570 firmware"

This reverts commit 8302d0afeaec0bc57d951dd085e0cffe997d4d18.

It turns out this looked like the right fix on some systems, but it's not - as this causes runtime PM to actually fail on many a laptop.

[I have set the fixes to an older commit then the one that is reverted here, because when applied with the other patches in this series, this appears to /fully/ fix runtime PM in addition to the regression]

Fixes 53dac0623853 ("drm/nouveau/gsp: add support for 570.144")
Cc <[email protected]> # v6.16+
---
 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fbsr.c | 2 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c  | 2 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/fbsr.c | 8 ++++----
 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/rm.h        | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fbsr.c +1 -1
index 700cea5def357..035b575722db7 100644
@@ -208,7 +208,7 @@ r535_fbsr_resume(struct nvkm_gsp *gsp)
 }
 
 static int
-r535_fbsr_suspend(struct nvkm_gsp *gsp, bool runtime)
+r535_fbsr_suspend(struct nvkm_gsp *gsp)
 {
 	struct nvkm_subdev *subdev = &gsp->subdev;
 	struct nvkm_device *device = subdev->device;
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c +1 -1
index f544afa12b6bb..4a3b771ded255 100644
@@ -1749,7 +1749,7 @@ r535_gsp_fini(struct nvkm_gsp *gsp, enum nvkm_suspend_state suspend)
 		sr->sysmemAddrOfSuspendResumeData = gsp->sr.radix3.lvl0.addr;
 		sr->sizeOfSuspendResumeData = len;
 
-		ret = rm->api->fbsr->suspend(gsp, suspend == NVKM_RUNTIME_SUSPEND);
+		ret = rm->api->fbsr->suspend(gsp);
 		if (ret) {
 			nvkm_gsp_mem_dtor(&gsp->sr.meta);
 			nvkm_gsp_radix3_dtor(gsp, &gsp->sr.radix3);
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/fbsr.c +4 -4
index 8ef8b4f655883..2945d5b4e5707 100644
@@ -62,7 +62,7 @@ r570_fbsr_resume(struct nvkm_gsp *gsp)
 }
 
 static int
-r570_fbsr_init(struct nvkm_gsp *gsp, struct sg_table *sgt, u64 size, bool runtime)
+r570_fbsr_init(struct nvkm_gsp *gsp, struct sg_table *sgt, u64 size)
 {
 	NV2080_CTRL_INTERNAL_FBSR_INIT_PARAMS *ctrl;
 	struct nvkm_gsp_object memlist;
@@ -81,7 +81,7 @@ r570_fbsr_init(struct nvkm_gsp *gsp, struct sg_table *sgt, u64 size, bool runtim
 	ctrl->hClient = gsp->internal.client.object.handle;
 	ctrl->hSysMem = memlist.handle;
 	ctrl->sysmemAddrOfSuspendResumeData = gsp->sr.meta.addr;
-	ctrl->bEnteringGcoffState = runtime ? 1 : 0;
+	ctrl->bEnteringGcoffState = 1;
 
 	ret = nvkm_gsp_rm_ctrl_wr(&gsp->internal.device.subdevice, ctrl);
 	if (ret)
@@ -92,7 +92,7 @@ r570_fbsr_init(struct nvkm_gsp *gsp, struct sg_table *sgt, u64 size, bool runtim
 }
 
 static int
-r570_fbsr_suspend(struct nvkm_gsp *gsp, bool runtime)
+r570_fbsr_suspend(struct nvkm_gsp *gsp)
 {
 	struct nvkm_subdev *subdev = &gsp->subdev;
 	struct nvkm_device *device = subdev->device;
@@ -133,7 +133,7 @@ r570_fbsr_suspend(struct nvkm_gsp *gsp, bool runtime)
 		return ret;
 
 	/* Initialise FBSR on RM. */
-	ret = r570_fbsr_init(gsp, &gsp->sr.fbsr, size, runtime);
+	ret = r570_fbsr_init(gsp, &gsp->sr.fbsr, size);
 	if (ret) {
 		nvkm_gsp_sg_free(device, &gsp->sr.fbsr);
 		return ret;
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/rm.h +1 -1
index a9af94adf9efc..0fb0e67406c67 100644
@@ -78,7 +78,7 @@ struct nvkm_rm_api {
 	} *device;
 
 	const struct nvkm_rm_api_fbsr {
-		int (*suspend)(struct nvkm_gsp *, bool runtime);
+		int (*suspend)(struct nvkm_gsp *);
 		void (*resume)(struct nvkm_gsp *);
 	} *fbsr;
 
Signature · 1 line
2.54.0
#2 lore raw

Re: [PATCH v2 1/4] Revert "nouveau/gsp: fix suspend/resume regression on r570 firmware"

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Failing to restore hardware state if r570_fbsr_suspend encounters an error midway through execution. --

commit b9938c05e690ef9ccc55ef6c3f7541c371717b40
Author: Lyude Paul <[email protected]>

Revert "nouveau/gsp: fix suspend/resume regression on r570 firmware"

This reverts commit 8302d0afeaec0bc57d951dd085e0cffe997d4d18. It turns out this looked like the right fix on some systems, but it causes runtime PM to actually fail on many laptops.

Quoted 4 lines
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/fbsr.c +0 -0
index 8ef8b4f655883..2945d5b4e5707 100644

[ ... ]

drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/fbsr.c r570_fbsr_init(struct nvkm_gsp *gsp, struct sg_table *sgt, u64 size, bool runtim · line 98

Quoted 9 lines
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/fbsr.c +1 -1
@@ -92,7 +92,7 @@ r570_fbsr_init(struct nvkm_gsp *gsp, struct sg_table *sgt, u64 size, bool runtim
 }
 
 static int
-r570_fbsr_suspend(struct nvkm_gsp *gsp, bool runtime)
+r570_fbsr_suspend(struct nvkm_gsp *gsp)
 {
 	struct nvkm_subdev *subdev = &gsp->subdev;
 	struct nvkm_device *device = subdev->device;

[Severity: High]
This is a pre-existing issue, but does r570_fbsr_suspend() need to unwind hardware state changes if an error occurs?

Looking at the function body, hardware state is mutated upfront:

r570_fbsr_suspend() {
        ...
        /* Stop channel scheduling. */
        r570_fbsr_suspend_channels(gsp, true);

        /* Save BAR2 allocations to system memory. */
        list_for_each_entry(iobj, &imem->list, head) {
                if (iobj->preserve) {
                        ret = nvkm_instobj_save(iobj);
                        if (ret)
                                return ret;
                }
        }
        ...
        /* Disable BAR2 access. */
        device->bar->bar2 = false;
        ...
}

If a failure occurs (such as memory allocation failure in nvkm_instobj_save() or later in nvkm_gsp_sg()), the function returns an error without reverting these hardware changes.

The error propagates to nvkm_subdev_fini(), returning early without setting subdev->use.enabled to false. During a suspend abort recovery, nvkm_device_fini() attempts to restart failed devices via nvkm_subdev_init().

However, because use.enabled is still true, the restart is skipped, meaning the device's init and resume callbacks are never executed.

Could this leave the GPU permanently unusable with suspended channels and disabled BAR2 access if a failure happens during suspend?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#3 lore raw

Re: [PATCH v2 1/4] Revert "nouveau/gsp: fix suspend/resume regression on r570 firmware"

In reply to Lyude Paul
Quoted 8 lines · Lyude Paul

This reverts commit 8302d0afeaec0bc57d951dd085e0cffe997d4d18.

It turns out this looked like the right fix on some systems, but it's not - as this causes runtime PM to actually fail on many a laptop.

[I have set the fixes to an older commit then the one that is reverted here, because when applied with the other patches in this series, this appears to /fully/ fix runtime PM in addition to the regression]

No need to have this in the commit message, move it to the comment block...

Quoted 1 line
Fixes 53dac0623853 ("drm/nouveau/gsp: add support for 570.144")

I'm not sure, actually, that this is a correct approach. You can't revert something that never appeared (in time range between 53dac0623853 and 8302d0afeaec). Have you consulted with the stable kernel process documentation and/or respective maintainers?

Quoted 3 lines

---

...somewhere here.

Quoted 4 lines
 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fbsr.c | 2 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gsp.c  | 2 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/fbsr.c | 8 ++++----
 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/rm.h        | 2 +-
Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#4 lore raw

Re: [PATCH v2 1/4] Revert "nouveau/gsp: fix suspend/resume regression on r570 firmware"

Quoted 10 lines · Andy Shevchenko
Quoted 8 lines · Lyude Paul

This reverts commit 8302d0afeaec0bc57d951dd085e0cffe997d4d18.

It turns out this looked like the right fix on some systems, but it's not - as this causes runtime PM to actually fail on many a laptop.

[I have set the fixes to an older commit then the one that is reverted here, because when applied with the other patches in this series, this appears to /fully/ fix runtime PM in addition to the regression]

Quoted 8 lines

No need to have this in the commit message, move it to the comment block...

Quoted 1 line
Fixes 53dac0623853 ("drm/nouveau/gsp: add support for 570.144")

I'm not sure, actually, that this is a correct approach. You can't revert something that never appeared (in time range between 53dac0623853 and 8302d0afeaec). Have you consulted with the stable kernel process documentation and/or respective maintainers?

I think it should be as simple as picking

Fixes 8302d0afeaec ("nouveau/gsp: fix suspend/resume regression on r570 firmware")
Cc <[email protected]> # v6.19+

for this commit and keep patches 2, 3 and 4 as they are.

The commit message of this revert can then explain that the commit that was attempted to fix with this revert, i.e. commit 53dac0623853 ("drm/nouveau/gsp:
add support for 570.144") is fixed with a different, subsequent approach.

This seems correct, as reverting a bad fix does not claim to solve the original problem.

Thanks,
Danilo

author maintainer
#5 lore raw

Re: [PATCH v2 1/4] Revert "nouveau/gsp: fix suspend/resume regression on r570 firmware"

Sounds good to me - will update the patches with this on the next respin, which should get sent out in a moment.

Quoted 48 lines · Danilo Krummrich
Quoted 18 lines · Andy Shevchenko
Quoted 11 lines · Lyude Paul

This reverts commit 8302d0afeaec0bc57d951dd085e0cffe997d4d18.

It turns out this looked like the right fix on some systems, but it's not -
as this causes runtime PM to actually fail on many a laptop.

[I have set the fixes to an older commit then the one that is reverted
here, because when applied with the other patches in this series, this
appears to /fully/ fix runtime PM in addition to the regression]

No need to have this in the commit message, move it to the comment block...

Quoted 1 line
Fixes 53dac0623853 ("drm/nouveau/gsp: add support for 570.144")
Quoted 7 lines

I'm not sure, actually, that this is a correct approach. You can't revert
something that never appeared (in time range between 53dac0623853 and
8302d0afeaec). Have you consulted with the stable kernel process documentation
and/or respective maintainers?

I think it should be as simple as picking

Fixes 8302d0afeaec ("nouveau/gsp: fix suspend/resume regression on

r570 firmware")
Cc: <[email protected]> # v6.19+

for this commit and keep patches 2, 3 and 4 as they are.

The commit message of this revert can then explain that the commit that was
attempted to fix with this revert, i.e. commit 53dac0623853 ("drm/nouveau/gsp:
add support for 570.144") is fixed with a different, subsequent approach.

This seems correct, as reverting a bad fix does not claim to solve the original
problem.

Thanks,
Danilo

author maintainer
#6 lore raw

PATCH v2 2/4 drm/nouveau/gsp/r570: Never enter Gcoff state

In reply to Lyude Paul

It turns out that the only reason our previous fixes looked like they worked for this was because we would occasionally set the Gcoff state to 0 in the normal S3 path, which fixed suspend/resume on desktops - but not on machines using runtime suspend.

The proper fix is to just never set this flag. Our current guess for the reasoning behind this is that Gcoff likely coincides with GC6, and not literally power off.

Fixes 53dac0623853 ("drm/nouveau/gsp: add support for 570.144")
Cc <[email protected]> # v6.16+
---
 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/fbsr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/fbsr.c +1 -1
index 2945d5b4e5707..af5aa5065c3dd 100644
@@ -81,7 +81,7 @@ r570_fbsr_init(struct nvkm_gsp *gsp, struct sg_table *sgt, u64 size)
 	ctrl->hClient = gsp->internal.client.object.handle;
 	ctrl->hSysMem = memlist.handle;
 	ctrl->sysmemAddrOfSuspendResumeData = gsp->sr.meta.addr;
-	ctrl->bEnteringGcoffState = 1;
+	ctrl->bEnteringGcoffState = 0;
 
 	ret = nvkm_gsp_rm_ctrl_wr(&gsp->internal.device.subdevice, ctrl);
 	if (ret)
Signature · 1 line
2.54.0
#7 lore raw

Re: [PATCH v2 2/4] drm/nouveau/gsp/r570: Never enter Gcoff state

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but GSP active channel scheduling is not resumed on suspend error paths, leading to a permanent GPU hang. --

commit d3622da930a8cf5e22c2dae487c3e7c942f12198
Author: Lyude Paul <[email protected]>

drm/nouveau/gsp/r570: Never enter Gcoff state

This commit disables the Gcoff state transition for the r570 platform during suspend operations. It resolves an issue where the Gcoff state caused runtime suspend failures by ensuring the bEnteringGcoffState flag is permanently set to 0.

drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/fbsr.c r570_fbsr_init(struct nvkm_gsp *gsp, struct sg_table *sgt, u64 size) · line 87

Quoted 13 lines
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/fbsr.c +1 -1
index 2945d5b4e5707..af5aa5065c3dd 100644
@@ -81,7 +81,7 @@ r570_fbsr_init(struct nvkm_gsp *gsp, struct sg_table *sgt, u64 size)
 	ctrl->hClient = gsp->internal.client.object.handle;
 	ctrl->hSysMem = memlist.handle;
 	ctrl->sysmemAddrOfSuspendResumeData = gsp->sr.meta.addr;
-	ctrl->bEnteringGcoffState = 1;
+	ctrl->bEnteringGcoffState = 0;
 
 	ret = nvkm_gsp_rm_ctrl_wr(&gsp->internal.device.subdevice, ctrl);
 	if (ret)

[Severity: High]
This is a pre-existing issue, but I have a question about the error handling paths during suspend in this file.

If r570_fbsr_init() or other operations like nvkm_instobj_save() return an error, those errors propagate out of r570_fbsr_suspend():

drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/fbsr.c:r570_fbsr_suspend() {
    ...
	/* Stop channel scheduling. */
	r570_fbsr_suspend_channels(gsp, true);

	/* Save BAR2 allocations to system memory. */
	list_for_each_entry(iobj, &imem->list, head) {
		if (iobj->preserve) {
			ret = nvkm_instobj_save(iobj);
			if (ret)
				return ret;
    ...
}

If any of these early returns are taken, r570_fbsr_suspend_channels(gsp, false) is never called. Will this leave the GSP active channel scheduling permanently disabled and result in a GPU hang if the PM core aborts the suspend process?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
author maintainer
#8 lore raw

PATCH v2 3/4 drm/nouveau/gsp/r570: Set oldLevel correctly in GSP resume arguments

In reply to Lyude Paul

The way that OpenRM handles this is a bit funky. By default, OpenRM passes through NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_3 as the supposed power level that the GPU is entering. This is misleading though - because as far as I can tell, that argument is never actually provided to GSP and appears to be used mostly for internal state tracking by the driver.

What actually happens, is that on resume - OpenRM tells GSP that it's resuming the GPU from LEVEL_4.

This is one part of getting runtime PM to be genuinely reliable with GSP firmware.

Fixes 53dac0623853 ("drm/nouveau/gsp: add support for 570.144")
Cc <[email protected]> # v6.16+
---
 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c      | 2 +-
 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/nvrm/gsp.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c +1 -1
index 996941c668ba9..00158697bd77a 100644
@@ -197,7 +197,7 @@ r570_gsp_set_rmargs(struct nvkm_gsp *gsp, bool resume)
 		args->srInitArguments.flags = 0;
 		args->srInitArguments.bInPMTransition = 0;
 	} else {
-		args->srInitArguments.oldLevel = NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_3;
+		args->srInitArguments.oldLevel = NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_4;
 		args->srInitArguments.flags = 0;
 		args->srInitArguments.bInPMTransition = 1;
 	}
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/nvrm/gsp.h +1 -1
index b6075021e74f5..1904305b69624 100644
@@ -521,7 +521,7 @@ typedef struct
     } profilerArgs;
 } GSP_ARGUMENTS_CACHED;
 
-#define NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_3            (0x00000003U)
+#define NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_4            (0x00000004U)
 
 typedef struct
 {
Signature · 1 line
2.54.0
author maintainer
#9 lore raw

PATCH v2 4/4 drm/nouveau/gsp/r570: Add missing state flags to GSP resume arguments

In reply to Lyude Paul

When resuming the GPU, we need to let GSP know that we need it to avoid destructive state transitions when bringing the GPU back up. Otherwise, we will end up with a plethora of strange behavior after coming out of resume
- such as push buffers randomly timing out.

Fixes 53dac0623853 ("drm/nouveau/gsp: add support for 570.144")
Cc <[email protected]> # v6.16+
---
 drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c     | 3 ++-
 .../gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/nvrm/gsp.h    | 8 ++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/gsp.c +2 -1
index 00158697bd77a..b7f396897e56c 100644
@@ -198,7 +198,8 @@ r570_gsp_set_rmargs(struct nvkm_gsp *gsp, bool resume)
 		args->srInitArguments.bInPMTransition = 0;
 	} else {
 		args->srInitArguments.oldLevel = NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_4;
-		args->srInitArguments.flags = 0;
+		args->srInitArguments.flags =
+			GPU_STATE_FLAGS_PRESERVING | GPU_STATE_FLAGS_PM_TRANSITION;
 		args->srInitArguments.bInPMTransition = 1;
 	}
 
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r570/nvrm/gsp.h +8 -0
index 1904305b69624..aa6c19965e0b4 100644
@@ -523,6 +523,14 @@ typedef struct
 
 #define NV2080_CTRL_GPU_SET_POWER_STATE_GPU_LEVEL_4            (0x00000004U)
 
+#define GPU_STATE_FLAGS_PRESERVING         BIT(0)  // GPU state is preserved
+#define GPU_STATE_FLAGS_VGA_TRANSITION     BIT(1)   // To be used with GPU_STATE_FLAGS_PRESERVING.
+#define GPU_STATE_FLAGS_PM_TRANSITION      BIT(2)   // To be used with GPU_STATE_FLAGS_PRESERVING.
+#define GPU_STATE_FLAGS_PM_SUSPEND         BIT(3)
+#define GPU_STATE_FLAGS_PM_HIBERNATE       BIT(4)
+#define GPU_STATE_FLAGS_GC6_TRANSITION     BIT(5)  // To be used with GPU_STATE_FLAGS_PRESERVING.
+#define GPU_STATE_FLAGS_FAST_UNLOAD        BIT(6)  // Used during windows restart, skips stateDestroy steps
+
 typedef struct
 {
     // Magic for verification by secure ucode
Signature · 1 line
2.54.0
#10 lore raw
In reply to Lyude Paul
Quoted 5 lines · Lyude Paul

Runtime PM has been kind of unreliable with GSP for a while. It works well enough to shut the GPU off and turn it back on, but more often then not it ends up leaving the GPU in a broken state on resume - which makes it impossible to really do anything else with it.

Quoted 8 lines

Recently however, I discovered that it's been failing much harder on some ampere systems. This lead me down a rabbit hole that lead me to figure out one of our previous fixes for runtime PM wasn't correct. After fixing that and combining it with some fixes we had tried in the past without success, I finally managed to get nouveau to handle runtime PM with the GSP perfectly. These are those fixes.

Tested on a Lenovo P16 G1 (100 runtime PM cycles!), and RTX4000.

This is v2, and no changelog. What's going on?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
author maintainer
#11 lore raw

I forgot to link to the previous series:

https://patchwork.freedesktop.org/series/169227/

I also thought i hadn't sent a cover letter for it, but apparently I did - I would have reused that if I realized, whoops.

Regardless: I'll be sending out a V3 today, since after doing a lot of testing I came to the conclusion we should drop the change from LEVEL_3 to LEVEL_4 but keep pretty much everything else for now.

Quoted 23 lines · Andy Shevchenko
Quoted 19 lines · Lyude Paul

Runtime PM has been kind of unreliable with GSP for a while. It works
well enough to shut the GPU off and turn it back on, but more often then
not it ends up leaving the GPU in a broken state on resume - which makes
it impossible to really do anything else with it.

Recently however, I discovered that it's been failing much harder on
some ampere systems. This lead me down a rabbit hole that lead me to
figure out one of our previous fixes for runtime PM wasn't correct. After fixing that and combining it with some fixes we had tried in the
past without success, I finally managed to get nouveau to handle runtime
PM with the GSP perfectly. These are those fixes.

Quoted 1 line

Tested on a Lenovo P16 G1 (100 runtime PM cycles!), and RTX4000.

This is v2, and no changelog. What's going on?