Re: [git pull] drm for 5.7-rc1

From: Nathan Chancellor
Date: Thu Apr 02 2020 - 16:33:22 EST


On Wed, Apr 01, 2020 at 03:50:42PM +1000, Dave Airlie wrote:
> Hey Linus,
>
> This is the main drm pull request for 5.7-rc1.
>
> Writing the changelog seemed a bit quieter, but it looks about average.
>
> I've got a separate merge for some VM interactions for TTM huge pages, but I'll
> send that once this is landed.
>
> It didn't seem to have many major conflicts, but my git trees have a bad habit
> of finding the shared rerere cache and lulling me into thinking it merged fine.
>
> Highlights:
> i915 enables Tigerlake by default
> i915 and amdgpu have initial OLED backlight support
> vmwgfx add support to enable OpenGL 4 userspace
> zero length arrays are mostly removed.
>
> Regards,
> Dave.

<snip>

> drm: Remove the dma_alloc_coherent wrapper for internal usage

This patch causes a build regression on arm32 in certain configurations
(I found it with Debian's armmp config).

$ printf 'CONFIG_XEN=y\nCONFIG_DRM_LEGACY=y\n' >> arch/arm/configs/multi_v7_defconfig

$ make -j$(nproc) -s ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- defconfig drivers/gpu/drm/drm_bufs.o
drivers/gpu/drm/drm_bufs.c: In function 'drm_addmap_core':
drivers/gpu/drm/drm_bufs.c:328:8: error: passing argument 3 of 'dma_alloc_coherent' from incompatible pointer type [-Werror=incompatible-pointer-types]
328 | &map->offset,
| ^~~~~~~~~~~~
| |
| resource_size_t * {aka unsigned int *}
In file included from ./include/linux/pci-dma-compat.h:8,
from ./include/linux/pci.h:2392,
from ./include/drm/drm_pci.h:35,
from drivers/gpu/drm/drm_bufs.c:46:
./include/linux/dma-mapping.h:642:15: note: expected 'dma_addr_t *' {aka 'long long unsigned int *'} but argument is of type 'resource_size_t *' {aka 'unsigned int *'}
642 | dma_addr_t *dma_handle, gfp_t gfp)
| ~~~~~~~~~~~~^~~~~~~~~~
cc1: some warnings being treated as errors
make[4]: *** [scripts/Makefile.build:268: drivers/gpu/drm/drm_bufs.o] Error 1
make[3]: *** [scripts/Makefile.build:505: drivers/gpu/drm] Error 2
make[2]: *** [scripts/Makefile.build:505: drivers/gpu] Error 2
make[1]: *** [Makefile:1703: drivers] Error 2
make: *** [Makefile:328: __build_one_by_one] Error 2

This fixes it but I am not sure if it is proper or not (could be
problematic if CONFIG_PHYS_ADDR_T_64BIT is set but
CONFIG_ARCH_DMA_ADDR_T_64BIT is not, not sure if that is possible) so I
figured I'd report it and let you guys deal with it.

Cheers,
Nathan

diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index dcabf5698333..9282fd075424 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -325,7 +325,7 @@ static int drm_addmap_core(struct drm_device *dev, resource_size_t offset,
* need to point to a 64bit variable first. */
map->handle = dma_alloc_coherent(&dev->pdev->dev,
map->size,
- &map->offset,
+ (dma_addr_t *)&map->offset,
GFP_KERNEL);
if (!map->handle) {
kfree(map);