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 X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F872C43381 for ; Fri, 15 Feb 2019 14:31:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DC54821A4C for ; Fri, 15 Feb 2019 14:31:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732488AbfBOObK convert rfc822-to-8bit (ORCPT ); Fri, 15 Feb 2019 09:31:10 -0500 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:32841 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730368AbfBOObK (ORCPT ); Fri, 15 Feb 2019 09:31:10 -0500 X-Originating-IP: 90.53.137.203 Received: from localhost (alyon-652-1-306-203.w90-53.abo.wanadoo.fr [90.53.137.203]) (Authenticated sender: gregory.clement@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 7401F60004; Fri, 15 Feb 2019 14:31:07 +0000 (UTC) From: Gregory CLEMENT To: Russell King , Thomas Petazzoni Cc: "David S. Miller" , netdev@vger.kernel.org Subject: Re: [PATCH] net: marvell: mvneta: fix DMA debug warning In-Reply-To: References: Date: Fri, 15 Feb 2019 15:31:06 +0100 Message-ID: <87zhqx2ket.fsf@FE-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi Russell, On ven., févr. 15 2019, Russell King wrote: > Booting 4.20 on SolidRun Clearfog issues this warning with DMA API > debug enabled: > > WARNING: CPU: 0 PID: 555 at kernel/dma/debug.c:1230 check_sync+0x514/0x5bc > mvneta f1070000.ethernet: DMA-API: device driver tries to sync DMA memory it has not allocated [device address=0x000000002dd7dc00] [size=240 bytes] > Modules linked in: ahci mv88e6xxx dsa_core xhci_plat_hcd xhci_hcd devlink armada_thermal marvell_cesa des_generic ehci_orion phy_armada38x_comphy mcp3021 spi_orion evbug sfp mdio_i2c ip_tables x_tables > CPU: 0 PID: 555 Comm: bridge-network- Not tainted 4.20.0+ #291 > Hardware name: Marvell Armada 380/385 (Device Tree) > [] (unwind_backtrace) from [] (show_stack+0x10/0x14) > [] (show_stack) from [] (dump_stack+0x9c/0xd4) > [] (dump_stack) from [] (__warn+0xf8/0x124) > [] (__warn) from [] (warn_slowpath_fmt+0x38/0x48) > [] (warn_slowpath_fmt) from [] (check_sync+0x514/0x5bc) > [] (check_sync) from [] (debug_dma_sync_single_range_for_cpu+0x6c/0x74) > [] (debug_dma_sync_single_range_for_cpu) from [] (mvneta_poll+0x298/0xf58) > [] (mvneta_poll) from [] (net_rx_action+0x128/0x424) > [] (net_rx_action) from [] (__do_softirq+0xf0/0x540) > [] (__do_softirq) from [] (irq_exit+0x124/0x144) > [] (irq_exit) from [] (__handle_domain_irq+0x58/0xb0) > [] (__handle_domain_irq) from [] (gic_handle_irq+0x48/0x98) > [] (gic_handle_irq) from [] (__irq_svc+0x70/0x98) > ... > > This appears to be caused by mvneta_rx_hwbm() calling > dma_sync_single_range_for_cpu() with the wrong struct device pointer, > as the buffer manager device pointer is used to map and unmap the > buffer. Fix this. > For me it makes sens to associate the DMA buffer to the HWBM, so this fixes looks good for me. Reviwed-by: Gregory CLEMENT Thanks, Gregory > Signed-off-by: Russell King > --- > Please check that this is the correct fix. > > drivers/net/ethernet/marvell/mvneta.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c > index ef0a85bbc586..0e1f87fca952 100644 > --- a/drivers/net/ethernet/marvell/mvneta.c > +++ b/drivers/net/ethernet/marvell/mvneta.c > @@ -2086,7 +2086,7 @@ static int mvneta_rx_hwbm(struct napi_struct *napi, > if (unlikely(!skb)) > goto err_drop_frame_ret_pool; > > - dma_sync_single_range_for_cpu(dev->dev.parent, > + dma_sync_single_range_for_cpu(&pp->bm_priv->pdev->dev, > rx_desc->buf_phys_addr, > MVNETA_MH_SIZE + NET_SKB_PAD, > rx_bytes, > -- > 2.7.4 > -- Gregory Clement, Bootlin Embedded Linux and Kernel engineering http://bootlin.com