drm/nouveau/gsp: add common code for engines/engine objects
authorBen Skeggs <bskeggs@nvidia.com>
Fri, 14 Feb 2025 17:21:47 +0000 (03:21 +1000)
committerDave Airlie <airlied@redhat.com>
Sun, 18 May 2025 20:29:24 +0000 (06:29 +1000)
With minimal to no direct HW programming required, most nvkm_engine
implementations are nearly identical when running on top of GSP-RM.

Add a common implementation of the boilerplate, and use nvkm_rm_gpu to
expose the correct class IDs.

As they're now handled by common code, and there's no support for them
prior to GSP-RM support - this deletes the GA100 NVDEC/NVJPG/OFA HALs,
the GA102 NVENC/OFA HALs, and the AD102 GR/NVDEC/NVENC/NVJPG/OFA HALs.

Signed-off-by: Ben Skeggs <bskeggs@nvidia.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Timur Tabi <ttabi@nvidia.com>
Tested-by: Timur Tabi <ttabi@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
58 files changed:
drivers/gpu/drm/nouveau/include/nvif/class.h
drivers/gpu/drm/nouveau/include/nvkm/engine/gr.h
drivers/gpu/drm/nouveau/include/nvkm/engine/nvdec.h
drivers/gpu/drm/nouveau/include/nvkm/engine/nvenc.h
drivers/gpu/drm/nouveau/include/nvkm/engine/nvjpg.h [deleted file]
drivers/gpu/drm/nouveau/include/nvkm/engine/ofa.h [deleted file]
drivers/gpu/drm/nouveau/nvkm/engine/Kbuild
drivers/gpu/drm/nouveau/nvkm/engine/ce/ga100.c
drivers/gpu/drm/nouveau/nvkm/engine/ce/ga102.c
drivers/gpu/drm/nouveau/nvkm/engine/ce/tu102.c
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/Kbuild
drivers/gpu/drm/nouveau/nvkm/engine/gr/ad102.c [deleted file]
drivers/gpu/drm/nouveau/nvkm/engine/gr/ga102.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/tu102.c
drivers/gpu/drm/nouveau/nvkm/engine/nvdec/Kbuild
drivers/gpu/drm/nouveau/nvkm/engine/nvdec/ad102.c [deleted file]
drivers/gpu/drm/nouveau/nvkm/engine/nvdec/ga100.c [deleted file]
drivers/gpu/drm/nouveau/nvkm/engine/nvdec/ga102.c
drivers/gpu/drm/nouveau/nvkm/engine/nvdec/priv.h
drivers/gpu/drm/nouveau/nvkm/engine/nvdec/tu102.c
drivers/gpu/drm/nouveau/nvkm/engine/nvenc/Kbuild
drivers/gpu/drm/nouveau/nvkm/engine/nvenc/ad102.c [deleted file]
drivers/gpu/drm/nouveau/nvkm/engine/nvenc/ga102.c [deleted file]
drivers/gpu/drm/nouveau/nvkm/engine/nvenc/priv.h
drivers/gpu/drm/nouveau/nvkm/engine/nvenc/tu102.c
drivers/gpu/drm/nouveau/nvkm/engine/nvjpg/Kbuild [deleted file]
drivers/gpu/drm/nouveau/nvkm/engine/nvjpg/ad102.c [deleted file]
drivers/gpu/drm/nouveau/nvkm/engine/nvjpg/ga100.c [deleted file]
drivers/gpu/drm/nouveau/nvkm/engine/nvjpg/priv.h [deleted file]
drivers/gpu/drm/nouveau/nvkm/engine/ofa/Kbuild [deleted file]
drivers/gpu/drm/nouveau/nvkm/engine/ofa/ad102.c [deleted file]
drivers/gpu/drm/nouveau/nvkm/engine/ofa/ga100.c [deleted file]
drivers/gpu/drm/nouveau/nvkm/engine/ofa/ga102.c [deleted file]
drivers/gpu/drm/nouveau/nvkm/engine/ofa/priv.h [deleted file]
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/Kbuild
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/ad10x.c
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/engine.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/engine.h [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/ga100.c
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/ga1xx.c
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/gpu.h
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/gr.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/gr.h [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/nvdec.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/nvenc.c [new file with mode: 0644]
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/ce.c
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/fifo.c
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/gr.c
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/nvdec.c
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/nvenc.c
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/nvjpg.c
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/ofa.c
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rm.c
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/rm.h
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/tu1xx.c

index 824e052dcc25e31ccc2e0837a86488f5f2c3a128..71a2a53bff7f1f413d976293bb1abd39f4d717f6 100644 (file)
 
 #define TURING_A                                      /* cl9097.h */ 0x0000c597
 
+#define AMPERE_A                                                     0x0000c697
 #define AMPERE_B                                      /* cl9097.h */ 0x0000c797
 
 #define ADA_A                                         /* cl9097.h */ 0x0000c997
 #define PASCAL_COMPUTE_B                                             0x0000c1c0
 #define VOLTA_COMPUTE_A                                              0x0000c3c0
 #define TURING_COMPUTE_A                                             0x0000c5c0
+#define AMPERE_COMPUTE_A                                             0x0000c6c0
 #define AMPERE_COMPUTE_B                                             0x0000c7c0
 #define ADA_COMPUTE_A                                                0x0000c9c0
 
index 8145796ffc61bb8f220893415ff392b9dce45136..a2333cfe6955c951c4e739fa014160da4b3c3e95 100644 (file)
@@ -55,5 +55,4 @@ int gp10b_gr_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct n
 int gv100_gr_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_gr **);
 int tu102_gr_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_gr **);
 int ga102_gr_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_gr **);
-int ad102_gr_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_gr **);
 #endif
index 8d2e170883e1f364b68c474abbca2fffc6acbca6..ca83caa55157da9d509a63a4657dea7d310c1158 100644 (file)
@@ -13,7 +13,5 @@ struct nvkm_nvdec {
 
 int gm107_nvdec_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_nvdec **);
 int tu102_nvdec_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_nvdec **);
-int ga100_nvdec_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_nvdec **);
 int ga102_nvdec_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_nvdec **);
-int ad102_nvdec_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_nvdec **);
 #endif
index 018c58fc32ba61395233e4efa739f8a7c771ab9f..1f6eef13f872cf395f8320331c7ef22feffc8a8d 100644 (file)
@@ -13,6 +13,4 @@ struct nvkm_nvenc {
 
 int gm107_nvenc_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_nvenc **);
 int tu102_nvenc_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_nvenc **);
-int ga102_nvenc_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_nvenc **);
-int ad102_nvenc_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_nvenc **);
 #endif
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/engine/nvjpg.h b/drivers/gpu/drm/nouveau/include/nvkm/engine/nvjpg.h
deleted file mode 100644 (file)
index 80b7933..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/* SPDX-License-Identifier: MIT */
-#ifndef __NVKM_NVJPG_H__
-#define __NVKM_NVJPG_H__
-#include <core/engine.h>
-
-int ga100_nvjpg_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_engine **);
-int ad102_nvjpg_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_engine **);
-#endif
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/engine/ofa.h b/drivers/gpu/drm/nouveau/include/nvkm/engine/ofa.h
deleted file mode 100644 (file)
index e72e211..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-/* SPDX-License-Identifier: MIT */
-#ifndef __NVKM_OFA_H__
-#define __NVKM_OFA_H__
-#include <core/engine.h>
-
-int ga100_ofa_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_engine **);
-int ga102_ofa_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_engine **);
-int ad102_ofa_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_engine **);
-#endif
index 2e48b08166705a472a64541cdf301fc6e3b85b10..ddcf8782d6b6e3f1bce70cd2b9a79fcabf2d6442 100644 (file)
@@ -17,8 +17,6 @@ include $(src)/nvkm/engine/msppp/Kbuild
 include $(src)/nvkm/engine/msvld/Kbuild
 include $(src)/nvkm/engine/nvenc/Kbuild
 include $(src)/nvkm/engine/nvdec/Kbuild
-include $(src)/nvkm/engine/nvjpg/Kbuild
-include $(src)/nvkm/engine/ofa/Kbuild
 include $(src)/nvkm/engine/sec/Kbuild
 include $(src)/nvkm/engine/sec2/Kbuild
 include $(src)/nvkm/engine/sw/Kbuild
index 9427a592bd16c05d38c089bf438020feb2163786..1c0c6013870602f935430227ae9367d86dcabe0d 100644 (file)
@@ -90,7 +90,7 @@ ga100_ce_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
             struct nvkm_engine **pengine)
 {
        if (nvkm_gsp_rm(device->gsp))
-               return r535_ce_new(&ga100_ce, device, type, inst, pengine);
+               return -ENODEV;
 
        return nvkm_engine_new_(&ga100_ce, device, type, inst, true, pengine);
 }
index ce56ede7c2e9433cdab33040b2998888f2053045..9359c5e7aa3a90d5b3480016f8e957cd96f56f0e 100644 (file)
@@ -44,7 +44,7 @@ ga102_ce_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
             struct nvkm_engine **pengine)
 {
        if (nvkm_gsp_rm(device->gsp))
-               return r535_ce_new(&ga102_ce, device, type, inst, pengine);
+               return -ENODEV;
 
        return nvkm_engine_new_(&ga102_ce, device, type, inst, true, pengine);
 }
index 7c8647dcb349e1bb8bd225ef7641c1b25dd4fa3c..67d0545cf902a5490b526fbbbc6b341c8debc260 100644 (file)
@@ -40,7 +40,7 @@ tu102_ce_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
             struct nvkm_engine **pengine)
 {
        if (nvkm_gsp_rm(device->gsp))
-               return r535_ce_new(&tu102_ce, device, type, inst, pengine);
+               return -ENODEV;
 
        return nvkm_engine_new_(&tu102_ce, device, type, inst, true, pengine);
 }
index aa929d3b2941c5c13efed78e689f836bb90d5aac..0cd20d0f878255e0b86b6b5f3f6a6ca3b4e68ffd 100644 (file)
@@ -2529,9 +2529,6 @@ nv170_chipset = {
        .vfn      = { 0x00000001, ga100_vfn_new },
        .ce       = { 0x000003ff, ga100_ce_new },
        .fifo     = { 0x00000001, ga100_fifo_new },
-       .nvdec    = { 0x0000001f, ga100_nvdec_new },
-       .nvjpg    = { 0x00000001, ga100_nvjpg_new },
-       .ofa      = { 0x00000001, ga100_ofa_new },
 };
 
 static const struct nvkm_device_chip
