drm/nouveau/core: pass subdev into nvkm_firmware_get, rather than device
authorBen Skeggs <bskeggs@redhat.com>
Thu, 6 Jun 2019 07:08:12 +0000 (17:08 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 7 Jun 2019 05:13:58 +0000 (15:13 +1000)
It'd be nice to have FW loading debug messages to appear for the relevant
subsystem, when enabled.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/include/nvkm/core/firmware.h
drivers/gpu/drm/nouveau/nvkm/core/firmware.c
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr.c
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/ls_ucode_gr.c
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/ls_ucode_msgqueue.c

index ff0fa38aee72c03b07e60c24bf9167eea7efda8b..d0fe98bd50fd0f191eba1bc21743f08431c77e25 100644 (file)
@@ -1,12 +1,9 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #ifndef __NVKM_FIRMWARE_H__
 #define __NVKM_FIRMWARE_H__
+#include <core/subdev.h>
 
-#include <core/device.h>
-
-int nvkm_firmware_get(struct nvkm_device *device, const char *fwname,
+int nvkm_firmware_get(const struct nvkm_subdev *, const char *fwname,
                      const struct firmware **fw);
-
 void nvkm_firmware_put(const struct firmware *fw);
-
 #endif
index 058ff46b5f16676ee56ab9323252109724a31595..87728133ff937454cd2c964966c0ae23c90e24a9 100644 (file)
@@ -24,7 +24,7 @@
 
 /**
  * nvkm_firmware_get - load firmware from the official nvidia/chip/ directory
- * @device     device that will use that firmware
+ * @subdev     subdevice that will use that firmware
  * @fwname     name of firmware file to load
  * @fw         firmware structure to load to
  *
  * Firmware files released by NVIDIA will always follow this format.
  */
 int
-nvkm_firmware_get(struct nvkm_device *device, const char *fwname,
+nvkm_firmware_get(const struct nvkm_subdev *subdev, const char *fwname,
                  const struct firmware **fw)
 {
+       struct nvkm_device *device = subdev->device;
        char f[64];
        char cname[16];
        int i;
index 81a13cf9a292fef896270d56e9d0eddcce127462..c578deb5867a8d0cd2495a5f9bf55d6330bfe86a 100644 (file)
@@ -2115,12 +2115,10 @@ int
 gf100_gr_ctor_fw(struct gf100_gr *gr, const char *fwname,
                 struct gf100_gr_fuc *fuc)
 {
-       struct nvkm_subdev *subdev = &gr->base.engine.subdev;
-       struct nvkm_device *device = subdev->device;
        const struct firmware *fw;
        int ret;
 
-       ret = nvkm_firmware_get(device, fwname, &fw);
+       ret = nvkm_firmware_get(&gr->base.engine.subdev, fwname, &fw);
        if (ret) {
                ret = gf100_gr_ctor_fw_legacy(gr, fwname, fuc, ret);
                if (ret)
index 75dc06557877670ad5b2529d556584514bf5ada4..dc80985cf0933a647855f470848cbe80bbe0a246 100644 (file)
@@ -36,7 +36,7 @@ nvkm_acr_load_firmware(const struct nvkm_subdev *subdev, const char *name,
        void *blob;
        int ret;
 
-       ret = nvkm_firmware_get(subdev->device, name, &fw);
+       ret = nvkm_firmware_get(subdev, name, &fw);
        if (ret)
                return ERR_PTR(ret);
        if (fw->size < min_size) {
index 1b0c793c0192b940103701142e5561ffb1b5263a..0d71a9e40c3ea65f10df5d9a2cbe997cbf376259 100644 (file)
@@ -98,22 +98,22 @@ ls_ucode_img_load_gr(const struct nvkm_subdev *subdev, struct ls_ucode_img *img,
        int ret;
 
        snprintf(f, sizeof(f), "gr/%s_bl", falcon_name);
-       ret = nvkm_firmware_get(subdev->device, f, &bl);
+       ret = nvkm_firmware_get(subdev, f, &bl);
        if (ret)
                goto error;
 
        snprintf(f, sizeof(f), "gr/%s_inst", falcon_name);
-       ret = nvkm_firmware_get(subdev->device, f, &code);
+       ret = nvkm_firmware_get(subdev, f, &code);
        if (ret)
                goto free_bl;
 
        snprintf(f, sizeof(f), "gr/%s_data", falcon_name);
-       ret = nvkm_firmware_get(subdev->device, f, &data);
+       ret = nvkm_firmware_get(subdev, f, &data);
        if (ret)
                goto free_inst;
 
        snprintf(f, sizeof(f), "gr/%s_sig", falcon_name);
-       ret = nvkm_firmware_get(subdev->device, f, &sig);
+       ret = nvkm_firmware_get(subdev, f, &sig);
        if (ret)
                goto free_data;
 
index 1e1f1c635cabc468f1f44cb142c929805b427952..5b9874619e53aac30d4e78b86ddacc05ed62c7ab 100644 (file)
@@ -46,7 +46,7 @@ acr_ls_ucode_load_msgqueue(const struct nvkm_subdev *subdev, const char *name,
        int ret;
 
        snprintf(f, sizeof(f), "%s/image", name);
-       ret = nvkm_firmware_get(subdev->device, f, &image);
+       ret = nvkm_firmware_get(subdev, f, &image);
        if (ret)
                return ret;
        img->ucode_data = kmemdup(image->data, image->size, GFP_KERNEL);
@@ -55,7 +55,7 @@ acr_ls_ucode_load_msgqueue(const struct nvkm_subdev *subdev, const char *name,
                return -ENOMEM;
 
        snprintf(f, sizeof(f), "%s/desc", name);
-       ret = nvkm_firmware_get(subdev->device, f, &desc);
+       ret = nvkm_firmware_get(subdev, f, &desc);
        if (ret)
                return ret;
        memcpy(&img->ucode_desc, desc->data, sizeof(img->ucode_desc));
@@ -63,7 +63,7 @@ acr_ls_ucode_load_msgqueue(const struct nvkm_subdev *subdev, const char *name,
        nvkm_firmware_put(desc);
 
        snprintf(f, sizeof(f), "%s/sig", name);
-       ret = nvkm_firmware_get(subdev->device, f, &sig);
+       ret = nvkm_firmware_get(subdev, f, &sig);
        if (ret)
                return ret;
        img->sig_size = sig->size;