From: Michal Simek <michal.simek@xilinx.com>
To: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>,
<u-boot@lists.denx.de>
Cc: <oleksandr.suvorov@foundries.io>, <ricardo@foundries.io>,
<michal.simek@xilinx.com>, <igor.opaniuk@foundries.io>,
<jorge@foundries.io>, <mr.nuke.me@gmail.com>,
<bmeng.cn@gmail.com>, <hs@denx.de>, <jagan@amarulasolutions.com>,
<klaus@linux.vnet.ibm.com>, <seanga2@gmail.com>,
<sjg@chromium.org>, <jaeckel-floss@eyet-services.de>
Subject: Re: [PATCH v7 6/7] fpga: zynqmp: support loading authenticated images
Date: Tue, 3 May 2022 09:55:44 +0200 [thread overview]
Message-ID: <3291358c-4159-d6ff-067e-34fbfb4aa7ba@xilinx.com> (raw)
In-Reply-To: <20220411180046.1505209-7-adrian.fiergolski@fastree3d.com>
On 4/11/22 20:00, Adrian Fiergolski wrote:
> From: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
>
> Add supporting new compatible string "u-boot,zynqmp-fpga-ddrauth" to
> handle loading authenticated images (DDR).
>
> Based on solution by Jorge Ramirez-Ortiz <jorge@foundries.io>
> Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
> Co-developed-by: Ricardo Salveti <ricardo@foundries.io>
> Signed-off-by: Ricardo Salveti <ricardo@foundries.io>
> Tested-by: Ricardo Salveti <ricardo@foundries.io>
> Co-developed-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
> Signed-off-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
> ---
> boot/Kconfig | 4 ++--
> doc/uImage.FIT/source_file_format.txt | 5 ++++-
> drivers/fpga/zynqmppl.c | 21 +++++++++++++++++++++
> 3 files changed, 27 insertions(+), 3 deletions(-)
>
> diff --git a/boot/Kconfig b/boot/Kconfig
> index b83a4e8400..f7faafb29f 100644
> --- a/boot/Kconfig
> +++ b/boot/Kconfig
> @@ -209,8 +209,8 @@ config SPL_LOAD_FIT
> 1. "loadables" images, other than FDTs, which do not have a "load"
> property will not be loaded. This limitation also applies to FPGA
> images with the correct "compatible" string.
> - 2. For FPGA images, only the "compatible" = "u-boot,fpga-legacy"
> - loading method is supported.
> + 2. For FPGA images, the supported "compatible" list is in the
> + doc/uImage.FIT/source_file_format.txt.
> 3. FDTs are only loaded for images with an "os" property of "u-boot".
> "linux" images are also supported with Falcon boot mode.
>
> diff --git a/doc/uImage.FIT/source_file_format.txt b/doc/uImage.FIT/source_file_format.txt
> index f93ac6d1c7..461e2af2a8 100644
> --- a/doc/uImage.FIT/source_file_format.txt
> +++ b/doc/uImage.FIT/source_file_format.txt
> @@ -184,7 +184,10 @@ the '/images' node should have the following layout:
> Mandatory for types: "firmware", and "kernel".
> - compatible : compatible method for loading image.
> Mandatory for types: "fpga", and images that do not specify a load address.
> - To use the generic fpga loading routine, use "u-boot,fpga-legacy".
> + Supported compatible methods:
> + "u-boot,fpga-legacy" - the generic fpga loading routine.
> + "u-boot,zynqmp-fpga-ddrauth" - signed non-encrypted FPGA bitstream for
> + Xilinx Zynq UltraScale+ (ZymqMP) device.
>
> Optional nodes:
> - hash-1 : Each hash sub-node represents separate hash or checksum
> diff --git a/drivers/fpga/zynqmppl.c b/drivers/fpga/zynqmppl.c
> index c7f9f4ae84..0ce641e495 100644
> --- a/drivers/fpga/zynqmppl.c
> +++ b/drivers/fpga/zynqmppl.c
> @@ -9,6 +9,7 @@
> #include <common.h>
> #include <compiler.h>
> #include <cpu_func.h>
> +#include <fpga.h>
> #include <log.h>
> #include <zynqmppl.h>
> #include <zynqmp_firmware.h>
> @@ -210,6 +211,26 @@ static int zynqmp_load(xilinx_desc **desc_ptr, const void *buf, size_t bsize,
> u32 ret_payload[PAYLOAD_ARG_CNT];
> bool xilfpga_old = false;
> xilinx_desc *desc = *desc_ptr;
> + fpga_desc *fdesc = container_of((void *)desc_ptr, fpga_desc, devdesc);
> +
> + if (fdesc && fdesc->compatible &&
> + !strcmp(fdesc->compatible, "u-boot,zynqmp-fpga-ddrauth")) {
I think you should use directly here what you have in 7/7. It means to check
that it is not fpga-legacy.
> + struct fpga_secure_info info = { 0 };
> +
> + if (!CONFIG_IS_ENABLED(FPGA_LOAD_SECURE)) {
> + printf("No support for %s\n", fdesc->compatible);
> + return FPGA_FAIL;
> + }
> +
> + if (!desc->operations->loads) {
> + printf("%s: Missing load operation\n", __func__);
> + return FPGA_FAIL;
> + }
> + /* DDR authentication */
> + info.authflag = 1;
> + info.encflag = 2;
> + return desc->operations->loads(desc, buf, bsize, &info);
> + }
>
> if (zynqmp_firmware_version() <= PMUFW_V1_0) {
> puts("WARN: PMUFW v1.0 or less is detected\n");
Before you start to deal with secure bitstreams you should also likely check
this PMUFW checking before you call loads.
Thanks,
Michal
next prev parent reply other threads:[~2022-05-03 7:56 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-11 18:00 [PATCH v7 0/7] fpga: zynqmp: Adding support of loading authenticated images Adrian Fiergolski
2022-04-11 18:00 ` [PATCH v7 1/7] fpga: add option for loading FPGA secure bitstreams Adrian Fiergolski
2022-04-11 18:00 ` [PATCH v7 2/7] fpga: add fit_fpga_load function Adrian Fiergolski
2022-05-03 7:42 ` Michal Simek
2022-05-04 14:28 ` Adrian Fiergolski
2022-05-04 18:26 ` Oleksandr Suvorov
2022-05-09 10:30 ` Adrian Fiergolski
2022-05-09 11:41 ` Oleksandr Suvorov
2022-05-09 11:02 ` Oleksandr Suvorov
2022-05-09 11:35 ` Adrian Fiergolski
2022-05-09 13:28 ` Oleksandr Suvorov
2022-05-09 13:34 ` Adrian Fiergolski
2022-05-16 14:25 ` Michal Simek
2022-05-18 8:47 ` Oleksandr Suvorov
2022-05-31 23:17 ` Oleksandr Suvorov
2022-04-11 18:00 ` [PATCH v7 3/7] fpga: xilinx: pass an address of xilinx_desc in fpga_desc Adrian Fiergolski
2022-04-11 18:00 ` [PATCH v7 4/7] fpga: xilinx: add missed identifier names Adrian Fiergolski
2022-05-03 7:43 ` Michal Simek
2022-04-11 18:00 ` [PATCH v7 5/7] fpga: xilinx: pass xilinx_desc pointer address into load() ops Adrian Fiergolski
2022-05-03 7:44 ` Michal Simek
2022-04-11 18:00 ` [PATCH v7 6/7] fpga: zynqmp: support loading authenticated images Adrian Fiergolski
2022-05-03 7:55 ` Michal Simek [this message]
2022-05-07 22:19 ` Oleksandr Suvorov
2022-04-11 18:00 ` [PATCH v7 7/7] fpga: zynqmp: support loading encrypted bitfiles Adrian Fiergolski
2022-05-03 7:56 ` [PATCH v7 0/7] fpga: zynqmp: Adding support of loading authenticated images Michal Simek
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=3291358c-4159-d6ff-067e-34fbfb4aa7ba@xilinx.com \
--to=michal.simek@xilinx.com \
--cc=adrian.fiergolski@fastree3d.com \
--cc=bmeng.cn@gmail.com \
--cc=hs@denx.de \
--cc=igor.opaniuk@foundries.io \
--cc=jaeckel-floss@eyet-services.de \
--cc=jagan@amarulasolutions.com \
--cc=jorge@foundries.io \
--cc=klaus@linux.vnet.ibm.com \
--cc=mr.nuke.me@gmail.com \
--cc=oleksandr.suvorov@foundries.io \
--cc=ricardo@foundries.io \
--cc=seanga2@gmail.com \
--cc=sjg@chromium.org \
--cc=u-boot@lists.denx.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox