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 74AC9C433FE for ; Tue, 4 Oct 2022 09:09:51 +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:In-Reply-To:MIME-Version:References: 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=G97LKdWbGo421Zz7wL8tecbJKB6a1Xjb9at6WIY44S0=; b=BLb/WaAvnqh9/p Edyz8RnQl+3/CUgfEp0fM9NxCeBROoVZ2w2Q9rVEPDaZVPrZE7Jld3U8zxEoXnhLwRn4vv1MooHoN wLZ81iX3B96+QvHvXuVxvVjV3/OoeJvseBRApltLG1ocbNo/nJC/v66EeN+Vpe9fdOAttelzokXC8 HvVz/PFVDKq+UG6J81AfztwpaUGP0Tfg8t+pr+tCU0d//FStPqY5PEGE+zg86xgrv4IbGncOyD9PG HLmppPD1g/GP0/3IipuH7zsrKTssuBIWGHsGNwlC/4EB2o/2ca5xtqGZXt6b7eyKwnFG+Wz6pWZer YwbR5YHIMUanFZ3EK85A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofdut-0094V8-KS; Tue, 04 Oct 2022 09:08:43 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofduk-0094TX-8l for linux-arm-kernel@lists.infradead.org; Tue, 04 Oct 2022 09:08:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=m+y2fj/5P8PwvNKRrZV+VeY1FPH0GSf9kcQWSug4Tpg=; b=0XA/JwKdmVYqYrT0BxowiirUH2 OCZdkYDHj/xuc58RfZb0WhjH+VALlQ+n0yMG0n+2e+tDVI5t/El+JHPnOz+LtbqW39lPbvEc5BxYE HKZCzLORppTW/fqf4bGvBbA1wirf3FtoR5m4zy7QkEEAznxXV/PriyKYlqNbrCtZ/beuAoX6lR8B8 AdYejvPX24/mrlH8DX4e3pBoqD/yQjClDnxKiRGhg/LEpNrG4tRfpF6jT1EjWkLF7ZaKXmEUpNeKC IwmKTc/fLIO46Bq7eyZjurOTzs2+R9yE0snKcKoJz9FIHd/1nQFFKH2PL+LMizneIvp/TqT4FT+Fh su0bjyQA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:34576) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ofduU-0007sS-OF; Tue, 04 Oct 2022 10:08:18 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1ofduR-0004G4-Og; Tue, 04 Oct 2022 10:08:15 +0100 Date: Tue, 4 Oct 2022 10:08:15 +0100 From: "Russell King (Oracle)" To: Marcin Wojtas Cc: Marek =?iso-8859-1?Q?Beh=FAn?= , pali@kernel.org, Christoph Hellwig , 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: References: <20220930151028.0e518421@dellmb> <630be11f-09ef-02d4-69f7-c7880ae5674c@arm.com> <20220930165234.729ad68c@dellmb> <20220930170205.490f1a6b@dellmb> <20221003073037.GB2108@lst.de> <20221003172533.6dc87184@dellmb> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221004_020834_329865_405A11FB X-CRM114-Status: GOOD ( 24.23 ) 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, Oct 04, 2022 at 10:30:40AM +0200, Marcin Wojtas wrote: > Thanks for the explanation and I agree with your reasoning. Therefore > the below should be sufficient if we use HW BM and non-coherent > setting: > > --- a/drivers/net/ethernet/marvell/mvneta_bm.c > +++ b/drivers/net/ethernet/marvell/mvneta_bm.c > @@ -103,7 +103,7 @@ int mvneta_bm_construct(struct hwbm_pool > *hwbm_pool, void *buf) > */ > *(u32 *)buf = (u32)buf; > phys_addr = dma_map_single(&priv->pdev->dev, buf, bm_pool->buf_size, > - DMA_FROM_DEVICE); > + DMA_BIDIRECTIONAL); > if (unlikely(dma_mapping_error(&priv->pdev->dev, phys_addr))) > return -ENOMEM; > > Marek - can you please confirm that? This is insufficient. Marek's patch is the correct version. The DMA API requires that the direction argument is the same for mapping, unmapping and syncing a region. > > I did notice that there was no dma-coherent markings in DT, which means > > that the DMA API will assume the device is non-coherent, and cache > > maintenance will be performed. If it is dma-coherent, then cache > > maintenance won't be performed, and DT needs to be updated to indicate > > this. > > > > If firmware is making the devices DMA coherent, and it's under firmware > > control, then shouldn't firmware also be updating the kernel's device > > tree to indicate how it's configured the hardware coherency? > > > > Imo there are too many boxes out there and updating firmware in the > field is rather no-go. We already handle this in kernel / DT in big > extent, so I think we should stick to that path. Seemingly, we don't handle it "well enough" in the kernel, since with Christoph's change, we end up with the devices being non-coherent. Yes, the kernel needs fixing to work with older firmware, but I think firmware should also be fixed. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel