From patchwork Thu Jan 19 04:36:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 9525165 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7BB6C60437 for ; Thu, 19 Jan 2017 04:37:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C9BE28642 for ; Thu, 19 Jan 2017 04:37:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F6D728646; Thu, 19 Jan 2017 04:37:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DC2A628642 for ; Thu, 19 Jan 2017 04:37:01 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cU4Sy-0003YB-Pn; Thu, 19 Jan 2017 04:36:52 +0000 Received: from mail-pf0-x231.google.com ([2607:f8b0:400e:c00::231]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cU4Sl-0003JN-98 for linux-amlogic@lists.infradead.org; Thu, 19 Jan 2017 04:36:41 +0000 Received: by mail-pf0-x231.google.com with SMTP id 189so9999913pfu.3 for ; Wed, 18 Jan 2017 20:36:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:organization:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=yllRUxCQpzstOxcadYpXDIPmNwvNvh5XQac87XWBVHQ=; b=RHKFgowoee2+49Pt90sh3p/r3ZrxVpyw0BDYou6C55z+289l7VvvxznwoGH0asThLq /U0ViWoehcMG63EDoZB8Im2gLgfwCXnmJdSKg+E2ixMgPHKYM8nYWae/lWJiw7Gg7aIE VOjWXUp3aoWX+cd6EQxMrtriSTvhLfF4aaW88NEKip8G00JVGLCdAqwBTbyOtTuecvin lmiF1gLKAJh1F89v8bKuMT9pvedCELqoTwZn4PFz5Ju3bn87dqDDmLyZP2QJNBOTy8Fu /yAKYNhOju8B2TQwQnPyJ08pbJmyjKh8ule3ZFP6JBOhQNn7rRXC3w/wGR26TvU9GKJ0 aAiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:organization:references:date :in-reply-to:message-id:user-agent:mime-version :content-transfer-encoding; bh=yllRUxCQpzstOxcadYpXDIPmNwvNvh5XQac87XWBVHQ=; b=fhNxvbibHGzcDL9qtlgybIsL/F+eMK+KJaIE1RkPfWj9+gp6sCfW7AmgvAPOKW6hMK DhMSip8+334zEcMiam06vhRc3gmGaTDQFgvW9DOTckBTINhpny15q6o6/MpUqR0XHlkl JAiO5Zr5BQrPnhXMqVZ24RPMKaZGCsGl24LStyev9d8+459zegFLJmtLSC9e9Dea0N/m WkG3BzXyTWfIq0cC46y8UtGxOCe0Dr1+79L3C1qSCvfSudrbgwOE6RrU5BSq4E/Q1I9x aukqYfKaOLIPhS1d/ybE/YNglrJH9zDGPhQKgrriEYT6DD6Qfur6ZfY4P8vvsPo/+dMh RPew== X-Gm-Message-State: AIkVDXKC7vI3qpXhDLvCcobWO84JRrqJHSVPAZMJG2zvLAPTrVlwiz/HuoOmYPHQuDxp/Pu5 X-Received: by 10.98.14.84 with SMTP id w81mr7817402pfi.168.1484800577458; Wed, 18 Jan 2017 20:36:17 -0800 (PST) Received: from localhost (c-98-203-232-209.hsd1.wa.comcast.net. [98.203.232.209]) by smtp.gmail.com with ESMTPSA id a24sm4302116pfh.33.2017.01.18.20.36.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jan 2017 20:36:16 -0800 (PST) From: Kevin Hilman To: Andreas =?utf-8?Q?F=C3=A4rber?= Subject: Re: [PATCH v5] ARM64: dts: meson-gx: Add firmware reserved memory zones Organization: BayLibre References: <1484758245-9354-1-git-send-email-narmstrong@baylibre.com> <2bdb6818-4620-53b1-112d-2d6a29e484d9@suse.de> Date: Wed, 18 Jan 2017 20:36:15 -0800 In-Reply-To: ("Andreas =?utf-8?Q?F=C3=A4rber=22's?= message of "Thu, 19 Jan 2017 02:18:27 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (darwin) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170118_203639_363251_7407A902 X-CRM114-Status: GOOD ( 16.70 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Neil Armstrong , xypron.glpk@gmx.de, linux-kernel@vger.kernel.org, carlo@caione.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Andreas Färber writes: > Am 19.01.2017 um 01:20 schrieb Andreas Färber: >> Hi, >> >> Am 18.01.2017 um 17:50 schrieb Neil Armstrong: >>> The Amlogic Meson GXBB/GXL/GXM secure monitor uses part of the memory space, >>> this patch adds these reserved zones. >>> >>> Without such reserved memory zones, running the following stress command : >>> $ stress-ng --vm 16 --vm-bytes 128M --timeout 10s >>> multiple times: >>> >>> Could lead to the following kernel crashes : >>> [ 46.937975] Bad mode in Error handler detected on CPU1, code 0xbf000000 -- SError >>> ... >>> [ 47.058536] Internal error: Attempting to execute userspace memory: 8600000f [#3] PREEMPT SMP >>> ... >>> Instead of the OOM killer. >>> >> >> I miss a Fixes: or Cc: here for the backport you desired. To have it >> fixed back to my very introduction: >> >> Fixes: 4f24eda8401f ("ARM64: dts: Prepare configs for Amlogic Meson GXBaby") >> >> People backporting it would need to handle the meson-{gx => gxbb}.dtsi >> transition for 4.9 down to 4.6, which seems fairly straightforward. >> >>> Signed-off-by: Neil Armstrong >>> --- >>> arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 18 ++++++++++++++++++ >>> 1 file changed, 18 insertions(+) >>> >>> Changes since v4 at [5]: >>> - Move start of ddr memory to reserved-memory node >>> - Drop memory node move >>> - Fix typo in sizes >>> >>> Changes since resent v2 at [4]: >>> - Fix invalid comment of useable memory attributes >>> >>> Changes since original v2 at [3]: >>> - Typo in commit 2GiB -> 1GiB, 4GiB -> 2GiB >>> >>> Changes since v2 at [2]: >>> - Moved all memory node out of dtsi >>> - Added comment about useable memory >>> - Fixed comment about secmon reserved zone >>> >>> Changes since v1 at [1] : >>> - Renamed reg into linux,usable-memory to ovveride u-boot memory >>> - only kept secmon memory zone >>> >>> [1] http://lkml.kernel.org/r/20161212101801.28491-1-narmstrong@baylibre.com >>> [2] http://lkml.kernel.org/r/1483105232-6242-1-git-send-email-narmstrong@baylibre.com >>> [3] http://lkml.kernel.org/r/1484128128-22454-1-git-send-email-narmstrong@baylibre.com >>> [4] http://lkml.kernel.org/r/1484128540-22662-1-git-send-email-narmstrong@baylibre.com >>> [5] http://lkml.kernel.org/r/1484129414-23325-1-git-send-email-narmstrong@baylibre.com >>> >>> diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi >>> index eada0b5..63d52b7 100644 >>> --- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi >>> +++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi >>> @@ -55,6 +55,24 @@ >>> #address-cells = <2>; >>> #size-cells = <2>; >>> >>> + reserved-memory { >>> + #address-cells = <2>; >>> + #size-cells = <2>; >>> + ranges; >>> + >>> + /* 16 MiB reserved for Hardware ROM Firmware */ >>> + hwrom: hwrom { >> >> Both sub-nodes get a label that is unused, but reserved-memory itself >> does not (my v4 remark). Intentional? >> >>> + reg = <0x0 0x0 0x0 0x1000000>; >>> + no-map; >>> + }; >>> + >>> + /* 2 MiB reserved for ARM Trusted Firmware (BL31) */ >>> + secmon: secmon { >> >> I note that this .dtsi further down has a node /firmware/secure-monitor >> with label sm. >> a) Is there any naming convention such as secmon_mem to adopt here to >> avoid mixups with sm? >> b) Should this secmon node be referenced in the secure-monitor node via >> memory-node = <&secmon>; to model their connection, thereby giving the >> label a use? Or should we maybe merge the two nodes by moving the >> compatible string here? >> >> https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt > > Answering my own question: the example labels use _reserved suffix. > >>> + reg = <0x0 0x10000000 0x0 0x200000>; > > And since we use a reg property here, the node name should get a unit > address to avoid future dtc warnings/errors. Ditto for hwrom. OK, I added Fixes:, your Reviewed-by, added the _reserved suffix and unit address and applied to v4.10/fixes. Update patch below for reference. Other cleanups/fixups (like adding a phandle from secure monitor) can be done as add-ons, as they are not strictly related to this fix. Kevin From ecb88f3001ed9ee8c53450d971de8c18bcbf7925 Mon Sep 17 00:00:00 2001 From: Neil Armstrong Date: Wed, 18 Jan 2017 17:50:45 +0100 Subject: [PATCH] ARM64: dts: meson-gx: Add firmware reserved memory zones MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Amlogic Meson GXBB/GXL/GXM secure monitor uses part of the memory space, this patch adds these reserved zones. Without such reserved memory zones, running the following stress command : $ stress-ng --vm 16 --vm-bytes 128M --timeout 10s multiple times: Could lead to the following kernel crashes : [ 46.937975] Bad mode in Error handler detected on CPU1, code 0xbf000000 -- SError ... [ 47.058536] Internal error: Attempting to execute userspace memory: 8600000f [#3] PREEMPT SMP ... Instead of the OOM killer. Fixes: 4f24eda8401f ("ARM64: dts: Prepare configs for Amlogic Meson GXBaby") Signed-off-by: Neil Armstrong Reviewed-by: Andreas Färber [khilman: added Fixes tag, added _reserved and unit addresses] Signed-off-by: Kevin Hilman --- arch/arm64/boot/dts/amlogic/meson-gx.dtsi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi index eada0b58ba1c..0cbe24b49710 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi @@ -55,6 +55,24 @@ #address-cells = <2>; #size-cells = <2>; + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + /* 16 MiB reserved for Hardware ROM Firmware */ + hwrom_reserved: hwrom@0 { + reg = <0x0 0x0 0x0 0x1000000>; + no-map; + }; + + /* 2 MiB reserved for ARM Trusted Firmware (BL31) */ + secmon_reserved: secmon@10000000 { + reg = <0x0 0x10000000 0x0 0x200000>; + no-map; + }; + }; + cpus { #address-cells = <0x2>; #size-cells = <0x0>;