From patchwork Wed Apr 18 07:32:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 10347459 X-Patchwork-Delegate: agross@codeaurora.org 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 711AB6031B for ; Wed, 18 Apr 2018 07:33:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60561284CE for ; Wed, 18 Apr 2018 07:33:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54AC62855C; Wed, 18 Apr 2018 07:33:13 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F8F6284CE for ; Wed, 18 Apr 2018 07:33:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752947AbeDRHdK (ORCPT ); Wed, 18 Apr 2018 03:33:10 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:40469 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752972AbeDRHdJ (ORCPT ); Wed, 18 Apr 2018 03:33:09 -0400 Received: by mail-wr0-f193.google.com with SMTP id v60-v6so1911276wrc.7 for ; Wed, 18 Apr 2018 00:33:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openmesh-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=SWI+hrdRwPMm3rQMptcsmaGf4Oo9SfY1Vvxbs131T94=; b=QlP5htBO3E8nLo1RIMI3irYStqFwCNUlBk5xtVsd1soEoSxVqDLoYFbIMLFdK2YLAp +pcp5CwND+YlC4H9JPIILKQGU1k9PhDP78Y/TWzcdN7R8fCyWXyV8RzPKovomUQ9muoa L1aG4BWHkqUP8+ay5Vk9vEhXBoysPO/LzKv74OnsRLl0k5srywhCdSlGeRj1O1J6mKvt kYc95q08UtxqrZJXey5dENZPlL2R28nNR8e0YnAsZ+xc5pPvmtTLbCyQlhMHXnKN4fvv 5sEeKfGgp4FbImCjkIE741bnYD+MRdHGXv8Uq2hGi3PgZNCLeCgF62aQ1+3Sm62aqgNz dSmQ== 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:date:message-id; bh=SWI+hrdRwPMm3rQMptcsmaGf4Oo9SfY1Vvxbs131T94=; b=WXuA08iNOBm/xZjNNJwFxTA9XV7rRzgD1kv41ZvSO4cI9ETXZq7vJR8z0jHFgWT8rs f+FKKwQPEkbcmLYPxMBugNBH50I4ex751BCaodibUVmRo+Ii1rDl8D2TjC48eOaLoaju FrPMFZWHFydG31I0OLJzxazsm79PBde1itkmsecpbCMoCJret9LQW3eF/9ktPIz+n6wE O20SADXgQQtLfn0sfaI5MNPCVFGiPM8OT/BiI3ozfo2WvW8hM+KjZVguGsnq1B+Kt8Mr ZAX6nAd1oIlijo4xNABpGa/1rzJUA3gaGpqLmVuek6OvjkuqUikCiS0LRo8m02gYlrho YhvA== X-Gm-Message-State: ALQs6tDfdZAXDeDii3sf54b1H97K8JJRoJTIaE1FOmZ8IePYfEuM4mIr 8030wOFnKGx1UJudXZiuie5fxiKZfGQ= X-Google-Smtp-Source: AIpwx4/5Tq+zZg18J16xHGz4ZXwp+VoJZcOECeqCRQILGuNio5rGiqugKRUbxY/HJ1XWkRO13IRYMg== X-Received: by 2002:adf:aa94:: with SMTP id h20-v6mr736035wrc.149.1524036787553; Wed, 18 Apr 2018 00:33:07 -0700 (PDT) Received: from sven-desktop.home.narfation.org (p549BD81D.dip0.t-ipconnect.de. [84.155.216.29]) by smtp.gmail.com with ESMTPSA id y191sm1440003wme.14.2018.04.18.00.33.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 18 Apr 2018 00:33:06 -0700 (PDT) From: Sven Eckelmann To: linux-arm-msm@vger.kernel.org Cc: linux-soc@vger.kernel.org, devicetree@vger.kernel.org, Mark Rutland , Rob Herring , David Brown , Andy Gross , Sven Eckelmann , Sricharan Ramabadhran , Senthilkumar N L Subject: [PATCH] ARM: dts: ipq4019: Add TZ and SMEM reserved regions Date: Wed, 18 Apr 2018 09:32:59 +0200 Message-Id: <20180418073259.18645-1-sven.eckelmann@openmesh.com> X-Mailer: git-send-email 2.11.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The QSEE (trustzone) is started on IPQ4019 before Linux is started. According to QCA, it is placed in in the the memory region 0x87e80000-0x88000000 and must not be accessed directly. There is an additional memory region 0x87e00000-0x87E80000 smem which which can be used for communication with the TZ. The driver for the latter is not yet ready but it is still not allowed to use this memory region like any other memory region. Not reserving this memory region either leads to kernel crashes, kernel hangs (often during the boot) or bus errors for userspace programs. The latter happens when a program is using a memory region which is mapped to these physical memory regions. [ 571.758058] Unhandled fault: imprecise external abort (0xc06) at 0x01715ff8 [ 571.758099] pgd = cebec000 [ 571.763826] [01715ff8] *pgd=8e7fa835, *pte=87e7f75f, *ppte=87e7fc7f Bus error Signed-off-by: Sven Eckelmann --- Cc: Sricharan Ramabadhran Cc: Senthilkumar N L There are additional memory regions which have to be initialized first by Linux. So they are currently not used. We were told by QCA that the features QSDK uses them for are: * crash dump feature - a couple of regions used when 'qca,scm_restart_reason' dt node has the value 'dload_status' not set to 1 + apps_bl <0x87000000 0x400000> + sbl <0x87400000 0x100000> + cnss_debug <0x87400000 0x100000> + cpu_context_dump <0x87b00000 0x080000> - required driver not available in Linux - safe to remove * QSEE app execution - region tz_apps <0x87b80000 0x280000> - required driver not available in Linux - safe to remove * communication with TZ/QSEE - region smem <0x87b80000 0x280000> - driver changes not yet upstreamed - must not be removed because any access can crash kernel/program * trustzone (QSEE) private memory - region tz <0x87e80000 0x180000> - must not be removed because any access can crash kernel/program The problem with the missing regions was reported in 2016 [1]. So maybe this change qualifies for a stable@vger.kernel.org submission. [1] https://www.spinics.net/lists/linux-arm-msm/msg21536.html --- arch/arm/boot/dts/qcom-ipq4019.dtsi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/arm/boot/dts/qcom-ipq4019.dtsi b/arch/arm/boot/dts/qcom-ipq4019.dtsi index 10d112a4078e..b25daf368012 100644 --- a/arch/arm/boot/dts/qcom-ipq4019.dtsi +++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi @@ -23,6 +23,22 @@ compatible = "qcom,ipq4019"; interrupt-parent = <&intc>; + reserved-memory { + #address-cells = <0x1>; + #size-cells = <0x1>; + ranges; + + smem_region: smem@87e00000 { + reg = <0x87e00000 0x080000>; + no-map; + }; + + tz@87e80000 { + reg = <0x87e80000 0x180000>; + no-map; + }; + }; + aliases { spi0 = &spi_0; i2c0 = &i2c_0;