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: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
4d326469d9
commit
809724560f
@ -96,7 +96,7 @@ nvkm_fault_oneinit_buffer(struct nvkm_fault *fault, int id)
|
||||
return -ENOMEM;
|
||||
buffer->fault = fault;
|
||||
buffer->id = id;
|
||||
buffer->entries = fault->func->buffer.entries(buffer);
|
||||
fault->func->buffer.info(buffer);
|
||||
fault->buffer[id] = buffer;
|
||||
|
||||
nvkm_debug(subdev, "buffer %d: %d entries\n", id, buffer->entries);
|
||||
|
@ -37,10 +37,12 @@ gp100_fault_buffer_init(struct nvkm_fault_buffer *buffer)
|
||||
nvkm_mask(device, 0x002a70, 0x00000001, 0x00000001);
|
||||
}
|
||||
|
||||
static u32
|
||||
gp100_fault_buffer_entries(struct nvkm_fault_buffer *buffer)
|
||||
static void
|
||||
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
|
||||
@ -54,7 +56,7 @@ gp100_fault = {
|
||||
.intr = gp100_fault_intr,
|
||||
.buffer.nr = 1,
|
||||
.buffer.entry_size = 32,
|
||||
.buffer.entries = gp100_fault_buffer_entries,
|
||||
.buffer.info = gp100_fault_buffer_info,
|
||||
.buffer.init = gp100_fault_buffer_init,
|
||||
.buffer.fini = gp100_fault_buffer_fini,
|
||||
};
|
||||
|
@ -30,9 +30,8 @@ gv100_fault_buffer_process(struct nvkm_fault_buffer *buffer)
|
||||
{
|
||||
struct nvkm_device *device = buffer->fault->subdev.device;
|
||||
struct nvkm_memory *mem = buffer->mem;
|
||||
const u32 foff = buffer->id * 0x14;
|
||||
u32 get = nvkm_rd32(device, 0x100e2c + foff);
|
||||
u32 put = nvkm_rd32(device, 0x100e30 + foff);
|
||||
u32 get = nvkm_rd32(device, buffer->get);
|
||||
u32 put = nvkm_rd32(device, buffer->put);
|
||||
if (put == get)
|
||||
return;
|
||||
|
||||
@ -51,7 +50,7 @@ gv100_fault_buffer_process(struct nvkm_fault_buffer *buffer)
|
||||
|
||||
if (++get == buffer->entries)
|
||||
get = 0;
|
||||
nvkm_wr32(device, 0x100e2c + foff, get);
|
||||
nvkm_wr32(device, buffer->get, get);
|
||||
|
||||
info.addr = ((u64)addrhi << 32) | addrlo;
|
||||
info.inst = ((u64)insthi << 32) | instlo;
|
||||
@ -94,13 +93,17 @@ gv100_fault_buffer_init(struct nvkm_fault_buffer *buffer)
|
||||
nvkm_mask(device, 0x100a2c, intr, intr);
|
||||
}
|
||||
|
||||
static u32
|
||||
gv100_fault_buffer_entries(struct nvkm_fault_buffer *buffer)
|
||||
static void
|
||||
gv100_fault_buffer_info(struct nvkm_fault_buffer *buffer)
|
||||
{
|
||||
struct nvkm_device *device = buffer->fault->subdev.device;
|
||||
const u32 foff = buffer->id * 0x14;
|
||||
|
||||
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
|
||||
@ -192,7 +195,7 @@ gv100_fault = {
|
||||
.intr = gv100_fault_intr,
|
||||
.buffer.nr = 2,
|
||||
.buffer.entry_size = 32,
|
||||
.buffer.entries = gv100_fault_buffer_entries,
|
||||
.buffer.info = gv100_fault_buffer_info,
|
||||
.buffer.init = gv100_fault_buffer_init,
|
||||
.buffer.fini = gv100_fault_buffer_fini,
|
||||
};
|
||||
|
@ -12,6 +12,8 @@ struct nvkm_fault_buffer {
|
||||
struct nvkm_fault *fault;
|
||||
int id;
|
||||
int entries;
|
||||
u32 get;
|
||||
u32 put;
|
||||
struct nvkm_memory *mem;
|
||||
u64 addr;
|
||||
};
|
||||
@ -27,7 +29,7 @@ struct nvkm_fault_func {
|
||||
struct {
|
||||
int nr;
|
||||
u32 entry_size;
|
||||
u32 (*entries)(struct nvkm_fault_buffer *);
|
||||
void (*info)(struct nvkm_fault_buffer *);
|
||||
void (*init)(struct nvkm_fault_buffer *);
|
||||
void (*fini)(struct nvkm_fault_buffer *);
|
||||
} buffer;
|
||||
|
Loading…
Reference in New Issue
Block a user