lkml.org 
[lkml]   [2018]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Linux 4.19-rc1
On Mon, Aug 27, 2018 at 08:46:41AM -0700, Christoph Hellwig wrote:
> > sparc:
> >
> > WARNING: CPU: 0 PID: 1 at ./include/linux/dma-mapping.h:516 esp_sbus_probe+0x408/0x6e8
> > WARNING: CPU: 0 PID: 1 at ./include/linux/dma-mapping.h:516 sparc_lance_probe_one+0x428/0x4f
> >
> > Missing initialization of coherent_dma_mask in the respective drivers.
> >
> > ---
> > Each platform driver instantiated through a devicetree node now generates
> > the following warning:
> >
> > esp ffd38e00: DMA mask not set
> >
> > It isn't a traceback so it may fly under the radar. There is nothing the
> > drivers can do about it; the message is generated by the core before the
> > driver probe function is called. No idea what a correct fix might be.
>
> Both of these should probably be fixed by something like the patch
> below:
>
> ---
> From 6294e0e330851ee06e66ab85b348f1d92d375d7a Mon Sep 17 00:00:00 2001
> From: Christoph Hellwig <hch@lst.de>
> 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 <hch@lst.de>
> ---
> 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;

When building sparc32 images, this results in the following
error.

drivers/base/platform.c: In function 'setup_pdev_archdata':
drivers/base/platform.c:235:22: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
pdev->dev.dma_mask = &pdev->dma_mask;

pdev->dev.dma_mask is u64 *, pdev->dma_mask is dma_addr_t which in turn
is either u32 or u64 depending on the architecture.

> +++ 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;

... so this will have to be u64, or the pointer in struct device would
have to be fixed.

However, even changing the definition to u64 does not help: The warnings
are still reported. This is because setup_pdev_archdata() is not called
for any of the affected devices. That is kind of interesting since it
means that arch_setup_pdev_archdata() won't be called for those devices
either.

Guenter

\
 
 \ /
  Last update: 2018-08-27 19:13    [W:0.088 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site