Skip to contentSkip to conversation

Add Vendor Authorized Boot (VAB) support

PATCH Superseded Siew Chin Lim 2 participants 12 messages Feb 26, 2021 – Mar 1, 2021

Subsystems (5)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover Add Vendor Authorized Boot (VAB) support

This is the 4th version of patchset to add Vendor Authorized Boot (VAB) support for Intel Agilex SoC device.

Vendor Authorized Boot is a security feature for authenticating the images such as U-Boot, ARM trusted Firmware, Linux kernel, device tree blob and etc loaded from FIT. After those images are loaded from FIT, the VAB certificate and signature block appended at the end of each image are sent to Secure Device Manager (SDM) for authentication. U-Boot will validate the SHA384 of the image against the SHA384 hash stored in the VAB certificate before sending the image to SDM for authentication.

Patch status:
Have changes: Patch 2, 7
Other patches unchanged.

Detail changelog can find in commit message.

v3->v4:
--------
Patch 2:
- Move function 'board_fit_image_post_process' and 'board_prep_linux' from secure_vab.c to board.c

Patch 7:
- Replace CONFIG_TARGET_SOCFPGA_STRATIX10/AGILEX with CONFIG_TARGET_SOCFPGA_SOC64.
- Add this patch into 'VAB' series because it is depending on CONFIG_TARGET_SOCFPGA_SOC64 patch.

History:
--------
[v1]: https://patchwork.ozlabs.org/project/uboot/cover/20201110070505.26935-1-elly.siew.chin.lim at intel.com/ [v2]: https://patchwork.ozlabs.org/project/uboot/cover/20210107100337.45293-1-elly.siew.chin.lim at intel.com/ [v3]: https://patchwork.ozlabs.org/project/uboot/cover/20210205105212.16510-1-elly.siew.chin.lim at intel.com/

Dalon Westergreen (1):
Makefile: socfpga: Add target to generate hex output for combined spl
and dtb

Siew Chin Lim (6):
arm: socfpga: Move Stratix10 and Agilex to use TARGET_SOCFPGA_SOC64
arm: socfpga: soc64: Support Vendor Authorized Boot (VAB)
arm: socfpga: cmd: Support 'vab' command
arm: socfpga: dts: soc64: Update filename in binman node of FIT image
with VAB support
configs: socfpga: soc64: Move CONFIG_BOOTCOMMAND to defconfig
configs: socfpga: Add defconfig for Agilex with VAB support

 Makefile                                           |  11 +-
 arch/arm/Kconfig                                   |   6 +-
 arch/arm/dts/socfpga_soc64_fit-u-boot.dtsi         |  22 +++
 arch/arm/mach-socfpga/Kconfig                      |  20 +++
 arch/arm/mach-socfpga/Makefile                     |   3 +
 arch/arm/mach-socfpga/board.c                      |  43 ++++-
 arch/arm/mach-socfpga/include/mach/mailbox_s10.h   |   1 +
 arch/arm/mach-socfpga/include/mach/reset_manager.h |   3 +-
 arch/arm/mach-socfpga/include/mach/secure_vab.h    |  63 +++++++
 .../arm/mach-socfpga/include/mach/system_manager.h |   3 +-
 arch/arm/mach-socfpga/secure_vab.c                 | 186 +++++++++++++++++++++
 arch/arm/mach-socfpga/vab.c                        |  34 ++++
 common/Kconfig.boot                                |   2 +-
 configs/socfpga_agilex_atf_defconfig               |   2 +
 configs/socfpga_agilex_defconfig                   |   2 +
 ..._atf_defconfig => socfpga_agilex_vab_defconfig} |   4 +
 configs/socfpga_stratix10_atf_defconfig            |   2 +
 configs/socfpga_stratix10_defconfig                |   2 +
 drivers/ddr/altera/Kconfig                         |   6 +-
 drivers/fpga/Kconfig                               |   2 +-
 drivers/sysreset/Kconfig                           |   2 +-
 include/configs/socfpga_soc64_common.h             |  10 +-
 scripts/Makefile.spl                               |   7 +
 23 files changed, 406 insertions(+), 30 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/include/mach/secure_vab.h
 create mode 100644 arch/arm/mach-socfpga/secure_vab.c
 create mode 100644 arch/arm/mach-socfpga/vab.c
 copy configs/{socfpga_agilex_atf_defconfig => socfpga_agilex_vab_defconfig} (91%)
Signature · 1 line
2.13.0
#1 lore raw

PATCH v4 1/7 arm: socfpga: Move Stratix10 and Agilex to use TARGET_SOCFPGA_SOC64

Create common macro TARGET_SOCFPGA_SOC64 for Stratix10 and Agilex.

---
 arch/arm/Kconfig                                    | 6 +++---
 arch/arm/mach-socfpga/Kconfig                       | 5 +++++
 arch/arm/mach-socfpga/include/mach/reset_manager.h  | 3 +--
 arch/arm/mach-socfpga/include/mach/system_manager.h | 3 +--
 drivers/ddr/altera/Kconfig                          | 6 +++---
 drivers/fpga/Kconfig                                | 2 +-
 drivers/sysreset/Kconfig                            | 2 +-
 7 files changed, 15 insertions(+), 12 deletions(-)
arch/arm/Kconfig +3 -3
index 95557d6ed6..f4299ae692 100644
@@ -975,7 +975,7 @@ config ARCH_SOCFPGA
 	bool "Altera SOCFPGA family"
 	select ARCH_EARLY_INIT_R
 	select ARCH_MISC_INIT if !TARGET_SOCFPGA_ARRIA10
-	select ARM64 if TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
+	select ARM64 if TARGET_SOCFPGA_SOC64
 	select CPU_V7A if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10
 	select DM
 	select DM_SERIAL
@@ -987,7 +987,7 @@ config ARCH_SOCFPGA
 	select SPL_LIBGENERIC_SUPPORT
 	select SPL_NAND_SUPPORT if SPL_NAND_DENALI
 	select SPL_OF_CONTROL
-	select SPL_SEPARATE_BSS if TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
+	select SPL_SEPARATE_BSS if TARGET_SOCFPGA_SOC64
 	select SPL_SERIAL_SUPPORT
 	select SPL_SYSRESET
 	select SPL_WATCHDOG_SUPPORT
@@ -996,7 +996,7 @@ config ARCH_SOCFPGA
 	select SYS_THUMB_BUILD if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10
 	select SYSRESET
 	select SYSRESET_SOCFPGA if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10
