Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp15667902rwb; Mon, 28 Nov 2022 14:40:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf7iJd2+rgfNkf46kVVEdQYSTXbfHCjI/HtUSFEAbOcUbrFYvsR9o2r2zZru7Et2NrC1cc63 X-Received: by 2002:a17:90b:1bc6:b0:218:4d16:cecf with SMTP id oa6-20020a17090b1bc600b002184d16cecfmr55491860pjb.96.1669675204745; Mon, 28 Nov 2022 14:40:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669675204; cv=none; d=google.com; s=arc-20160816; b=YAY8y7Mkx0RB7m4zPyQGmGs5rdr4P5siz86d1k4LrQoI3+NNLGYPc6Bntsbqlz+i9q EmipNA5rEe5ET3tqsyTOXDGDKmbcJxwT5I9vJxA4AoXEOp+hIlt6kdEE/ZjxVq8VVg7a MActPFZQjd6B26zgo38H1vr7dcmL3JvCYDWZDtSk3+CIS0sxB8UvBPfBCnvCCBPv8fis qHxNnzvKsgC/SUAhcqGREsfDK9iYmbmmWeWwNBtlFcpx7Q9/AFqYEBr/XcH7DjXTGjRg y0+Ml8OMZQBnvJfFLOTe1gnwtIWmea8v/RZzVJL2ipi8/O23O1FpWj4Qwrdh0wdmfHff Ea9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=vRCP5i+kS7Z6U29Z84RcTfhHLs05Gmm0hutojax5sCQ=; b=qAjQ64TsVtw8OhF4fUWypVZxF0Do7xBVJ8kPvAmu4NvfoyM9hECKSP7BbLiPfZFphz hNRPqJO1sfhv3XJ4tWitrNp9p731fpmnA3lI+MKN6IsJCurFpeLUfsVX33idX2UkWoE3 9UdkczVX2UNh+UD+JtcWsLEP9N+u2iZpGOOx1+85R3lVN6tH5qFt/KdFfp3TWjC8GLYG uGg6wVWwvkzuwIlsmvqlx+ZxBy/1PK9KWdmWkDWHeLO1j0ofujjuhMFsxzMBwNbMMLE0 N5Z6gYrTpBddS5OBN0XTKoLM0CyPlt/sOOOXVTE6/oX4M4fVjiJgOYdaNaziyteTtVfx g/ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=j8Vmxmlo; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x71-20020a63864a000000b0047813915b38si4546254pgd.767.2022.11.28.14.39.54; Mon, 28 Nov 2022 14:40:04 -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=j8Vmxmlo; 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 S234513AbiK1WOy (ORCPT + 84 others); Mon, 28 Nov 2022 17:14:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234481AbiK1WOv (ORCPT ); Mon, 28 Nov 2022 17:14:51 -0500 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE0BD1B0 for ; Mon, 28 Nov 2022 14:14:50 -0800 (PST) Received: by mail-io1-xd31.google.com with SMTP id n188so8731861iof.8 for ; Mon, 28 Nov 2022 14:14:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=vRCP5i+kS7Z6U29Z84RcTfhHLs05Gmm0hutojax5sCQ=; b=j8VmxmloAfeZxEA3bXqzHAqH4WWzlyvDlESJv713QjFWvS1Hn8f7Ue3yiGK6JHS/Ue Zh4TzPaicWn/3R0FGXzTUisHAPSpFYj2QVIQjjccPUTBGCOh31fWgWZmgg1nf5dgXnb5 ePvpR9jbLcUt2+vJDPVM5E3gfYIj6NrTmNdYc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vRCP5i+kS7Z6U29Z84RcTfhHLs05Gmm0hutojax5sCQ=; b=zpol8DD9+VPW2MmvbkPOFF9G0K6udaLVurr4MBcy9u4tiiE6VVdOqLwqR1sYkdQsF4 yFYd4HC1B+TqhPefLVk5/EBQRaFXqZO7RsJ0O76BoztgxI+6GMpvj5r3PG0Y/9ti66yY UprmSXkMkYBGt8sqsUunD66KOzQEeSFPYoWH7p2Aj3eLAMEUJrcCp3dWK9E3R6QpctXO wAW/uXfgng+VmHk5cauCgVoM/K7bnzvNI3FJC2qzJgrRkgESUwjGzDpnsf9WexA98lkk T3HLcddfK2tkHdH8NnMZmzJbgR/AY3QHTBnZgDV6M2r6kt6DPOz+JQNN2waHyi6ol8SV mP/g== X-Gm-Message-State: ANoB5pl/dk7xhN8/qkjLtXHD52kGm+tWUekYlqw+sDnfYYG4QdmVGIPX 8r5nfbYWyxYtwJXyDzLNz6PX25YVvxKPZfWO X-Received: by 2002:a02:ad09:0:b0:363:ba2d:fe04 with SMTP id s9-20020a02ad09000000b00363ba2dfe04mr24818956jan.226.1669673690058; Mon, 28 Nov 2022 14:14:50 -0800 (PST) Received: from mail-io1-f45.google.com (mail-io1-f45.google.com. [209.85.166.45]) by smtp.gmail.com with ESMTPSA id d74-20020a02624d000000b00363e4730a41sm4648093jac.175.2022.11.28.14.14.49 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Nov 2022 14:14:49 -0800 (PST) Received: by mail-io1-f45.google.com with SMTP id h206so8738586iof.10 for ; Mon, 28 Nov 2022 14:14:49 -0800 (PST) X-Received: by 2002:a05:6638:11d3:b0:389:ebdc:8f4 with SMTP id g19-20020a05663811d300b00389ebdc08f4mr530772jas.27.1669673688675; Mon, 28 Nov 2022 14:14:48 -0800 (PST) MIME-Version: 1.0 References: <20221125-mtk-iommu-v1-0-bb5ecac97a28@chromium.org> <9e81fb3cc4f315f330c610dfb16bad50b7241f4c.camel@mediatek.com> In-Reply-To: <9e81fb3cc4f315f330c610dfb16bad50b7241f4c.camel@mediatek.com> From: Ricardo Ribalda Date: Mon, 28 Nov 2022 23:14:37 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] iommu/mediatek: Fix crash on isr after kexec() To: =?UTF-8?B?WW9uZyBXdSAo5ZC05YuHKQ==?= Cc: "robin.murphy@arm.com" , "joro@8bytes.org" , "matthias.bgg@gmail.com" , "will@kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-mediatek@lists.infradead.org" , "iommu@lists.linux.dev" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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: X-Mailing-List: linux-kernel@vger.kernel.org Hi Yong On Mon, 28 Nov 2022 at 07:44, Yong Wu (=E5=90=B4=E5=8B=87) 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 > > --- > > To: Yong Wu > > To: Joerg Roedel > > To: Will Deacon > > To: Robin Murphy > > To: Matthias Brugger > > 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 =3D 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, --=20 Ricardo Ribalda