FAILED: patch "[PATCH] remoteproc: qcom: pas: Guard dtb metadata release with" failed to apply to 6.12-stable tree
[email protected]
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x c06c5ab4945392d2c2aded6d832ab6b58cabe351
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090336-snowiness-uncle-0a18@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From c06c5ab4945392d2c2aded6d832ab6b58cabe351 Mon Sep 17 00:00:00 2001
From: Mukesh Ojha <[email protected]>
Date: Fri, 24 Jul 2026 23:58:54 +0530
Subject: [PATCH] remoteproc: qcom: pas: Guard dtb metadata release with
dtb_pas_id check
All other call sites of qcom_scm_pas_metadata_release() for the DTB context are guarded by a check on pas->dtb_pas_id, but the call inside qcom_pas_load() was not. Fix this by moving the call to the guarded block.
drivers/remoteproc/qcom_q6v5_pas.c +5 -8
@@ -245,17 +245,14 @@ static int qcom_pas_load(struct rproc *rproc, const struct firmware *fw) ret =qcom_mdt_pas_load (pas->dtb_pas_ctx, pas->dtb_firmware, pas->dtb_firmware_name, (__force void *)pas->dtb_mem_region, &pas->dtb_mem_reloc); -if (ret) - goto release_dtb_metadata; +if (ret) { +qcom_pas_metadata_release (pas->dtb_pas_ctx); +release_firmware (pas->dtb_firmware); +return ret; + } }return 0 ; - -release_dtb_metadata: -qcom_pas_metadata_release (pas->dtb_pas_ctx); -release_firmware (pas->dtb_firmware); - -return ret; }static void qcom_pas_unmap_carveout (struct rproc *rproc,phys_addr_t mem_phys,size_t size)
Sasha Levin
maintainerPATCH 1/3 firmware: qcom_scm: Rename peripheral as pas_id
From: Mukesh Ojha <[email protected]>
[ Upstream commit 69054348cc1c2d87acad90aec5e6e0d191012aff ]
Peripheral and pas_id refers to unique id for a subsystem and used only when peripheral authentication service from secure world is utilized.
Lets rename peripheral to pas_id to reflect closer to its meaning.
Stable-dep-of: c06c5ab49453 ("remoteproc: qcom: pas: Guard dtb metadata release with dtb_pas_id check")
--- drivers/firmware/qcom/qcom_scm.c | 30 +++++++++++++------------- include/linux/firmware/qcom/qcom_scm.h | 10 ++++----- 2 files changed, 20 insertions(+), 20 deletions(-)
drivers/firmware/qcom/qcom_scm.c +15 -15
@@ -562,7 +562,7 @@ static void qcom_scm_set_download_mode(u32 dload_mode)* qcom_scm_pas_init_image() - Initialize peripheral authentication service * state machine for a given peripheral, using the * metadata -* @peripheral: peripheral id +* @pas_id: peripheral authentication service id * @metadata: pointer to memory containing ELF header, program header table * and optional blob of data used for authenticating the metadata * and the rest of the firmware
@@ -575,7 +575,7 @@ static void qcom_scm_set_download_mode(u32 dload_mode)* track the metadata allocation, this needs to be released by invoking * qcom_scm_pas_metadata_release() by the caller. */ -int qcom_scm_pas_init_image (u32 peripheral,const void *metadata,size_t size, +int qcom_scm_pas_init_image (u32 pas_id,const void *metadata,size_t size,struct qcom_scm_pas_metadata *ctx) {dma_addr_t mdata_phys;
@@ -585,7 +585,7 @@ int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size, .svc = QCOM_SCM_SVC_PIL, .cmd = QCOM_SCM_PIL_PAS_INIT_IMAGE, .arginfo = QCOM_SCM_ARGS(2, QCOM_SCM_VAL, QCOM_SCM_RW), - .args[0] = peripheral, + .args[0] = pas_id, .owner = ARM_SMCCC_OWNER_SIP, };struct qcom_scm_res res;
@@ -658,20 +658,20 @@ EXPORT_SYMBOL_GPL(qcom_scm_pas_metadata_release);/** * qcom_scm_pas_mem_setup() - Prepare the memory related to a given peripheral * for firmware loading -* @peripheral: peripheral id +* @pas_id: peripheral authentication service id * @addr: start address of memory area to prepare * @size: size of the memory area to prepare * * Returns 0 on success. */ -int qcom_scm_pas_mem_setup (u32 peripheral,phys_addr_t addr,phys_addr_t size) +int qcom_scm_pas_mem_setup (u32 pas_id,phys_addr_t addr,phys_addr_t size) {int ret;struct qcom_scm_desc desc = { .svc =QCOM_SCM_SVC_PIL , .cmd =QCOM_SCM_PIL_PAS_MEM_SETUP , .arginfo =QCOM_SCM_ARGS (3 ), - .args[0 ] = peripheral, + .args[0 ] = pas_id, .args[1 ] = addr, .args[2 ] = size, .owner =ARM_SMCCC_OWNER_SIP ,
@@ -699,18 +699,18 @@ EXPORT_SYMBOL_GPL(qcom_scm_pas_mem_setup);/** * qcom_scm_pas_auth_and_reset() - Authenticate the given peripheral firmware * and reset the remote processor -* @peripheral: peripheral id +* @pas_id: peripheral authentication service id * * Return 0 on success. */ -int qcom_scm_pas_auth_and_reset (u32 peripheral) +int qcom_scm_pas_auth_and_reset (u32 pas_id) {int ret;struct qcom_scm_desc desc = { .svc =QCOM_SCM_SVC_PIL , .cmd =QCOM_SCM_PIL_PAS_AUTH_AND_RESET , .arginfo =QCOM_SCM_ARGS (1 ), - .args[0 ] = peripheral, + .args[0 ] = pas_id, .owner =ARM_SMCCC_OWNER_SIP , };struct qcom_scm_res res;
@@ -735,18 +735,18 @@ EXPORT_SYMBOL_GPL(qcom_scm_pas_auth_and_reset);/** * qcom_scm_pas_shutdown() - Shut down the remote processor -* @peripheral: peripheral id +* @pas_id: peripheral authentication service id * * Returns 0 on success. */ -int qcom_scm_pas_shutdown (u32 peripheral) +int qcom_scm_pas_shutdown (u32 pas_id) {int ret;struct qcom_scm_desc desc = { .svc =QCOM_SCM_SVC_PIL , .cmd =QCOM_SCM_PIL_PAS_SHUTDOWN , .arginfo =QCOM_SCM_ARGS (1 ), - .args[0 ] = peripheral, + .args[0 ] = pas_id, .owner =ARM_SMCCC_OWNER_SIP , };struct qcom_scm_res res;
@@ -772,18 +772,18 @@ EXPORT_SYMBOL_GPL(qcom_scm_pas_shutdown);/** * qcom_scm_pas_supported() - Check if the peripheral authentication service is * available for the given peripherial -* @peripheral: peripheral id +* @pas_id: peripheral authentication service id * * Returns true if PAS is supported for this peripheral, otherwise false. */ -bool qcom_scm_pas_supported (u32 peripheral) +bool qcom_scm_pas_supported (u32 pas_id) {int ret;struct qcom_scm_desc desc = { .svc =QCOM_SCM_SVC_PIL , .cmd =QCOM_SCM_PIL_PAS_IS_SUPPORTED , .arginfo =QCOM_SCM_ARGS (1 ), - .args[0 ] = peripheral, + .args[0 ] = pas_id, .owner =ARM_SMCCC_OWNER_SIP , };struct qcom_scm_res res;
include/linux/firmware/qcom/qcom_scm.h +5 -5
@@ -72,13 +72,13 @@ struct qcom_scm_pas_metadata {ssize_t size; }; -int qcom_scm_pas_init_image (u32 peripheral,const void *metadata,size_t size, +int qcom_scm_pas_init_image (u32 pas_id,const void *metadata,size_t size,struct qcom_scm_pas_metadata *ctx);void qcom_scm_pas_metadata_release (struct qcom_scm_pas_metadata *ctx); -int qcom_scm_pas_mem_setup (u32 peripheral,phys_addr_t addr,phys_addr_t size); -int qcom_scm_pas_auth_and_reset (u32 peripheral); -int qcom_scm_pas_shutdown (u32 peripheral); -bool qcom_scm_pas_supported (u32 peripheral); +int qcom_scm_pas_mem_setup (u32 pas_id,phys_addr_t addr,phys_addr_t size); +int qcom_scm_pas_auth_and_reset (u32 pas_id); +int qcom_scm_pas_shutdown (u32 pas_id); +bool qcom_scm_pas_supported (u32 pas_id);int qcom_scm_io_readl (phys_addr_t addr,unsigned int *val);int qcom_scm_io_writel (phys_addr_t addr,unsigned int val);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/3 remoteproc: pas: Replace metadata context with PAS context structure
From: Mukesh Ojha <[email protected]>
[ Upstream commit b13d8baf56016e7eec29395b52d18b91df081d48 ]
As a superset of the existing metadata context, the PAS context structure enables both remoteproc and non-remoteproc subsystems to better support scenarios where the SoC runs with or without the Gunyah hypervisor. To reflect this, relevant SCM and metadata functions are updated to incorporate PAS context awareness and remove metadata context data structure completely.
Stable adaptation for c06c5ab4945392d2c2aded6d832ab6b58cabe351:
This tree has neither the PAS context allocator nor the later generic PAS service and context-aware MDT loader. Define the PAS context in the existing SCM header and allocate and initialize it in adsp_probe() using devm_kzalloc(), without adding any functions. Keep the stable MDT loader interfaces and update their existing context arguments and declarations.
Rename the existing metadata release implementation and its callers to qcom_pas_metadata_release(), as used by the target fix. Keep the driver's adsp names except for the local PAS pointer in adsp_load(). Handle DTB initialization failure inline, preserving its existing cleanup behavior, so that the target can remove the shared load-failure cleanup label. The remaining load-failure path and its context now support a clean three-way cherry-pick of the target without importing the newer loader helper.
Stable-dep-of: c06c5ab49453 ("remoteproc: qcom: pas: Guard dtb metadata release with dtb_pas_id check")
--- drivers/firmware/qcom/qcom_scm.c | 14 ++--- drivers/remoteproc/qcom_q6v5_pas.c | 84 ++++++++++++++++---------- drivers/soc/qcom/mdt_loader.c | 4 +- include/linux/firmware/qcom/qcom_scm.h | 10 ++- include/linux/soc/qcom/mdt_loader.h | 6 +- 5 files changed, 72 insertions(+), 46 deletions(-)
drivers/firmware/qcom/qcom_scm.c +7 -7
@@ -567,16 +567,16 @@ static void qcom_scm_set_download_mode(u32 dload_mode)* and optional blob of data used for authenticating the metadata * and the rest of the firmware * @size: size of the metadata -* @ctx: optional metadata context +* @ctx: optional pas context * * Return: 0 on success. * * Upon successful return, the PAS metadata context (@ctx) will be used to * track the metadata allocation, this needs to be released by invoking -* qcom_scm_pas_metadata_release() by the caller. +* qcom_pas_metadata_release() by the caller. */ int qcom_scm_pas_init_image (u32 pas_id,const void *metadata,size_t size, -struct qcom_scm_pas_metadata *ctx) +struct qcom_scm_pas_context *ctx) {dma_addr_t mdata_phys;void *mdata_buf;
@@ -639,10 +639,10 @@ int qcom_scm_pas_init_image(u32 pas_id, const void *metadata, size_t size,EXPORT_SYMBOL_GPL (qcom_scm_pas_init_image);/** -* qcom_scm_pas_metadata_release() - release metadata context -* @ctx: metadata context +* qcom_pas_metadata_release() - release metadata context +* @ctx: pas context */ -void qcom_scm_pas_metadata_release (struct qcom_scm_pas_metadata *ctx) +void qcom_pas_metadata_release (struct qcom_scm_pas_context *ctx) {if (!ctx->ptr)return ;
@@ -653,7 +653,7 @@ void qcom_scm_pas_metadata_release(struct qcom_scm_pas_metadata *ctx) ctx->phys =0 ; ctx->size =0 ; } -EXPORT_SYMBOL_GPL (qcom_scm_pas_metadata_release); +EXPORT_SYMBOL_GPL (qcom_pas_metadata_release);/** * qcom_scm_pas_mem_setup() - Prepare the memory related to a given peripheral
drivers/remoteproc/qcom_q6v5_pas.c +53 -31
149 lines not on this page · raw message
drivers/soc/qcom/mdt_loader.c +2 -2
@@ -234,13 +234,13 @@ EXPORT_SYMBOL_GPL(qcom_mdt_read_metadata);* @fw_name: name of the firmware, for construction of segment file names * @pas_id: PAS identifier * @mem_phys: physical address of allocated memory region -* @ctx: PAS metadata context, to be released by caller +* @ctx: PAS context, metadata to be released by caller * * Returns 0 on success, negative errno otherwise. */ int qcom_mdt_pas_init (struct device *dev,const struct firmware *fw,const char *fw_name,int pas_id,phys_addr_t mem_phys, -struct qcom_scm_pas_metadata *ctx) +struct qcom_scm_pas_context *ctx) {const struct elf32_phdr *phdrs;const struct elf32_phdr *phdr;
include/linux/firmware/qcom/qcom_scm.h +7 -3
@@ -66,15 +66,19 @@ int qcom_scm_set_warm_boot_addr(void *entry);void qcom_scm_cpu_power_down (u32 flags);int qcom_scm_set_remote_state (u32 state,u32 id); -struct qcom_scm_pas_metadata { +struct qcom_scm_pas_context { +struct device *dev; +u32 pas_id; +phys_addr_t mem_phys; +size_t mem_size;void *ptr;dma_addr_t phys;ssize_t size; };int qcom_scm_pas_init_image (u32 pas_id,const void *metadata,size_t size, -struct qcom_scm_pas_metadata *ctx); -void qcom_scm_pas_metadata_release (struct qcom_scm_pas_metadata *ctx); +struct qcom_scm_pas_context *ctx); +void qcom_pas_metadata_release (struct qcom_scm_pas_context *ctx);int qcom_scm_pas_mem_setup (u32 pas_id,phys_addr_t addr,phys_addr_t size);int qcom_scm_pas_auth_and_reset (u32 pas_id);int qcom_scm_pas_shutdown (u32 pas_id);
include/linux/soc/qcom/mdt_loader.h +3 -3
@@ -10,14 +10,14 @@struct device ;struct firmware ; -struct qcom_scm_pas_metadata ; +struct qcom_scm_pas_context ;#if IS_ENABLED (CONFIG_QCOM_MDT_LOADER )ssize_t qcom_mdt_get_size (const struct firmware *fw);int qcom_mdt_pas_init (struct device *dev,const struct firmware *fw,const char *fw_name,int pas_id,phys_addr_t mem_phys, -struct qcom_scm_pas_metadata *pas_metadata_ctx); +struct qcom_scm_pas_context *pas_ctx); 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,
@@ -39,7 +39,7 @@ static inline ssize_t qcom_mdt_get_size(const struct firmware *fw)static inline int qcom_mdt_pas_init (struct device *dev,const struct firmware *fw,const char *fw_name,int pas_id,phys_addr_t mem_phys, -struct qcom_scm_pas_metadata *pas_metadata_ctx) +struct qcom_scm_pas_context *pas_ctx) {return -ENODEV ; }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/3 remoteproc: qcom: pas: Guard dtb metadata release with dtb_pas_id check
In reply to Sasha LevinFrom: Mukesh Ojha <[email protected]>
[ Upstream commit c06c5ab4945392d2c2aded6d832ab6b58cabe351 ]
All other call sites of qcom_scm_pas_metadata_release() for the DTB context are guarded by a check on pas->dtb_pas_id, but the call inside qcom_pas_load() was not. Fix this by moving the call to the guarded block.
--- drivers/remoteproc/qcom_q6v5_pas.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
drivers/remoteproc/qcom_q6v5_pas.c +5 -8
@@ -247,17 +247,14 @@ static int adsp_load(struct rproc *rproc, const struct firmware *fw) pas->dtb_pas_id, pas->dtb_mem_region, pas->dtb_mem_phys, pas->dtb_mem_size, &pas->dtb_mem_reloc); -if (ret) - goto release_dtb_metadata; +if (ret) { +qcom_pas_metadata_release (pas->dtb_pas_ctx); +release_firmware (pas->dtb_firmware); +return ret; + } }return 0 ; - -release_dtb_metadata: -qcom_pas_metadata_release (pas->dtb_pas_ctx); -release_firmware (pas->dtb_firmware); - -return ret; }static int adsp_start (struct rproc *rproc)
Signature · 1 line
2.53.0