Commit c26f3061 authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/secboot: pass max supported FW version to LS load funcs



Will be passed to the FW loader function as an upper bound on the supported
FW version to attempt to load.

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 475cf02b
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -243,6 +243,7 @@ acr_r352_ls_ucode_img_load(const struct acr_r352 *acr,
			   enum nvkm_secboot_falcon falcon_id)
{
	const struct nvkm_subdev *subdev = acr->base.subdev;
	const struct acr_r352_ls_func *func = acr->func->ls_func[falcon_id];
	struct ls_ucode_img_r352 *img;
	int ret;

@@ -252,9 +253,8 @@ acr_r352_ls_ucode_img_load(const struct acr_r352 *acr,

	img->base.falcon_id = falcon_id;

	ret = acr->func->ls_func[falcon_id]->load(sb, &img->base);

	if (ret) {
	ret = func->load(sb, func->version_max, &img->base);
	if (ret < 0) {
		kfree(img->base.ucode_data);
		kfree(img->base.sig);
		kfree(img);
+3 −1
Original line number Diff line number Diff line
@@ -57,12 +57,14 @@ hsf_load_header_app_size(const struct hsf_load_header *hdr, u32 app)
 * @lhdr_flags: LS flags
 */
struct acr_r352_ls_func {
	int (*load)(const struct nvkm_secboot *, struct ls_ucode_img *);
	int (*load)(const struct nvkm_secboot *, int maxver,
		    struct ls_ucode_img *);
	void (*generate_bl_desc)(const struct nvkm_acr *,
				 const struct ls_ucode_img *, u64, void *);
	u32 bl_desc_size;
	int (*post_run)(const struct nvkm_acr *, const struct nvkm_secboot *);
	u32 lhdr_flags;
	int version_max;
};

struct acr_r352;
+3 −2
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ acr_r367_ls_ucode_img_load(const struct acr_r352 *acr,
			   enum nvkm_secboot_falcon falcon_id)
{
	const struct nvkm_subdev *subdev = acr->base.subdev;
	const struct acr_r352_ls_func *func = acr->func->ls_func[falcon_id];
	struct ls_ucode_img_r367 *img;
	int ret;

@@ -120,8 +121,8 @@ acr_r367_ls_ucode_img_load(const struct acr_r352 *acr,

	img->base.falcon_id = falcon_id;

	ret = acr->func->ls_func[falcon_id]->load(sb, &img->base);
	if (ret) {
	ret = func->load(sb, func->version_max, &img->base);
	if (ret < 0) {
		kfree(img->base.ucode_data);
		kfree(img->base.sig);
		kfree(img);
+8 −4
Original line number Diff line number Diff line
@@ -147,11 +147,15 @@ struct fw_bl_desc {
	u32 data_size;
};

int acr_ls_ucode_load_fecs(const struct nvkm_secboot *, struct ls_ucode_img *);
int acr_ls_ucode_load_gpccs(const struct nvkm_secboot *, struct ls_ucode_img *);
int acr_ls_ucode_load_pmu(const struct nvkm_secboot *, struct ls_ucode_img *);
int acr_ls_ucode_load_fecs(const struct nvkm_secboot *, int,
			   struct ls_ucode_img *);
int acr_ls_ucode_load_gpccs(const struct nvkm_secboot *, int,
			    struct ls_ucode_img *);
int acr_ls_ucode_load_pmu(const struct nvkm_secboot *, int,
			  struct ls_ucode_img *);
int acr_ls_pmu_post_run(const struct nvkm_acr *, const struct nvkm_secboot *);
int acr_ls_ucode_load_sec2(const struct nvkm_secboot *, struct ls_ucode_img *);
int acr_ls_ucode_load_sec2(const struct nvkm_secboot *, int,
			   struct ls_ucode_img *);
int acr_ls_sec2_post_run(const struct nvkm_acr *, const struct nvkm_secboot *);

#endif
+8 −6
Original line number Diff line number Diff line
@@ -90,8 +90,8 @@ ls_ucode_img_build(const struct firmware *bl, const struct firmware *code,
 * blob. Also generate the corresponding ucode descriptor.
 */
static int
ls_ucode_img_load_gr(const struct nvkm_subdev *subdev, struct ls_ucode_img *img,
		     const char *falcon_name)
ls_ucode_img_load_gr(const struct nvkm_subdev *subdev, int maxver,
		     struct ls_ucode_img *img, const char *falcon_name)
{
	const struct firmware *bl, *code, *data, *sig;
	char f[64];
@@ -146,13 +146,15 @@ error:
}

int
acr_ls_ucode_load_fecs(const struct nvkm_secboot *sb, struct ls_ucode_img *img)
acr_ls_ucode_load_fecs(const struct nvkm_secboot *sb, int maxver,
		       struct ls_ucode_img *img)
{
	return ls_ucode_img_load_gr(&sb->subdev, img, "fecs");
	return ls_ucode_img_load_gr(&sb->subdev, maxver, img, "fecs");
}

int
acr_ls_ucode_load_gpccs(const struct nvkm_secboot *sb, struct ls_ucode_img *img)
acr_ls_ucode_load_gpccs(const struct nvkm_secboot *sb, int maxver,
			struct ls_ucode_img *img)
{
	return ls_ucode_img_load_gr(&sb->subdev, img, "gpccs");
	return ls_ucode_img_load_gr(&sb->subdev, maxver, img, "gpccs");
}
Loading