From patchwork Wed Apr 8 19:07:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 185280 Delivered-To: patch@linaro.org Received: by 2002:a92:de47:0:0:0:0:0 with SMTP id e7csp926254ilr; Wed, 8 Apr 2020 12:13:11 -0700 (PDT) X-Google-Smtp-Source: APiQypIhdFLWSIjw7rwJTL52eakpxit5o8KHEFd7jQnqyuj/XhAe1zptR8PXaKHDYXdqxq3vq+J5 X-Received: by 2002:a63:b447:: with SMTP id n7mr8059985pgu.278.1586373191479; Wed, 08 Apr 2020 12:13:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586373191; cv=none; d=google.com; s=arc-20160816; b=mO7TfDQFnS1ujMmfv/10avC9M8rbXkBWlXCC2VCIcf2qcrjgFRXduDVPG9wR5eWD2B ol58inMpCXDBMYMl8enabNV+f6aJ/eTDgGJV3M4DVZyGilXD0IIhSu5QM9bE1oEwkTur 7r/kfqv8+rMAQyZmQZhMzMOIf4AJhIAq4w6d0leBGWIJj69ymGEYgg7K/AebNc67swFG AMo4GDoaJajvFfu51exv3U4YqiZueD/rthPjuVTb3+1unsUI9mRz1Qf1J5RxW4Hp4nQe GafrKQI7ohcW13l8KYbeWYy0qy6BpnWR7C1cRQTD8cLo8kUxHkiSt5WZl2P/eBX5cIYj t2rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:message-id:date:subject:to:from :delivered-to; bh=7Dzz1Zus4Rsfpad+g98QLzUs4F1ZGIirC9yv+tKsr9w=; b=IOUVIy8CraJpuKg3zGSVv+puRlTbw2HFfmbaSzpeEAUHTc+t17t7idsnnbHJK3FY3o n7jEmGjge6/hcAoJfvdVlpNA7KEJCsh0Z0L93RNRNxmsdUTt/+T1HyxYVCLMSYrKe00H 0acP25uVOH0Evtbve3V5hlDYJC0DYl7uQTjbBnMbmGlkCE7/GJPkNDLi06VTj52gQsfa xR3L/NMXIJmD4DJY4ASZCBUIUmusfje9mkxMf2edRNa3B4JyJE/jxal/J68Vhn5kdxXC gCjI+TY/hlgf5Vs/HHT6nJVuNvYD/F0ADjETT2VUCY5s3v1UBVkKCxMN4CJxLocYbwQc g8nw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id o15si302370pjq.103.2020.04.08.12.13.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Apr 2020 12:13:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 30F416EAB8; Wed, 8 Apr 2020 19:13:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.74]) by gabe.freedesktop.org (Postfix) with ESMTPS id DF2B56E02E for ; Wed, 8 Apr 2020 19:13:05 +0000 (UTC) Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1MybX9-1j6Gzx3Zgz-00z1aQ; Wed, 08 Apr 2020 21:12:28 +0200 From: Arnd Bergmann To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Subject: [PATCH] drm: work around dma_addr_t/resource_size_t mixup warning Date: Wed, 8 Apr 2020 21:07:05 +0200 Message-Id: <20200408191224.947302-1-arnd@arndb.de> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:DVSM1LIbfhMXWme1EElCj+8pny765s3sA/2Gb86UfuGGhZJ6d22 ZLfY/aoBnETxdQe3tl80wWrA9EH52Nrzodw33eV2E5IjGmEvuuTfZ//0NcKB1v0Mmb7nN4Z Kg9uEcr2deFJ7CA8RDRNyzjOTqTPl6ecd68O6CQsSx8ZRbV+4M+8oAKlbdQsu2czskwZYza pvt9mDYF+wn6rtouoQphg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:66Qguc75blI=:teWWSWuMOiL9cYz8XdHo0F uxSaU1XYvL+4VfYNLWX6pg/PYV7tKUQ29ZOpbbdetFx3X+wqQauNkNixr7eWupCwniohAdsZS BXK8/w5/IMsCzsS1saiCcF4WoLwYVeZM4aliuNmqOK8ByQVeRbI8EP5piYFV89hoikNbj6x75 GP//GYKJxRw2gVyWX6NwD5vj+tRU+E40YafWzl+KpepxecQOP0fkB1elrZzLUKD0zXO5RaTHN yj0Y9rr23gARxJsJF7fTJ+GPuObkozhZlMBnH9pRQaQBkP/kWZAVdsrWAQdXw8pBcAWeOnuFc E9Yz2CksQcCdbAUGRMdsJmX018f9Hqah6Q8jpqToc8H1zQjEsjFJPfj/JLSo8elt2aU7y5HfY xCT0ik4rdI3Y46MHi1nB0Zrc8qZIa2YN1KtJlmT1ZhGjbL37+eCGnmDaLKEpQa6VK4zSr9rOW FCHk9YZ1w8KZBb7JNh9aY6EyO8+BmCfqGH6yIQ8wpbpAWQPj8/y3RCHx7+UYOIOaobwQuV+RA iKLQ4a0n7Xyd5aqD6POGqgpxorwQ+lGh6t0qZ3bgk9aDDZKwM1LFXNcRy2F8/d0XS4psdZQno RoITjbLEUIFCX94D/vasDn3inMVfGCHnIWKV5nh6j9T5eSN3tHI1lsITlZw7r51w78rqyNqxy LpPKLyPLDdBjTCZCz0u8kgXa/RiMoo48xYfcd+5f2uVX7GZQ+aTroZcrfDJjO+KYlqHhrF9Fk wWUaXXuZmH0/dBZnDqCxaRfaAwCBEm0oSorEGafd5a+0pLV87DjM85awFTbr6+py+q4jAeeGz M/mOs+V9Fk6h37rJ/mp1s+XaIT7YAaNcrNgxn6UOZ1nDQ7DU0Q= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Benjamin Gaignard , Arnd Bergmann , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Chris Wilson , Sean Paul , Alex Deucher , Dave Airlie , Sam Ravnborg , Dan Carpenter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On configurations with 64-bit dma_addr_t but 32-bit resource_size_t, there is now a warning: 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) | ~~~~~~~~~~~~^~~~~~~~~~ I have no idea if this is safe on targets that may need a high DMA address, or why we store a DMA address token in a resource_size_t in the first place, but using a temporary variable avoids the warning. Fixes: 8e4ff9b56957 ("drm: Remove the dma_alloc_coherent wrapper for internal usage") Signed-off-by: Arnd Bergmann --- drivers/gpu/drm/drm_bufs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.26.0 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index dcabf5698333..0fbe65c62f1e 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -149,6 +149,7 @@ static int drm_addmap_core(struct drm_device *dev, resource_size_t offset, { struct drm_local_map *map; struct drm_map_list *list; + dma_addr_t dma_addr; unsigned long user_token; int ret; @@ -325,8 +326,9 @@ 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, GFP_KERNEL); + map->offset = (resource_size_t)dma_addr; if (!map->handle) { kfree(map); return -ENOMEM;