From patchwork Wed Nov 16 10:16:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 20869 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp60488wru; Wed, 16 Nov 2022 02:18:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf4q5OKb+NA1wBNNEnBS3GotsTu+oZJBssr2QMIdMs8+49w/U5at8elNJK+iuTbQ/skrm732 X-Received: by 2002:a17:906:d8a3:b0:7a0:9d58:5c7b with SMTP id qc3-20020a170906d8a300b007a09d585c7bmr17361394ejb.115.1668593904658; Wed, 16 Nov 2022 02:18:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668593904; cv=none; d=google.com; s=arc-20160816; b=bOSlZzeMSrQJlW4SGnJEvgSjsSW7irT2E0SBYgAxDPAQ0ITaQMTmeOoXAhzuQJaqW0 ZuStHc5PHU5M7wb6ZNrRWTRLuJYUjmjcywWLG/hFs8idJNEa4/nBRSovrpc+EJqOjtHb VGC+KK3a8Eejl5xV6JuWDB6XLLGa0aHvB0wtNbQSDZsW5IWB2CeccnDagUzWlqSyxa+C IcJ5z7YqmpmWHrVrSrS0kgbq4vc5eZJMFonDTEtXcWeVwLcc70gvyrpbt/gkBqi28Qv7 d2YSwNlo2SFWfm3xbvvuUU/Iy0JSGnIY7xbQ7HexepL5lM2Sybpgbi2iM3Yf0QiW71MP anbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=Pu7n9N+0O5BDIzgboei0EVzrkBbQ6PttgZW+WxRWsp0=; b=yPUY6/Md1Hx9dzvrJVYoDFNB/7Gu870SGvQNvOgSHzo9OTd9wDQ0duO2L16La1Q0fz U/QdAYPKa1i5D0i/gxqheX7QaNc7Mjn+74/CMyAsqBrUm1y+RV88FbrSmEULkCLj3z8h Ih2Zw+vbHK7F5yKcoiww8/25v3rlzjfwFP2SGi34hSA8GJaWVfMb/bdVkHM/ly/Bhldu TyuWU/PZzHKEjehJJyeDIShYMQEwBd1LoshmlMKKbhZFPpyfplpY4QpG7WrTi+zGRNir NjVIIF7mInp1zSxiKILlpxSv8/LpMi6SRqTT1Xh7oWlEt3cOzdfAHa7+70IFXE9iJfdM Z8iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="G7Z5/x6S"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh18-20020a1709076e9200b0078e11e9286csi11359131ejc.195.2022.11.16.02.17.59; Wed, 16 Nov 2022 02:18:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="G7Z5/x6S"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232965AbiKPKRR (ORCPT + 99 others); Wed, 16 Nov 2022 05:17:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232877AbiKPKQ7 (ORCPT ); Wed, 16 Nov 2022 05:16:59 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2D9FBF47 for ; Wed, 16 Nov 2022 02:16:57 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id cl5so29093062wrb.9 for ; Wed, 16 Nov 2022 02:16:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=Pu7n9N+0O5BDIzgboei0EVzrkBbQ6PttgZW+WxRWsp0=; b=G7Z5/x6S57rt6bfL4e5y1ndNXKgn6SQ2r47XxAXklpogTiYtUVc4LvU9HBUhUJIqGW CK/RD7IJL+hmfAug62nieUT/iNNNbFxjBjG54g3DznfPOnDpToG1tWBl4fE/I4oVSyCO 4jEnCBQaDRAweOJsgDP1ODET/dfz5n8L5XZklazjKgl8+BIae0F87+KL+D9X0+XZwIT4 QsUF30r9TEYrHr1ijeJgDRUSdBdISVqwZplQOwRi2+nivnzQ3td5bKYB3Geca08WoPET egj5FJHXUum+8qtFXc8ivx36sR65ZqtkN7iFMkqqdE/T2j7mbOW9ia4E7/WwmzHAHsN6 SVfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Pu7n9N+0O5BDIzgboei0EVzrkBbQ6PttgZW+WxRWsp0=; b=m32N/nZ7tHx2QvIt9pVkgq24V6myb5HMf09SXsVWBqHO75L9E7FDscgWLFnYS5D0nI rZsP5xyIi+yRvFRSLc0EBnard5qKSfudhYqpLY1hhDqqLqv+sIIPBJ6chvfQULaXW4Ym wTuTf4HywbmJfAp2x3Sr4bLcjOsm+0ZGty3RytvjpMg+l43frYH83MUipEV6T2Ps+HSK W4S7iba7JHGc53Cvk85hzdDvtYPe7kGpeHYekpboX3GJNGT3Y4yxFABUViW0P5Yovc0P kS75k4wuHRcTgEueOkBSZWklnklJ5iqJXm6m8vLYUu+bAgPk7C8vu0Ks78lWmRK2kcZ2 0EHw== X-Gm-Message-State: ANoB5pmaMYuO89NFz3kXQ3ADbAgh9JSb+myYxnBgSYpZ5Xcl6DsjGk7A TVvxlHtdCiZb2+pxm44SmlDxJg== X-Received: by 2002:a5d:43d0:0:b0:236:4e3c:7720 with SMTP id v16-20020a5d43d0000000b002364e3c7720mr13509880wrr.674.1668593816360; Wed, 16 Nov 2022 02:16:56 -0800 (PST) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id c4-20020a5d4f04000000b0023672104c24sm15081007wru.74.2022.11.16.02.16.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 02:16:56 -0800 (PST) From: Neil Armstrong Date: Wed, 16 Nov 2022 11:16:52 +0100 Subject: [PATCH 1/2] dt-bindings: reserved-memory: document Qualcomm MPSS DSM memory MIME-Version: 1.0 Message-Id: <20221114-narmstrong-sm8550-upstream-mpss_dsm-v1-1-158dc2bb6e96@linaro.org> References: <20221114-narmstrong-sm8550-upstream-mpss_dsm-v1-0-158dc2bb6e96@linaro.org> In-Reply-To: <20221114-narmstrong-sm8550-upstream-mpss_dsm-v1-0-158dc2bb6e96@linaro.org> To: Konrad Dybcio , Bjorn Andersson , Krzysztof Kozlowski , Rob Herring , Andy Gross , Frank Rowand Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Neil Armstrong , devicetree@vger.kernel.org X-Mailer: b4 0.10.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749647522660075591?= X-GMAIL-MSGID: =?utf-8?q?1749647522660075591?= This documents the Qualcomm Modem Processing SubSystem DSM shared memory. Signed-off-by: Neil Armstrong --- .../reserved-memory/qcom,mpss-dsm-mem.yaml | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Documentation/devicetree/bindings/reserved-memory/qcom,mpss-dsm-mem.yaml b/Documentation/devicetree/bindings/reserved-memory/qcom,mpss-dsm-mem.yaml new file mode 100644 index 000000000000..65f37e1356d4 --- /dev/null +++ b/Documentation/devicetree/bindings/reserved-memory/qcom,mpss-dsm-mem.yaml @@ -0,0 +1,37 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/reserved-memory/qcom,mpss-dsm-mem.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Qualcomm Modem Processing SubSystem DSM Memory + +description: | + This binding describes the Qualcomm Modem Processing SubSystem DSM, which serves the + purpose of describing the shared memory region used for MPSS remote processors. + +maintainers: + - Bjorn Andersson + +allOf: + - $ref: "reserved-memory.yaml" + +properties: + compatible: + const: qcom,mpss-dsm-mem + +unevaluatedProperties: false + +examples: + - | + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + mpss-dsm@86700000 { + compatible = "qcom,mpss-dsm-mem"; + reg = <0x86700000 0xe0000>; + no-map; + }; + }; From patchwork Wed Nov 16 10:16:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 20873 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp60960wru; Wed, 16 Nov 2022 02:19:39 -0800 (PST) X-Google-Smtp-Source: AA0mqf7cadR7X3ulC6kqDZA4bDJsJoyddQFhBIdf0xo8Da/0utSUbEA5JVtbSvMO9Buas/dch8e3 X-Received: by 2002:a17:907:6d9d:b0:7ae:63b8:d688 with SMTP id sb29-20020a1709076d9d00b007ae63b8d688mr17624612ejc.222.1668593979340; Wed, 16 Nov 2022 02:19:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668593979; cv=none; d=google.com; s=arc-20160816; b=TailZJ+zxnA2z0ONFNUFSCIP6MhhHXHEdQO2PLaPzOOBD0daouvOLDIWFPHI/VdfTd 7kdO7KQWkE+7UAi7uVU7zKjd8RFaJUntnWILCK171WsIVwjVK/0ET2o3qJRhhoqyZqVP q4WVQUjJPcdt3cc1GOiXrbCwM9Nq65xexQ5SzsHtWSeyBPA+++vccTtziGkY8A132f80 F41jeYD9h2biDDF2rc70+Yy6lNCkfLsIieY1ekga+lM+eGj6NiR5CK5rN4NTr7KUzw9x vtpN6ToffVMVo3MZV3oRdgBOHkLsc/qu//FACw3I+no5R4+Jpbc0c/BmGfd7N5iy9PuF Ltbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=Fw5QT1NVHfKKpmW7+khEKT2Vh+eUJ/stlclYXIud4p4=; b=roAhuNnAhsYpK6PnqmxKyZWPaUC7m3jI+zweqcB0+gbhBCx/Rc+XPEohA0zohALOMg vLsoGvbMOc44AGE9r+Wyj+HDpJwgnQvkgOfa/DbCZ9WcxFX514LKZbjmIfPD7HfIEPIT h31eZmXciQv1r3azEMiNmLfdNHFXXj/x6sN48rwFG1bPUq1vUBS55CqoDqhcpqgUkDLo Da2FeCieZ6Fa/FILgBJVwMxjDacM4G2rpk24uQx9qjVG/sEJtSC28jtfyAjD7fGoj+U6 jIonAIqeiTlOQwcRlA4dOXqtNNOvKGh6nPAXT6fUaGHN/L7CHyL9Myc6moS2k1lHVcay MAoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AH4KC2hi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb18-20020a170907161200b007add6c835a9si14294060ejc.867.2022.11.16.02.19.15; Wed, 16 Nov 2022 02:19:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AH4KC2hi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232974AbiKPKRU (ORCPT + 99 others); Wed, 16 Nov 2022 05:17:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233033AbiKPKRA (ORCPT ); Wed, 16 Nov 2022 05:17:00 -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 A51BE13EB8 for ; Wed, 16 Nov 2022 02:16:58 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id v7so11555870wmn.0 for ; Wed, 16 Nov 2022 02:16:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=Fw5QT1NVHfKKpmW7+khEKT2Vh+eUJ/stlclYXIud4p4=; b=AH4KC2hil4/jmyYmqRsMSX5cx0eNktRhCSImGrZTarg8ROS+AJJymBA3cJiCkvF+ae 4Tqwi8a+tmYCgrGaQxj6gwPXqdnT3URn+L54FPs4KIFgNWGaAByu7HcQfyxN3k+FKJGy bVhTW72QmTu6fluMBvGxfriYQJJny49DtROFfAf+GlRHi0dOUMGZtPSIQUMdYD/dgr7Q BR5o+Q6SLuR83UoSZB684bEuF47FkxYjJbOAvr6K48UDxcPFGijbgsVHaNpIdkdxr/v6 7r3fXC32gdItRwkBT/1NJTwU3tyX2yVq66TueF65YAv5jG2SQ9eUZNaGLF0Ejf2Mczwt kB1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Fw5QT1NVHfKKpmW7+khEKT2Vh+eUJ/stlclYXIud4p4=; b=LLwUHLH8BuskrQPwtoPZjba+L3NBGYIovXVN7IEA3txhAz0va67jIrCA58sl7sKrVD TCT3bDsvqVWFkQ8F2kynI+2u8S04ZnntKkhtfJOvfiGGnapy93oZP58s6ujjE5vZJlUW PVx/EbTq5jd16sqIges0rI/yM3LCH4LS447aUsfre+RglfHAGtl6dpTQZGrQ6mljoH6q pjbibpwH4L/0ddiai9yn0JkGsAjnL56ALcLPY+SzKCVULo3ldNZ+REVnzh4uVoScJNIk 82p+7iiXfBfFSrPSU5utHfhcLLW41x+ygv5oe9UnjfHaxV68K6PD/o/QimmsOxpBDAdC PZGQ== X-Gm-Message-State: ANoB5pnXpUlevyqc5hIQYrWz3FndTDlpxU/SQe0nfVAdhGtu86BLOfle DsqRlIC7bnmokFKpnsFsJ2vSZg== X-Received: by 2002:a05:600c:a14:b0:3c7:a5:6113 with SMTP id z20-20020a05600c0a1400b003c700a56113mr1632321wmp.129.1668593817181; Wed, 16 Nov 2022 02:16:57 -0800 (PST) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id c4-20020a5d4f04000000b0023672104c24sm15081007wru.74.2022.11.16.02.16.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 02:16:56 -0800 (PST) From: Neil Armstrong Date: Wed, 16 Nov 2022 11:16:53 +0100 Subject: [PATCH 2/2] soc: qcom: add MDSS DSM memory driver MIME-Version: 1.0 Message-Id: <20221114-narmstrong-sm8550-upstream-mpss_dsm-v1-2-158dc2bb6e96@linaro.org> References: <20221114-narmstrong-sm8550-upstream-mpss_dsm-v1-0-158dc2bb6e96@linaro.org> In-Reply-To: <20221114-narmstrong-sm8550-upstream-mpss_dsm-v1-0-158dc2bb6e96@linaro.org> To: Konrad Dybcio , Bjorn Andersson , Krzysztof Kozlowski , Rob Herring , Andy Gross , Frank Rowand Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Neil Armstrong , devicetree@vger.kernel.org X-Mailer: b4 0.10.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749647600516960988?= X-GMAIL-MSGID: =?utf-8?q?1749647600516960988?= This adds a driver for the Qualcomm Modem Processing SubSystem DSM memory used to assign such regions of memory with remote MPSS processors. Signed-off-by: Neil Armstrong --- drivers/of/platform.c | 1 + drivers/soc/qcom/Kconfig | 10 +++++ drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/mpss_dsm_mem.c | 95 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 107 insertions(+) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 81c8c227ab6b..d5a9962641f4 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -504,6 +504,7 @@ EXPORT_SYMBOL_GPL(of_platform_default_populate); static const struct of_device_id reserved_mem_matches[] = { { .compatible = "phram" }, + { .compatible = "qcom,mpss-dsm-mem" }, { .compatible = "qcom,rmtfs-mem" }, { .compatible = "qcom,cmd-db" }, { .compatible = "qcom,smem" }, diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig index 024e420f1bb7..7624a8af56bf 100644 --- a/drivers/soc/qcom/Kconfig +++ b/drivers/soc/qcom/Kconfig @@ -95,6 +95,16 @@ config QCOM_QMI_HELPERS tristate depends on NET +config QCOM_MPSS_DSM_MEM + tristate "Qualcomm Modem Processing SubSystem DSM memory driver" + depends on ARCH_QCOM + select QCOM_SCM + help + The Qualcomm Modem Processing SubSystem DSM memory driver is used to + assign regions of DSM memory with remote MPSS processors. + + Say y here if you intend to boot the modem remoteproc. + config QCOM_RMTFS_MEM tristate "Qualcomm Remote Filesystem memory driver" depends on ARCH_QCOM diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile index d66604aff2b0..0d0e850f1a18 100644 --- a/drivers/soc/qcom/Makefile +++ b/drivers/soc/qcom/Makefile @@ -16,6 +16,7 @@ qcom_rpmh-y += rpmh-rsc.o qcom_rpmh-y += rpmh.o obj-$(CONFIG_QCOM_SMD_RPM) += smd-rpm.o obj-$(CONFIG_QCOM_SMEM) += smem.o +obj-$(CONFIG_QCOM_MPSS_DSM_MEM) += mpss_dsm_mem.o obj-$(CONFIG_QCOM_SMEM_STATE) += smem_state.o obj-$(CONFIG_QCOM_SMP2P) += smp2p.o obj-$(CONFIG_QCOM_SMSM) += smsm.o diff --git a/drivers/soc/qcom/mpss_dsm_mem.c b/drivers/soc/qcom/mpss_dsm_mem.c new file mode 100644 index 000000000000..5584bd101aee --- /dev/null +++ b/drivers/soc/qcom/mpss_dsm_mem.c @@ -0,0 +1,95 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2022 Linaro Ltd. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +struct qcom_mpss_dsm_mem { + phys_addr_t addr; + phys_addr_t size; + + unsigned int perms; +}; + +static int qcom_mpss_dsm_mem_probe(struct platform_device *pdev) +{ + struct device_node *node = pdev->dev.of_node; + struct qcom_scm_vmperm perm; + struct reserved_mem *rmem; + struct qcom_mpss_dsm_mem *mpss_dsm_mem; + int ret; + + if (!qcom_scm_is_available()) + return -EPROBE_DEFER; + + rmem = of_reserved_mem_lookup(node); + if (!rmem) { + dev_err(&pdev->dev, "failed to acquire memory region\n"); + return -EINVAL; + } + + mpss_dsm_mem = kzalloc(sizeof(*mpss_dsm_mem), GFP_KERNEL); + if (!mpss_dsm_mem) + return -ENOMEM; + + mpss_dsm_mem->addr = rmem->base; + mpss_dsm_mem->size = rmem->size; + + perm.vmid = QCOM_SCM_VMID_MSS_MSA; + perm.perm = QCOM_SCM_PERM_RW; + + mpss_dsm_mem->perms = BIT(QCOM_SCM_VMID_HLOS); + ret = qcom_scm_assign_mem(mpss_dsm_mem->addr, mpss_dsm_mem->size, + &mpss_dsm_mem->perms, &perm, 1); + if (ret < 0) { + dev_err(&pdev->dev, "assign memory failed\n"); + return ret; + } + + dev_set_drvdata(&pdev->dev, mpss_dsm_mem); + + return 0; +} + +static int qcom_mpss_dsm_mem_remove(struct platform_device *pdev) +{ + struct qcom_mpss_dsm_mem *mpss_dsm_mem = dev_get_drvdata(&pdev->dev); + struct qcom_scm_vmperm perm; + + perm.vmid = QCOM_SCM_VMID_HLOS; + perm.perm = QCOM_SCM_PERM_RW; + + qcom_scm_assign_mem(mpss_dsm_mem->addr, mpss_dsm_mem->size, + &mpss_dsm_mem->perms, &perm, 1); + + return 0; +} + +static const struct of_device_id qcom_mpss_dsm_mem_of_match[] = { + { .compatible = "qcom,mpss-dsm-mem" }, + {} +}; +MODULE_DEVICE_TABLE(of, qcom_mpss_dsm_mem_of_match); + +static struct platform_driver qcom_mpss_dsm_mem_driver = { + .probe = qcom_mpss_dsm_mem_probe, + .remove = qcom_mpss_dsm_mem_remove, + .driver = { + .name = "qcom_mpss_dsm_mem", + .of_match_table = qcom_mpss_dsm_mem_of_match, + }, +}; + +module_platform_driver(qcom_mpss_dsm_mem_driver); + +MODULE_AUTHOR("Linaro Ltd"); +MODULE_DESCRIPTION("Qualcomm DSM memory driver"); +MODULE_LICENSE("GPL");