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 A5B26C433FE for ; Tue, 4 Oct 2022 09:57:36 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ArFLjxhCnVe5EGH/Kk8FL8FbTjJyuG+S05eq7sDAxn0=; b=x2YZr6zFzJZwOI SYmyk+9/DkBQRX1QEN88wysS1k2bebJsKfuHSemekfJWLL1/OrGkQtWOK9ziZbAVDF/uSUVLrgXRv eEBS6p7ji0CLgX6wly7OrLF4Shp3GJDy39rCdyIvNuldgLWmtNfPoJ9gvl3mhWkoPClqMfjKx4Uxg clloAC6pWyW4qfDCBWrmcqphgNk+j5qmTA5jeiNsRZZq+Y2iC/8tPlBkAXX931eda/CiuPm9iktoa hFgNlFSxddS8cmJPSSeIkFIykQBhkCiqd/EA1PppMc/aogirSWoR9IbbuN8ItcHkNFIh8yBWMW+7m 7Ujm/Y/v8GAVtmZD5LDQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofefK-009Ewg-An; Tue, 04 Oct 2022 09:56:42 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofefG-009EuU-NU for linux-arm-kernel@lists.infradead.org; Tue, 04 Oct 2022 09:56:40 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1544112FC; Tue, 4 Oct 2022 02:56:40 -0700 (PDT) Received: from [10.57.65.170] (unknown [10.57.65.170]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 43C943F67D; Tue, 4 Oct 2022 02:56:31 -0700 (PDT) Message-ID: <5383faae-a41f-0f99-efac-30780be675f4@arm.com> Date: Tue, 4 Oct 2022 10:56:24 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: REGRESSION in 6.0-rc7 caused by patch "ARM/dma-mapping: use dma-direct unconditionally" Content-Language: en-GB To: Christoph Hellwig , Marcin Wojtas Cc: =?UTF-8?Q?Marek_Beh=c3=ban?= , "Russell King (Oracle)" , pali@kernel.org, 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 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> From: Robin Murphy In-Reply-To: <20221004071000.GA28925@lst.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221004_025638_890782_2F6A7284 X-CRM114-Status: GOOD ( 20.93 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2022-10-04 08:10, 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 > That seems reasonable to me - it preserves the equivalent behaviour of respecting platform overrides, which thankfully only go one way. In terms of the intent it might be more properly phrased as "if (!dev->dma_coherent) dev->dma_coherent = coherent" but whether that's worth the extra characters is debatable. The only other possibility might be to change mvebu_hwcc_notifier() to apply its override at the BUS_NOTIFY_BIND_DRIVER stage, after dma_configure() has run. The other notifier for highbank looks unaffected since that one's just following whatever the DT says rather than trying to override anything. Thanks, Robin. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel