From patchwork Thu Apr 20 12:29:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ivan T . Ivanov" X-Patchwork-Id: 13218702 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C1EB2C77B7C for ; Thu, 20 Apr 2023 12:30:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=S9FV2FZ2XvoB6Eaam97OoxDFRMEtJX+uOKESnF8w/x4=; b=RG64zcdmsKvlqI OcyDKlcA1d/mxPyIZ6lVP2/luo45A9dlSzR9woh7gm0xrtdq6KOygc8xQ3pnKkp7xU1V6gL+3GpVD k6/auAyLBG/YT1HdjdaZ7Vcviy1e4Gp1uj64+cRz62O5cJ9SaaibIObxyMQ0yIAYaKPrfxTJ/1u/G PwY93PJHWgZQpUhPJjkil5SuitjymfP89az+7zGWdsVAgkFuRFpZnPeWVROAomBHyGyFHpg7bJFSe ZZToBqiubfQqF95mgpBDZD7Ej6g2CgB15anK3luNSE/UnKjCrjTlgveco533wg0j2JtIGXXbOVi7a Mo8ACqJQWMnFR97ivZDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ppTQ5-0083hu-0R; Thu, 20 Apr 2023 12:29:49 +0000 Received: from smtp-out1.suse.de ([2001:67c:2178:6::1c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ppTQ1-0083gM-2V; Thu, 20 Apr 2023 12:29:47 +0000 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 594AF219E9; Thu, 20 Apr 2023 12:29:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1681993784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UuSrP+8SJkpdoPBxCBowJ+DnkR7MI35JUEvk9XwrMdA=; b=o7/kSD9c1Lg+Z5r5xGW2/66xE/yJcRRcEN2hxClLe+wgviUNPEs+TcsjRc1YUvwM/NWZ+L dKjSpA2I9IIJ+AUbq0c1+FniM/+4i2USQDxi8wu62pEF0mpiFe4bNTl/UOYOIET66UQmPG gku3vlLqsrCtu3nJMB6SYEkbJqmpkdI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1681993784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UuSrP+8SJkpdoPBxCBowJ+DnkR7MI35JUEvk9XwrMdA=; b=oFFxbo3zApxTcUQvPc/eAmjsYhs4urrx4at7ACIo4TJebbbeRKmh3ntPlH1R2ajCKJgAMH 2rfwvTN/B9W7c7Dw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 4A508139EC; Thu, 20 Apr 2023 12:29:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id cFTyETgwQWSueQAAMHmgww (envelope-from ); Thu, 20 Apr 2023 12:29:44 +0000 From: "Ivan T. Ivanov" To: Srinivas Kandagatla , Rob Herring , Krzysztof Kozlowski Cc: Nicolas Saenz Julienne , Florian Fainelli , Stefan Wahren , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, "Ivan T. Ivanov" Subject: [PATCH v3 1/3] dt-bindings: nvmem: rmem: Add raspberrypi,bootloader-public-key Date: Thu, 20 Apr 2023 15:29:22 +0300 Message-Id: <20230420122924.37997-2-iivanov@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230420122924.37997-1-iivanov@suse.de> References: <20230420122924.37997-1-iivanov@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230420_052945_961855_3F41C2D1 X-CRM114-Status: UNSURE ( 8.65 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On RPi4 the bootloader[1] will copy the binary public key blob (if present) into memory location specified by this node, for use by the OS. [1] https://www.raspberrypi.com/documentation/computers/configuration.html#nvmem-nodes Signed-off-by: Ivan T. Ivanov Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/nvmem/rmem.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/nvmem/rmem.yaml b/Documentation/devicetree/bindings/nvmem/rmem.yaml index a4a755dcfc43..566eff3d1061 100644 --- a/Documentation/devicetree/bindings/nvmem/rmem.yaml +++ b/Documentation/devicetree/bindings/nvmem/rmem.yaml @@ -17,6 +17,7 @@ properties: items: - enum: - raspberrypi,bootloader-config + - raspberrypi,bootloader-public-key - const: nvmem-rmem reg: From patchwork Thu Apr 20 12:29:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ivan T . Ivanov" X-Patchwork-Id: 13218704 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 10DC8C77B72 for ; Thu, 20 Apr 2023 12:30:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=d7dZXYkmJVapw/BdQiRavk5wbIZVVgaFVwwO2Q/iIYU=; b=DMFrCJ/fJybJtA gxGZtoepG31EGXkXynAcyTigjzx+2fK+3CPSr6E/9aj6F7yY4UMzinjcSFzRpLKjpaIePDAGGdu4h 4KNTz93CezqTtP5BHEiFQrEhf7ApsDQHL9vEsgAyngwrMWa+G49uf/iIkQOXjBuy71GiXFM5ukIXW 47mbvnwXNn0qdtcqWXj4bBEpc31Ub4VdcsB4pUAxHevalnr7XinEh2urlKoH1brSFl4ZiWXp7+1F2 S57qrN1uxy3r3U72ABFrKVhZnXanydWwhedblYYpZAElXmLCTOO+wqGnP4Ojm/ZmgjR2e9SRXKQFX qHhL58IeEoM70Sr7zmxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ppTQH-0083lp-1d; Thu, 20 Apr 2023 12:30:01 +0000 Received: from smtp-out1.suse.de ([195.135.220.28]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ppTQ3-0083gO-14; Thu, 20 Apr 2023 12:29:49 +0000 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 7143D219FF; Thu, 20 Apr 2023 12:29:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1681993784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n7KqzZ53Bqetayq7fLUITqZmZD9Kd9Jl8L8VLaUQzHM=; b=KCbZGP1+PpPX8QfoEh/2gGuzNBqeyu5sTWF/7diLKSbP8xZbMisn6uxjldzwW1PTA17tnH lD9fAKSohdHEs38gVc83Xfil6KISa4SmXm3BvU+3rUWxLlZBuof2J0BBAfNBs8FNc8VUHr pfiwqPG+XiKQrGgyGSLeBwcXa/eJZt0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1681993784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n7KqzZ53Bqetayq7fLUITqZmZD9Kd9Jl8L8VLaUQzHM=; b=a6o5UBbQnyceSVkmX2w8xUbJrx4M99I2Svvdf6rNUYmHMZR+Mb7q6YOPOU4N1/xF9q87RM wfba/cdUsbh88YAQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 57F0D1333C; Thu, 20 Apr 2023 12:29:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wFNUFTgwQWSueQAAMHmgww (envelope-from ); Thu, 20 Apr 2023 12:29:44 +0000 From: "Ivan T. Ivanov" To: Srinivas Kandagatla , Rob Herring , Krzysztof Kozlowski Cc: Nicolas Saenz Julienne , Florian Fainelli , Stefan Wahren , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Tim Gover , "Ivan T . Ivanov" Subject: [PATCH v3 2/3] ARM: dts: Add nvmem node for BCM2711 bootloader public key Date: Thu, 20 Apr 2023 15:29:23 +0300 Message-Id: <20230420122924.37997-3-iivanov@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230420122924.37997-1-iivanov@suse.de> References: <20230420122924.37997-1-iivanov@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230420_052947_516872_5C9C87B0 X-CRM114-Status: GOOD ( 11.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Tim Gover Make a copy of the bootloader secure-boot public key available to the OS via an nvmem node. The placement information is populated by the Raspberry Pi firmware[1] if a public key is present in the BCM2711 bootloader EEPROM. [1] https://www.raspberrypi.com/documentation/computers/configuration.html#nvmem-nodes Signed-off-by: Tim Gover [iivanov] Added link to documentation. Signed-off-by: Ivan T. Ivanov --- arch/arm/boot/dts/bcm2711-rpi.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/arm/boot/dts/bcm2711-rpi.dtsi b/arch/arm/boot/dts/bcm2711-rpi.dtsi index 98817a6675b9..e30fbe84f9c3 100644 --- a/arch/arm/boot/dts/bcm2711-rpi.dtsi +++ b/arch/arm/boot/dts/bcm2711-rpi.dtsi @@ -15,6 +15,7 @@ aliases { ethernet0 = &genet; pcie0 = &pcie0; blconfig = &blconfig; + blpubkey = &blpubkey; }; }; @@ -67,6 +68,19 @@ blconfig: nvram@0 { no-map; status = "disabled"; }; + + /* + * RPi4 will copy the binary public key blob (if present) from the bootloader + * into memory for use by the OS. + */ + blpubkey: nvram@1 { + compatible = "raspberrypi,bootloader-public-key", "nvmem-rmem"; + #address-cells = <1>; + #size-cells = <1>; + reg = <0x0 0x0 0x0>; + no-map; + status = "disabled"; + }; }; &v3d { From patchwork Thu Apr 20 12:29:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ivan T . Ivanov" X-Patchwork-Id: 13218701 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0A781C77B73 for ; Thu, 20 Apr 2023 12:30:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dbnj222f2CXX2V65nUOpK3UD79rfUKnoGRQtsUkJYBg=; b=B0W7uB61zw8Pgz 4mFVL076oDMyZfpxhssMXGaasmrVaXpNEmd0WQH2MHY2H7WNIYj35RQJM1fYjpqf+eSLbWpGnd1QN HVS2PcdEWW0IcBRHfWZfc+eGYSLntQ8RuQpgegT5j6/d1AgAmpw1C3qxhgk9dHJm0lSAg+HmNJM+B XViHz4PQ7ftspqYXM/M014cquVg2heARrUykxAe9k+Wsvp0njzllt+0lou5Cijmf05ZhM0tm1cQMZ LX8ND/AlSae1yTtMXDf+aQoENo5plL5qFy+6Bx11KLqfAEO61PeSxDENktAZrHl5C9pqt/hr35SPx NpLUR9Ba/f9ntDIRmA0g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ppTQ6-0083iq-2m; Thu, 20 Apr 2023 12:29:50 +0000 Received: from smtp-out2.suse.de ([195.135.220.29]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ppTQ2-0083gN-2C; Thu, 20 Apr 2023 12:29:48 +0000 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 7ED311FDBA; Thu, 20 Apr 2023 12:29:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1681993784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ear+cnYjNr0Xxid0IYuEKGOWEhCYOcJOGEYisWpZTKo=; b=lTQBsRPImul/dzDjRLdSIxIYhzoWqMD5MjvoLJZ686GUZGGYZ5lpA+OHvB7fV9XSv0EI8u WgJnSTeTbXdjHVWoqF8/vIZO73ek//GuUgRAzpoB6z+nB1OznLRyusZb6EFq1e5yrfPNDO mJ2+EYDfBZ7fjaoC59ayXrItpFphips= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1681993784; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ear+cnYjNr0Xxid0IYuEKGOWEhCYOcJOGEYisWpZTKo=; b=DPndw74uEj69h/W8wXdFqD9/L0dXdLnsFhBJbZfXHS8VDiSMOxgKoXEXtTLn5qh1NCYiK+ Xt/zBCSNKpRBUdBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6E8BC139EC; Thu, 20 Apr 2023 12:29:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id aOPVGjgwQWSueQAAMHmgww (envelope-from ); Thu, 20 Apr 2023 12:29:44 +0000 From: "Ivan T. Ivanov" To: Srinivas Kandagatla , Rob Herring , Krzysztof Kozlowski Cc: Nicolas Saenz Julienne , Florian Fainelli , Stefan Wahren , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Phil Elwell , "Ivan T . Ivanov" Subject: [PATCH v3 3/3] nvmem: rmem: Use NVMEM_DEVID_AUTO Date: Thu, 20 Apr 2023 15:29:24 +0300 Message-Id: <20230420122924.37997-4-iivanov@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230420122924.37997-1-iivanov@suse.de> References: <20230420122924.37997-1-iivanov@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230420_052946_864639_867DBC41 X-CRM114-Status: GOOD ( 10.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Phil Elwell It is reasonable to declare multiple nvmem blocks. Unless a unique 'id' is passed in for each block there may be name clashes. Avoid this by using the magic token NVMEM_DEVID_AUTO. Fixes: 5a3fa75a4d9cb ("nvmem: Add driver to expose reserved memory as nvmem") Signed-off-by: Phil Elwell Signed-off-by: Ivan T. Ivanov --- drivers/nvmem/rmem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/nvmem/rmem.c b/drivers/nvmem/rmem.c index 80cb187f1481..752d0bf4445e 100644 --- a/drivers/nvmem/rmem.c +++ b/drivers/nvmem/rmem.c @@ -71,6 +71,7 @@ static int rmem_probe(struct platform_device *pdev) config.dev = dev; config.priv = priv; config.name = "rmem"; + config.id = NVMEM_DEVID_AUTO; config.size = mem->size; config.reg_read = rmem_read;