Commit 80972456 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/fault: store get/put pri address in nvkm_fault_buffer

Will allow more shared fault buffer handling code between Pascal/Volta.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 4d326469
...@@ -96,7 +96,7 @@ nvkm_fault_oneinit_buffer(struct nvkm_fault *fault, int id) ...@@ -96,7 +96,7 @@ nvkm_fault_oneinit_buffer(struct nvkm_fault *fault, int id)
return -ENOMEM; return -ENOMEM;
buffer->fault = fault; buffer->fault = fault;
buffer->id = id; buffer->id = id;
buffer->entries = fault->func->buffer.entries(buffer); fault->func->buffer.info(buffer);
fault->buffer[id] = buffer; fault->buffer[id] = buffer;
nvkm_debug(subdev, "buffer %d: %d entries\n", id, buffer->entries); nvkm_debug(subdev, "buffer %d: %d entries\n", id, buffer->entries);
......
...@@ -37,10 +37,12 @@ gp100_fault_buffer_init(struct nvkm_fault_buffer *buffer) ...@@ -37,10 +37,12 @@ gp100_fault_buffer_init(struct nvkm_fault_buffer *buffer)
nvkm_mask(device, 0x002a70, 0x00000001, 0x00000001); nvkm_mask(device, 0x002a70, 0x00000001, 0x00000001);
} }
static u32 static void
gp100_fault_buffer_entries(struct nvkm_fault_buffer *buffer) gp100_fault_buffer_info(struct nvkm_fault_buffer *buffer)
{ {
return nvkm_rd32(buffer->fault->subdev.device, 0x002a78); buffer->entries = nvkm_rd32(buffer->fault->subdev.device, 0x002a78);
buffer->get = 0x002a7c;
buffer->put = 0x002a80;
} }
static void static void
...@@ -54,7 +56,7 @@ gp100_fault = { ...@@ -54,7 +56,7 @@ gp100_fault = {
.intr = gp100_fault_intr, .intr = gp100_fault_intr,
.buffer.nr = 1, .buffer.nr = 1,
.buffer.entry_size = 32, .buffer.entry_size = 32,
.buffer.entries = gp100_fault_buffer_entries, .buffer.info = gp100_fault_buffer_info,
.buffer.init = gp100_fault_buffer_init, .buffer.init = gp100_fault_buffer_init,
.buffer.fini = gp100_fault_buffer_fini, .buffer.fini = gp100_fault_buffer_fini,
}; };
......
...@@ -30,9 +30,8 @@ gv100_fault_buffer_process(struct nvkm_fault_buffer *buffer) ...@@ -30,9 +30,8 @@ gv100_fault_buffer_process(struct nvkm_fault_buffer *buffer)
{ {
struct nvkm_device *device = buffer->fault->subdev.device; struct nvkm_device *device = buffer->fault->subdev.device;
struct nvkm_memory *mem = buffer->mem; struct nvkm_memory *mem = buffer->mem;
const u32 foff = buffer->id * 0x14; u32 get = nvkm_rd32(device, buffer->get);
u32 get = nvkm_rd32(device, 0x100e2c + foff); u32 put = nvkm_rd32(device, buffer->put);
u32 put = nvkm_rd32(device, 0x100e30 + foff);
if (put == get) if (put == get)
return; return;
...@@ -51,7 +50,7 @@ gv100_fault_buffer_process(struct nvkm_fault_buffer *buffer) ...@@ -51,7 +50,7 @@ gv100_fault_buffer_process(struct nvkm_fault_buffer *buffer)
if (++get == buffer->entries) if (++get == buffer->entries)
get = 0; get = 0;
nvkm_wr32(device, 0x100e2c + foff, get); nvkm_wr32(device, buffer->get, get);
info.addr = ((u64)addrhi << 32) | addrlo; info.addr = ((u64)addrhi << 32) | addrlo;
info.inst = ((u64)insthi << 32) | instlo; info.inst = ((u64)insthi << 32) | instlo;
...@@ -94,13 +93,17 @@ gv100_fault_buffer_init(struct nvkm_fault_buffer *buffer) ...@@ -94,13 +93,17 @@ gv100_fault_buffer_init(struct nvkm_fault_buffer *buffer)
nvkm_mask(device, 0x100a2c, intr, intr); nvkm_mask(device, 0x100a2c, intr, intr);
} }
static u32 static void
gv100_fault_buffer_entries(struct nvkm_fault_buffer *buffer) gv100_fault_buffer_info(struct nvkm_fault_buffer *buffer)
{ {
struct nvkm_device *device = buffer->fault->subdev.device; struct nvkm_device *device = buffer->fault->subdev.device;
const u32 foff = buffer->id * 0x14; const u32 foff = buffer->id * 0x14;
nvkm_mask(device, 0x100e34 + foff, 0x40000000, 0x40000000); nvkm_mask(device, 0x100e34 + foff, 0x40000000, 0x40000000);
return nvkm_rd32(device, 0x100e34 + foff) & 0x000fffff;
buffer->entries = nvkm_rd32(device, 0x100e34 + foff) & 0x000fffff;
buffer->get = 0x100e2c + foff;
buffer->put = 0x100e30 + foff;
} }
static int static int
...@@ -192,7 +195,7 @@ gv100_fault = { ...@@ -192,7 +195,7 @@ gv100_fault = {
.intr = gv100_fault_intr, .intr = gv100_fault_intr,
.buffer.nr = 2, .buffer.nr = 2,
.buffer.entry_size = 32, .buffer.entry_size = 32,
.buffer.entries = gv100_fault_buffer_entries, .buffer.info = gv100_fault_buffer_info,
.buffer.init = gv100_fault_buffer_init, .buffer.init = gv100_fault_buffer_init,
.buffer.fini = gv100_fault_buffer_fini, .buffer.fini = gv100_fault_buffer_fini,
}; };
......
...@@ -12,6 +12,8 @@ struct nvkm_fault_buffer { ...@@ -12,6 +12,8 @@ struct nvkm_fault_buffer {
struct nvkm_fault *fault; struct nvkm_fault *fault;
int id; int id;
int entries; int entries;
u32 get;
u32 put;
struct nvkm_memory *mem; struct nvkm_memory *mem;
u64 addr; u64 addr;
}; };
...@@ -27,7 +29,7 @@ struct nvkm_fault_func { ...@@ -27,7 +29,7 @@ struct nvkm_fault_func {
struct { struct {
int nr; int nr;
u32 entry_size; u32 entry_size;
u32 (*entries)(struct nvkm_fault_buffer *); void (*info)(struct nvkm_fault_buffer *);
void (*init)(struct nvkm_fault_buffer *); void (*init)(struct nvkm_fault_buffer *);
void (*fini)(struct nvkm_fault_buffer *); void (*fini)(struct nvkm_fault_buffer *);
} buffer; } buffer;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment