Thread View: linux.kernel.netdev
11 messages
11 total messages
Started by Mukesh Ojha
Fri, 13 Nov 2026 18:50
[PATCH v2 0/9] Migrate PAS clients to qcom_mdt_pas_load() and qcom_pas_prepare_and_auth_reset()
Author: Mukesh Ojha
Date: Fri, 13 Nov 2026 18:50
Date: Fri, 13 Nov 2026 18:50
57 lines
17572 bytes
17572 bytes
In preparation to remove qcom_mdt_load() and qcom_pas_auth_and_reset()
public function, migrate every user to the new PAS context-aware API
qcom_mdt_pas_load() and qcom_pas_prepare_and_auth_reset().
This series migrates every remaining caller of the deprecated APIs
(qcom_wcnss, adreno zap shader, iris, venus, IPA, ath12k) and then
removes qcom_mdt_load() and qcom_pas_auth_and_reset() entirely.
Requesting the Ack from subsystem owners to get this merge
through Bjorn's tree.
Changes in v2:
- Addressed Sasiko comments.
- Addressed Alex comment and added 1/9 as new patch in this
series and use the API to other patches.
- Commit description change.
- Link to v1: https://lore.kernel.org/lkml/20260925155737.4161358-1-mukesh.ojha@oss.qualcomm.com/
Mukesh Ojha (9):
firmware: qcom: pas: add qcom_pas_context_init() for pre-allocated
context
remoteproc: qcom_wcnss: migrate to qcom_mdt_pas_load() and
qcom_pas_prepare_and_auth_reset()
drm/msm/adreno: migrate zap shader loading to qcom_mdt_pas_load() and
qcom_pas_prepare_and_auth_reset()
media: iris: migrate firmware loading to qcom_mdt_pas_load() and
qcom_pas_prepare_and_auth_reset()
media: venus: migrate firmware loading to qcom_mdt_pas_load() and
qcom_pas_prepare_and_auth_reset()
net: ipa: migrate firmware loading to qcom_mdt_pas_load() and
qcom_pas_prepare_and_auth_reset()
wifi: ath12k: migrate firmware loading to qcom_mdt_pas_load() and
qcom_pas_prepare_and_auth_reset()
soc: qcom: mdt_loader: remove qcom_mdt_load()
firmware: qcom: pas: remove qcom_pas_auth_and_reset()
drivers/firmware/qcom/qcom_pas.c | 42 +++++++------
drivers/firmware/qcom/qcom_pas.h | 3 -
drivers/firmware/qcom/qcom_pas_tee.c | 6 --
drivers/firmware/qcom/qcom_scm.c | 7 +--
drivers/gpu/drm/msm/adreno/adreno_gpu.c | 22 ++-----
drivers/media/platform/qcom/iris/iris_core.h | 2 +
.../media/platform/qcom/iris/iris_firmware.c | 27 ++++----
drivers/media/platform/qcom/venus/core.h | 2 +
drivers/media/platform/qcom/venus/firmware.c | 29 ++++-----
drivers/net/ipa/ipa_main.c | 23 +++----
drivers/net/wireless/ath/ath12k/ahb.c | 23 ++++---
drivers/remoteproc/qcom_wcnss.c | 12 ++--
drivers/soc/qcom/mdt_loader.c | 63 +++++++------------
include/linux/firmware/qcom/qcom_pas.h | 3 +-
include/linux/soc/qcom/mdt_loader.h | 12 ----
15 files changed, 116 insertions(+), 160 deletions(-)
--
2.55.0
[PATCH v2 1/9] firmware: qcom: pas: add qcom_pas_context_init() for pre-allocated context
Author: Mukesh Ojha
Date: Fri, 13 Nov 2026 18:50
Date: Fri, 13 Nov 2026 18:50
100 lines
18927 bytes
18927 bytes
devm_qcom_pas_context_alloc() allocates and initializes a struct
qcom_pas_context using devres. Several callers, however, either live
entirely on the stack (short-lived helper functions) or embed the
context in a larger structure that is already managed by other means.
Forcing those callers through the devm allocation path is wasteful and,
in the case of functions called on every power cycle, causes a devres
entry to accumulate on every invocation.
Add qcom_pas_context_init() that initializes a caller-supplied struct
qcom_pas_context in place using memset + field assignment, with no
allocation at all. Rework devm_qcom_pas_context_alloc() to delegate
to qcom_pas_context_init() after the kzalloc, so both helpers share
the same initialization logic.
Update the kernel-doc for qcom_mdt_pas_load() to reflect that the PAS
context may now be initialized by either qcom_pas_context_init() or
devm_qcom_pas_context_alloc().
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
drivers/firmware/qcom/qcom_pas.c | 26 ++++++++++++++++++++++----
drivers/soc/qcom/mdt_loader.c | 4 ++--
include/linux/firmware/qcom/qcom_pas.h | 2 ++
3 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/drivers/firmware/qcom/qcom_pas.c b/drivers/firmware/qcom/qcom_pas.c
index d74dd7b4f332..fdf62003fbf1 100644
--- a/drivers/firmware/qcom/qcom_pas.c
+++ b/drivers/firmware/qcom/qcom_pas.c
@@ -14,6 +14,27 @@
static struct qcom_pas_ops *ops_ptr;
+/**
+ * qcom_pas_context_init() - Initialize a peripheral authentication service
+ * context for a given peripheral
+ *
+ * @ctx: Caller-provided PAS context to initialize
+ * @dev: PAS firmware device
+ * @pas_id: peripheral authentication service id
+ * @mem_phys: Subsystem reserve memory start address
+ * @mem_size: Subsystem reserve memory size
+ */
+void qcom_pas_context_init(struct qcom_pas_context *ctx, struct device *dev,
+ u32 pas_id, phys_addr_t mem_phys, size_t mem_size)
+{
+ memset(ctx, 0, sizeof(*ctx));
+ ctx->dev = dev;
+ ctx->pas_id = pas_id;
+ ctx->mem_phys = mem_phys;
+ ctx->mem_size = mem_size;
+}
+EXPORT_SYMBOL_GPL(qcom_pas_context_init);
+
/**
* devm_qcom_pas_context_alloc() - Allocate peripheral authentication service
* context for a given peripheral
@@ -39,10 +60,7 @@ struct qcom_pas_context *devm_qcom_pas_context_alloc(struct device *dev,
if (!ctx)
return ERR_PTR(-ENOMEM);
- ctx->dev = dev;
- ctx->pas_id = pas_id;
- ctx->mem_phys = mem_phys;
- ctx->mem_size = mem_size;
+ qcom_pas_context_init(ctx, dev, pas_id, mem_phys, mem_size);
return ctx;
}
diff --git a/drivers/soc/qcom/mdt_loader.c b/drivers/soc/qcom/mdt_loader.c
index 0d55e9e0af3f..c6ec67e1da09 100644
--- a/drivers/soc/qcom/mdt_loader.c
+++ b/drivers/soc/qcom/mdt_loader.c
@@ -476,8 +476,8 @@ EXPORT_SYMBOL_GPL(qcom_mdt_load);
* firmware segments (e.g., .bXX files). Authentication of the segments done
* by a separate call.
*
- * The PAS context must be initialized using devm_qcom_pas_context_alloc()
- * prior to invoking this function.
+ * The PAS context must be initialized using qcom_pas_context_init() or
+ * devm_qcom_pas_context_alloc() prior to invoking this function.
*
* @ctx: Pointer to the PAS (Peripheral Authentication Service) context
* @fw: Firmware object representing the .mdt file
diff --git a/include/linux/firmware/qcom/qcom_pas.h b/include/linux/firmware/qcom/qcom_pas.h
index 1d132e89536e..458075868bf5 100644
--- a/include/linux/firmware/qcom/qcom_pas.h
+++ b/include/linux/firmware/qcom/qcom_pas.h
@@ -36,6 +36,8 @@ static inline void __iomem *qcom_pas_ctx_map(struct qcom_pas_context *ctx)
}
bool qcom_pas_is_available(void);
+void qcom_pas_context_init(struct qcom_pas_context *ctx, struct device *dev,
+ u32 pas_id, phys_addr_t mem_phys, size_t mem_size);
struct qcom_pas_context *devm_qcom_pas_context_alloc(struct device *dev,
u32 pas_id,
phys_addr_t mem_phys,
--
2.55.0
[PATCH v2 2/9] remoteproc: qcom_wcnss: migrate to qcom_mdt_pas_load() and qcom_pas_prepare_and_auth_reset()
Author: Mukesh Ojha
Date: Fri, 13 Nov 2026 18:50
Date: Fri, 13 Nov 2026 18:50
71 lines
17942 bytes
17942 bytes
wcnss_load() calls qcom_mdt_load(), which bundles metadata init,
memory setup, and segment loading into a single API that does not
expose a PAS context, and wcnss_start() calls
qcom_pas_auth_and_reset() for TrustZone authentication, which is
the intended behaviour. However, a new qcom_mdt_pas_load() has
recently been introduced that works with a PAS context and can
handle everything qcom_mdt_load() provides, along with additional
functionality such as shmbridge creation and retrieving memory
from the shmbridge buffer when the same remote processor needs to
run while Linux runs at EL2.
Allocate a qcom_pas_context in wcnss_probe() via
devm_qcom_pas_context_alloc() and store it in struct qcom_wcnss.
Replace qcom_mdt_load() with qcom_mdt_pas_load() in wcnss_load()
and replace qcom_pas_auth_and_reset() with
qcom_pas_prepare_and_auth_reset() in wcnss_start(). The existing
devm_ioremap_wc() mapping is retained for wcnss_da_to_va()
address translation.
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
drivers/remoteproc/qcom_wcnss.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcnss.c
index 02f38fe29f20..f377ce6d324f 100644
--- a/drivers/remoteproc/qcom_wcnss.c
+++ b/drivers/remoteproc/qcom_wcnss.c
@@ -96,6 +96,7 @@ struct qcom_wcnss {
phys_addr_t mem_reloc;
void __iomem *mem_region;
size_t mem_size;
+ struct qcom_pas_context *pas_ctx;
struct qcom_rproc_subdev smd_subdev;
struct qcom_sysmon *sysmon;
@@ -157,9 +158,7 @@ static int wcnss_load(struct rproc *rproc, const struct firmware *fw)
struct qcom_wcnss *wcnss = rproc->priv;
int ret;
- ret = qcom_mdt_load(wcnss->dev, fw, rproc->firmware, WCNSS_PAS_ID,
- (__force void *)wcnss->mem_region, wcnss->mem_phys,
- wcnss->mem_size, &wcnss->mem_reloc);
+ ret = qcom_mdt_pas_load(wcnss->pas_ctx, fw, rproc->firmware, wcnss->mem_reloc);
if (ret)
return ret;
@@ -257,7 +256,7 @@ static int wcnss_start(struct rproc *rproc)
wcnss_indicate_nv_download(wcnss);
wcnss_configure_iris(wcnss);
- ret = qcom_pas_auth_and_reset(WCNSS_PAS_ID);
+ ret = qcom_pas_prepare_and_auth_reset(wcnss->pas_ctx);
if (ret) {
dev_err(wcnss->dev,
"failed to authenticate image and release reset\n");
@@ -599,6 +598,11 @@ static int wcnss_probe(struct platform_device *pdev)
if (ret)
return ret;
+ wcnss->pas_ctx = devm_qcom_pas_context_alloc(wcnss->dev, WCNSS_PAS_ID,
+ wcnss->mem_phys, wcnss->mem_size);
+ if (IS_ERR(wcnss->pas_ctx))
+ return PTR_ERR(wcnss->pas_ctx);
+
wcnss->pmu_cfg = mmio + data->pmu_offset;
wcnss->spare_out = mmio + data->spare_offset;
--
2.55.0
[PATCH v2 4/9] media: iris: migrate firmware loading to qcom_mdt_pas_load() and qcom_pas_prepare_and_auth_reset()
Author: Mukesh Ojha
Date: Fri, 13 Nov 2026 18:50
Date: Fri, 13 Nov 2026 18:50
96 lines
18719 bytes
18719 bytes
iris_load_fw_to_memory() calls qcom_mdt_load(), which bundles
metadata initialization, memory setup, and segment loading into a
single API that does not expose a PAS context. iris_fw_load()
calls qcom_pas_auth_and_reset() for TrustZone authentication,
which is the intended behaviour. However, a new
qcom_mdt_pas_load() has recently been introduced that works with
a PAS context and can handle everything qcom_mdt_load() provides,
along with additional functionality such as shmbridge creation
and retrieving memory from the shmbridge buffer when the same
remote processor needs to run while Linux runs at EL2.
Embed a struct qcom_pas_context directly in struct iris_core and
initialize it with qcom_pas_context_init() inside
iris_load_fw_to_memory() on each call. Replace qcom_mdt_load()
with qcom_mdt_pas_load() and replace qcom_pas_auth_and_reset()
with qcom_pas_prepare_and_auth_reset(). The
iris_detect_firmware() scan retains a separate memremap window
after qcom_mdt_pas_load() completes, since it needs to read back
the loaded image data.
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
drivers/media/platform/qcom/iris/iris_core.h | 2 ++
.../media/platform/qcom/iris/iris_firmware.c | 27 +++++++++----------
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/drivers/media/platform/qcom/iris/iris_core.h b/drivers/media/platform/qcom/iris/iris_core.h
index 3e4cf652bf39..ac73bda072f8 100644
--- a/drivers/media/platform/qcom/iris/iris_core.h
+++ b/drivers/media/platform/qcom/iris/iris_core.h
@@ -9,6 +9,7 @@
#include <linux/types.h>
#include <linux/dma-mapping.h>
#include <linux/pm_domain.h>
+#include <linux/firmware/qcom/qcom_pas.h>
#include <media/v4l2-device.h>
#include "iris_hfi_common.h"
@@ -129,6 +130,7 @@ struct iris_core {
struct platform_inst_fw_cap inst_fw_caps_dec[INST_FW_CAP_MAX];
struct platform_inst_fw_cap inst_fw_caps_enc[INST_FW_CAP_MAX];
struct dma_iova_state *iova_state;
+ struct qcom_pas_context pas_ctx;
};
int iris_core_init(struct iris_core *core);
diff --git a/drivers/media/platform/qcom/iris/iris_firmware.c b/drivers/media/platform/qcom/iris/iris_firmware.c
index 21f57d37da18..b701a7f43514 100644
--- a/drivers/media/platform/qcom/iris/iris_firmware.c
+++ b/drivers/media/platform/qcom/iris/iris_firmware.c
@@ -201,21 +201,20 @@ static int iris_load_fw_to_memory(struct iris_core *core)
goto err_release_fw;
}
- mem_virt = memremap(mem_phys, res_size, MEMREMAP_WC);
- if (!mem_virt) {
- ret = -ENOMEM;
- goto err_release_fw;
- }
-
- memset(mem_virt, 0, res_size);
-
- ret = qcom_mdt_load(dev, firmware, fw_name,
- IRIS_PAS_ID, mem_virt, mem_phys, res_size, NULL);
+ qcom_pas_context_init(&core->pas_ctx, dev, IRIS_PAS_ID, mem_phys,
+ res_size);
+
+ ret = qcom_mdt_pas_load(&core->pas_ctx, firmware, fw_name, NULL);
+ if (!ret) {
+ mem_virt = memremap(mem_phys, res_size, MEMREMAP_WC);
+ if (!mem_virt) {
+ ret = -ENOMEM;
+ goto err_release_fw;
+ }
- if (!ret)
iris_detect_firmware(core, fw_name, mem_virt, res_size, desc);
-
- memunmap(mem_virt);
+ memunmap(mem_virt);
+ }
err_release_fw:
release_firmware(firmware);
@@ -233,7 +232,7 @@ int iris_fw_load(struct iris_core *core)
return ret;
}
- ret = qcom_pas_auth_and_reset(IRIS_PAS_ID);
+ ret = qcom_pas_prepare_and_auth_reset(&core->pas_ctx);
if (ret) {
dev_err(core->dev, "auth and reset failed: %d\n", ret);
return ret;
--
2.55.0
[PATCH v2 6/9] net: ipa: migrate firmware loading to qcom_mdt_pas_load() and qcom_pas_prepare_and_auth_reset()
Author: Mukesh Ojha
Date: Fri, 13 Nov 2026 18:50
Date: Fri, 13 Nov 2026 18:50
73 lines
17874 bytes
17874 bytes
ipa_firmware_load() calls qcom_mdt_load(), which bundles metadata
initialization, memory setup, and segment loading into a single API that
does not expose a PAS context. Later it calls qcom_pas_auth_and_reset() for
TrustZone authentication, which is the intended behaviour. However, a new
qcom_mdt_pas_load() has recently been introduced that works with a PAS
context and can handle everything qcom_mdt_load() provides, along with
additional functionality such as shmbridge creation and retrieving memory
from the shmbridge buffer when the same remote processor needs to run while
Linux runs at EL2.
Replace the open-coded memremap()/qcom_mdt_load()/memunmap() sequence with
qcom_pas_context_init() and qcom_mdt_pas_load() and
qcom_pas_auth_and_reset() with qcom_pas_prepare_and_auth_reset().
Acked-by: Alex Elder <elder@riscstar.com>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
drivers/net/ipa/ipa_main.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c
index 14ac2d2faf7c..0a37741c2285 100644
--- a/drivers/net/ipa/ipa_main.c
+++ b/drivers/net/ipa/ipa_main.c
@@ -585,12 +585,11 @@ static void ipa_deconfig(struct ipa *ipa)
static int ipa_firmware_load(struct device *dev)
{
+ struct qcom_pas_context ctx;
const struct firmware *fw;
struct resource res;
phys_addr_t phys;
const char *path;
- ssize_t size;
- void *virt;
int ret;
ret = of_reserved_mem_region_to_resource(dev->of_node, 0, &res);
@@ -615,24 +614,18 @@ static int ipa_firmware_load(struct device *dev)
}
phys = res.start;
- size = (size_t)resource_size(&res);
- virt = memremap(phys, size, MEMREMAP_WC);
- if (!virt) {
- dev_err(dev, "unable to remap firmware memory\n");
- ret = -ENOMEM;
- goto out_release_firmware;
- }
+ qcom_pas_context_init(&ctx, dev, IPA_PAS_ID, phys, resource_size(&res));
- ret = qcom_mdt_load(dev, fw, path, IPA_PAS_ID, virt, phys, size, NULL);
+ ret = qcom_mdt_pas_load(&ctx, fw, path, NULL);
if (ret) {
dev_err(dev, "error %d loading \"%s\"\n", ret, path);
- } else {
- ret = qcom_pas_auth_and_reset(IPA_PAS_ID);
- if (ret)
- dev_err(dev, "error %d authenticating \"%s\"\n", ret, path);
+ goto out_release_firmware;
}
- memunmap(virt);
+ ret = qcom_pas_prepare_and_auth_reset(&ctx);
+ if (ret)
+ dev_err(dev, "error %d authenticating \"%s\"\n", ret, path);
+
out_release_firmware:
release_firmware(fw);
--
2.55.0
[PATCH v2 7/9] wifi: ath12k: migrate firmware loading to qcom_mdt_pas_load() and qcom_pas_prepare_and_auth_reset()
Author: Mukesh Ojha
Date: Fri, 13 Nov 2026 18:50
Date: Fri, 13 Nov 2026 18:50
97 lines
19237 bytes
19237 bytes
ath12k_ahb_power_up() calls qcom_mdt_load(), which bundles metadata
initialization, memory setup, and segment loading into a single API that
does not expose a PAS context. Later it calls qcom_pas_auth_and_reset() for
TrustZone authentication, which is the intended behaviour. However, a new
qcom_mdt_pas_load() has recently been introduced that works with a PAS
context and can handle everything qcom_mdt_load() provides, along with
additional functionality such as shmbridge creation and retrieving memory
from the shmbridge buffer when the same remote processor needs to run while
Linux runs at EL2.
Replace qcom_mdt_load() with qcom_pas_context_init() +
qcom_mdt_pas_load() and replace qcom_pas_auth_and_reset() with
qcom_pas_prepare_and_auth_reset(), using a stack-allocated struct
qcom_pas_context in ath12k_ahb_power_up(). The non-scm_auth path
retains qcom_mdt_load_no_init() with the caller-provided mem_region.
Apply the same pattern to ath12k_ahb_load_auth_shared_fw() for
consistency.
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
drivers/net/wireless/ath/ath12k/ahb.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/ahb.c b/drivers/net/wireless/ath/ath12k/ahb.c
index 8a3919675134..75d3141f968f 100644
--- a/drivers/net/wireless/ath/ath12k/ahb.c
+++ b/drivers/net/wireless/ath/ath12k/ahb.c
@@ -418,6 +418,7 @@ static int ath12k_ahb_power_up(struct ath12k_base *ab)
struct ath12k_ahb_rproc_info *rproc_info = ab_ahb->rproc_info;
char fw_name[ATH12K_USERPD_FW_NAME_LEN];
char fw2_name[ATH12K_USERPD_FW_NAME_LEN];
+ struct qcom_pas_context ctx;
struct device *dev = ab->dev;
const struct firmware *fw, *fw2;
unsigned long time_left;
@@ -451,14 +452,15 @@ static int ath12k_ahb_power_up(struct ath12k_base *ab)
ATH12K_AHB_UPD_SWID;
/* Load FW image to a reserved memory location */
- if (ab_ahb->scm_auth_enabled)
- ret = qcom_mdt_load(dev, fw, fw_name, pasid, rproc_info->mem_region,
- rproc_info->mem_phys, rproc_info->mem_size,
- NULL);
- else
+ if (ab_ahb->scm_auth_enabled) {
+ qcom_pas_context_init(&ctx, dev, pasid,
+ rproc_info->mem_phys, rproc_info->mem_size);
+ ret = qcom_mdt_pas_load(&ctx, fw, fw_name, NULL);
+ } else {
ret = qcom_mdt_load_no_init(dev, fw, fw_name, rproc_info->mem_region,
rproc_info->mem_phys, rproc_info->mem_size,
NULL);
+ }
if (ret) {
ath12k_err(ab, "Failed to load MDT segments: %d\n", ret);
goto err_fw;
@@ -492,7 +494,7 @@ static int ath12k_ahb_power_up(struct ath12k_base *ab)
if (ab_ahb->scm_auth_enabled) {
/* Authenticate FW image using peripheral ID */
- ret = qcom_pas_auth_and_reset(pasid);
+ ret = qcom_pas_prepare_and_auth_reset(&ctx);
if (ret) {
ath12k_err(ab, "failed to boot the remote processor %d\n", ret);
goto err_fw2;
@@ -1056,6 +1058,7 @@ static int ath12k_ahb_load_auth_shared_fw(struct ath12k_base *ab,
struct ath12k_ahb_rproc_info *rproc_info,
const char *fw_name, u32 pasid)
{
+ struct qcom_pas_context ctx;
int ret;
const struct firmware *fw __free(firmware) = NULL;
@@ -1074,14 +1077,16 @@ static int ath12k_ahb_load_auth_shared_fw(struct ath12k_base *ab,
ath12k_dbg(ab, ATH12K_DBG_AHB, "loading firmware %s, size %zd\n", fw_name,
fw->size);
- ret = qcom_mdt_load(ab->dev, fw, fw_name, pasid, rproc_info->mem_region,
- rproc_info->mem_phys, rproc_info->mem_size, NULL);
+ qcom_pas_context_init(&ctx, ab->dev, pasid,
+ rproc_info->mem_phys, rproc_info->mem_size);
+
+ ret = qcom_mdt_pas_load(&ctx, fw, fw_name, NULL);
if (ret) {
ath12k_err(ab, "failed to load RO firmware %s: %d\n", fw_name, ret);
return ret;
}
- ret = qcom_pas_auth_and_reset(pasid);
+ ret = qcom_pas_prepare_and_auth_reset(&ctx);
if (ret)
ath12k_err(ab, "failed to authenticate and boot shared firmware: %d\n",
ret);
--
2.55.0
[PATCH v2 8/9] soc: qcom: mdt_loader: remove qcom_mdt_load()
Author: Mukesh Ojha
Date: Fri, 13 Nov 2026 18:50
Date: Fri, 13 Nov 2026 18:50
157 lines
20976 bytes
20976 bytes
All callers have been migrated to qcom_mdt_pas_load(), which takes an
explicit qcom_pas_context instead of a raw pas_id and delegates memory
setup to the context. Remove the now-unused qcom_mdt_load() wrapper
along with its EXPORT_SYMBOL_GPL and header declaration.
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
drivers/soc/qcom/mdt_loader.c | 59 ++++++++++-------------------
include/linux/soc/qcom/mdt_loader.h | 12 ------
2 files changed, 19 insertions(+), 52 deletions(-)
diff --git a/drivers/soc/qcom/mdt_loader.c b/drivers/soc/qcom/mdt_loader.c
index c6ec67e1da09..fd638833b17e 100644
--- a/drivers/soc/qcom/mdt_loader.c
+++ b/drivers/soc/qcom/mdt_loader.c
@@ -329,7 +329,8 @@ static bool qcom_mdt_bins_are_split(const struct firmware *fw)
* @dev: device handle to associate resources with
* @fw: firmware object for the mdt file
* @fw_name: name of the firmware, for construction of segment file names
- * @mem_region: allocated memory region to load firmware into
+ * @mem_region: virtual address of the memory region to load firmware into,
+ * or NULL to have the region mapped internally with ioremap_wc()
* @mem_phys: physical address of allocated memory region
* @mem_size: size of the allocated memory region
* @reloc_base: adjusted physical address after relocation
@@ -344,6 +345,7 @@ int qcom_mdt_load_no_init(struct device *dev, const struct firmware *fw,
const struct elf32_phdr *phdrs;
const struct elf32_phdr *phdr;
const struct elf32_hdr *ehdr;
+ void __iomem *mapped = NULL;
phys_addr_t mem_reloc;
phys_addr_t min_addr = PHYS_ADDR_MAX;
ssize_t offset;
@@ -353,12 +355,22 @@ int qcom_mdt_load_no_init(struct device *dev, const struct firmware *fw,
int ret = 0;
int i;
- if (!fw || !mem_region || !mem_phys || !mem_size)
+ if (!fw || !mem_phys || !mem_size)
return -EINVAL;
if (!mdt_header_valid(fw))
return -EINVAL;
+ if (!mem_region) {
+ mapped = ioremap_wc(mem_phys, mem_size);
+ if (!mapped) {
+ dev_err(dev, "unable to map memory region: %pa+%zx\n",
+ &mem_phys, mem_size);
+ return -ENOMEM;
+ }
+ mem_region = (__force void *)mapped;
+ }
+
is_split = qcom_mdt_bins_are_split(fw);
ehdr = (struct elf32_hdr *)fw->data;
phdrs = (struct elf32_phdr *)(fw->data + ehdr->e_phoff);
@@ -437,39 +449,13 @@ int qcom_mdt_load_no_init(struct device *dev, const struct firmware *fw,
if (reloc_base)
*reloc_base = mem_reloc;
+ if (mapped)
+ iounmap(mapped);
+
return ret;
}
EXPORT_SYMBOL_GPL(qcom_mdt_load_no_init);
-/**
- * qcom_mdt_load() - load the firmware which header is loaded as fw
- * @dev: device handle to associate resources with
- * @fw: firmware object for the mdt file
- * @fw_name: name of the firmware, for construction of segment file names
- * @pas_id: PAS identifier
- * @mem_region: allocated memory region to load firmware into
- * @mem_phys: physical address of allocated memory region
- * @mem_size: size of the allocated memory region
- * @reloc_base: adjusted physical address after relocation
- *
- * Returns 0 on success, negative errno otherwise.
- */
-int qcom_mdt_load(struct device *dev, const struct firmware *fw,
- const char *fw_name, int pas_id, void *mem_region,
- phys_addr_t mem_phys, size_t mem_size,
- phys_addr_t *reloc_base)
-{
- int ret;
-
- ret = __qcom_mdt_pas_init(dev, fw, fw_name, pas_id, mem_phys, NULL);
- if (ret)
- return ret;
-
- return qcom_mdt_load_no_init(dev, fw, fw_name, mem_region, mem_phys,
- mem_size, reloc_base);
-}
-EXPORT_SYMBOL_GPL(qcom_mdt_load);
-
/**
* qcom_mdt_pas_load - Loads and authenticates the metadata of the firmware
* (typically contained in the .mdt file), followed by loading the actual
@@ -489,21 +475,14 @@ EXPORT_SYMBOL_GPL(qcom_mdt_load);
int qcom_mdt_pas_load(struct qcom_pas_context *ctx, const struct firmware *fw,
const char *firmware, phys_addr_t *reloc_base)
{
- void __iomem *mem_region;
int ret;
ret = __qcom_mdt_pas_init(ctx->dev, fw, firmware, ctx->pas_id, ctx->mem_phys, ctx);
if (ret)
return ret;
- mem_region = qcom_pas_ctx_map(ctx);
- if (!mem_region)
- return -ENOMEM;
-
- ret = qcom_mdt_load_no_init(ctx->dev, fw, firmware, (__force void *)mem_region,
- ctx->mem_phys, ctx->mem_size, reloc_base);
- iounmap(mem_region);
- return ret;
+ return qcom_mdt_load_no_init(ctx->dev, fw, firmware, NULL,
+ ctx->mem_phys, ctx->mem_size, reloc_base);
}
EXPORT_SYMBOL_GPL(qcom_mdt_pas_load);
diff --git a/include/linux/soc/qcom/mdt_loader.h b/include/linux/soc/qcom/mdt_loader.h
index 74886f772d46..f49de7b388bc 100644
--- a/include/linux/soc/qcom/mdt_loader.h
+++ b/include/linux/soc/qcom/mdt_loader.h
@@ -15,10 +15,6 @@ struct qcom_pas_context;
#if IS_ENABLED(CONFIG_QCOM_MDT_LOADER)
ssize_t qcom_mdt_get_size(const struct firmware *fw);
-int qcom_mdt_load(struct device *dev, const struct firmware *fw,
- const char *fw_name, int pas_id, void *mem_region,
- phys_addr_t mem_phys, size_t mem_size,
- phys_addr_t *reloc_base);
int qcom_mdt_pas_load(struct qcom_pas_context *ctx, const struct firmware *fw,
const char *firmware, phys_addr_t *reloc_base);
@@ -37,14 +33,6 @@ static inline ssize_t qcom_mdt_get_size(const struct firmware *fw)
return -ENODEV;
}
-static inline int qcom_mdt_load(struct device *dev, const struct firmware *fw,
- const char *fw_name, int pas_id,
- void *mem_region, phys_addr_t mem_phys,
- size_t mem_size, phys_addr_t *reloc_base)
-{
- return -ENODEV;
-}
-
static inline int qcom_mdt_pas_load(struct qcom_pas_context *ctx,
const struct firmware *fw, const char *firmware,
phys_addr_t *reloc_base)
--
2.55.0
[PATCH v2 9/9] firmware: qcom: pas: remove qcom_pas_auth_and_reset()
Author: Mukesh Ojha
Date: Fri, 13 Nov 2026 18:50
Date: Fri, 13 Nov 2026 18:50
145 lines
20955 bytes
20955 bytes
All callers have been migrated to qcom_pas_prepare_and_auth_reset(),
which additionally sets up a shmbridge over firmware memory before
TrustZone authentication. Remove the bare pas_id-only wrapper, its
EXPORT_SYMBOL_GPL, the header declaration, the auth_and_reset ops slot
from struct qcom_pas_ops and both backend implementations.
The internal helper functions (__qcom_scm_pas_auth_and_reset,
__qcom_pas_tee_auth_and_reset) remain as they are called directly by
their respective prepare_and_auth_reset implementations.
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
---
drivers/firmware/qcom/qcom_pas.c | 16 ----------------
drivers/firmware/qcom/qcom_pas.h | 3 ---
drivers/firmware/qcom/qcom_pas_tee.c | 6 ------
drivers/firmware/qcom/qcom_scm.c | 7 +++----
include/linux/firmware/qcom/qcom_pas.h | 1 -
5 files changed, 3 insertions(+), 30 deletions(-)
diff --git a/drivers/firmware/qcom/qcom_pas.c b/drivers/firmware/qcom/qcom_pas.c
index fdf62003fbf1..08bf3a8d3bf6 100644
--- a/drivers/firmware/qcom/qcom_pas.c
+++ b/drivers/firmware/qcom/qcom_pas.c
@@ -184,22 +184,6 @@ struct resource_table *qcom_pas_get_rsc_table(struct qcom_pas_context *ctx,
}
EXPORT_SYMBOL_GPL(qcom_pas_get_rsc_table);
-/**
- * qcom_pas_auth_and_reset() - Authenticate the given peripheral firmware
- * and reset the remote processor
- * @pas_id: peripheral authentication service id
- *
- * Return: 0 on success.
- */
-int qcom_pas_auth_and_reset(u32 pas_id)
-{
- if (!ops_ptr)
- return -ENODEV;
-
- return ops_ptr->auth_and_reset(ops_ptr->dev, pas_id);
-}
-EXPORT_SYMBOL_GPL(qcom_pas_auth_and_reset);
-
/**
* qcom_pas_prepare_and_auth_reset() - Prepare, authenticate, and reset the
* remote processor
diff --git a/drivers/firmware/qcom/qcom_pas.h b/drivers/firmware/qcom/qcom_pas.h
index 8643e2760602..a296be2be8c0 100644
--- a/drivers/firmware/qcom/qcom_pas.h
+++ b/drivers/firmware/qcom/qcom_pas.h
@@ -18,8 +18,6 @@ struct device;
* @get_rsc_table: Peripheral get resource table callback.
* @prepare_and_auth_reset: Peripheral prepare firmware authentication and
* reset callback.
- * @auth_and_reset: Peripheral firmware authentication and reset
- * callback.
* @set_remote_state: Peripheral set remote state callback.
* @shutdown: Peripheral shutdown callback.
* @metadata_release: Image metadata release callback.
@@ -37,7 +35,6 @@ struct qcom_pas_ops {
size_t *output_rt_size);
int (*prepare_and_auth_reset)(struct device *dev,
struct qcom_pas_context *ctx);
- int (*auth_and_reset)(struct device *dev, u32 pas_id);
int (*set_remote_state)(struct device *dev, u32 state, u32 pas_id);
int (*shutdown)(struct device *dev, u32 pas_id);
void (*metadata_release)(struct device *dev,
diff --git a/drivers/firmware/qcom/qcom_pas_tee.c b/drivers/firmware/qcom/qcom_pas_tee.c
index 1fca2712d791..525b8a02ae82 100644
--- a/drivers/firmware/qcom/qcom_pas_tee.c
+++ b/drivers/firmware/qcom/qcom_pas_tee.c
@@ -331,11 +331,6 @@ static int __qcom_pas_tee_auth_and_reset(struct device *dev, u32 pas_id,
return ret;
}
-static int qcom_pas_tee_auth_and_reset(struct device *dev, u32 pas_id)
-{
- return __qcom_pas_tee_auth_and_reset(dev, pas_id, 0, 0);
-}
-
static int qcom_pas_tee_prepare_and_auth_reset(struct device *dev,
struct qcom_pas_context *ctx)
{
@@ -412,7 +407,6 @@ static struct qcom_pas_ops qcom_pas_ops_tee = {
.init_image = qcom_pas_tee_init_image,
.mem_setup = qcom_pas_tee_mem_setup,
.get_rsc_table = qcom_pas_tee_get_rsc_table,
- .auth_and_reset = qcom_pas_tee_auth_and_reset,
.prepare_and_auth_reset = qcom_pas_tee_prepare_and_auth_reset,
.set_remote_state = qcom_pas_tee_set_remote_state,
.shutdown = qcom_pas_tee_shutdown,
diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c
index 030e4ba90812..b0f96e751167 100644
--- a/drivers/firmware/qcom/qcom_scm.c
+++ b/drivers/firmware/qcom/qcom_scm.c
@@ -855,7 +855,7 @@ static void *qcom_scm_pas_get_rsc_table(struct device *dev,
return ret ? ERR_PTR(ret) : tbl_ptr;
}
-static int qcom_scm_pas_auth_and_reset(struct device *dev, u32 pas_id)
+static int __qcom_scm_pas_auth_and_reset(struct device *dev, u32 pas_id)
{
int ret;
struct qcom_scm_desc desc = {
@@ -896,7 +896,7 @@ static int qcom_scm_pas_prepare_and_auth_reset(struct device *dev,
* memory region and then invokes a call to TrustZone to authenticate.
*/
if (!ctx->use_tzmem)
- return qcom_scm_pas_auth_and_reset(dev, ctx->pas_id);
+ return __qcom_scm_pas_auth_and_reset(dev, ctx->pas_id);
/*
* When Linux runs @ EL2 Linux must create the shmbridge itself and then
@@ -906,7 +906,7 @@ static int qcom_scm_pas_prepare_and_auth_reset(struct device *dev,
if (ret)
return ret;
- ret = qcom_scm_pas_auth_and_reset(dev, ctx->pas_id);
+ ret = __qcom_scm_pas_auth_and_reset(dev, ctx->pas_id);
qcom_tzmem_shm_bridge_delete(handle);
return ret;
@@ -987,7 +987,6 @@ static struct qcom_pas_ops qcom_pas_ops_scm = {
.init_image = qcom_scm_pas_init_image,
.mem_setup = qcom_scm_pas_mem_setup,
.get_rsc_table = qcom_scm_pas_get_rsc_table,
- .auth_and_reset = qcom_scm_pas_auth_and_reset,
.prepare_and_auth_reset = qcom_scm_pas_prepare_and_auth_reset,
.set_remote_state = qcom_scm_pas_set_remote_state,
.shutdown = qcom_scm_pas_shutdown,
diff --git a/include/linux/firmware/qcom/qcom_pas.h b/include/linux/firmware/qcom/qcom_pas.h
index 458075868bf5..53b8d9631f22 100644
--- a/include/linux/firmware/qcom/qcom_pas.h
+++ b/include/linux/firmware/qcom/qcom_pas.h
@@ -48,7 +48,6 @@ struct resource_table *qcom_pas_get_rsc_table(struct qcom_pas_context *ctx,
void *input_rt, size_t input_rt_size,
size_t *output_rt_size);
int qcom_pas_mem_setup(u32 pas_id, phys_addr_t addr, phys_addr_t size);
-int qcom_pas_auth_and_reset(u32 pas_id);
int qcom_pas_prepare_and_auth_reset(struct qcom_pas_context *ctx);
int qcom_pas_set_remote_state(u32 state, u32 pas_id);
int qcom_pas_shutdown(u32 pas_id);
--
2.55.0
Re: [PATCH v2 7/9] wifi: ath12k: migrate firmware loading to qcom_mdt_pas_load() and qcom_pas_prepare_and_auth_reset()
Author: Jeff Johnson
Date: Fri, 13 Nov 2026 21:54
Date: Fri, 13 Nov 2026 21:54
24 lines
9397 bytes
9397 bytes
On 11/13/2026 10:50 AM, Mukesh Ojha wrote: > ath12k_ahb_power_up() calls qcom_mdt_load(), which bundles metadata > initialization, memory setup, and segment loading into a single API that > does not expose a PAS context. Later it calls qcom_pas_auth_and_reset() for > TrustZone authentication, which is the intended behaviour. However, a new > qcom_mdt_pas_load() has recently been introduced that works with a PAS > context and can handle everything qcom_mdt_load() provides, along with > additional functionality such as shmbridge creation and retrieving memory > from the shmbridge buffer when the same remote processor needs to run while > Linux runs at EL2. > > Replace qcom_mdt_load() with qcom_pas_context_init() + > qcom_mdt_pas_load() and replace qcom_pas_auth_and_reset() with > qcom_pas_prepare_and_auth_reset(), using a stack-allocated struct > qcom_pas_context in ath12k_ahb_power_up(). The non-scm_auth path > retains qcom_mdt_load_no_init() with the caller-provided mem_region. > > Apply the same pattern to ath12k_ahb_load_auth_shared_fw() for > consistency. > > Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> Acked-by: Jeff Johnson <jjohnson@kernel.org>
Re: [PATCH v2 2/9] remoteproc: qcom_wcnss: migrate to qcom_mdt_pas_load() and qcom_pas_prepare_and_auth_reset()
Author: kernel test robot
Date: Sat, 14 Nov 2026 07:29
Date: Sat, 14 Nov 2026 07:29
58 lines
12552 bytes
12552 bytes
Hi Mukesh,
kernel test robot noticed the following build errors:
[auto build test ERROR on remoteproc/rproc-next]
[also build test ERROR on drm-misc/drm-misc-next ath/ath-next linus/master v7.4-rc2 next-20261112]
[cannot apply to linux-review/Mukesh-Ojha/remoteproc-qcom_wcnss-migrate-to-qcom_mdt_pas_load-and-qcom_pas_prepare_and_auth_reset/20260925-212730]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Mukesh-Ojha/firmware-qcom-pas-add-qcom_pas_context_init-for-pre-allocated-context/20261114-002001
base: https://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux.git rproc-next
patch link: https://lore.kernel.org/r/20261113185009.157893-3-mukesh.ojha%40oss.qualcomm.com
patch subject: [PATCH v2 2/9] remoteproc: qcom_wcnss: migrate to qcom_mdt_pas_load() and qcom_pas_prepare_and_auth_reset()
config: arm-defconfig (https://download.01.org/0day-ci/archive/20261114/202611141531.Yu2Xl6F2-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 1b1fed44d3dcca649a9877915d57c3357a98124e)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261114/202611141531.Yu2Xl6F2-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202611141531.Yu2Xl6F2-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/remoteproc/qcom_wcnss.c:161:63: error: incompatible integer to pointer conversion passing 'phys_addr_t' (aka 'unsigned int') to parameter of type 'phys_addr_t *' (aka 'unsigned int *'); take the address with & [-Wint-conversion]
161 | ret = qcom_mdt_pas_load(wcnss->pas_ctx, fw, rproc->firmware, wcnss->mem_reloc);
| ^~~~~~~~~~~~~~~~
| &
include/linux/soc/qcom/mdt_loader.h:24:44: note: passing argument to parameter 'reloc_base' here
24 | const char *firmware, phys_addr_t *reloc_base);
| ^
1 error generated.
vim +161 drivers/remoteproc/qcom_wcnss.c
155
156 static int wcnss_load(struct rproc *rproc, const struct firmware *fw)
157 {
158 struct qcom_wcnss *wcnss = rproc->priv;
159 int ret;
160
> 161 ret = qcom_mdt_pas_load(wcnss->pas_ctx, fw, rproc->firmware, wcnss->mem_reloc);
162 if (ret)
163 return ret;
164
165 qcom_pil_info_store("wcnss", wcnss->mem_phys, wcnss->mem_size);
166
167 return 0;
168 }
169
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH v2 2/9] remoteproc: qcom_wcnss: migrate to qcom_mdt_pas_load() and qcom_pas_prepare_and_auth_reset()
Author: kernel test robot
Date: Sat, 14 Nov 2026 14:49
Date: Sat, 14 Nov 2026 14:49
64 lines
13052 bytes
13052 bytes
Hi Mukesh,
kernel test robot noticed the following build errors:
[auto build test ERROR on remoteproc/rproc-next]
[also build test ERROR on drm-misc/drm-misc-next ath/ath-next linus/master v7.4-rc2 next-20261113]
[cannot apply to linux-review/Mukesh-Ojha/remoteproc-qcom_wcnss-migrate-to-qcom_mdt_pas_load-and-qcom_pas_prepare_and_auth_reset/20260925-212730]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Mukesh-Ojha/firmware-qcom-pas-add-qcom_pas_context_init-for-pre-allocated-context/20261114-002001
base: https://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux.git rproc-next
patch link: https://lore.kernel.org/r/20261113185009.157893-3-mukesh.ojha%40oss.qualcomm.com
patch subject: [PATCH v2 2/9] remoteproc: qcom_wcnss: migrate to qcom_mdt_pas_load() and qcom_pas_prepare_and_auth_reset()
config: arm64-defconfig (https://download.01.org/0day-ci/archive/20261114/202611142207.UkqcyoQJ-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 16.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261114/202611142207.UkqcyoQJ-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202611142207.UkqcyoQJ-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/remoteproc/qcom_wcnss.c: In function 'wcnss_load':
>> drivers/remoteproc/qcom_wcnss.c:161:75: error: passing argument 4 of 'qcom_mdt_pas_load' makes pointer from integer without a cast [-Wint-conversion]
161 | ret = qcom_mdt_pas_load(wcnss->pas_ctx, fw, rproc->firmware, wcnss->mem_reloc);
| ~~~~~^~~~~~~~~~~
| |
| phys_addr_t {aka long long unsigned int}
drivers/remoteproc/qcom_wcnss.c:161:75: note: possible fix: take the address with '&'
161 | ret = qcom_mdt_pas_load(wcnss->pas_ctx, fw, rproc->firmware, wcnss->mem_reloc);
| ~~~~~^~~~~~~~~~~
| &
In file included from drivers/remoteproc/qcom_wcnss.c:25:
include/linux/soc/qcom/mdt_loader.h:24:58: note: expected 'phys_addr_t *' {aka 'long long unsigned int *'} but argument is of type 'phys_addr_t' {aka 'long long unsigned int'}
24 | const char *firmware, phys_addr_t *reloc_base);
| ~~~~~~~~~~~~~^~~~~~~~~~
vim +/qcom_mdt_pas_load +161 drivers/remoteproc/qcom_wcnss.c
155
156 static int wcnss_load(struct rproc *rproc, const struct firmware *fw)
157 {
158 struct qcom_wcnss *wcnss = rproc->priv;
159 int ret;
160
> 161 ret = qcom_mdt_pas_load(wcnss->pas_ctx, fw, rproc->firmware, wcnss->mem_reloc);
162 if (ret)
163 return ret;
164
165 qcom_pil_info_store("wcnss", wcnss->mem_phys, wcnss->mem_size);
166
167 return 0;
168 }
169
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads