* [PATCH 2/2] nouveau: Membar before between semaphore writes and the interrupt
2025-08-28 20:55 [PATCH 1/2] nouveau: fix disabling the nonstall irq due to storm code Dave Airlie
@ 2025-08-28 20:55 ` Dave Airlie
0 siblings, 0 replies; 9+ messages in thread
From: Dave Airlie @ 2025-08-28 20:55 UTC (permalink / raw)
To: dri-devel; +Cc: nouveau, dakr
From: Faith Ekstrand <faith.ekstrand@collabora.com>
This ensures that the memory write and the interrupt are properly
ordered and we won't wake up the kernel before the semaphore write has
hit memory.
Fixes: b1ca384772b6 ("drm/nouveau/gv100-: switch to volta semaphore methods")
Cc: stable@vger.kernel.org
Signed-off-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
drivers/gpu/drm/nouveau/gv100_fence.c | 7 +-
.../drm/nouveau/include/nvhw/class/clc36f.h | 85 +++++++++++++++++++
2 files changed, 91 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/gv100_fence.c b/drivers/gpu/drm/nouveau/gv100_fence.c
index cccdeca72002..317e516c4ec7 100644
--- a/drivers/gpu/drm/nouveau/gv100_fence.c
+++ b/drivers/gpu/drm/nouveau/gv100_fence.c
@@ -18,7 +18,7 @@ gv100_fence_emit32(struct nouveau_channel *chan, u64 virtual, u32 sequence)
struct nvif_push *push = &chan->chan.push;
int ret;
- ret = PUSH_WAIT(push, 8);
+ ret = PUSH_WAIT(push, 13);
if (ret)
return ret;
@@ -32,6 +32,11 @@ gv100_fence_emit32(struct nouveau_channel *chan, u64 virtual, u32 sequence)
NVDEF(NVC36F, SEM_EXECUTE, PAYLOAD_SIZE, 32BIT) |
NVDEF(NVC36F, SEM_EXECUTE, RELEASE_TIMESTAMP, DIS));
+ PUSH_MTHD(push, NVC36F, MEM_OP_A, 0,
+ MEM_OP_B, 0,
+ MEM_OP_C, NVDEF(NVC36F, MEM_OP_C, MEMBAR_TYPE, SYS_MEMBAR),
+ MEM_OP_D, NVDEF(NVC36F, MEM_OP_D, OPERATION, MEMBAR));
+
PUSH_MTHD(push, NVC36F, NON_STALL_INTERRUPT, 0);
PUSH_KICK(push);
diff --git a/drivers/gpu/drm/nouveau/include/nvhw/class/clc36f.h b/drivers/gpu/drm/nouveau/include/nvhw/class/clc36f.h
index 8735dda4c8a7..338f74b9f501 100644
--- a/drivers/gpu/drm/nouveau/include/nvhw/class/clc36f.h
+++ b/drivers/gpu/drm/nouveau/include/nvhw/class/clc36f.h
@@ -7,6 +7,91 @@
#define NVC36F_NON_STALL_INTERRUPT (0x00000020)
#define NVC36F_NON_STALL_INTERRUPT_HANDLE 31:0
+// NOTE - MEM_OP_A and MEM_OP_B have been replaced in gp100 with methods for
+// specifying the page address for a targeted TLB invalidate and the uTLB for
+// a targeted REPLAY_CANCEL for UVM.
+// The previous MEM_OP_A/B functionality is in MEM_OP_C/D, with slightly
+// rearranged fields.
+#define NVC36F_MEM_OP_A (0x00000028)
+#define NVC36F_MEM_OP_A_TLB_INVALIDATE_CANCEL_TARGET_CLIENT_UNIT_ID 5:0 // only relevant for REPLAY_CANCEL_TARGETED
+#define NVC36F_MEM_OP_A_TLB_INVALIDATE_INVALIDATION_SIZE 5:0 // Used to specify size of invalidate, used for invalidates which are not of the REPLAY_CANCEL_TARGETED type
+#define NVC36F_MEM_OP_A_TLB_INVALIDATE_CANCEL_TARGET_GPC_ID 10:6 // only relevant for REPLAY_CANCEL_TARGETED
+#define NVC36F_MEM_OP_A_TLB_INVALIDATE_CANCEL_MMU_ENGINE_ID 6:0 // only relevant for REPLAY_CANCEL_VA_GLOBAL
+#define NVC36F_MEM_OP_A_TLB_INVALIDATE_SYSMEMBAR 11:11
+#define NVC36F_MEM_OP_A_TLB_INVALIDATE_SYSMEMBAR_EN 0x00000001
+#define NVC36F_MEM_OP_A_TLB_INVALIDATE_SYSMEMBAR_DIS 0x00000000
+#define NVC36F_MEM_OP_A_TLB_INVALIDATE_TARGET_ADDR_LO 31:12
+#define NVC36F_MEM_OP_B (0x0000002c)
+#define NVC36F_MEM_OP_B_TLB_INVALIDATE_TARGET_ADDR_HI 31:0
+#define NVC36F_MEM_OP_C (0x00000030)
+#define NVC36F_MEM_OP_C_MEMBAR_TYPE 2:0
+#define NVC36F_MEM_OP_C_MEMBAR_TYPE_SYS_MEMBAR 0x00000000
+#define NVC36F_MEM_OP_C_MEMBAR_TYPE_MEMBAR 0x00000001
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB 0:0
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB_ONE 0x00000000
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB_ALL 0x00000001 // Probably nonsensical for MMU_TLB_INVALIDATE_TARGETED
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_GPC 1:1
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_GPC_ENABLE 0x00000000
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_GPC_DISABLE 0x00000001
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_REPLAY 4:2 // only relevant if GPC ENABLE
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_REPLAY_NONE 0x00000000
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_REPLAY_START 0x00000001
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_REPLAY_START_ACK_ALL 0x00000002
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_REPLAY_CANCEL_TARGETED 0x00000003
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_REPLAY_CANCEL_GLOBAL 0x00000004
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_REPLAY_CANCEL_VA_GLOBAL 0x00000005
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACK_TYPE 6:5 // only relevant if GPC ENABLE
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACK_TYPE_NONE 0x00000000
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACK_TYPE_GLOBALLY 0x00000001
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACK_TYPE_INTRANODE 0x00000002
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE 9:7 //only relevant for REPLAY_CANCEL_VA_GLOBAL
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_READ 0
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_WRITE 1
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_ATOMIC_STRONG 2
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_RSVRVD 3
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_ATOMIC_WEAK 4
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_ATOMIC_ALL 5
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_WRITE_AND_ATOMIC 6
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_ALL 7
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL 9:7 // Invalidate affects this level and all below
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_ALL 0x00000000 // Invalidate tlb caches at all levels of the page table
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_PTE_ONLY 0x00000001
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_UP_TO_PDE0 0x00000002
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_UP_TO_PDE1 0x00000003
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_UP_TO_PDE2 0x00000004
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_UP_TO_PDE3 0x00000005
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_UP_TO_PDE4 0x00000006
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_UP_TO_PDE5 0x00000007
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB_APERTURE 11:10 // only relevant if PDB_ONE
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB_APERTURE_VID_MEM 0x00000000
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB_APERTURE_SYS_MEM_COHERENT 0x00000002
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB_APERTURE_SYS_MEM_NONCOHERENT 0x00000003
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB_ADDR_LO 31:12 // only relevant if PDB_ONE
+#define NVC36F_MEM_OP_C_ACCESS_COUNTER_CLR_TARGETED_NOTIFY_TAG 19:0
+// MEM_OP_D MUST be preceded by MEM_OPs A-C.
+#define NVC36F_MEM_OP_D (0x00000034)
+#define NVC36F_MEM_OP_D_TLB_INVALIDATE_PDB_ADDR_HI 26:0 // only relevant if PDB_ONE
+#define NVC36F_MEM_OP_D_OPERATION 31:27
+#define NVC36F_MEM_OP_D_OPERATION_MEMBAR 0x00000005
+#define NVC36F_MEM_OP_D_OPERATION_MMU_TLB_INVALIDATE 0x00000009
+#define NVC36F_MEM_OP_D_OPERATION_MMU_TLB_INVALIDATE_TARGETED 0x0000000a
+#define NVC36F_MEM_OP_D_OPERATION_L2_PEERMEM_INVALIDATE 0x0000000d
+#define NVC36F_MEM_OP_D_OPERATION_L2_SYSMEM_INVALIDATE 0x0000000e
+// CLEAN_LINES is an alias for Tegra/GPU IP usage
+#define NVC36F_MEM_OP_B_OPERATION_L2_INVALIDATE_CLEAN_LINES 0x0000000e
+#define NVC36F_MEM_OP_D_OPERATION_L2_CLEAN_COMPTAGS 0x0000000f
+#define NVC36F_MEM_OP_D_OPERATION_L2_FLUSH_DIRTY 0x00000010
+#define NVC36F_MEM_OP_D_OPERATION_L2_WAIT_FOR_SYS_PENDING_READS 0x00000015
+#define NVC36F_MEM_OP_D_OPERATION_ACCESS_COUNTER_CLR 0x00000016
+#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TYPE 1:0
+#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TYPE_MIMC 0x00000000
+#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TYPE_MOMC 0x00000001
+#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TYPE_ALL 0x00000002
+#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TYPE_TARGETED 0x00000003
+#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TARGETED_TYPE 2:2
+#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TARGETED_TYPE_MIMC 0x00000000
+#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TARGETED_TYPE_MOMC 0x00000001
+#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TARGETED_BANK 6:3
#define NVC36F_SEM_ADDR_LO (0x0000005c)
#define NVC36F_SEM_ADDR_LO_OFFSET 31:2
#define NVC36F_SEM_ADDR_HI (0x00000060)
--
2.50.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 1/2] nouveau: fix disabling the nonstall irq due to storm code. (v2)
@ 2025-08-29 2:16 Dave Airlie
2025-08-29 2:16 ` [PATCH 2/2] nouveau: Membar before between semaphore writes and the interrupt Dave Airlie
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Dave Airlie @ 2025-08-29 2:16 UTC (permalink / raw)
To: dri-devel; +Cc: nouveau, dakr
From: Dave Airlie <airlied@redhat.com>
Nouveau has code that when it gets an IRQ with no allowed handler
it disables it to avoid storms.
However with nonstall interrupts, we often disable them from
the drm driver, but still request their emission via the push submission.
Just don't disable nonstall irqs ever in normal operation, the
event handling code will filter them out, and the driver will
just enable/disable them at load time.
This fixes timeouts we've been seeing on/off for a long time,
but they became a lot more noticable on Blackwell.
This doesn't fix all of them, there is a subsequent fence emission
fix to fix the last few.
Fixes: 3ebd64aa3c4f ("drm/nouveau/intr: support multiple trees, and explicit interfaces")
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
v2: add missing ga102.
---
.../gpu/drm/nouveau/nvkm/engine/fifo/base.c | 2 ++
.../gpu/drm/nouveau/nvkm/engine/fifo/ga100.c | 22 ++++++++++++-------
.../gpu/drm/nouveau/nvkm/engine/fifo/ga102.c | 1 +
.../gpu/drm/nouveau/nvkm/engine/fifo/priv.h | 2 ++
.../nouveau/nvkm/subdev/gsp/rm/r535/fifo.c | 2 +-
5 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c
index fdffa0391b31..6fd4e60634fb 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c
@@ -350,6 +350,8 @@ nvkm_fifo_dtor(struct nvkm_engine *engine)
nvkm_chid_unref(&fifo->chid);
nvkm_event_fini(&fifo->nonstall.event);
+ if (fifo->func->nonstall_dtor)
+ fifo->func->nonstall_dtor(fifo);
mutex_destroy(&fifo->mutex);
if (fifo->func->dtor)
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c
index e74493a4569e..81beae473122 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c
@@ -517,19 +517,11 @@ ga100_fifo_nonstall_intr(struct nvkm_inth *inth)
static void
ga100_fifo_nonstall_block(struct nvkm_event *event, int type, int index)
{
- struct nvkm_fifo *fifo = container_of(event, typeof(*fifo), nonstall.event);
- struct nvkm_runl *runl = nvkm_runl_get(fifo, index, 0);
-
- nvkm_inth_block(&runl->nonstall.inth);
}
static void
ga100_fifo_nonstall_allow(struct nvkm_event *event, int type, int index)
{
- struct nvkm_fifo *fifo = container_of(event, typeof(*fifo), nonstall.event);
- struct nvkm_runl *runl = nvkm_runl_get(fifo, index, 0);
-
- nvkm_inth_allow(&runl->nonstall.inth);
}
const struct nvkm_event_func
@@ -564,12 +556,25 @@ ga100_fifo_nonstall_ctor(struct nvkm_fifo *fifo)
if (ret)
return ret;
+ nvkm_inth_allow(&runl->nonstall.inth);
+
nr = max(nr, runl->id + 1);
}
return nr;
}
+void
+ga100_fifo_nonstall_dtor(struct nvkm_fifo *fifo)
+{
+ struct nvkm_runl *runl;
+ nvkm_runl_foreach(runl, fifo) {
+ if (runl->nonstall.vector < 0)
+ continue;
+ nvkm_inth_block(&runl->nonstall.inth);
+ }
+}
+
int
ga100_fifo_runl_ctor(struct nvkm_fifo *fifo)
{
@@ -599,6 +604,7 @@ ga100_fifo = {
.runl_ctor = ga100_fifo_runl_ctor,
.mmu_fault = &tu102_fifo_mmu_fault,
.nonstall_ctor = ga100_fifo_nonstall_ctor,
+ .nonstall_dtor = ga100_fifo_nonstall_dtor,
.nonstall = &ga100_fifo_nonstall,
.runl = &ga100_runl,
.runq = &ga100_runq,
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga102.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga102.c
index 755235f55b3a..18a0b1f4eab7 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga102.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga102.c
@@ -30,6 +30,7 @@ ga102_fifo = {
.runl_ctor = ga100_fifo_runl_ctor,
.mmu_fault = &tu102_fifo_mmu_fault,
.nonstall_ctor = ga100_fifo_nonstall_ctor,
+ .nonstall_dtor = ga100_fifo_nonstall_dtor,
.nonstall = &ga100_fifo_nonstall,
.runl = &ga100_runl,
.runq = &ga100_runq,
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h
index 5e81ae195329..fff1428ef267 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h
@@ -41,6 +41,7 @@ struct nvkm_fifo_func {
void (*start)(struct nvkm_fifo *, unsigned long *);
int (*nonstall_ctor)(struct nvkm_fifo *);
+ void (*nonstall_dtor)(struct nvkm_fifo *);
const struct nvkm_event_func *nonstall;
const struct nvkm_runl_func *runl;
@@ -200,6 +201,7 @@ u32 tu102_chan_doorbell_handle(struct nvkm_chan *);
int ga100_fifo_runl_ctor(struct nvkm_fifo *);
int ga100_fifo_nonstall_ctor(struct nvkm_fifo *);
+void ga100_fifo_nonstall_dtor(struct nvkm_fifo *);
extern const struct nvkm_event_func ga100_fifo_nonstall;
extern const struct nvkm_runl_func ga100_runl;
extern const struct nvkm_runq_func ga100_runq;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c
index 1ac5628c5140..b8be0a872e7a 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c
@@ -601,7 +601,7 @@ r535_fifo_new(const struct nvkm_fifo_func *hw, struct nvkm_device *device,
rm->chan.func = &r535_chan;
rm->nonstall = &ga100_fifo_nonstall;
rm->nonstall_ctor = ga100_fifo_nonstall_ctor;
-
+ rm->nonstall_dtor = ga100_fifo_nonstall_dtor;
return nvkm_fifo_new_(rm, device, type, inst, pfifo);
}
--
2.50.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] nouveau: Membar before between semaphore writes and the interrupt
2025-08-29 2:16 [PATCH 1/2] nouveau: fix disabling the nonstall irq due to storm code. (v2) Dave Airlie
@ 2025-08-29 2:16 ` Dave Airlie
2025-08-29 18:21 ` Danilo Krummrich
2025-08-29 23:09 ` James Jones
2025-08-29 14:49 ` [PATCH 1/2] nouveau: fix disabling the nonstall irq due to storm code. (v2) Faith Ekstrand
` (2 subsequent siblings)
3 siblings, 2 replies; 9+ messages in thread
From: Dave Airlie @ 2025-08-29 2:16 UTC (permalink / raw)
To: dri-devel; +Cc: nouveau, dakr
From: Faith Ekstrand <faith.ekstrand@collabora.com>
This ensures that the memory write and the interrupt are properly
ordered and we won't wake up the kernel before the semaphore write has
hit memory.
Fixes: b1ca384772b6 ("drm/nouveau/gv100-: switch to volta semaphore methods")
Cc: stable@vger.kernel.org
Signed-off-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
drivers/gpu/drm/nouveau/gv100_fence.c | 7 +-
.../drm/nouveau/include/nvhw/class/clc36f.h | 85 +++++++++++++++++++
2 files changed, 91 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/nouveau/gv100_fence.c b/drivers/gpu/drm/nouveau/gv100_fence.c
index cccdeca72002..317e516c4ec7 100644
--- a/drivers/gpu/drm/nouveau/gv100_fence.c
+++ b/drivers/gpu/drm/nouveau/gv100_fence.c
@@ -18,7 +18,7 @@ gv100_fence_emit32(struct nouveau_channel *chan, u64 virtual, u32 sequence)
struct nvif_push *push = &chan->chan.push;
int ret;
- ret = PUSH_WAIT(push, 8);
+ ret = PUSH_WAIT(push, 13);
if (ret)
return ret;
@@ -32,6 +32,11 @@ gv100_fence_emit32(struct nouveau_channel *chan, u64 virtual, u32 sequence)
NVDEF(NVC36F, SEM_EXECUTE, PAYLOAD_SIZE, 32BIT) |
NVDEF(NVC36F, SEM_EXECUTE, RELEASE_TIMESTAMP, DIS));
+ PUSH_MTHD(push, NVC36F, MEM_OP_A, 0,
+ MEM_OP_B, 0,
+ MEM_OP_C, NVDEF(NVC36F, MEM_OP_C, MEMBAR_TYPE, SYS_MEMBAR),
+ MEM_OP_D, NVDEF(NVC36F, MEM_OP_D, OPERATION, MEMBAR));
+
PUSH_MTHD(push, NVC36F, NON_STALL_INTERRUPT, 0);
PUSH_KICK(push);
diff --git a/drivers/gpu/drm/nouveau/include/nvhw/class/clc36f.h b/drivers/gpu/drm/nouveau/include/nvhw/class/clc36f.h
index 8735dda4c8a7..338f74b9f501 100644
--- a/drivers/gpu/drm/nouveau/include/nvhw/class/clc36f.h
+++ b/drivers/gpu/drm/nouveau/include/nvhw/class/clc36f.h
@@ -7,6 +7,91 @@
#define NVC36F_NON_STALL_INTERRUPT (0x00000020)
#define NVC36F_NON_STALL_INTERRUPT_HANDLE 31:0
+// NOTE - MEM_OP_A and MEM_OP_B have been replaced in gp100 with methods for
+// specifying the page address for a targeted TLB invalidate and the uTLB for
+// a targeted REPLAY_CANCEL for UVM.
+// The previous MEM_OP_A/B functionality is in MEM_OP_C/D, with slightly
+// rearranged fields.
+#define NVC36F_MEM_OP_A (0x00000028)
+#define NVC36F_MEM_OP_A_TLB_INVALIDATE_CANCEL_TARGET_CLIENT_UNIT_ID 5:0 // only relevant for REPLAY_CANCEL_TARGETED
+#define NVC36F_MEM_OP_A_TLB_INVALIDATE_INVALIDATION_SIZE 5:0 // Used to specify size of invalidate, used for invalidates which are not of the REPLAY_CANCEL_TARGETED type
+#define NVC36F_MEM_OP_A_TLB_INVALIDATE_CANCEL_TARGET_GPC_ID 10:6 // only relevant for REPLAY_CANCEL_TARGETED
+#define NVC36F_MEM_OP_A_TLB_INVALIDATE_CANCEL_MMU_ENGINE_ID 6:0 // only relevant for REPLAY_CANCEL_VA_GLOBAL
+#define NVC36F_MEM_OP_A_TLB_INVALIDATE_SYSMEMBAR 11:11
+#define NVC36F_MEM_OP_A_TLB_INVALIDATE_SYSMEMBAR_EN 0x00000001
+#define NVC36F_MEM_OP_A_TLB_INVALIDATE_SYSMEMBAR_DIS 0x00000000
+#define NVC36F_MEM_OP_A_TLB_INVALIDATE_TARGET_ADDR_LO 31:12
+#define NVC36F_MEM_OP_B (0x0000002c)
+#define NVC36F_MEM_OP_B_TLB_INVALIDATE_TARGET_ADDR_HI 31:0
+#define NVC36F_MEM_OP_C (0x00000030)
+#define NVC36F_MEM_OP_C_MEMBAR_TYPE 2:0
+#define NVC36F_MEM_OP_C_MEMBAR_TYPE_SYS_MEMBAR 0x00000000
+#define NVC36F_MEM_OP_C_MEMBAR_TYPE_MEMBAR 0x00000001
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB 0:0
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB_ONE 0x00000000
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB_ALL 0x00000001 // Probably nonsensical for MMU_TLB_INVALIDATE_TARGETED
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_GPC 1:1
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_GPC_ENABLE 0x00000000
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_GPC_DISABLE 0x00000001
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_REPLAY 4:2 // only relevant if GPC ENABLE
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_REPLAY_NONE 0x00000000
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_REPLAY_START 0x00000001
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_REPLAY_START_ACK_ALL 0x00000002
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_REPLAY_CANCEL_TARGETED 0x00000003
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_REPLAY_CANCEL_GLOBAL 0x00000004
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_REPLAY_CANCEL_VA_GLOBAL 0x00000005
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACK_TYPE 6:5 // only relevant if GPC ENABLE
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACK_TYPE_NONE 0x00000000
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACK_TYPE_GLOBALLY 0x00000001
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACK_TYPE_INTRANODE 0x00000002
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE 9:7 //only relevant for REPLAY_CANCEL_VA_GLOBAL
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_READ 0
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_WRITE 1
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_ATOMIC_STRONG 2
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_RSVRVD 3
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_ATOMIC_WEAK 4
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_ATOMIC_ALL 5
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_WRITE_AND_ATOMIC 6
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_ALL 7
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL 9:7 // Invalidate affects this level and all below
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_ALL 0x00000000 // Invalidate tlb caches at all levels of the page table
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_PTE_ONLY 0x00000001
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_UP_TO_PDE0 0x00000002
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_UP_TO_PDE1 0x00000003
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_UP_TO_PDE2 0x00000004
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_UP_TO_PDE3 0x00000005
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_UP_TO_PDE4 0x00000006
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_UP_TO_PDE5 0x00000007
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB_APERTURE 11:10 // only relevant if PDB_ONE
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB_APERTURE_VID_MEM 0x00000000
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB_APERTURE_SYS_MEM_COHERENT 0x00000002
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB_APERTURE_SYS_MEM_NONCOHERENT 0x00000003
+#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB_ADDR_LO 31:12 // only relevant if PDB_ONE
+#define NVC36F_MEM_OP_C_ACCESS_COUNTER_CLR_TARGETED_NOTIFY_TAG 19:0
+// MEM_OP_D MUST be preceded by MEM_OPs A-C.
+#define NVC36F_MEM_OP_D (0x00000034)
+#define NVC36F_MEM_OP_D_TLB_INVALIDATE_PDB_ADDR_HI 26:0 // only relevant if PDB_ONE
+#define NVC36F_MEM_OP_D_OPERATION 31:27
+#define NVC36F_MEM_OP_D_OPERATION_MEMBAR 0x00000005
+#define NVC36F_MEM_OP_D_OPERATION_MMU_TLB_INVALIDATE 0x00000009
+#define NVC36F_MEM_OP_D_OPERATION_MMU_TLB_INVALIDATE_TARGETED 0x0000000a
+#define NVC36F_MEM_OP_D_OPERATION_L2_PEERMEM_INVALIDATE 0x0000000d
+#define NVC36F_MEM_OP_D_OPERATION_L2_SYSMEM_INVALIDATE 0x0000000e
+// CLEAN_LINES is an alias for Tegra/GPU IP usage
+#define NVC36F_MEM_OP_B_OPERATION_L2_INVALIDATE_CLEAN_LINES 0x0000000e
+#define NVC36F_MEM_OP_D_OPERATION_L2_CLEAN_COMPTAGS 0x0000000f
+#define NVC36F_MEM_OP_D_OPERATION_L2_FLUSH_DIRTY 0x00000010
+#define NVC36F_MEM_OP_D_OPERATION_L2_WAIT_FOR_SYS_PENDING_READS 0x00000015
+#define NVC36F_MEM_OP_D_OPERATION_ACCESS_COUNTER_CLR 0x00000016
+#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TYPE 1:0
+#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TYPE_MIMC 0x00000000
+#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TYPE_MOMC 0x00000001
+#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TYPE_ALL 0x00000002
+#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TYPE_TARGETED 0x00000003
+#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TARGETED_TYPE 2:2
+#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TARGETED_TYPE_MIMC 0x00000000
+#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TARGETED_TYPE_MOMC 0x00000001
+#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TARGETED_BANK 6:3
#define NVC36F_SEM_ADDR_LO (0x0000005c)
#define NVC36F_SEM_ADDR_LO_OFFSET 31:2
#define NVC36F_SEM_ADDR_HI (0x00000060)
--
2.50.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] nouveau: fix disabling the nonstall irq due to storm code. (v2)
2025-08-29 2:16 [PATCH 1/2] nouveau: fix disabling the nonstall irq due to storm code. (v2) Dave Airlie
2025-08-29 2:16 ` [PATCH 2/2] nouveau: Membar before between semaphore writes and the interrupt Dave Airlie
@ 2025-08-29 14:49 ` Faith Ekstrand
2025-08-29 18:21 ` Danilo Krummrich
2025-09-01 18:17 ` M Henning
3 siblings, 0 replies; 9+ messages in thread
From: Faith Ekstrand @ 2025-08-29 14:49 UTC (permalink / raw)
To: Dave Airlie; +Cc: dri-devel, nouveau, dakr
On Thu, Aug 28, 2025 at 10:17 PM Dave Airlie <airlied@gmail.com> wrote:
>
> From: Dave Airlie <airlied@redhat.com>
>
> Nouveau has code that when it gets an IRQ with no allowed handler
> it disables it to avoid storms.
>
> However with nonstall interrupts, we often disable them from
> the drm driver, but still request their emission via the push submission.
>
> Just don't disable nonstall irqs ever in normal operation, the
> event handling code will filter them out, and the driver will
> just enable/disable them at load time.
>
> This fixes timeouts we've been seeing on/off for a long time,
> but they became a lot more noticable on Blackwell.
>
> This doesn't fix all of them, there is a subsequent fence emission
> fix to fix the last few.
>
> Fixes: 3ebd64aa3c4f ("drm/nouveau/intr: support multiple trees, and explicit interfaces")
> Cc: stable@vger.kernel.org
> Signed-off-by: Dave Airlie <airlied@redhat.com>
I don't 100% grok all the storm stuff but this certainly looks
reasonable and I'm convinced it shouldn't break anything
Reviewed-by Faith Ekstrand <faith.ekstrand@collabora.com>
>
> ---
> v2: add missing ga102.
> ---
> .../gpu/drm/nouveau/nvkm/engine/fifo/base.c | 2 ++
> .../gpu/drm/nouveau/nvkm/engine/fifo/ga100.c | 22 ++++++++++++-------
> .../gpu/drm/nouveau/nvkm/engine/fifo/ga102.c | 1 +
> .../gpu/drm/nouveau/nvkm/engine/fifo/priv.h | 2 ++
> .../nouveau/nvkm/subdev/gsp/rm/r535/fifo.c | 2 +-
> 5 files changed, 20 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c
> index fdffa0391b31..6fd4e60634fb 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c
> @@ -350,6 +350,8 @@ nvkm_fifo_dtor(struct nvkm_engine *engine)
> nvkm_chid_unref(&fifo->chid);
>
> nvkm_event_fini(&fifo->nonstall.event);
> + if (fifo->func->nonstall_dtor)
> + fifo->func->nonstall_dtor(fifo);
> mutex_destroy(&fifo->mutex);
>
> if (fifo->func->dtor)
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c
> index e74493a4569e..81beae473122 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c
> @@ -517,19 +517,11 @@ ga100_fifo_nonstall_intr(struct nvkm_inth *inth)
> static void
> ga100_fifo_nonstall_block(struct nvkm_event *event, int type, int index)
> {
> - struct nvkm_fifo *fifo = container_of(event, typeof(*fifo), nonstall.event);
> - struct nvkm_runl *runl = nvkm_runl_get(fifo, index, 0);
> -
> - nvkm_inth_block(&runl->nonstall.inth);
> }
>
> static void
> ga100_fifo_nonstall_allow(struct nvkm_event *event, int type, int index)
> {
> - struct nvkm_fifo *fifo = container_of(event, typeof(*fifo), nonstall.event);
> - struct nvkm_runl *runl = nvkm_runl_get(fifo, index, 0);
> -
> - nvkm_inth_allow(&runl->nonstall.inth);
> }
>
> const struct nvkm_event_func
> @@ -564,12 +556,25 @@ ga100_fifo_nonstall_ctor(struct nvkm_fifo *fifo)
> if (ret)
> return ret;
>
> + nvkm_inth_allow(&runl->nonstall.inth);
> +
> nr = max(nr, runl->id + 1);
> }
>
> return nr;
> }
>
> +void
> +ga100_fifo_nonstall_dtor(struct nvkm_fifo *fifo)
> +{
> + struct nvkm_runl *runl;
> + nvkm_runl_foreach(runl, fifo) {
> + if (runl->nonstall.vector < 0)
> + continue;
> + nvkm_inth_block(&runl->nonstall.inth);
> + }
> +}
> +
> int
> ga100_fifo_runl_ctor(struct nvkm_fifo *fifo)
> {
> @@ -599,6 +604,7 @@ ga100_fifo = {
> .runl_ctor = ga100_fifo_runl_ctor,
> .mmu_fault = &tu102_fifo_mmu_fault,
> .nonstall_ctor = ga100_fifo_nonstall_ctor,
> + .nonstall_dtor = ga100_fifo_nonstall_dtor,
> .nonstall = &ga100_fifo_nonstall,
> .runl = &ga100_runl,
> .runq = &ga100_runq,
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga102.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga102.c
> index 755235f55b3a..18a0b1f4eab7 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga102.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga102.c
> @@ -30,6 +30,7 @@ ga102_fifo = {
> .runl_ctor = ga100_fifo_runl_ctor,
> .mmu_fault = &tu102_fifo_mmu_fault,
> .nonstall_ctor = ga100_fifo_nonstall_ctor,
> + .nonstall_dtor = ga100_fifo_nonstall_dtor,
> .nonstall = &ga100_fifo_nonstall,
> .runl = &ga100_runl,
> .runq = &ga100_runq,
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h
> index 5e81ae195329..fff1428ef267 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h
> @@ -41,6 +41,7 @@ struct nvkm_fifo_func {
> void (*start)(struct nvkm_fifo *, unsigned long *);
>
> int (*nonstall_ctor)(struct nvkm_fifo *);
> + void (*nonstall_dtor)(struct nvkm_fifo *);
> const struct nvkm_event_func *nonstall;
>
> const struct nvkm_runl_func *runl;
> @@ -200,6 +201,7 @@ u32 tu102_chan_doorbell_handle(struct nvkm_chan *);
>
> int ga100_fifo_runl_ctor(struct nvkm_fifo *);
> int ga100_fifo_nonstall_ctor(struct nvkm_fifo *);
> +void ga100_fifo_nonstall_dtor(struct nvkm_fifo *);
> extern const struct nvkm_event_func ga100_fifo_nonstall;
> extern const struct nvkm_runl_func ga100_runl;
> extern const struct nvkm_runq_func ga100_runq;
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c
> index 1ac5628c5140..b8be0a872e7a 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c
> @@ -601,7 +601,7 @@ r535_fifo_new(const struct nvkm_fifo_func *hw, struct nvkm_device *device,
> rm->chan.func = &r535_chan;
> rm->nonstall = &ga100_fifo_nonstall;
> rm->nonstall_ctor = ga100_fifo_nonstall_ctor;
> -
> + rm->nonstall_dtor = ga100_fifo_nonstall_dtor;
> return nvkm_fifo_new_(rm, device, type, inst, pfifo);
> }
>
> --
> 2.50.1
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] nouveau: fix disabling the nonstall irq due to storm code. (v2)
2025-08-29 2:16 [PATCH 1/2] nouveau: fix disabling the nonstall irq due to storm code. (v2) Dave Airlie
2025-08-29 2:16 ` [PATCH 2/2] nouveau: Membar before between semaphore writes and the interrupt Dave Airlie
2025-08-29 14:49 ` [PATCH 1/2] nouveau: fix disabling the nonstall irq due to storm code. (v2) Faith Ekstrand
@ 2025-08-29 18:21 ` Danilo Krummrich
2025-09-01 18:17 ` M Henning
3 siblings, 0 replies; 9+ messages in thread
From: Danilo Krummrich @ 2025-08-29 18:21 UTC (permalink / raw)
To: Dave Airlie; +Cc: dri-devel, nouveau
On 8/29/25 4:16 AM, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
>
> Nouveau has code that when it gets an IRQ with no allowed handler
> it disables it to avoid storms.
>
> However with nonstall interrupts, we often disable them from
> the drm driver, but still request their emission via the push submission.
>
> Just don't disable nonstall irqs ever in normal operation, the
> event handling code will filter them out, and the driver will
> just enable/disable them at load time.
>
> This fixes timeouts we've been seeing on/off for a long time,
> but they became a lot more noticable on Blackwell.
>
> This doesn't fix all of them, there is a subsequent fence emission
> fix to fix the last few.
>
> Fixes: 3ebd64aa3c4f ("drm/nouveau/intr: support multiple trees, and explicit interfaces")
> Cc: stable@vger.kernel.org
> Signed-off-by: Dave Airlie <airlied@redhat.com>
Applied to drm-misc-fixes, thanks!
[ Fix a typo and a minor checkpatch.pl warning; remove "v2" from commit
subject. - Danilo ]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] nouveau: Membar before between semaphore writes and the interrupt
2025-08-29 2:16 ` [PATCH 2/2] nouveau: Membar before between semaphore writes and the interrupt Dave Airlie
@ 2025-08-29 18:21 ` Danilo Krummrich
2025-08-29 23:09 ` James Jones
1 sibling, 0 replies; 9+ messages in thread
From: Danilo Krummrich @ 2025-08-29 18:21 UTC (permalink / raw)
To: Dave Airlie; +Cc: dri-devel, nouveau
On 8/29/25 4:16 AM, Dave Airlie wrote:
> From: Faith Ekstrand <faith.ekstrand@collabora.com>
>
> This ensures that the memory write and the interrupt are properly
> ordered and we won't wake up the kernel before the semaphore write has
> hit memory.
>
> Fixes: b1ca384772b6 ("drm/nouveau/gv100-: switch to volta semaphore methods")
> Cc: stable@vger.kernel.org
> Signed-off-by: Faith Ekstrand <faith.ekstrand@collabora.com>
> Signed-off-by: Dave Airlie <airlied@redhat.com>
Applied to drm-misc-fixes, thanks!
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] nouveau: Membar before between semaphore writes and the interrupt
2025-08-29 2:16 ` [PATCH 2/2] nouveau: Membar before between semaphore writes and the interrupt Dave Airlie
2025-08-29 18:21 ` Danilo Krummrich
@ 2025-08-29 23:09 ` James Jones
1 sibling, 0 replies; 9+ messages in thread
From: James Jones @ 2025-08-29 23:09 UTC (permalink / raw)
To: Dave Airlie, dri-devel; +Cc: nouveau, dakr
For posterity: This surprised me, so I asked our architecture team
whether it makes sense. They confirmed the additional sysmembar is
required for correct ordering between the interrupt handler's CPU read
and the host semaphore release's memory write.
Thanks,
-James
On 8/28/25 19:16, Dave Airlie wrote:
> From: Faith Ekstrand <faith.ekstrand@collabora.com>
>
> This ensures that the memory write and the interrupt are properly
> ordered and we won't wake up the kernel before the semaphore write has
> hit memory.
>
> Fixes: b1ca384772b6 ("drm/nouveau/gv100-: switch to volta semaphore methods")
> Cc: stable@vger.kernel.org
> Signed-off-by: Faith Ekstrand <faith.ekstrand@collabora.com>
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
> drivers/gpu/drm/nouveau/gv100_fence.c | 7 +-
> .../drm/nouveau/include/nvhw/class/clc36f.h | 85 +++++++++++++++++++
> 2 files changed, 91 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/nouveau/gv100_fence.c b/drivers/gpu/drm/nouveau/gv100_fence.c
> index cccdeca72002..317e516c4ec7 100644
> --- a/drivers/gpu/drm/nouveau/gv100_fence.c
> +++ b/drivers/gpu/drm/nouveau/gv100_fence.c
> @@ -18,7 +18,7 @@ gv100_fence_emit32(struct nouveau_channel *chan, u64 virtual, u32 sequence)
> struct nvif_push *push = &chan->chan.push;
> int ret;
>
> - ret = PUSH_WAIT(push, 8);
> + ret = PUSH_WAIT(push, 13);
> if (ret)
> return ret;
>
> @@ -32,6 +32,11 @@ gv100_fence_emit32(struct nouveau_channel *chan, u64 virtual, u32 sequence)
> NVDEF(NVC36F, SEM_EXECUTE, PAYLOAD_SIZE, 32BIT) |
> NVDEF(NVC36F, SEM_EXECUTE, RELEASE_TIMESTAMP, DIS));
>
> + PUSH_MTHD(push, NVC36F, MEM_OP_A, 0,
> + MEM_OP_B, 0,
> + MEM_OP_C, NVDEF(NVC36F, MEM_OP_C, MEMBAR_TYPE, SYS_MEMBAR),
> + MEM_OP_D, NVDEF(NVC36F, MEM_OP_D, OPERATION, MEMBAR));
> +
> PUSH_MTHD(push, NVC36F, NON_STALL_INTERRUPT, 0);
>
> PUSH_KICK(push);
> diff --git a/drivers/gpu/drm/nouveau/include/nvhw/class/clc36f.h b/drivers/gpu/drm/nouveau/include/nvhw/class/clc36f.h
> index 8735dda4c8a7..338f74b9f501 100644
> --- a/drivers/gpu/drm/nouveau/include/nvhw/class/clc36f.h
> +++ b/drivers/gpu/drm/nouveau/include/nvhw/class/clc36f.h
> @@ -7,6 +7,91 @@
>
> #define NVC36F_NON_STALL_INTERRUPT (0x00000020)
> #define NVC36F_NON_STALL_INTERRUPT_HANDLE 31:0
> +// NOTE - MEM_OP_A and MEM_OP_B have been replaced in gp100 with methods for
> +// specifying the page address for a targeted TLB invalidate and the uTLB for
> +// a targeted REPLAY_CANCEL for UVM.
> +// The previous MEM_OP_A/B functionality is in MEM_OP_C/D, with slightly
> +// rearranged fields.
> +#define NVC36F_MEM_OP_A (0x00000028)
> +#define NVC36F_MEM_OP_A_TLB_INVALIDATE_CANCEL_TARGET_CLIENT_UNIT_ID 5:0 // only relevant for REPLAY_CANCEL_TARGETED
> +#define NVC36F_MEM_OP_A_TLB_INVALIDATE_INVALIDATION_SIZE 5:0 // Used to specify size of invalidate, used for invalidates which are not of the REPLAY_CANCEL_TARGETED type
> +#define NVC36F_MEM_OP_A_TLB_INVALIDATE_CANCEL_TARGET_GPC_ID 10:6 // only relevant for REPLAY_CANCEL_TARGETED
> +#define NVC36F_MEM_OP_A_TLB_INVALIDATE_CANCEL_MMU_ENGINE_ID 6:0 // only relevant for REPLAY_CANCEL_VA_GLOBAL
> +#define NVC36F_MEM_OP_A_TLB_INVALIDATE_SYSMEMBAR 11:11
> +#define NVC36F_MEM_OP_A_TLB_INVALIDATE_SYSMEMBAR_EN 0x00000001
> +#define NVC36F_MEM_OP_A_TLB_INVALIDATE_SYSMEMBAR_DIS 0x00000000
> +#define NVC36F_MEM_OP_A_TLB_INVALIDATE_TARGET_ADDR_LO 31:12
> +#define NVC36F_MEM_OP_B (0x0000002c)
> +#define NVC36F_MEM_OP_B_TLB_INVALIDATE_TARGET_ADDR_HI 31:0
> +#define NVC36F_MEM_OP_C (0x00000030)
> +#define NVC36F_MEM_OP_C_MEMBAR_TYPE 2:0
> +#define NVC36F_MEM_OP_C_MEMBAR_TYPE_SYS_MEMBAR 0x00000000
> +#define NVC36F_MEM_OP_C_MEMBAR_TYPE_MEMBAR 0x00000001
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB 0:0
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB_ONE 0x00000000
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB_ALL 0x00000001 // Probably nonsensical for MMU_TLB_INVALIDATE_TARGETED
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_GPC 1:1
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_GPC_ENABLE 0x00000000
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_GPC_DISABLE 0x00000001
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_REPLAY 4:2 // only relevant if GPC ENABLE
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_REPLAY_NONE 0x00000000
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_REPLAY_START 0x00000001
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_REPLAY_START_ACK_ALL 0x00000002
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_REPLAY_CANCEL_TARGETED 0x00000003
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_REPLAY_CANCEL_GLOBAL 0x00000004
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_REPLAY_CANCEL_VA_GLOBAL 0x00000005
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACK_TYPE 6:5 // only relevant if GPC ENABLE
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACK_TYPE_NONE 0x00000000
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACK_TYPE_GLOBALLY 0x00000001
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACK_TYPE_INTRANODE 0x00000002
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE 9:7 //only relevant for REPLAY_CANCEL_VA_GLOBAL
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_READ 0
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_WRITE 1
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_ATOMIC_STRONG 2
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_RSVRVD 3
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_ATOMIC_WEAK 4
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_ATOMIC_ALL 5
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_WRITE_AND_ATOMIC 6
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_ACCESS_TYPE_VIRT_ALL 7
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL 9:7 // Invalidate affects this level and all below
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_ALL 0x00000000 // Invalidate tlb caches at all levels of the page table
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_PTE_ONLY 0x00000001
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_UP_TO_PDE0 0x00000002
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_UP_TO_PDE1 0x00000003
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_UP_TO_PDE2 0x00000004
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_UP_TO_PDE3 0x00000005
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_UP_TO_PDE4 0x00000006
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PAGE_TABLE_LEVEL_UP_TO_PDE5 0x00000007
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB_APERTURE 11:10 // only relevant if PDB_ONE
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB_APERTURE_VID_MEM 0x00000000
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB_APERTURE_SYS_MEM_COHERENT 0x00000002
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB_APERTURE_SYS_MEM_NONCOHERENT 0x00000003
> +#define NVC36F_MEM_OP_C_TLB_INVALIDATE_PDB_ADDR_LO 31:12 // only relevant if PDB_ONE
> +#define NVC36F_MEM_OP_C_ACCESS_COUNTER_CLR_TARGETED_NOTIFY_TAG 19:0
> +// MEM_OP_D MUST be preceded by MEM_OPs A-C.
> +#define NVC36F_MEM_OP_D (0x00000034)
> +#define NVC36F_MEM_OP_D_TLB_INVALIDATE_PDB_ADDR_HI 26:0 // only relevant if PDB_ONE
> +#define NVC36F_MEM_OP_D_OPERATION 31:27
> +#define NVC36F_MEM_OP_D_OPERATION_MEMBAR 0x00000005
> +#define NVC36F_MEM_OP_D_OPERATION_MMU_TLB_INVALIDATE 0x00000009
> +#define NVC36F_MEM_OP_D_OPERATION_MMU_TLB_INVALIDATE_TARGETED 0x0000000a
> +#define NVC36F_MEM_OP_D_OPERATION_L2_PEERMEM_INVALIDATE 0x0000000d
> +#define NVC36F_MEM_OP_D_OPERATION_L2_SYSMEM_INVALIDATE 0x0000000e
> +// CLEAN_LINES is an alias for Tegra/GPU IP usage
> +#define NVC36F_MEM_OP_B_OPERATION_L2_INVALIDATE_CLEAN_LINES 0x0000000e
> +#define NVC36F_MEM_OP_D_OPERATION_L2_CLEAN_COMPTAGS 0x0000000f
> +#define NVC36F_MEM_OP_D_OPERATION_L2_FLUSH_DIRTY 0x00000010
> +#define NVC36F_MEM_OP_D_OPERATION_L2_WAIT_FOR_SYS_PENDING_READS 0x00000015
> +#define NVC36F_MEM_OP_D_OPERATION_ACCESS_COUNTER_CLR 0x00000016
> +#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TYPE 1:0
> +#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TYPE_MIMC 0x00000000
> +#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TYPE_MOMC 0x00000001
> +#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TYPE_ALL 0x00000002
> +#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TYPE_TARGETED 0x00000003
> +#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TARGETED_TYPE 2:2
> +#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TARGETED_TYPE_MIMC 0x00000000
> +#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TARGETED_TYPE_MOMC 0x00000001
> +#define NVC36F_MEM_OP_D_ACCESS_COUNTER_CLR_TARGETED_BANK 6:3
> #define NVC36F_SEM_ADDR_LO (0x0000005c)
> #define NVC36F_SEM_ADDR_LO_OFFSET 31:2
> #define NVC36F_SEM_ADDR_HI (0x00000060)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] nouveau: fix disabling the nonstall irq due to storm code. (v2)
2025-08-29 2:16 [PATCH 1/2] nouveau: fix disabling the nonstall irq due to storm code. (v2) Dave Airlie
` (2 preceding siblings ...)
2025-08-29 18:21 ` Danilo Krummrich
@ 2025-09-01 18:17 ` M Henning
2025-09-01 20:52 ` Dave Airlie
3 siblings, 1 reply; 9+ messages in thread
From: M Henning @ 2025-09-01 18:17 UTC (permalink / raw)
To: Dave Airlie; +Cc: dri-devel, nouveau, dakr
On Thu, Aug 28, 2025 at 10:17 PM Dave Airlie <airlied@gmail.com> wrote:
>
> From: Dave Airlie <airlied@redhat.com>
>
> Nouveau has code that when it gets an IRQ with no allowed handler
> it disables it to avoid storms.
>
> However with nonstall interrupts, we often disable them from
> the drm driver, but still request their emission via the push submission.
>
> Just don't disable nonstall irqs ever in normal operation, the
> event handling code will filter them out, and the driver will
> just enable/disable them at load time.
>
> This fixes timeouts we've been seeing on/off for a long time,
> but they became a lot more noticable on Blackwell.
>
> This doesn't fix all of them, there is a subsequent fence emission
> fix to fix the last few.
>
> Fixes: 3ebd64aa3c4f ("drm/nouveau/intr: support multiple trees, and explicit interfaces")
> Cc: stable@vger.kernel.org
> Signed-off-by: Dave Airlie <airlied@redhat.com>
>
> ---
> v2: add missing ga102.
> ---
> .../gpu/drm/nouveau/nvkm/engine/fifo/base.c | 2 ++
> .../gpu/drm/nouveau/nvkm/engine/fifo/ga100.c | 22 ++++++++++++-------
> .../gpu/drm/nouveau/nvkm/engine/fifo/ga102.c | 1 +
> .../gpu/drm/nouveau/nvkm/engine/fifo/priv.h | 2 ++
> .../nouveau/nvkm/subdev/gsp/rm/r535/fifo.c | 2 +-
> 5 files changed, 20 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c
> index fdffa0391b31..6fd4e60634fb 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c
> @@ -350,6 +350,8 @@ nvkm_fifo_dtor(struct nvkm_engine *engine)
> nvkm_chid_unref(&fifo->chid);
>
> nvkm_event_fini(&fifo->nonstall.event);
> + if (fifo->func->nonstall_dtor)
> + fifo->func->nonstall_dtor(fifo);
> mutex_destroy(&fifo->mutex);
>
> if (fifo->func->dtor)
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c
> index e74493a4569e..81beae473122 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c
> @@ -517,19 +517,11 @@ ga100_fifo_nonstall_intr(struct nvkm_inth *inth)
> static void
> ga100_fifo_nonstall_block(struct nvkm_event *event, int type, int index)
> {
> - struct nvkm_fifo *fifo = container_of(event, typeof(*fifo), nonstall.event);
> - struct nvkm_runl *runl = nvkm_runl_get(fifo, index, 0);
> -
> - nvkm_inth_block(&runl->nonstall.inth);
> }
>
> static void
> ga100_fifo_nonstall_allow(struct nvkm_event *event, int type, int index)
> {
> - struct nvkm_fifo *fifo = container_of(event, typeof(*fifo), nonstall.event);
> - struct nvkm_runl *runl = nvkm_runl_get(fifo, index, 0);
> -
> - nvkm_inth_allow(&runl->nonstall.inth);
> }
>
> const struct nvkm_event_func
> @@ -564,12 +556,25 @@ ga100_fifo_nonstall_ctor(struct nvkm_fifo *fifo)
> if (ret)
> return ret;
>
> + nvkm_inth_allow(&runl->nonstall.inth);
> +
> nr = max(nr, runl->id + 1);
> }
>
> return nr;
> }
>
> +void
> +ga100_fifo_nonstall_dtor(struct nvkm_fifo *fifo)
> +{
> + struct nvkm_runl *runl;
> + nvkm_runl_foreach(runl, fifo) {
> + if (runl->nonstall.vector < 0)
> + continue;
> + nvkm_inth_block(&runl->nonstall.inth);
> + }
> +}
> +
> int
> ga100_fifo_runl_ctor(struct nvkm_fifo *fifo)
> {
> @@ -599,6 +604,7 @@ ga100_fifo = {
> .runl_ctor = ga100_fifo_runl_ctor,
> .mmu_fault = &tu102_fifo_mmu_fault,
> .nonstall_ctor = ga100_fifo_nonstall_ctor,
> + .nonstall_dtor = ga100_fifo_nonstall_dtor,
> .nonstall = &ga100_fifo_nonstall,
> .runl = &ga100_runl,
> .runq = &ga100_runq,
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga102.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga102.c
> index 755235f55b3a..18a0b1f4eab7 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga102.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga102.c
> @@ -30,6 +30,7 @@ ga102_fifo = {
> .runl_ctor = ga100_fifo_runl_ctor,
> .mmu_fault = &tu102_fifo_mmu_fault,
> .nonstall_ctor = ga100_fifo_nonstall_ctor,
> + .nonstall_dtor = ga100_fifo_nonstall_dtor,
> .nonstall = &ga100_fifo_nonstall,
> .runl = &ga100_runl,
> .runq = &ga100_runq,
> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h
> index 5e81ae195329..fff1428ef267 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h
> @@ -41,6 +41,7 @@ struct nvkm_fifo_func {
> void (*start)(struct nvkm_fifo *, unsigned long *);
>
> int (*nonstall_ctor)(struct nvkm_fifo *);
> + void (*nonstall_dtor)(struct nvkm_fifo *);
> const struct nvkm_event_func *nonstall;
>
> const struct nvkm_runl_func *runl;
> @@ -200,6 +201,7 @@ u32 tu102_chan_doorbell_handle(struct nvkm_chan *);
>
> int ga100_fifo_runl_ctor(struct nvkm_fifo *);
> int ga100_fifo_nonstall_ctor(struct nvkm_fifo *);
> +void ga100_fifo_nonstall_dtor(struct nvkm_fifo *);
> extern const struct nvkm_event_func ga100_fifo_nonstall;
> extern const struct nvkm_runl_func ga100_runl;
> extern const struct nvkm_runq_func ga100_runq;
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c
> index 1ac5628c5140..b8be0a872e7a 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c
> @@ -601,7 +601,7 @@ r535_fifo_new(const struct nvkm_fifo_func *hw, struct nvkm_device *device,
> rm->chan.func = &r535_chan;
> rm->nonstall = &ga100_fifo_nonstall;
> rm->nonstall_ctor = ga100_fifo_nonstall_ctor;
> -
> + rm->nonstall_dtor = ga100_fifo_nonstall_dtor;
> return nvkm_fifo_new_(rm, device, type, inst, pfifo);
> }
>
> --
> 2.50.1
>
Maybe we should also do this for older GPUs? eg. perhaps we should
also update gf100_fifo_nonstall_allow / gf100_fifo_nonstall_block ?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] nouveau: fix disabling the nonstall irq due to storm code. (v2)
2025-09-01 18:17 ` M Henning
@ 2025-09-01 20:52 ` Dave Airlie
0 siblings, 0 replies; 9+ messages in thread
From: Dave Airlie @ 2025-09-01 20:52 UTC (permalink / raw)
To: M Henning; +Cc: dri-devel, nouveau, dakr
On Tue, 2 Sept 2025 at 04:18, M Henning <mhenning@darkrefraction.com> wrote:
>
> On Thu, Aug 28, 2025 at 10:17 PM Dave Airlie <airlied@gmail.com> wrote:
> >
> > From: Dave Airlie <airlied@redhat.com>
> >
> > Nouveau has code that when it gets an IRQ with no allowed handler
> > it disables it to avoid storms.
> >
> > However with nonstall interrupts, we often disable them from
> > the drm driver, but still request their emission via the push submission.
> >
> > Just don't disable nonstall irqs ever in normal operation, the
> > event handling code will filter them out, and the driver will
> > just enable/disable them at load time.
> >
> > This fixes timeouts we've been seeing on/off for a long time,
> > but they became a lot more noticable on Blackwell.
> >
> > This doesn't fix all of them, there is a subsequent fence emission
> > fix to fix the last few.
> >
> > Fixes: 3ebd64aa3c4f ("drm/nouveau/intr: support multiple trees, and explicit interfaces")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Dave Airlie <airlied@redhat.com>
> >
> > ---
> > v2: add missing ga102.
> > ---
> > .../gpu/drm/nouveau/nvkm/engine/fifo/base.c | 2 ++
> > .../gpu/drm/nouveau/nvkm/engine/fifo/ga100.c | 22 ++++++++++++-------
> > .../gpu/drm/nouveau/nvkm/engine/fifo/ga102.c | 1 +
> > .../gpu/drm/nouveau/nvkm/engine/fifo/priv.h | 2 ++
> > .../nouveau/nvkm/subdev/gsp/rm/r535/fifo.c | 2 +-
> > 5 files changed, 20 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c
> > index fdffa0391b31..6fd4e60634fb 100644
> > --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c
> > +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c
> > @@ -350,6 +350,8 @@ nvkm_fifo_dtor(struct nvkm_engine *engine)
> > nvkm_chid_unref(&fifo->chid);
> >
> > nvkm_event_fini(&fifo->nonstall.event);
> > + if (fifo->func->nonstall_dtor)
> > + fifo->func->nonstall_dtor(fifo);
> > mutex_destroy(&fifo->mutex);
> >
> > if (fifo->func->dtor)
> > diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c
> > index e74493a4569e..81beae473122 100644
> > --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c
> > +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c
> > @@ -517,19 +517,11 @@ ga100_fifo_nonstall_intr(struct nvkm_inth *inth)
> > static void
> > ga100_fifo_nonstall_block(struct nvkm_event *event, int type, int index)
> > {
> > - struct nvkm_fifo *fifo = container_of(event, typeof(*fifo), nonstall.event);
> > - struct nvkm_runl *runl = nvkm_runl_get(fifo, index, 0);
> > -
> > - nvkm_inth_block(&runl->nonstall.inth);
> > }
> >
> > static void
> > ga100_fifo_nonstall_allow(struct nvkm_event *event, int type, int index)
> > {
> > - struct nvkm_fifo *fifo = container_of(event, typeof(*fifo), nonstall.event);
> > - struct nvkm_runl *runl = nvkm_runl_get(fifo, index, 0);
> > -
> > - nvkm_inth_allow(&runl->nonstall.inth);
> > }
> >
> > const struct nvkm_event_func
> > @@ -564,12 +556,25 @@ ga100_fifo_nonstall_ctor(struct nvkm_fifo *fifo)
> > if (ret)
> > return ret;
> >
> > + nvkm_inth_allow(&runl->nonstall.inth);
> > +
> > nr = max(nr, runl->id + 1);
> > }
> >
> > return nr;
> > }
> >
> > +void
> > +ga100_fifo_nonstall_dtor(struct nvkm_fifo *fifo)
> > +{
> > + struct nvkm_runl *runl;
> > + nvkm_runl_foreach(runl, fifo) {
> > + if (runl->nonstall.vector < 0)
> > + continue;
> > + nvkm_inth_block(&runl->nonstall.inth);
> > + }
> > +}
> > +
> > int
> > ga100_fifo_runl_ctor(struct nvkm_fifo *fifo)
> > {
> > @@ -599,6 +604,7 @@ ga100_fifo = {
> > .runl_ctor = ga100_fifo_runl_ctor,
> > .mmu_fault = &tu102_fifo_mmu_fault,
> > .nonstall_ctor = ga100_fifo_nonstall_ctor,
> > + .nonstall_dtor = ga100_fifo_nonstall_dtor,
> > .nonstall = &ga100_fifo_nonstall,
> > .runl = &ga100_runl,
> > .runq = &ga100_runq,
> > diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga102.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga102.c
> > index 755235f55b3a..18a0b1f4eab7 100644
> > --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga102.c
> > +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga102.c
> > @@ -30,6 +30,7 @@ ga102_fifo = {
> > .runl_ctor = ga100_fifo_runl_ctor,
> > .mmu_fault = &tu102_fifo_mmu_fault,
> > .nonstall_ctor = ga100_fifo_nonstall_ctor,
> > + .nonstall_dtor = ga100_fifo_nonstall_dtor,
> > .nonstall = &ga100_fifo_nonstall,
> > .runl = &ga100_runl,
> > .runq = &ga100_runq,
> > diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h
> > index 5e81ae195329..fff1428ef267 100644
> > --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h
> > +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h
> > @@ -41,6 +41,7 @@ struct nvkm_fifo_func {
> > void (*start)(struct nvkm_fifo *, unsigned long *);
> >
> > int (*nonstall_ctor)(struct nvkm_fifo *);
> > + void (*nonstall_dtor)(struct nvkm_fifo *);
> > const struct nvkm_event_func *nonstall;
> >
> > const struct nvkm_runl_func *runl;
> > @@ -200,6 +201,7 @@ u32 tu102_chan_doorbell_handle(struct nvkm_chan *);
> >
> > int ga100_fifo_runl_ctor(struct nvkm_fifo *);
> > int ga100_fifo_nonstall_ctor(struct nvkm_fifo *);
> > +void ga100_fifo_nonstall_dtor(struct nvkm_fifo *);
> > extern const struct nvkm_event_func ga100_fifo_nonstall;
> > extern const struct nvkm_runl_func ga100_runl;
> > extern const struct nvkm_runq_func ga100_runq;
> > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c
> > index 1ac5628c5140..b8be0a872e7a 100644
> > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c
> > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c
> > @@ -601,7 +601,7 @@ r535_fifo_new(const struct nvkm_fifo_func *hw, struct nvkm_device *device,
> > rm->chan.func = &r535_chan;
> > rm->nonstall = &ga100_fifo_nonstall;
> > rm->nonstall_ctor = ga100_fifo_nonstall_ctor;
> > -
> > + rm->nonstall_dtor = ga100_fifo_nonstall_dtor;
> > return nvkm_fifo_new_(rm, device, type, inst, pfifo);
> > }
> >
> > --
> > 2.50.1
> >
>
> Maybe we should also do this for older GPUs? eg. perhaps we should
> also update gf100_fifo_nonstall_allow / gf100_fifo_nonstall_block ?
Those actually turn off the irq at the hardware, and therefore
shouldn't hit the allowed path check, not touching that without
someone showing it's broken.
Dave.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-09-01 20:52 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-29 2:16 [PATCH 1/2] nouveau: fix disabling the nonstall irq due to storm code. (v2) Dave Airlie
2025-08-29 2:16 ` [PATCH 2/2] nouveau: Membar before between semaphore writes and the interrupt Dave Airlie
2025-08-29 18:21 ` Danilo Krummrich
2025-08-29 23:09 ` James Jones
2025-08-29 14:49 ` [PATCH 1/2] nouveau: fix disabling the nonstall irq due to storm code. (v2) Faith Ekstrand
2025-08-29 18:21 ` Danilo Krummrich
2025-09-01 18:17 ` M Henning
2025-09-01 20:52 ` Dave Airlie
-- strict thread matches above, loose matches on Subject: below --
2025-08-28 20:55 [PATCH 1/2] nouveau: fix disabling the nonstall irq due to storm code Dave Airlie
2025-08-28 20:55 ` [PATCH 2/2] nouveau: Membar before between semaphore writes and the interrupt Dave Airlie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).