From patchwork Mon Jan 2 16:50:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 13086844 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAF7BC4708E for ; Mon, 2 Jan 2023 16:50:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230127AbjABQun (ORCPT ); Mon, 2 Jan 2023 11:50:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234311AbjABQum (ORCPT ); Mon, 2 Jan 2023 11:50:42 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6884C3BE for ; Mon, 2 Jan 2023 08:50:40 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id f34so42236463lfv.10 for ; Mon, 02 Jan 2023 08:50:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=2X3LClvVib2/hNnEXNqeR2CvZH0rmRAd8DFSNKxgY5Q=; b=Y45y59OzI05LisjUASag+l5CMJMSN/UZaH9vfPtswX7N7TxqyneLfl2pw6WYJhCw6G jsb/ezF4j1nV8hZTxX9mvWMSskhHzYkNHYd4Fx6nDWM07v0/O3TsLXPgtk3owTfmTs87 jJYHpHHg5Mz8oXt+3Oq+iOXSZxVvRWdxrRpW2Vm5hi13zJaSwfinXaDH6H+fx+dzMGKW ZkBe01H7+h/xHNmBPst4kdUxUMAst7O6+wNKLrcNaENRKpN8VzTzkFv5ga9C4Zr9IB+q s+k5wx8oEq8eUkO2IO8B5IMzXk5q+06lfXRnhTaem7e6SOcRi8MnCkGZmPBtTYXEmrVq lnfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2X3LClvVib2/hNnEXNqeR2CvZH0rmRAd8DFSNKxgY5Q=; b=iqWz1S66phKIsAHOP5CWeC0y4aQE/V6J20TkqOwD6ZhE/7reXZrWeqwsV1TfAXU+3H t34BXTj5rxmiiP/Xxs9yLJfbCAd04TQ4od3LY9r92MIz/bl6O7KKcJwbX46oyCefHK0M sM1P1LLC4c6PFnyN0XrsF3l0C+Lv606x30+J4IjI/vwTIjNYnmFMVPHgf0nN2lSler7z rhINgTAqTgHMDPIwrFbsyYsg8iTJBLBmPeDlQOJwVXMMPtO7hrJLHsCQ0IcplmBqgCH0 Gq32OzRpv+6lDqKQGuNhZ8lEAjO5rNUEJXLL4jIFZUH6PZ2zYfYqAQsoOfONNJn/medv mJKg== X-Gm-Message-State: AFqh2koFioHX73tBJkGRZHVeqoT1S7yWZUxpk2TWuaC0hTJSsqh4XWhT HYVIlc/tZjlFS22VTuF5Pa9zBT3j2h5oTFRz X-Google-Smtp-Source: AMrXdXvpFp/QqEMFzhlvlw9F1EmytinBUgmWeBn1onXB1ZylG8nB9w1epxkq0ZkZmIlMewmtq5QC7A== X-Received: by 2002:a19:7b01:0:b0:4b5:a64a:4408 with SMTP id w1-20020a197b01000000b004b5a64a4408mr17292512lfc.48.1672678238609; Mon, 02 Jan 2023 08:50:38 -0800 (PST) Received: from localhost.localdomain (abxi45.neoplus.adsl.tpnet.pl. [83.9.2.45]) by smtp.gmail.com with ESMTPSA id o8-20020ac24348000000b004b49025f96dsm4510491lfl.187.2023.01.02.08.50.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Jan 2023 08:50:37 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org, krzysztof.kozlowski@linaro.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] dt-bindings: reserved-memory: rmtfs: Document qcom,assign-to-nav Date: Mon, 2 Jan 2023 17:50:33 +0100 Message-Id: <20230102165034.830620-1-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Some SoCs mandate that the RMTFS is also assigned to the NAV VM, while others really don't want that. Since it has to be conditional, add a bool property to toggle this behavior. Signed-off-by: Konrad Dybcio Acked-by: Krzysztof Kozlowski --- v1 -> v2: - Rewrite the newly added description .../devicetree/bindings/reserved-memory/qcom,rmtfs-mem.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/reserved-memory/qcom,rmtfs-mem.yaml b/Documentation/devicetree/bindings/reserved-memory/qcom,rmtfs-mem.yaml index 2998f1c8f0db..4026788a4e40 100644 --- a/Documentation/devicetree/bindings/reserved-memory/qcom,rmtfs-mem.yaml +++ b/Documentation/devicetree/bindings/reserved-memory/qcom,rmtfs-mem.yaml @@ -31,6 +31,12 @@ properties: description: > vmid of the remote processor, to set up memory protection + qcom,assign-to-nav: + type: boolean + description: + Whether to also assign the region to a third (NAV) VM, as opposed to + the usual 2. + required: - qcom,client-id From patchwork Mon Jan 2 16:50:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 13086845 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7699C3DA7A for ; Mon, 2 Jan 2023 16:50:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232909AbjABQup (ORCPT ); Mon, 2 Jan 2023 11:50:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234954AbjABQuo (ORCPT ); Mon, 2 Jan 2023 11:50:44 -0500 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E84C3BE for ; Mon, 2 Jan 2023 08:50:42 -0800 (PST) Received: by mail-lf1-x12d.google.com with SMTP id y25so42271544lfa.9 for ; Mon, 02 Jan 2023 08:50:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=+0Hsdkn9Ik2bsrBztjUnz8QbQ+4RQ0dV6PdSxg6F+H8=; b=iM/zicdP4fDksBdQClbPeGnvZ2ZdUJzYaVLfEqaCgpyG0mgT8VCI0YUwrizq31W+zb aBVvZRBGvjKps55MjEVa1+Vc5rxYutQh45lkayaIT4dvLaJUmFGJTnDaH3q+Tve/lLFq hYegFz5B/O3/k+zdtWhWLzGC7UEdtZ9hc3KXyLY6T7OuAmTsTvF9KoZZ+Gk4y734Qa8A LOYbnwzZMyoRi9QcHkoMSSBZoYq0CvvXW5EnDGJxlBoJ6hWgw06BMt2Cc1xbprGVk3C8 VuyMQNZdRQomcF39GFjv2fvTmi3rY85aaD9gZLkTbg4ZmSxblEBESoBA7P4h838WY87y Gkqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=+0Hsdkn9Ik2bsrBztjUnz8QbQ+4RQ0dV6PdSxg6F+H8=; b=a4/NldORRuPnZwPeO7ewQiJr56y+WCSHe1vz8jzakifzgaN8bnHtpgls4B2fNUIPtK VUTOJSYWV0bcJW0xl/5OcjmTQEu+ojZWphymdgJRQODH7dFK+dtMP3OeN/hcx74gP4T3 MoALyQi43Glzpans+WzFMT3ITE9HMd0MR497U8zdwDI8rcBGe6XUVOL9Ujoy6i/LuIPg 2qYJ6p2P5/7hyFae50KR/afN06uBjm84PIlzOCICEUI047xD4mNG19qLWs6+ZfIn1x2B ATf2IEWS9+GsVVBKu96XuWoKdqe/snK6tHooYOojVxEmEO2cu+txZrbLuxApAAD2x60F nf/w== X-Gm-Message-State: AFqh2koLRXpHdQohEZjkPmmTfDq/qOAwY+4nFL36OIHJ1498Ug1m8KRa 6DG78yreEqHHzFrPokkZZFjE2NYCHf15E7Py X-Google-Smtp-Source: AMrXdXsTRfgOlSc/J+mZZreOlJvJGk9L6RUEAWxCdOrSYW2yM6lIlnuzyn6CFI18QGR66ChJ383ewQ== X-Received: by 2002:a05:6512:32cb:b0:4c5:38ae:4b1e with SMTP id f11-20020a05651232cb00b004c538ae4b1emr15797405lfg.45.1672678240762; Mon, 02 Jan 2023 08:50:40 -0800 (PST) Received: from localhost.localdomain (abxi45.neoplus.adsl.tpnet.pl. [83.9.2.45]) by smtp.gmail.com with ESMTPSA id o8-20020ac24348000000b004b49025f96dsm4510491lfl.187.2023.01.02.08.50.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Jan 2023 08:50:40 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org, krzysztof.kozlowski@linaro.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Loic Poulain , AngeloGioacchino Del Regno , Stephan Gerhold Subject: [PATCH v2 2/2] soc: qcom: rmtfs: Optionally map RMTFS to NAV VM Date: Mon, 2 Jan 2023 17:50:34 +0100 Message-Id: <20230102165034.830620-2-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230102165034.830620-1-konrad.dybcio@linaro.org> References: <20230102165034.830620-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Loic Poulain Some SoCs require that RMTFS is also mapped to the NAV VM. Trying to power on the modem without that results in the whole platform crashing and forces a hard reboot within about 2 seconds. Signed-off-by: Loic Poulain [Konrad: reword, make conditional, add a define for NAV VMID] Signed-off-by: Konrad Dybcio --- v1 -> v2: No changes drivers/soc/qcom/rmtfs_mem.c | 22 +++++++++++++++------- include/linux/qcom_scm.h | 1 + 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/soc/qcom/rmtfs_mem.c b/drivers/soc/qcom/rmtfs_mem.c index 0feaae357821..999f2c5b49b0 100644 --- a/drivers/soc/qcom/rmtfs_mem.c +++ b/drivers/soc/qcom/rmtfs_mem.c @@ -171,12 +171,13 @@ static void qcom_rmtfs_mem_release_device(struct device *dev) static int qcom_rmtfs_mem_probe(struct platform_device *pdev) { struct device_node *node = pdev->dev.of_node; - struct qcom_scm_vmperm perms[2]; + struct qcom_scm_vmperm perms[3]; struct reserved_mem *rmem; struct qcom_rmtfs_mem *rmtfs_mem; + bool assign_to_nav; u32 client_id; u32 vmid; - int ret; + int ret, cnt = 0; rmem = of_reserved_mem_lookup(node); if (!rmem) { @@ -191,6 +192,8 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev) } + assign_to_nav = of_property_read_bool(node, "qcom,assign-to-nav"); + rmtfs_mem = kzalloc(sizeof(*rmtfs_mem), GFP_KERNEL); if (!rmtfs_mem) return -ENOMEM; @@ -236,14 +239,19 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev) goto remove_cdev; } - perms[0].vmid = QCOM_SCM_VMID_HLOS; - perms[0].perm = QCOM_SCM_PERM_RW; - perms[1].vmid = vmid; - perms[1].perm = QCOM_SCM_PERM_RW; + perms[cnt].vmid = QCOM_SCM_VMID_HLOS; + perms[cnt++].perm = QCOM_SCM_PERM_RW; + perms[cnt].vmid = vmid; + perms[cnt++].perm = QCOM_SCM_PERM_RW; + + if (assign_to_nav) { + perms[cnt].vmid = QCOM_SCM_VMID_NAV; + perms[cnt++].perm = QCOM_SCM_PERM_RW; + } rmtfs_mem->perms = BIT(QCOM_SCM_VMID_HLOS); ret = qcom_scm_assign_mem(rmtfs_mem->addr, rmtfs_mem->size, - &rmtfs_mem->perms, perms, 2); + &rmtfs_mem->perms, perms, cnt); if (ret < 0) { dev_err(&pdev->dev, "assign memory failed\n"); goto remove_cdev; diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h index f8335644a01a..150b72edb879 100644 --- a/include/linux/qcom_scm.h +++ b/include/linux/qcom_scm.h @@ -55,6 +55,7 @@ enum qcom_scm_ice_cipher { #define QCOM_SCM_VMID_MSS_MSA 0xF #define QCOM_SCM_VMID_WLAN 0x18 #define QCOM_SCM_VMID_WLAN_CE 0x19 +#define QCOM_SCM_VMID_NAV 0x2B #define QCOM_SCM_PERM_READ 0x4 #define QCOM_SCM_PERM_WRITE 0x2 #define QCOM_SCM_PERM_EXEC 0x1