OSDN Git Service

drm/nouveau/cipher: switch to instanced constructor
authorBen Skeggs <bskeggs@redhat.com>
Wed, 3 Feb 2021 22:34:38 +0000 (08:34 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 11 Feb 2021 01:49:56 +0000 (11:49 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
drivers/gpu/drm/nouveau/include/nvkm/core/device.h
drivers/gpu/drm/nouveau/include/nvkm/core/layout.h
drivers/gpu/drm/nouveau/include/nvkm/engine/cipher.h
drivers/gpu/drm/nouveau/nvkm/core/subdev.c
drivers/gpu/drm/nouveau/nvkm/engine/cipher/g84.c
drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/devinit/g84.c

index 902976f..bdf0515 100644 (file)
@@ -60,7 +60,6 @@ struct nvkm_device {
                struct notifier_block nb;
        } acpi;
 
-       struct nvkm_engine *cipher;
        struct nvkm_disp *disp;
        struct nvkm_dma *dma;
        struct nvkm_fifo *fifo;
@@ -120,7 +119,6 @@ struct nvkm_device_chip {
 #undef NVKM_LAYOUT_INST
 #undef NVKM_LAYOUT_ONCE
 
-       int (*cipher  )(struct nvkm_device *, int idx, struct nvkm_engine **);
        int (*disp    )(struct nvkm_device *, int idx, struct nvkm_disp **);
        int (*dma     )(struct nvkm_device *, int idx, struct nvkm_dma **);
        int (*fifo    )(struct nvkm_device *, int idx, struct nvkm_fifo **);
index 72ba4d5..5bc3854 100644 (file)
@@ -27,4 +27,5 @@ NVKM_LAYOUT_ONCE(NVKM_SUBDEV_GSP     , struct nvkm_gsp     ,      gsp)
 
 NVKM_LAYOUT_ONCE(NVKM_ENGINE_BSP     , struct nvkm_engine  ,      bsp)
 NVKM_LAYOUT_INST(NVKM_ENGINE_CE      , struct nvkm_engine  ,       ce, 9)
+NVKM_LAYOUT_ONCE(NVKM_ENGINE_CIPHER  , struct nvkm_engine  ,   cipher)
 NVKM_LAYOUT_ONCE(NVKM_ENGINE_VP      , struct nvkm_engine  ,       vp)
index 66c5c5e..9da9176 100644 (file)
@@ -2,5 +2,5 @@
 #ifndef __NVKM_CIPHER_H__
 #define __NVKM_CIPHER_H__
 #include <core/engine.h>
-int g84_cipher_new(struct nvkm_device *, int, struct nvkm_engine **);
+int g84_cipher_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_engine **);
 #endif
index c0129ac..e999023 100644 (file)
@@ -33,7 +33,6 @@ nvkm_subdev_type[NVKM_SUBDEV_NR] = {
 #include <core/layout.h>
 #undef NVKM_LAYOUT_ONCE
 #undef NVKM_LAYOUT_INST
-       [NVKM_ENGINE_CIPHER  ] = "cipher",
        [NVKM_ENGINE_DISP    ] = "disp",
        [NVKM_ENGINE_DMAOBJ  ] = "dma",
        [NVKM_ENGINE_FIFO    ] = "fifo",
index 68ffb52..be2a718 100644 (file)
@@ -127,8 +127,8 @@ g84_cipher = {
 };
 
 int
-g84_cipher_new(struct nvkm_device *device, int index,
+g84_cipher_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
               struct nvkm_engine **pengine)
 {
-       return nvkm_engine_new_(&g84_cipher, device, index, true, pengine);
+       return nvkm_engine_new_(&g84_cipher, device, type, inst, true, pengine);
 }
index 14636df..159d048 100644 (file)
@@ -935,7 +935,7 @@ nv84_chipset = {
        .timer    = { 0x00000001, nv41_timer_new },
        .volt     = { 0x00000001, nv40_volt_new },
        .bsp      = { 0x00000001, g84_bsp_new },
-       .cipher = g84_cipher_new,
+       .cipher   = { 0x00000001, g84_cipher_new },
        .disp = g84_disp_new,
        .dma = nv50_dma_new,
        .fifo = g84_fifo_new,
@@ -967,7 +967,7 @@ nv86_chipset = {
        .timer    = { 0x00000001, nv41_timer_new },
        .volt     = { 0x00000001, nv40_volt_new },
        .bsp      = { 0x00000001, g84_bsp_new },
-       .cipher = g84_cipher_new,
+       .cipher   = { 0x00000001, g84_cipher_new },
        .disp = g84_disp_new,
        .dma = nv50_dma_new,
        .fifo = g84_fifo_new,
@@ -999,7 +999,7 @@ nv92_chipset = {
        .timer    = { 0x00000001, nv41_timer_new },
        .volt     = { 0x00000001, nv40_volt_new },
        .bsp      = { 0x00000001, g84_bsp_new },
-       .cipher = g84_cipher_new,
+       .cipher   = { 0x00000001, g84_cipher_new },
        .disp = g84_disp_new,
        .dma = nv50_dma_new,
        .fifo = g84_fifo_new,
@@ -1031,7 +1031,7 @@ nv94_chipset = {
        .timer    = { 0x00000001, nv41_timer_new },
        .volt     = { 0x00000001, nv40_volt_new },
        .bsp      = { 0x00000001, g84_bsp_new },
-       .cipher = g84_cipher_new,
+       .cipher   = { 0x00000001, g84_cipher_new },
        .disp = g94_disp_new,
        .dma = nv50_dma_new,
        .fifo = g84_fifo_new,
@@ -1063,7 +1063,7 @@ nv96_chipset = {
        .timer    = { 0x00000001, nv41_timer_new },
        .volt     = { 0x00000001, nv40_volt_new },
        .bsp      = { 0x00000001, g84_bsp_new },
-       .cipher = g84_cipher_new,
+       .cipher   = { 0x00000001, g84_cipher_new },
        .disp = g94_disp_new,
        .dma = nv50_dma_new,
        .fifo = g84_fifo_new,
@@ -1127,7 +1127,7 @@ nva0_chipset = {
        .timer    = { 0x00000001, nv41_timer_new },
        .volt     = { 0x00000001, nv40_volt_new },
        .bsp      = { 0x00000001, g84_bsp_new },
-       .cipher = g84_cipher_new,
+       .cipher   = { 0x00000001, g84_cipher_new },
        .disp = gt200_disp_new,
        .dma = nv50_dma_new,
        .fifo = g84_fifo_new,
@@ -3174,7 +3174,6 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
 #include <core/layout.h>
 #undef NVKM_LAYOUT_INST
 #undef NVKM_LAYOUT_ONCE
-               _(NVKM_ENGINE_CIPHER  ,   cipher);
                _(NVKM_ENGINE_DISP    ,     disp);
                _(NVKM_ENGINE_DMAOBJ  ,      dma);
                _(NVKM_ENGINE_FIFO    ,     fifo);
index cd4a5b3..a04c3bf 100644 (file)
@@ -38,7 +38,7 @@ g84_devinit_disable(struct nvkm_devinit *init)
                disable |= (1ULL << NVKM_ENGINE_MPEG);
                nvkm_subdev_disable(device, NVKM_ENGINE_VP, 0);
                nvkm_subdev_disable(device, NVKM_ENGINE_BSP, 0);
-               disable |= (1ULL << NVKM_ENGINE_CIPHER);
+               nvkm_subdev_disable(device, NVKM_ENGINE_CIPHER, 0);
        }
 
        if (!(r00154c & 0x00000004))
@@ -46,7 +46,7 @@ g84_devinit_disable(struct nvkm_devinit *init)
        if (!(r00154c & 0x00000020))
                nvkm_subdev_disable(device, NVKM_ENGINE_BSP, 0);
        if (!(r00154c & 0x00000040))
-               disable |= (1ULL << NVKM_ENGINE_CIPHER);
+               nvkm_subdev_disable(device, NVKM_ENGINE_CIPHER, 0);
 
        return disable;
 }