drm/nouveau/gr/gf100-: move some init to init_rop_exceptions()
authorBen Skeggs <bskeggs@redhat.com>
Wed, 1 Jun 2022 10:48:12 +0000 (20:48 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 9 Nov 2022 00:45:11 +0000 (10:45 +1000)
Ampere.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
20 files changed:
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf104.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf108.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf110.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf117.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf119.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gk104.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gk110.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gk110b.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gk208.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gm107.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gm200.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gp100.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gp102.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gp104.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gp107.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gp10b.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gv100.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/tu102.c

index 8f935b9..5dcebda 100644 (file)
@@ -2155,6 +2155,20 @@ gf100_gr_init_400054(struct gf100_gr *gr)
 }
 
 void
+gf100_gr_init_rop_exceptions(struct gf100_gr *gr)
+{
+       struct nvkm_device *device = gr->base.engine.subdev.device;
+       int rop;
+
+       for (rop = 0; rop < gr->rop_nr; rop++) {
+               nvkm_wr32(device, ROP_UNIT(rop, 0x144), 0x40000000);
+               nvkm_wr32(device, ROP_UNIT(rop, 0x070), 0x40000000);
+               nvkm_wr32(device, ROP_UNIT(rop, 0x204), 0xffffffff);
+               nvkm_wr32(device, ROP_UNIT(rop, 0x208), 0xffffffff);
+       }
+}
+
+void
 gf100_gr_init_shader_exceptions(struct gf100_gr *gr, int gpc, int tpc)
 {
        struct nvkm_device *device = gr->base.engine.subdev.device;
@@ -2283,7 +2297,7 @@ int
 gf100_gr_init(struct gf100_gr *gr)
 {
        struct nvkm_device *device = gr->base.engine.subdev.device;
-       int gpc, tpc, rop;
+       int gpc, tpc;
 
        nvkm_mask(device, 0x400500, 0x00010001, 0x00000000);
 
@@ -2375,12 +2389,7 @@ gf100_gr_init(struct gf100_gr *gr)
                nvkm_wr32(device, GPC_UNIT(gpc, 0x2c94), 0xffffffff);
        }
 
-       for (rop = 0; rop < gr->rop_nr; rop++) {
-               nvkm_wr32(device, ROP_UNIT(rop, 0x144), 0x40000000);
-               nvkm_wr32(device, ROP_UNIT(rop, 0x070), 0x40000000);
-               nvkm_wr32(device, ROP_UNIT(rop, 0x204), 0xffffffff);
-               nvkm_wr32(device, ROP_UNIT(rop, 0x208), 0xffffffff);
-       }
+       gr->func->init_rop_exceptions(gr);
 
        nvkm_wr32(device, 0x400108, 0xffffffff);
        nvkm_wr32(device, 0x400138, 0xffffffff);
@@ -2464,6 +2473,7 @@ gf100_gr = {
        .init_419eb4 = gf100_gr_init_419eb4,
        .init_tex_hww_esr = gf100_gr_init_tex_hww_esr,
        .init_shader_exceptions = gf100_gr_init_shader_exceptions,
+       .init_rop_exceptions = gf100_gr_init_rop_exceptions,
        .init_400054 = gf100_gr_init_400054,
        .trap_mp = gf100_gr_trap_mp,
        .mmio = gf100_gr_pack_mmio,
index f98c739..6f1f4fc 100644 (file)
@@ -165,6 +165,7 @@ struct gf100_gr_func {
        void (*init_tex_hww_esr)(struct gf100_gr *, int gpc, int tpc);
        void (*init_504430)(struct gf100_gr *, int gpc, int tpc);
        void (*init_shader_exceptions)(struct gf100_gr *, int gpc, int tpc);
+       void (*init_rop_exceptions)(struct gf100_gr *);
        void (*init_400054)(struct gf100_gr *);
        void (*init_4188a4)(struct gf100_gr *);
        void (*trap_mp)(struct gf100_gr *, int gpc, int tpc);
@@ -200,6 +201,7 @@ void gf100_gr_init_419cc0(struct gf100_gr *);
 void gf100_gr_init_419eb4(struct gf100_gr *);
 void gf100_gr_init_tex_hww_esr(struct gf100_gr *, int, int);
 void gf100_gr_init_shader_exceptions(struct gf100_gr *, int, int);
+void gf100_gr_init_rop_exceptions(struct gf100_gr *);
 void gf100_gr_init_400054(struct gf100_gr *);
 void gf100_gr_init_num_tpc_per_gpc(struct gf100_gr *, bool, bool);
 extern const struct gf100_gr_func_zbc gf100_gr_zbc;
index bb82c0a..a1a338c 100644 (file)
@@ -127,6 +127,7 @@ gf104_gr = {
        .init_419eb4 = gf100_gr_init_419eb4,
        .init_tex_hww_esr = gf100_gr_init_tex_hww_esr,
        .init_shader_exceptions = gf100_gr_init_shader_exceptions,
+       .init_rop_exceptions = gf100_gr_init_rop_exceptions,
        .init_400054 = gf100_gr_init_400054,
        .trap_mp = gf100_gr_trap_mp,
        .mmio = gf104_gr_pack_mmio,
index e625206..5687835 100644 (file)
@@ -125,6 +125,7 @@ gf108_gr = {
        .init_419eb4 = gf100_gr_init_419eb4,
        .init_tex_hww_esr = gf100_gr_init_tex_hww_esr,
        .init_shader_exceptions = gf100_gr_init_shader_exceptions,
+       .init_rop_exceptions = gf100_gr_init_rop_exceptions,
        .init_400054 = gf100_gr_init_400054,
        .trap_mp = gf100_gr_trap_mp,
        .mmio = gf108_gr_pack_mmio,
index d489602..f6a7709 100644 (file)
@@ -99,6 +99,7 @@ gf110_gr = {
        .init_419eb4 = gf100_gr_init_419eb4,
        .init_tex_hww_esr = gf100_gr_init_tex_hww_esr,
        .init_shader_exceptions = gf100_gr_init_shader_exceptions,
+       .init_rop_exceptions = gf100_gr_init_rop_exceptions,
        .init_400054 = gf100_gr_init_400054,
        .trap_mp = gf100_gr_trap_mp,
        .mmio = gf110_gr_pack_mmio,
index e3e69ab..065d183 100644 (file)
@@ -163,6 +163,7 @@ gf117_gr = {
        .init_419eb4 = gf100_gr_init_419eb4,
        .init_tex_hww_esr = gf100_gr_init_tex_hww_esr,
        .init_shader_exceptions = gf100_gr_init_shader_exceptions,
+       .init_rop_exceptions = gf100_gr_init_rop_exceptions,
        .init_400054 = gf100_gr_init_400054,
        .trap_mp = gf100_gr_trap_mp,
        .mmio = gf117_gr_pack_mmio,
index 4dccf0b..e4add18 100644 (file)
@@ -190,6 +190,7 @@ gf119_gr = {
        .init_419eb4 = gf100_gr_init_419eb4,
        .init_tex_hww_esr = gf100_gr_init_tex_hww_esr,
        .init_shader_exceptions = gf100_gr_init_shader_exceptions,
+       .init_rop_exceptions = gf100_gr_init_rop_exceptions,
        .init_400054 = gf100_gr_init_400054,
        .trap_mp = gf100_gr_trap_mp,
        .mmio = gf119_gr_pack_mmio,
index cff24a0..85db57b 100644 (file)
@@ -470,6 +470,7 @@ gk104_gr = {
        .init_ppc_exceptions = gk104_gr_init_ppc_exceptions,
        .init_tex_hww_esr = gf100_gr_init_tex_hww_esr,
        .init_shader_exceptions = gf100_gr_init_shader_exceptions,
+       .init_rop_exceptions = gf100_gr_init_rop_exceptions,
        .init_400054 = gf100_gr_init_400054,
        .trap_mp = gf100_gr_trap_mp,
        .mmio = gk104_gr_pack_mmio,
index ae430b3..157de00 100644 (file)
@@ -366,6 +366,7 @@ gk110_gr = {
        .init_ppc_exceptions = gk104_gr_init_ppc_exceptions,
        .init_tex_hww_esr = gf100_gr_init_tex_hww_esr,
        .init_shader_exceptions = gf100_gr_init_shader_exceptions,
+       .init_rop_exceptions = gf100_gr_init_rop_exceptions,
        .init_400054 = gf100_gr_init_400054,
        .trap_mp = gf100_gr_trap_mp,
        .mmio = gk110_gr_pack_mmio,
index c22eada..7f590d3 100644 (file)
@@ -118,6 +118,7 @@ gk110b_gr = {
        .init_ppc_exceptions = gk104_gr_init_ppc_exceptions,
        .init_tex_hww_esr = gf100_gr_init_tex_hww_esr,
        .init_shader_exceptions = gf100_gr_init_shader_exceptions,
+       .init_rop_exceptions = gf100_gr_init_rop_exceptions,
        .init_400054 = gf100_gr_init_400054,
        .trap_mp = gf100_gr_trap_mp,
        .mmio = gk110b_gr_pack_mmio,
index 35a70a4..68c74d4 100644 (file)
@@ -176,6 +176,7 @@ gk208_gr = {
        .init_ppc_exceptions = gk104_gr_init_ppc_exceptions,
        .init_tex_hww_esr = gf100_gr_init_tex_hww_esr,
        .init_shader_exceptions = gf100_gr_init_shader_exceptions,
+       .init_rop_exceptions = gf100_gr_init_rop_exceptions,
        .init_400054 = gf100_gr_init_400054,
        .trap_mp = gf100_gr_trap_mp,
        .mmio = gk208_gr_pack_mmio,
index 17c36f3..8ac7131 100644 (file)
@@ -411,6 +411,7 @@ gm107_gr = {
        .init_tex_hww_esr = gf100_gr_init_tex_hww_esr,
        .init_504430 = gm107_gr_init_504430,
        .init_shader_exceptions = gm107_gr_init_shader_exceptions,
+       .init_rop_exceptions = gf100_gr_init_rop_exceptions,
        .init_400054 = gm107_gr_init_400054,
        .trap_mp = gf100_gr_trap_mp,
        .mmio = gm107_gr_pack_mmio,
index 31e753f..0145d0c 100644 (file)
@@ -199,6 +199,7 @@ gm200_gr = {
        .init_tex_hww_esr = gf100_gr_init_tex_hww_esr,
        .init_504430 = gm107_gr_init_504430,
        .init_shader_exceptions = gm107_gr_init_shader_exceptions,
+       .init_rop_exceptions = gf100_gr_init_rop_exceptions,
        .init_400054 = gm107_gr_init_400054,
        .trap_mp = gf100_gr_trap_mp,
        .fecs.reset = gf100_gr_fecs_reset,
index 7a6657b..47cb5a2 100644 (file)
@@ -119,6 +119,7 @@ gp100_gr = {
        .init_tex_hww_esr = gf100_gr_init_tex_hww_esr,
        .init_504430 = gm107_gr_init_504430,
        .init_shader_exceptions = gp100_gr_init_shader_exceptions,
+       .init_rop_exceptions = gf100_gr_init_rop_exceptions,
        .trap_mp = gf100_gr_trap_mp,
        .fecs.reset = gf100_gr_fecs_reset,
        .rops = gm200_gr_rops,
index ebde815..e8a5dc8 100644 (file)
@@ -115,6 +115,7 @@ gp102_gr = {
        .init_tex_hww_esr = gf100_gr_init_tex_hww_esr,
        .init_504430 = gm107_gr_init_504430,
        .init_shader_exceptions = gp100_gr_init_shader_exceptions,
+       .init_rop_exceptions = gf100_gr_init_rop_exceptions,
        .trap_mp = gf100_gr_trap_mp,
        .fecs.reset = gf100_gr_fecs_reset,
        .rops = gm200_gr_rops,
index 3d824bd..4c9549e 100644 (file)
@@ -43,6 +43,7 @@ gp104_gr = {
        .init_tex_hww_esr = gf100_gr_init_tex_hww_esr,
        .init_504430 = gm107_gr_init_504430,
        .init_shader_exceptions = gp100_gr_init_shader_exceptions,
+       .init_rop_exceptions = gf100_gr_init_rop_exceptions,
        .trap_mp = gf100_gr_trap_mp,
        .fecs.reset = gf100_gr_fecs_reset,
        .rops = gm200_gr_rops,
index d4f87d9..e624162 100644 (file)
@@ -45,6 +45,7 @@ gp107_gr = {
        .init_tex_hww_esr = gf100_gr_init_tex_hww_esr,
        .init_504430 = gm107_gr_init_504430,
        .init_shader_exceptions = gp100_gr_init_shader_exceptions,
+       .init_rop_exceptions = gf100_gr_init_rop_exceptions,
        .trap_mp = gf100_gr_trap_mp,
        .fecs.reset = gf100_gr_fecs_reset,
        .rops = gm200_gr_rops,
index a20db4d..1034822 100644 (file)
@@ -55,6 +55,7 @@ gp10b_gr = {
        .init_tex_hww_esr = gf100_gr_init_tex_hww_esr,
        .init_504430 = gm107_gr_init_504430,
        .init_shader_exceptions = gp100_gr_init_shader_exceptions,
+       .init_rop_exceptions = gf100_gr_init_rop_exceptions,
        .trap_mp = gf100_gr_trap_mp,
        .fecs.reset = gf100_gr_fecs_reset,
        .rops = gm200_gr_rops,
index c57bb39..07507a0 100644 (file)
@@ -103,6 +103,7 @@ gv100_gr = {
        .init_ppc_exceptions = gk104_gr_init_ppc_exceptions,
        .init_504430 = gv100_gr_init_504430,
        .init_shader_exceptions = gv100_gr_init_shader_exceptions,
+       .init_rop_exceptions = gf100_gr_init_rop_exceptions,
        .init_4188a4 = gv100_gr_init_4188a4,
        .trap_mp = gv100_gr_trap_mp,
        .fecs.reset = gf100_gr_fecs_reset,
index 88f768c..bc5d77d 100644 (file)
@@ -109,6 +109,7 @@ tu102_gr = {
        .init_ppc_exceptions = gk104_gr_init_ppc_exceptions,
        .init_504430 = gv100_gr_init_504430,
        .init_shader_exceptions = gv100_gr_init_shader_exceptions,
+       .init_rop_exceptions = gf100_gr_init_rop_exceptions,
        .trap_mp = gv100_gr_trap_mp,
        .fecs.reset = gf100_gr_fecs_reset,
        .rops = gm200_gr_rops,