drm/nouveau/fb/tu102-: fix register used to determine scrub status
authorBen Skeggs <bskeggs@redhat.com>
Mon, 30 Jan 2023 22:37:14 +0000 (08:37 +1000)
committerLyude Paul <lyude@redhat.com>
Mon, 30 Jan 2023 23:49:17 +0000 (18:49 -0500)
Turing apparently needs to use the same register we use on Ampere.

Not executing the scrubber ucode when required would result in large
areas of VRAM being inaccessible to the driver.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230130223715.1831509-2-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/subdev/fb/Kbuild
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ga102.c
drivers/gpu/drm/nouveau/nvkm/subdev/fb/gv100.c
drivers/gpu/drm/nouveau/nvkm/subdev/fb/priv.h
drivers/gpu/drm/nouveau/nvkm/subdev/fb/tu102.c [new file with mode: 0644]

index 40768373cdd90de752d157568135061ff4790310..c5a4f49ee2065416137af9fc64180b1b4ce9e570 100644 (file)
@@ -97,6 +97,7 @@ int gp100_fb_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct n
 int gp102_fb_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fb **);
 int gp10b_fb_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fb **);
 int gv100_fb_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fb **);
+int tu102_fb_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fb **);
 int ga100_fb_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fb **);
 int ga102_fb_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_fb **);
 
