From: Alexandre Courbot <acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: Ben Skeggs <bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH v3 15/15] secboot: safer zeroing of BL descriptors
Date: Wed, 2 Nov 2016 15:02:56 +0900 [thread overview]
Message-ID: <20161102060256.14341-16-acourbot@nvidia.com> (raw)
In-Reply-To: <20161102060256.14341-1-acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Perform the zeroing of BL descriptors in the caller function instead of
trusting each generator will do it. This could avoid a few pulled hairs.
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
---
drm/nouveau/nvkm/subdev/secboot/acr_r352.c | 4 ++--
drm/nouveau/nvkm/subdev/secboot/acr_r361.c | 2 --
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drm/nouveau/nvkm/subdev/secboot/acr_r352.c b/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
index 6d79fa27ef14..83de670a4362 100644
--- a/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
+++ b/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
@@ -104,7 +104,6 @@ acr_r352_generate_flcn_bl_desc(const struct nvkm_acr *acr,
addr_code = (base + pdesc->app_resident_code_offset) >> 8;
addr_data = (base + pdesc->app_resident_data_offset) >> 8;
- memset(desc, 0, sizeof(*desc));
desc->ctx_dma = FALCON_DMAIDX_UCODE;
desc->code_dma_base = lower_32_bits(addr_code);
desc->non_sec_code_off = pdesc->app_resident_code_offset;
@@ -354,6 +353,7 @@ acr_r352_ls_write_wpr(struct acr_r352 *acr, struct list_head *imgs,
&img->lsb_header, sizeof(img->lsb_header));
/* Generate and write BL descriptor */
+ memset(gdesc, 0, ls_func->bl_desc_size);
ls_func->generate_bl_desc(&acr->base, _img, wpr_addr, gdesc);
nvkm_gpuobj_memcpy_to(wpr_blob, img->lsb_header.bl_data_off,
@@ -515,7 +515,6 @@ acr_r352_generate_hs_bl_desc(const struct hsf_load_header *hdr, void *_bl_desc,
struct acr_r352_flcn_bl_desc *bl_desc = _bl_desc;
u64 addr_code, addr_data;
- memset(bl_desc, 0, sizeof(*bl_desc));
addr_code = offset >> 8;
addr_data = (offset + hdr->data_dma_base) >> 8;
@@ -719,6 +718,7 @@ acr_r352_load(struct nvkm_acr *_acr, struct nvkm_secboot *sb,
code_size, hsbl_desc->start_tag);
/* Generate the BL header */
+ memset(bl_desc, 0, bl_desc_size);
acr->func->generate_hs_bl_desc(load_hdr, bl_desc, offset);
/*
diff --git a/drm/nouveau/nvkm/subdev/secboot/acr_r361.c b/drm/nouveau/nvkm/subdev/secboot/acr_r361.c
index df0a8f2a70ee..a758e8d45176 100644
--- a/drm/nouveau/nvkm/subdev/secboot/acr_r361.c
+++ b/drm/nouveau/nvkm/subdev/secboot/acr_r361.c
@@ -73,7 +73,6 @@ acr_r361_generate_flcn_bl_desc(const struct nvkm_acr *acr,
addr_code = base + pdesc->app_resident_code_offset;
addr_data = base + pdesc->app_resident_data_offset;
- memset(desc, 0, sizeof(*desc));
desc->ctx_dma = FALCON_DMAIDX_UCODE;
desc->code_dma_base = u64_to_flcn64(addr_code);
desc->non_sec_code_off = pdesc->app_resident_code_offset;
@@ -89,7 +88,6 @@ acr_r361_generate_hs_bl_desc(const struct hsf_load_header *hdr, void *_bl_desc,
{
struct acr_r361_flcn_bl_desc *bl_desc = _bl_desc;
- memset(bl_desc, 0, sizeof(*bl_desc));
bl_desc->ctx_dma = FALCON_DMAIDX_VIRT;
bl_desc->code_dma_base = u64_to_flcn64(offset);
bl_desc->non_sec_code_off = hdr->non_sec_code_off;
--
2.10.0
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
prev parent reply other threads:[~2016-11-02 6:02 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-02 6:02 [PATCH v3 00/15] Secure Boot refactoring Alexandre Courbot
[not found] ` <20161102060256.14341-1-acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-11-02 6:02 ` [PATCH v3 01/15] core: constify nv*_printk macros Alexandre Courbot
2016-11-02 6:02 ` [PATCH v3 02/15] core: add falcon library Alexandre Courbot
2016-11-02 6:02 ` [PATCH v3 03/15] secboot: use falcon library's IMEM/DMEM loading functions Alexandre Courbot
2016-11-02 6:02 ` [PATCH v3 04/15] secboot: rename init() hook to oneinit() Alexandre Courbot
2016-11-02 6:02 ` [PATCH v3 05/15] secboot: remove fixup_hs_desc hook Alexandre Courbot
2016-11-02 6:02 ` [PATCH v3 06/15] secboot: add low-secure firmware hooks Alexandre Courbot
2016-11-02 6:02 ` [PATCH v3 07/15] secboot: generate HS BL descriptor in hook Alexandre Courbot
2016-11-02 6:02 ` [PATCH v3 08/15] secboot: reorganize into more files Alexandre Courbot
2016-11-02 6:02 ` [PATCH v3 09/15] secboot: add LS flags to LS func structure Alexandre Courbot
2016-11-02 6:02 ` [PATCH v3 10/15] secboot: split reset function Alexandre Courbot
2016-11-02 6:02 ` [PATCH v3 11/15] secboot: disable falcon interrupts before running Alexandre Courbot
2016-11-02 6:02 ` [PATCH v3 12/15] secboot: remove unneeded ls_ucode_img member Alexandre Courbot
2016-11-02 6:02 ` [PATCH v3 13/15] secboot: remove ls_ucode_mgr Alexandre Courbot
2016-11-02 6:02 ` [PATCH v3 14/15] secboot: abstract LS firmware loading functions Alexandre Courbot
2016-11-02 6:02 ` Alexandre Courbot [this message]
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=20161102060256.14341-16-acourbot@nvidia.com \
--to=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.