-	select SYSRESET_SOCFPGA_SOC64 if TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
+	select SYSRESET_SOCFPGA_SOC64 if TARGET_SOCFPGA_SOC64
 	imply CMD_DM
 	imply CMD_MTDPARTS
 	imply CRC32_VERIFY
arch/arm/mach-socfpga/Kconfig +5 -0
index 4d4ff16337..9b1abdaabd 100644
@@ -38,6 +38,7 @@ config TARGET_SOCFPGA_AGILEX
 	select FPGA_INTEL_SDM_MAILBOX
 	select NCORE_CACHE
 	select SPL_CLK if SPL
+	select TARGET_SOCFPGA_SOC64
 
 config TARGET_SOCFPGA_ARRIA5
 	bool
@@ -75,12 +76,16 @@ config TARGET_SOCFPGA_GEN5
 	imply SPL_SYS_MALLOC_SIMPLE
 	imply SPL_USE_TINY_PRINTF
 
+config TARGET_SOCFPGA_SOC64
+	bool
+
 config TARGET_SOCFPGA_STRATIX10
 	bool
 	select ARMV8_MULTIENTRY
 	select ARMV8_SET_SMPEN
 	select BINMAN if SPL_ATF
 	select FPGA_INTEL_SDM_MAILBOX
+	select TARGET_SOCFPGA_SOC64
 
 choice
 	prompt "Altera SOCFPGA board select"
arch/arm/mach-socfpga/include/mach/reset_manager.h +1 -2
index 7844ad14cb..8c25325e45 100644
@@ -43,8 +43,7 @@ void socfpga_per_reset_all(void);
 #include <asm/arch/reset_manager_gen5.h>
 #elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
 #include <asm/arch/reset_manager_arria10.h>
-#elif defined(CONFIG_TARGET_SOCFPGA_STRATIX10) || \
-	defined(CONFIG_TARGET_SOCFPGA_AGILEX)
+#elif defined(CONFIG_TARGET_SOCFPGA_SOC64)
 #include <asm/arch/reset_manager_soc64.h>
 #endif
 
arch/arm/mach-socfpga/include/mach/system_manager.h +1 -2
index f816954717..5603eaa3d0 100644
@@ -8,8 +8,7 @@
 
 phys_addr_t socfpga_get_sysmgr_addr(void);
 
-#if defined(CONFIG_TARGET_SOCFPGA_STRATIX10) || \
-	defined(CONFIG_TARGET_SOCFPGA_AGILEX)
+#if defined(CONFIG_TARGET_SOCFPGA_SOC64)
 #include <asm/arch/system_manager_soc64.h>
 #else
 #define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGPINMUX	BIT(0)
drivers/ddr/altera/Kconfig +3 -3
index 8f590dc5f6..4660d20def 100644
@@ -1,8 +1,8 @@
 config SPL_ALTERA_SDRAM
 	bool "SoCFPGA DDR SDRAM driver in SPL"
 	depends on SPL
-	depends on TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10 || TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
-	select RAM if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
-	select SPL_RAM if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
+	depends on TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10 || TARGET_SOCFPGA_SOC64
+	select RAM if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_SOC64
+	select SPL_RAM if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_SOC64
 	help
 	  Enable DDR SDRAM controller for the SoCFPGA devices.
drivers/fpga/Kconfig +1 -1
index 425b52a926..dc0b3dd31b 100644
@@ -33,7 +33,7 @@ config FPGA_CYCLON2
 
 config FPGA_INTEL_SDM_MAILBOX
 	bool "Enable Intel FPGA Full Reconfiguration SDM Mailbox driver"
-	depends on TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX
+	depends on TARGET_SOCFPGA_SOC64
 	select FPGA_ALTERA
 	help
 	  Say Y here to enable the Intel FPGA Full Reconfig SDM Mailbox driver
drivers/sysreset/Kconfig +1 -1
index 0e5c7c9971..52f874317b 100644
@@ -88,7 +88,7 @@ config SYSRESET_SOCFPGA
 
 config SYSRESET_SOCFPGA_SOC64
 	bool "Enable support for Intel SOCFPGA SoC64 family (Stratix10/Agilex)"
-	depends on ARCH_SOCFPGA && (TARGET_SOCFPGA_STRATIX10 || TARGET_SOCFPGA_AGILEX)
+	depends on ARCH_SOCFPGA && TARGET_SOCFPGA_SOC64
 	help
 	  This enables the system reset driver support for Intel SOCFPGA
 	  SoC64 SoCs.
Signature · 1 line
2.13.0
#2 lore raw

PATCH v4 2/7 arm: socfpga: soc64: Support Vendor Authorized Boot (VAB)

In reply to Siew Chin Lim

Vendor Authorized Boot is a security feature for authenticating the images such as U-Boot, ARM trusted Firmware, Linux kernel, device tree blob and etc loaded from FIT. After those images are loaded from FIT, the VAB certificate and signature block appended at the end of each image are sent to Secure Device Manager (SDM) for authentication. U-Boot will validate the SHA384 of the image against the SHA384 hash stored in the VAB certificate before sending the image to SDM for authentication.

---
v4:
- Move function 'board_fit_image_post_process' and 'board_prep_linux' to arch/arm/mach-socfpga/board.c

v3:
- Add description for function 'socfpga_vendor_authentication'.
- Relocate vab certificate to first memory bank before trigger SMC call to send mailbox command because ATF only able to access first memory bank.
- Report error instead of bypass the authentication in SPL if Secure Device Manager (SDM) does not support VAB.
- Print success string if VAB success.
- Replace #ifdef with if(IS_ENABLED(CONFIG_...)).

---
 arch/arm/mach-socfpga/Kconfig                    |  15 ++
 arch/arm/mach-socfpga/Makefile                   |   2 +
 arch/arm/mach-socfpga/board.c                    |  43 +++++-
 arch/arm/mach-socfpga/include/mach/mailbox_s10.h |   1 +
 arch/arm/mach-socfpga/include/mach/secure_vab.h  |  63 ++++++++
 arch/arm/mach-socfpga/secure_vab.c               | 186 +++++++++++++++++++++++
 common/Kconfig.boot                              |   2 +-
 7 files changed, 307 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/include/mach/secure_vab.h
 create mode 100644 arch/arm/mach-socfpga/secure_vab.c
arch/arm/mach-socfpga/Kconfig +15 -0
index 9b1abdaabd..0c35406232 100644
@@ -6,6 +6,21 @@ config ERR_PTR_OFFSET
 config NR_DRAM_BANKS
 	default 1
 
