From patchwork Mon Nov 6 08:28:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 742320 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 69389C4167B for ; Mon, 6 Nov 2023 08:29:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231301AbjKFI3F (ORCPT ); Mon, 6 Nov 2023 03:29:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231245AbjKFI3E (ORCPT ); Mon, 6 Nov 2023 03:29:04 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A1BF184 for ; Mon, 6 Nov 2023 00:29:00 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4083f61312eso32435255e9.3 for ; Mon, 06 Nov 2023 00:29:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699259339; x=1699864139; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=71CxKbWqIB1thWUHFZAzLfbTO4lgIALsc6uKYJhAAGc=; b=qV2bNOtYWd+pfLGgMJYJMXghJL5zeQclW2Yqlf92SeemWkiRZECQ/Ukd6MsrSr1r9y i2Ob56G2vyK9HqrHMEOqSG8WiXe4vttj4g7MzjpNB3C6Kh/hTGdCmCKL6VvqU+sYBTfg grIFEAotoz4/s7bSGw2/M5I6u21B2HvvH1lggINVsfL5C7Q7YBGMdEucL1jbnjlDYBuG 9hkDZqaU9+7VDmgRt0cS09rdlLWA81jbQRsqsKG9nfym4QZJjM+uJ1Qe0z78teejfXRR HfVNGRZy3IZDrsTsF0M9Trk3yll3CIZQDPwEdpFaiXScbdiN8TyxweIG18PsDCN1fCLJ GvRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699259339; x=1699864139; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=71CxKbWqIB1thWUHFZAzLfbTO4lgIALsc6uKYJhAAGc=; b=c/8cyKo+Tdp8zRCGY65T3kIhsKQaWm2Zg73jnkqnz33y8EmsPmVdaAPurhIias3fKD N1YseqAve+HjYNEe2wLAxBPu6TkYsOAQmqHHHGTV3eKHAt2tQkk0ngNhu9tCgY1eaadV K6l1iUsAQEgqMXStFz5H+Lb4eM8KDZKHb95wjI+JxLmISQegJ5ZgnGVj7BeEt0/XAj/Z LSTZkGvaFg9+97v2gcvmSXArhHHEahYJN/gk/mqWarN/L8UqIc95RPmKJmp8mK4NKiAl bOKL65QqRKXpSxP6yc9PBnAyjRKTY6Ivwv34pzzHMe4VmS1H+GF6X9HOreIlfVLrq3KR Ta+w== X-Gm-Message-State: AOJu0YxfKMNUwbazLJ/cnxnyqWh+8maz+bBPjX2kOIg2rZzuemj2TdT2 HfxYZVVTFFad7N6BnSbqgMmcqQ== X-Google-Smtp-Source: AGHT+IGL7/mxxsODCac2Iuesz8nOv2RLlMBNJ3e7Zxj0TaMRjwursFhG397QDqaoPo5GbJxQ93a4IA== X-Received: by 2002:a5d:60d2:0:b0:32f:d88b:2242 with SMTP id x18-20020a5d60d2000000b0032fd88b2242mr538852wrt.7.1699259339013; Mon, 06 Nov 2023 00:28:59 -0800 (PST) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id p12-20020adfce0c000000b0032dc1fc84f2sm8796126wrn.46.2023.11.06.00.28.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 00:28:58 -0800 (PST) From: Neil Armstrong Date: Mon, 06 Nov 2023 09:28:52 +0100 Subject: [PATCH v3 1/3] dt-bindings: remoteproc: qcom,sm8550-pas: document the SM8650 PAS MIME-Version: 1.0 Message-Id: <20231106-topic-sm8650-upstream-remoteproc-v3-1-dbd4cabaeb47@linaro.org> References: <20231106-topic-sm8650-upstream-remoteproc-v3-0-dbd4cabaeb47@linaro.org> In-Reply-To: <20231106-topic-sm8650-upstream-remoteproc-v3-0-dbd4cabaeb47@linaro.org> To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Manivannan Sadhasivam Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Neil Armstrong , Krzysztof Kozlowski X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=3084; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=gsIvwnD1pTzAEzxjRT3QO/jWU2a/vS/+hNR3Zbvsze0=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBlSKPHN2BrTwkoxLoI1slEW2seI7xkkYzDCmPvunTV t4lMVIyJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZUijxwAKCRB33NvayMhJ0dv4D/ 9hRvNcQvHyzy6Pf4A1mjehaEpjro3EKdArWz5rgd/7cZrL1duYEveuBpH51J/goxI5lzTUbqdBNx00 J6i6vJZTmYlChDDowOE8S/b/jJ1oDk8fiVaNxJ6x67Bkv1wdczZa75a98AGjOJ5cTdx049omSdOmDj hnlLNLzBpG7QQMGjIXQh+FgaMQyHiExQfGARvbcYUeetLsfctTWLmBAm6bRqG023VzQoDNSl6AhZW2 GkdP28Rhsa9n+xSh4GouiNf2uykWy1VDzDsLHFixOH5PmJTKnmEsySHVYUVWoBqOYgSVila0kBx5+l ssr4irFpow4tlB40lZaSgI9DWvr2lDiEBWNtY+nHFc6AsJJMY1ibh4QPyPAvp5AMQuRg1n++g7rZov rxYvDy2EzqxbLm1S1rRe2v989mzw11ZY2Xgitp71wQD2FdxVU5PRArM/Sx/I47pUer+y78KJt2PPgO ZXk+agBAs3930nV8NN7GMrWK8LxCHdWGDv0Pz6RmN4QWETS9fqBay1Sifk6IZlRkyB8HJ24TEhmSwT VH8pgAoczGgjUbKlhcFZ0sJhLJdFAiXqmJu5wsAnUkW3PPsOzqwIJ6B54cwQTmV7Xb5l6kBuukgWJN vN4YNQnj/nSYmoLYE9z6AQce5fLzJkbzilTFmTc2XvfvyOmBq1epxdGl7Sfg== X-Developer-Key: i=neil.armstrong@linaro.org; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Document the DSP Peripheral Authentication Service on the SM8650 Platform. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Neil Armstrong --- .../bindings/remoteproc/qcom,sm8550-pas.yaml | 44 +++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,sm8550-pas.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,sm8550-pas.yaml index 58120829fb06..4e8ce9e7e9fa 100644 --- a/Documentation/devicetree/bindings/remoteproc/qcom,sm8550-pas.yaml +++ b/Documentation/devicetree/bindings/remoteproc/qcom,sm8550-pas.yaml @@ -19,6 +19,9 @@ properties: - qcom,sm8550-adsp-pas - qcom,sm8550-cdsp-pas - qcom,sm8550-mpss-pas + - qcom,sm8650-adsp-pas + - qcom,sm8650-cdsp-pas + - qcom,sm8650-mpss-pas reg: maxItems: 1 @@ -49,6 +52,7 @@ properties: - description: Memory region for main Firmware authentication - description: Memory region for Devicetree Firmware authentication - description: DSM Memory region + - description: DSM Memory region 2 required: - compatible @@ -63,6 +67,7 @@ allOf: enum: - qcom,sm8550-adsp-pas - qcom,sm8550-cdsp-pas + - qcom,sm8650-adsp-pas then: properties: interrupts: @@ -71,7 +76,26 @@ allOf: maxItems: 5 memory-region: maxItems: 2 - else: + - if: + properties: + compatible: + enum: + - qcom,sm8650-cdsp-pas + then: + properties: + interrupts: + maxItems: 5 + interrupt-names: + maxItems: 5 + memory-region: + minItems: 3 + maxItems: 3 + - if: + properties: + compatible: + enum: + - qcom,sm8550-mpss-pas + then: properties: interrupts: minItems: 6 @@ -79,12 +103,28 @@ allOf: minItems: 6 memory-region: minItems: 3 + maxItems: 3 + - if: + properties: + compatible: + enum: + - qcom,sm8650-mpss-pas + then: + properties: + interrupts: + minItems: 6 + interrupt-names: + minItems: 6 + memory-region: + minItems: 4 + maxItems: 4 - if: properties: compatible: enum: - qcom,sm8550-adsp-pas + - qcom,sm8650-adsp-pas then: properties: power-domains: @@ -101,6 +141,7 @@ allOf: compatible: enum: - qcom,sm8550-mpss-pas + - qcom,sm8650-mpss-pas then: properties: power-domains: @@ -116,6 +157,7 @@ allOf: compatible: enum: - qcom,sm8550-cdsp-pas + - qcom,sm8650-cdsp-pas then: properties: power-domains: From patchwork Mon Nov 6 08:28:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 742319 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 05428C4708E for ; Mon, 6 Nov 2023 08:29:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231245AbjKFI3H (ORCPT ); Mon, 6 Nov 2023 03:29:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231220AbjKFI3F (ORCPT ); Mon, 6 Nov 2023 03:29:05 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C70DB0 for ; Mon, 6 Nov 2023 00:29:01 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-32df66c691dso2398256f8f.3 for ; Mon, 06 Nov 2023 00:29:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699259340; x=1699864140; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=zwCCOoSwPAq81CXeFaa1ZEXJOETTRIUb81b9f7FxvQE=; b=iCWiGenbpKUdCgwpp5j84XvlqLdPr9ALrVF/7RXNlEEZMpVMZm7ynsOnZbIofunAeG Mwyojv4bLWTlWLSPoEGkob5Tg1XxJa8kX95FH+/qJfTmXEFnzn0RuTXHX4ZR9gYbbrl+ UuoUERO02VTHgZvzxCNoKVR7ziSl61ZjSkaMAyWszXn1LKxq/aTUNrkpxsluhukMf0iW uK4Z/6YUdJRuDZK7nO5j4SJEfnpA44WTZiM7ctxZrCE5US5DAyjatsmqQoxjoyt2hBI7 LO/XSThuREjQga+Jl//2rNAiSHvC8ecz6JzvRLK8tz/foCsLwORlwmjoKf40HOR/V4pn 0jMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699259340; x=1699864140; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zwCCOoSwPAq81CXeFaa1ZEXJOETTRIUb81b9f7FxvQE=; b=b7PwGBN0RUfOWQt1lbmDe2/8v5g9Z0ogFt3xAfpL8QE3DfwRUdg0F4eUU1JG+6b2gC eo0GU+4gvi/0UMhkERVtHjpMCR6umhTmJzZXt4DNcJ/eOyR+fJkV4L5meCOdmY5o2+u0 VU50dVbp3uq+X9LgRI02afI9QiITbs12utXzBZyCQTGb9eVfdcPuHRm0ZiNS78SZQnc5 8ayHn6ModWPROHDMnNETmUPwveb0zzP44v5hby1Eca+BumMg9JXMVivbC+pwpMff0Nas QXpOhDIQjW+RSI2M7WJu2mZUwntVmRYQYDEtuhTLPjdwOpG7FX4eiVP/kb+d80d6xFhE 3LiA== X-Gm-Message-State: AOJu0YzLwsaR+QxejKHmQZ5jAOc97Dw+kB3EZGTQdOkvllq8ogU3S9to 4QxuayMjvZTKVtdSEgK1e3jzfQ== X-Google-Smtp-Source: AGHT+IF10TmLfzt6cJJsy4KG3v2S3SxlbtLe8MJJ2RE2pZc9/f43mJM2iNYbTUBKU4swFzGQVmQSoA== X-Received: by 2002:adf:f8cb:0:b0:32d:8c57:b4f2 with SMTP id f11-20020adff8cb000000b0032d8c57b4f2mr22393657wrq.37.1699259340033; Mon, 06 Nov 2023 00:29:00 -0800 (PST) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id p12-20020adfce0c000000b0032dc1fc84f2sm8796126wrn.46.2023.11.06.00.28.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 00:28:59 -0800 (PST) From: Neil Armstrong Date: Mon, 06 Nov 2023 09:28:53 +0100 Subject: [PATCH v3 2/3] remoteproc: qcom: pas: make region assign more generic MIME-Version: 1.0 Message-Id: <20231106-topic-sm8650-upstream-remoteproc-v3-2-dbd4cabaeb47@linaro.org> References: <20231106-topic-sm8650-upstream-remoteproc-v3-0-dbd4cabaeb47@linaro.org> In-Reply-To: <20231106-topic-sm8650-upstream-remoteproc-v3-0-dbd4cabaeb47@linaro.org> To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Manivannan Sadhasivam Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Neil Armstrong X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=6158; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=kgGD2iNGnWz+J97/SP/Ac1ViSBNTEhHF6d8FSrY+bEg=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBlSKPI2TjEZeZeK5pTcsLX54Rk0RaUFRAiwEOThutz kF3QTiCJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZUijyAAKCRB33NvayMhJ0VMMD/ 4p/VczjnDz8yeCIz/P3MuIgcP77MdiC0NCYXIDjwiT6yApuKl3G6EQ/GzlSqyvHUgon0uUIqvuOLp+ /xWfDSbGzoPN41QvMWDMfxwf3a8EnACrYaOyqVbkfzkqvkxpv1QzLl1uQv8sB5dx119PCX+JJ1cAgy sLdGGB7zi9mzy2J3Xsp93xaCJrxF7sWSZAqv1iaes0A45gAS7fSqnR2X5UF1npEGUTf090SqKeBgQt VjzdTKDhBQfKs8AAFjIxl/8kkv8Pst9QvY93uqn/Mq/yf0PTmudB4fTkEXPwobcXT0je04AcEassQJ So05PFhplxxcsumCNBP66iC/EBALNZRX2mkknjqHIvBEp/o8uLG8O2JRF4b9UeVz3zHk2Pwu3R7YjZ Pk2v2uHMhL6zQzAc3NFBhOr5VeSgErfTYlLOgqR18QsD8kG/bXBgRxLm/WCA+E81uKqQJXs5NP12LS 0JfsXhOnLQ8O7ncN/DZBGv+1SHZEswGRwzNyWdiiA91IZTT9WV3jJCuz4aH7J8S9rhPHKFGEZ3SpLf lWSNynWV+NXwmGLvXgnsjvJaDSBhhuPX9DNxvXJ/vKKLLhGgGAam6V1rIGnYsQdGbFle45JsDqePdf 6lhQ83ntlj0M8ONUpmMu76sC3hBJ3bJWihdApwy+31lTZhGn0oVgvAZM323w== X-Developer-Key: i=neil.armstrong@linaro.org; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The current memory region assign only supports a single memory region. But new platforms introduces more regions to make the memory requirements more flexible for various use cases. Those new platforms also shares the memory region between the DSP and HLOS. To handle this, make the region assign more generic in order to support more than a single memory region and also permit setting the regions permissions as shared. Signed-off-by: Neil Armstrong --- drivers/remoteproc/qcom_q6v5_pas.c | 101 ++++++++++++++++++++++++------------- 1 file changed, 66 insertions(+), 35 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index 913a5d2068e8..2ea364a04d4c 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -33,6 +33,8 @@ #define ADSP_DECRYPT_SHUTDOWN_DELAY_MS 100 +#define MAX_ASSIGN_COUNT 2 + struct adsp_data { int crash_reason_smem; const char *firmware_name; @@ -51,6 +53,9 @@ struct adsp_data { int ssctl_id; int region_assign_idx; + int region_assign_count; + bool region_assign_shared; + int region_assign_vmid; }; struct qcom_adsp { @@ -87,15 +92,18 @@ struct qcom_adsp { phys_addr_t dtb_mem_phys; phys_addr_t mem_reloc; phys_addr_t dtb_mem_reloc; - phys_addr_t region_assign_phys; + phys_addr_t region_assign_phys[MAX_ASSIGN_COUNT]; void *mem_region; void *dtb_mem_region; size_t mem_size; size_t dtb_mem_size; - size_t region_assign_size; + size_t region_assign_size[MAX_ASSIGN_COUNT]; int region_assign_idx; - u64 region_assign_perms; + int region_assign_count; + bool region_assign_shared; + int region_assign_vmid; + u64 region_assign_perms[MAX_ASSIGN_COUNT]; struct qcom_rproc_glink glink_subdev; struct qcom_rproc_subdev smd_subdev; @@ -590,37 +598,53 @@ static int adsp_alloc_memory_region(struct qcom_adsp *adsp) static int adsp_assign_memory_region(struct qcom_adsp *adsp) { - struct reserved_mem *rmem = NULL; - struct qcom_scm_vmperm perm; + struct qcom_scm_vmperm perm[MAX_ASSIGN_COUNT]; struct device_node *node; + unsigned int perm_size; + int offset; int ret; if (!adsp->region_assign_idx) return 0; - node = of_parse_phandle(adsp->dev->of_node, "memory-region", adsp->region_assign_idx); - if (node) - rmem = of_reserved_mem_lookup(node); - of_node_put(node); - if (!rmem) { - dev_err(adsp->dev, "unable to resolve shareable memory-region\n"); - return -EINVAL; - } + for (offset = 0; offset < adsp->region_assign_count; ++offset) { + struct reserved_mem *rmem = NULL; + + node = of_parse_phandle(adsp->dev->of_node, "memory-region", + adsp->region_assign_idx + offset); + if (node) + rmem = of_reserved_mem_lookup(node); + of_node_put(node); + if (!rmem) { + dev_err(adsp->dev, "unable to resolve shareable memory-region index %d\n", + offset); + return -EINVAL; + } - perm.vmid = QCOM_SCM_VMID_MSS_MSA; - perm.perm = QCOM_SCM_PERM_RW; + if (adsp->region_assign_shared) { + perm[0].vmid = QCOM_SCM_VMID_HLOS; + perm[0].perm = QCOM_SCM_PERM_RW; + perm[1].vmid = adsp->region_assign_vmid; + perm[1].perm = QCOM_SCM_PERM_RW; + perm_size = 2; + } else { + perm[0].vmid = adsp->region_assign_vmid; + perm[0].perm = QCOM_SCM_PERM_RW; + perm_size = 1; + } - adsp->region_assign_phys = rmem->base; - adsp->region_assign_size = rmem->size; - adsp->region_assign_perms = BIT(QCOM_SCM_VMID_HLOS); + adsp->region_assign_phys[offset] = rmem->base; + adsp->region_assign_size[offset] = rmem->size; + adsp->region_assign_perms[offset] = BIT(QCOM_SCM_VMID_HLOS); - ret = qcom_scm_assign_mem(adsp->region_assign_phys, - adsp->region_assign_size, - &adsp->region_assign_perms, - &perm, 1); - if (ret < 0) { - dev_err(adsp->dev, "assign memory failed\n"); - return ret; + ret = qcom_scm_assign_mem(adsp->region_assign_phys[offset], + adsp->region_assign_size[offset], + &adsp->region_assign_perms[offset], + perm, perm_size); + if (ret < 0) { + dev_err(adsp->dev, "assign memory %d failed\n", offset); + return ret; + } } return 0; @@ -629,20 +653,22 @@ static int adsp_assign_memory_region(struct qcom_adsp *adsp) static void adsp_unassign_memory_region(struct qcom_adsp *adsp) { struct qcom_scm_vmperm perm; - int ret; + int offset, ret; - if (!adsp->region_assign_idx) + if (!adsp->region_assign_idx || adsp->region_assign_shared) return; - perm.vmid = QCOM_SCM_VMID_HLOS; - perm.perm = QCOM_SCM_PERM_RW; + for (offset = 0; offset < adsp->region_assign_count; ++offset) { + perm.vmid = QCOM_SCM_VMID_HLOS; + perm.perm = QCOM_SCM_PERM_RW; - ret = qcom_scm_assign_mem(adsp->region_assign_phys, - adsp->region_assign_size, - &adsp->region_assign_perms, - &perm, 1); - if (ret < 0) - dev_err(adsp->dev, "unassign memory failed\n"); + ret = qcom_scm_assign_mem(adsp->region_assign_phys[offset], + adsp->region_assign_size[offset], + &adsp->region_assign_perms[offset], + &perm, 1); + if (ret < 0) + dev_err(adsp->dev, "unassign memory failed\n"); + } } static int adsp_probe(struct platform_device *pdev) @@ -696,6 +722,9 @@ static int adsp_probe(struct platform_device *pdev) adsp->info_name = desc->sysmon_name; adsp->decrypt_shutdown = desc->decrypt_shutdown; adsp->region_assign_idx = desc->region_assign_idx; + adsp->region_assign_count = min_t(int, MAX_ASSIGN_COUNT, desc->region_assign_count); + adsp->region_assign_vmid = desc->region_assign_vmid; + adsp->region_assign_shared = desc->region_assign_shared; if (dtb_fw_name) { adsp->dtb_firmware_name = dtb_fw_name; adsp->dtb_pas_id = desc->dtb_pas_id; @@ -1163,6 +1192,8 @@ static const struct adsp_data sm8550_mpss_resource = { .sysmon_name = "modem", .ssctl_id = 0x12, .region_assign_idx = 2, + .region_assign_count = 1, + .region_assign_vmid = QCOM_SCM_VMID_MSS_MSA, }; static const struct of_device_id adsp_of_match[] = { From patchwork Mon Nov 6 08:28:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 741563 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 B824BC001DB for ; Mon, 6 Nov 2023 08:29:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231220AbjKFI3I (ORCPT ); Mon, 6 Nov 2023 03:29:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231299AbjKFI3F (ORCPT ); Mon, 6 Nov 2023 03:29:05 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D89FD51 for ; Mon, 6 Nov 2023 00:29:02 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-32daeed7771so2149762f8f.3 for ; Mon, 06 Nov 2023 00:29:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699259341; x=1699864141; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=PNu0NhO35ovIfiYPvGl781iKPTMgquYiMp0mZ7xCvVM=; b=hAqfMY8Ysmpfw86qHBPXNWGNbWKNHC3f9Qs0ZDoZKA6owl+DMyjwlcLLDLtYpQ/7Fk NwyOo21qtCOW07LQ93ntRCdPNhrR7tSPmiagPrA6Y02ZJB+x+x0E2cqpRg5yCfzb8L/e 5qxgsEyoj+uiCdmyR/LlugYJFeAnJtacoUK9oDfhhlbomIrALlPr2GQDEtBDWElv8joc T5V0lR8QWHd8VtLfhpEUJPBQeonPckSpMvfoc3aCQ0dBUiL3juY0UuY9VeaI8HEq7h3N z20Xxwpm8YuA8+aGqcpRW+lb4wNuXmi8rf7Vve2jR0T5YaDJlvQCCAs5bwIH1CmHh4R3 aCPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699259341; x=1699864141; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PNu0NhO35ovIfiYPvGl781iKPTMgquYiMp0mZ7xCvVM=; b=l9Ekm759UFl5Np0aR4cYLslLOZ9ftzTS6l8yrm4h5ssXadZVUtVMbyvukCByMzkUWU 4bqxPTFrgZJTapuzrisCcupsVK1B43DfFpITNkaslC+hO3wRzgzzIXoT7KWtQuwgZQnt g/bwQgczMjMfyC8/Vp/M7tEa2c1S1eTmzIeaEHPgIPK2T/5W33xjIE4UOCS4zinmAocm 82R79kJKRpGmLzCU1h/dnbVOzHGC/vJuA4z4ozb29YIcbSIxdeHpLYvnPiiblaM64Kbr gR0dIZATQTcVIsc+TqtuAnu11/WejLKqzuuIICnU9O72S4KjO1ROPRCNe2SpVvUlO0Hw EMlg== X-Gm-Message-State: AOJu0Yx2PDrb3NdGlfjjyQpdDTMfJJaCuEWIEWD8uauOp7jzmvgPl5Lf kWVZuu8Dn7Y3+4aS4YwUrh603A== X-Google-Smtp-Source: AGHT+IFNSWvxCMuznflCmXVJC8pcrpQ0ahid6voOMeDpvpNi4pcVt2K3yxXoEO1C4Rrjz0biHXdA0A== X-Received: by 2002:a5d:46ca:0:b0:32d:b289:4bda with SMTP id g10-20020a5d46ca000000b0032db2894bdamr23459681wrs.40.1699259340970; Mon, 06 Nov 2023 00:29:00 -0800 (PST) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id p12-20020adfce0c000000b0032dc1fc84f2sm8796126wrn.46.2023.11.06.00.29.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 00:29:00 -0800 (PST) From: Neil Armstrong Date: Mon, 06 Nov 2023 09:28:54 +0100 Subject: [PATCH v3 3/3] remoteproc: qcom: pas: Add SM8650 remoteproc support MIME-Version: 1.0 Message-Id: <20231106-topic-sm8650-upstream-remoteproc-v3-3-dbd4cabaeb47@linaro.org> References: <20231106-topic-sm8650-upstream-remoteproc-v3-0-dbd4cabaeb47@linaro.org> In-Reply-To: <20231106-topic-sm8650-upstream-remoteproc-v3-0-dbd4cabaeb47@linaro.org> To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Manivannan Sadhasivam Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Neil Armstrong , Dmitry Baryshkov X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2575; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=V+hhGqyuT9McQl2wN0mZk+6+Al3b4CJGDt+P4+rXTSk=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBlSKPISG+tdQXIB8ruDIY47ZQKBf7rTWBmkxeTL4DC OcC4d+iJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZUijyAAKCRB33NvayMhJ0eGXD/ 9YubQFacjudBzLyt+YWtzqUqEZlsQso7plhS2jq+5V2W77Nu381v3J1Z+KXagFZ8F/tP6f12Hx8y/6 OUHXcSa9OqI/A9GZPW0RimcRCMUJYQDngCMi+jOJ2SdQ1Pye1Ccg1ulWnSpxVkYojtVERA2FkBu+9c nRuYyi02rslpVBWtUG1BvyiN7xfrk8LVZuxmhxwevAv08t2ZthajAU23/Hg4XjlZhJPgGIwYLIPyrM It9iaT50OfVkjMNdmxirxqR3AX0riZDAj+E6Kg7L7jeEl3sDg3vVazOIVPhEVV11gIQl8225cZWCWZ Hh7nq46XkMM6uEIbK1Kj56A+hncnyzhgyeruZG7MMukDkh8ySnsuwwf8laPHm4EhgfdlAORmxrew/o O2rg/GHgtkToDv287zwMZ28GASEqLN28ja0sFAaZbM9rlVDCbYptXiwykcxxAqXwbfbO9dXGJHduvw pQuVHaOCF8ck9ZeXFZNs05qXQrU/EWSmTsFXM+ZH+4ruDrsKrNKsVVYnp3D05Nz1RKtM8X75rX6lPH fu3QDfIbYIA5CUdDYVgEyndfpaPHRNaVpazd9zDEMIzH/2vUwK3HhZUtAEEPHSe5jbEXvzbzfqFYis uHhT5X/pjTzs+D7XLcgmNCnlU7q+RG0vASsCrMCjhjxCupyXRv+3kbsppfdw== X-Developer-Key: i=neil.armstrong@linaro.org; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add DSP Peripheral Authentication Service support for the SM8650 platform. Reviewed-by: Dmitry Baryshkov Signed-off-by: Neil Armstrong --- drivers/remoteproc/qcom_q6v5_pas.c | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index 2ea364a04d4c..8f7429d86a6f 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -1196,6 +1196,53 @@ static const struct adsp_data sm8550_mpss_resource = { .region_assign_vmid = QCOM_SCM_VMID_MSS_MSA, }; +static const struct adsp_data sm8650_cdsp_resource = { + .crash_reason_smem = 601, + .firmware_name = "cdsp.mdt", + .dtb_firmware_name = "cdsp_dtb.mdt", + .pas_id = 18, + .dtb_pas_id = 0x25, + .minidump_id = 7, + .auto_boot = true, + .proxy_pd_names = (char*[]){ + "cx", + "mxc", + "nsp", + NULL + }, + .load_state = "cdsp", + .ssr_name = "cdsp", + .sysmon_name = "cdsp", + .ssctl_id = 0x17, + .region_assign_idx = 2, + .region_assign_count = 1, + .region_assign_shared = true, + .region_assign_vmid = QCOM_SCM_VMID_CDSP, +}; + +static const struct adsp_data sm8650_mpss_resource = { + .crash_reason_smem = 421, + .firmware_name = "modem.mdt", + .dtb_firmware_name = "modem_dtb.mdt", + .pas_id = 4, + .dtb_pas_id = 0x26, + .minidump_id = 3, + .auto_boot = false, + .decrypt_shutdown = true, + .proxy_pd_names = (char*[]){ + "cx", + "mss", + NULL + }, + .load_state = "modem", + .ssr_name = "mpss", + .sysmon_name = "modem", + .ssctl_id = 0x12, + .region_assign_idx = 2, + .region_assign_count = 2, + .region_assign_vmid = QCOM_SCM_VMID_MSS_MSA, +}; + static const struct of_device_id adsp_of_match[] = { { .compatible = "qcom,msm8226-adsp-pil", .data = &adsp_resource_init}, { .compatible = "qcom,msm8953-adsp-pil", .data = &msm8996_adsp_resource}, @@ -1248,6 +1295,9 @@ static const struct of_device_id adsp_of_match[] = { { .compatible = "qcom,sm8550-adsp-pas", .data = &sm8550_adsp_resource}, { .compatible = "qcom,sm8550-cdsp-pas", .data = &sm8550_cdsp_resource}, { .compatible = "qcom,sm8550-mpss-pas", .data = &sm8550_mpss_resource}, + { .compatible = "qcom,sm8650-adsp-pas", .data = &sm8550_adsp_resource}, + { .compatible = "qcom,sm8650-cdsp-pas", .data = &sm8650_cdsp_resource}, + { .compatible = "qcom,sm8650-mpss-pas", .data = &sm8650_mpss_resource}, { }, }; MODULE_DEVICE_TABLE(of, adsp_of_match);