drm/nouveau/top: add function to translate subdev index to mmu fault id
authorBen Skeggs <bskeggs@redhat.com>
Wed, 18 Jan 2017 04:57:01 +0000 (14:57 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 17 Feb 2017 07:38:11 +0000 (17:38 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/include/nvkm/subdev/top.h
drivers/gpu/drm/nouveau/nvkm/subdev/top/base.c

index 71ebbfd4484fc9b824cdb84cb07d30449c7576e7..d23209b62c2514f5fe67632f86e0e79fce5d9a50 100644 (file)
@@ -11,6 +11,7 @@ struct nvkm_top {
 u32 nvkm_top_reset(struct nvkm_device *, enum nvkm_devidx);
 u32 nvkm_top_intr(struct nvkm_device *, u32 intr, u64 *subdevs);
 u32 nvkm_top_intr_mask(struct nvkm_device *, enum nvkm_devidx);
+int nvkm_top_fault_id(struct nvkm_device *, enum nvkm_devidx);
 enum nvkm_devidx nvkm_top_fault(struct nvkm_device *, int fault);
 enum nvkm_devidx nvkm_top_engine(struct nvkm_device *, int, int *runl, int *engn);
 
index fe063d5728e21b600556cfb6724cde8d979800c9..67ada1d9a28c31e8475c5f407879ed8dc83ecf9b 100644 (file)
@@ -95,6 +95,20 @@ nvkm_top_intr(struct nvkm_device *device, u32 intr, u64 *psubdevs)
        return intr & ~handled;
 }
 
+int
+nvkm_top_fault_id(struct nvkm_device *device, enum nvkm_devidx devidx)
+{
+       struct nvkm_top *top = device->top;
+       struct nvkm_top_device *info;
+
+       list_for_each_entry(info, &top->device, head) {
+               if (info->index == devidx && info->fault >= 0)
+                       return info->fault;
+       }
+
+       return -ENOENT;
+}
+
 enum nvkm_devidx
 nvkm_top_fault(struct nvkm_device *device, int fault)
 {