drm/nouveau/fb/gm200: setup mmu debug buffer registers at init()
authorBen Skeggs <bskeggs@redhat.com>
Thu, 14 Apr 2016 01:14:33 +0000 (11:14 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 20 May 2016 04:43:04 +0000 (14:43 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/include/nvkm/subdev/fb.h
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gm200.c
drivers/gpu/drm/nouveau/nvkm/subdev/fb/Kbuild
drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm200.c [new file with mode: 0644]

index bb9247d88190bffe147081f8e9759a67fd4f12a9..0a734fd06acf347aeee52368ee159c62d99a4e75 100644 (file)
@@ -90,6 +90,7 @@ int gf100_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
 int gk104_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
 int gk20a_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
 int gm107_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
+int gm200_fb_new(struct nvkm_device *, int, struct nvkm_fb **);
 
 #include <subdev/bios.h>
 #include <subdev/bios/ramcfg.h>
index be7633f36d6bd3bc1acdc92ff139390105295186..a364efe60a1811c6e0c2561778a72406dd157f91 100644 (file)
@@ -1995,7 +1995,7 @@ nv120_chipset = {
        .bios = nvkm_bios_new,
        .bus = gf100_bus_new,
        .devinit = gm200_devinit_new,
-       .fb = gm107_fb_new,
+       .fb = gm200_fb_new,
        .fuse = gm107_fuse_new,
        .gpio = gk104_gpio_new,
        .i2c = gm200_i2c_new,
@@ -2029,7 +2029,7 @@ nv124_chipset = {
        .bios = nvkm_bios_new,
        .bus = gf100_bus_new,
        .devinit = gm200_devinit_new,
-       .fb = gm107_fb_new,
+       .fb = gm200_fb_new,
        .fuse = gm107_fuse_new,
        .gpio = gk104_gpio_new,
        .i2c = gm200_i2c_new,
@@ -2063,7 +2063,7 @@ nv126_chipset = {
        .bios = nvkm_bios_new,
        .bus = gf100_bus_new,
        .devinit = gm200_devinit_new,
-       .fb = gm107_fb_new,
+       .fb = gm200_fb_new,
        .fuse = gm107_fuse_new,
        .gpio = gk104_gpio_new,
        .i2c = gm200_i2c_new,
index 6e992c6f9532d904774e42c50fdb215430433e2b..28002a606ac8838b26cdf5d8c9e70fb44380888a 100644 (file)
@@ -24,7 +24,6 @@
 #include "gf100.h"
 #include "ctxgf100.h"
 
-#include <subdev/fb.h>
 #include <subdev/secboot.h>
 
 #include <nvif/class.h>
@@ -57,17 +56,12 @@ int
 gm200_gr_init(struct gf100_gr *gr)
 {
        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);
        u32 data[TPC_MAX / 8] = {};
        u8  tpcnr[GPC_MAX];
        int gpc, tpc, ppc, rop;
        int i;
 
-       /*XXX: belongs in fb */
-       nvkm_wr32(device, 0x100cc8, nvkm_memory_addr(fb->mmu_wr) >> 8);
-       nvkm_wr32(device, 0x100ccc, nvkm_memory_addr(fb->mmu_rd) >> 8);
-       nvkm_mask(device, 0x100cc4, 0x00040000, 0x00040000);
        gr->func->init_gpc_mmu(gr);
 
        gf100_gr_mmio(gr, gr->fuc_sw_nonctx);
index 08105701af7e3e4fc014584acefd76542b637115..842d5de96d73169be05fc86d2462fb1e27ebdcf9 100644 (file)
@@ -23,6 +23,7 @@ nvkm-y += nvkm/subdev/fb/gf100.o
 nvkm-y += nvkm/subdev/fb/gk104.o
 nvkm-y += nvkm/subdev/fb/gk20a.o
 nvkm-y += nvkm/subdev/fb/gm107.o
+nvkm-y += nvkm/subdev/fb/gm200.o
 
 nvkm-y += nvkm/subdev/fb/ram.o
 nvkm-y += nvkm/subdev/fb/ramnv04.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm200.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm200.c
new file mode 100644 (file)
index 0000000..44f5716
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2012 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Ben Skeggs
+ */
+#include "gf100.h"
+#include "ram.h"
+
+#include <core/memory.h>
+
+static void
+gm200_fb_init(struct nvkm_fb *base)
+{
+       struct gf100_fb *fb = gf100_fb(base);
+       struct nvkm_device *device = fb->base.subdev.device;
+
+       if (fb->r100c10_page)
+               nvkm_wr32(device, 0x100c10, fb->r100c10 >> 8);
+
+       nvkm_mask(device, 0x100c80, 0x00000001, 0x00000000); /* 128KiB lpg */
+
+       nvkm_wr32(device, 0x100cc8, nvkm_memory_addr(fb->base.mmu_wr) >> 8);
+       nvkm_wr32(device, 0x100ccc, nvkm_memory_addr(fb->base.mmu_rd) >> 8);
+       nvkm_mask(device, 0x100cc4, 0x00060000,
+                 min(nvkm_memory_size(fb->base.mmu_rd) >> 16, (u64)2) << 17);
+}
+
+static const struct nvkm_fb_func
+gm200_fb = {
+       .dtor = gf100_fb_dtor,
+       .oneinit = gf100_fb_oneinit,
+       .init = gm200_fb_init,
+       .intr = gf100_fb_intr,
+       .ram_new = gm107_ram_new,
+       .memtype_valid = gf100_fb_memtype_valid,
+};
+
+int
+gm200_fb_new(struct nvkm_device *device, int index, struct nvkm_fb **pfb)
+{
+       return gf100_fb_new_(&gm200_fb, device, index, pfb);
+}