[PATCH v2 6/9] net: ipa: migrate firmware loading to qcom_mdt_pas_load() and qcom_pas_prepare_and_auth_reset()
From: Mukesh Ojha
Date: Fri Nov 13 2026 - 14:41:41 EST
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@xxxxxxxxxxxx>
Signed-off-by: Mukesh Ojha <mukesh.ojha@xxxxxxxxxxxxxxxx>
---
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