Commit ba083ec7 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/fifo/gk104-: switch dev_top fault handling to type+inst

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
parent 088bfe43
...@@ -12,7 +12,6 @@ struct nvkm_top { ...@@ -12,7 +12,6 @@ struct nvkm_top {
struct nvkm_top_device { struct nvkm_top_device {
enum nvkm_subdev_type type; enum nvkm_subdev_type type;
int inst; int inst;
enum nvkm_devidx index;
u32 addr; u32 addr;
int fault; int fault;
int engine; int engine;
...@@ -26,7 +25,7 @@ u32 nvkm_top_addr(struct nvkm_device *, enum nvkm_subdev_type, int); ...@@ -26,7 +25,7 @@ u32 nvkm_top_addr(struct nvkm_device *, enum nvkm_subdev_type, int);
u32 nvkm_top_reset(struct nvkm_device *, enum nvkm_subdev_type, int); u32 nvkm_top_reset(struct nvkm_device *, enum nvkm_subdev_type, int);
u32 nvkm_top_intr_mask(struct nvkm_device *, enum nvkm_subdev_type, int); u32 nvkm_top_intr_mask(struct nvkm_device *, enum nvkm_subdev_type, int);
int nvkm_top_fault_id(struct nvkm_device *, enum nvkm_subdev_type, int); int nvkm_top_fault_id(struct nvkm_device *, enum nvkm_subdev_type, int);
enum nvkm_devidx nvkm_top_fault(struct nvkm_device *, int fault); struct nvkm_subdev *nvkm_top_fault(struct nvkm_device *, int fault);
int gk104_top_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_top **); int gk104_top_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_top **);
#endif #endif
...@@ -483,7 +483,8 @@ gk104_fifo_fault(struct nvkm_fifo *base, struct nvkm_fault_data *info) ...@@ -483,7 +483,8 @@ gk104_fifo_fault(struct nvkm_fifo *base, struct nvkm_fault_data *info)
struct nvkm_engine *engine = NULL; struct nvkm_engine *engine = NULL;
struct nvkm_fifo_chan *chan; struct nvkm_fifo_chan *chan;
unsigned long flags; unsigned long flags;
char ct[8] = "HUB/", en[16] = ""; const char *en = "";
char ct[8] = "HUB/";
er = nvkm_enum_find(fifo->func->fault.reason, info->reason); er = nvkm_enum_find(fifo->func->fault.reason, info->reason);
ee = nvkm_enum_find(fifo->func->fault.engine, info->engine); ee = nvkm_enum_find(fifo->func->fault.engine, info->engine);
...@@ -513,17 +514,14 @@ gk104_fifo_fault(struct nvkm_fifo *base, struct nvkm_fault_data *info) ...@@ -513,17 +514,14 @@ gk104_fifo_fault(struct nvkm_fifo *base, struct nvkm_fault_data *info)
} }
if (ee == NULL) { if (ee == NULL) {
enum nvkm_devidx engidx = nvkm_top_fault(device, info->engine); struct nvkm_subdev *subdev = nvkm_top_fault(device, info->engine);
if (engidx < NVKM_SUBDEV_NR) { if (subdev) {
const char *src = nvkm_subdev_type[engidx]; if (subdev->func == &nvkm_engine)
char *dst = en; engine = container_of(subdev, typeof(*engine), subdev);
do { en = engine->subdev.name;
*dst++ = toupper(*src++);
} while(*src);
engine = nvkm_device_engine(device, engidx, 0);
} }
} else { } else {
snprintf(en, sizeof(en), "%s", ee->name); en = ee->name;
} }
spin_lock_irqsave(&fifo->base.lock, flags); spin_lock_irqsave(&fifo->base.lock, flags);
......
...@@ -278,7 +278,8 @@ tu102_fifo_fault(struct nvkm_fifo *base, struct nvkm_fault_data *info) ...@@ -278,7 +278,8 @@ tu102_fifo_fault(struct nvkm_fifo *base, struct nvkm_fault_data *info)
struct nvkm_engine *engine = NULL; struct nvkm_engine *engine = NULL;
struct nvkm_fifo_chan *chan; struct nvkm_fifo_chan *chan;
unsigned long flags; unsigned long flags;
char ct[8] = "HUB/", en[16] = ""; const char *en = "";
char ct[8] = "HUB/";
int engn; int engn;
er = nvkm_enum_find(fifo->func->fault.reason, info->reason); er = nvkm_enum_find(fifo->func->fault.reason, info->reason);
...@@ -309,19 +310,14 @@ tu102_fifo_fault(struct nvkm_fifo *base, struct nvkm_fault_data *info) ...@@ -309,19 +310,14 @@ tu102_fifo_fault(struct nvkm_fifo *base, struct nvkm_fault_data *info)
} }
if (ee == NULL) { if (ee == NULL) {
enum nvkm_devidx engidx = nvkm_top_fault(device, info->engine); struct nvkm_subdev *subdev = nvkm_top_fault(device, info->engine);
if (subdev) {
if (engidx < NVKM_SUBDEV_NR) { if (subdev->func == &nvkm_engine)
const char *src = nvkm_subdev_type[engidx]; engine = container_of(subdev, typeof(*engine), subdev);
char *dst = en; en = engine->subdev.name;
do {
*dst++ = toupper(*src++);
} while (*src);
engine = nvkm_device_engine(device, engidx, 0);
} }
} else { } else {
snprintf(en, sizeof(en), "%s", ee->name); en = ee->name;
} }
spin_lock_irqsave(&fifo->base.lock, flags); spin_lock_irqsave(&fifo->base.lock, flags);
......
...@@ -30,7 +30,6 @@ nvkm_top_device_new(struct nvkm_top *top) ...@@ -30,7 +30,6 @@ nvkm_top_device_new(struct nvkm_top *top)
if (info) { if (info) {
info->type = NVKM_SUBDEV_NR; info->type = NVKM_SUBDEV_NR;
info->inst = -1; info->inst = -1;
info->index = NVKM_SUBDEV_NR;
info->addr = 0; info->addr = 0;
info->fault = -1; info->fault = -1;
info->engine = -1; info->engine = -1;
...@@ -104,7 +103,7 @@ nvkm_top_fault_id(struct nvkm_device *device, enum nvkm_subdev_type type, int in ...@@ -104,7 +103,7 @@ nvkm_top_fault_id(struct nvkm_device *device, enum nvkm_subdev_type type, int in
return -ENOENT; return -ENOENT;
} }
enum nvkm_devidx struct nvkm_subdev *
nvkm_top_fault(struct nvkm_device *device, int fault) nvkm_top_fault(struct nvkm_device *device, int fault)
{ {
struct nvkm_top *top = device->top; struct nvkm_top *top = device->top;
...@@ -112,10 +111,10 @@ nvkm_top_fault(struct nvkm_device *device, int fault) ...@@ -112,10 +111,10 @@ nvkm_top_fault(struct nvkm_device *device, int fault)
list_for_each_entry(info, &top->device, head) { list_for_each_entry(info, &top->device, head) {
if (info->fault == fault) if (info->fault == fault)
return info->index; return nvkm_device_subdev(device, info->type, info->inst);
} }
return NVKM_SUBDEV_NR; return NULL;
} }
static int static int
......
...@@ -70,7 +70,7 @@ gk104_top_oneinit(struct nvkm_top *top) ...@@ -70,7 +70,7 @@ gk104_top_oneinit(struct nvkm_top *top)
continue; continue;
/* Translate engine type to NVKM engine identifier. */ /* Translate engine type to NVKM engine identifier. */
#define I_(T,I) do { info->type = (T); info->inst = (I); info->index = (T) + (I); } while(0) #define I_(T,I) do { info->type = (T); info->inst = (I); } while(0)
#define O_(T,I) do { WARN_ON(inst); I_(T, I); } while (0) #define O_(T,I) do { WARN_ON(inst); I_(T, I); } while (0)
switch (type) { switch (type) {
case 0x00000000: O_(NVKM_ENGINE_GR , 0); break; case 0x00000000: O_(NVKM_ENGINE_GR , 0); break;
......
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