@@ -2561,8 +2558,6 @@ nv172_chipset = {
        .fifo     = { 0x00000001, ga102_fifo_new },
        .gr       = { 0x00000001, ga102_gr_new },
        .nvdec    = { 0x00000003, ga102_nvdec_new },
-       .nvenc    = { 0x00000001, ga102_nvenc_new },
-       .ofa      = { 0x00000001, ga102_ofa_new },
        .sec2     = { 0x00000001, ga102_sec2_new },
 };
 
@@ -2593,8 +2588,6 @@ nv173_chipset = {
        .fifo     = { 0x00000001, ga102_fifo_new },
        .gr       = { 0x00000001, ga102_gr_new },
        .nvdec    = { 0x00000003, ga102_nvdec_new },
-       .nvenc    = { 0x00000001, ga102_nvenc_new },
-       .ofa      = { 0x00000001, ga102_ofa_new },
        .sec2     = { 0x00000001, ga102_sec2_new },
 };
 
@@ -2625,8 +2618,6 @@ nv174_chipset = {
        .fifo     = { 0x00000001, ga102_fifo_new },
        .gr       = { 0x00000001, ga102_gr_new },
        .nvdec    = { 0x00000003, ga102_nvdec_new },
-       .nvenc    = { 0x00000001, ga102_nvenc_new },
-       .ofa      = { 0x00000001, ga102_ofa_new },
        .sec2     = { 0x00000001, ga102_sec2_new },
 };
 
@@ -2657,8 +2648,6 @@ nv176_chipset = {
        .fifo     = { 0x00000001, ga102_fifo_new },
        .gr       = { 0x00000001, ga102_gr_new },
        .nvdec    = { 0x00000003, ga102_nvdec_new },
-       .nvenc    = { 0x00000001, ga102_nvenc_new },
-       .ofa      = { 0x00000001, ga102_ofa_new },
        .sec2     = { 0x00000001, ga102_sec2_new },
 };
 
@@ -2689,8 +2678,6 @@ nv177_chipset = {
        .fifo     = { 0x00000001, ga102_fifo_new },
        .gr       = { 0x00000001, ga102_gr_new },
        .nvdec    = { 0x00000003, ga102_nvdec_new },
-       .nvenc    = { 0x00000001, ga102_nvenc_new },
-       .ofa      = { 0x00000001, ga102_ofa_new },
        .sec2     = { 0x00000001, ga102_sec2_new },
 };
 
@@ -2712,11 +2699,6 @@ nv192_chipset = {
        .disp     = { 0x00000001, ga102_disp_new },
        .dma      = { 0x00000001, gv100_dma_new },
        .fifo     = { 0x00000001, ga102_fifo_new },
-       .gr       = { 0x00000001, ad102_gr_new },
-       .nvdec    = { 0x0000000f, ad102_nvdec_new },
-       .nvenc    = { 0x00000007, ad102_nvenc_new },
-       .nvjpg    = { 0x0000000f, ad102_nvjpg_new },
-       .ofa      = { 0x00000001, ad102_ofa_new },
        .sec2     = { 0x00000001, ga102_sec2_new },
 };
 
@@ -2738,11 +2720,6 @@ nv193_chipset = {
        .disp     = { 0x00000001, ga102_disp_new },
        .dma      = { 0x00000001, gv100_dma_new },
        .fifo     = { 0x00000001, ga102_fifo_new },
-       .gr       = { 0x00000001, ad102_gr_new },
-       .nvdec    = { 0x0000000f, ad102_nvdec_new },
-       .nvenc    = { 0x00000007, ad102_nvenc_new },
-       .nvjpg    = { 0x0000000f, ad102_nvjpg_new },
-       .ofa      = { 0x00000001, ad102_ofa_new },
        .sec2     = { 0x00000001, ga102_sec2_new },
 };
 
@@ -2764,11 +2741,6 @@ nv194_chipset = {
        .disp     = { 0x00000001, ga102_disp_new },
        .dma      = { 0x00000001, gv100_dma_new },
        .fifo     = { 0x00000001, ga102_fifo_new },
-       .gr       = { 0x00000001, ad102_gr_new },
-       .nvdec    = { 0x0000000f, ad102_nvdec_new },
-       .nvenc    = { 0x00000007, ad102_nvenc_new },
-       .nvjpg    = { 0x0000000f, ad102_nvjpg_new },
-       .ofa      = { 0x00000001, ad102_ofa_new },
        .sec2     = { 0x00000001, ga102_sec2_new },
 };
 
@@ -2790,11 +2762,6 @@ nv196_chipset = {
        .disp     = { 0x00000001, ga102_disp_new },
        .dma      = { 0x00000001, gv100_dma_new },
        .fifo     = { 0x00000001, ga102_fifo_new },
-       .gr       = { 0x00000001, ad102_gr_new },
-       .nvdec    = { 0x0000000f, ad102_nvdec_new },
-       .nvenc    = { 0x00000007, ad102_nvenc_new },
-       .nvjpg    = { 0x0000000f, ad102_nvjpg_new },
-       .ofa      = { 0x00000001, ad102_ofa_new },
        .sec2     = { 0x00000001, ga102_sec2_new },
 };
 
@@ -2816,11 +2783,6 @@ nv197_chipset = {
        .disp     = { 0x00000001, ga102_disp_new },
        .dma      = { 0x00000001, gv100_dma_new },
        .fifo     = { 0x00000001, ga102_fifo_new },
-       .gr       = { 0x00000001, ad102_gr_new },
-       .nvdec    = { 0x0000000f, ad102_nvdec_new },
-       .nvenc    = { 0x00000007, ad102_nvenc_new },
-       .nvjpg    = { 0x0000000f, ad102_nvjpg_new },
-       .ofa      = { 0x00000001, ad102_ofa_new },
        .sec2     = { 0x00000001, ga102_sec2_new },
 };
 
index e42b18820a9564bcdef61c8150ceabf9342235e8..8da5e896dd74f6a15c52ec3e5db0968fb1f17964 100644 (file)
@@ -43,8 +43,6 @@
 #include <engine/msvld.h>
 #include <engine/nvenc.h>
 #include <engine/nvdec.h>
-#include <engine/nvjpg.h>
-#include <engine/ofa.h>
 #include <engine/sec.h>
 #include <engine/sec2.h>
 #include <engine/sw.h>
index 487fcc14b9a93449dca4b549aff03aaca2e99bb7..b5418f05ccd8b46c7664fd449b51f90ff3f9eb25 100644 (file)
@@ -41,7 +41,6 @@ nvkm-y += nvkm/engine/gr/gp10b.o
 nvkm-y += nvkm/engine/gr/gv100.o
 nvkm-y += nvkm/engine/gr/tu102.o
 nvkm-y += nvkm/engine/gr/ga102.o
-nvkm-y += nvkm/engine/gr/ad102.o
 
 nvkm-y += nvkm/engine/gr/ctxnv40.o
 nvkm-y += nvkm/engine/gr/ctxnv50.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ad102.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ad102.c
deleted file mode 100644 (file)
index 7bfa624..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2023 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 <subdev/gsp.h>
-
-#include <nvif/class.h>
-
-static const struct gf100_gr_func
-ad102_gr = {
-       .sclass = {
-               { -1, -1, FERMI_TWOD_A },
-               { -1, -1, KEPLER_INLINE_TO_MEMORY_B },
-               { -1, -1, ADA_A },
-               { -1, -1, ADA_COMPUTE_A },
-               {}
-       }
-};
-
-int
-ad102_gr_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_gr **pgr)
-{
-       if (nvkm_gsp_rm(device->gsp))
-               return r535_gr_new(&ad102_gr, device, type, inst, pgr);
-
-       return -ENODEV;
-}
index d285c597aff9c4a0d208aa956d9d45d126d440e4..2b51f1d0c281f2cc5e518597691343181aab91ae 100644 (file)
@@ -352,7 +352,7 @@ int
 ga102_gr_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_gr **pgr)
 {
        if (nvkm_gsp_rm(device->gsp))
-               return r535_gr_new(&ga102_gr, device, type, inst, pgr);
+               return -ENODEV;
 
        return gf100_gr_new_(ga102_gr_fwif, device, type, inst, pgr);
 }
index b0e0c93050345d73ac57d6cd0e9e4297f81b6b8f..54f686ba39ac2fff3cdbed960539c053e8ac9154 100644 (file)
@@ -445,6 +445,4 @@ void gp108_gr_acr_bld_patch(struct nvkm_acr *, u32, s64);
 
 int gf100_gr_new_(const struct gf100_gr_fwif *, struct nvkm_device *, enum nvkm_subdev_type, int,
                  struct nvkm_gr **);
-int r535_gr_new(const struct gf100_gr_func *, struct nvkm_device *, enum nvkm_subdev_type, int,
-               struct nvkm_gr **);
 #endif
index b7a458e9040a3e26a6eeef0814289c99729318f1..bda8054c6b59cc31c6cde3483ae574c9ef8a436b 100644 (file)
@@ -219,7 +219,7 @@ int
 tu102_gr_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_gr **pgr)
 {
        if (nvkm_gsp_rm(device->gsp))
-               return r535_gr_new(&tu102_gr, device, type, inst, pgr);
+               return -ENODEV;
 
        return gf100_gr_new_(tu102_gr_fwif, device, type, inst, pgr);
 }
index 5cc317abc42cc0445065b161d49a042ab85a0cda..37b0cdc760c763af44752a9c51c99bf9e8309aac 100644 (file)
@@ -2,6 +2,4 @@
 nvkm-y += nvkm/engine/nvdec/base.o
 nvkm-y += nvkm/engine/nvdec/gm107.o
 nvkm-y += nvkm/engine/nvdec/tu102.o
-nvkm-y += nvkm/engine/nvdec/ga100.o
 nvkm-y += nvkm/engine/nvdec/ga102.o
