* [PATCH v2 0/4] remoteproc: qcom_q6v5: Misc fixes to prepare for reusing the "lite" ADSP FW
@ 2025-08-20 16:02 Stephan Gerhold
2025-08-20 16:02 ` [PATCH v2 1/4] remoteproc: qcom_q6v5: Avoid disabling handover IRQ twice Stephan Gerhold
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Stephan Gerhold @ 2025-08-20 16:02 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier
Cc: Sibi Sankar, Abel Vesa, linux-arm-msm, linux-remoteproc,
linux-kernel, Konrad Dybcio, Dmitry Baryshkov
On X1E, the boot firmware already loads a "lite" ADSP firmware that
provides essential functionality such as charging, battery status and USB-C
detection. Only the audio functionality is missing. Since the full ADSP
firmware is device-specific and needs to be manually copied by the user, it
would be useful if we could provide the basic functionality even without
having the full firmware present.
I have a working prototype for this that I will post soon. To keep that
series smaller, this series contains some misc fixes for minor issues
I noticed while working on this feature. The issues are present even
without my additional patches, so the fixes can be picked up independently.
Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
---
Changes in v2:
- Split up PATCH 3/3 and remove the redundant assignment to "ret" in a
separate patch (Dmitry)
- Add review tags from Dmitry
- Link to v1: https://lore.kernel.org/r/20250819-rproc-qcom-q6v5-fixes-v1-0-de92198f23c7@linaro.org
---
Stephan Gerhold (4):
remoteproc: qcom_q6v5: Avoid disabling handover IRQ twice
remoteproc: qcom_q6v5: Avoid handling handover twice
remoteproc: qcom_q6v5_pas: Shutdown lite ADSP DTB on X1E
remoteproc: qcom_q6v5_pas: Drop redundant assignment to ret
drivers/remoteproc/qcom_q6v5.c | 8 +++++---
drivers/remoteproc/qcom_q6v5_pas.c | 8 +++++++-
2 files changed, 12 insertions(+), 4 deletions(-)
---
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
change-id: 20250814-rproc-qcom-q6v5-fixes-9882ad571097
Best regards,
--
Stephan Gerhold <stephan.gerhold@linaro.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/4] remoteproc: qcom_q6v5: Avoid disabling handover IRQ twice
2025-08-20 16:02 [PATCH v2 0/4] remoteproc: qcom_q6v5: Misc fixes to prepare for reusing the "lite" ADSP FW Stephan Gerhold
@ 2025-08-20 16:02 ` Stephan Gerhold
2025-08-20 16:02 ` [PATCH v2 2/4] remoteproc: qcom_q6v5: Avoid handling handover twice Stephan Gerhold
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Stephan Gerhold @ 2025-08-20 16:02 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier
Cc: Sibi Sankar, Abel Vesa, linux-arm-msm, linux-remoteproc,
linux-kernel, Konrad Dybcio, Dmitry Baryshkov
enable_irq() and disable_irq() are reference counted, so we must make sure
that each enable_irq() is always paired with a single disable_irq(). If we
call disable_irq() twice followed by just a single enable_irq(), the IRQ
will remain disabled forever.
For the error handling path in qcom_q6v5_wait_for_start(), disable_irq()
will end up being called twice, because disable_irq() also happens in
qcom_q6v5_unprepare() when rolling back the call to qcom_q6v5_prepare().
Fix this by dropping disable_irq() in qcom_q6v5_wait_for_start(). Since
qcom_q6v5_prepare() is the function that calls enable_irq(), it makes more
sense to have the rollback handled always by qcom_q6v5_unprepare().
Fixes: 3b415c8fb263 ("remoteproc: q6v5: Extract common resource handling")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
---
drivers/remoteproc/qcom_q6v5.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/remoteproc/qcom_q6v5.c b/drivers/remoteproc/qcom_q6v5.c
index 4ee5e67a9f03f5f766f04396b9a3e45f77293764..769c6d6d6a731672eca9f960b05c68f6d4d77af2 100644
--- a/drivers/remoteproc/qcom_q6v5.c
+++ b/drivers/remoteproc/qcom_q6v5.c
@@ -156,9 +156,6 @@ int qcom_q6v5_wait_for_start(struct qcom_q6v5 *q6v5, int timeout)
int ret;
ret = wait_for_completion_timeout(&q6v5->start_done, timeout);
- if (!ret)
- disable_irq(q6v5->handover_irq);
-
return !ret ? -ETIMEDOUT : 0;
}
EXPORT_SYMBOL_GPL(qcom_q6v5_wait_for_start);
--
2.50.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/4] remoteproc: qcom_q6v5: Avoid handling handover twice
2025-08-20 16:02 [PATCH v2 0/4] remoteproc: qcom_q6v5: Misc fixes to prepare for reusing the "lite" ADSP FW Stephan Gerhold
2025-08-20 16:02 ` [PATCH v2 1/4] remoteproc: qcom_q6v5: Avoid disabling handover IRQ twice Stephan Gerhold
@ 2025-08-20 16:02 ` Stephan Gerhold
2025-08-20 16:02 ` [PATCH v2 3/4] remoteproc: qcom_q6v5_pas: Shutdown lite ADSP DTB on X1E Stephan Gerhold
2025-08-20 16:02 ` [PATCH v2 4/4] remoteproc: qcom_q6v5_pas: Drop redundant assignment to ret Stephan Gerhold
3 siblings, 0 replies; 6+ messages in thread
From: Stephan Gerhold @ 2025-08-20 16:02 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier
Cc: Sibi Sankar, Abel Vesa, linux-arm-msm, linux-remoteproc,
linux-kernel, Konrad Dybcio, Dmitry Baryshkov
A remoteproc could theoretically signal handover twice. This is unexpected
and would break the reference counting for the handover resources (power
domains, clocks, regulators, etc), so add a check to prevent that from
happening.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
---
drivers/remoteproc/qcom_q6v5.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/remoteproc/qcom_q6v5.c b/drivers/remoteproc/qcom_q6v5.c
index 769c6d6d6a731672eca9f960b05c68f6d4d77af2..58d5b85e58cdadabdd3e23d39c06a39196c3a194 100644
--- a/drivers/remoteproc/qcom_q6v5.c
+++ b/drivers/remoteproc/qcom_q6v5.c
@@ -164,6 +164,11 @@ static irqreturn_t q6v5_handover_interrupt(int irq, void *data)
{
struct qcom_q6v5 *q6v5 = data;
+ if (q6v5->handover_issued) {
+ dev_err(q6v5->dev, "Handover signaled, but it already happened\n");
+ return IRQ_HANDLED;
+ }
+
if (q6v5->handover)
q6v5->handover(q6v5);
--
2.50.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 3/4] remoteproc: qcom_q6v5_pas: Shutdown lite ADSP DTB on X1E
2025-08-20 16:02 [PATCH v2 0/4] remoteproc: qcom_q6v5: Misc fixes to prepare for reusing the "lite" ADSP FW Stephan Gerhold
2025-08-20 16:02 ` [PATCH v2 1/4] remoteproc: qcom_q6v5: Avoid disabling handover IRQ twice Stephan Gerhold
2025-08-20 16:02 ` [PATCH v2 2/4] remoteproc: qcom_q6v5: Avoid handling handover twice Stephan Gerhold
@ 2025-08-20 16:02 ` Stephan Gerhold
2025-08-20 16:02 ` [PATCH v2 4/4] remoteproc: qcom_q6v5_pas: Drop redundant assignment to ret Stephan Gerhold
3 siblings, 0 replies; 6+ messages in thread
From: Stephan Gerhold @ 2025-08-20 16:02 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier
Cc: Sibi Sankar, Abel Vesa, linux-arm-msm, linux-remoteproc,
linux-kernel, Konrad Dybcio, Dmitry Baryshkov
The ADSP firmware on X1E has separate firmware binaries for the main
firmware and the DTB. The same applies for the "lite" firmware loaded by
the boot firmware.
When preparing to load the new ADSP firmware we shutdown the lite_pas_id
for the main firmware, but we don't shutdown the corresponding lite pas_id
for the DTB. The fact that we're leaving it "running" forever becomes
obvious if you try to reuse (or just access) the memory region used by the
"lite" firmware: The &adsp_boot_mem is accessible, but accessing the
&adsp_boot_dtb_mem results in a crash.
We don't support reusing the memory regions currently, but nevertheless we
should not keep part of the lite firmware running. Fix this by adding the
lite_dtb_pas_id and shutting it down as well.
We don't have a way to detect if the lite firmware is actually running yet,
so ignore the return status of qcom_scm_pas_shutdown() for now. This was
already the case before, the assignment to "ret" is not used anywhere.
Fixes: 62210f7509e1 ("remoteproc: qcom_q6v5_pas: Unload lite firmware on ADSP")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
---
drivers/remoteproc/qcom_q6v5_pas.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c
index 02e29171cbbee2d305827365ef7d2241b6eb786b..f3ec5b06261e8bafe8a8d2378b60285d0855674a 100644
--- a/drivers/remoteproc/qcom_q6v5_pas.c
+++ b/drivers/remoteproc/qcom_q6v5_pas.c
@@ -42,6 +42,7 @@ struct qcom_pas_data {
int pas_id;
int dtb_pas_id;
int lite_pas_id;
+ int lite_dtb_pas_id;
unsigned int minidump_id;
bool auto_boot;
bool decrypt_shutdown;
@@ -80,6 +81,7 @@ struct qcom_pas {
int pas_id;
int dtb_pas_id;
int lite_pas_id;
+ int lite_dtb_pas_id;
unsigned int minidump_id;
int crash_reason_smem;
unsigned int smem_host_id;
@@ -226,6 +228,8 @@ static int qcom_pas_load(struct rproc *rproc, const struct firmware *fw)
if (pas->lite_pas_id)
ret = qcom_scm_pas_shutdown(pas->lite_pas_id);
+ if (pas->lite_dtb_pas_id)
+ qcom_scm_pas_shutdown(pas->lite_dtb_pas_id);
if (pas->dtb_pas_id) {
ret = request_firmware(&pas->dtb_firmware, pas->dtb_firmware_name, pas->dev);
@@ -722,6 +726,7 @@ static int qcom_pas_probe(struct platform_device *pdev)
pas->minidump_id = desc->minidump_id;
pas->pas_id = desc->pas_id;
pas->lite_pas_id = desc->lite_pas_id;
+ pas->lite_dtb_pas_id = desc->lite_dtb_pas_id;
pas->info_name = desc->sysmon_name;
pas->smem_host_id = desc->smem_host_id;
pas->decrypt_shutdown = desc->decrypt_shutdown;
@@ -1085,6 +1090,7 @@ static const struct qcom_pas_data x1e80100_adsp_resource = {
.pas_id = 1,
.dtb_pas_id = 0x24,
.lite_pas_id = 0x1f,
+ .lite_dtb_pas_id = 0x29,
.minidump_id = 5,
.auto_boot = true,
.proxy_pd_names = (char*[]){
--
2.50.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 4/4] remoteproc: qcom_q6v5_pas: Drop redundant assignment to ret
2025-08-20 16:02 [PATCH v2 0/4] remoteproc: qcom_q6v5: Misc fixes to prepare for reusing the "lite" ADSP FW Stephan Gerhold
` (2 preceding siblings ...)
2025-08-20 16:02 ` [PATCH v2 3/4] remoteproc: qcom_q6v5_pas: Shutdown lite ADSP DTB on X1E Stephan Gerhold
@ 2025-08-20 16:02 ` Stephan Gerhold
2025-08-20 17:18 ` Dmitry Baryshkov
3 siblings, 1 reply; 6+ messages in thread
From: Stephan Gerhold @ 2025-08-20 16:02 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier
Cc: Sibi Sankar, Abel Vesa, linux-arm-msm, linux-remoteproc,
linux-kernel, Konrad Dybcio, Dmitry Baryshkov
We don't have a way to detect if the lite firmware is actually running yet,
so we should ignore the return status of qcom_scm_pas_shutdown() for now.
The assignment to "ret" is not used anywhere, so just drop it.
Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
---
drivers/remoteproc/qcom_q6v5_pas.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c
index f3ec5b06261e8bafe8a8d2378b60285d0855674a..6faedae8d32ef6c3c2071975f2f1e37a9ffd8abe 100644
--- a/drivers/remoteproc/qcom_q6v5_pas.c
+++ b/drivers/remoteproc/qcom_q6v5_pas.c
@@ -227,7 +227,7 @@ static int qcom_pas_load(struct rproc *rproc, const struct firmware *fw)
pas->firmware = fw;
if (pas->lite_pas_id)
- ret = qcom_scm_pas_shutdown(pas->lite_pas_id);
+ qcom_scm_pas_shutdown(pas->lite_pas_id);
if (pas->lite_dtb_pas_id)
qcom_scm_pas_shutdown(pas->lite_dtb_pas_id);
--
2.50.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 4/4] remoteproc: qcom_q6v5_pas: Drop redundant assignment to ret
2025-08-20 16:02 ` [PATCH v2 4/4] remoteproc: qcom_q6v5_pas: Drop redundant assignment to ret Stephan Gerhold
@ 2025-08-20 17:18 ` Dmitry Baryshkov
0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Baryshkov @ 2025-08-20 17:18 UTC (permalink / raw)
To: Stephan Gerhold
Cc: Bjorn Andersson, Mathieu Poirier, Sibi Sankar, Abel Vesa,
linux-arm-msm, linux-remoteproc, linux-kernel, Konrad Dybcio
On Wed, Aug 20, 2025 at 06:02:36PM +0200, Stephan Gerhold wrote:
> We don't have a way to detect if the lite firmware is actually running yet,
> so we should ignore the return status of qcom_scm_pas_shutdown() for now.
> The assignment to "ret" is not used anywhere, so just drop it.
>
> Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
> ---
> drivers/remoteproc/qcom_q6v5_pas.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-08-20 17:19 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-20 16:02 [PATCH v2 0/4] remoteproc: qcom_q6v5: Misc fixes to prepare for reusing the "lite" ADSP FW Stephan Gerhold
2025-08-20 16:02 ` [PATCH v2 1/4] remoteproc: qcom_q6v5: Avoid disabling handover IRQ twice Stephan Gerhold
2025-08-20 16:02 ` [PATCH v2 2/4] remoteproc: qcom_q6v5: Avoid handling handover twice Stephan Gerhold
2025-08-20 16:02 ` [PATCH v2 3/4] remoteproc: qcom_q6v5_pas: Shutdown lite ADSP DTB on X1E Stephan Gerhold
2025-08-20 16:02 ` [PATCH v2 4/4] remoteproc: qcom_q6v5_pas: Drop redundant assignment to ret Stephan Gerhold
2025-08-20 17:18 ` Dmitry Baryshkov
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).