Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4130574ybe; Mon, 9 Sep 2019 04:51:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVGnWVf1HnukPZ9+QczpuPdUr1Cx9UJ/aeVKLpoZFce4ZvZpqv72Ym9cgPuTZFAq/6PFKd X-Received: by 2002:a17:906:938c:: with SMTP id l12mr16553708ejx.309.1568029864344; Mon, 09 Sep 2019 04:51:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568029864; cv=none; d=google.com; s=arc-20160816; b=zgfgi0Y4fyQzqUNcA11//o4tG8zaJloWz0ysKIzmR8wqU5lnVBriFtCvbw4sV66UeA LneAH1fv8SP72c5hIngX+HF4F8BCl5WMiJQmsZeNoVxlzEjG9eG5HO3FI4kTUQvh3SPH CfPM4WaQJqz5lQjRYNXdBgp55AyMNqFVa7iC1+3kdfV4H5P80wTuogE6Crv6SHsNyqkJ v6UKmRs4pi7Xu+Om+yJYfQPV6lz8YDzpZf4CnIscRVFaoOvUdsntYTJZnSUIFZkJAsUh qLD/xx5r4BwTShLp9bjMfjUHTffsu4YVoEiv5gE0HcQZj7zr9O74K1JL/3PF8OPyWGzz lKiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gZKRqbQfpD3pAeB7I47qPKJv8LnnYQf1IfDC0sUkkZg=; b=tmX4Lrq04o7cyVSBVkhpbToYLanjQ1lLFj4ujhoJv5lyx1TusrnartKwdoMe7GJGP7 F510lVdhdvkg2HYywYuP8T7mESK2oGlGaN0GshuW9757ArzuD2mgnP/pWm4vUinpLZHl UsbBTAEdcPbz0jbjKAYYN8b4cJKM6k4eoG1cKV2SmcnxyxRBm1GxLcJ2d4SfQKjPqFtw Dgfgf7NzOW6yZT3f93bHKeumqqYJsUrTQBG/R6Q7bY/FodKDv3PPmRhsCmWTe6W9TKsW 30jT2buvgBRbwzA4STlgv+DU1TQSPqxUEOQo6Ysti4FaSbf1VynyvjTXE9CVtKWMtdTq EQfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ByJrTQ6X; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l24si4900801ejp.396.2019.09.09.04.50.40; Mon, 09 Sep 2019 04:51:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ByJrTQ6X; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732409AbfIHMu7 (ORCPT + 99 others); Sun, 8 Sep 2019 08:50:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:42128 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732388AbfIHMu4 (ORCPT ); Sun, 8 Sep 2019 08:50:56 -0400 Received: from localhost (unknown [62.28.240.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 63EB120863; Sun, 8 Sep 2019 12:50:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567947055; bh=A4ZmiyPIF1uZo86eOM9WHNPb7h48PAF4MTOpjvOFQf0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ByJrTQ6XmZdIKlk89PFKFUIXmiOpZ2kBABBvk+YMwIq3EeDjU2lgB/0bTBW0LFBfw zkVo2MVH5UFlhag9lkwTlUjgJoS5y8AXPwdmzTqb2mHSxWE10EN26GfauSlOAntUTE mRKBAZIqboJoEBa0ONgL1FZfoFnGggePQ76fd6sw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexandre Courbot , CK Hu , Sasha Levin Subject: [PATCH 5.2 43/94] drm/mediatek: use correct device to import PRIME buffers Date: Sun, 8 Sep 2019 13:41:39 +0100 Message-Id: <20190908121151.671441758@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190908121150.420989666@linuxfoundation.org> References: <20190908121150.420989666@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 4c6f3196e6ea111c456c6086dc3f57d4706b0b2d ] PRIME buffers should be imported using the DMA device. To this end, use a custom import function that mimics drm_gem_prime_import_dev(), but passes the correct device. Fixes: 119f5173628aa ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.") Signed-off-by: Alexandre Courbot Signed-off-by: CK Hu Signed-off-by: Sasha Levin --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index 95fdbd0fbcace..8b18a00a58c7e 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -320,6 +320,18 @@ static const struct file_operations mtk_drm_fops = { .compat_ioctl = drm_compat_ioctl, }; +/* + * We need to override this because the device used to import the memory is + * not dev->dev, as drm_gem_prime_import() expects. + */ +struct drm_gem_object *mtk_drm_gem_prime_import(struct drm_device *dev, + struct dma_buf *dma_buf) +{ + struct mtk_drm_private *private = dev->dev_private; + + return drm_gem_prime_import_dev(dev, dma_buf, private->dma_dev); +} + static struct drm_driver mtk_drm_driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME | DRIVER_ATOMIC, @@ -331,7 +343,7 @@ static struct drm_driver mtk_drm_driver = { .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_export = drm_gem_prime_export, - .gem_prime_import = drm_gem_prime_import, + .gem_prime_import = mtk_drm_gem_prime_import, .gem_prime_get_sg_table = mtk_gem_prime_get_sg_table, .gem_prime_import_sg_table = mtk_gem_prime_import_sg_table, .gem_prime_mmap = mtk_drm_gem_mmap_buf, -- 2.20.1