-nvkm-y += nvkm/engine/nvdec/ad102.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/nvdec/ad102.c b/drivers/gpu/drm/nouveau/nvkm/engine/nvdec/ad102.c
deleted file mode 100644 (file)
index d72b3aa..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2023 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"
-
-#include <subdev/gsp.h>
-
-#include <nvif/class.h>
-
-static const struct nvkm_engine_func
-ad102_nvdec = {
-       .sclass = {
-               { -1, -1, NVC9B0_VIDEO_DECODER },
-               {}
-       }
-};
-
-int
-ad102_nvdec_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
-               struct nvkm_nvdec **pnvdec)
-{
-       if (nvkm_gsp_rm(device->gsp))
-               return r535_nvdec_new(&ad102_nvdec, device, type, inst, pnvdec);
-
-       return -ENODEV;
-}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/nvdec/ga100.c b/drivers/gpu/drm/nouveau/nvkm/engine/nvdec/ga100.c
deleted file mode 100644 (file)
index 9329342..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2023 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"
-
-#include <subdev/gsp.h>
-
-#include <nvif/class.h>
-
-static const struct nvkm_engine_func
-ga100_nvdec = {
-       .sclass = {
-               { -1, -1, NVC6B0_VIDEO_DECODER },
-               {}
-       }
-};
-
-int
-ga100_nvdec_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
-               struct nvkm_nvdec **pnvdec)
-{
-       if (nvkm_gsp_rm(device->gsp))
-               return r535_nvdec_new(&ga100_nvdec, device, type, inst, pnvdec);
-
-       return -ENODEV;
-}
index 022a9c824304372c4ceb0af1db31af806fd4acd1..eea6368adae2b11ad5f3bd25c2f281fb664973b6 100644 (file)
 
 #include <subdev/gsp.h>
 
-#include <nvif/class.h>
-
-static const struct nvkm_engine_func
-ga102_nvdec_gsp = {
-       .sclass = {
-               { -1, -1, NVC7B0_VIDEO_DECODER },
-               {}
-       }
-};
-
 static const struct nvkm_falcon_func
 ga102_nvdec_flcn = {
        .disable = gm200_flcn_disable,
@@ -67,7 +57,7 @@ ga102_nvdec_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst
                struct nvkm_nvdec **pnvdec)
 {
        if (nvkm_gsp_rm(device->gsp))
-               return r535_nvdec_new(&ga102_nvdec_gsp, device, type, inst, pnvdec);
+               return -ENODEV;
 
        return nvkm_nvdec_new_(ga102_nvdec_fwif, device, type, inst, 0x848000, pnvdec);
 }
index f506ae83bfd73f6358102c4e7bc62815c87cbdb6..f8d43e913093634222c4eede81e807e038da6d55 100644 (file)
@@ -20,7 +20,4 @@ extern const struct nvkm_nvdec_fwif gm107_nvdec_fwif[];
 
 int nvkm_nvdec_new_(const struct nvkm_nvdec_fwif *fwif, struct nvkm_device *,
                    enum nvkm_subdev_type, int, u32 addr, struct nvkm_nvdec **);
-
-int r535_nvdec_new(const struct nvkm_engine_func *, struct nvkm_device *,
-                  enum nvkm_subdev_type, int, struct nvkm_nvdec **);
 #endif
index 808c8e010b9e2999404703e744647aff6dd798c9..fe95b6e22f21d77b6bf073f4729da6b3845f60d1 100644 (file)
 
 #include <subdev/gsp.h>
 
-#include <nvif/class.h>
-
-static const struct nvkm_engine_func
-tu102_nvdec = {
-       .sclass = {
-               { -1, -1, NVC4B0_VIDEO_DECODER },
-               {}
-       }
-};
-
 int
 tu102_nvdec_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
                struct nvkm_nvdec **pnvdec)
 {
        if (nvkm_gsp_rm(device->gsp))
-               return r535_nvdec_new(&tu102_nvdec, device, type, inst, pnvdec);
+               return -ENODEV;
 
        return nvkm_nvdec_new_(gm107_nvdec_fwif, device, type, inst, 0, pnvdec);
 }
index 3d71f2973dab02808bdab193bc378444cc167160..6dcb20d1d156f1c0edd730afd1300c1cc9b31588 100644 (file)
@@ -2,5 +2,3 @@
 nvkm-y += nvkm/engine/nvenc/base.o
 nvkm-y += nvkm/engine/nvenc/gm107.o
 nvkm-y += nvkm/engine/nvenc/tu102.o
-nvkm-y += nvkm/engine/nvenc/ga102.o
-nvkm-y += nvkm/engine/nvenc/ad102.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/nvenc/ad102.c b/drivers/gpu/drm/nouveau/nvkm/engine/nvenc/ad102.c
deleted file mode 100644 (file)
index 1b4619f..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2023 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"
-
-#include <subdev/gsp.h>
-
-#include <nvif/class.h>
-
-static const struct nvkm_engine_func
-ad102_nvenc = {
-       .sclass = {
-               { -1, -1, NVC9B7_VIDEO_ENCODER },
-               {}
-       }
-};
-
-int
-ad102_nvenc_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
-               struct nvkm_nvenc **pnvenc)
-{
-       if (nvkm_gsp_rm(device->gsp))
-               return r535_nvenc_new(&ad102_nvenc, device, type, inst, pnvenc);
-
-       return -ENODEV;
-}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/nvenc/ga102.c b/drivers/gpu/drm/nouveau/nvkm/engine/nvenc/ga102.c
deleted file mode 100644 (file)
index 6463ab8..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2023 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"
-
-#include <subdev/gsp.h>
-
-#include <nvif/class.h>
-
-static const struct nvkm_engine_func
-ga102_nvenc = {
-       .sclass = {
-               { -1, -1, NVC7B7_VIDEO_ENCODER },
-               {}
-       }
-};
-
-int
-ga102_nvenc_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
-               struct nvkm_nvenc **pnvenc)
-{
-       if (nvkm_gsp_rm(device->gsp))
-               return r535_nvenc_new(&ga102_nvenc, device, type, inst, pnvenc);
-
-       return -ENODEV;
-}
index 7917affc6505a8ecf965d475dc8f5fecedb45bbe..b097e3f2867b338c9d83c5c65643fddb9befcdb8 100644 (file)
@@ -18,7 +18,4 @@ extern const struct nvkm_nvenc_fwif gm107_nvenc_fwif[];
 
 int nvkm_nvenc_new_(const struct nvkm_nvenc_fwif *, struct nvkm_device *, enum nvkm_subdev_type,
                    int, struct nvkm_nvenc **pnvenc);
-
-int r535_nvenc_new(const struct nvkm_engine_func *, struct nvkm_device *,
-                  enum nvkm_subdev_type, int, struct nvkm_nvenc **);
 #endif
index 933864423bb3d3f513fdfe30696fefe705418af8..8a436b398749fee7afc241a86a6fa2e28b4fecca 100644 (file)
 
 #include <subdev/gsp.h>
 
-#include <nvif/class.h>
-
-static const struct nvkm_engine_func
-tu102_nvenc = {
-       .sclass = {
-               { -1, -1, NVC4B7_VIDEO_ENCODER },
-               {}
-       }
-};
-
 int
 tu102_nvenc_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
                struct nvkm_nvenc **pnvenc)
 {
        if (nvkm_gsp_rm(device->gsp))
-               return r535_nvenc_new(&tu102_nvenc, device, type, inst, pnvenc);
+               return -ENODEV;
 
        return nvkm_nvenc_new_(gm107_nvenc_fwif, device, type, inst, pnvenc);
 }
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/nvjpg/Kbuild b/drivers/gpu/drm/nouveau/nvkm/engine/nvjpg/Kbuild
deleted file mode 100644 (file)
index 1d9bddd..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: MIT
-nvkm-y += nvkm/engine/nvjpg/ga100.o
-nvkm-y += nvkm/engine/nvjpg/ad102.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/nvjpg/ad102.c b/drivers/gpu/drm/nouveau/nvkm/engine/nvjpg/ad102.c
deleted file mode 100644 (file)
index 62705dc..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2023 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"
-
-#include <subdev/gsp.h>
-
-#include <nvif/class.h>
-
-static const struct nvkm_engine_func
-ad102_nvjpg = {
-       .sclass = {
-               { -1, -1, NVC9D1_VIDEO_NVJPG },
-               {}
-       }
-};
-
-int
-ad102_nvjpg_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
-               struct nvkm_engine **pengine)
-{
-       if (nvkm_gsp_rm(device->gsp))
-               return r535_nvjpg_new(&ad102_nvjpg, device, type, inst, pengine);
-
-       return -ENODEV;
-}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/nvjpg/ga100.c b/drivers/gpu/drm/nouveau/nvkm/engine/nvjpg/ga100.c
deleted file mode 100644 (file)
index f550eb0..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2023 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"
-
-#include <subdev/gsp.h>
-
-#include <nvif/class.h>
-
-static const struct nvkm_engine_func
-ga100_nvjpg = {
-       .sclass = {
-               { -1, -1, NVC4D1_VIDEO_NVJPG },
-               {}
-       }
-};
-
-int
-ga100_nvjpg_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
-               struct nvkm_engine **pengine)
-{
-       if (nvkm_gsp_rm(device->gsp))
-               return r535_nvjpg_new(&ga100_nvjpg, device, type, inst, pengine);
-
-       return -ENODEV;
-}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/nvjpg/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/nvjpg/priv.h
deleted file mode 100644 (file)
index 1e80cf7..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/* SPDX-License-Identifier: MIT */
-#ifndef __NVKM_NVJPG_PRIV_H__
-#define __NVKM_NVJPG_PRIV_H__
-#include <engine/nvjpg.h>
-
-int r535_nvjpg_new(const struct nvkm_engine_func *, struct nvkm_device *,
-                  enum nvkm_subdev_type, int, struct nvkm_engine **);
-#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/ofa/Kbuild b/drivers/gpu/drm/nouveau/nvkm/engine/ofa/Kbuild
deleted file mode 100644 (file)
index 3faf73b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# SPDX-License-Identifier: MIT
-nvkm-y += nvkm/engine/ofa/ga100.o
-nvkm-y += nvkm/engine/ofa/ga102.o
-nvkm-y += nvkm/engine/ofa/ad102.o
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/ofa/ad102.c b/drivers/gpu/drm/nouveau/nvkm/engine/ofa/ad102.c
deleted file mode 100644 (file)
index 7ac87ef..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2023 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"
-
-#include <subdev/gsp.h>
-
-#include <nvif/class.h>
-
-static const struct nvkm_engine_func
-ad102_ofa = {
-       .sclass = {
-               { -1, -1, NVC9FA_VIDEO_OFA },
-               {}
-       }
-};
-
-int
-ad102_ofa_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
-             struct nvkm_engine **pengine)
-{
-       if (nvkm_gsp_rm(device->gsp))
-               return r535_ofa_new(&ad102_ofa, device, type, inst, pengine);
-
-       return -ENODEV;
-}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/ofa/ga100.c b/drivers/gpu/drm/nouveau/nvkm/engine/ofa/ga100.c
deleted file mode 100644 (file)
index ef474f6..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2023 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"
-
-#include <subdev/gsp.h>
-
-#include <nvif/class.h>
-
-static const struct nvkm_engine_func
-ga100_ofa = {
-       .sclass = {
-               { -1, -1, NVC6FA_VIDEO_OFA },
-               {}
-       }
-};
-
-int
-ga100_ofa_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
-             struct nvkm_engine **pengine)
-{
-       if (nvkm_gsp_rm(device->gsp))
-               return r535_ofa_new(&ga100_ofa, device, type, inst, pengine);
-
-       return -ENODEV;
-}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/ofa/ga102.c b/drivers/gpu/drm/nouveau/nvkm/engine/ofa/ga102.c
deleted file mode 100644 (file)
index bea2555..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2023 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"
-
-#include <subdev/gsp.h>
-
-#include <nvif/class.h>
-
-static const struct nvkm_engine_func
-ga102_ofa = {
-       .sclass = {
-               { -1, -1, NVC7FA_VIDEO_OFA },
-               {}
-       }
-};
-
-int
-ga102_ofa_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
-             struct nvkm_engine **pengine)
-{
-       if (nvkm_gsp_rm(device->gsp))
-               return r535_ofa_new(&ga102_ofa, device, type, inst, pengine);
-
-       return -ENODEV;
-}
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/ofa/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/ofa/priv.h
deleted file mode 100644 (file)
index caf29e6..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/* SPDX-License-Identifier: MIT */
-#ifndef __NVKM_OFA_PRIV_H__
-#define __NVKM_OFA_PRIV_H__
-#include <engine/ofa.h>
-
-int r535_ofa_new(const struct nvkm_engine_func *, struct nvkm_device *,
-                enum nvkm_subdev_type, int, struct nvkm_engine **);
-#endif
index 841b690c0c0a880da68a147d2ce3ae380d090586..e5d5f8880d31fd47c44bad70beccd9ab4628080c 100644 (file)
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: MIT
 #
 # Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
