From patchwork Mon Oct 30 10:03:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 740156 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 E2BB3C4167B for ; Mon, 30 Oct 2023 10:14:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232839AbjJ3KOz (ORCPT ); Mon, 30 Oct 2023 06:14:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232680AbjJ3KOb (ORCPT ); Mon, 30 Oct 2023 06:14:31 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 311901B6 for ; Mon, 30 Oct 2023 03:03:38 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4084095722aso33349425e9.1 for ; Mon, 30 Oct 2023 03:03:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698660217; x=1699265017; 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=uBEjkFtEoDLXP4jW5j4UkikPWGjNO3wSnuP7dLnI0Wc=; b=JBy4utfi+lkuFj+ksC37VXlNa1hVpO5QBnXPCE6MD4+SSh6KkV4Kl7UiNXQUQm5xoo xeKkAiMegEru36HgY0jrakg54WV3x6RnCwsGvHXN7AotPiX9HEH5u+hrFMEvYuVbVpyM OnCbkLb9bg1Mb2kbX5jLXjex56zBieffQ0NBlpS3yyROxOAdOaghvdUMftd6rEYQma1K P5k4dzbi/z6yPyv8UHuHLXmHaCDCAg+fdnIBAj3ZJW9FDmRxIcWn/+38cEv5go0sMM6e gSJsz3nr7JjLcHVPizNtLkpAxNNv/pvcAt18kb2FHgMC3FcvkT1LS6GgyUVZ+jLwd/YL pCuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698660217; x=1699265017; 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=uBEjkFtEoDLXP4jW5j4UkikPWGjNO3wSnuP7dLnI0Wc=; b=DmPSjj/owZdRMtgaeflmxLdAcEY7gK1jHqHQFUYtvCc9O7ZJyCOSF+vwHPAKNp3QiR pjEUUle6bs5zdUg6LVkwY5pota94QtysY4G0BO3KzfH+zcoOvdUg+kEYqtwQN2xy3QGK 5lms0bpQ8eCxqTh5/oQTm2K6zNzUyPEcGY+vM1m3qAdTK07M6pxMP8zs2oq1B8/4yxcG o9buJNKtA7pAdT/9xe2o52T2nxqD8e7ndbhrbAs5klrnmJ7iALuOXWCQPajfdIn87GT+ ZiUJbPteXtsHtVpewrZzUKJSLCbgUiQptOS9DAxXFG8a1NdHamIPKgJ0HY/lxulHfwIN /OmQ== X-Gm-Message-State: AOJu0YwSKvjmgzMqtW073TlYCZGEqHyhEyo91bLXS/tPFoYVZ4dnu4/9 n8oDjMt/r95bOO/wNUMCvAmPQg== X-Google-Smtp-Source: AGHT+IHy64T+PoGYYQlUsuvXeeiAf0tknKiASshoaLlDzGF9PnlqZwUBFzxBXt/ytSsEzYhHCfpvCg== X-Received: by 2002:a05:600c:5489:b0:402:f5c4:2e5a with SMTP id iv9-20020a05600c548900b00402f5c42e5amr8417691wmb.37.1698660216615; Mon, 30 Oct 2023 03:03:36 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id p8-20020a05600c358800b0040472ad9a3dsm8776700wmq.14.2023.10.30.03.03.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 03:03:36 -0700 (PDT) From: Neil Armstrong Date: Mon, 30 Oct 2023 11:03:13 +0100 Subject: [PATCH v2 1/3] dt-bindings: remoteproc: qcom,sm8550-pas: document the SM8650 PAS MIME-Version: 1.0 Message-Id: <20231030-topic-sm8650-upstream-remoteproc-v2-1-609ee572e0a2@linaro.org> References: <20231030-topic-sm8650-upstream-remoteproc-v2-0-609ee572e0a2@linaro.org> In-Reply-To: <20231030-topic-sm8650-upstream-remoteproc-v2-0-609ee572e0a2@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=3017; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=reEmefJKZGV+uJvNoYw60U/aLAM89Ky7sJqGT1KB8qg=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBlP391nsS+vxxMb7MKYMWPKKtkj7UT7Xjmy1yBa4X+ fS1m4SmJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZT9/dQAKCRB33NvayMhJ0QJLEA COC/azx2ass0U5ckn4Hi6Y475flR7DQHXwyAzdgCQOVyqqt+/3hnTJGCuDiDINzb7wYmN/a31yLK61 xo3nA5NRYFWLYKrN/Nvb4hhEvb1i89NvArqFRclVOEZYogl2kVK93MwI09orGpmVcEdAW/phYUsKp6 hKG6DW4B3Qu/8lWT7CRL3L+K+RFRv8VZe3SnmIAeK4S5RCmnwqKXeoTgm4luj9cHh+ArHhh0iWxE4K y6IYHRx+uAix+IXY9kU+JbyWXbahHNNb/5yFnUKQqdWkmcQ+0V7Xvq9AP3451Rs3mAEg1KcMHytigW 8cp+naclHK4mqBQpVQ6mhY6jiFf3GRcv8f/iR1+B2PXZQzsADTuBjEU4NL8/T/4tWgzYrJh69rGd4L BcLyP5FcdnkxGzISo+YTZKUziVQHZvky9ejdjVA+SrMJVQPTS9MM5+VuMRtFvgcbeop4qr2ITck5L6 UDv3zWKgVWGej13QYnSfEXZDFeJ7QVGzSP/TzUysbJXuQYBjiPMLj/QCxAcrvMMiKXYFxt2AE+fbVC y1yqv96YNXxG0Re+vfSlqUUyA/eEbXJg1roigRbBkaeF5mB8DChUMht3UfX8YDaDNE28Lcv+o8xkJT C1FeUGuN5oULxEIOt9zQLsArizPARi0yPVnKTFdnKXfeiyanNTjcWdfPQ9tg== 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. 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 Oct 30 10:03:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 740155 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 3FE34C4332F for ; Mon, 30 Oct 2023 10:17:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232535AbjJ3KRy (ORCPT ); Mon, 30 Oct 2023 06:17:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232538AbjJ3KRk (ORCPT ); Mon, 30 Oct 2023 06:17:40 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B451319A9 for ; Mon, 30 Oct 2023 03:03:40 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4079ed65471so31255025e9.1 for ; Mon, 30 Oct 2023 03:03:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698660218; x=1699265018; 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=ssP4KB5jQYMoyjKlHdy1AaYK1DfyUFr3e4RTz1dsus8=; b=ZGRR8Mnz0fweLmmMNEjm3tQyiiZRS0IovK/tz1SRgor5DRM0kFKsZL+7G1aTaqzTan xRudOLeO0MvNL5embfgSpW2rlUrKrBHpehJwsd1GfHKSxQKKe8KBS+F8rBexghJpNhxU eF1+AhqfjEbx8c+S3Ai0zrxzt+oktdcs1F7vyLOp4kkAg2/MQNsZ3j51LGAz7n0HNnx7 rqaDQOCmtTj273O3Kyz6c9qxksqXHgHzXnbdysJXrkDF8oKKyWDKUgxJVEdB8d+aiL6D CJ61nf9OM6vU4XSfKLYGhMNfLwkUdMui5usqDaTvtwKBudIVi9jXKvfXHS3WmyVG3a/c eDxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698660218; x=1699265018; 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=ssP4KB5jQYMoyjKlHdy1AaYK1DfyUFr3e4RTz1dsus8=; b=tcZafxBmmqid/8C1oqSKw8aj9luI6QoFm+luH86BI02DWw5mbmQ9U7XIx+e9Rx800X rVYNrVRdqk8T9eDZyLJo6CSB5yoDFy+BC+GYmbC3o9CvcZ27DFfxQfcP/TW6aelwySJi 3NwD9pLnhsdfTQlkVZVTiBR4bWgyySIHca++7IRAQYfsBvecAvmkgm8suLnpQyW640ud Bl2N8C8BOqKuJfA2oYKOl4RkV23qxsRz9qSJcCJo76z/tmvIq8G2OpLz92b8F+R2qW0X j9SfbJJhnWzvdpiSiSuM96yPIYSGrfxC3cC3Trg3emq4BSq+iE2LhZe1aEsVEkSbfvaK P/nw== X-Gm-Message-State: AOJu0Ywytqp5of4P/NEzHrzXMZ8eyZ1XPDckmgZ14XxY4SY9sjW0p+Ws lnG/cZyli++vyya5yasarTqhOA== X-Google-Smtp-Source: AGHT+IGU4WGLWFwmmfINDCqcuCN3MipD9JqGNMvyYWk3kt4Gd8D6RntrGPdd34aBqxa6DICnnsJpQA== X-Received: by 2002:a05:600c:5488:b0:401:2ee0:7558 with SMTP id iv8-20020a05600c548800b004012ee07558mr7491764wmb.32.1698660217674; Mon, 30 Oct 2023 03:03:37 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id p8-20020a05600c358800b0040472ad9a3dsm8776700wmq.14.2023.10.30.03.03.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 03:03:37 -0700 (PDT) From: Neil Armstrong Date: Mon, 30 Oct 2023 11:03:14 +0100 Subject: [PATCH v2 2/3] remoteproc: qcom: pas: make region assign more generic MIME-Version: 1.0 Message-Id: <20231030-topic-sm8650-upstream-remoteproc-v2-2-609ee572e0a2@linaro.org> References: <20231030-topic-sm8650-upstream-remoteproc-v2-0-609ee572e0a2@linaro.org> In-Reply-To: <20231030-topic-sm8650-upstream-remoteproc-v2-0-609ee572e0a2@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=6167; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=i9GgDCC6g7mU5EIa98I5Xi71yOCJg6QFzSORhu8lHB4=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBlP391B5JQ3SVWxZ+JqmrRuIDVmqL7qt9tDX1CD0DS 8ej5dAqJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZT9/dQAKCRB33NvayMhJ0SyrD/ 43VvuyHtjG2+8030sfn/NxmEgUB3wb4hy2Y7AKO5ms0D6OEPXthtQN8n7jbDtRI6aRclAl5CigNE60 eb6h+Pt+NLBDsZL/QH48chngz8kCfEfsRkZz+7T5oJqF2pAWf0qy7h8d8K3fhyOemOoeGZ/ywUKJfN TMywfWYZsNcj4kIflyJ32DydzaErEWRtin4Swba0EXs698AzR0qCBGKtF6dj17s20m3W+wn4lara+t Mgd0WGheM5AXZ6CIBN8ioTtGIudtWpChrADsB7KWArP6zwx5oTdXUlLtLC3lnlTxLIEWmc1O3zJKal 4ZNAISEipw003Kk8c//7WXbiRkTohQMN2k4TUzKcVFQ3bVwn9I2UWc2DLZ1ScmyU6Ai88/27sG9NI2 QkmBXfikgnyMMFVhbnlStM3zAhOcqdnHG8xY9PkbS1dgIkCkay5TrSmaXTzybCbVGFPDjXe63ibLqS vi3MpO5CHta3N1hOgq8LZ8m8J250/X6kDFtRs1v4vYf1jpp5CItbkVXPsHdm39zjkMK1iv8jqNnZZZ Pmt8TWeoIIeL2E0lUh3zWqjDWOh7eZYHtzOZ4QSDyEPFFEIwoKEC9Y6ZYpdu5Z0YfVUDjAuDFBXpSV lPl99CHBgkkaCN5gs5oQOJbIgtFR5949Anx6kjfG7FVKm7RY0D3IbpSqdvjw== 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 | 102 ++++++++++++++++++++++++------------- 1 file changed, 66 insertions(+), 36 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index 913a5d2068e8..4829fd26e17d 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,52 @@ 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]; + unsigned int perm_size = 1; struct device_node *node; - int ret; + int offset, 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 +652,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 +721,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 +1191,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 Oct 30 10:03:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 740157 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 B91DEC4332F for ; Mon, 30 Oct 2023 10:09:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232119AbjJ3KJm (ORCPT ); Mon, 30 Oct 2023 06:09:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231741AbjJ3KJl (ORCPT ); Mon, 30 Oct 2023 06:09:41 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD5B88A65 for ; Mon, 30 Oct 2023 03:09:38 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-507b96095abso6104099e87.3 for ; Mon, 30 Oct 2023 03:09:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698660577; x=1699265377; 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=0y2DFM2LPG1teWJjvY3TK3xeJgx1vKnV7mxdqKxnohk=; b=tKCc/efLj+7bgIAOLvIdZsm10f5eLlM2T3AoIXuoiPK7FbY8avl1C7jOmpMfvcn2Kn a9bO0xXoyiWATd6rAsgXE5cl/G6Ui+mY2dKz2GmFryk3t9dqBJlbhjIDYSyjviCYOytV C181xeyqgmkarGPkKL+gX21rNL9uBUqZrVm3unI1wDL350aMlxjSt9nsDT8A9zfdI6He LpKQUOrdoFyJSn4nOO2dSlEmDuhMdcFiCyphIOgDMct9Gqim3aT9CYsni+OaDUkq16kE e08m1eRLIKrdUlO8QRL39kw7DlZmmYRcASKgJp7a+6DAullfXAp6GJ0jRG/rC0/U/Atv mO7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698660577; x=1699265377; 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=0y2DFM2LPG1teWJjvY3TK3xeJgx1vKnV7mxdqKxnohk=; b=wzIjNUSWNgZyas4lA5nIZ+8lkU68uBhopnMrioVzAjJZRYc/J1kYTnWdkaFIajkgt0 4BHEVTc+UCcIOa9fyZCqPVaYrSOfsfMPg0lxIIPTwpE8tr6dvRZL386P/yKEVsG0k6yj FgbYJ0pt5KH0S9AST71Qu4dw6xwyiVBi6+ZyDELodNb06ypJ1zYc3r9B+WEboGLRI299 KWyGRJt+99NsBipPz5KOURxo5YP0+f3VKzvc8M9CWJgZCpWdYkWI7C7OJA6eqFqJmrbL dXcsGGy6sNtkxNUISQoWovUsll25XUBIG3WiK1pCqgbsxvJS4gLxVYIPDNt6/Rg0e3P9 57Bg== X-Gm-Message-State: AOJu0Yy+i1IzFLbFf6B23wgB6GWgJ12VQ0f0ZLJ8GBqgXD8sU+8TYBhD 9uR2QZIOGkCHi1HBL0MiTyLeBeEgTHDK+wVSpFBabg== X-Google-Smtp-Source: AGHT+IHNBxn3cXELrnJX/E2SxZW5Wl5MWkraZKMmV4K8N0LwWPmPM9LYKjpQUbaZXuJpAe61yveeQg== X-Received: by 2002:a05:600c:468e:b0:3fe:e7b2:c97f with SMTP id p14-20020a05600c468e00b003fee7b2c97fmr7183406wmo.36.1698660218664; Mon, 30 Oct 2023 03:03:38 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id p8-20020a05600c358800b0040472ad9a3dsm8776700wmq.14.2023.10.30.03.03.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 03:03:38 -0700 (PDT) From: Neil Armstrong Date: Mon, 30 Oct 2023 11:03:15 +0100 Subject: [PATCH v2 3/3] remoteproc: qcom: pas: Add SM8650 remoteproc support MIME-Version: 1.0 Message-Id: <20231030-topic-sm8650-upstream-remoteproc-v2-3-609ee572e0a2@linaro.org> References: <20231030-topic-sm8650-upstream-remoteproc-v2-0-609ee572e0a2@linaro.org> In-Reply-To: <20231030-topic-sm8650-upstream-remoteproc-v2-0-609ee572e0a2@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=TkT4wt2310yY48l8xXkR00+vzE+Z0XLgSG9XiuLyvd8=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBlP3926H6Bkp0+nf/AY+ehqBs9OFnmvuUcSNhbC5Wg DgZCfHWJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCZT9/dgAKCRB33NvayMhJ0e6gD/ oC7S01eR3M+XOzwocTiaklsW1VDVZEGPr2KQSk0btLyxh555v3hDGDWiLpmosZgQSCgxWul4PWhn/X oEbMpV44ndrQgaZbtYZNXwvF6JaINpDTxyI/U8Ftm+Re+mFTXfpw46KZOzJXH1eTT4zC4DpL5Q9OjZ Otmu1QTSxJHG9BvbbrmkCiVQ00r5bXlSs4W1euAAQjvK1RrMFpo/Fa7sKRaBzV8XFsuFp1UnAyIXKM m3s0dsWbMy/IbzVaKigmH2ayWFZ6RJdtQtFycfpRWFqkDRdg0j2Q5bHXv937HQHjdOk1RTtm9MvWTz 1YmVipyvX5LqhjtNlPi33FgBhQ4cCNLUe6wAsYbEcYmxEBKgmG7+ydNQeD5OsIY5qPtOz49U+zDO9w tfdPrKfKJikQCG5dw5GlsHfxsSL8ACjSJ7G4slKp4QT6BNh4ynfYZa9V2BVUVGVp9nPnZst3zf1TW9 35gnkAZa0151zHyZst1bRsTst06ulB/qtv9TCmM7hyxmFLofbcexIne5EBMkhPW25/KtNVqGCrA+X0 m3iE7OajbR77RIZmhgmevkL6VnaUaLDLn5vHBE12DH+jo5jTfuCp2IiaxqGdigXVd04ajOxvw/GMMp 2ceqFRqepwQX1xAe2/rrV2/QFLdP7DEvsIXmh3JAmD2+m9u3at/5ig7mXqow== 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 4829fd26e17d..c593e6d529b3 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -1195,6 +1195,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}, @@ -1247,6 +1294,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);