Message ID | 20221125-mtk-iommu-v1-0-bb5ecac97a28@chromium.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp4151882wrr; Fri, 25 Nov 2022 08:44:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf7qfPYAVuNDEcdi8r/qoU1obDdDePuzCXjWwywexoXSb8iXL8VXTWvPglIB7G8KTa4Eru7I X-Received: by 2002:a17:90b:394a:b0:210:4438:2d40 with SMTP id oe10-20020a17090b394a00b0021044382d40mr47295256pjb.196.1669394673312; Fri, 25 Nov 2022 08:44:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669394673; cv=none; d=google.com; s=arc-20160816; b=YPuRPMEOiwbEc7zc0KOTeQxB4oAgOmroMBvadmYKkKbpC/V4/QiZYT2KE3WlbOTwRX M3RY8HxeupeuRhkqgit0dUGZ312J89o1Itdl/Hvhm3RGNkTIi8tZM9rhTBse1LL8vPXj IrZu70GSb/5WxafyV8OBdI6LC/jOKSjYJ9Sj67nAVafDRAx10li158Y0naoKYCPmTICP wPhEakOpcAi7+qW3Wre329KMGSLIE4URmsUZZuJmI7H2Ym20nkYVBpWbgtQDbdISNI0y hNvDLXO1vRJSM1azclG392Uytpnm57vEph9P33RXXScNxKne2uHPmMDPABuyuLdgaAzj XO6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=FPfIcZ7oMFAWMErNOiDjIKAKPnIKu22VqMpx37ofk00=; b=fwh8vnVhf5oi0A4rdKb4fwyDidKygg6kIQfAWIVc4Ohbth4nLAxRTk2wFwch+/5ZaR 936/RXE7UahlIpM4YJha/cRDtM7jEecTxzCVj8yByCy5if61H5imh5iI4NOnDim3X4SV TKZOUYArg0YHrVLcXc/jO/5v2mzLT6t0j7f91cZVagdJWgHR4Zu5ZfRuOdLDxr4G1c7P L73wyEYHygZtQdPW77RwLTGytx5UMh2Mg5Xa04JC17v/JQeaFGLFJdOEZtCFJysZvTsZ ivRpbnDne6ykCkFUG1ccj9QtS0iRSiICOqAe1VDOwsc5HVGXH4kXBLhh3zoxGZlTrNbq LAfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=aUwGVuMX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w63-20020a638242000000b00476c46ff6ebsi4532969pgd.27.2022.11.25.08.44.19; Fri, 25 Nov 2022 08:44:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=aUwGVuMX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229672AbiKYQ2W (ORCPT <rfc822;zxc52fgh@gmail.com> + 99 others); Fri, 25 Nov 2022 11:28:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbiKYQ2V (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 25 Nov 2022 11:28:21 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FED517427 for <linux-kernel@vger.kernel.org>; Fri, 25 Nov 2022 08:28:20 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id cw8so1311745ejb.10 for <linux-kernel@vger.kernel.org>; Fri, 25 Nov 2022 08:28:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=FPfIcZ7oMFAWMErNOiDjIKAKPnIKu22VqMpx37ofk00=; b=aUwGVuMXyJgJCAsCUvWy3cRAnZdydVYshWa7vdWjNxFdJlX17LHfBZidw2jPsd6Ias rDsTEWcavVDqxeeofCi6uvNO79qiGVFMmDKKrrMomr8desXQAn9S2PY5T+eVfdHMFi/h 8ty+kGBPgvn7HF22ZOAAZA0P+oYT/20dD8t9s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FPfIcZ7oMFAWMErNOiDjIKAKPnIKu22VqMpx37ofk00=; b=sOnUkjkfwmE0Te6n6aBEazVGAGBQ8sV/BRz0J1Nlz51kL/n8LIHO2xYZ+1fHyFmQzx VQdhFmVwRmeeWp1wFOOSEsR4ZOZIH8GtWtrtBKap6SL8HMDJgkwTdIwEZk+9uewqYKwc 9hVvxEII6vHBfRSDBSyD9fJI6/mo3jEy/JGa1GdXIiZyBR8qSXtmnp1hEbUrLcvrBtET jPsFx9Rlm0MqgkGg2nMB63ghgI+SVs1VNVTdv2DJPRXKjPzLzsg/vNnbX4dqCjoYleE8 sU33ZZLsNMqSNCb4T0Qlk3s+qEyjSmCDqyLxnDMZU1WHr92m65JQJUWb4CjmYG9/RSU3 CLmg== X-Gm-Message-State: ANoB5pkWI5VEJUkeQzxltFGwuaKzd7nibpK9AJVyDd/WxPci2wBk1/ul ry83ziPFqwu7zb/nDXZCULw9XOzKdP6q2FCp X-Received: by 2002:a17:906:d8db:b0:7ba:8633:7f7b with SMTP id re27-20020a170906d8db00b007ba86337f7bmr9893641ejb.206.1669393699000; Fri, 25 Nov 2022 08:28:19 -0800 (PST) Received: from alco.roam.corp.google.com (80.71.134.83.ipv4.parknet.dk. [80.71.134.83]) by smtp.gmail.com with ESMTPSA id ud10-20020a170907c60a00b007b29eb8a4dbsm1771589ejc.13.2022.11.25.08.28.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Nov 2022 08:28:18 -0800 (PST) From: Ricardo Ribalda <ribalda@chromium.org> Date: Fri, 25 Nov 2022 17:28:10 +0100 Subject: [PATCH] iommu/mediatek: Fix crash on isr after kexec() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20221125-mtk-iommu-v1-0-bb5ecac97a28@chromium.org> To: Joerg Roedel <joro@8bytes.org>, Matthias Brugger <matthias.bgg@gmail.com>, Yong Wu <yong.wu@mediatek.com>, Will Deacon <will@kernel.org>, Robin Murphy <robin.murphy@arm.com> Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ricardo Ribalda <ribalda@chromium.org>, linux-mediatek@lists.infradead.org X-Mailer: b4 0.11.0-dev-696ae X-Developer-Signature: v=1; a=openpgp-sha256; l=1626; i=ribalda@chromium.org; h=from:subject:message-id; bh=yRsx62PHekdowYwa/Kc+JnAl1OMT11qcvF/UlUuv6e0=; b=owEBbQKS/ZANAwAKAdE30T7POsSIAcsmYgBjgO0e3Iz3uM3saXvlJTwcfd3xV9teD31lx/tBsCaA +GKjJmCJAjMEAAEKAB0WIQREDzjr+/4oCDLSsx7RN9E+zzrEiAUCY4DtHgAKCRDRN9E+zzrEiJyVD/ 4m5rgQ65+VT7WWI6q1UJaIcmFMXSC9WDSpsxRNyMBz6BZRl8DFMhNassgGM7Yjvs/dpX2vSLlc65qv GiFTZaTAvqIk5J8IS7wIrf4/vfknf9EVix8AUcFguYeK8FlPNWbxWWVPtum55vKSQS1a86HOlOtmAt 0JWGTzVCkSPmG9whMr37fwsQmcXd1U22IoxKYKxlTDsW43eplAc8+YCXlGUw/jIRf6VSD2jyCC6q1s VPPdqFmFrVvYPnvPj9x2JYrSyJxgATgup+ik22/syCK/2Gfm/q6Q+F3i9D5SlOi9UceYAkazZgGTQ4 9DU0HQ4BfNJxEdEHEeiAwMuFuA4ghfTigyEgD/U2gIt2mVnaI0+ja67va3TFrqfFjX4viTps6fQDRO ysS39413twJwmd2jmq9jSUAMgv7dJJnpAAwajU5EO5Ll7Jiefj982V5jwuHIEv+2UfNBcNcNy4hHpC rT4CPllsoZC40ASm16E4LEQ8k957AN9mCXoSOAaFpM9xoKhtwIOthkoXW5QRWPjB1iYsAYfiMo3GDb vpyigsb2GbfNvCV7+oZmpcrnWBBqBG/Oiohf4LIsBsuI+3HWAZMIKAT2sYpW9BrpXoPvD7qKWefC9f VT9oitp2Ge/qjpxG1RCS3QoszdeRwAsmwGWTzh2I0RFE5HJUvMUQaTOzdYLg== X-Developer-Key: i=ribalda@chromium.org; a=openpgp; fpr=9EC3BB66E2FC129A6F90B39556A0D81F9F782DA9 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750487188883235926?= X-GMAIL-MSGID: =?utf-8?q?1750487188883235926?= |
Series |
iommu/mediatek: Fix crash on isr after kexec()
|
|
Commit Message
Ricardo Ribalda
Nov. 25, 2022, 4:28 p.m. UTC
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
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(-)
---
base-commit: 4312098baf37ee17a8350725e6e0d0e8590252d4
change-id: 20221125-mtk-iommu-13023f971298
Best regards,
Comments
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,
Hi Robin Thanks for your review! On Fri, 25 Nov 2022 at 18:02, Robin Murphy <robin.murphy@arm.com> wrote: > > 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...) It is not only about the "last" IRQ before kexec. The peripherals under the IOMMU might still active and producing faults and therefore IRQs. I tried this: @@ -886,6 +886,11 @@ static int mtk_iommu_hw_init(const struct mtk_iommu_data *data, unsigned int ban upper_32_bits(data->protect_base); writel_relaxed(regval, bankx->base + REG_MMU_IVRP_PADDR); + /* Clear previous IRQs */ + regval = readl_relaxed(bankx->base + REG_MMU_INT_CONTROL0); + regval |= F_INT_CLR_BIT; + writel_relaxed(regval, bankx->base + REG_MMU_INT_CONTROL0); + if (devm_request_irq(bankx->pdev, bankx->irq, mtk_iommu_isr, 0, dev_name(bankx->pdev), (void *)bankx)) { writel_relaxed(0, bankx->base + REG_MMU_PT_BASE_ADDR); And I still get the same crash > > > 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,
On Fri, 2022-11-25 at 17:28 +0100, 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 > > 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, Which SoC does this issue happen? Does this issue is happened in the upstream kernel or the downstream kernel? Normally each port enable the iommu defaultly. Let's print the error log even though "dom" is null to check which port fail here. then analyse the port's behavior. if (!dom || report_iommu_fault(xx)) dev_err_ratelimited(xx) > write ? IOMMU_FAULT_WRITE : > IOMMU_FAULT_READ)) { > dev_err_ratelimited( > bank->parent_dev, > > --- > base-commit: 4312098baf37ee17a8350725e6e0d0e8590252d4 > change-id: 20221125-mtk-iommu-13023f971298 > > Best regards,
Hi Yong On Mon, 28 Nov 2022 at 07:44, Yong Wu (吴勇) <Yong.Wu@mediatek.com> wrote: > > On Fri, 2022-11-25 at 17:28 +0100, 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 > > > > 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, > > > Which SoC does this issue happen? Does this issue is happened in the > upstream kernel or the downstream kernel? I am using chromeos-5.10 and chromeos-5.15 (which are pretty much upstream). I have seen this issue at least with MT8195 and MT8183 > > Normally each port enable the iommu defaultly. Let's print the error > log even though "dom" is null to check which port fail here. then > analyse the port's behavior. > > if (!dom || report_iommu_fault(xx)) > dev_err_ratelimited(xx) sending a v2 with the change. Thanks! > > > write ? IOMMU_FAULT_WRITE : > > IOMMU_FAULT_READ)) { > > dev_err_ratelimited( > > bank->parent_dev, > > > > --- > > base-commit: 4312098baf37ee17a8350725e6e0d0e8590252d4 > > change-id: 20221125-mtk-iommu-13023f971298 > > > > Best regards,
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,