From patchwork Tue Nov 14 12:13:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 10057451 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5ABBB60231 for ; Tue, 14 Nov 2017 12:14:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 228EE29743 for ; Tue, 14 Nov 2017 12:14:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 16F542974B; Tue, 14 Nov 2017 12:14:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AD84429743 for ; Tue, 14 Nov 2017 12:14:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 07E7A6E8E3; Tue, 14 Nov 2017 12:14:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2ABDC89E69; Tue, 14 Nov 2017 12:14:01 +0000 (UTC) Received: by mail-wr0-x243.google.com with SMTP id u97so17334882wrc.1; Tue, 14 Nov 2017 04:14:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=VI1ypEa3yBZUk9HrQZhP1GLbBrbGRknOlRZK41PlJe4=; b=Lo6VcUPf4+LOk0mAhGXtMNJBuHvN3DnPQFBaqodneNQMuPcr4LP/lQheZmJtLHuX2i kIeSAW0KwnbEcPYz2tzo784AFYbT5rQ7O0JrUemL08WILgSqKHXJwo4xkzwSBlDkhYGU DYnnTvDnmiLGeUnqWXiTI9g4fTc6+rbXd+2wD55Mb7H25sn4RSst3joxXxcLqkCk7/2m /qF7XswVJfJSSCS+4iGGxjO0ed9BZicH5uaqfVjnCXLAX3ewKUshRsorNnHrSeawQIZl dDmsBjK89Pi4aO7clPspF5RANH9CLsZIPkifzfkq8YdzGApVLWl27qVndD6EaGdohqci Uumw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=VI1ypEa3yBZUk9HrQZhP1GLbBrbGRknOlRZK41PlJe4=; b=YmZDE1cJa3dg/Xg3KxR6idBa4WGB/3AH5bFQ0T0ZNWTb8OqNNRcDOZa5gkMXgj4vZ0 V/Ruhlk3rHQfsyb/3jRJGCggGu0iH3kMLaz0SzeB0SLq8ENkAa5UJy/o1EYR+g2L/Fc/ zHLkKGgo51FrLqGMG+lDPigdbVRAjf+wrL9/4IXJgzSkjtVlrv0b3Ck7IYrQhUvrPaw/ maeHSwYQbkD/hn2uXYNZrctptfcvnpcKPhR4k8xfrzSr4xM154/nxQofvDYEhAtfvQb3 a3D9OlYVF2Rcz0qh3nUdh3hSXM631wsQZqyNcZJvUadTjuWK3iZld+mTPCJul/UrkMIp MZFA== X-Gm-Message-State: AJaThX4VcJRJSnQWii68A/FIcLYlFgRbJgp+3Sm3RSYRgk2K67YuZPMY bu0zfBbEC6e3MDEu7oMLGvGfSg== X-Google-Smtp-Source: AGs4zMbpQPVqtMUJoQm4j7EkP4gMHhS0AjvUCxqK6yvHzvLMySCUk1vYNYdZobrlN8RoIUnmsBcX3w== X-Received: by 10.223.144.71 with SMTP id h65mr10323024wrh.41.1510661639670; Tue, 14 Nov 2017 04:13:59 -0800 (PST) Received: from localhost.localdomain ([2a02:908:1251:7981:b0e4:40a4:7fb3:2c20]) by smtp.gmail.com with ESMTPSA id o11sm12302319wrg.5.2017.11.14.04.13.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Nov 2017 04:13:58 -0800 (PST) From: "=?UTF-8?q?Christian=20K=C3=B6nig?=" X-Google-Original-From: =?UTF-8?q?Christian=20K=C3=B6nig?= To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Subject: [PATCH] drm/amdgpu: set f_mapping on exported DMA-bufs Date: Tue, 14 Nov 2017 13:13:56 +0100 Message-Id: <20171114121356.3356-1-christian.koenig@amd.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Otherwise we can't correctly CPU map TTM buffers. Signed-off-by: Christian König Acked-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c index 90af8e82b16a..ae9c106979d7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c @@ -169,10 +169,14 @@ struct dma_buf *amdgpu_gem_prime_export(struct drm_device *dev, int flags) { struct amdgpu_bo *bo = gem_to_amdgpu_bo(gobj); + struct dma_buf *buf; if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm) || bo->flags & AMDGPU_GEM_CREATE_VM_ALWAYS_VALID) return ERR_PTR(-EPERM); - return drm_gem_prime_export(dev, gobj, flags); + buf = drm_gem_prime_export(dev, gobj, flags); + if (!IS_ERR(buf)) + buf->file->f_mapping = dev->anon_inode->i_mapping; + return buf; }