drm/nouveau/fault: add explicit control over fault buffer interrupts
authorBen Skeggs <bskeggs@redhat.com>
Tue, 11 Dec 2018 04:50:02 +0000 (14:50 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 11 Dec 2018 05:37:46 +0000 (15:37 +1000)
The GPU will continually fire interrupts while a fault buffer GET != PUT,
and to stop the spurious interrupts while the handler does its thing, we
were disabling the fault buffer temporarily.

This is not actually a great idea to begin with, and made worse by Volta
resetting GET/PUT when it's reactivated.  So, let's not do that.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/fault/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/fault/gp100.c
drivers/gpu/drm/nouveau/nvkm/subdev/fault/gv100.c
drivers/gpu/drm/nouveau/nvkm/subdev/fault/priv.h

index 75587cafa0cedb85c0efd1a00b5ff421f98229c1..4ba1e21e8fdac6a557489c7bcadcf1ceee780527 100644 (file)
@@ -28,14 +28,14 @@ static void
 nvkm_fault_ntfy_fini(struct nvkm_event *event, int type, int index)
 {
        struct nvkm_fault *fault = container_of(event, typeof(*fault), event);
-       fault->func->buffer.fini(fault->buffer[index]);
+       fault->func->buffer.intr(fault->buffer[index], false);
 }
 
 static void
 nvkm_fault_ntfy_init(struct nvkm_event *event, int type, int index)
 {
        struct nvkm_fault *fault = container_of(event, typeof(*fault), event);
-       fault->func->buffer.init(fault->buffer[index]);
+       fault->func->buffer.intr(fault->buffer[index], true);
 }
 
 static int
index 67d587a50f147086b2de6b623eef209fb64c174e..8fb96fe614f9dead4075bc233fdd5c9bd9750491 100644 (file)
  */
 #include "priv.h"
 
+#include <subdev/mc.h>
+
+static void
+gp100_fault_buffer_intr(struct nvkm_fault_buffer *buffer, bool enable)
+{
+       struct nvkm_device *device = buffer->fault->subdev.device;
+       nvkm_mc_intr_mask(device, NVKM_SUBDEV_FAULT, enable);
+}
+
 static void
 gp100_fault_buffer_fini(struct nvkm_fault_buffer *buffer)
 {
@@ -59,6 +68,7 @@ gp100_fault = {
        .buffer.info = gp100_fault_buffer_info,
        .buffer.init = gp100_fault_buffer_init,
        .buffer.fini = gp100_fault_buffer_fini,
+       .buffer.intr = gp100_fault_buffer_intr,
 };
 
 int
index c5f735cf8eb36ead406fb33efad248c6c1058971..5de916fc5ccddd23c3bc7fe95685e3218feedb4a 100644 (file)
@@ -69,13 +69,21 @@ gv100_fault_buffer_process(struct nvkm_fault_buffer *buffer)
 }
 
 static void
-gv100_fault_buffer_fini(struct nvkm_fault_buffer *buffer)
+gv100_fault_buffer_intr(struct nvkm_fault_buffer *buffer, bool enable)
 {
        struct nvkm_device *device = buffer->fault->subdev.device;
        const u32 intr = buffer->id ? 0x08000000 : 0x20000000;
-       const u32 foff = buffer->id * 0x14;
+       if (enable)
+               nvkm_mask(device, 0x100a2c, intr, intr);
+       else
+               nvkm_mask(device, 0x100a34, intr, intr);
+}
 
-       nvkm_mask(device, 0x100a34, intr, intr);
+static void
+gv100_fault_buffer_fini(struct nvkm_fault_buffer *buffer)
+{
+       struct nvkm_device *device = buffer->fault->subdev.device;
+       const u32 foff = buffer->id * 0x14;
        nvkm_mask(device, 0x100e34 + foff, 0x80000000, 0x00000000);
 }
 
@@ -83,14 +91,12 @@ static void
 gv100_fault_buffer_init(struct nvkm_fault_buffer *buffer)
 {
        struct nvkm_device *device = buffer->fault->subdev.device;
-       const u32 intr = buffer->id ? 0x08000000 : 0x20000000;
        const u32 foff = buffer->id * 0x14;
 
        nvkm_mask(device, 0x100e34 + foff, 0xc0000000, 0x40000000);
        nvkm_wr32(device, 0x100e28 + foff, upper_32_bits(buffer->addr));
        nvkm_wr32(device, 0x100e24 + foff, lower_32_bits(buffer->addr));
        nvkm_mask(device, 0x100e34 + foff, 0x80000000, 0x80000000);
-       nvkm_mask(device, 0x100a2c, intr, intr);
 }
 
 static void
@@ -169,6 +175,8 @@ static void
 gv100_fault_fini(struct nvkm_fault *fault)
 {
        nvkm_notify_put(&fault->nrpfb);
+       if (fault->buffer[0])
+               fault->func->buffer.fini(fault->buffer[0]);
        nvkm_mask(fault->subdev.device, 0x100a34, 0x80000000, 0x80000000);
 }
 
@@ -176,6 +184,7 @@ static void
 gv100_fault_init(struct nvkm_fault *fault)
 {
        nvkm_mask(fault->subdev.device, 0x100a2c, 0x80000000, 0x80000000);
+       fault->func->buffer.init(fault->buffer[0]);
        nvkm_notify_get(&fault->nrpfb);
 }
 
@@ -183,7 +192,7 @@ static int
 gv100_fault_oneinit(struct nvkm_fault *fault)
 {
        return nvkm_notify_init(&fault->buffer[0]->object, &fault->event,
-                               gv100_fault_ntfy_nrpfb, false, NULL, 0, 0,
+                               gv100_fault_ntfy_nrpfb, true, NULL, 0, 0,
                                &fault->nrpfb);
 }
 
@@ -198,6 +207,7 @@ gv100_fault = {
        .buffer.info = gv100_fault_buffer_info,
        .buffer.init = gv100_fault_buffer_init,
        .buffer.fini = gv100_fault_buffer_fini,
+       .buffer.intr = gv100_fault_buffer_intr,
 };
 
 int
index b9a30a6f6aafb390c050fbaa18f95b2a1a5012e1..ec085dcb5c5c6c89693707d20db7041ab8f65fa0 100644 (file)
@@ -32,6 +32,7 @@ struct nvkm_fault_func {
                void (*info)(struct nvkm_fault_buffer *);
                void (*init)(struct nvkm_fault_buffer *);
                void (*fini)(struct nvkm_fault_buffer *);
+               void (*intr)(struct nvkm_fault_buffer *, bool enable);
        } buffer;
 };
 #endif