index 364fea320cb37c28b34ebc1343e3b128b0e6ac08..1c81e5b34d29d871b35431c47b9d1ff651fc5245 100644 (file)
@@ -2405,7 +2405,7 @@ nv162_chipset = {
        .bus      = { 0x00000001, gf100_bus_new },
        .devinit  = { 0x00000001, tu102_devinit_new },
        .fault    = { 0x00000001, tu102_fault_new },
-       .fb       = { 0x00000001, gv100_fb_new },
+       .fb       = { 0x00000001, tu102_fb_new },
        .fuse     = { 0x00000001, gm107_fuse_new },
        .gpio     = { 0x00000001, gk104_gpio_new },
        .gsp      = { 0x00000001, gv100_gsp_new },
@@ -2440,7 +2440,7 @@ nv164_chipset = {
        .bus      = { 0x00000001, gf100_bus_new },
        .devinit  = { 0x00000001, tu102_devinit_new },
        .fault    = { 0x00000001, tu102_fault_new },
-       .fb       = { 0x00000001, gv100_fb_new },
+       .fb       = { 0x00000001, tu102_fb_new },
        .fuse     = { 0x00000001, gm107_fuse_new },
        .gpio     = { 0x00000001, gk104_gpio_new },
        .gsp      = { 0x00000001, gv100_gsp_new },
@@ -2475,7 +2475,7 @@ nv166_chipset = {
        .bus      = { 0x00000001, gf100_bus_new },
        .devinit  = { 0x00000001, tu102_devinit_new },
        .fault    = { 0x00000001, tu102_fault_new },
-       .fb       = { 0x00000001, gv100_fb_new },
+       .fb       = { 0x00000001, tu102_fb_new },
        .fuse     = { 0x00000001, gm107_fuse_new },
        .gpio     = { 0x00000001, gk104_gpio_new },
        .gsp      = { 0x00000001, gv100_gsp_new },
@@ -2510,7 +2510,7 @@ nv167_chipset = {
        .bus      = { 0x00000001, gf100_bus_new },
        .devinit  = { 0x00000001, tu102_devinit_new },
        .fault    = { 0x00000001, tu102_fault_new },
-       .fb       = { 0x00000001, gv100_fb_new },
+       .fb       = { 0x00000001, tu102_fb_new },
        .fuse     = { 0x00000001, gm107_fuse_new },
        .gpio     = { 0x00000001, gk104_gpio_new },
        .gsp      = { 0x00000001, gv100_gsp_new },
@@ -2545,7 +2545,7 @@ nv168_chipset = {
        .bus      = { 0x00000001, gf100_bus_new },
        .devinit  = { 0x00000001, tu102_devinit_new },
        .fault    = { 0x00000001, tu102_fault_new },
-       .fb       = { 0x00000001, gv100_fb_new },
+       .fb       = { 0x00000001, tu102_fb_new },
        .fuse     = { 0x00000001, gm107_fuse_new },
        .gpio     = { 0x00000001, gk104_gpio_new },
        .gsp      = { 0x00000001, gv100_gsp_new },
index 5d0bab8ecb433d60dd28306048f4f7ca656ea483..6ba5120a2ebe1d8c6f7804f4cd17634c3deba887 100644 (file)
@@ -32,6 +32,7 @@ nvkm-y += nvkm/subdev/fb/gp100.o
 nvkm-y += nvkm/subdev/fb/gp102.o
 nvkm-y += nvkm/subdev/fb/gp10b.o
 nvkm-y += nvkm/subdev/fb/gv100.o
+nvkm-y += nvkm/subdev/fb/tu102.o
 nvkm-y += nvkm/subdev/fb/ga100.o
 nvkm-y += nvkm/subdev/fb/ga102.o
 
index 8b7c8ea5e8a5f3f887f20fb3c3a92b1b1b2b8e1c..5a21b0ae459580b1318727e00e1432a94f1abbeb 100644 (file)
@@ -40,12 +40,6 @@ ga102_fb_vpr_scrub(struct nvkm_fb *fb)
        return ret;
 }
 
-static bool
-ga102_fb_vpr_scrub_required(struct nvkm_fb *fb)
-{
-       return (nvkm_rd32(fb->subdev.device, 0x1fa80c) & 0x00000010) != 0;
-}
-
 static const struct nvkm_fb_func
 ga102_fb = {
        .dtor = gf100_fb_dtor,
@@ -56,7 +50,7 @@ ga102_fb = {
        .sysmem.flush_page_init = gf100_fb_sysmem_flush_page_init,
        .ram_new = ga102_ram_new,
        .default_bigpage = 16,
-       .vpr.scrub_required = ga102_fb_vpr_scrub_required,
+       .vpr.scrub_required = tu102_fb_vpr_scrub_required,
        .vpr.scrub = ga102_fb_vpr_scrub,
 };
 
index 1f0126437c1aa1d0a1bb742b0376bae28379d38a..0e3c0a8f5d716e6796d0a40f790b6c312ccf479e 100644 (file)
@@ -49,8 +49,3 @@ gv100_fb_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, s
 }
 
 MODULE_FIRMWARE("nvidia/gv100/nvdec/scrubber.bin");
-MODULE_FIRMWARE("nvidia/tu102/nvdec/scrubber.bin");
-MODULE_FIRMWARE("nvidia/tu104/nvdec/scrubber.bin");
-MODULE_FIRMWARE("nvidia/tu106/nvdec/scrubber.bin");
-MODULE_FIRMWARE("nvidia/tu116/nvdec/scrubber.bin");
-MODULE_FIRMWARE("nvidia/tu117/nvdec/scrubber.bin");
index ac03eac0f2616950c38c3d88ea238352d4024b6a..f517751f94acddc5f4c1d585085cc644f72c931c 100644 (file)
@@ -89,4 +89,6 @@ bool gp102_fb_vpr_scrub_required(struct nvkm_fb *);
 int gp102_fb_vpr_scrub(struct nvkm_fb *);
 
 int gv100_fb_init_page(struct nvkm_fb *);
+
+bool tu102_fb_vpr_scrub_required(struct nvkm_fb *);
 #endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/tu102.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/tu102.c
new file mode 100644 (file)
index 0000000..be82af0
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2018 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.
+ */
+#include "gf100.h"
+#include "ram.h"
+
+bool
+tu102_fb_vpr_scrub_required(struct nvkm_fb *fb)
+{
+       return (nvkm_rd32(fb->subdev.device, 0x1fa80c) & 0x00000010) != 0;
+}
+
+static const struct nvkm_fb_func
+tu102_fb = {
+       .dtor = gf100_fb_dtor,
+       .oneinit = gf100_fb_oneinit,
+       .init = gm200_fb_init,
+       .init_page = gv100_fb_init_page,
+       .init_unkn = gp100_fb_init_unkn,
+       .sysmem.flush_page_init = gf100_fb_sysmem_flush_page_init,
+       .vpr.scrub_required = tu102_fb_vpr_scrub_required,
+       .vpr.scrub = gp102_fb_vpr_scrub,
+       .ram_new = gp100_ram_new,
+       .default_bigpage = 16,
+};
+
+int
+tu102_fb_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_fb **pfb)
+{
+       return gp102_fb_new_(&tu102_fb, device, type, inst, pfb);
+}
+
+MODULE_FIRMWARE("nvidia/tu102/nvdec/scrubber.bin");
+MODULE_FIRMWARE("nvidia/tu104/nvdec/scrubber.bin");
+MODULE_FIRMWARE("nvidia/tu106/nvdec/scrubber.bin");
+MODULE_FIRMWARE("nvidia/tu116/nvdec/scrubber.bin");
+MODULE_FIRMWARE("nvidia/tu117/nvdec/scrubber.bin");