Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp6743717ybn; Mon, 30 Sep 2019 03:05:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqyA6DsUNNYMYJkLmzDPiulXNR1UVA+/Xnl91Jnfd93K4QzhWGkuYEFnRsQy7+N79SuiKmnl X-Received: by 2002:a05:6402:17a2:: with SMTP id j2mr18682884edy.121.1569837916264; Mon, 30 Sep 2019 03:05:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569837916; cv=none; d=google.com; s=arc-20160816; b=OEJj/CqPlxwZhBIXRtXnYXjFPyskdifz4liYDCYAR81FtYiee+FWNcGVaaLWTd9Jw1 LgYupG5xx9juR4GUOxLy8O5DRlEdiGXcGSikDiXd3rLjUcvy/T4KIsdKhEY5hR4ip7c6 ED7YWPorrmgu+h8MAQz8UIgrdzPi5fzy0cfLehwUcnz0ECq3KXR8FjK9t2D747pgHccI 77grzguXi9Ud0rW8bdHOjih9B49qZCg6NFc5KO0lN1GKvTVDxMU5DAt7Q2eAK7KpIvqa ulx3q2/WSjQVQmnPvrTPr33pwbwvIF9+iPJAKsC8grEp72vMGEZVBBwoxYgsVhpWKPSi +t+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ajeet0swDX4gnLrUQmO0F/r8s4oKd89JmS8XskX0TYU=; b=eF6aNasx5pqiMPskb3VnNkPNcPqC4VuCDl3eqHeq+kCaKXGAGTRzIfW/UR7hQpOC6S d2oQxjKOh7/Cu5IEFblBlAXqLmoiyLv9MNoyzBp/kMa+hX1BYz3DtJUjl2zu8L2GaVOL EBTWyK4cF4t9kHkfRuWiZNNCTPXnta0502bWmjK+U0YlEYb6uWuh4jVnV60PWZ9Rz93R YmDVhWkmj4YL44tahLZ4KBCSQHqE7DHdpiVdZJzfJEIsxck3x44JDDWpuI3c6paJRYoQ cuXumWejshgA2GI8qWnvqz0q1HPwCdPSc9daBAdAnYihG8wZe/aOsm8PM0sMAW4J9jYL LbHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p14si6863267ejn.192.2019.09.30.03.04.51; Mon, 30 Sep 2019 03:05:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730548AbfI3KCV (ORCPT + 99 others); Mon, 30 Sep 2019 06:02:21 -0400 Received: from mx2.suse.de ([195.135.220.15]:58034 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727025AbfI3KCV (ORCPT ); Mon, 30 Sep 2019 06:02:21 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 89203B157; Mon, 30 Sep 2019 10:02:19 +0000 (UTC) Date: Mon, 30 Sep 2019 12:02:12 +0200 From: Mian Yousaf Kaukab To: Stephen Warren Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, treding@nvidia.com, jonathanh@nvidia.com, linux-tegra@vger.kernel.org Subject: Re: [PATCH] arm64: tegra: only map accessible sysram Message-ID: <20190930100212.GA21324@suse.de> References: <20190929200851.14228-1-ykaukab@suse.de> <5d2e47ec-8304-d648-9c4a-80c7c02050a9@wwwdotorg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <5d2e47ec-8304-d648-9c4a-80c7c02050a9@wwwdotorg.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Sep 29, 2019 at 11:28:43PM -0600, Stephen Warren wrote: > On 9/29/19 2:08 PM, Mian Yousaf Kaukab wrote: > > Most of the SysRAM is secure and only accessible by TF-A. > > Don't map this inaccessible memory in kernel. Only map pages > > used by bpmp driver. > > I don't believe this change is correct. The actual patch doesn't > implement mapping a subset of the RAM (a software issue), but rather it > changes the DT representation of the SYSRAM hardware. The SYSRAM > hardware always does start at 0x30000000, even if a subset of the > address range is dedicated to a specific purpose. If the kernel must map > only part of the RAM, then some additional property should indicate > this.[...] I agree the hardware description becomes inaccurate with this change. In the current setup complete 0x3000_0000 to 0x3005_0000 range is being mapped as normal memory (MT_NORMAL_NC). Though only 0x3004_E000 to 0x3005_0000 are accessible by the kernel. I am seeing an issue where a read access (which I believe is speculative) to inaccessible range causes an SError. Another solution for this problem could be to add "no-memory-wc" to SysRAM node so that it is mapped as device memory (MT_DEVICE_nGnRE). Would that be acceptable? > [...] Also, I believe it's incorrect to hard-code into the kernel's DT > the range of addresses used by the secure monitor/OS, since this can > vary depending on what the user actually chooses to install as the > secure monitor/OS. Any indication of such regions should be filled in at > runtime by some boot firmware or the secure monitor/OS itself, or > retrieved using some runtime API rather than DT. Secure-OS addresses are not of interest here. SysRAM is partitioned between secure-OS and BPMP and kernel is only interested in the BPMP part. The firmware can update these addresses in the device-tree if it wants to. Would you prefer something similar implemented in u-boot so that it updates SysRAM node to only expose kernel accessible part of it to the kernel? Can u-boot dynamically figure out the Secure-OS vs BPMP partition? BR, Yousaf