Commit 223eaf4b authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/gr/gf100-gk208: make use of init_gpc_mmu() hook to share setup

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 2854ab8d
...@@ -1903,25 +1903,33 @@ gf100_gr_new_(const struct gf100_gr_func *func, struct nvkm_device *device, ...@@ -1903,25 +1903,33 @@ gf100_gr_new_(const struct gf100_gr_func *func, struct nvkm_device *device,
return 0; return 0;
} }
void
gf100_gr_init_gpc_mmu(struct gf100_gr *gr)
{
struct nvkm_device *device = gr->base.engine.subdev.device;
struct nvkm_fb *fb = device->fb;
nvkm_wr32(device, 0x418880, 0x00000000);
nvkm_wr32(device, 0x4188a4, 0x00000000);
nvkm_wr32(device, 0x418888, 0x00000000);
nvkm_wr32(device, 0x41888c, 0x00000000);
nvkm_wr32(device, 0x418890, 0x00000000);
nvkm_wr32(device, 0x418894, 0x00000000);
nvkm_wr32(device, 0x4188b4, nvkm_memory_addr(fb->mmu_wr) >> 8);
nvkm_wr32(device, 0x4188b8, nvkm_memory_addr(fb->mmu_rd) >> 8);
}
int int
gf100_gr_init(struct gf100_gr *gr) gf100_gr_init(struct gf100_gr *gr)
{ {
struct nvkm_device *device = gr->base.engine.subdev.device; struct nvkm_device *device = gr->base.engine.subdev.device;
struct nvkm_fb *fb = device->fb;
const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, gr->tpc_total); const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, gr->tpc_total);
u32 data[TPC_MAX / 8] = {}; u32 data[TPC_MAX / 8] = {};
u8 tpcnr[GPC_MAX]; u8 tpcnr[GPC_MAX];
int gpc, tpc, rop; int gpc, tpc, rop;
int i; int i;
nvkm_wr32(device, GPC_BCAST(0x0880), 0x00000000); gr->func->init_gpc_mmu(gr);
nvkm_wr32(device, GPC_BCAST(0x08a4), 0x00000000);
nvkm_wr32(device, GPC_BCAST(0x0888), 0x00000000);
nvkm_wr32(device, GPC_BCAST(0x088c), 0x00000000);
nvkm_wr32(device, GPC_BCAST(0x0890), 0x00000000);
nvkm_wr32(device, GPC_BCAST(0x0894), 0x00000000);
nvkm_wr32(device, GPC_BCAST(0x08b4), nvkm_memory_addr(fb->mmu_wr) >> 8);
nvkm_wr32(device, GPC_BCAST(0x08b8), nvkm_memory_addr(fb->mmu_rd) >> 8);
gf100_gr_mmio(gr, gr->func->mmio); gf100_gr_mmio(gr, gr->func->mmio);
...@@ -2036,6 +2044,7 @@ gf100_gr_gpccs_ucode = { ...@@ -2036,6 +2044,7 @@ gf100_gr_gpccs_ucode = {
static const struct gf100_gr_func static const struct gf100_gr_func
gf100_gr = { gf100_gr = {
.init = gf100_gr_init, .init = gf100_gr_init,
.init_gpc_mmu = gf100_gr_init_gpc_mmu,
.mmio = gf100_gr_pack_mmio, .mmio = gf100_gr_pack_mmio,
.fecs.ucode = &gf100_gr_fecs_ucode, .fecs.ucode = &gf100_gr_fecs_ucode,
.gpccs.ucode = &gf100_gr_gpccs_ucode, .gpccs.ucode = &gf100_gr_gpccs_ucode,
......
...@@ -254,6 +254,7 @@ extern const struct gf100_gr_init gf100_gr_init_mpc_0[]; ...@@ -254,6 +254,7 @@ extern const struct gf100_gr_init gf100_gr_init_mpc_0[];
extern const struct gf100_gr_init gf100_gr_init_be_0[]; extern const struct gf100_gr_init gf100_gr_init_be_0[];
extern const struct gf100_gr_init gf100_gr_init_fe_1[]; extern const struct gf100_gr_init gf100_gr_init_fe_1[];
extern const struct gf100_gr_init gf100_gr_init_pe_1[]; extern const struct gf100_gr_init gf100_gr_init_pe_1[];
void gf100_gr_init_gpc_mmu(struct gf100_gr *);
extern const struct gf100_gr_init gf104_gr_init_ds_0[]; extern const struct gf100_gr_init gf104_gr_init_ds_0[];
extern const struct gf100_gr_init gf104_gr_init_tex_0[]; extern const struct gf100_gr_init gf104_gr_init_tex_0[];
......
...@@ -115,6 +115,7 @@ gf104_gr_pack_mmio[] = { ...@@ -115,6 +115,7 @@ gf104_gr_pack_mmio[] = {
static const struct gf100_gr_func static const struct gf100_gr_func
gf104_gr = { gf104_gr = {
.init = gf100_gr_init, .init = gf100_gr_init,
.init_gpc_mmu = gf100_gr_init_gpc_mmu,
.mmio = gf104_gr_pack_mmio, .mmio = gf104_gr_pack_mmio,
.fecs.ucode = &gf100_gr_fecs_ucode, .fecs.ucode = &gf100_gr_fecs_ucode,
.gpccs.ucode = &gf100_gr_gpccs_ucode, .gpccs.ucode = &gf100_gr_gpccs_ucode,
......
...@@ -106,6 +106,7 @@ gf108_gr_pack_mmio[] = { ...@@ -106,6 +106,7 @@ gf108_gr_pack_mmio[] = {
static const struct gf100_gr_func static const struct gf100_gr_func
gf108_gr = { gf108_gr = {
.init = gf100_gr_init, .init = gf100_gr_init,
.init_gpc_mmu = gf100_gr_init_gpc_mmu,
.mmio = gf108_gr_pack_mmio, .mmio = gf108_gr_pack_mmio,
.fecs.ucode = &gf100_gr_fecs_ucode, .fecs.ucode = &gf100_gr_fecs_ucode,
.gpccs.ucode = &gf100_gr_gpccs_ucode, .gpccs.ucode = &gf100_gr_gpccs_ucode,
......
...@@ -87,6 +87,7 @@ gf110_gr_pack_mmio[] = { ...@@ -87,6 +87,7 @@ gf110_gr_pack_mmio[] = {
static const struct gf100_gr_func static const struct gf100_gr_func
gf110_gr = { gf110_gr = {
.init = gf100_gr_init, .init = gf100_gr_init,
.init_gpc_mmu = gf100_gr_init_gpc_mmu,
.mmio = gf110_gr_pack_mmio, .mmio = gf110_gr_pack_mmio,
.fecs.ucode = &gf100_gr_fecs_ucode, .fecs.ucode = &gf100_gr_fecs_ucode,
.gpccs.ucode = &gf100_gr_gpccs_ucode, .gpccs.ucode = &gf100_gr_gpccs_ucode,
......
...@@ -123,6 +123,7 @@ gf117_gr_gpccs_ucode = { ...@@ -123,6 +123,7 @@ gf117_gr_gpccs_ucode = {
static const struct gf100_gr_func static const struct gf100_gr_func
gf117_gr = { gf117_gr = {
.init = gf100_gr_init, .init = gf100_gr_init,
.init_gpc_mmu = gf100_gr_init_gpc_mmu,
.mmio = gf117_gr_pack_mmio, .mmio = gf117_gr_pack_mmio,
.fecs.ucode = &gf117_gr_fecs_ucode, .fecs.ucode = &gf117_gr_fecs_ucode,
.gpccs.ucode = &gf117_gr_gpccs_ucode, .gpccs.ucode = &gf117_gr_gpccs_ucode,
......
...@@ -178,6 +178,7 @@ gf119_gr_pack_mmio[] = { ...@@ -178,6 +178,7 @@ gf119_gr_pack_mmio[] = {
static const struct gf100_gr_func static const struct gf100_gr_func
gf119_gr = { gf119_gr = {
.init = gf100_gr_init, .init = gf100_gr_init,
.init_gpc_mmu = gf100_gr_init_gpc_mmu,
.mmio = gf119_gr_pack_mmio, .mmio = gf119_gr_pack_mmio,
.fecs.ucode = &gf100_gr_fecs_ucode, .fecs.ucode = &gf100_gr_fecs_ucode,
.gpccs.ucode = &gf100_gr_gpccs_ucode, .gpccs.ucode = &gf100_gr_gpccs_ucode,
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
#include "gf100.h" #include "gf100.h"
#include "ctxgf100.h" #include "ctxgf100.h"
#include <subdev/fb.h>
#include <nvif/class.h> #include <nvif/class.h>
/******************************************************************************* /*******************************************************************************
...@@ -207,21 +205,13 @@ int ...@@ -207,21 +205,13 @@ int
gk104_gr_init(struct gf100_gr *gr) gk104_gr_init(struct gf100_gr *gr)
{ {
struct nvkm_device *device = gr->base.engine.subdev.device; struct nvkm_device *device = gr->base.engine.subdev.device;
struct nvkm_fb *fb = device->fb;
const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, gr->tpc_total); const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, gr->tpc_total);
u32 data[TPC_MAX / 8] = {}; u32 data[TPC_MAX / 8] = {};
u8 tpcnr[GPC_MAX]; u8 tpcnr[GPC_MAX];
int gpc, tpc, rop; int gpc, tpc, rop;
int i; int i;
nvkm_wr32(device, GPC_BCAST(0x0880), 0x00000000); gr->func->init_gpc_mmu(gr);
nvkm_wr32(device, GPC_BCAST(0x08a4), 0x00000000);
nvkm_wr32(device, GPC_BCAST(0x0888), 0x00000000);
nvkm_wr32(device, GPC_BCAST(0x088c), 0x00000000);
nvkm_wr32(device, GPC_BCAST(0x0890), 0x00000000);
nvkm_wr32(device, GPC_BCAST(0x0894), 0x00000000);
nvkm_wr32(device, GPC_BCAST(0x08b4), nvkm_memory_addr(fb->mmu_wr) >> 8);
nvkm_wr32(device, GPC_BCAST(0x08b8), nvkm_memory_addr(fb->mmu_rd) >> 8);
gf100_gr_mmio(gr, gr->func->mmio); gf100_gr_mmio(gr, gr->func->mmio);
...@@ -339,6 +329,7 @@ gk104_gr_gpccs_ucode = { ...@@ -339,6 +329,7 @@ gk104_gr_gpccs_ucode = {
static const struct gf100_gr_func static const struct gf100_gr_func
gk104_gr = { gk104_gr = {
.init = gk104_gr_init, .init = gk104_gr_init,
.init_gpc_mmu = gf100_gr_init_gpc_mmu,
.init_rop_active_fbps = gk104_gr_init_rop_active_fbps, .init_rop_active_fbps = gk104_gr_init_rop_active_fbps,
.init_ppc_exceptions = gk104_gr_init_ppc_exceptions, .init_ppc_exceptions = gk104_gr_init_ppc_exceptions,
.mmio = gk104_gr_pack_mmio, .mmio = gk104_gr_pack_mmio,
......
...@@ -183,6 +183,7 @@ gk110_gr_gpccs_ucode = { ...@@ -183,6 +183,7 @@ gk110_gr_gpccs_ucode = {
static const struct gf100_gr_func static const struct gf100_gr_func
gk110_gr = { gk110_gr = {
.init = gk104_gr_init, .init = gk104_gr_init,
.init_gpc_mmu = gf100_gr_init_gpc_mmu,
.init_rop_active_fbps = gk104_gr_init_rop_active_fbps, .init_rop_active_fbps = gk104_gr_init_rop_active_fbps,
.init_ppc_exceptions = gk104_gr_init_ppc_exceptions, .init_ppc_exceptions = gk104_gr_init_ppc_exceptions,
.mmio = gk110_gr_pack_mmio, .mmio = gk110_gr_pack_mmio,
......
...@@ -103,6 +103,7 @@ gk110b_gr_pack_mmio[] = { ...@@ -103,6 +103,7 @@ gk110b_gr_pack_mmio[] = {
static const struct gf100_gr_func static const struct gf100_gr_func
gk110b_gr = { gk110b_gr = {
.init = gk104_gr_init, .init = gk104_gr_init,
.init_gpc_mmu = gf100_gr_init_gpc_mmu,
.init_rop_active_fbps = gk104_gr_init_rop_active_fbps, .init_rop_active_fbps = gk104_gr_init_rop_active_fbps,
.init_ppc_exceptions = gk104_gr_init_ppc_exceptions, .init_ppc_exceptions = gk104_gr_init_ppc_exceptions,
.mmio = gk110b_gr_pack_mmio, .mmio = gk110b_gr_pack_mmio,
......
...@@ -162,6 +162,7 @@ gk208_gr_gpccs_ucode = { ...@@ -162,6 +162,7 @@ gk208_gr_gpccs_ucode = {
static const struct gf100_gr_func static const struct gf100_gr_func
gk208_gr = { gk208_gr = {
.init = gk104_gr_init, .init = gk104_gr_init,
.init_gpc_mmu = gf100_gr_init_gpc_mmu,
.init_rop_active_fbps = gk104_gr_init_rop_active_fbps, .init_rop_active_fbps = gk104_gr_init_rop_active_fbps,
.init_ppc_exceptions = gk104_gr_init_ppc_exceptions, .init_ppc_exceptions = gk104_gr_init_ppc_exceptions,
.mmio = gk208_gr_pack_mmio, .mmio = gk208_gr_pack_mmio,
......
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