* [PATCH] mailbox: mtk-cmdq: Do not request irq until we are ready
@ 2022-11-25 16:19 Ricardo Ribalda
2022-11-30 11:18 ` AngeloGioacchino Del Regno
0 siblings, 1 reply; 2+ messages in thread
From: Ricardo Ribalda @ 2022-11-25 16:19 UTC (permalink / raw)
To: Jassi Brar, Matthias Brugger
Cc: linux-mediatek, Ricardo Ribalda, linux-arm-kernel, linux-kernel
If the system comes from kexec() the peripheral might trigger an IRQ
befoe we are ready for it. Triggering a crash due to an access to
invalid memory.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
To: Jassi Brar <jassisinghbrar@gmail.com>
To: Matthias Brugger <matthias.bgg@gmail.com>
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@lists.infradead.org
---
drivers/mailbox/mtk-cmdq-mailbox.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c
index 9465f9081515..829f1ef3309f 100644
--- a/drivers/mailbox/mtk-cmdq-mailbox.c
+++ b/drivers/mailbox/mtk-cmdq-mailbox.c
@@ -545,12 +545,6 @@ static int cmdq_probe(struct platform_device *pdev)
cmdq->control_by_sw = plat_data->control_by_sw;
cmdq->gce_num = plat_data->gce_num;
cmdq->irq_mask = GENMASK(cmdq->thread_nr - 1, 0);
- err = devm_request_irq(dev, cmdq->irq, cmdq_irq_handler, IRQF_SHARED,
- "mtk_cmdq", cmdq);
- if (err < 0) {
- dev_err(dev, "failed to register ISR (%d)\n", err);
- return err;
- }
dev_dbg(dev, "cmdq device: addr:0x%p, va:0x%p, irq:%d\n",
dev, cmdq->base, cmdq->irq);
@@ -613,6 +607,13 @@ static int cmdq_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, cmdq);
+ err = devm_request_irq(dev, cmdq->irq, cmdq_irq_handler, IRQF_SHARED,
+ "mtk_cmdq", cmdq);
+ if (err < 0) {
+ dev_err(dev, "failed to register ISR (%d)\n", err);
+ return err;
+ }
+
WARN_ON(clk_bulk_prepare(cmdq->gce_num, cmdq->clocks));
cmdq_init(cmdq);
---
base-commit: 4312098baf37ee17a8350725e6e0d0e8590252d4
change-id: 20221125-mtk-mailbox-ba6cbd1d91b6
Best regards,
--
Ricardo Ribalda <ribalda@chromium.org>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mailbox: mtk-cmdq: Do not request irq until we are ready
2022-11-25 16:19 [PATCH] mailbox: mtk-cmdq: Do not request irq until we are ready Ricardo Ribalda
@ 2022-11-30 11:18 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 2+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-11-30 11:18 UTC (permalink / raw)
To: Ricardo Ribalda, Jassi Brar, Matthias Brugger
Cc: linux-mediatek, linux-arm-kernel, linux-kernel
Il 25/11/22 17:19, Ricardo Ribalda ha scritto:
> If the system comes from kexec() the peripheral might trigger an IRQ
> befoe we are ready for it. Triggering a crash due to an access to
> invalid memory.
>
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
I agree on this change, but I've already sent a patch that's been reviewed
by multiple people (hence ready to be picked), on top of which this patch
will not apply.
Can you please rebase this patch on top of [1]?
Thanks,
Angelo
[1]:
https://patchwork.kernel.org/project/linux-mediatek/patch/20221102100736.37815-1-angelogioacchino.delregno@collabora.com/
> ---
> To: Jassi Brar <jassisinghbrar@gmail.com>
> To: Matthias Brugger <matthias.bgg@gmail.com>
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-mediatek@lists.infradead.org
> ---
> drivers/mailbox/mtk-cmdq-mailbox.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
>
> ---
> base-commit: 4312098baf37ee17a8350725e6e0d0e8590252d4
> change-id: 20221125-mtk-mailbox-ba6cbd1d91b6
>
> Best regards,
>
> diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c
> index 9465f9081515..829f1ef3309f 100644
> --- a/drivers/mailbox/mtk-cmdq-mailbox.c
> +++ b/drivers/mailbox/mtk-cmdq-mailbox.c
> @@ -545,12 +545,6 @@ static int cmdq_probe(struct platform_device *pdev)
> cmdq->control_by_sw = plat_data->control_by_sw;
> cmdq->gce_num = plat_data->gce_num;
> cmdq->irq_mask = GENMASK(cmdq->thread_nr - 1, 0);
> - err = devm_request_irq(dev, cmdq->irq, cmdq_irq_handler, IRQF_SHARED,
> - "mtk_cmdq", cmdq);
> - if (err < 0) {
> - dev_err(dev, "failed to register ISR (%d)\n", err);
> - return err;
> - }
>
> dev_dbg(dev, "cmdq device: addr:0x%p, va:0x%p, irq:%d\n",
> dev, cmdq->base, cmdq->irq);
> @@ -613,6 +607,13 @@ static int cmdq_probe(struct platform_device *pdev)
>
> platform_set_drvdata(pdev, cmdq);
>
> + err = devm_request_irq(dev, cmdq->irq, cmdq_irq_handler, IRQF_SHARED,
> + "mtk_cmdq", cmdq);
> + if (err < 0) {
> + dev_err(dev, "failed to register ISR (%d)\n", err);
> + return err;
> + }
> +
> WARN_ON(clk_bulk_prepare(cmdq->gce_num, cmdq->clocks));
>
> cmdq_init(cmdq);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-30 11:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-25 16:19 [PATCH] mailbox: mtk-cmdq: Do not request irq until we are ready Ricardo Ribalda
2022-11-30 11:18 ` AngeloGioacchino Del Regno
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).