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 9BA6CC433F5 for ; Mon, 3 Oct 2022 14:13:10 +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=I8q9LRm2cEq1PZTPVsQ9yNCNRu/inMz24wXewv9VB+E=; b=qPxtyGB8yfa11j nnbwQt7dUDnBU2oiwHjw9HBaTNH5OqooeIeGqRsdiHVVb1kJpBdESYm4bJjNBvRIZW92+SHZFGQsG kTcpOhhK4sSfP9j0JuVNgJNDnqeTtxcW46yV+VDfMRK4ETv5rYGr+rNSq417l7yqixa1iddIiyLni nEPYsPRC+T24IZ8etl8QKrXIZDf4ty/a1gDSoBg0x5uNPLv01bX+AFh3x68DWuPaZmu2ngw/pGeDz wNErojv3uCdJakPNIR245BDeYUWTCm3WTVPONRf20EkWSDymYhN4S5FHE4wWO2+MI3h0jrTlduFkD RAB7+fw5fRfTA94a5gGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofMAy-006CYV-WF; Mon, 03 Oct 2022 14:12:09 +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 1ofMAw-006CVI-7H for linux-arm-kernel@lists.infradead.org; Mon, 03 Oct 2022 14:12:07 +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-Transfer-Encoding:Content-Type: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-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Pk5ZGb05/HJZ/7j2FP2QlD6/ZAuzfwyTNp5DPle7z2w=; b=hihfARV49AWgegtIPptV1+E27W gLag5V2KJzLX/Svqh7epIBWbtG0G31QkAumdPSlCi1awW57tgD5+W9tFAY5EWfL2DElJ02nDdqV55 QkyqHlywKyAadzEkp40loiVjEvwExte/80bO0kuxTOoHKnrpt64SsrI6Z6G9jQeoPaw8F6slBLUZc Qi3fGHUeiUpcNgLRliYr3g6TroPQW/T9y94cun2aDSnr6byQhKJc8bOhOZPv50CDCd83do2xmzF6J IkQPrLsOCSpSAh9+NpLT9jAFOvE9LSV/VuNdICV4Vni2vkszi7K5UaxXxIMN+tPq3JyD13U4rvzox b76yaWdQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:34566) 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 1ofMAf-0007BG-Rd; Mon, 03 Oct 2022 15:11:49 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1ofMAa-0003TT-Bg; Mon, 03 Oct 2022 15:11:44 +0100 Date: Mon, 3 Oct 2022 15:11:44 +0100 From: "Russell King (Oracle)" To: Christoph Hellwig Cc: Marek =?iso-8859-1?Q?Beh=FAn?= , 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> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20221003073037.GB2108@lst.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221003_071206_285154_9289EA7F X-CRM114-Status: GOOD ( 16.34 ) 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="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Oct 03, 2022 at 09:30:37AM +0200, Christoph Hellwig wrote: > On Fri, Sep 30, 2022 at 05:02:05PM +0200, Marek Beh=FAn wrote: > > It seems that the null pointer dereference comes from the data variable > > having zero value. We assign > > data =3D (u8 *)(uintptr_t)rx_desc->buf_cookie; > = > I never see any assignment to ->buf_cookie in the driver, what am > I missing? I think Marek's setup (like my setups) use the hardware buffer manager, and it's hardware that fills in the "buf_cookie", which is supposed to be the virtual address of the buffer. Each buffer supplied to the hardware buffer manager is supposed to contain the virtual address in the first 32-bit word in that buffer. This is done by mvneta_bm_construct(): /* In order to update buf_cookie field of RX descriptor properly, * BM hardware expects buf virtual address to be placed in the * first four bytes of mapped buffer. */ *(u32 *)buf =3D (u32)buf; immediately prior to dma_map_single(..., DMA_FROM_DEVICE) is called. If I had to guess, I would suggest that this write is being lost via cache invalidation, and given that the hardware BM both reads and writes this buffer, DMA_FROM_DEVICE is not correct, it should be DMA_BIDIRECTIONAL. Changing that is probably going to need DMA_FROM_DEVICE also changed elsewhere in the mvneta_bm and mvneta driver. I'm not in a position where I could test that out. Marek? -- = 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