+nvkm-y += nvkm/subdev/gsp/rm/engine.o
+nvkm-y += nvkm/subdev/gsp/rm/gr.o
+nvkm-y += nvkm/subdev/gsp/rm/nvdec.o
+nvkm-y += nvkm/subdev/gsp/rm/nvenc.o
 
 nvkm-y += nvkm/subdev/gsp/rm/tu1xx.o
 nvkm-y += nvkm/subdev/gsp/rm/ga100.o
index d5b64da712bcce7e1ccb5fca57685ff27b8d0757..d699c386adec62335eb8700ec5ece4a20281d206 100644 (file)
@@ -22,4 +22,15 @@ ad10x_gpu = {
        .fifo.chan = {
                .class = AMPERE_CHANNEL_GPFIFO_A,
        },
+
+       .ce.class = AMPERE_DMA_COPY_B,
+       .gr.class = {
+               .i2m = KEPLER_INLINE_TO_MEMORY_B,
+               .twod = FERMI_TWOD_A,
+               .threed = ADA_A,
+               .compute = ADA_COMPUTE_A,
+       },
+       .nvdec.class = NVC9B0_VIDEO_DECODER,
+       .nvenc.class = NVC9B7_VIDEO_ENCODER,
+       .ofa.class = NVC9FA_VIDEO_OFA,
 };
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/engine.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/engine.c
new file mode 100644 (file)
index 0000000..3b0e83b
--- /dev/null
@@ -0,0 +1,189 @@
+/* SPDX-License-Identifier: MIT
+ *
+ * Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
+ */
+#include "engine.h"
+#include "gpu.h"
+
+#include <core/object.h>
+#include <engine/fifo/chan.h>
+
+struct nvkm_rm_engine {
+       struct nvkm_engine engine;
+
+       struct nvkm_engine_func func;
+};
+
+struct nvkm_rm_engine_obj {
+       struct nvkm_object object;
+       struct nvkm_gsp_object rm;
+};
+
+static void*
+nvkm_rm_engine_obj_dtor(struct nvkm_object *object)
+{
+       struct nvkm_rm_engine_obj *obj = container_of(object, typeof(*obj), object);
+
+       nvkm_gsp_rm_free(&obj->rm);
+       return obj;
+}
+
+static const struct nvkm_object_func
+nvkm_rm_engine_obj = {
+       .dtor = nvkm_rm_engine_obj_dtor,
+};
+
+int
+nvkm_rm_engine_obj_new(struct nvkm_gsp_object *chan, int chid, const struct nvkm_oclass *oclass,
+                      struct nvkm_object **pobject)
+{
+       struct nvkm_rm *rm = chan->client->gsp->rm;
+       const int inst = oclass->engine->subdev.inst;
+       const u32 class = oclass->base.oclass;
+       const u32 handle = oclass->handle;
+       struct nvkm_rm_engine_obj *obj;
+       int ret;
+
+       obj = kzalloc(sizeof(*obj), GFP_KERNEL);
+       if (!obj)
+               return -ENOMEM;
+
+       switch (oclass->engine->subdev.type) {
+       case NVKM_ENGINE_CE:
+               ret = rm->api->ce->alloc(chan, handle, class, inst, &obj->rm);
+               break;
+       case NVKM_ENGINE_GR:
+               ret = nvkm_gsp_rm_alloc(chan, handle, class, 0, &obj->rm);
+               break;
+       case NVKM_ENGINE_NVDEC:
+               ret = rm->api->nvdec->alloc(chan, handle, class, inst, &obj->rm);
+               break;
+       case NVKM_ENGINE_NVENC:
+               ret = rm->api->nvenc->alloc(chan, handle, class, inst, &obj->rm);
+               break;
+       case NVKM_ENGINE_NVJPG:
+               ret = rm->api->nvjpg->alloc(chan, handle, class, inst, &obj->rm);
+               break;
+       case NVKM_ENGINE_OFA:
+               ret = rm->api->ofa->alloc(chan, handle, class, inst, &obj->rm);
+               break;
+       default:
+               ret = -EINVAL;
+               WARN_ON(1);
+               break;
+       }
+
+       if (ret) {
+               kfree(obj);
+               return ret;
+       }
+
+       nvkm_object_ctor(&nvkm_rm_engine_obj, oclass, &obj->object);
+       *pobject = &obj->object;
+       return 0;
+}
+
+static int
+nvkm_rm_engine_obj_ctor(const struct nvkm_oclass *oclass, void *argv, u32 argc,
+                       struct nvkm_object **pobject)
+{
+       struct nvkm_chan *chan = nvkm_uchan_chan(oclass->parent);
+
+       return nvkm_rm_engine_obj_new(&chan->rm.object, chan->id, oclass, pobject);
+}
+
+static void *
+nvkm_rm_engine_dtor(struct nvkm_engine *engine)
+{
+       kfree(engine->func);
+       return engine;
+}
+
+int
+nvkm_rm_engine_ctor(void *(*dtor)(struct nvkm_engine *), struct nvkm_rm *rm,
+                   enum nvkm_subdev_type type, int inst,
+                   const u32 *class, int nclass, struct nvkm_engine *engine)
+{
+       struct nvkm_engine_func *func;
+
+       func = kzalloc(struct_size(func, sclass, nclass + 1), GFP_KERNEL);
+       if (!func)
+               return -ENOMEM;
+
+       func->dtor = dtor;
+
+       for (int i = 0; i < nclass; i++) {
+               func->sclass[i].oclass = class[i];
+               func->sclass[i].minver = -1;
+               func->sclass[i].maxver = 0;
+               func->sclass[i].ctor = nvkm_rm_engine_obj_ctor;
+       }
+
+       nvkm_engine_ctor(func, rm->device, type, inst, true, engine);
+       return 0;
+}
+
+static int
+nvkm_rm_engine_new_(struct nvkm_rm *rm, enum nvkm_subdev_type type, int inst, u32 class,
+                   struct nvkm_engine **pengine)
+{
+       struct nvkm_engine *engine;
+       int ret;
+
+       engine = kzalloc(sizeof(*engine), GFP_KERNEL);
+       if (!engine)
+               return -ENOMEM;
+
+       ret = nvkm_rm_engine_ctor(nvkm_rm_engine_dtor, rm, type, inst, &class, 1, engine);
+       if (ret) {
+               kfree(engine);
+               return ret;
+       }
+
+       *pengine = engine;
+       return 0;
+}
+
+int
+nvkm_rm_engine_new(struct nvkm_rm *rm, enum nvkm_subdev_type type, int inst)
+{
+       const struct nvkm_rm_gpu *gpu = rm->gpu;
+       struct nvkm_device *device = rm->device;
+
+       switch (type) {
+       case NVKM_ENGINE_CE:
+               if (WARN_ON(inst >= ARRAY_SIZE(device->ce)))
+                       return -EINVAL;
+
+               return nvkm_rm_engine_new_(rm, type, inst, gpu->ce.class, &device->ce[inst]);
+       case NVKM_ENGINE_GR:
+               if (inst != 0)
+                       return -ENODEV; /* MiG not supported, just ignore. */
+
+               return nvkm_rm_gr_new(rm);
+       case NVKM_ENGINE_NVDEC:
+               if (WARN_ON(inst >= ARRAY_SIZE(device->nvdec)))
+                       return -EINVAL;
+
+               return nvkm_rm_nvdec_new(rm, inst);
+       case NVKM_ENGINE_NVENC:
+               if (WARN_ON(inst >= ARRAY_SIZE(device->nvenc)))
+                       return -EINVAL;
+
+               return nvkm_rm_nvenc_new(rm, inst);
+       case NVKM_ENGINE_NVJPG:
+               if (WARN_ON(inst >= ARRAY_SIZE(device->nvjpg)))
+                       return -EINVAL;
+
+               return nvkm_rm_engine_new_(rm, type, inst, gpu->nvjpg.class, &device->nvjpg[inst]);
+       case NVKM_ENGINE_OFA:
+               if (WARN_ON(inst >= ARRAY_SIZE(device->ofa)))
+                       return -EINVAL;
+
+               return nvkm_rm_engine_new_(rm, type, inst, gpu->ofa.class, &device->ofa[inst]);
+       default:
+               break;
+       }
+
+       return -ENODEV;
+}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/engine.h b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/engine.h
new file mode 100644 (file)
index 0000000..5b8c9c3
--- /dev/null
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: MIT
+ *
+ * Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
+ */
+#ifndef __NVKM_RM_ENGINE_H__
+#define __NVKM_RM_ENGINE_H__
+#include "gpu.h"
+
+int nvkm_rm_engine_ctor(void *(*dtor)(struct nvkm_engine *), struct nvkm_rm *,
+                       enum nvkm_subdev_type type, int inst,
+                       const u32 *class, int nclass, struct nvkm_engine *);
+int nvkm_rm_engine_new(struct nvkm_rm *, enum nvkm_subdev_type, int inst);
+
+int nvkm_rm_engine_obj_new(struct nvkm_gsp_object *chan, int chid, const struct nvkm_oclass *,
+                          struct nvkm_object **);
+
+int nvkm_rm_gr_new(struct nvkm_rm *);
+int nvkm_rm_nvdec_new(struct nvkm_rm *, int inst);
+int nvkm_rm_nvenc_new(struct nvkm_rm *, int inst);
+#endif
index 9bf80e1961497e814d97c8ecc73145d303ebe833..5e7f18dbf18b30e4b0e8a3b6225d1e18974da485 100644 (file)
@@ -13,4 +13,13 @@ ga100_gpu = {
        .fifo.chan = {
                .class = AMPERE_CHANNEL_GPFIFO_A,
        },
+
+       .ce.class = AMPERE_DMA_COPY_A,
+       .gr.class = {
+               .i2m = KEPLER_INLINE_TO_MEMORY_B,
+               .twod = FERMI_TWOD_A,
+               .threed = AMPERE_A,
+               .compute = AMPERE_COMPUTE_A,
+       },
+       .nvdec.class = NVC6B0_VIDEO_DECODER,
 };