+config SOCFPGA_SECURE_VAB_AUTH
+	bool "Enable boot image authentication with Secure Device Manager"
+	depends on TARGET_SOCFPGA_AGILEX
+	select FIT_IMAGE_POST_PROCESS
+	select SHA384
+	select SHA512_ALGO
+	select SPL_FIT_IMAGE_POST_PROCESS
+	help
+	 All images loaded from FIT will be authenticated by Secure Device
+	 Manager.
+
+config SOCFPGA_SECURE_VAB_AUTH_ALLOW_NON_FIT_IMAGE
+	bool "Allow non-FIT VAB signed images"
+	depends on SOCFPGA_SECURE_VAB_AUTH
+
 config SPL_SIZE_LIMIT
 	default 0x10000 if TARGET_SOCFPGA_GEN5
 
arch/arm/mach-socfpga/Makefile +2 -0
index 82b681d870..1f1e21766d 100644
@@ -4,6 +4,7 @@
 # Wolfgang Denk, DENX Software Engineering, wd at denx.de.
 #
 # Copyright (C) 2012-2017 Altera Corporation <www.altera.com>
+# Copyright (C) 2017-2020 Intel Corporation <www.intel.com>
 
 obj-y	+= board.o
 obj-y	+= clock_manager.o
@@ -47,6 +48,7 @@ obj-y	+= mailbox_s10.o
 obj-y	+= misc_s10.o
 obj-y	+= mmu-arm64_s10.o
 obj-y	+= reset_manager_s10.o
+obj-$(CONFIG_SOCFPGA_SECURE_VAB_AUTH)	+= secure_vab.o
 obj-y	+= system_manager_s10.o
 obj-y	+= timer_s10.o
 obj-y	+= wrap_pinmux_config_s10.o
arch/arm/mach-socfpga/board.c +39 -4

55 lines not on this page · raw message

