From: Robin Murphy <robin.murphy@arm.com>
To: Ricardo Ribalda <ribalda@chromium.org>,
Joerg Roedel <joro@8bytes.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
Yong Wu <yong.wu@mediatek.com>, Will Deacon <will@kernel.org>
Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH] iommu/mediatek: Fix crash on isr after kexec()
Date: Fri, 25 Nov 2022 17:02:41 +0000 [thread overview]
Message-ID: <b5682296-4844-863c-83c1-1fb9a35009d8@arm.com> (raw)
In-Reply-To: <20221125-mtk-iommu-v1-0-bb5ecac97a28@chromium.org>
On 2022-11-25 16:28, Ricardo Ribalda wrote:
> If the system is rebooted via isr(), the IRQ handler might be triggerd
> before the domain is initialized. Resulting on an invalid memory access
> error.
>
> Fix:
> [ 0.500930] Unable to handle kernel read from unreadable memory at virtual address 0000000000000070
> [ 0.501166] Call trace:
> [ 0.501174] report_iommu_fault+0x28/0xfc
> [ 0.501180] mtk_iommu_isr+0x10c/0x1c0
Hmm, shouldn't we clear any pending faults at probe in
mtk_iommu_hw_init(), before the IRQ is requested? mtk_iommu_isr() might
still want to be robust against a spurious interrupt, but then it can
simply return without doing anything at all if the domain is NULL, since
we'll know that's the case.
Thanks,
Robin.
(It might be nice if request_irq() had a flag to say "if this IRQ looks
pending already just clear it" for drivers that know it could only be
spurious at that point; kexec seems to lead to this problem quite a lot...)
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
> To: Yong Wu <yong.wu@mediatek.com>
> To: Joerg Roedel <joro@8bytes.org>
> To: Will Deacon <will@kernel.org>
> To: Robin Murphy <robin.murphy@arm.com>
> To: Matthias Brugger <matthias.bgg@gmail.com>
> Cc: iommu@lists.linux.dev
> Cc: linux-mediatek@lists.infradead.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> ---
> drivers/iommu/mtk_iommu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
> index 2ab2ecfe01f8..17f6be5a5097 100644
> --- a/drivers/iommu/mtk_iommu.c
> +++ b/drivers/iommu/mtk_iommu.c
> @@ -454,7 +454,7 @@ static irqreturn_t mtk_iommu_isr(int irq, void *dev_id)
> fault_larb = data->plat_data->larbid_remap[fault_larb][sub_comm];
> }
>
> - if (report_iommu_fault(&dom->domain, bank->parent_dev, fault_iova,
> + if (dom && report_iommu_fault(&dom->domain, bank->parent_dev, fault_iova,
> write ? IOMMU_FAULT_WRITE : IOMMU_FAULT_READ)) {
> dev_err_ratelimited(
> bank->parent_dev,
>
> ---
> base-commit: 4312098baf37ee17a8350725e6e0d0e8590252d4
> change-id: 20221125-mtk-iommu-13023f971298
>
> Best regards,
next prev parent reply other threads:[~2022-11-25 17:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-25 16:28 Ricardo Ribalda
2022-11-25 17:02 ` Robin Murphy [this message]
2022-11-25 17:15 ` Ricardo Ribalda
2022-11-28 6:44 ` Yong Wu (吴勇)
2022-11-28 22:14 ` Ricardo Ribalda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b5682296-4844-863c-83c1-1fb9a35009d8@arm.com \
--to=robin.murphy@arm.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=ribalda@chromium.org \
--cc=will@kernel.org \
--cc=yong.wu@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®