index 55c90148a0d184f65d8c57a84e55b6574ad4f9c2..61525d23aaa04bc815046d9e2dfec2f2610dcbad 100644 (file)
@@ -22,4 +22,15 @@ ga1xx_gpu = {
        .fifo.chan = {
                .class = AMPERE_CHANNEL_GPFIFO_A,
        },
+
+       .ce.class = AMPERE_DMA_COPY_B,
+       .gr.class = {
+               .i2m = KEPLER_INLINE_TO_MEMORY_B,
+               .twod = FERMI_TWOD_A,
+               .threed = AMPERE_B,
+               .compute = AMPERE_COMPUTE_B,
+       },
+       .nvdec.class = NVC7B0_VIDEO_DECODER,
+       .nvenc.class = NVC7B7_VIDEO_ENCODER,
+       .ofa.class = NVC7FA_VIDEO_OFA,
 };
index 4aeeb4b32dc86054a25619cc9331a7a9bffd50c5..a256be42ab6eba6e0e907c3a50f5fb1522195bb4 100644 (file)
@@ -27,6 +27,35 @@ struct nvkm_rm_gpu {
                        u32 class;
                } chan;
        } fifo;
+
+       struct {
+               u32 class;
+       } ce;
+
+       struct {
+               struct {
+                       u32 i2m;
+                       u32 twod;
+                       u32 threed;
+                       u32 compute;
+               } class;
+       } gr;
+
+       struct {
+               u32 class;
+       } nvdec;
+
+       struct {
+               u32 class;
+       } nvenc;
+
+       struct {
+               u32 class;
+       } nvjpg;
+
+       struct {
+               u32 class;
+       } ofa;
 };
 
 extern const struct nvkm_rm_gpu tu1xx_gpu;
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/gr.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/gr.c
new file mode 100644 (file)
index 0000000..22aa894
--- /dev/null
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: MIT
+ *
+ * Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
+ */
+#include "gr.h"
+
+#include <engine/fifo.h>
+#include <engine/gr/priv.h>
+
+static int
+nvkm_rm_gr_obj_ctor(const struct nvkm_oclass *oclass, void *argv, u32 argc,
+                   struct nvkm_object **pobject)
+{
+       struct r535_gr_chan *chan = container_of(oclass->parent, typeof(*chan), object);
+
+       return nvkm_rm_engine_obj_new(&chan->chan->rm.object, chan->chan->id, oclass, pobject);
+}
+
+int
+nvkm_rm_gr_new(struct nvkm_rm *rm)
+{
+       const u32 classes[] = {
+               rm->gpu->gr.class.i2m,
+               rm->gpu->gr.class.twod,
+               rm->gpu->gr.class.threed,
+               rm->gpu->gr.class.compute,
+       };
+       struct nvkm_gr_func *func;
+       struct r535_gr *gr;
+
+       func = kzalloc(struct_size(func, sclass, ARRAY_SIZE(classes) + 1), GFP_KERNEL);
+       if (!func)
+               return -ENOMEM;
+
+       func->dtor = r535_gr_dtor;
+       func->oneinit = r535_gr_oneinit;
+       func->units = r535_gr_units;
+       func->chan_new = r535_gr_chan_new;
+
+       for (int i = 0; i < ARRAY_SIZE(classes); i++) {
+               func->sclass[i].oclass = classes[i];
+               func->sclass[i].minver = -1;
+               func->sclass[i].maxver = 0;
+               func->sclass[i].ctor = nvkm_rm_gr_obj_ctor;
+       }
+
+       gr = kzalloc(sizeof(*gr), GFP_KERNEL);
+       if (!gr) {
+               kfree(func);
+               return -ENOMEM;
+       }
+
+       nvkm_gr_ctor(func, rm->device, NVKM_ENGINE_GR, 0, true, &gr->base);
+       rm->device->gr = &gr->base;
+       return 0;
+}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/gr.h b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/gr.h
new file mode 100644 (file)
index 0000000..9f2b316
--- /dev/null
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: MIT */
+#ifndef __NVKM_RM_GR_H__
+#define __NVKM_RM_GR_H__
+#include "engine.h"
+
+#include <core/object.h>
+#include <engine/gr.h>
+
+#define R515_GR_MAX_CTXBUFS 9
+
+struct r535_gr_chan {
+       struct nvkm_object object;
+       struct r535_gr *gr;
+
+       struct nvkm_vmm *vmm;
+       struct nvkm_chan *chan;
+
+       struct nvkm_memory *mem[R515_GR_MAX_CTXBUFS];
+       struct nvkm_vma    *vma[R515_GR_MAX_CTXBUFS];
+};
+
+struct r535_gr {
+       struct nvkm_gr base;
+
+       struct {
+               u16 bufferId;
+               u32 size;
+               u8  page;
+               u8  align;
+               bool global;
+               bool init;
+               bool ro;
+       } ctxbuf[R515_GR_MAX_CTXBUFS];
+       int ctxbuf_nr;
+
+       struct nvkm_memory *ctxbuf_mem[R515_GR_MAX_CTXBUFS];
+};
+#endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/nvdec.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/nvdec.c
new file mode 100644 (file)
index 0000000..d9fbfc3
--- /dev/null
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: MIT
+ *
+ * Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
+ */
+#include "engine.h"
+#include <engine/nvdec.h>
+
+static void *
+nvkm_rm_nvdec_dtor(struct nvkm_engine *engine)
+{
+       return container_of(engine, struct nvkm_nvdec, engine);
+}
+
+int
+nvkm_rm_nvdec_new(struct nvkm_rm *rm, int inst)
+{
+       struct nvkm_nvdec *nvdec;
+       int ret;
+
+       nvdec = kzalloc(sizeof(*nvdec), GFP_KERNEL);
+       if (!nvdec)
+               return -ENOMEM;
+
+       ret = nvkm_rm_engine_ctor(nvkm_rm_nvdec_dtor, rm, NVKM_ENGINE_NVDEC, inst,
+                                 &rm->gpu->nvdec.class, 1, &nvdec->engine);
+       if (ret) {
+               kfree(nvdec);
+               return ret;
+       }
+
+       rm->device->nvdec[inst] = nvdec;
+       return 0;
+}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/nvenc.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/nvenc.c
new file mode 100644 (file)
index 0000000..6dfa7b7
--- /dev/null
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: MIT
+ *
+ * Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
+ */
+#include "engine.h"
+#include <engine/nvenc.h>
+
+static void *
+nvkm_rm_nvenc_dtor(struct nvkm_engine *engine)
+{
+       return container_of(engine, struct nvkm_nvenc, engine);
+}
+
+int
+nvkm_rm_nvenc_new(struct nvkm_rm *rm, int inst)
+{
+       struct nvkm_nvenc *nvenc;
+       int ret;
+
+       nvenc = kzalloc(sizeof(*nvenc), GFP_KERNEL);
+       if (!nvenc)
+               return -ENOMEM;
+
+       ret = nvkm_rm_engine_ctor(nvkm_rm_nvenc_dtor, rm, NVKM_ENGINE_NVENC, inst,
+                                 &rm->gpu->nvenc.class, 1, &nvenc->engine);
+       if (ret) {
+               kfree(nvenc);
+               return ret;
+       }
+
+       rm->device->nvenc[inst] = nvenc;
+       return 0;
+}
index d60003231e6dfff65169118748afd3c566dd556e..2d1ce9db2dcf968e5cc5630ee01d09cd4ffc6b1b 100644 (file)
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  * OTHER DEALINGS IN THE SOFTWARE.
  */
-#include <engine/ce/priv.h>
-
-#include <core/object.h>
-#include <subdev/gsp.h>
-#include <engine/fifo.h>
+#include <rm/engine.h>
 
 #include "nvrm/ce.h"
 #include "nvrm/engine.h"
 
-struct r535_ce_obj {
-       struct nvkm_object object;
-       struct nvkm_gsp_object rm;
-};
-
-static void *
-r535_ce_obj_dtor(struct nvkm_object *object)
-{
-       struct r535_ce_obj *obj = container_of(object, typeof(*obj), object);
-
-       nvkm_gsp_rm_free(&obj->rm);
-       return obj;
-}
-
-static const struct nvkm_object_func
-r535_ce_obj = {
-       .dtor = r535_ce_obj_dtor,
-};
-
 static int
-r535_ce_obj_ctor(const struct nvkm_oclass *oclass, void *argv, u32 argc,
-                struct nvkm_object **pobject)
+r535_ce_alloc(struct nvkm_gsp_object *chan, u32 handle, u32 class, int inst,
+             struct nvkm_gsp_object *ce)
 {
-       struct nvkm_chan *chan = nvkm_uchan_chan(oclass->parent);
-       struct r535_ce_obj *obj;
        NVC0B5_ALLOCATION_PARAMETERS *args;
 
-       if (!(obj = kzalloc(sizeof(*obj), GFP_KERNEL)))
-               return -ENOMEM;
-
-       nvkm_object_ctor(&r535_ce_obj, oclass, &obj->object);
-       *pobject = &obj->object;
-
-       args = nvkm_gsp_rm_alloc_get(&chan->rm.object, oclass->handle, oclass->base.oclass,
-                                    sizeof(*args), &obj->rm);
+       args = nvkm_gsp_rm_alloc_get(chan, handle, class, sizeof(*args), ce);
        if (WARN_ON(IS_ERR(args)))
                return PTR_ERR(args);
 
        args->version = 1;
-       args->engineType = NV2080_ENGINE_TYPE_COPY0 + oclass->engine->subdev.inst;
+       args->engineType = NV2080_ENGINE_TYPE_COPY0 + inst;
 
-       return nvkm_gsp_rm_alloc_wr(&obj->rm, args);
+       return nvkm_gsp_rm_alloc_wr(ce, args);
 }
 
-static void *
-r535_ce_dtor(struct nvkm_engine *engine)
-{
-       kfree(engine->func);
-       return engine;
-}
-
-int
-r535_ce_new(const struct nvkm_engine_func *hw, struct nvkm_device *device,
-           enum nvkm_subdev_type type, int inst, struct nvkm_engine **pengine)
-{
-       struct nvkm_engine_func *rm;
-       int nclass, ret;
-
-       for (nclass = 0; hw->sclass[nclass].oclass; nclass++);
-
-       if (!(rm = kzalloc(sizeof(*rm) + (nclass + 1) * sizeof(rm->sclass[0]), GFP_KERNEL)))
-               return -ENOMEM;
-
-       rm->dtor = r535_ce_dtor;
-       for (int i = 0; i < nclass; i++) {
-               rm->sclass[i].minver = hw->sclass[i].minver;
-               rm->sclass[i].maxver = hw->sclass[i].maxver;
-               rm->sclass[i].oclass = hw->sclass[i].oclass;
-               rm->sclass[i].ctor = r535_ce_obj_ctor;
-       }
-
-       ret = nvkm_engine_new_(rm, device, type, inst, true, pengine);
-       if (ret)
-               kfree(rm);
-
-       return ret;
-}
+const struct nvkm_rm_api_engine
+r535_ce = {
+       .alloc = r535_ce_alloc,
+};
index 28ac97415e8f730ac28c98ba5edb014a049e1099..98aa272be642f858668d58b75ade8fd8627cb182 100644 (file)
@@ -31,7 +31,7 @@
 #include <subdev/vfn.h>
 #include <engine/gr.h>
 
-#include <rm/gpu.h>
+#include <rm/engine.h>
 
 #include <nvhw/drf.h>
 
@@ -230,7 +230,7 @@ r535_engn_nonstall(struct nvkm_engn *engn)
 }
 
 static const struct nvkm_engn_func
-r535_ce = {
+r535_engn_ce = {
        .nonstall = r535_engn_nonstall,
 };
 
@@ -463,9 +463,17 @@ r535_fifo_runl_ctor(struct nvkm_fifo *fifo)
                        continue;
                }
 