arch/arm/mach-socfpga/include/mach/mailbox_s10.h +1 -0
index 4d783119ea..fbaf11597e 100644
@@ -118,6 +118,7 @@ enum ALT_SDM_MBOX_RESP_CODE {
 #define MBOX_RECONFIG_MSEL	7
 #define MBOX_RECONFIG_DATA	8
 #define MBOX_RECONFIG_STATUS	9
+#define MBOX_VAB_SRC_CERT		11
 #define MBOX_QSPI_OPEN		50
 #define MBOX_QSPI_CLOSE		51
 #define MBOX_QSPI_DIRECT	59
arch/arm/mach-socfpga/include/mach/secure_vab.h new file +63 -0

63 lines not on this page · raw message

arch/arm/mach-socfpga/secure_vab.c new file +186 -0

186 lines not on this page · raw message

common/Kconfig.boot +1 -1
index 5eaabdfc27..7b94f402fd 100644
@@ -128,7 +128,7 @@ config FIT_BEST_MATCH
 
 config FIT_IMAGE_POST_PROCESS
 	bool "Enable post-processing of FIT artifacts after loading by U-Boot"
-	depends on TI_SECURE_DEVICE
+	depends on TI_SECURE_DEVICE || SOCFPGA_SECURE_VAB_AUTH
 	help
 	  Allows doing any sort of manipulation to blobs after they got extracted
 	  from FIT images like stripping off headers or modifying the size of the
Signature · 1 line
2.13.0
#3 lore raw

PATCH v4 2/7 arm: socfpga: soc64: Support Vendor Authorized Boot (VAB)

Quoted 73 lines

-----Original Message-----
From: Lim, Elly Siew Chin <[email protected]>
Sent: Saturday, February 27, 2021 12:11 AM
To: u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; Tan, Ley Foon <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Westergreen, Dalon <[email protected]>; Simon Glass <[email protected]>; Gan, Yau Wai <[email protected]>; Lim, Elly Siew Chin <[email protected]>
Subject: [v4 2/7] arm: socfpga: soc64: Support Vendor Authorized Boot (VAB)

Vendor Authorized Boot is a security feature for authenticating the images such as U-Boot, ARM trusted Firmware, Linux kernel, device tree blob and etc loaded from FIT. After those images are loaded from FIT, the VAB certificate and signature block appended at the end of each image are sent to Secure Device Manager (SDM) for authentication. U-Boot will validate the SHA384 of the image against the SHA384 hash stored in the VAB certificate before sending the image to SDM for authentication.

---
v4:
- Move function 'board_fit_image_post_process' and 'board_prep_linux' to arch/arm/mach-socfpga/board.c

v3:
- Add description for function 'socfpga_vendor_authentication'.
- Relocate vab certificate to first memory bank before trigger SMC call to send mailbox command because ATF only able to access first memory
bank.
- Report error instead of bypass the authentication in SPL if Secure Device Manager (SDM) does not support VAB.
- Print success string if VAB success.
- Replace #ifdef with if(IS_ENABLED(CONFIG_...)).

---
 arch/arm/mach-socfpga/Kconfig                    |  15 ++
 arch/arm/mach-socfpga/Makefile                   |   2 +
 arch/arm/mach-socfpga/board.c                    |  43 +++++-
 arch/arm/mach-socfpga/include/mach/mailbox_s10.h |   1 +
 arch/arm/mach-socfpga/include/mach/secure_vab.h  |  63 ++++++++
 arch/arm/mach-socfpga/secure_vab.c               | 186
+++++++++++++++++++++++
 common/Kconfig.boot                              |   2 +-
 7 files changed, 307 insertions(+), 5 deletions(-)  create mode 100644
arch/arm/mach-socfpga/include/mach/secure_vab.h
 create mode 100644 arch/arm/mach-socfpga/secure_vab.c

#include <common.h>

arch/arm/mach-socfpga/board.c +7 -4
-#include <errno.h>
-#include <fdtdec.h>
-#include <init.h>
-#include <asm/arch/reset_manager.h>
 #include <asm/arch/clock_manager.h>
 #include <asm/arch/misc.h>
+#include <asm/arch/reset_manager.h>
+#include <asm/arch/secure_vab.h>
 #include <asm/io.h>
+#include <errno.h>
+#include <fdtdec.h>
+#include <hang.h>
+#include <image.h>
+#include <init.h>
 #include <log.h>
 #include <usb.h>
 #include <usb/dwc2_udc.h>
@@ -97,3 +100,35 @@ __weak int board_fit_config_name_match(const char
 *name)
 	return 0;

arch/arm/mach-socfpga/board.c __weak int board_fit_config_name_match(const char

Quoted 10 lines
arch/arm/mach-socfpga/board.c +8 -0
 }
 #endif
+
+#if IS_ENABLED(CONFIG_SOCFPGA_SECURE_VAB_AUTH)
+void board_fit_image_post_process(void **p_image, size_t *p_size) {
+	if (socfpga_vendor_authentication(p_image, p_size))
+		hang();
+}
+
+void board_prep_linux(bootm_headers_t *images) {

Check CONFIG_SOCFPGA_SECURE_VAB_AUTH setting, then only include code below.

Quoted 21 lines
(quoted diff) +2 -0
+	if (!IS_ENABLED(CONFIG_SPL_BUILD)) {
+		if

(!IS_ENABLED(CONFIG_SECURE_VAB_AUTH_ALLOW_NON_FIT_IMAGE)) {

arch/arm/mach-socfpga/board.c +6 -0
+			/*
+			 * Ensure the OS is always booted from FIT and with
+			 * VAB signed certificate
+			 */
+			if (!images->fit_uname_cfg) {
+				printf("Please use FIT with VAB signed

images!\n");

arch/arm/mach-socfpga/board.c +5 -0
+				hang();
+			}
+
+			env_set_hex("fdt_addr", (ulong)images->ft_addr);
+			debug("images->ft_addr = 0x%08lx\n",

(ulong)images->ft_addr);

arch/arm/mach-socfpga/board.c +5 -0
+		}
+
+		if (IS_ENABLED(CONFIG_CADENCE_QSPI)) {
+			if (env_get("linux_qspi_enable"))
+
Quoted 1 line
	run_command(env_get("linux_qspi_enable"), 0);

Can always run " linux_qspi_enable" command for all target SOC64? Then can remove linux_qspi_enable from BOOTCOMMAND.

Regards
Ley Foon

#4 lore raw

PATCH v4 2/7 arm: socfpga: soc64: Support Vendor Authorized Boot (VAB)

Hi Ley Foon,

Quoted 120 lines

-----Original Message-----
From: Tan, Ley Foon <[email protected]>
Sent: Monday, March 1, 2021 9:56 AM
To: Lim, Elly Siew Chin <[email protected]>; u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Westergreen, Dalon <[email protected]>; Simon Glass <[email protected]>; Gan, Yau Wai <[email protected]>
Subject: RE: [v4 2/7] arm: socfpga: soc64: Support Vendor Authorized Boot (VAB)

Quoted 23 lines

-----Original Message-----
From: Lim, Elly Siew Chin <[email protected]>
Sent: Saturday, February 27, 2021 12:11 AM
To: u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; Tan, Ley Foon <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Westergreen, Dalon <[email protected]>; Simon Glass <[email protected]>; Gan, Yau Wai <[email protected]>; Lim, Elly Siew Chin <[email protected]>
Subject: [v4 2/7] arm: socfpga: soc64: Support Vendor Authorized Boot (VAB)

Vendor Authorized Boot is a security feature for authenticating the images such as U-Boot, ARM trusted Firmware, Linux kernel, device tree blob and etc loaded from FIT. After those images are loaded from FIT, the VAB certificate and signature block appended at the end of each image are sent to Secure Device Manager (SDM) for authentication. U-Boot will validate the
SHA384 of the image against the SHA384 hash stored in the VAB certificate before sending the image to SDM for authentication.

Quoted 5 lines

---
v4:
- Move function 'board_fit_image_post_process' and 'board_prep_linux'

to

arch/arm/mach-socfpga/board.c __weak int board_fit_config_name_match(const

Quoted 43 lines

arch/arm/mach-socfpga/board.c

v3:
- Add description for function 'socfpga_vendor_authentication'.
- Relocate vab certificate to first memory bank before trigger SMC call to send mailbox command because ATF only able to access first memory
bank.
- Report error instead of bypass the authentication in SPL if Secure Device Manager (SDM) does not support VAB.
- Print success string if VAB success.
- Replace #ifdef with if(IS_ENABLED(CONFIG_...)).

---
 arch/arm/mach-socfpga/Kconfig                    |  15 ++
 arch/arm/mach-socfpga/Makefile                   |   2 +
 arch/arm/mach-socfpga/board.c                    |  43 +++++-
 arch/arm/mach-socfpga/include/mach/mailbox_s10.h |   1 +
 arch/arm/mach-socfpga/include/mach/secure_vab.h  |  63 ++++++++
 arch/arm/mach-socfpga/secure_vab.c               | 186
+++++++++++++++++++++++
 common/Kconfig.boot                              |   2 +-
 7 files changed, 307 insertions(+), 5 deletions(-)  create mode
100644 arch/arm/mach-socfpga/include/mach/secure_vab.h
 create mode 100644 arch/arm/mach-socfpga/secure_vab.c

#include <common.h>

arch/arm/mach-socfpga/board.c +7 -4
-#include <errno.h>
-#include <fdtdec.h>
-#include <init.h>
-#include <asm/arch/reset_manager.h>
 #include <asm/arch/clock_manager.h>
 #include <asm/arch/misc.h>
+#include <asm/arch/reset_manager.h>
+#include <asm/arch/secure_vab.h>
 #include <asm/io.h>
+#include <errno.h>
+#include <fdtdec.h>
+#include <hang.h>
+#include <image.h>
+#include <init.h>
 #include <log.h>
 #include <usb.h>
 #include <usb/dwc2_udc.h>
@@ -97,3 +100,35 @@ __weak int board_fit_config_name_match(const

char

arch/arm/mach-socfpga/board.c __weak int board_fit_config_name_match(const char *name)

Quoted 12 lines
arch/arm/mach-socfpga/board.c +8 -0
 *name)
 	return 0;
 }
 #endif
+
+#if IS_ENABLED(CONFIG_SOCFPGA_SECURE_VAB_AUTH)
+void board_fit_image_post_process(void **p_image, size_t *p_size) {
+	if (socfpga_vendor_authentication(p_image, p_size))
+		hang();
+}
+
+void board_prep_linux(bootm_headers_t *images) {

Check CONFIG_SOCFPGA_SECURE_VAB_AUTH setting, then only include code below.

Quoted 16 lines
(quoted diff) +2 -0
+	if (!IS_ENABLED(CONFIG_SPL_BUILD)) {
+		if

(!IS_ENABLED(CONFIG_SECURE_VAB_AUTH_ALLOW_NON_FIT_IMAGE)) {

arch/arm/mach-socfpga/board.c +6 -0
+			/*
+			 * Ensure the OS is always booted from FIT and with
+			 * VAB signed certificate
+			 */
+			if (!images->fit_uname_cfg) {
+				printf("Please use FIT with VAB signed

images!\n");

arch/arm/mach-socfpga/board.c +5 -0
+				hang();
+			}
+
+			env_set_hex("fdt_addr", (ulong)images->ft_addr);
+			debug("images->ft_addr = 0x%08lx\n",

(ulong)images->ft_addr);

Quoted 8 lines
Quoted 6 lines
arch/arm/mach-socfpga/board.c +5 -0
+		}
+
+		if (IS_ENABLED(CONFIG_CADENCE_QSPI)) {
+			if (env_get("linux_qspi_enable"))
+
	run_command(env_get("linux_qspi_enable"), 0);

Can always run " linux_qspi_enable" command for all target SOC64? Then can remove linux_qspi_enable from BOOTCOMMAND.

board_prep_linux will only be called when we use "bootm" to boot to Linux. Only SOC64 VAB flow is using "bootm" now. We still need linux_qspi_enable in BOOTCOMMAND for ATF and non-ATF boot flow.

Quoted 3 lines

Regards
Ley Foon

#5 lore raw

PATCH v4 2/7 arm: socfpga: soc64: Support Vendor Authorized Boot (VAB)

Quoted 153 lines

-----Original Message-----
From: Lim, Elly Siew Chin <[email protected]>
Sent: Monday, March 1, 2021 2:43 PM
To: Tan, Ley Foon <[email protected]>; u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Westergreen, Dalon <[email protected]>; Simon Glass <[email protected]>; Gan, Yau Wai <[email protected]>
Subject: RE: [v4 2/7] arm: socfpga: soc64: Support Vendor Authorized Boot (VAB)

Hi Ley Foon,

Quoted 6 lines

-----Original Message-----
From: Tan, Ley Foon <[email protected]>
Sent: Monday, March 1, 2021 9:56 AM
To: Lim, Elly Siew Chin <[email protected]>; u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; See, Chin Liang

Quoted 21 lines

<[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Westergreen, Dalon <[email protected]>; Simon Glass <[email protected]>; Gan, Yau Wai <[email protected]>
Subject: RE: [v4 2/7] arm: socfpga: soc64: Support Vendor Authorized Boot
(VAB)

Quoted 10 lines

-----Original Message-----
From: Lim, Elly Siew Chin <[email protected]>
Sent: Saturday, February 27, 2021 12:11 AM
To: u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; Tan, Ley Foon <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Westergreen, Dalon <[email protected]>; Simon Glass <[email protected]>;

Gan,

Quoted 11 lines
Quoted 11 lines

Yau Wai <[email protected]>; Lim, Elly Siew Chin <[email protected]>
Subject: [v4 2/7] arm: socfpga: soc64: Support Vendor Authorized Boot
(VAB)

Vendor Authorized Boot is a security feature for authenticating the images such as U-Boot, ARM trusted Firmware, Linux kernel, device tree blob and etc loaded from FIT. After those images are loaded from FIT, the VAB certificate and signature block appended at the end of each image are sent to Secure Device Manager (SDM) for

authentication.

Quoted 53 lines
Quoted 9 lines

U-Boot will validate the
SHA384 of the image against the SHA384 hash stored in the VAB certificate before sending the image to SDM for authentication.

---
v4:
- Move function 'board_fit_image_post_process' and 'board_prep_linux'

to

arch/arm/mach-socfpga/board.c __weak int board_fit_config_name_match(const

Quoted 42 lines

arch/arm/mach-socfpga/board.c

v3:
- Add description for function 'socfpga_vendor_authentication'.
- Relocate vab certificate to first memory bank before trigger SMC call to send mailbox command because ATF only able to access first
memory bank.
- Report error instead of bypass the authentication in SPL if Secure Device Manager (SDM) does not support VAB.
- Print success string if VAB success.
- Replace #ifdef with if(IS_ENABLED(CONFIG_...)).

---
 arch/arm/mach-socfpga/Kconfig                    |  15 ++
 arch/arm/mach-socfpga/Makefile                   |   2 +
 arch/arm/mach-socfpga/board.c                    |  43 +++++-
 arch/arm/mach-socfpga/include/mach/mailbox_s10.h |   1 +
 arch/arm/mach-socfpga/include/mach/secure_vab.h  |  63 ++++++++
 arch/arm/mach-socfpga/secure_vab.c               | 186
+++++++++++++++++++++++
 common/Kconfig.boot                              |   2 +-
 7 files changed, 307 insertions(+), 5 deletions(-)  create mode
100644 arch/arm/mach-socfpga/include/mach/secure_vab.h
 create mode 100644 arch/arm/mach-socfpga/secure_vab.c

#include <common.h>

arch/arm/mach-socfpga/board.c +0 -4
-#include <errno.h>
-#include <fdtdec.h>
-#include <init.h>
-#include <asm/arch/reset_manager.h>  #include

<asm/arch/clock_manager.h> #include <asm/arch/misc.h>

arch/arm/mach-socfpga/board.c +7 -0
+#include <asm/arch/reset_manager.h> #include
+<asm/arch/secure_vab.h>
 #include <asm/io.h>
+#include <errno.h>
+#include <fdtdec.h>
+#include <hang.h>
+#include <image.h>
+#include <init.h>
 #include <log.h>
 #include <usb.h>
 #include <usb/dwc2_udc.h>
@@ -97,3 +100,35 @@ __weak int board_fit_config_name_match(const

char

Quoted 14 lines

arch/arm/mach-socfpga/board.c __weak int board_fit_config_name_match(const char *name)

Quoted 12 lines
arch/arm/mach-socfpga/board.c +8 -0
 *name)
 	return 0;
 }
 #endif
+
+#if IS_ENABLED(CONFIG_SOCFPGA_SECURE_VAB_AUTH)
+void board_fit_image_post_process(void **p_image, size_t *p_size) {
+	if (socfpga_vendor_authentication(p_image, p_size))
+		hang();
+}
+
+void board_prep_linux(bootm_headers_t *images) {

Check CONFIG_SOCFPGA_SECURE_VAB_AUTH setting, then only include

code

Quoted 5 lines

below.

Quoted 3 lines
(quoted diff) +2 -0
+	if (!IS_ENABLED(CONFIG_SPL_BUILD)) {
+		if

(!IS_ENABLED(CONFIG_SECURE_VAB_AUTH_ALLOW_NON_FIT_IMAGE))

{

Quoted 13 lines
Quoted 13 lines
arch/arm/mach-socfpga/board.c +6 -0
+			/*
+			 * Ensure the OS is always booted from FIT and with
+			 * VAB signed certificate
+			 */
+			if (!images->fit_uname_cfg) {
+				printf("Please use FIT with VAB signed

images!\n");

arch/arm/mach-socfpga/board.c +5 -0
+				hang();
+			}
+
+			env_set_hex("fdt_addr", (ulong)images->ft_addr);
+			debug("images->ft_addr = 0x%08lx\n",

(ulong)images->ft_addr);

Quoted 8 lines
Quoted 6 lines
arch/arm/mach-socfpga/board.c +5 -0
+		}
+
+		if (IS_ENABLED(CONFIG_CADENCE_QSPI)) {
+			if (env_get("linux_qspi_enable"))
+
	run_command(env_get("linux_qspi_enable"), 0);

Can always run " linux_qspi_enable" command for all target SOC64? Then can remove linux_qspi_enable from BOOTCOMMAND.

Quoted 3 lines

board_prep_linux will only be called when we use "bootm" to boot to Linux. Only SOC64 VAB flow is using "bootm" now. We still need linux_qspi_enable in BOOTCOMMAND for ATF and non-ATF boot flow.

Okay.

#6 lore raw

PATCH v4 3/7 arm: socfpga: cmd: Support 'vab' command

In reply to Siew Chin Lim

Support 'vab' command to perform vendor authentication.

Command format: vab addr len
Authorize 'len' bytes starting at 'addr' via vendor public key

---
v3
---
- Remove the print in 'vab' command to avoid duplicated print out. The 'socfpga_vendor_authntication' function in secure_vab.c will print out the string if VAB success.

---
 arch/arm/mach-socfpga/Makefile |  1 +
 arch/arm/mach-socfpga/vab.c    | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 arch/arm/mach-socfpga/vab.c
arch/arm/mach-socfpga/Makefile +1 -0
index 1f1e21766d..9e63296b38 100644
@@ -51,6 +51,7 @@ obj-y	+= reset_manager_s10.o
 obj-$(CONFIG_SOCFPGA_SECURE_VAB_AUTH)	+= secure_vab.o
 obj-y	+= system_manager_s10.o
 obj-y	+= timer_s10.o
+obj-$(CONFIG_SOCFPGA_SECURE_VAB_AUTH)	+= vab.o
 obj-y	+= wrap_pinmux_config_s10.o
 obj-y	+= wrap_pll_config_s10.o
 endif
arch/arm/mach-socfpga/vab.c new file +34 -0
new file mode 100644
index 0000000000..85b3f30211
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 Intel Corporation <www.intel.com>
+ *
+ */
+
+#include <asm/arch/secure_vab.h>
+#include <command.h>
+#include <common.h>
+#include <linux/ctype.h>
+
+static int do_vab(struct cmd_tbl *cmdtp, int flag, int argc,
+		  char *const argv[])
+{
+	unsigned long addr, len;
+
+	if (argc < 3)
+		return CMD_RET_USAGE;
+
+	addr = simple_strtoul(argv[1], NULL, 16);
+	len = simple_strtoul(argv[2], NULL, 16);
+
+	if (socfpga_vendor_authentication((void *)&addr, (size_t *)&len) != 0)
+		return CMD_RET_FAILURE;
+
+	return 0;
+}
+
+U_BOOT_CMD(
+	vab,	3,	2,	do_vab,
+	"perform vendor authorization",
+	"addr len   - authorize 'len' bytes starting at\n"
+	"                 'addr' via vendor public key"
+);
Signature · 1 line
2.13.0
#7 lore raw

PATCH v4 4/7 arm: socfpga: dts: soc64: Update filename in binman node of FIT image with VAB support

In reply to Siew Chin Lim

FIT image of Vendor Authentication Coot (VAB) contains signed images.

---
 arch/arm/dts/socfpga_soc64_fit-u-boot.dtsi | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
arch/arm/dts/socfpga_soc64_fit-u-boot.dtsi +22 -0
index cf365590a8..4b30473743 100644
@@ -117,4 +117,26 @@
 	};
 };
 
+#if defined(CONFIG_SOCFPGA_SECURE_VAB_AUTH)
+&uboot_blob {
+	filename = "signed-u-boot-nodtb.bin";
+};
+
+&atf_blob {
+	filename = "signed-bl31.bin";
+};
+
+&uboot_fdt_blob {
+	filename = "signed-u-boot.dtb";
+};
+
+&kernel_blob {
+	filename = "signed-Image";
+};
+
+&kernel_fdt_blob {
+	filename = "signed-linux.dtb";
+};
+#endif
+
 #endif
Signature · 1 line
2.13.0
#8 lore raw

PATCH v4 5/7 configs: socfpga: soc64: Move CONFIG_BOOTCOMMAND to defconfig

In reply to Siew Chin Lim

CONFIG_BOOTCOMMAND have been moved to Kconfig.boot. This patch move the CONFIG_BOOTCOMMAND macro from socfpga_soc64_common.h to *_defconfig file for both Stratix 10 and Agilex.

---
 configs/socfpga_agilex_atf_defconfig    | 2 ++
 configs/socfpga_agilex_defconfig        | 2 ++
 configs/socfpga_stratix10_atf_defconfig | 2 ++
 configs/socfpga_stratix10_defconfig     | 2 ++
 include/configs/socfpga_soc64_common.h  | 8 +-------
 5 files changed, 9 insertions(+), 7 deletions(-)
configs/socfpga_agilex_atf_defconfig +2 -0
index ebe6ce63a4..7adda02b00 100644
@@ -20,6 +20,8 @@ CONFIG_SPL_LOAD_FIT_ADDRESS=0x02000000
 CONFIG_BOOTDELAY=5
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="earlycon"
+CONFIG_USE_BOOTCOMMAND=y
+CONFIG_BOOTCOMMAND="run fatscript; run mmcfitload; run linux_qspi_enable; run mmcfitboot"
 CONFIG_SPL_CACHE=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SPL_ATF=y
configs/socfpga_agilex_defconfig +2 -0
index 230d3c2ce5..3d5d39fe0f 100644
@@ -18,6 +18,8 @@ CONFIG_DEFAULT_DEVICE_TREE="socfpga_agilex_socdk"
 CONFIG_BOOTDELAY=5
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="earlycon"
+CONFIG_USE_BOOTCOMMAND=y
+CONFIG_BOOTCOMMAND="run fatscript; run mmcload; run linux_qspi_enable; run mmcboot"
 CONFIG_SPL_CACHE=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_HUSH_PARSER=y
configs/socfpga_stratix10_atf_defconfig +2 -0
index d1b12113ab..8dbb7424ba 100644
@@ -20,6 +20,8 @@ CONFIG_SPL_LOAD_FIT_ADDRESS=0x02000000
 CONFIG_BOOTDELAY=5
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="earlycon"
+CONFIG_USE_BOOTCOMMAND=y
+CONFIG_BOOTCOMMAND="run fatscript; run mmcfitload; run linux_qspi_enable; run mmcfitboot"
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SPL_ATF=y
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
configs/socfpga_stratix10_defconfig +2 -0
index 3df44bb88d..2d145e1a5f 100644
@@ -20,6 +20,8 @@ CONFIG_SPL_OPTIMIZE_INLINING=y
 CONFIG_BOOTDELAY=5
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="earlycon"
+CONFIG_USE_BOOTCOMMAND=y
+CONFIG_BOOTCOMMAND="run fatscript; run mmcload; run linux_qspi_enable; run mmcboot"
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="SOCFPGA_STRATIX10 # "
include/configs/socfpga_soc64_common.h +1 -7
index fdcd7d3e9a..0e54601257 100644
@@ -79,19 +79,13 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
 #endif /* CONFIG_CADENCE_QSPI */
 
 /*
- * Boot arguments passed to the boot command. The value of
- * CONFIG_BOOTARGS goes into the environment value "bootargs".
- * Do note the value will override also the chosen node in FDT blob.
+ * Environment variable
  */
 
 #ifdef CONFIG_FIT
 #define CONFIG_BOOTFILE "kernel.itb"
-#define CONFIG_BOOTCOMMAND "run fatscript; run mmcfitload;run linux_qspi_enable;" \
-			   "run mmcfitboot"
 #else
 #define CONFIG_BOOTFILE "Image"
-#define CONFIG_BOOTCOMMAND "run fatscript; run mmcload;run linux_qspi_enable;" \
-			   "run mmcboot"
 #endif
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
Signature · 1 line
2.13.0
#9 lore raw

PATCH v4 6/7 configs: socfpga: Add defconfig for Agilex with VAB support

In reply to Siew Chin Lim

Booting Agilex with Vendor Authorized Boot.

---
 .../{socfpga_agilex_atf_defconfig => socfpga_agilex_vab_defconfig}    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
 copy configs/{socfpga_agilex_atf_defconfig => socfpga_agilex_vab_defconfig} (92%)
configs/socfpga_agilex_vab_defconfig renamed from configs/socfpga_agilex_atf_defconfig +3 -1
similarity index 92%
copy from configs/socfpga_agilex_atf_defconfig
copy to configs/socfpga_agilex_vab_defconfig
index 7adda02b00..bca663ed61 100644
@@ -9,6 +9,7 @@ CONFIG_ENV_OFFSET=0x200
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x02000000
 CONFIG_DM_GPIO=y
 CONFIG_SPL_TEXT_BASE=0xFFE00000
+CONFIG_SOCFPGA_SECURE_VAB_AUTH=y
 CONFIG_TARGET_SOCFPGA_AGILEX_SOCDK=y
 CONFIG_IDENT_STRING="socfpga_agilex"
 CONFIG_SPL_FS_FAT=y
@@ -17,11 +18,12 @@ CONFIG_FIT=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_SPL_LOAD_FIT_ADDRESS=0x02000000
 # CONFIG_USE_SPL_FIT_GENERATOR is not set
+# CONFIG_LEGACY_IMAGE_FORMAT is not set
 CONFIG_BOOTDELAY=5
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="earlycon"
 CONFIG_USE_BOOTCOMMAND=y
-CONFIG_BOOTCOMMAND="run fatscript; run mmcfitload; run linux_qspi_enable; run mmcfitboot"
+CONFIG_BOOTCOMMAND="run fatscript; run mmcfitload; run mmcfitboot"
 CONFIG_SPL_CACHE=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SPL_ATF=y
Signature · 1 line
2.13.0
#10 lore raw

PATCH v4 7/7 Makefile: socfpga: Add target to generate hex output for combined spl and dtb

In reply to Siew Chin Lim

From: Dalon Westergreen <[email protected]>

Add target to Makefile to generate "u-boot-spl-dtb.hex" for Intel SOCFPGA SOC64 devices (Stratix 10 and Agilex). "u-boot-spl-dtb.hex" is hex formatted spl with and offset of CONFIG_SPL_TEXT_BASE. It combines the spl image and dtb. "u-boot-spl-dtb.hex" is needed to generate the final configuration bitstream for Intel SOCFPGA SOC64 devices.

---
v4
---
- Replace CONFIG_TARGET_SOCFPGA_STRATIX10/AGILEX with CONFIG_TARGET_SOCFPGA_SOC64.
- Add this patch into 'VAB' series because it is depending on CONFIG_TARGET_SOCFPGA_SOC64 patch.

---
 Makefile                               | 11 ++++++-----
 include/configs/socfpga_soc64_common.h |  2 +-
 scripts/Makefile.spl                   |  7 +++++++
 3 files changed, 14 insertions(+), 6 deletions(-)
Makefile +6 -5
index 23dd11f723..dd7781b43c 100644
@@ -1263,11 +1263,6 @@ OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \
 		$(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec) \
 		$(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR),-R .bootpg -R .resetvec)
 
-OBJCOPYFLAGS_u-boot-spl.hex = $(OBJCOPYFLAGS_u-boot.hex)
-
-spl/u-boot-spl.hex: spl/u-boot-spl FORCE
-	$(call if_changed,objcopy)
-
 binary_size_check: u-boot-nodtb.bin FORCE
 	@file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \
 	map_size=$(shell cat u-boot.map | \
@@ -1931,6 +1926,12 @@ spl/u-boot-spl.bin: spl/u-boot-spl
 	@:
 	$(SPL_SIZE_CHECK)
 
+spl/u-boot-spl-dtb.bin: spl/u-boot-spl
+	@:
+
+spl/u-boot-spl-dtb.hex: spl/u-boot-spl
+	@:
+
 spl/u-boot-spl: tools prepare \
 		$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SPL_OF_PLATDATA),dts/dt.dtb) \
 		$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_TPL_OF_PLATDATA),dts/dt.dtb)
include/configs/socfpga_soc64_common.h +1 -1
index 0e54601257..1cfa190047 100644
@@ -194,7 +194,7 @@ unsigned int cm_get_l4_sys_free_clk_hz(void);
  * 0x8000_0000 ...... End of SDRAM_1 (assume 2GB)
  *
  */
-#define CONFIG_SPL_TARGET		"spl/u-boot-spl.hex"
+#define CONFIG_SPL_TARGET		"spl/u-boot-spl-dtb.hex"
 #define CONFIG_SPL_MAX_SIZE		CONFIG_SYS_INIT_RAM_SIZE
 #define CONFIG_SPL_STACK		CONFIG_SYS_INIT_SP_ADDR
 #define CONFIG_SPL_BSS_MAX_SIZE		0x100000	/* 1 MB */
scripts/Makefile.spl +7 -0
index ea4e045769..1fd63efdfd 100644
@@ -229,6 +229,8 @@ ifneq ($(CONFIG_TARGET_SOCFPGA_GEN5)$(CONFIG_TARGET_SOCFPGA_ARRIA10),)
 INPUTS-y	+= $(obj)/$(SPL_BIN).sfp
 endif
 
+INPUTS-$(CONFIG_TARGET_SOCFPGA_SOC64) += $(obj)/u-boot-spl-dtb.hex
+
 ifdef CONFIG_ARCH_SUNXI
 INPUTS-y	+= $(obj)/sunxi-spl.bin
 
@@ -389,6 +391,11 @@ $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE
 MKIMAGEFLAGS_sunxi-spl.bin = -T sunxi_egon \
 	-n $(CONFIG_DEFAULT_DEVICE_TREE)
 
+OBJCOPYFLAGS_u-boot-spl-dtb.hex := -I binary -O ihex --change-address=$(CONFIG_SPL_TEXT_BASE)
+
+$(obj)/u-boot-spl-dtb.hex: $(obj)/u-boot-spl-dtb.bin FORCE
+	$(call if_changed,objcopy)
+
 $(obj)/sunxi-spl.bin: $(obj)/$(SPL_BIN).bin FORCE
 	$(call if_changed,mkimage)
 
Signature · 1 line
2.13.0
#11 lore raw

v4 cover Add Vendor Authorized Boot (VAB) support

In reply to Siew Chin Lim

Hi All,

Please ignore this series, I accidentally create this series based on older master branch which causes patch [v4 2/7] conflict with latest master branch due to new commit about asm/global_data.h. I have rebased to latest master branch and resend the VAB series with prefix " [RESEND,v4,1/7] ...".

Thanks,
Siew Chin

Quoted 102 lines

-----Original Message-----
From: Lim, Elly Siew Chin <[email protected]>
Sent: Saturday, February 27, 2021 12:11 AM
To: u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; Tan, Ley Foon <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Westergreen, Dalon <[email protected]>; Simon Glass <[email protected]>; Gan, Yau Wai <[email protected]>; Lim, Elly Siew Chin <[email protected]>
Subject: [v4 0/7] Add Vendor Authorized Boot (VAB) support

This is the 4th version of patchset to add Vendor Authorized Boot (VAB) support for Intel Agilex SoC device.

Vendor Authorized Boot is a security feature for authenticating the images such as U-Boot, ARM trusted Firmware, Linux kernel, device tree blob and etc loaded from FIT. After those images are loaded from FIT, the VAB certificate and signature block appended at the end of each image are sent to Secure Device Manager (SDM) for authentication. U-Boot will validate the SHA384 of the image against the SHA384 hash stored in the VAB certificate before sending the image to SDM for authentication.

Patch status:
Have changes: Patch 2, 7
Other patches unchanged.

Detail changelog can find in commit message.

v3->v4:
--------
Patch 2:
- Move function 'board_fit_image_post_process' and 'board_prep_linux' from
secure_vab.c to board.c

Patch 7:
- Replace CONFIG_TARGET_SOCFPGA_STRATIX10/AGILEX with CONFIG_TARGET_SOCFPGA_SOC64.
- Add this patch into 'VAB' series because it is depending on CONFIG_TARGET_SOCFPGA_SOC64 patch.

History:
--------
[v1]:
https://patchwork.ozlabs.org/project/uboot/cover/20201110070505.26935-
1-elly.siew.chin.lim at intel.com/
[v2]:
https://patchwork.ozlabs.org/project/uboot/cover/20210107100337.45293-
1-elly.siew.chin.lim at intel.com/
[v3]:
https://patchwork.ozlabs.org/project/uboot/cover/20210205105212.16510-
1-elly.siew.chin.lim at intel.com/

Dalon Westergreen (1):
Makefile: socfpga: Add target to generate hex output for combined spl
and dtb

Siew Chin Lim (6):
arm: socfpga: Move Stratix10 and Agilex to use TARGET_SOCFPGA_SOC64
arm: socfpga: soc64: Support Vendor Authorized Boot (VAB)
arm: socfpga: cmd: Support 'vab' command
arm: socfpga: dts: soc64: Update filename in binman node of FIT image
with VAB support
configs: socfpga: soc64: Move CONFIG_BOOTCOMMAND to defconfig
configs: socfpga: Add defconfig for Agilex with VAB support

 Makefile                                           |  11 +-
 arch/arm/Kconfig                                   |   6 +-
 arch/arm/dts/socfpga_soc64_fit-u-boot.dtsi         |  22 +++
 arch/arm/mach-socfpga/Kconfig                      |  20 +++
 arch/arm/mach-socfpga/Makefile                     |   3 +
 arch/arm/mach-socfpga/board.c                      |  43 ++++-
 arch/arm/mach-socfpga/include/mach/mailbox_s10.h   |   1 +
 arch/arm/mach-socfpga/include/mach/reset_manager.h |   3 +-
 arch/arm/mach-socfpga/include/mach/secure_vab.h    |  63 +++++++
 .../arm/mach-socfpga/include/mach/system_manager.h |   3 +-
 arch/arm/mach-socfpga/secure_vab.c                 | 186
+++++++++++++++++++++
 arch/arm/mach-socfpga/vab.c                        |  34 ++++
 common/Kconfig.boot                                |   2 +-
 configs/socfpga_agilex_atf_defconfig               |   2 +
 configs/socfpga_agilex_defconfig                   |   2 +
 ..._atf_defconfig => socfpga_agilex_vab_defconfig} |   4 +
 configs/socfpga_stratix10_atf_defconfig            |   2 +
 configs/socfpga_stratix10_defconfig                |   2 +
 drivers/ddr/altera/Kconfig                         |   6 +-
 drivers/fpga/Kconfig                               |   2 +-
 drivers/sysreset/Kconfig                           |   2 +-
 include/configs/socfpga_soc64_common.h             |  10 +-
 scripts/Makefile.spl                               |   7 +
 23 files changed, 406 insertions(+), 30 deletions(-)  create mode 100644
arch/arm/mach-socfpga/include/mach/secure_vab.h
 create mode 100644 arch/arm/mach-socfpga/secure_vab.c
 create mode 100644 arch/arm/mach-socfpga/vab.c  copy

configs/{socfpga_agilex_atf_defconfig => socfpga_agilex_vab_defconfig} (91%)

--
2.13.0