From patchwork Tue Oct 5 11:13:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jorge Ramirez-Ortiz, Foundries" X-Patchwork-Id: 1536609 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.a=rsa-sha256 header.s=google header.b=lPHd5Qqe; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HNw255ldTz9sR4 for ; Tue, 5 Oct 2021 22:13:48 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 717C881F0B; Tue, 5 Oct 2021 13:13:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.b="lPHd5Qqe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6FB13829FC; Tue, 5 Oct 2021 13:13:33 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BBCD481196 for ; Tue, 5 Oct 2021 13:13:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jorge@foundries.io Received: by mail-wm1-x334.google.com with SMTP id t16-20020a1c7710000000b003049690d882so2643954wmi.5 for ; Tue, 05 Oct 2021 04:13:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TtI/xz0Kcf6PghSGjPaXh+xF23tmSv3bnGEYidzDkL0=; b=lPHd5QqecDIZz8aHgpTxfsMINfuxO+a8X1XfwuPDfXhHAu8fpP3Y3ghJ5s1ZWi7Ujo ATY4hkpMbdmm5AFFUsv9ShPN9P30NKhm/N74uBs4HEQJaY9feNiKGOxTb/zNBscZcWeU 1OJ2To9Zq0lYZoJwlxWeov9w5UonA4BiLffV5OcE6AC1fgSXEpyVMLPVC6CY08wUzNte vI0AR/IB64ft5aMQIuuMHYEWup97LHndA3c+YlTw4bwHWobPDih2KOqxF4NXOHJU1AQa W5T+hMvm3vAa59e+KqRJF3wWx2zhd69Fe8La0sTEuwIAMYoQxnv9LyvG4jtrdXZgw4bA 5hVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TtI/xz0Kcf6PghSGjPaXh+xF23tmSv3bnGEYidzDkL0=; b=AfHlpvxk3He83Zyoum+Ds06Azb0xeJrqMwcuAl6xfRZR3Yv8z/Q05Dj+QJcKMypvuj RSN4aAJzJ4vC0tN3TWO2wJgBLT9VpUuSTg/tzt9+kul0MMiev96/1xjy6spI57IF05N6 QMHLKbRUjdPY7tecvI8L+eftg7I52Cj80QspoZEWLH4+5ukyUQkkeJmJqpA3K5aj/0kb eIaOadMlNuuUOXbubHclKGWgZ1uXSb0enSWKRLItCc2DhUTnqZOLm8HpEMLBdjh58vhy kVbGOUiUNIjhWMYBdPOGYaVgeUtp3N3V036l0rzfYrxrwyrs1ohaiJ6/IciqUm2wiFLo E0wQ== X-Gm-Message-State: AOAM533q9JymSAqLuCelJiv4rT4j4oFu7QresMvrVedcNs1+/mut5+1T QO6iVeX/pAPLYZp9jlY2QyGWhQ== X-Google-Smtp-Source: ABdhPJwWTLxlb5Ve25BNcgmemkhN5BGtpyii1OeFI0JiciykDZJMDBo9BXh/L5OOV9Ejt9AlsPo/jQ== X-Received: by 2002:a05:600c:4ec8:: with SMTP id g8mr2794322wmq.56.1633432410324; Tue, 05 Oct 2021 04:13:30 -0700 (PDT) Received: from localhost.localdomain (197.red-79-154-202.dynamicip.rima-tde.net. [79.154.202.197]) by smtp.gmail.com with ESMTPSA id i92sm16882825wri.28.2021.10.05.04.13.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Oct 2021 04:13:29 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge@foundries.io, michal.simek@xilinx.com, trini@konsulko.com, sjg@chromium.org, mr.nuke.me@gmail.com Cc: u-boot@lists.denx.de, ricardo@foundries.io, mike@foundries.io, igor.opaniuk@foundries.io Subject: [PATCH] arm64: zynqmp: Print the secure boot status information in EL3 Date: Tue, 5 Oct 2021 13:13:22 +0200 Message-Id: <20211005111324.19749-1-jorge@foundries.io> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Confirm the secure boot configuration on the console. Signed-off-by: Jorge Ramirez-Ortiz Reviewed-by: Igor Opaniuk Acked-by: Oleksandr Suvorov --- 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; }