All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jorge Ramirez-Ortiz <jorge@foundries.io>
To: jorge@foundries.io, monstr@monstr.eu
Cc: adrian.fiergolski@fastree3d.com, sjg@chromium.org,
	ibai.erkiaga-elorza@xilinx.com, t.karthik.reddy@xilinx.com,
	u-boot@lists.denx.de, ricardo@foundries.io
Subject: [PATCH] arm64: zynqmp: Print the secure boot status information in EL3
Date: Thu, 22 Jul 2021 13:19:32 +0200	[thread overview]
Message-ID: <20210722111932.5544-1-jorge@foundries.io> (raw)

Confirm the secure boot configuration on the console.

Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
---
 arch/arm/mach-zynqmp/include/mach/hardware.h |  3 ++-
 board/xilinx/zynqmp/zynqmp.c                 | 16 +++++++++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-zynqmp/include/mach/hardware.h b/arch/arm/mach-zynqmp/include/mach/hardware.h
index 3776499070..3d3ffa086e 100644
--- a/arch/arm/mach-zynqmp/include/mach/hardware.h
+++ b/arch/arm/mach-zynqmp/include/mach/hardware.h
@@ -139,7 +139,8 @@ struct apu_regs {
 #define ZYNQMP_SILICON_VER_SHIFT	0
 
 struct csu_regs {
-	u32 reserved0[4];
+	u32 status;
+	u32 reserved0[3];
 	u32 multi_boot;
 	u32 reserved1[11];
 	u32 idcode;
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 1748fec2e4..b7d11630d1 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -355,6 +355,18 @@ static int multi_boot(void)
 	return 0;
 }
 
+static void secure_boot(void)
+{
+	u32 status;
+
+	status = readl(&csu_base->status);
+	if (status & (BIT(0) | BIT(1))) {
+		printf("Secure Boot:\t%s%s\n",
+		       status & BIT(0) ? "authenticated" : "not authenticated",
+		       status & BIT(1) ? ", encrypted" : ", not encrypted");
+	}
+}
+
 #define PS_SYSMON_ANALOG_BUS_VAL	0x3210
 #define PS_SYSMON_ANALOG_BUS_REG	0xFFA50914
 
@@ -391,8 +403,10 @@ int board_init(void)
 	fpga_add(fpga_xilinx, &zynqmppl);
 #endif
 
-	if (current_el() == 3)
+	if (current_el() == 3) {
 		multi_boot();
+		secure_boot();
+	}
 
 	return 0;
 }
-- 
2.31.1


             reply	other threads:[~2021-07-22 11:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22 11:19 Jorge Ramirez-Ortiz [this message]
2021-07-22 16:00 ` [PATCH] arm64: zynqmp: Print the secure boot status information in EL3 Igor Opaniuk
2021-08-11 18:55 ` Jorge Ramirez-Ortiz, Foundries
2021-08-12  5:29 ` Michal Simek
2021-08-27  9:20   ` Jorge Ramirez-Ortiz, Foundries
2021-10-05 11:13 Jorge Ramirez-Ortiz
2021-10-05 11:19 ` Igor Opaniuk
2021-10-05 11:28 ` Oleksandr Suvorov
2021-10-05 12:23 ` 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=20210722111932.5544-1-jorge@foundries.io \
    --to=jorge@foundries.io \
    --cc=adrian.fiergolski@fastree3d.com \
    --cc=ibai.erkiaga-elorza@xilinx.com \
    --cc=monstr@monstr.eu \
    --cc=ricardo@foundries.io \
    --cc=sjg@chromium.org \
    --cc=t.karthik.reddy@xilinx.com \
    --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 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.