[PATCH v2 4/4] fpga: zynqmp: support loading authenticated images

Michal Simek michal.simek at xilinx.com
Mon Nov 1 13:06:12 CET 2021



On 11/1/21 11:47, Oleksandr Suvorov wrote:
> Add supporting new compatible string "u-boot,zynqmp-fpga-ddrauth" to
> handle loading authenticated images (DDR).
> 
> Based on solution by Jorge Ramirez-Ortiz <jorge at foundries.io>
> Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov at foundries.io>
> Co-developed-by: Ricardo Salveti <ricardo at foundries.io>
> Signed-off-by: Ricardo Salveti <ricardo at foundries.io>
> Tested-by: Ricardo Salveti <ricardo at foundries.io>
> ---
> 
> Changes in v2:
> - add function fit_fpga_load() to simplify calls of fpga_load()
>    from contexts without a compatible attribute.
> - move all ZynqMP-specific logic to drivers/fpga/zynqmppl.c
> - prepare for passing a "compatible" FDT property to any fpga driver.
> 
>   drivers/fpga/zynqmppl.c | 21 +++++++++++++++++++++
>   1 file changed, 21 insertions(+)
> 
> diff --git a/drivers/fpga/zynqmppl.c b/drivers/fpga/zynqmppl.c
> index 8ff12bf50a..ce25381890 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>
> @@ -209,6 +210,26 @@ static int zynqmp_load(xilinx_desc *desc, const void *buf, size_t bsize,
>   	u32 buf_lo, buf_hi;
>   	u32 ret_payload[PAYLOAD_ARG_CNT];
>   	bool xilfpga_old = false;
> +	fpga_desc *fdesc = container_of((void *)desc, fpga_desc, devdesc);
> +
> +	if (fdesc && fdesc->compatible &&
> +	    !strcmp(fdesc->compatible, "u-boot,zynqmp-fpga-ddrauth")) {
> +#if CONFIG_IS_ENABLED(FPGA_LOAD_SECURE)
> +		struct fpga_secure_info info = { 0 };
> +
> +		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);
> +#else
> +		printf("No support for %s\n", fdesc->compatible);
> +		return FPGA_FAIL;
> +#endif
> +	}
>   
>   	if (zynqmp_firmware_version() <= PMUFW_V1_0) {
>   		puts("WARN: PMUFW v1.0 or less is detected\n");
> 

This is fine but I would like to also see update in documentation to 
describe that possible/supported types.

Thanks,
Michal



More information about the U-Boot mailing list