From: Peter Wu <peter-VTkQYDcBqhK7DlmcbJSQ7g@public.gmane.org>
To: Alexandre Courbot <acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
Ben Skeggs <bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH v2] gr: fallback to legacy paths during firmware lookup
Date: Sat, 5 Nov 2016 16:12:49 +0100 [thread overview]
Message-ID: <20161105151249.GA19457@al> (raw)
In-Reply-To: <20161104093617.11370-1-acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
On Fri, Nov 04, 2016 at 06:36:17PM +0900, Alexandre Courbot wrote:
> Look for firmware files using the legacy ("nouveau/nvxx_fucxxxx") path
> if they cannot be found in the new, "official" path. User setups were
> broken by the switch, which is bad.
>
> There are only 4 firmware files we may want to look up that way, so
> hardcode them into the lookup function. All new firmware files should
> use the standard "nvidia/<chip>/gr/" path.
>
> Fixes: 8539b37acef7 ("drm/nouveau/gr: use NVIDIA-provided external firmwares")
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> ---
> Changes since v1:
> * Moved file name translation into the legacy function
>
> drm/nouveau/nvkm/engine/gr/gf100.c | 53 +++++++++++++++++++++++++++++++++++---
> 1 file changed, 49 insertions(+), 4 deletions(-)
>
> diff --git a/drm/nouveau/nvkm/engine/gr/gf100.c b/drm/nouveau/nvkm/engine/gr/gf100.c
> index eccdee04107d..ed45f923442f 100644
> --- a/drm/nouveau/nvkm/engine/gr/gf100.c
> +++ b/drm/nouveau/nvkm/engine/gr/gf100.c
> @@ -1756,6 +1756,53 @@ gf100_gr_ = {
> };
>
> int
> +gf100_gr_ctor_fw_legacy(struct gf100_gr *gr, const char *fwname,
> + struct gf100_gr_fuc *fuc, int ret)
> +{
> + struct nvkm_subdev *subdev = &gr->base.engine.subdev;
> + struct nvkm_device *device = subdev->device;
> + const struct firmware *fw;
> + char f[32];
> +
> + /* see if this firmware has a legacy path */
> + if (!strcmp(fwname, "fecs_inst"))
> + fwname = "fuc409c";
> + else if (!strcmp(fwname, "fecs_data"))
> + fwname = "fuc409d";
> + else if (!strcmp(fwname, "gpccs_inst"))
> + fwname = "fuc41ac";
> + else if (!strcmp(fwname, "gpccs_data"))
> + fwname = "fuc41ad";
> + else
> + fwname = NULL;
> +
> + /* nope, let's just return the error we got */
> + if (!fwname) {
> + nvkm_error(subdev, "failed to load %s\n", fwname);
Due to the rename from legacy_fwname -> fwname, this can be NULL.
What about replacing the else branch above by this block?
Kind regards,
Peter
> + return ret;
> + }
> +
> + /* yes, try to load from the legacy path */
> + nvkm_debug(subdev, "%s: falling back to legacy path\n", fwname);
> +
> + snprintf(f, sizeof(f), "nouveau/nv%02x_%s", device->chipset, fwname);
> + ret = request_firmware(&fw, f, device->dev);
> + if (ret) {
> + snprintf(f, sizeof(f), "nouveau/%s", fwname);
> + ret = request_firmware(&fw, f, device->dev);
> + if (ret) {
> + nvkm_error(subdev, "failed to load %s\n", fwname);
> + return ret;
> + }
> + }
> +
> + fuc->size = fw->size;
> + fuc->data = kmemdup(fw->data, fuc->size, GFP_KERNEL);
> + release_firmware(fw);
> + return (fuc->data != NULL) ? 0 : -ENOMEM;
> +}
> +
> +int
> gf100_gr_ctor_fw(struct gf100_gr *gr, const char *fwname,
> struct gf100_gr_fuc *fuc)
> {
> @@ -1765,10 +1812,8 @@ gf100_gr_ctor_fw(struct gf100_gr *gr, const char *fwname,
> int ret;
>
> ret = nvkm_firmware_get(device, fwname, &fw);
> - if (ret) {
> - nvkm_error(subdev, "failed to load %s\n", fwname);
> - return ret;
> - }
> + if (ret)
> + return gf100_gr_ctor_fw_legacy(gr, fwname, fuc, ret);
>
> fuc->size = fw->size;
> fuc->data = kmemdup(fw->data, fuc->size, GFP_KERNEL);
> --
> 2.10.0
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
next prev parent reply other threads:[~2016-11-05 15:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-04 9:36 [PATCH v2] gr: fallback to legacy paths during firmware lookup Alexandre Courbot
[not found] ` <20161104093617.11370-1-acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-11-05 15:12 ` Peter Wu [this message]
2016-11-06 9:02 ` Alexandre Courbot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161105151249.GA19457@al \
--to=peter-vtkqydcbqhk7dlmcbjsq7g@public.gmane.org \
--cc=acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.