Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp731263imm; Sat, 1 Sep 2018 19:14:13 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYSkWl2gH7TOrsi9fU1+/1qrQKIGOrrypMQQCJwsGR0Y9wJrMVw2j4Bqf3OqxKpqdq22hYX X-Received: by 2002:a17:902:4906:: with SMTP id u6-v6mr21902804pld.44.1535854453770; Sat, 01 Sep 2018 19:14:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535854453; cv=none; d=google.com; s=arc-20160816; b=jogpkOiG0SpAV3i1HNP+0ymvDI+jYhOXUE4A8NM913nIJTIibkw/BfmhsWjb9xVtih hcXyDsAwbmLrrXnwSantCjquYLrvQZJWmZdyg+eDYBDaCKYxu4kt5U/yDWeSTy/jnB54 b9lapRzQxcAHH7xxvjEexm9pmyYl2M+EZGW++I6zTZFNCsDit8cqA4Mmd+mUF27yIJFH SM0sCFEkJQV4pgyx4y1zfZfwb9BA2WdTCbcijMdtGwx6PZcJ/+Hh/2q4H/OoSy17x71z sH9/oYNIullckHu2MD1z6HESWBGEyyNM09J2LtDtv3XjI3aPcjivr3aWSOdGAJSEwL78 K4Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=KbvrYNnUVsmHKIRzR7B3wBX4UTF3yKUXd9r3H5r1poA=; b=fNmLIIBZdjQsWI++HXGY/R1ZFMU/OPiyz/O+OvkVTUo/Z4809rld3h9H0y+zAWsVXZ 3GBDPx35sK4FibJcZmE+SP2ebAoHqOct+uy9hG8Q2G5zc4k5lq/45SDzMKZbuTPV6bgG iVYwxDnD+EsaFZxnfg1ewTDsu5gwhDMSeWFuzC13cba1qAC9Fmdzi7zQYV79CTJ6/MVg dZZKhdUfeCsKnSdL5xAmVsDseZ0qkOSplDpbt6NjN5nojAyEDQrxWyjiiiJZVRfLkADF 5PqXUPSCwefxXvZ/a8MuZJCfhTYkKbgWMyinBKBjeEV8uXvf/+qzlfUNIfwBk1U6zqtL qr/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fbv3c7WI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t7-v6si14202459pgh.307.2018.09.01.19.13.34; Sat, 01 Sep 2018 19:14:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fbv3c7WI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726014AbeIBGYh (ORCPT + 99 others); Sun, 2 Sep 2018 02:24:37 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:38667 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725790AbeIBGYh (ORCPT ); Sun, 2 Sep 2018 02:24:37 -0400 Received: by mail-oi0-f67.google.com with SMTP id x197-v6so28177856oix.5 for ; Sat, 01 Sep 2018 19:10:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=KbvrYNnUVsmHKIRzR7B3wBX4UTF3yKUXd9r3H5r1poA=; b=fbv3c7WIzO2p1qvpcJDs7yHj8rrewwqNafyb+rZnlhFYzEEw7g7gRYfIQuwGT8JUar Zi5hg8NQ7S7YCXt38rnNANrm9ms540SMdfUg6NU+zq5fFBiRaXL+Kok+R+Ik2cnei8qs +UY5GWA1LRaW2GWtoNPIX+GPs4vKnUc54/lw0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=KbvrYNnUVsmHKIRzR7B3wBX4UTF3yKUXd9r3H5r1poA=; b=ZvtE/7CkjM56U6JaVkorAW2ExqEzCVy5Te2H3W5klYB1DjTHoS2LD0Cv0w5ZX73iLb ZrsrIw6MVmj48lUny70jHSEQL/zwj9SjEIwttWE+NiYrL/DucWpYTE6fv4PfpM1QQrSV U2eS68Y6zgBOMJ6SZ2SGNoPRY8wA3NcN6upy4w+o4mkch7NNxmb/bds1oaJZSGS3n5s4 1iVidz/R5jzxDWNtObNwa/GmcvvHewOVonEiv40TvW9yqZW0/lDpC8ct06XspDHrKWzz fyR9kxR5qyVoJj8JNqVa2VIyZSH/ZXD/x39/EW+VlhoRii+EyRmr8GMCA56JcEFjE9Xw vTww== X-Gm-Message-State: APzg51AIm3tKa9GlxUKqka7re8QRLmrp/BZarQmCTUztYfkCgp44LgOr znALP/kTXm7rG3Lo0xJ59a1g5Q== X-Received: by 2002:aca:d9c5:: with SMTP id q188-v6mr14490656oig.239.1535854237993; Sat, 01 Sep 2018 19:10:37 -0700 (PDT) Received: from localhost (68-248-140-212.lightspeed.austtx.sbcglobal.net. [68.248.140.212]) by smtp.gmail.com with ESMTPSA id k85-v6sm30577194oiy.2.2018.09.01.19.10.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 01 Sep 2018 19:10:37 -0700 (PDT) Date: Sat, 1 Sep 2018 21:10:36 -0500 From: Brian Brooks To: Christoph Hellwig Cc: David Miller , antoine.tenart@bootlin.com, maxime.chevallier@bootlin.com, ymarkman@marvell.com, stefanc@marvell.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bjorn.topel@intel.com, brian.brooks@arm.com Subject: Re: [PATCH] net: mvpp2: avoid bouncing buffers Message-ID: <20180902021036.nyxcphdi3i5mgkjs@i7-8700> References: <20180820024730.9147-1-brian.brooks@linaro.org> <20180819.195505.1988137313680465320.davem@davemloft.net> <20180820062326.GA22222@infradead.org> <20180827135524.fv4mxkwjn5bv7p5e@di3> <20180827154843.GA25821@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180827154843.GA25821@infradead.org> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/27 08:48:43, Christoph Hellwig wrote: > WE should basically never have dev->dma_mask = &dev->coherent_dma_mask, > so until that is the case you are doctoring around the symptoms and > not the problem. > > Does the patch below help your case? Yes. Just tested it. Works great. I see how this patch addresses the issue in the platform code instead of the driver code. Thanks. > ---- > From 6294e0e330851ee06e66ab85b348f1d92d375d7a Mon Sep 17 00:00:00 2001 > From: Christoph Hellwig > Date: Mon, 27 Aug 2018 17:23:24 +0200 > Subject: driver core: initialize a default DMA mask for platform device > > We still treat devices without a DMA mask as defaulting to 32-bits for > both mask, but a few releases ago we've started warning about such > cases, as they require special cases to work around this sloppyness. > Add a dma_mask field to struct platform_object so that we can initialize > the dma_mask pointer in struct device and initialize both masks to > 32-bits by default. Architectures can still override this in > arch_setup_pdev_archdata if needed. > > Note that the code looks a little odd with the various conditionals > because we have to support platform_device structures that are > statically allocated. > > Signed-off-by: Christoph Hellwig > --- > drivers/base/platform.c | 15 +++++++++++++-- > include/linux/platform_device.h | 1 + > 2 files changed, 14 insertions(+), 2 deletions(-) > > diff --git a/drivers/base/platform.c b/drivers/base/platform.c > index dff82a3c2caa..baf4b06cf2d9 100644 > --- a/drivers/base/platform.c > +++ b/drivers/base/platform.c > @@ -225,6 +225,17 @@ struct platform_object { > char name[]; > }; > > +static void setup_pdev_archdata(struct platform_device *pdev) > +{ > + if (!pdev->dev.coherent_dma_mask) > + pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); > + if (!pdev->dma_mask) > + pdev->dma_mask = DMA_BIT_MASK(32); > + if (!pdev->dev.dma_mask) > + pdev->dev.dma_mask = &pdev->dma_mask; > + arch_setup_pdev_archdata(pdev); > +}; > + > /** > * platform_device_put - destroy a platform device > * @pdev: platform device to free > @@ -271,7 +282,7 @@ struct platform_device *platform_device_alloc(const char *name, int id) > pa->pdev.id = id; > device_initialize(&pa->pdev.dev); > pa->pdev.dev.release = platform_device_release; > - arch_setup_pdev_archdata(&pa->pdev); > + setup_pdev_archdata(&pa->pdev); > } > > return pa ? &pa->pdev : NULL; > @@ -472,7 +483,7 @@ EXPORT_SYMBOL_GPL(platform_device_del); > int platform_device_register(struct platform_device *pdev) > { > device_initialize(&pdev->dev); > - arch_setup_pdev_archdata(pdev); > + setup_pdev_archdata(pdev); > return platform_device_add(pdev); > } > EXPORT_SYMBOL_GPL(platform_device_register); > diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h > index 1a9f38f27f65..d84ec1de6022 100644 > --- a/include/linux/platform_device.h > +++ b/include/linux/platform_device.h > @@ -25,6 +25,7 @@ struct platform_device { > int id; > bool id_auto; > struct device dev; > + dma_addr_t dma_mask; Hmm.. should struct device use dma_addr_t instead of u64 for masks too? > u32 num_resources; > struct resource *resource; > > -- > 2.18.0 >