+               ret = nvkm_rm_engine_new(gsp->rm, type, inst);
+               if (ret) {
+                       nvkm_runl_del(runl);
+                       continue;
+               }
+
+               engn = NULL;
+
                switch (type) {
                case NVKM_ENGINE_CE:
-                       engn = nvkm_runl_add(runl, nv2080, &r535_ce, type, inst);
+                       engn = nvkm_runl_add(runl, nv2080, &r535_engn_ce, type, inst);
                        break;
                case NVKM_ENGINE_GR:
                        engn = nvkm_runl_add(runl, nv2080, &r535_gr, type, inst);
index ab941d808e241ab97c5d28abfffb399db465bc35..3618fa36040cc1e34f8bee58cc6296d57624fd76 100644 (file)
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  * OTHER DEALINGS IN THE SOFTWARE.
  */
-#include <engine/gr/gf100.h>
+#include <rm/gr.h>
 
 #include <core/memory.h>
 #include <subdev/gsp.h>
 #include <subdev/mmu/vmm.h>
 #include <engine/fifo/priv.h>
+#include <engine/gr/priv.h>
 
 #include <nvif/if900d.h>
 
 
 #define r535_gr(p) container_of((p), struct r535_gr, base)
 
-#define R515_GR_MAX_CTXBUFS 9
-
-struct r535_gr {
-       struct nvkm_gr base;
-
-       struct {
-               u16 bufferId;
-               u32 size;
-               u8  page;
-               u8  align;
-               bool global;
-               bool init;
-               bool ro;
-       } ctxbuf[R515_GR_MAX_CTXBUFS];
-       int ctxbuf_nr;
-
-       struct nvkm_memory *ctxbuf_mem[R515_GR_MAX_CTXBUFS];
-};
-
-struct r535_gr_chan {
-       struct nvkm_object object;
-       struct r535_gr *gr;
-
-       struct nvkm_vmm *vmm;
-       struct nvkm_chan *chan;
-
-       struct nvkm_memory *mem[R515_GR_MAX_CTXBUFS];
-       struct nvkm_vma    *vma[R515_GR_MAX_CTXBUFS];
-};
-
-struct r535_gr_obj {
-       struct nvkm_object object;
-       struct nvkm_gsp_object rm;
-};
-
-static void *
-r535_gr_obj_dtor(struct nvkm_object *object)
-{
-       struct r535_gr_obj *obj = container_of(object, typeof(*obj), object);
-
-       nvkm_gsp_rm_free(&obj->rm);
-       return obj;
-}
-
-static const struct nvkm_object_func
-r535_gr_obj = {
-       .dtor = r535_gr_obj_dtor,
-};
-
-static int
-r535_gr_obj_ctor(const struct nvkm_oclass *oclass, void *argv, u32 argc,
-                struct nvkm_object **pobject)
-{
-       struct r535_gr_chan *chan = container_of(oclass->parent, typeof(*chan), object);
-       struct r535_gr_obj *obj;
-
-       if (!(obj = kzalloc(sizeof(*obj), GFP_KERNEL)))
-               return -ENOMEM;
-
-       nvkm_object_ctor(&r535_gr_obj, oclass, &obj->object);
-       *pobject = &obj->object;
-
-       return nvkm_gsp_rm_alloc(&chan->chan->rm.object, oclass->handle, oclass->base.oclass, 0,
-                                &obj->rm);
-}
-
 static void *
 r535_gr_chan_dtor(struct nvkm_object *object)
 {
@@ -203,7 +138,7 @@ r535_gr_promote_ctx(struct r535_gr *gr, bool golden, struct nvkm_vmm *vmm,
        return nvkm_gsp_rm_ctrl_wr(&vmm->rm.device.subdevice, ctrl);
 }
 
-static int
+int
 r535_gr_chan_new(struct nvkm_gr *base, struct nvkm_chan *chan, const struct nvkm_oclass *oclass,
                 struct nvkm_object **pobject)
 {
@@ -227,7 +162,7 @@ r535_gr_chan_new(struct nvkm_gr *base, struct nvkm_chan *chan, const struct nvkm
        return 0;
 }
 
-static u64
+u64
 r535_gr_units(struct nvkm_gr *gr)
 {
        struct nvkm_gsp *gsp = gr->engine.subdev.device->gsp;
@@ -235,7 +170,7 @@ r535_gr_units(struct nvkm_gr *gr)
        return (gsp->gr.tpcs << 8) | gsp->gr.gpcs;
 }
 
-static int
+int
 r535_gr_oneinit(struct nvkm_gr *base)
 {
        NV2080_CTRL_INTERNAL_STATIC_GR_GET_CONTEXT_BUFFERS_INFO_PARAMS *info;
@@ -243,6 +178,7 @@ r535_gr_oneinit(struct nvkm_gr *base)
        struct nvkm_subdev *subdev = &gr->base.engine.subdev;
        struct nvkm_device *device = subdev->device;
        struct nvkm_gsp *gsp = device->gsp;
+       struct nvkm_rm *rm = gsp->rm;
        struct nvkm_mmu *mmu = device->mmu;
        struct {
                struct nvkm_memory *inst;
@@ -250,6 +186,7 @@ r535_gr_oneinit(struct nvkm_gr *base)
                struct nvkm_gsp_object chan;
                struct nvkm_vma *vma[R515_GR_MAX_CTXBUFS];
        } golden = {};
+       struct nvkm_gsp_object threed;
        int ret;
 
        /* Allocate a channel to use for golden context init. */
@@ -421,30 +358,12 @@ r535_gr_oneinit(struct nvkm_gr *base)
                goto done;
 
        /* Allocate 3D class on channel to trigger golden context init in RM. */
-       {
-               int i;
-
-               for (i = 0; gr->base.func->sclass[i].ctor; i++) {
-                       if ((gr->base.func->sclass[i].oclass & 0xff) == 0x97) {
-                               struct nvkm_gsp_object threed;
-
-                               ret = nvkm_gsp_rm_alloc(&golden.chan, 0x97000000,
-                                                       gr->base.func->sclass[i].oclass, 0,
-                                                       &threed);
-                               if (ret)
-                                       goto done;
-
-                               nvkm_gsp_rm_free(&threed);
-                               break;
-                       }
-               }
-
-               if (WARN_ON(!gr->base.func->sclass[i].ctor)) {
-                       ret = -EINVAL;
-                       goto done;
-               }
-       }
+       ret = nvkm_gsp_rm_alloc(&golden.chan, 0x97000000, rm->gpu->gr.class.threed, 0, &threed);
+       if (ret)
+               goto done;
 
+       /* There's no need to keep the golden channel around, as RM caches the context. */
+       nvkm_gsp_rm_free(&threed);
 done:
        nvkm_gsp_rm_free(&golden.chan);
        for (int i = gr->ctxbuf_nr - 1; i >= 0; i--)
@@ -455,7 +374,7 @@ done:
 
 }
 
-static void *
+void *
 r535_gr_dtor(struct nvkm_gr *base)
 {
        struct r535_gr *gr = r535_gr(base);
@@ -466,38 +385,3 @@ r535_gr_dtor(struct nvkm_gr *base)
        kfree(gr->base.func);
        return gr;
 }
-
-int
-r535_gr_new(const struct gf100_gr_func *hw,
-           struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_gr **pgr)
-{
-       struct nvkm_gr_func *rm;
-       struct r535_gr *gr;
-       int nclass;
-
-       for (nclass = 0; hw->sclass[nclass].oclass; nclass++);
-
-       if (!(rm = kzalloc(sizeof(*rm) + (nclass + 1) * sizeof(rm->sclass[0]), GFP_KERNEL)))
-               return -ENOMEM;
-
-       rm->dtor = r535_gr_dtor;
-       rm->oneinit = r535_gr_oneinit;
-       rm->units = r535_gr_units;
-       rm->chan_new = r535_gr_chan_new;
-
-       for (int i = 0; i < nclass; i++) {
-               rm->sclass[i].minver = hw->sclass[i].minver;
-               rm->sclass[i].maxver = hw->sclass[i].maxver;
-               rm->sclass[i].oclass = hw->sclass[i].oclass;
-               rm->sclass[i].ctor = r535_gr_obj_ctor;
-       }
-
-       if (!(gr = kzalloc(sizeof(*gr), GFP_KERNEL))) {
-               kfree(rm);
-               return -ENOMEM;
-       }
-
-       *pgr = &gr->base;
-
-       return nvkm_gr_ctor(rm, device, type, inst, true, &gr->base);
-}
index 05d0916d199ee10694cd852abaca52c8f50efde9..a8c42ec0367be5d6bd099224b5e08d27c822e030 100644 (file)
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  * OTHER DEALINGS IN THE SOFTWARE.
  */
-#include <engine/nvdec/priv.h>
-
-#include <core/object.h>
-#include <subdev/gsp.h>
-#include <engine/fifo.h>
+#include <rm/engine.h>
 
 #include "nvrm/nvdec.h"
 
-struct r535_nvdec_obj {
-       struct nvkm_object object;
-       struct nvkm_gsp_object rm;
-};
-
-static void *
-r535_nvdec_obj_dtor(struct nvkm_object *object)
-{
-       struct r535_nvdec_obj *obj = container_of(object, typeof(*obj), object);
-
-       nvkm_gsp_rm_free(&obj->rm);
-       return obj;
-}
-
-static const struct nvkm_object_func
-r535_nvdec_obj = {
-       .dtor = r535_nvdec_obj_dtor,
-};
-
 static int
-r535_nvdec_obj_ctor(const struct nvkm_oclass *oclass, void *argv, u32 argc,
-                struct nvkm_object **pobject)
+r535_nvdec_alloc(struct nvkm_gsp_object *chan, u32 handle, u32 class, int inst,
+                struct nvkm_gsp_object *nvdec)
 {
-       struct nvkm_chan *chan = nvkm_uchan_chan(oclass->parent);
-       struct r535_nvdec_obj *obj;
        NV_BSP_ALLOCATION_PARAMETERS *args;
 
-       if (!(obj = kzalloc(sizeof(*obj), GFP_KERNEL)))
-               return -ENOMEM;
-
-       nvkm_object_ctor(&r535_nvdec_obj, oclass, &obj->object);
-       *pobject = &obj->object;
-
-       args = nvkm_gsp_rm_alloc_get(&chan->rm.object, oclass->handle, oclass->base.oclass,
-                                    sizeof(*args), &obj->rm);
+       args = nvkm_gsp_rm_alloc_get(chan, handle, class, sizeof(*args), nvdec);
        if (WARN_ON(IS_ERR(args)))
                return PTR_ERR(args);
 
        args->size = sizeof(*args);
-       args->engineInstance = oclass->engine->subdev.inst;
+       args->engineInstance = inst;
 
-       return nvkm_gsp_rm_alloc_wr(&obj->rm, args);
+       return nvkm_gsp_rm_alloc_wr(nvdec, args);
 }
 
-static void *
-r535_nvdec_dtor(struct nvkm_engine *engine)
-{
-       struct nvkm_nvdec *nvdec = nvkm_nvdec(engine);
-
-       kfree(nvdec->engine.func);
-       return nvdec;
-}
-
-int
-r535_nvdec_new(const struct nvkm_engine_func *hw, struct nvkm_device *device,
-              enum nvkm_subdev_type type, int inst, struct nvkm_nvdec **pnvdec)
-{
-       struct nvkm_engine_func *rm;
-       int nclass;
-
-       for (nclass = 0; hw->sclass[nclass].oclass; nclass++);
-
-       if (!(rm = kzalloc(sizeof(*rm) + (nclass + 1) * sizeof(rm->sclass[0]), GFP_KERNEL)))
-               return -ENOMEM;
-
-       rm->dtor = r535_nvdec_dtor;
-       for (int i = 0; i < nclass; i++) {
-               rm->sclass[i].minver = hw->sclass[i].minver;
-               rm->sclass[i].maxver = hw->sclass[i].maxver;
-               rm->sclass[i].oclass = hw->sclass[i].oclass;
-               rm->sclass[i].ctor = r535_nvdec_obj_ctor;
-       }
-
-       if (!(*pnvdec = kzalloc(sizeof(**pnvdec), GFP_KERNEL))) {
-               kfree(rm);
-               return -ENOMEM;
-       }
-
-       return nvkm_engine_ctor(rm, device, type, inst, true, &(*pnvdec)->engine);
-}
+const struct nvkm_rm_api_engine
+r535_nvdec = {
+       .alloc = r535_nvdec_alloc,
+};
index dcf80d1f1e9e60ab4d6b51a56e6e3a05b7aa41bc..acb3ce8bb9de2961b23e0238f47487d4892efc6a 100644 (file)
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  * OTHER DEALINGS IN THE SOFTWARE.
  */
-#include <engine/nvenc/priv.h>
-
-#include <core/object.h>
-#include <subdev/gsp.h>
-#include <engine/fifo.h>
+#include <rm/engine.h>
 
 #include "nvrm/nvenc.h"
 
-struct r535_nvenc_obj {
-       struct nvkm_object object;
-       struct nvkm_gsp_object rm;
-};
-
-static void *
-r535_nvenc_obj_dtor(struct nvkm_object *object)
-{
-       struct r535_nvenc_obj *obj = container_of(object, typeof(*obj), object);
-
-       nvkm_gsp_rm_free(&obj->rm);
-       return obj;
-}
-
-static const struct nvkm_object_func
-r535_nvenc_obj = {
-       .dtor = r535_nvenc_obj_dtor,
-};
-
 static int
-r535_nvenc_obj_ctor(const struct nvkm_oclass *oclass, void *argv, u32 argc,
-                struct nvkm_object **pobject)
+r535_nvenc_alloc(struct nvkm_gsp_object *chan, u32 handle, u32 class, int inst,
+                struct nvkm_gsp_object *nvenc)
 {
-       struct nvkm_chan *chan = nvkm_uchan_chan(oclass->parent);
-       struct r535_nvenc_obj *obj;
        NV_MSENC_ALLOCATION_PARAMETERS *args;
 
-       if (!(obj = kzalloc(sizeof(*obj), GFP_KERNEL)))
-               return -ENOMEM;
-
-       nvkm_object_ctor(&r535_nvenc_obj, oclass, &obj->object);
-       *pobject = &obj->object;
-
-       args = nvkm_gsp_rm_alloc_get(&chan->rm.object, oclass->handle, oclass->base.oclass,
-                                    sizeof(*args), &obj->rm);
+       args = nvkm_gsp_rm_alloc_get(chan, handle, class, sizeof(*args), nvenc);
        if (WARN_ON(IS_ERR(args)))
                return PTR_ERR(args);
 
        args->size = sizeof(*args);
-       args->engineInstance = oclass->engine->subdev.inst;
+       args->engineInstance = inst;
 
-       return nvkm_gsp_rm_alloc_wr(&obj->rm, args);
+       return nvkm_gsp_rm_alloc_wr(nvenc, args);
 }
 
-static void *
-r535_nvenc_dtor(struct nvkm_engine *engine)
-{
-       struct nvkm_nvenc *nvenc = nvkm_nvenc(engine);
-
-       kfree(nvenc->engine.func);
-       return nvenc;
-}
-
-int
-r535_nvenc_new(const struct nvkm_engine_func *hw, struct nvkm_device *device,
-              enum nvkm_subdev_type type, int inst, struct nvkm_nvenc **pnvenc)
-{
-       struct nvkm_engine_func *rm;
-       int nclass;
-
-       for (nclass = 0; hw->sclass[nclass].oclass; nclass++);
-
-       if (!(rm = kzalloc(sizeof(*rm) + (nclass + 1) * sizeof(rm->sclass[0]), GFP_KERNEL)))
-               return -ENOMEM;
-
-       rm->dtor = r535_nvenc_dtor;
-       for (int i = 0; i < nclass; i++) {
-               rm->sclass[i].minver = hw->sclass[i].minver;
-               rm->sclass[i].maxver = hw->sclass[i].maxver;
-               rm->sclass[i].oclass = hw->sclass[i].oclass;
-               rm->sclass[i].ctor = r535_nvenc_obj_ctor;
-       }
-
-       if (!(*pnvenc = kzalloc(sizeof(**pnvenc), GFP_KERNEL))) {
-               kfree(rm);
-               return -ENOMEM;
-       }
-
-       return nvkm_engine_ctor(rm, device, type, inst, true, &(*pnvenc)->engine);
-}
+const struct nvkm_rm_api_engine
+r535_nvenc = {
+       .alloc = r535_nvenc_alloc,
+};
index 8a8d7becba930a66ff79e02cf04627606fe7cca5..fbc4080ad8d824927e6684211207cfbb3148b733 100644 (file)
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  * OTHER DEALINGS IN THE SOFTWARE.
  */
-#include <engine/nvjpg/priv.h>
-
-#include <core/object.h>
-#include <subdev/gsp.h>
-#include <engine/fifo.h>
+#include <rm/engine.h>
 
 #include "nvrm/nvjpg.h"
 
-struct r535_nvjpg_obj {
-       struct nvkm_object object;
-       struct nvkm_gsp_object rm;
-};
-
-static void *
-r535_nvjpg_obj_dtor(struct nvkm_object *object)
-{
-       struct r535_nvjpg_obj *obj = container_of(object, typeof(*obj), object);
-
-       nvkm_gsp_rm_free(&obj->rm);
-       return obj;
-}
-
-static const struct nvkm_object_func
-r535_nvjpg_obj = {
-       .dtor = r535_nvjpg_obj_dtor,
-};
-
 static int
-r535_nvjpg_obj_ctor(const struct nvkm_oclass *oclass, void *argv, u32 argc,
-                   struct nvkm_object **pobject)
+r535_nvjpg_alloc(struct nvkm_gsp_object *chan, u32 handle, u32 class, int inst,
+                struct nvkm_gsp_object *nvjpg)
 {
-       struct nvkm_chan *chan = nvkm_uchan_chan(oclass->parent);
-       struct r535_nvjpg_obj *obj;
        NV_NVJPG_ALLOCATION_PARAMETERS *args;
 
-       if (!(obj = kzalloc(sizeof(*obj), GFP_KERNEL)))
-               return -ENOMEM;
-
-       nvkm_object_ctor(&r535_nvjpg_obj, oclass, &obj->object);
-       *pobject = &obj->object;
-
-       args = nvkm_gsp_rm_alloc_get(&chan->rm.object, oclass->handle, oclass->base.oclass,
-                                    sizeof(*args), &obj->rm);
+       args = nvkm_gsp_rm_alloc_get(chan, handle, class, sizeof(*args), nvjpg);
        if (WARN_ON(IS_ERR(args)))
                return PTR_ERR(args);
 
        args->size = sizeof(*args);
-       args->engineInstance = oclass->engine->subdev.inst;
+       args->engineInstance = inst;
 
-       return nvkm_gsp_rm_alloc_wr(&obj->rm, args);
+       return nvkm_gsp_rm_alloc_wr(nvjpg, args);
 }
 
-static void *
-r535_nvjpg_dtor(struct nvkm_engine *engine)
-{
-       kfree(engine->func);
-       return engine;
-}
-
-int
-r535_nvjpg_new(const struct nvkm_engine_func *hw, struct nvkm_device *device,
-              enum nvkm_subdev_type type, int inst, struct nvkm_engine **pengine)
-{
-       struct nvkm_engine_func *rm;
-       int nclass, ret;
-
-       for (nclass = 0; hw->sclass[nclass].oclass; nclass++);
-
-       if (!(rm = kzalloc(sizeof(*rm) + (nclass + 1) * sizeof(rm->sclass[0]), GFP_KERNEL)))
-               return -ENOMEM;
-
-       rm->dtor = r535_nvjpg_dtor;
-       for (int i = 0; i < nclass; i++) {
-               rm->sclass[i].minver = hw->sclass[i].minver;
-               rm->sclass[i].maxver = hw->sclass[i].maxver;
-               rm->sclass[i].oclass = hw->sclass[i].oclass;
-               rm->sclass[i].ctor = r535_nvjpg_obj_ctor;
-       }
-
-       ret = nvkm_engine_new_(rm, device, type, inst, true, pengine);
-       if (ret)
-               kfree(rm);
-
-       return ret;
-}
+const struct nvkm_rm_api_engine
+r535_nvjpg = {
+       .alloc = r535_nvjpg_alloc,
+};
index 4bd84ff04702fa887128b486c535859f841077b9..2156808cba4f2f5c2fc1c03fd5b7e0a2327d2125 100644 (file)
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  * OTHER DEALINGS IN THE SOFTWARE.
  */
-#include <engine/ofa/priv.h>
-
-#include <core/object.h>
-#include <subdev/gsp.h>
-#include <subdev/mmu.h>
-#include <engine/fifo.h>
+#include <rm/engine.h>
 
 #include "nvrm/ofa.h"
 
-struct r535_ofa_obj {
-       struct nvkm_object object;
-       struct nvkm_gsp_object rm;
-};
-
-static void *
-r535_ofa_obj_dtor(struct nvkm_object *object)
-{
-       struct r535_ofa_obj *obj = container_of(object, typeof(*obj), object);
-
-       nvkm_gsp_rm_free(&obj->rm);
-       return obj;
-}
-
-static const struct nvkm_object_func
-r535_ofa_obj = {
-       .dtor = r535_ofa_obj_dtor,
-};
-
 static int
-r535_ofa_obj_ctor(const struct nvkm_oclass *oclass, void *argv, u32 argc,
-                struct nvkm_object **pobject)
+r535_ofa_alloc(struct nvkm_gsp_object *chan, u32 handle, u32 class, int inst,
+              struct nvkm_gsp_object *ofa)
 {
-       struct nvkm_chan *chan = nvkm_uchan_chan(oclass->parent);
-       struct r535_ofa_obj *obj;
        NV_OFA_ALLOCATION_PARAMETERS *args;
 
-       if (!(obj = kzalloc(sizeof(*obj), GFP_KERNEL)))
-               return -ENOMEM;
-
-       nvkm_object_ctor(&r535_ofa_obj, oclass, &obj->object);
-       *pobject = &obj->object;
-
-       args = nvkm_gsp_rm_alloc_get(&chan->rm.object, oclass->handle, oclass->base.oclass,
-                                    sizeof(*args), &obj->rm);
+       args = nvkm_gsp_rm_alloc_get(chan, handle, class, sizeof(*args), ofa);
        if (WARN_ON(IS_ERR(args)))
                return PTR_ERR(args);
 
        args->size = sizeof(*args);
 
-       return nvkm_gsp_rm_alloc_wr(&obj->rm, args);
+       return nvkm_gsp_rm_alloc_wr(ofa, args);
 }
 
-static void *
-r535_ofa_dtor(struct nvkm_engine *engine)
-{
-       kfree(engine->func);
-       return engine;
-}
-
-int
-r535_ofa_new(const struct nvkm_engine_func *hw, struct nvkm_device *device,
-            enum nvkm_subdev_type type, int inst, struct nvkm_engine **pengine)
-{
-       struct nvkm_engine_func *rm;
-       int nclass, ret;
-
-       for (nclass = 0; hw->sclass[nclass].oclass; nclass++);
-
-       if (!(rm = kzalloc(sizeof(*rm) + (nclass + 1) * sizeof(rm->sclass[0]), GFP_KERNEL)))
-               return -ENOMEM;
-
-       rm->dtor = r535_ofa_dtor;
-       for (int i = 0; i < nclass; i++) {
-               rm->sclass[i].minver = hw->sclass[i].minver;
-               rm->sclass[i].maxver = hw->sclass[i].maxver;
-               rm->sclass[i].oclass = hw->sclass[i].oclass;
-               rm->sclass[i].ctor = r535_ofa_obj_ctor;
-       }
-
-       ret = nvkm_engine_new_(rm, device, type, inst, true, pengine);
-       if (ret)
-               kfree(rm);
-
-       return ret;
-}
+const struct nvkm_rm_api_engine
+r535_ofa = {
+       .alloc = r535_ofa_alloc,
+};
index 3c17b75b5e3778310a368186d48083e83b2666ee..6de7d1a91119fb5f77405b157f21b7587f8030d5 100644 (file)
@@ -11,6 +11,11 @@ r535_api = {
        .alloc = &r535_alloc,
        .client = &r535_client,
        .device = &r535_device,
+       .ce = &r535_ce,
+       .nvdec = &r535_nvdec,
+       .nvenc = &r535_nvenc,
+       .nvjpg = &r535_nvjpg,
+       .ofa = &r535_ofa,
 };
 
 const struct nvkm_rm_impl
index 41d4ed70fc10893e8778e3b57d472f2bc4a6de56..bda22703690adb2ee140ed3cce774c844609702f 100644 (file)
@@ -53,6 +53,11 @@ struct nvkm_rm_api {
                        void (*dtor)(struct nvkm_gsp_event *);
                } event;
        } *device;
+
+       const struct nvkm_rm_api_engine {
+               int (*alloc)(struct nvkm_gsp_object *chan, u32 handle, u32 class, int inst,
+                            struct nvkm_gsp_object *);
+       } *ce, *nvdec, *nvenc, *nvjpg, *ofa;
 };
 
 extern const struct nvkm_rm_impl r535_rm_tu102;
@@ -62,4 +67,14 @@ extern const struct nvkm_rm_api_ctrl r535_ctrl;
 extern const struct nvkm_rm_api_alloc r535_alloc;
 extern const struct nvkm_rm_api_client r535_client;
 extern const struct nvkm_rm_api_device r535_device;
+extern const struct nvkm_rm_api_engine r535_ce;
+void *r535_gr_dtor(struct nvkm_gr *);
+int r535_gr_oneinit(struct nvkm_gr *);
+u64 r535_gr_units(struct nvkm_gr *);
+int r535_gr_chan_new(struct nvkm_gr *, struct nvkm_chan *, const struct nvkm_oclass *,
+                    struct nvkm_object **);
+extern const struct nvkm_rm_api_engine r535_nvdec;
+extern const struct nvkm_rm_api_engine r535_nvenc;
+extern const struct nvkm_rm_api_engine r535_nvjpg;
+extern const struct nvkm_rm_api_engine r535_ofa;
 #endif
index bb674b9cef696f513cb130d8ff00c5ddc6103e43..883b9eddbfe62a2fe843d60cea9da1721246616e 100644 (file)
@@ -22,4 +22,14 @@ tu1xx_gpu = {
        .fifo.chan = {
                .class = TURING_CHANNEL_GPFIFO_A,
        },
+
+       .ce.class = TURING_DMA_COPY_A,
+       .gr.class = {
+               .i2m = KEPLER_INLINE_TO_MEMORY_B,
+               .twod = FERMI_TWOD_A,
+               .threed = TURING_A,
+               .compute = TURING_COMPUTE_A,
+       },
+       .nvdec.class = NVC4B0_VIDEO_DECODER,
+       .nvenc.class = NVC4B7_VIDEO_ENCODER,
 };