From patchwork Fri Nov 18 08:53:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 22210 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp77169wrr; Fri, 18 Nov 2022 01:06:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf6j/44gv2r0Nvwe6z5B2xWKoRUqDv6+OBdlh/X6cigZZiQX/pNoK++Fyz1pUMLmLxyopZlS X-Received: by 2002:a17:902:76c8:b0:188:635d:5cf1 with SMTP id j8-20020a17090276c800b00188635d5cf1mr6946487plt.53.1668762407625; Fri, 18 Nov 2022 01:06:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668762407; cv=none; d=google.com; s=arc-20160816; b=IvlXhitPs1lhluCMyrgqKCbLZ2L7DYpkVpI3lmu9MFXe/WQ73sVvsreRKOhZEphiuV 5yYVqTHGNVACxCHMn07YNNWbeMy7CIboJ0np1nntjnCcVkhn7D1HvnJfhTHaTB6wVbnq wHPSpMMaD6/J7nlSLpLylWZnnhgBo7VsLI7IiHhEA4gqhqEkLBhFFPKs7sqSWiwtIVIT dZy7m3GIo7Vg9l9BTs/MFW2w6zZsWyl8k+2at4igIwEdhc2jQl2hoODwcVjjj/ZWNm2j 7pNN+RxXP0i4ZWScXXFdOkhyP1BDadaPGrH6bHwMBVLtrLQSbE007Cj058BXY+mFyh4+ PM+w== 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=HmJBD0oRRMzrYbbDbAItcJ2A5J5IdD5EulvQFU5WhFQ=; b=Zo/vmm8nQDWJ1d2aafL1j9YsMKu9BnxejzGi4s8RhrfqWI7apWOGyLsSqt4VLf1M8P TMgCSmzKvzEUBldcB00vrnXtZZzhVS1uCaxULncyONL50XKNhgAexq6hoFGiRAwNvhAW mYUycPG5482wrbalTdsg1uMmWbwWo3ouxxPeyrc2WKFPcN45gjCJbh7ZAFp+NEEcaAks 5XkXUfoBfGe2ZciPqXKKPdewK36w1r37+5g4MmVCuQmxmsQ7BEqzN21W++rASRhdu0Te HMpPvCeknT2tiyds4GFeDyQwAq2j35zwh88AZeozWiF1+is9tWfLZFwoW+Ejc1Lhhhom 8xIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bv5E3mA3; 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 q19-20020a170903205300b001868375410dsi2898105pla.64.2022.11.18.01.06.34; Fri, 18 Nov 2022 01:06:47 -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=bv5E3mA3; 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 S235278AbiKRIyE (ORCPT + 99 others); Fri, 18 Nov 2022 03:54:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241609AbiKRIx4 (ORCPT ); Fri, 18 Nov 2022 03:53:56 -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 E60C761B84 for ; Fri, 18 Nov 2022 00:53:52 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id v1so8156930wrt.11 for ; Fri, 18 Nov 2022 00:53:52 -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=HmJBD0oRRMzrYbbDbAItcJ2A5J5IdD5EulvQFU5WhFQ=; b=bv5E3mA3ICFc4Gy7Pj5mCjK+LyjNhb7SSFEw7WR9E/RO3qeKKTFVcyJMHkxQRpWERn jr9eXOrD34kDfEkal59Ybf+VE23crhBsnn6UXhl5m32LkjGVyFe8lC81k5z8+lSbQp/j xtpaXXjg+efWClyQRYQ5QLCvVVMcdDogS4L4Ta1s4C3FWZwqQAJnLXWkRpMgo5UQ1/fG +WSGTO/Pa9sLQ1/SYbjKEL2Ou+DTUX1GOgVhIba46ENJLeTTJVKyVOBgy3Zxaq6wSogu oVzpSllwYl4wfdKKNWFDq/ZLW+jZ+UOUlNvYVRwJPyHQ72RkuH8K+Fi3tRjb/ytTZG3Z m69A== 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=HmJBD0oRRMzrYbbDbAItcJ2A5J5IdD5EulvQFU5WhFQ=; b=2AWBIXDuICg9KglltPvrXTFrRP29UtMbpmDE0iR8mRZqCLVcHuc3zIrn1phN0FRIQp 40Kc7/qDJCZ3WHX9Ts63VDCQBD6HYOfmV+QyFdJAEmtteFXA/iG7KyOQoVrImAXgEg4y +ea4tfCcC7cFXyO691vz1Na4MJ1jBPy6q/lr3IXcdAVDG4+Skg1R/w2Lz6ygoDDxTYv6 QpPupKxb+VSkgm7WNNe/Q9tYQYlf/SDXmqm5hBL/uncJxNQXbYv87qh+nHTaaHOeAse8 D6VQvw5302J+FNraGHG6xupypDfbo0YdYnnc/5X44bq64uz8wKTYNUsZ17HHjON44URe tOTw== X-Gm-Message-State: ANoB5pltt3xARgO6MjlF1qJv0SLFdHheRE/Eq+/+RqakjOMRwBJulVB+ bcMjNqr5t0Hv6e67NbQKsNj5UQ== X-Received: by 2002:adf:fdcb:0:b0:22e:386f:4088 with SMTP id i11-20020adffdcb000000b0022e386f4088mr3700848wrs.526.1668761631098; Fri, 18 Nov 2022 00:53:51 -0800 (PST) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id a13-20020a5d53cd000000b002383edcde09sm2971264wrw.59.2022.11.18.00.53.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 00:53:50 -0800 (PST) From: Neil Armstrong Date: Fri, 18 Nov 2022 09:53:48 +0100 Subject: [PATCH v2 1/2] dt-bindings: reserved-memory: document Qualcomm MPSS DSM memory MIME-Version: 1.0 Message-Id: <20221114-narmstrong-sm8550-upstream-mpss_dsm-v2-1-f7c65d6f0e55@linaro.org> References: <20221114-narmstrong-sm8550-upstream-mpss_dsm-v2-0-f7c65d6f0e55@linaro.org> In-Reply-To: <20221114-narmstrong-sm8550-upstream-mpss_dsm-v2-0-f7c65d6f0e55@linaro.org> To: Bjorn Andersson , Frank Rowand , Konrad Dybcio , Krzysztof Kozlowski , Rob Herring , Andy Gross Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Neil Armstrong , linux-arm-msm@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?1749824210419493683?= X-GMAIL-MSGID: =?utf-8?q?1749824210419493683?= Document the Qualcomm Modem Processing SubSystem DSM shared memory. This memory zone is shared between the APPS and the MPSS subsystem, and must be configured during the whole lifetime of the system. 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..226d0dfc422c --- /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: | + 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 Fri Nov 18 08:53:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 22211 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp77259wrr; Fri, 18 Nov 2022 01:06:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf5DWa9DWomoWC5UlEwzBpFzmxLYLKgnwu4zht2TUMd/m4HiFm9Im0PIWAONHx1lYp3CrkZw X-Received: by 2002:a17:902:eb81:b0:188:4f8b:dc59 with SMTP id q1-20020a170902eb8100b001884f8bdc59mr6640484plg.50.1668762418782; Fri, 18 Nov 2022 01:06:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668762418; cv=none; d=google.com; s=arc-20160816; b=Ykt8WnZ/NRcJzlpOH/ZMFU7lalNZuu8Bi2CIs87HAUsmQbvesPJn5zRXx/KUHUs5xH D8BupTqSpnChvVPHE6+5mna6Go3xvLVVFflNbohDArKFJoPvjhKg5lr+tOiMEnY5LgaY VKLlmJDVQ9hvsJkh6fKHFW0CpYokWV+62bXWuKOMjOW24h/AfW4Ho6nBvplQ6TtFfacU a5EmPEIpAaCmyYOs+7+YQ+2ukCfjbLNCX06sd2WHR99oF5y/bOvnXmP4KIa3o91br8gB NTqyJLtat90uJBbYMQ5L1vUYFsoTNf2QDwLUqcCPU9EQND9hoPN45t8GCJJhbL2PLvRs G4iQ== 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=QZM+/eA5EeYgU6vVbsCp5elFhU52KA03Cvx4YSfR2fc=; b=DyeNYseIc98K5gN2VT5vQoQMMqLS6ivVVswXzXZs0wlrK+R6bnzjppMOvqF6a5Y10D mJ5V1ohZWHXXKsdV8tUxR7OKr9MP57Sbg/nylKliuZpTGKvdBOM6NZyGca4zfSR+rb1n 9yMGmJY56Ul9FjfpWViWdITnkvppYnm1mYSWmFvoL45dbRKsDtSlMxHQSU0h/x0P5hFV FF5CFL4AIkvaZZl4VK4jH30hXByrGhnF9IO9qaF8OwbUZXkr/xTn5yH1KSe78ChYZ1T+ U+5rObNItNFwO0psuTqXxWlthqo7Gg0RR4ztXk+ikYXxZ9elYN5/MYS5sXte+US52EeR We2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ISJ9rEXI; 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 n3-20020a638f03000000b0047701a21acfsi3356969pgd.604.2022.11.18.01.06.46; Fri, 18 Nov 2022 01:06:58 -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=ISJ9rEXI; 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 S235253AbiKRIyH (ORCPT + 99 others); Fri, 18 Nov 2022 03:54:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241618AbiKRIx4 (ORCPT ); Fri, 18 Nov 2022 03:53:56 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F64B63CC9 for ; Fri, 18 Nov 2022 00:53:53 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id a14so8243156wru.5 for ; Fri, 18 Nov 2022 00:53:53 -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=QZM+/eA5EeYgU6vVbsCp5elFhU52KA03Cvx4YSfR2fc=; b=ISJ9rEXISkwZ7jZ+xw2nFd42wbqUUrS9KtVTxT0F8TpEmfuvVTuyKqSH0dN6xVGn+d YbokNeDKP3b3NA9Ltkhxx46muzphG6zJ6ewb7Od+5r6q2D9TlmM0PZl/mxrAuzQ4LuXv 8YWmFY/ZXPCUKYwaSfpnHXVvlDVWiDpLuD2gNo0IQMit37lppX1xq8zdHlWAlIoRaIJx fp1jyYlGZ9aTvXsyHwuIDNUvliQXnn/rJ33QUwWJVT/YzrUfV1s0cGUkem4U2VGproNR EezPg1IHfsJ6jQx/NNHvJ6EV61rDEPhm+4hmpKQCOVX4YO/71yIiky67pG2/HUXzBVT7 ctiw== 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=QZM+/eA5EeYgU6vVbsCp5elFhU52KA03Cvx4YSfR2fc=; b=c2uj09Ei7X8A3lzqpyIZW/uz0sd/OXy5pHQ2cntdhcv0iRVU2GX/1Ksr6UfX4WYCxd 2DNFNOOC5mKxKemR2pDhpB4i3R3iei+R/4e/YXhQTs59Tt6xT9Fgqz/zCCsQ0lchsCom 9Cc7MkEM+3ktR2LUwBuLrxZf+3MN+yUuNspjS0g/6xRKgp6yJtzYoQxHrZz8ji4ucNLJ d3s36kQcv6r5dMPnC2Qob8nxm1847J9O1L4BB8ZzcYvtlC3IAjBRVyAouO7npWeZDmL6 e4THFnwXKQOxydnymEs9GlFcMfzXKRu5od666zpFFUPN2mmCYdKQzSk7oN2fOBGLO8f2 F+Sg== X-Gm-Message-State: ANoB5pmc6xf+LAQ98WNjEGkCLPb9ooOI2lanHvvvRG6DjOV3LaedpdrI 8zdPREEDKrjGG+JfigPC8GvDCA== X-Received: by 2002:adf:ea0b:0:b0:236:695b:6275 with SMTP id q11-20020adfea0b000000b00236695b6275mr3789781wrm.116.1668761631867; Fri, 18 Nov 2022 00:53:51 -0800 (PST) Received: from arrakeen.starnux.net ([2a01:e0a:982:cbb0:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id a13-20020a5d53cd000000b002383edcde09sm2971264wrw.59.2022.11.18.00.53.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Nov 2022 00:53:51 -0800 (PST) From: Neil Armstrong Date: Fri, 18 Nov 2022 09:53:49 +0100 Subject: [PATCH v2 2/2] soc: qcom: add MDSS DSM memory driver MIME-Version: 1.0 Message-Id: <20221114-narmstrong-sm8550-upstream-mpss_dsm-v2-2-f7c65d6f0e55@linaro.org> References: <20221114-narmstrong-sm8550-upstream-mpss_dsm-v2-0-f7c65d6f0e55@linaro.org> In-Reply-To: <20221114-narmstrong-sm8550-upstream-mpss_dsm-v2-0-f7c65d6f0e55@linaro.org> To: Bjorn Andersson , Frank Rowand , Konrad Dybcio , Krzysztof Kozlowski , Rob Herring , Andy Gross Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Neil Armstrong , linux-arm-msm@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=ham 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?1749824222433820825?= X-GMAIL-MSGID: =?utf-8?q?1749824222433820825?= Add a driver for the Qualcomm Modem Processing SubSystem DSM memory used to assign such regions of memory with remote MPSS processors. This memory zone is shared between the APPS and the MPSS subsystem, and must be configured during the whole lifetime of the system. 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 3507095a69f6..d4bb03292f45 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -505,6 +505,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");