From patchwork Tue Sep 25 16:16:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 10614389 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3826E13A4 for ; Tue, 25 Sep 2018 16:16:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2758B2978C for ; Tue, 25 Sep 2018 16:16:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1BEA6298A7; Tue, 25 Sep 2018 16:16:24 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 CFB312978C for ; Tue, 25 Sep 2018 16:16:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 69FCF6E3B4; Tue, 25 Sep 2018 16:16:17 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by gabe.freedesktop.org (Postfix) with ESMTPS id CFBEB6E3B4 for ; Tue, 25 Sep 2018 16:16:15 +0000 (UTC) Received: from ezexps.par1.mozilla.com (unknown [IPv6:2a00:8c40:243:232:20d1:1683:13e1:7cd]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: ezequiel) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 7CCDC27DB3E; Tue, 25 Sep 2018 17:16:14 +0100 (BST) From: Ezequiel Garcia To: dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org Subject: [PATCH 1/3] virtio: Add virtio_gpu_object_kunmap() Date: Tue, 25 Sep 2018 18:16:04 +0200 Message-Id: <20180925161606.17980-2-ezequiel@collabora.com> X-Mailer: git-send-email 2.19.0.rc2 In-Reply-To: <20180925161606.17980-1-ezequiel@collabora.com> References: <20180925161606.17980-1-ezequiel@collabora.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Ezequiel Garcia , Gerd Hoffmann Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Implement a virtio_gpu_object_kunmap() to unmap the kernel mapping, and use it in the TTM object destroy path. Signed-off-by: Ezequiel Garcia --- drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + drivers/gpu/drm/virtio/virtgpu_object.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h b/drivers/gpu/drm/virtio/virtgpu_drv.h index 2de29c90bed2..a8af46570a01 100644 --- a/drivers/gpu/drm/virtio/virtgpu_drv.h +++ b/drivers/gpu/drm/virtio/virtgpu_drv.h @@ -356,6 +356,7 @@ void virtio_gpu_fence_event_process(struct virtio_gpu_device *vdev, int virtio_gpu_object_create(struct virtio_gpu_device *vgdev, unsigned long size, bool kernel, bool pinned, struct virtio_gpu_object **bo_ptr); +void virtio_gpu_object_kunmap(struct virtio_gpu_object *bo); int virtio_gpu_object_kmap(struct virtio_gpu_object *bo, void **ptr); int virtio_gpu_object_get_sg_table(struct virtio_gpu_device *qdev, struct virtio_gpu_object *bo); diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virtio/virtgpu_object.c index 9f2f470efd9b..113eae00d293 100644 --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -37,6 +37,8 @@ static void virtio_gpu_ttm_bo_destroy(struct ttm_buffer_object *tbo) virtio_gpu_cmd_unref_resource(vgdev, bo->hw_res_handle); if (bo->pages) virtio_gpu_object_free_sg_table(bo); + if (bo->vmap) + virtio_gpu_object_kunmap(bo); drm_gem_object_release(&bo->gem_base); kfree(bo); } @@ -99,6 +101,12 @@ int virtio_gpu_object_create(struct virtio_gpu_device *vgdev, return 0; } +void virtio_gpu_object_kunmap(struct virtio_gpu_object *bo) +{ + bo->vmap = NULL; + ttm_bo_kunmap(&bo->kmap); +} + int virtio_gpu_object_kmap(struct virtio_gpu_object *bo, void **ptr) { bool is_iomem;