From patchwork Sat Oct 5 05:01:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Edwards X-Patchwork-Id: 13823101 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 BD0ACCF8861 for ; Sat, 5 Oct 2024 05:07:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Z4vQ/wHK+j/kiLmDR1amyCdiI1kzw4/23edhXgv3i5M=; b=KmXHvNLu6snGc21PEgGh00czfD l3m+4nh4ilcy9hIH/Ooktj4WRaCbjEq13X14YJv64a6gQKwB20e3uA3oOITqsIQxC1ENsYFx8WpNI 0/pBZOC4Uh4vnOn3quZLE/KmvqukkK0hSW+6DKCaKXC4/Uf9HaRh5lcRObxlRgq0tR9/ahWtteN9T IULdmHcTzzHpgQZTUXMFFNRDwGTxgIKe/1XmU7KTGSe/jd5fxNuzCbvgRJffM6/lZ3IpyG2+JADkM OAKqlS3kkoMf5SR+tTkJGuBrolN5NmVtGcfEdqGblRk99nvCb2KzHnKncIci+ncU89htMqxQVYFCJ Mi/XrJGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1swx0o-0000000EmUR-3jcP; Sat, 05 Oct 2024 05:07:26 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1swwy8-0000000EmCN-07R7 for linux-arm-kernel@lists.infradead.org; Sat, 05 Oct 2024 05:04:41 +0000 Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2e07d85e956so2356025a91.3 for ; Fri, 04 Oct 2024 22:04:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728104679; x=1728709479; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z4vQ/wHK+j/kiLmDR1amyCdiI1kzw4/23edhXgv3i5M=; b=BmavryYppGW1FmCCkjojZwcYgEXQ3S43PZvkqX/Q7VZQmNQHHTMV0qqRX/2GMxyt5q DJ7p/g9GHoq+hAuD77up6MV/L47tAbGQdAXLs22jrQmTjZKdZGNZoFChu5Rs6cCXXFCH wBtIak7qsJXWQyAKYK1IA54HVnnClRanZMRHE2cdXqhp0rsxx2DRRRQBwVix0VxYi1Mx XMQJcK0nlfu0UPePu1HGtsX3jiuPd7WMRS0MzN6RWGZoI6X8JTtp+DsS5rYwei70Focz SE5l9wTclZ1ZYmscY+cWycs6Kgwqy9Ysq7WIbDLNQTMRhFXqS8QZh7p9f57PKiartp3K Jsjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728104679; x=1728709479; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z4vQ/wHK+j/kiLmDR1amyCdiI1kzw4/23edhXgv3i5M=; b=UZRH1SP2UHZ5Gihno5rpox/pDjqUS7pBE81gwoZbFbV2eLPtMTMB0vcEz5WCn9AZYk Shk43rq4XIUqTWnrnVxyTV10SFOWmgn0pv4rKqAvfDIC4YXgx3Nr4+UBs7jXtiRXswaI wiocYcqnEPy74I71xNuily/aEfsTXpzodTO7hJxdaWvb19J1HFK4/OtglBr00Cqvwruc 0DNdXerf7ziSyuTJuS2lEhz0Rs/G/NJSyjFBZfgnviqSHHCS4tvzI1gXeg2/QNiOitmd 9Z8NPH1ri2oGW3Oe9qeBfOWZ6xXcryTdU8YVaxjPJseI0mry1i9cbph13v0UKpiRwUQB BNJQ== X-Forwarded-Encrypted: i=1; AJvYcCX6SwGlgfDqOGrjdV8VjizSCtIGL07xZi5Up4c+Dkb/7v3ztLSNARatHB6INWtEgxgtATVS2v676e1ArxKaq2Qi@lists.infradead.org X-Gm-Message-State: AOJu0YyK+qRnR4uFv3HerT48Omgv2jJEvAUdSl1fbt1emtyjKKh16UPJ /hy8eDE6/4OdxHoXErPcXnCNWISNhbkOca63nOsrUGeW1wfMBTBD X-Google-Smtp-Source: AGHT+IE7UAQiHWty60M82Q5LlDvs1wEvJRo5PR3IumIPHipsvTER2MS5gD2zN0KTu2dnsqvsUQEUpg== X-Received: by 2002:a17:90b:4f87:b0:2db:df68:52ae with SMTP id 98e67ed59e1d1-2e1e621d0a6mr5411826a91.14.1728104678705; Fri, 04 Oct 2024 22:04:38 -0700 (PDT) Received: from celestia.turtle.lan ([2601:1c2:c184:dc00:ed3:4cda:b368:ce98]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e1e85db34fsm2625744a91.33.2024.10.04.22.04.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Oct 2024 22:04:37 -0700 (PDT) From: Sam Edwards X-Google-Original-From: Sam Edwards To: Florian Fainelli , =?utf-8?b?UmFmYcWCIE1p?= =?utf-8?b?xYJlY2tp?= , William Zhang , Anand Gore , Kursad Oney Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Broadcom internal kernel review list , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sam Edwards Subject: [PATCH v2 1/2] arm64: dts: broadcom: bcmbca: bcm4908: Reserve CFE stub area Date: Fri, 4 Oct 2024 22:01:54 -0700 Message-ID: <20241005050155.61103-2-CFSworks@gmail.com> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20241005050155.61103-1-CFSworks@gmail.com> References: <20241005050155.61103-1-CFSworks@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241004_220440_110253_AA1C8073 X-CRM114-Status: GOOD ( 14.61 ) 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 The CFE bootloader places a stub program in the first page of physical memory to hold the secondary CPUs until the boot CPU writes the release address, but does not splice a /reserved-memory node into the FDT to protect it. If Linux overwrites this program before execution reaches smp_prepare_cpus(), the secondary CPUs may become inaccessible. This is only a problem with CFE, and then only until the secondary CPUs are brought online. Ideally, there would be some hypothetical mechanism we could use to indicate that this area of memory is sensitive only during boot. But as there is none, and since it is such a small amount of memory, it is easiest to reserve it unconditionally. Therefore, add a /reserved-memory node to bcm4908.dtsi to protect the first 4KiB of physical memory. Signed-off-by: Sam Edwards --- arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi b/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi index 8b924812322c..c51b92387fad 100644 --- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi @@ -68,6 +68,16 @@ l2: l2-cache0 { }; }; + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + cfe-stub@0 { + reg = <0x0 0x0 0x0 0x1000>; + }; + }; + axi@81000000 { compatible = "simple-bus"; #address-cells = <1>; From patchwork Sat Oct 5 05:01:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Edwards X-Patchwork-Id: 13823102 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 D9E82CF8861 for ; Sat, 5 Oct 2024 05:08:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=xhYJFY/3ez6e12f4SS2gZFove6N9JarO3wcT3pL3TYY=; b=EMXzk1I5LghLRNoC+kJmGQ4Rxx ugt/4sCHv4kahTXnbk15ealLdPwF/9s7HO4CU+JvSZ60npAxHFSve20oBLzJBmIUF8uyNdihjKxgp QNfsIcpJz68rHf8+8beqH5XcJyzdVT3GBQVZT8+IHaIlXCHSH5TC93CaatFk2dQ5B90WJDYHvVsIP pWjMgI//b5+BlSWtwFuG7gjvUE4qaPs6L1y/GC1vKcucvPJQtS27GSaT+AYHNmvB+g19CXY5MkDen 1edYHagD90tWoajDZlr8r0ECTc8rcSGWGSG5AhjRWevUdVd+xFZtgZTX3Uu0hX69rjX4uypPtxFEP 8FuUKP0g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1swx23-0000000Emcj-0h3m; Sat, 05 Oct 2024 05:08:43 +0000 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1swwy9-0000000EmCl-200t for linux-arm-kernel@lists.infradead.org; Sat, 05 Oct 2024 05:04:42 +0000 Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-2e137183587so2386193a91.3 for ; Fri, 04 Oct 2024 22:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728104680; x=1728709480; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xhYJFY/3ez6e12f4SS2gZFove6N9JarO3wcT3pL3TYY=; b=CuadyAtn1DCUJgtxEWQ5DMoitpGbo7pih5LbBQSNtf9HEYr2cUn8vdcfJ+6Vi+2Mc/ Ooq9/YU95TZipvR49PqRPnBccY8foXfzAch//foTb7qXKGizuEz3zrjCvMLKOUgHM438 fn7UhRNGedMg+l6exhSQctGANOyTPE4thOT1uKTS/DnwqbggjhIrW0U/GHM4GF37o4fB EvMJ+D4OJ+5n6r5BMt326JA2TDE0F5dkWnW+jw/Pb1D1K6+pukZsrIwilYEwMbk5wr+t fTUDYtYkpnD+coW4odc7yDnmVb5RLAmlLx6WmhP6eZJO8dTKAEDza4s2ZEtZ3Cmb9beC bqdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728104680; x=1728709480; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xhYJFY/3ez6e12f4SS2gZFove6N9JarO3wcT3pL3TYY=; b=fHdOiAAXKCdO+ztlI1kmOx5nybSQ7KcyV5y9cMegtY8S8DSPLetTULWsgXJnsZhEdq /IHj9Ik7cIBpzA6y7k+4d1Y6z67B6ShPg50TWpX891CNi5/njIWTE6al8lbJMezEkuOd eBirHRSUzQeFkAGITyoZkn7TswxaL7RrxQrcRxOZjaj/Slbm+rHOGNru/4wuo5zYdxfP uTTORLsgRyxP3pRepcZQnZVAYBMEMVSU0MuqU2T8JQUfpyZMgpbp7g8c0LyrpfVP9PRY KNxbFMWxeFwxAB9Smrbm9nnDrBjSJIX2OApepFDh8ZSKjbApwYKaLLbHRj199KNBIVbX 8kBA== X-Forwarded-Encrypted: i=1; AJvYcCVbqFd/6f+bDPAc1VFlLFKfglF+vhst1Lsq4Vpmo+03pXdnOdUB0GxtXfmLhKnRiAIED47nHfuyfjiVIIsbQUqC@lists.infradead.org X-Gm-Message-State: AOJu0YxJLZ4Udn91FbGy3pk1mNAyhXypiOVaDgDEYYWLEfxT5/Bo4zl+ F4wJtjw6enC1plRQ85+X+cgtKJJMCBTbqFqqD3lGRL1/ViAsvXeb X-Google-Smtp-Source: AGHT+IFqU/bD9owh44BLnO7Dt8lW7NUUiiNoXHDfrVl05qMKf92usq8r5t6nJNkTf762XBPm1PCy4A== X-Received: by 2002:a17:90a:7085:b0:2e0:a931:cb11 with SMTP id 98e67ed59e1d1-2e1e6213282mr6114447a91.4.1728104680268; Fri, 04 Oct 2024 22:04:40 -0700 (PDT) Received: from celestia.turtle.lan ([2601:1c2:c184:dc00:ed3:4cda:b368:ce98]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e1e85db34fsm2625744a91.33.2024.10.04.22.04.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Oct 2024 22:04:39 -0700 (PDT) From: Sam Edwards X-Google-Original-From: Sam Edwards To: Florian Fainelli , =?utf-8?b?UmFmYcWCIE1p?= =?utf-8?b?xYJlY2tp?= , William Zhang , Anand Gore , Kursad Oney Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Broadcom internal kernel review list , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sam Edwards Subject: [PATCH v2 2/2] arm64: dts: broadcom: bcmbca: bcm4908: Protect cpu-release-addr Date: Fri, 4 Oct 2024 22:01:55 -0700 Message-ID: <20241005050155.61103-3-CFSworks@gmail.com> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20241005050155.61103-1-CFSworks@gmail.com> References: <20241005050155.61103-1-CFSworks@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241004_220441_547447_15688CCC X-CRM114-Status: GOOD ( 14.20 ) 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 The `cpu-release-addr` property is relevant only when the "spin-table" enable method is used. It is the physical address where the bootloader expects Linux to write the secondary CPU entry point's physical address. On this platform, only the CFE bootloader uses this method: U-Boot uses PSCI instead. CFE actually walks the FDT to learn this address, so we're free to put it wherever we want. We only need to make sure that it goes in a reserved-memory block so that writing to it during early boot does not risk conflicting with an unrelated memory allocation: this was not done. Since the previous patch reserved the first page of memory for CFE's secondary-CPU init stub, which is actually much smaller than a page, just put this address at the end of that page and it shall be so protected. Signed-off-by: Sam Edwards --- arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi b/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi index c51b92387fad..613ba7ee43d6 100644 --- a/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcmbca/bcm4908.dtsi @@ -30,7 +30,7 @@ cpu0: cpu@0 { compatible = "brcm,brahma-b53"; reg = <0x0>; enable-method = "spin-table"; - cpu-release-addr = <0x0 0xfff8>; + cpu-release-addr = <0x0 0xff8>; next-level-cache = <&l2>; }; @@ -39,7 +39,7 @@ cpu1: cpu@1 { compatible = "brcm,brahma-b53"; reg = <0x1>; enable-method = "spin-table"; - cpu-release-addr = <0x0 0xfff8>; + cpu-release-addr = <0x0 0xff8>; next-level-cache = <&l2>; }; @@ -48,7 +48,7 @@ cpu2: cpu@2 { compatible = "brcm,brahma-b53"; reg = <0x2>; enable-method = "spin-table"; - cpu-release-addr = <0x0 0xfff8>; + cpu-release-addr = <0x0 0xff8>; next-level-cache = <&l2>; }; @@ -57,7 +57,7 @@ cpu3: cpu@3 { compatible = "brcm,brahma-b53"; reg = <0x3>; enable-method = "spin-table"; - cpu-release-addr = <0x0 0xfff8>; + cpu-release-addr = <0x0 0xff8>; next-level-cache = <&l2>; };