]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/nouveau/vfn: add stub subdev for dev_func
authorBen Skeggs <bskeggs@redhat.com>
Wed, 1 Jun 2022 10:46:53 +0000 (20:46 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 9 Nov 2022 00:44:36 +0000 (10:44 +1000)
Initially for NV_USERMODE class, and Turing/Ampere's new interrupt tree.

v2. fixup for ga103 early merge

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/include/nvkm/core/layout.h
drivers/gpu/drm/nouveau/include/nvkm/subdev/vfn.h [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h
drivers/gpu/drm/nouveau/nvkm/subdev/Kbuild
drivers/gpu/drm/nouveau/nvkm/subdev/vfn/Kbuild [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/subdev/vfn/base.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/subdev/vfn/ga100.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/subdev/vfn/gv100.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/subdev/vfn/priv.h [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/subdev/vfn/tu102.c [new file with mode: 0644]

index 7afe1579b20f433b26771791095f06d3c9bc4c69..a344ddb77c8080ce725584fc7c1129d0a784ddaf 100644 (file)
@@ -1,4 +1,5 @@
 /* SPDX-License-Identifier: MIT */
+NVKM_LAYOUT_ONCE(NVKM_SUBDEV_VFN     , struct nvkm_vfn     ,      vfn)
 NVKM_LAYOUT_ONCE(NVKM_SUBDEV_PCI     , struct nvkm_pci     ,      pci)
 NVKM_LAYOUT_ONCE(NVKM_SUBDEV_VBIOS   , struct nvkm_bios    ,     bios)
 NVKM_LAYOUT_ONCE(NVKM_SUBDEV_DEVINIT , struct nvkm_devinit ,  devinit)
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/vfn.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/vfn.h
new file mode 100644 (file)
index 0000000..85c1bd3
--- /dev/null
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: MIT */
+#ifndef __NVKM_VFN_H__
+#define __NVKM_VFN_H__
+#include <core/subdev.h>
+
+struct nvkm_vfn {
+       const struct nvkm_vfn_func *func;
+       struct nvkm_subdev subdev;
+
+       struct {
+               u32 priv;
+       } addr;
+};
+
+int gv100_vfn_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_vfn **);
+int tu102_vfn_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_vfn **);
+int ga100_vfn_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_vfn **);
+#endif
index 44fdb6f5f225f9cbbdbc0c74e0fdd3852eda4084..88b92306dd4964ecfce7ecea207bce38ddd2869c 100644 (file)
@@ -2385,6 +2385,7 @@ nv140_chipset = {
        .therm    = { 0x00000001, gp100_therm_new },
        .timer    = { 0x00000001, gk20a_timer_new },
        .top      = { 0x00000001, gk104_top_new },
+       .vfn      = { 0x00000001, gv100_vfn_new },
        .ce       = { 0x000001ff, gv100_ce_new },
        .disp     = { 0x00000001, gv100_disp_new },
        .dma      = { 0x00000001, gv100_dma_new },
@@ -2419,6 +2420,7 @@ nv162_chipset = {
        .therm    = { 0x00000001, gp100_therm_new },
        .timer    = { 0x00000001, gk20a_timer_new },
        .top      = { 0x00000001, gk104_top_new },
+       .vfn      = { 0x00000001, tu102_vfn_new },
        .ce       = { 0x0000001f, tu102_ce_new },
        .disp     = { 0x00000001, tu102_disp_new },
        .dma      = { 0x00000001, gv100_dma_new },
@@ -2453,6 +2455,7 @@ nv164_chipset = {
        .therm    = { 0x00000001, gp100_therm_new },
        .timer    = { 0x00000001, gk20a_timer_new },
        .top      = { 0x00000001, gk104_top_new },
+       .vfn      = { 0x00000001, tu102_vfn_new },
        .ce       = { 0x0000001f, tu102_ce_new },
        .disp     = { 0x00000001, tu102_disp_new },
        .dma      = { 0x00000001, gv100_dma_new },
@@ -2487,6 +2490,7 @@ nv166_chipset = {
        .therm    = { 0x00000001, gp100_therm_new },
        .timer    = { 0x00000001, gk20a_timer_new },
        .top      = { 0x00000001, gk104_top_new },
+       .vfn      = { 0x00000001, tu102_vfn_new },
        .ce       = { 0x0000001f, tu102_ce_new },
        .disp     = { 0x00000001, tu102_disp_new },
        .dma      = { 0x00000001, gv100_dma_new },
@@ -2521,6 +2525,7 @@ nv167_chipset = {
        .therm    = { 0x00000001, gp100_therm_new },
        .timer    = { 0x00000001, gk20a_timer_new },
        .top      = { 0x00000001, gk104_top_new },
+       .vfn      = { 0x00000001, tu102_vfn_new },
        .ce       = { 0x0000001f, tu102_ce_new },
        .disp     = { 0x00000001, tu102_disp_new },
        .dma      = { 0x00000001, gv100_dma_new },
@@ -2555,6 +2560,7 @@ nv168_chipset = {
        .therm    = { 0x00000001, gp100_therm_new },
        .timer    = { 0x00000001, gk20a_timer_new },
        .top      = { 0x00000001, gk104_top_new },
+       .vfn      = { 0x00000001, tu102_vfn_new },
        .ce       = { 0x0000001f, tu102_ce_new },
        .disp     = { 0x00000001, tu102_disp_new },
        .dma      = { 0x00000001, gv100_dma_new },
@@ -2581,6 +2587,7 @@ nv170_chipset = {
        .privring = { 0x00000001, gm200_privring_new },
        .timer    = { 0x00000001, gk20a_timer_new },
        .top      = { 0x00000001, ga100_top_new },
+       .vfn      = { 0x00000001, ga100_vfn_new },
 };
 
 static const struct nvkm_device_chip
@@ -2599,6 +2606,7 @@ nv172_chipset = {
        .privring = { 0x00000001, gm200_privring_new },
        .timer    = { 0x00000001, gk20a_timer_new },
        .top      = { 0x00000001, ga100_top_new },
+       .vfn      = { 0x00000001, ga100_vfn_new },
        .disp     = { 0x00000001, ga102_disp_new },
        .dma      = { 0x00000001, gv100_dma_new },
        .fifo     = { 0x00000001, ga102_fifo_new },
@@ -2620,6 +2628,7 @@ nv173_chipset = {
        .privring = { 0x00000001, gm200_privring_new },
        .timer    = { 0x00000001, gk20a_timer_new },
        .top      = { 0x00000001, ga100_top_new },
+       .vfn      = { 0x00000001, ga100_vfn_new },
        .disp     = { 0x00000001, ga102_disp_new },
        .dma      = { 0x00000001, gv100_dma_new },
        .fifo     = { 0x00000001, ga102_fifo_new },
@@ -2641,6 +2650,7 @@ nv174_chipset = {
        .privring = { 0x00000001, gm200_privring_new },
        .timer    = { 0x00000001, gk20a_timer_new },
        .top      = { 0x00000001, ga100_top_new },
+       .vfn      = { 0x00000001, ga100_vfn_new },
        .disp     = { 0x00000001, ga102_disp_new },
        .dma      = { 0x00000001, gv100_dma_new },
        .fifo     = { 0x00000001, ga102_fifo_new },
@@ -2662,6 +2672,7 @@ nv176_chipset = {
        .privring = { 0x00000001, gm200_privring_new },
        .timer    = { 0x00000001, gk20a_timer_new },
        .top      = { 0x00000001, ga100_top_new },
+       .vfn      = { 0x00000001, ga100_vfn_new },
        .disp     = { 0x00000001, ga102_disp_new },
        .dma      = { 0x00000001, gv100_dma_new },
        .fifo     = { 0x00000001, ga102_fifo_new },
@@ -2683,6 +2694,7 @@ nv177_chipset = {
        .privring = { 0x00000001, gm200_privring_new },
        .timer    = { 0x00000001, gk20a_timer_new },
        .top      = { 0x00000001, ga100_top_new },
+       .vfn      = { 0x00000001, ga100_vfn_new },
        .disp     = { 0x00000001, ga102_disp_new },
        .dma      = { 0x00000001, gv100_dma_new },
        .fifo     = { 0x00000001, ga102_fifo_new },
index 93949b3c721432be017c3d20bde7a355b6b48c94..24faaac1589178a137c969ed4b7c36b97908d4d3 100644 (file)
@@ -27,6 +27,7 @@
 #include <subdev/therm.h>
 #include <subdev/timer.h>
 #include <subdev/top.h>
+#include <subdev/vfn.h>
 #include <subdev/volt.h>
 
 #include <engine/bsp.h>
index 2cb24fff7e321585ea48923335aac8cfd00c3ab9..4c2f6fc4ef58fb95dbd7fce8ebb6ec69eaf12101 100644 (file)
@@ -23,4 +23,5 @@ include $(src)/nvkm/subdev/privring/Kbuild
 include $(src)/nvkm/subdev/therm/Kbuild
 include $(src)/nvkm/subdev/timer/Kbuild
 include $(src)/nvkm/subdev/top/Kbuild
+include $(src)/nvkm/subdev/vfn/Kbuild
 include $(src)/nvkm/subdev/volt/Kbuild
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/Kbuild
new file mode 100644 (file)
index 0000000..21c975a
--- /dev/null
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: MIT
+nvkm-y += nvkm/subdev/vfn/base.o
+nvkm-y += nvkm/subdev/vfn/gv100.o
+nvkm-y += nvkm/subdev/vfn/tu102.o
+nvkm-y += nvkm/subdev/vfn/ga100.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/base.c
new file mode 100644 (file)
index 0000000..682ca3e
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2021 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 "priv.h"
+
+static void *
+nvkm_vfn_dtor(struct nvkm_subdev *subdev)
+{
+       return nvkm_vfn(subdev);
+}
+
+static const struct nvkm_subdev_func
+nvkm_vfn = {
+       .dtor = nvkm_vfn_dtor,
+};
+
+int
+nvkm_vfn_new_(const struct nvkm_vfn_func *func, struct nvkm_device *device,
+             enum nvkm_subdev_type type, int inst, u32 addr, struct nvkm_vfn **pvfn)
+{
+       struct nvkm_vfn *vfn;
+
+       if (!(vfn = *pvfn = kzalloc(sizeof(*vfn), GFP_KERNEL)))
+               return -ENOMEM;
+
+       nvkm_subdev_ctor(&nvkm_vfn, device, type, inst, &vfn->subdev);
+       vfn->func = func;
+       vfn->addr.priv = addr;
+       return 0;
+}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/ga100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/ga100.c
new file mode 100644 (file)
index 0000000..979402d
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2021 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 "priv.h"
+
+static const struct nvkm_vfn_func
+ga100_vfn = {
+};
+
+int
+ga100_vfn_new(struct nvkm_device *device,
+             enum nvkm_subdev_type type, int inst, struct nvkm_vfn **pvfn)
+{
+       return nvkm_vfn_new_(&ga100_vfn, device, type, inst, 0xb80000, pvfn);
+}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/gv100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/gv100.c
new file mode 100644 (file)
index 0000000..83dd79b
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2021 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 "priv.h"
+
+static const struct nvkm_vfn_func
+gv100_vfn = {
+};
+
+int
+gv100_vfn_new(struct nvkm_device *device,
+             enum nvkm_subdev_type type, int inst, struct nvkm_vfn **pvfn)
+{
+       return nvkm_vfn_new_(&gv100_vfn, device, type, inst, 0, pvfn);
+}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/priv.h b/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/priv.h
new file mode 100644 (file)
index 0000000..174817c
--- /dev/null
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: MIT */
+#ifndef __NVKM_VFN_PRIV_H__
+#define __NVKM_VFN_PRIV_H__
+#define nvkm_vfn(p) container_of((p), struct nvkm_vfn, subdev)
+#include <subdev/vfn.h>
+
+struct nvkm_vfn_func {
+};
+
+int nvkm_vfn_new_(const struct nvkm_vfn_func *, struct nvkm_device *, enum nvkm_subdev_type, int,
+                 u32 addr, struct nvkm_vfn **);
+#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/tu102.c b/drivers/gpu/drm/nouveau/nvkm/subdev/vfn/tu102.c
new file mode 100644 (file)
index 0000000..999e50f
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2021 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 "priv.h"
+
+static const struct nvkm_vfn_func
+tu102_vfn = {
+};
+
+int
+tu102_vfn_new(struct nvkm_device *device,
+             enum nvkm_subdev_type type, int inst, struct nvkm_vfn **pvfn)
+{
+       return nvkm_vfn_new_(&tu102_vfn, device, type, inst, 0xb80000, pvfn);
+}