lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7fff8fd3-16ae-1f42-fcd6-9aa360fe36b5@ti.com>
Date:   Fri, 9 Aug 2019 09:40:32 +0300
From:   Tomi Valkeinen <tomi.valkeinen@...com>
To:     Christoph Hellwig <hch@....de>
CC:     <airlied@...ux.ie>, <daniel@...ll.ch>,
        <dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
        "H. Nikolaus Schaller" <hns@...delico.com>,
        Tony Lindgren <tony@...mide.com>,
        Peter Ujfalusi <peter.ujfalusi@...com>
Subject: Re: [PATCH for-5.3] drm/omap: ensure we have a valid dma_mask

Hi,

On 08/08/2019 13:10, Christoph Hellwig wrote:
> The omapfb platform devices does not have a DMA mask set.  The
> traditional arm DMA code ignores, but the generic dma-direct/swiotlb
> has stricter checks and thus fails mappings without a DMA mask.
> As we use swiotlb for arm with LPAE now, omap needs to catch up
> and actually set a DMA mask.
> 
> Fixes: ad3c7b18c5b3 ("arm: use swiotlb for bounce buffering on LPAE configs")
> Reported-by: "H. Nikolaus Schaller" <hns@...delico.com>
> Tested-by: "H. Nikolaus Schaller" <hns@...delico.com>
> Signed-off-by: Christoph Hellwig <hch@....de>
> ---
>   drivers/gpu/drm/omapdrm/omap_fbdev.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> index 561c4812545b..2c8abf07e617 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
> @@ -232,6 +232,8 @@ void omap_fbdev_init(struct drm_device *dev)
>   	if (!priv->num_pipes)
>   		return;
>   
> +	dma_coerce_mask_and_coherent(dev->dev, DMA_BIT_MASK(32));
> +
>   	fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL);
>   	if (!fbdev)
>   		goto fail;
> 

We do call dma_set_coherent_mask() in omapdrm's probe() (in omap_drv.c), 
but apparently that's not enough anymore. Changing that call to 
dma_coerce_mask_and_coherent() removes the WARN. I can create a patch 
for that, or Christoph can respin this one.

I am not too familiar with the dma mask handling, so maybe someone can 
educate:

dma_coerce_mask_and_coherent() overwrites dev->dma_mask. Isn't that a 
bad thing? What if the platform has set dev->dma_mask, and the driver 
overwrites it with its value? Or who is supposed to set dev->dma_mask?

  Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