From: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
To: Bjorn Andersson <andersson@kernel.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Manivannan Sadhasivam <mani@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
Subject: [PATCH v3 04/12] soc: qcom: mdtloader: Add context aware qcom_mdt_pas_load() helper
Date: Sun, 21 Sep 2025 01:11:02 +0530 [thread overview]
Message-ID: <20250921-kvm_rproc_pas-v3-4-458f09647920@oss.qualcomm.com> (raw)
In-Reply-To: <20250921-kvm_rproc_pas-v3-0-458f09647920@oss.qualcomm.com>
Currently, remoteproc and non-remoteproc subsystems use different
variants of the MDT loader helper API, primarily due to the handling of
the metadata context. Remoteproc subsystems retain this context until
authentication and reset, while non-remoteproc subsystems (e.g., video,
graphics) do not need to retain it and it is freed inside
qcom_scm_pas_init() based on metadata context parameter being NULL.
Add context aware qcom_mdt_pas_load() function which uses context
returned from qcom_scm_pas_ctx_init() and use it till subsystems
is out of set. This will also help in unifying the API used by
remoteproc and non-remoteproc subsystems drivers in future and
will also help in early setting context to all the PAS SMC function
to do appropriate things when SoC is running with gunyah hypervisor
or in absence of it.
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
drivers/soc/qcom/mdt_loader.c | 15 +++++++++++++++
include/linux/soc/qcom/mdt_loader.h | 10 ++++++++++
2 files changed, 25 insertions(+)
diff --git a/drivers/soc/qcom/mdt_loader.c b/drivers/soc/qcom/mdt_loader.c
index a5c80d4fcc36..2ef079797f05 100644
--- a/drivers/soc/qcom/mdt_loader.c
+++ b/drivers/soc/qcom/mdt_loader.c
@@ -486,5 +486,20 @@ int qcom_mdt_load_no_init(struct device *dev, const struct firmware *fw,
}
EXPORT_SYMBOL_GPL(qcom_mdt_load_no_init);
+int qcom_mdt_pas_load(struct qcom_scm_pas_ctx *ctx, const struct firmware *fw,
+ const char *firmware, void *mem_region, phys_addr_t *reloc_base)
+{
+ int ret;
+
+ ret = qcom_mdt_pas_init(ctx->dev, fw, firmware, ctx->pas_id,
+ ctx->mem_phys, ctx->metadata);
+ if (ret)
+ return ret;
+
+ return __qcom_mdt_load(ctx->dev, fw, firmware, mem_region, ctx->mem_phys,
+ ctx->mem_size, reloc_base);
+}
+EXPORT_SYMBOL_GPL(qcom_mdt_pas_load);
+
MODULE_DESCRIPTION("Firmware parser for Qualcomm MDT format");
MODULE_LICENSE("GPL v2");
diff --git a/include/linux/soc/qcom/mdt_loader.h b/include/linux/soc/qcom/mdt_loader.h
index 8ea8230579a2..36b8b331ce5f 100644
--- a/include/linux/soc/qcom/mdt_loader.h
+++ b/include/linux/soc/qcom/mdt_loader.h
@@ -11,6 +11,7 @@
struct device;
struct firmware;
struct qcom_scm_pas_metadata;
+struct qcom_scm_pas_ctx;
#if IS_ENABLED(CONFIG_QCOM_MDT_LOADER)
@@ -23,6 +24,9 @@ int qcom_mdt_load(struct device *dev, const struct firmware *fw,
phys_addr_t mem_phys, size_t mem_size,
phys_addr_t *reloc_base);
+int qcom_mdt_pas_load(struct qcom_scm_pas_ctx *ctx, const struct firmware *fw,
+ const char *firmware, void *mem_region, phys_addr_t *reloc_base);
+
int qcom_mdt_load_no_init(struct device *dev, const struct firmware *fw,
const char *fw_name, void *mem_region,
phys_addr_t mem_phys, size_t mem_size,
@@ -52,6 +56,12 @@ static inline int qcom_mdt_load(struct device *dev, const struct firmware *fw,
return -ENODEV;
}
+int qcom_mdt_pas_load(struct qcom_scm_pas_ctx *ctx, const struct firmware *fw,
+ const char *firmware, void *mem_region, phys_addr_t *reloc_base)
+{
+ return -ENODEV;
+}
+
static inline int qcom_mdt_load_no_init(struct device *dev,
const struct firmware *fw,
const char *fw_name, void *mem_region,
--
2.50.1
next prev parent reply other threads:[~2025-09-20 19:42 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-20 19:40 [PATCH v3 00/12] Peripheral Image Loader support for Qualcomm SoCs running Linux host at EL2 Mukesh Ojha
2025-09-20 19:40 ` [PATCH v3 01/12] dt-bindings: remoteproc: qcom,pas: Add iommus property Mukesh Ojha
2025-09-21 21:32 ` Bryan O'Donoghue
2025-09-22 20:29 ` Rob Herring (Arm)
2025-09-20 19:41 ` [PATCH v3 02/12] firmware: qcom_scm: Rename peripheral as pas_id Mukesh Ojha
2025-09-21 21:31 ` Bryan O'Donoghue
2025-09-20 19:41 ` [PATCH v3 03/12] firmware: qcom_scm: Introduce PAS context initialization and destroy helper Mukesh Ojha
2025-09-21 21:40 ` Bryan O'Donoghue
2025-09-22 11:34 ` Mukesh Ojha
2025-09-20 19:41 ` Mukesh Ojha [this message]
2025-09-21 7:31 ` [PATCH v3 04/12] soc: qcom: mdtloader: Add context aware qcom_mdt_pas_load() helper kernel test robot
2025-09-21 21:49 ` Bryan O'Donoghue
2025-09-20 19:41 ` [PATCH v3 05/12] remoteproc: pas: Use PAS context awareness in smc and mdt functions Mukesh Ojha
2025-09-21 22:14 ` Bryan O'Donoghue
2025-09-20 19:41 ` [PATCH v3 06/12] firmware: qcom_scm: Add a prep version of auth_and_reset function Mukesh Ojha
2025-09-21 22:23 ` Bryan O'Donoghue
2025-09-21 22:27 ` Bryan O'Donoghue
2025-09-22 6:12 ` Mukesh Ojha
2025-09-20 19:41 ` [PATCH v3 07/12] firmware: qcom_scm: Simplify qcom_scm_pas_init_image() Mukesh Ojha
2025-09-20 19:41 ` [PATCH v3 08/12] firmware: qcom_scm: Add shmbridge support to pas_init/release function Mukesh Ojha
2025-09-20 19:41 ` [PATCH v3 09/12] firmware: qcom_scm: Add qcom_scm_pas_get_rsc_table() to get resource table Mukesh Ojha
2025-09-20 19:41 ` [PATCH v3 10/12] remoteproc: pas: Extend parse_fw callback to fetch resources via SMC call Mukesh Ojha
2025-09-21 18:07 ` kernel test robot
2025-09-22 6:08 ` Mukesh Ojha
2025-09-20 19:41 ` [PATCH v3 11/12] remoteproc: qcom: pas: Enable Secure PAS support with IOMMU managed by Linux Mukesh Ojha
2025-09-20 19:41 ` [PATCH v3 12/12] arm64: dts: qcom: Add EL2 overlay for Lemans Mukesh Ojha
2025-09-22 8:21 ` Stephan Gerhold
2025-09-22 11:06 ` Mukesh Ojha
2025-09-22 12:15 ` Akhil P Oommen
2025-09-22 8:10 ` [PATCH v3 00/12] Peripheral Image Loader support for Qualcomm SoCs running Linux host at EL2 Stephan Gerhold
2025-09-22 9:47 ` Mukesh Ojha
2025-09-22 9:53 ` Stephan Gerhold
2025-09-22 10:33 ` Mukesh Ojha
2025-10-08 9:49 ` Konrad Dybcio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250921-kvm_rproc_pas-v3-4-458f09647920@oss.qualcomm.com \
--to=mukesh.ojha@oss.qualcomm.com \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mani@kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).