From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 62FB0C433FE for ; Tue, 4 Oct 2022 08:16:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MYVg6jxX3IwZ0calBEvH/OU1ZRwx1uHCW5FJaiYmzgA=; b=r13ICz515dCqkM 1ajwwp9ZIF03hMXYmfQyQqrLgsuPaZc3AR5dIA83QTKIdQPOYbV7VYScMPHobWv4eUKeF3Iy0bvGh SX9XAzysPYcRwhd47gLPGZUMngL8qB1MT1X6O9p9MDtK1dCDgwWhfPY/5e54WesjluEAiYKZqEOzS 8r9S34hp52JkD+CZ6eduOZ5dBwJ4M52f5Phfpr+sFcGTI3+bVp+ySEfAZFh++sGSHiWUJkdaQvTxW LKIzC4sSqNWXCHUGs6Rw0Y/54mjQUCQxED3CgiWQmwB8i2/b8lKZsmV40+wBgrY7FNdKfO71RARkG mTDGmzi7yjKCE4jab5OA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofd5F-008ta1-9V; Tue, 04 Oct 2022 08:15:21 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofd5B-008tYF-9F for linux-arm-kernel@lists.infradead.org; Tue, 04 Oct 2022 08:15:19 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E0DABB81914; Tue, 4 Oct 2022 08:15:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B00F3C433D6; Tue, 4 Oct 2022 08:15:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664871314; bh=kXZmrPpOkXeG55txUSpkXeuRy1fPDLDK7LedkF5tTv8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Nrtr3BZbDK6oNDppcn4Xu+54GqDtVZGMpjNtSYV3Mg9fR6IZ2dsf4acxK3La24AKT C/xtkrEAcRR9SORGyFexLvoWpcUN3PAASBngsF2hhDNff0hhkoU+Nae+Gc3bFDL3MU AHDx55j5/5u+76A3GAc9G1o5QCFWJXwvEFNNF9bjrKF/M7auR4iSIsdDYNhODX3DtI s4FvxsUKuhey9M8uytzmxOgCrO7LZiZO/N7dIMKftzt3CHOvaYWsDzKLxKwNUPrt9n NznP+PzlvUgK8S8Ze1wywUhw7WSYT6WgzEQh62aNXxUBa1665JCaCG2UZtTgvC6Rqd /CJsdYcBpa18w== Date: Tue, 4 Oct 2022 10:15:02 +0200 From: Marek =?UTF-8?B?QmVow7pu?= To: Christoph Hellwig Cc: Marcin Wojtas , "Russell King (Oracle)" , pali@kernel.org, Robin Murphy , Arnd Bergmann , Andre Przywara , Marc Zyngier , Linus Torvalds , Andrew Lunn , Gregory Clement , Greg Kroah-Hartman , iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org Subject: Re: REGRESSION in 6.0-rc7 caused by patch "ARM/dma-mapping: use dma-direct unconditionally" Message-ID: <20221004101502.5cbffc63@thinkpad> In-Reply-To: <20221004071000.GA28925@lst.de> References: <20220930151028.0e518421@dellmb> <630be11f-09ef-02d4-69f7-c7880ae5674c@arm.com> <20220930165234.729ad68c@dellmb> <20220930170205.490f1a6b@dellmb> <20221003073037.GB2108@lst.de> <20221003172533.6dc87184@dellmb> <20221004071000.GA28925@lst.de> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221004_011517_635389_92805834 X-CRM114-Status: GOOD ( 27.81 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 4 Oct 2022 09:10:00 +0200 Christoph Hellwig wrote: > On Mon, Oct 03, 2022 at 11:30:31PM +0200, Marcin Wojtas wrote: > > I have one overall concern here. On all kinds of A38x-based boards I > > worked on, by default, the firmware set all devices (e.g. network, > > AHCI, XHCI) on MBUS as fully IO cache coherent - it should be > > reflected in the MVNETA_WIN_BASE(w) registers attribute field. Bits > > [15:8] should be set to 0x1D (or 0x1E if there is a second DRAM CS > > used). Can you please try adding 'dma-coherent;' property under the > > 'internal-regs' node? > > Robin mentioned something similar earlier. This almost smalls like > we somehow manage to mark these device non-coherent by accident now. > > The interesting part of the bisected commit is the change to > mvebu_hwcc_notifier that used to force the DMA OPS to > arm_coherent_dma_ops, but now just sets the ->dma_coherent flags, > which seems to get overriden somehow again. Maybe the notifier is > run before arch_setup_dma_ops, even if that seems odd? As that is > the only thing I could think of, maybe try this patch: > > > diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c > index 089c9c644cce2..76789650e2596 100644 > --- a/arch/arm/mm/dma-mapping.c > +++ b/arch/arm/mm/dma-mapping.c > @@ -1770,7 +1770,9 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, > const struct iommu_ops *iommu, bool coherent) > { > dev->archdata.dma_coherent = coherent; > - dev->dma_coherent = coherent; > + > + if (coherent) > + dev->dma_coherent = true; > > /* > * Don't override the dma_ops if they have already been set. Ideally > Indeed this fixes the issue, and indeed arch_setup_dma_ops is called later than mvebu_hwcc_notifier. bash-5.1# dmesg | grep -Ee '(mvebu_hwcc|arch_setup)' | grep ethernet [ 0.009350] mvebu-coherency: mvebu_hwcc_notifier f1070000.ethernet [ 0.009434] mvebu-coherency: mvebu_hwcc_notifier f1030000.ethernet [ 0.009523] mvebu-coherency: mvebu_hwcc_notifier f1034000.ethernet [ 1.859657] arch_setup_dma_ops f1070000.ethernet coherent=0 [ 1.874852] arch_setup_dma_ops f1030000.ethernet coherent=0 [ 1.889770] arch_setup_dma_ops f1034000.ethernet coherent=0 But mvebu_hwcc_notifier is called even for device not in internal-regs:\ bash-5.1# dmesg | grep -Ee '(mvebu_hwcc|arch_setup)' [ 0.006475] mvebu-coherency: mvebu_hwcc_notifier pmu [ 0.006536] mvebu-coherency: mvebu_hwcc_notifier soc [ 0.007902] mvebu-coherency: mvebu_hwcc_notifier fff00000.bootrom [ 0.007946] mvebu-coherency: mvebu_hwcc_notifier soc:internal-regs ... [ 0.010790] mvebu-coherency: mvebu_hwcc_notifier soc:pcie This probably means that to fix it, we just need to select OF_DMA_DEFAULT_COHERENT in config MACH_MVEBU_V7 ? That way it will work with existing device-trees. Marek _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel