1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#include "priv.h"
25#include <core/enum.h>
26
27#include <nvif/class.h>
28
29static const struct nvkm_enum
30gp100_ce_launcherr_report[] = {
31 { 0x0, "NO_ERR" },
32 { 0x1, "2D_LAYER_EXCEEDS_DEPTH" },
33 { 0x2, "INVALID_ALIGNMENT" },
34 { 0x3, "MEM2MEM_RECT_OUT_OF_BOUNDS" },
35 { 0x4, "SRC_LINE_EXCEEDS_PITCH" },
36 { 0x5, "SRC_LINE_EXCEEDS_NEG_PITCH" },
37 { 0x6, "DST_LINE_EXCEEDS_PITCH" },
38 { 0x7, "DST_LINE_EXCEEDS_NEG_PITCH" },
39 { 0x8, "BAD_SRC_PIXEL_COMP_REF" },
40 { 0x9, "INVALID_VALUE" },
41 { 0xa, "UNUSED_FIELD" },
42 { 0xb, "INVALID_OPERATION" },
43 { 0xc, "NO_RESOURCES" },
44 { 0xd, "INVALID_CONFIG" },
45 {}
46};
47
48static void
49gp100_ce_intr_launcherr(struct nvkm_engine *ce, const u32 base)
50{
51 struct nvkm_subdev *subdev = &ce->subdev;
52 struct nvkm_device *device = subdev->device;
53 u32 stat = nvkm_rd32(device, 0x104418 + base);
54 const struct nvkm_enum *en =
55 nvkm_enum_find(gp100_ce_launcherr_report, stat & 0x0000000f);
56 nvkm_warn(subdev, "LAUNCHERR %08x [%s]\n", stat, en ? en->name : "");
57}
58
59void
60gp100_ce_intr(struct nvkm_engine *ce)
61{
62 struct nvkm_subdev *subdev = &ce->subdev;
63 struct nvkm_device *device = subdev->device;
64 const u32 base = subdev->inst * 0x80;
65 u32 mask = nvkm_rd32(device, 0x10440c + base);
66 u32 intr = nvkm_rd32(device, 0x104410 + base) & mask;
67 if (intr & 0x00000001) {
68 nvkm_warn(subdev, "BLOCKPIPE\n");
69 nvkm_wr32(device, 0x104410 + base, 0x00000001);
70 intr &= ~0x00000001;
71 }
72 if (intr & 0x00000002) {
73 nvkm_warn(subdev, "NONBLOCKPIPE\n");
74 nvkm_wr32(device, 0x104410 + base, 0x00000002);
75 intr &= ~0x00000002;
76 }
77 if (intr & 0x00000004) {
78 gp100_ce_intr_launcherr(ce, base);
79 nvkm_wr32(device, 0x104410 + base, 0x00000004);
80 intr &= ~0x00000004;
81 }
82 if (intr) {
83 nvkm_warn(subdev, "intr %08x\n", intr);
84 nvkm_wr32(device, 0x104410 + base, intr);
85 }
86}
87
88static const struct nvkm_engine_func
89gp100_ce = {
90 .intr = gp100_ce_intr,
91 .sclass = {
92 { -1, -1, PASCAL_DMA_COPY_A },
93 {}
94 }
95};
96
97int
98gp100_ce_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
99 struct nvkm_engine **pengine)
100{
101 return nvkm_engine_new_(&gp100_ce, device, type, inst, true, pengine);
102}
103