From patchwork Mon Nov 9 10:32:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 11890921 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CCE9C16C1 for ; Mon, 9 Nov 2020 10:34:19 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A2994206B2 for ; Mon, 9 Nov 2020 10:34:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A2994206B2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.22326.48607 (Exim 4.92) (envelope-from ) id 1kc4Tm-0007GV-2w; Mon, 09 Nov 2020 10:32:54 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 22326.48607; Mon, 09 Nov 2020 10:32:54 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kc4Tl-0007GO-Ub; Mon, 09 Nov 2020 10:32:53 +0000 Received: by outflank-mailman (input) for mailman id 22326; Mon, 09 Nov 2020 10:32:52 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kc4Tk-0007FI-9g for xen-devel@lists.xenproject.org; Mon, 09 Nov 2020 10:32:52 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d83c79b1-074a-4775-97b5-b1d801e6f370; Mon, 09 Nov 2020 10:32:51 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2DD92AF2F; Mon, 9 Nov 2020 10:32:50 +0000 (UTC) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kc4Tk-0007FI-9g for xen-devel@lists.xenproject.org; Mon, 09 Nov 2020 10:32:52 +0000 X-Inumbo-ID: d83c79b1-074a-4775-97b5-b1d801e6f370 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id d83c79b1-074a-4775-97b5-b1d801e6f370; Mon, 09 Nov 2020 10:32:51 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2DD92AF2F; Mon, 9 Nov 2020 10:32:50 +0000 (UTC) From: Thomas Zimmermann To: daniel@ffwll.ch, airlied@linux.ie, chunkuang.hu@kernel.org, p.zabel@pengutronix.de, robdclark@gmail.com, sean@poorly.run Cc: linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Thomas Zimmermann , =?utf-8?q?Christian_K=C3=B6nig?= , Maarten Lankhorst , Maxime Ripard , Dave Airlie , Lucas Stach , Russell King , Christian Gmeiner , Qiang Yu , Ben Skeggs , Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Gerd Hoffmann , Alex Deucher , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Hans de Goede , Eric Anholt , Rodrigo Siqueira , Melissa Wen , Haneen Mohammed , Oleksandr Andrushchenko , Sumit Semwal , Emil Velikov , Marek Szyprowski , Arunpravin , Huang Rui , Luben Tuikov , Madhav Chauhan , Nirmoy Das , Jason Gunthorpe , Sam Ravnborg , Chris Wilson , etnaviv@lists.freedesktop.org, lima@lists.freedesktop.org, nouveau@lists.freedesktop.org, virtualization@lists.linux-foundation.org, spice-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, xen-devel@lists.xenproject.org Subject: [PATCH 2/2] drm/mediatek: Use struct dma_buf_map in GEM vmap ops Date: Mon, 9 Nov 2020 11:32:42 +0100 Message-Id: <20201109103242.19544-3-tzimmermann@suse.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109103242.19544-1-tzimmermann@suse.de> References: <20201109103242.19544-1-tzimmermann@suse.de> MIME-Version: 1.0 Fixes a build failure with mediatek. This change was supposed to be part of commit 49a3f51dfeee ("drm/gem: Use struct dma_buf_map in GEM vmap ops and convert GEM backends"), but mediatek was forgotten. Signed-off-by: Thomas Zimmermann Fixes: 49a3f51dfeee ("drm/gem: Use struct dma_buf_map in GEM vmap ops and convert GEM backends") Cc: Thomas Zimmermann Cc: Christian König Cc: David Airlie Cc: Daniel Vetter Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Dave Airlie Cc: Lucas Stach Cc: Russell King Cc: Christian Gmeiner Cc: Qiang Yu Cc: Ben Skeggs Cc: Rob Herring Cc: Tomeu Vizoso Cc: Steven Price Cc: Alyssa Rosenzweig Cc: Gerd Hoffmann Cc: Alex Deucher Cc: "Christian König" Cc: Sandy Huang Cc: "Heiko Stübner" Cc: Hans de Goede Cc: Sean Paul Cc: Eric Anholt Cc: Rodrigo Siqueira Cc: Melissa Wen Cc: Haneen Mohammed Cc: Oleksandr Andrushchenko Cc: Sumit Semwal Cc: Emil Velikov Cc: Marek Szyprowski Cc: Arunpravin Cc: Huang Rui Cc: Luben Tuikov Cc: Madhav Chauhan Cc: Nirmoy Das Cc: Jason Gunthorpe Cc: Sam Ravnborg Cc: Chris Wilson Cc: dri-devel@lists.freedesktop.org Cc: etnaviv@lists.freedesktop.org Cc: lima@lists.freedesktop.org Cc: nouveau@lists.freedesktop.org Cc: virtualization@lists.linux-foundation.org Cc: spice-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-rockchip@lists.infradead.org Cc: xen-devel@lists.xenproject.org Acked-by: Chun-Kuang Hu --- drivers/gpu/drm/mediatek/mtk_drm_gem.c | 20 ++++++++++++-------- drivers/gpu/drm/mediatek/mtk_drm_gem.h | 4 ++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.c b/drivers/gpu/drm/mediatek/mtk_drm_gem.c index cdd1a6e61564..28a2ee1336ef 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.c @@ -240,23 +240,25 @@ struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev, return &mtk_gem->base; } -void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj) +int mtk_drm_gem_prime_vmap(struct drm_gem_object *obj, struct dma_buf_map *map) { struct mtk_drm_gem_obj *mtk_gem = to_mtk_gem_obj(obj); - struct sg_table *sgt; + struct sg_table *sgt = NULL; unsigned int npages; if (mtk_gem->kvaddr) - return mtk_gem->kvaddr; + goto out; sgt = mtk_gem_prime_get_sg_table(obj); if (IS_ERR(sgt)) - return NULL; + return PTR_ERR(sgt); npages = obj->size >> PAGE_SHIFT; mtk_gem->pages = kcalloc(npages, sizeof(*mtk_gem->pages), GFP_KERNEL); - if (!mtk_gem->pages) - goto out; + if (!mtk_gem->pages) { + kfree(sgt); + return -ENOMEM; + } drm_prime_sg_to_page_addr_arrays(sgt, mtk_gem->pages, NULL, npages); @@ -265,13 +267,15 @@ void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj) out: kfree(sgt); + dma_buf_map_set_vaddr(map, mtk_gem->kvaddr); - return mtk_gem->kvaddr; + return 0; } -void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr) +void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, struct dma_buf_map *map) { struct mtk_drm_gem_obj *mtk_gem = to_mtk_gem_obj(obj); + void *vaddr = map->vaddr; if (!mtk_gem->pages) return; diff --git a/drivers/gpu/drm/mediatek/mtk_drm_gem.h b/drivers/gpu/drm/mediatek/mtk_drm_gem.h index ff9f976d9807..6da5ccb4b933 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_gem.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_gem.h @@ -45,7 +45,7 @@ int mtk_drm_gem_mmap_buf(struct drm_gem_object *obj, struct sg_table *mtk_gem_prime_get_sg_table(struct drm_gem_object *obj); struct drm_gem_object *mtk_gem_prime_import_sg_table(struct drm_device *dev, struct dma_buf_attachment *attach, struct sg_table *sg); -void *mtk_drm_gem_prime_vmap(struct drm_gem_object *obj); -void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); +int mtk_drm_gem_prime_vmap(struct drm_gem_object *obj, struct dma_buf_map *map); +void mtk_drm_gem_prime_vunmap(struct drm_gem_object *obj, struct dma_buf_map *map); #endif