Skip to contentSkip to conversation

arm64: zynqmp: Print the secure boot status information

PATCH Applied Jorge Ramirez-Ortiz 3 participants 5 messages Oct 13, 2021 – Feb 4, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 arm64: zynqmp: Print the secure boot status information

Output the secure boot configuration to the console.

---

v2:
Michal review 12 Aug 2021
print information on SPL and UBOOT
improve the print command
add macros to mask the status

 arch/arm/mach-zynqmp/include/mach/hardware.h |  6 +++++-
 board/xilinx/zynqmp/zynqmp.c                 | 14 ++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
arch/arm/mach-zynqmp/include/mach/hardware.h +5 -1
index eebf38551c..c6b1464a9f 100644
@@ -141,8 +141,12 @@ struct apu_regs {
 #define ZYNQMP_SILICON_VER_MASK		0xF
 #define ZYNQMP_SILICON_VER_SHIFT	0
 
+#define ZYNQMP_CSU_STATUS_AUTHENTICATED	BIT(0)
+#define ZYNQMP_CSU_STATUS_ENCRYPTED	BIT(1)
+
 struct csu_regs {
-	u32 reserved0[4];
+	u32 status;
+	u32 reserved0[3];
 	u32 multi_boot;
 	u32 reserved1[11];
 	u32 idcode;
board/xilinx/zynqmp/zynqmp.c +14 -0
index 000a7cde8d..3e7ca2e9c6 100644
@@ -358,6 +358,18 @@ static int multi_boot(void)
 	return multiboot;
 }
 
+static void print_secure_boot(void)
+{
+	u32 status = 0;
+
+	if (zynqmp_mmio_read((ulong)&csu_base->status, &status))
+		return;
+
+	printf("Secure Boot:\t%sauthenticated, %sencrypted\n",
+	       status & ZYNQMP_CSU_STATUS_AUTHENTICATED ? "" : "not ",
+	       status & ZYNQMP_CSU_STATUS_ENCRYPTED ? "" : "not ");
+}
+
 #define PS_SYSMON_ANALOG_BUS_VAL	0x3210
 #define PS_SYSMON_ANALOG_BUS_REG	0xFFA50914
 
@@ -394,6 +406,8 @@ int board_init(void)
 	fpga_add(fpga_xilinx, &zynqmppl);
 #endif
 
+	/* display secure boot information */
+	print_secure_boot();
 	if (current_el() == 3)
 		printf("Multiboot:\t%d\n", multi_boot());
 
Signature · 1 line
2.31.1
#1 lore raw
Quoted 1 line · Jorge Ramirez-Ortiz

Output the secure boot configuration to the console.

Hi, Michal
was there any reason for not merging this patch?
thanks
Jorge

Quoted 67 lines

---

v2:
Michal review 12 Aug 2021
print information on SPL and UBOOT
improve the print command
add macros to mask the status

 arch/arm/mach-zynqmp/include/mach/hardware.h |  6 +++++-
 board/xilinx/zynqmp/zynqmp.c                 | 14 ++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
arch/arm/mach-zynqmp/include/mach/hardware.h +5 -1
index eebf38551c..c6b1464a9f 100644
@@ -141,8 +141,12 @@ struct apu_regs {
 #define ZYNQMP_SILICON_VER_MASK		0xF
 #define ZYNQMP_SILICON_VER_SHIFT	0
 
+#define ZYNQMP_CSU_STATUS_AUTHENTICATED	BIT(0)
+#define ZYNQMP_CSU_STATUS_ENCRYPTED	BIT(1)
+
 struct csu_regs {
-	u32 reserved0[4];
+	u32 status;
+	u32 reserved0[3];
 	u32 multi_boot;
 	u32 reserved1[11];
 	u32 idcode;
board/xilinx/zynqmp/zynqmp.c +14 -0
index 000a7cde8d..3e7ca2e9c6 100644
@@ -358,6 +358,18 @@ static int multi_boot(void)
 	return multiboot;
 }
 
+static void print_secure_boot(void)
+{
+	u32 status = 0;
+
+	if (zynqmp_mmio_read((ulong)&csu_base->status, &status))
+		return;
+
+	printf("Secure Boot:\t%sauthenticated, %sencrypted\n",
+	       status & ZYNQMP_CSU_STATUS_AUTHENTICATED ? "" : "not ",
+	       status & ZYNQMP_CSU_STATUS_ENCRYPTED ? "" : "not ");
+}
+
 #define PS_SYSMON_ANALOG_BUS_VAL	0x3210
 #define PS_SYSMON_ANALOG_BUS_REG	0xFFA50914
 
@@ -394,6 +406,8 @@ int board_init(void)
 	fpga_add(fpga_xilinx, &zynqmppl);
 #endif
 
+	/* display secure boot information */
+	print_secure_boot();
 	if (current_el() == 3)
 		printf("Multiboot:\t%d\n", multi_boot());
 
Signature · 1 line
2.31.1
#2 lore raw

Hi,

pá 4. 2. 2022 v 8:47 odesílatel Jorge Ramirez-Ortiz, Foundries <[email protected]> napsal:

Quoted 7 lines · Jorge Ramirez-Ortiz
Quoted 1 line

Output the secure boot configuration to the console.

Hi, Michal
was there any reason for not merging this patch?

thanks for the reminder. I just didn't see it.

Thanks,
Michal

#3 lore raw
Quoted 5 lines · Michal Simek

Hi,

pá 4. 2. 2022 v 8:47 odesílatel Jorge Ramirez-Ortiz, Foundries <[email protected]> napsal:

Quoted 1 line
Quoted 8 lines
Quoted 6 lines · Jorge Ramirez-Ortiz
Quoted 1 line

Output the secure boot configuration to the console.

Hi, Michal
was there any reason for not merging this patch?

thanks for the reminder. I just didn't see it.

awesome. thanks!

Quoted 3 lines

Thanks,
Michal

Applied
#4 lore raw
In reply to Jorge Ramirez-Ortiz
Quoted 57 lines · Jorge Ramirez-Ortiz

Output the secure boot configuration to the console.

---

v2:
Michal review 12 Aug 2021
print information on SPL and UBOOT
improve the print command
add macros to mask the status

  arch/arm/mach-zynqmp/include/mach/hardware.h |  6 +++++-
  board/xilinx/zynqmp/zynqmp.c                 | 14 ++++++++++++++
  2 files changed, 19 insertions(+), 1 deletion(-)
arch/arm/mach-zynqmp/include/mach/hardware.h +5 -1
index eebf38551c..c6b1464a9f 100644
@@ -141,8 +141,12 @@ struct apu_regs {
  #define ZYNQMP_SILICON_VER_MASK		0xF
  #define ZYNQMP_SILICON_VER_SHIFT	0
 
+#define ZYNQMP_CSU_STATUS_AUTHENTICATED	BIT(0)
+#define ZYNQMP_CSU_STATUS_ENCRYPTED	BIT(1)
+
  struct csu_regs {
-	u32 reserved0[4];
+	u32 status;
+	u32 reserved0[3];
  	u32 multi_boot;
  	u32 reserved1[11];
  	u32 idcode;
board/xilinx/zynqmp/zynqmp.c +12 -0
index 000a7cde8d..3e7ca2e9c6 100644
@@ -358,6 +358,18 @@ static int multi_boot(void)
  	return multiboot;
  }
 
+static void print_secure_boot(void)
+{
+	u32 status = 0;
+
+	if (zynqmp_mmio_read((ulong)&csu_base->status, &status))
+		return;
+
+	printf("Secure Boot:\t%sauthenticated, %sencrypted\n",
+	       status & ZYNQMP_CSU_STATUS_AUTHENTICATED ? "" : "not ",
+	       status & ZYNQMP_CSU_STATUS_ENCRYPTED ? "" : "not ");
+}
+
  #define PS_SYSMON_ANALOG_BUS_VAL	0x3210
  #define PS_SYSMON_ANALOG_BUS_REG	0xFFA50914
 

board/xilinx/zynqmp/zynqmp.c int board_init(void) · line 413

Quoted 8 lines
board/xilinx/zynqmp/zynqmp.c +2 -0
@@ -394,6 +406,8 @@ int board_init(void)
  	fpga_add(fpga_xilinx, &zynqmppl);
  #endif
 
+	/* display secure boot information */
+	print_secure_boot();
  	if (current_el() == 3)
  		printf("Multiboot:\t%d\n", multi_boot());
 

Applied.
M