From patchwork Thu Jun 8 13:25:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 9774769 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 CFA6360393 for ; Thu, 8 Jun 2017 13:28:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C163628451 for ; Thu, 8 Jun 2017 13:28:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B5F7E28520; Thu, 8 Jun 2017 13:28:48 +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_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2D30228451 for ; Thu, 8 Jun 2017 13:28:48 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dIxSY-0003AY-DF; Thu, 08 Jun 2017 13:26:46 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dIxSW-00039U-Pt for xen-devel@lists.xenproject.org; Thu, 08 Jun 2017 13:26:44 +0000 Received: from [85.158.139.211] by server-12.bemta-5.messagelabs.com id 71/F1-01735-49059395; Thu, 08 Jun 2017 13:26:44 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMLMWRWlGSWpSXmKPExsXiaHS5VXdCgGW kwdEN4hbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bv4/oFz4UrPh14wtbA2CrYxcjFwSJwgk1i 78dV7CCOkMAJRol13V9Zuhg5OdgEVCTePO8BS4gIHGKROPnmKBNIgllAQeLXvU2sILawgK3Ek uUTgRo4gEapSnxsjgYJ8wroS/y5/YMRxJYQkJfY1XYRrJxTwECi5fQusDFCQDWHFkxjBpkvId DCKNF2cQXLBEaeBYwMqxg1ilOLylKLdA2N9ZKKMtMzSnITM3N0DQ1M9XJTi4sT01NzEpOK9ZL zczcxAj3PAAQ7GP9t8zzEKMnBpCTKqyhgGSnEl5SfUpmRWJwRX1Sak1p8iFGGg0NJgvedH1BO sCg1PbUiLTMHGIIwaQkOHiUR3v8+QGne4oLE3OLMdIjUKUZFKXHeXyB9AiCJjNI8uDZY2F9il JUS5mUEOkSIpyC1KDezBFX+FaM4B6OSMK+bL9AUnsy8Erjpr4AWMwEtXvLOAmRxSSJCSqqBUd fXPLVA4V29etXp1Y0mkZsUndifX1R123LOc9Xd2f7bfMNnSQj3rLQpujNDwz7jSV3JgxNfpF4 /TeDayKRWyWy+havs+r6EGW5KKUHmYU+120t//1vBt85GReWYir3OxUtrtWr+NudpqTUoHrW8 kn96vfmyg8kuk67NerRobvXMaTO9FvzuVmIpzkg01GIuKk4EAN0Rvld2AgAA X-Env-Sender: BATV+eb06f239ea6f59aeb59b+5037+infradead.org+hch@bombadil.s rs.infradead.org X-Msg-Ref: server-9.tower-206.messagelabs.com!1496928398!102588420!1 X-Originating-IP: [65.50.211.133] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 25934 invoked from network); 8 Jun 2017 13:26:40 -0000 Received: from bombadil.infradead.org (HELO bombadil.infradead.org) (65.50.211.133) by server-9.tower-206.messagelabs.com with AES256-GCM-SHA384 encrypted SMTP; 8 Jun 2017 13:26:40 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Pwg3znQ/jRIAoC9Aa7lucF7QlnShJfVfmNX9YXBG9Q4=; b=bne7zH9MOV7a9/v8Zst418m7L t8aqngrtr0jVxiou82vprQz1Y40jRslnldTmbqFSZAAQ+W6qTC652MCrWVJQsa5YhrkQpBHzOhZgV M/enwkUBW0R0qjg+0jclYmQA2CtZhoV3AzY0rRyFgKq9yTJOVbUvbEoXJDV342gzS7pFVSciuqd8Q 8b8ma+0ggdBAKMkuGV/2/Zj6ZrHjYdnOBU1G5pd6NGEybJ2Vjf/49a3P84ug85ETIg4+lWuY9HORZ 5o4LE2ffyzkD0IhOFwVxGk08/kNEAYy4itNing3nOhDEhURXDN1wDPLDqcTczjb9VeR9oe3eWeYyK rICYifIow==; Received: from clnet-p099-196.ikbnet.co.at ([83.175.99.196] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1dIxSO-00059Q-6V; Thu, 08 Jun 2017 13:26:36 +0000 From: Christoph Hellwig To: x86@kernel.org, linux-arm-kernel@lists.infradead.org, xen-devel@lists.xenproject.org, linux-c6x-dev@linux-c6x.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@linux-mips.org, openrisc@lists.librecores.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-xtensa@linux-xtensa.org, dmaengine@vger.kernel.org, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, iommu@lists.linux-foundation.org, netdev@vger.kernel.org Date: Thu, 8 Jun 2017 15:25:30 +0200 Message-Id: <20170608132609.32662-6-hch@lst.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170608132609.32662-1-hch@lst.de> References: <20170608132609.32662-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Cc: linux-kernel@vger.kernel.org Subject: [Xen-devel] [PATCH 05/44] drm/armada: don't abuse DMA_ERROR_CODE X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP dev_addr isn't even a dma_addr_t, and DMA_ERROR_CODE has never been a valid driver API. Add a bool mapped flag instead. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/armada/armada_fb.c | 2 +- drivers/gpu/drm/armada/armada_gem.c | 5 ++--- drivers/gpu/drm/armada/armada_gem.h | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/armada/armada_fb.c b/drivers/gpu/drm/armada/armada_fb.c index 2a7eb6817c36..92e6b08ea64a 100644 --- a/drivers/gpu/drm/armada/armada_fb.c +++ b/drivers/gpu/drm/armada/armada_fb.c @@ -133,7 +133,7 @@ static struct drm_framebuffer *armada_fb_create(struct drm_device *dev, } /* Framebuffer objects must have a valid device address for scanout */ - if (obj->dev_addr == DMA_ERROR_CODE) { + if (!obj->mapped) { ret = -EINVAL; goto err_unref; } diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c index d6c2a5d190eb..a76ca21d063b 100644 --- a/drivers/gpu/drm/armada/armada_gem.c +++ b/drivers/gpu/drm/armada/armada_gem.c @@ -175,6 +175,7 @@ armada_gem_linear_back(struct drm_device *dev, struct armada_gem_object *obj) obj->phys_addr = obj->linear->start; obj->dev_addr = obj->linear->start; + obj->mapped = true; } DRM_DEBUG_DRIVER("obj %p phys %#llx dev %#llx\n", obj, @@ -205,7 +206,6 @@ armada_gem_alloc_private_object(struct drm_device *dev, size_t size) return NULL; drm_gem_private_object_init(dev, &obj->obj, size); - obj->dev_addr = DMA_ERROR_CODE; DRM_DEBUG_DRIVER("alloc private obj %p size %zu\n", obj, size); @@ -229,8 +229,6 @@ static struct armada_gem_object *armada_gem_alloc_object(struct drm_device *dev, return NULL; } - obj->dev_addr = DMA_ERROR_CODE; - mapping = obj->obj.filp->f_mapping; mapping_set_gfp_mask(mapping, GFP_HIGHUSER | __GFP_RECLAIMABLE); @@ -610,5 +608,6 @@ int armada_gem_map_import(struct armada_gem_object *dobj) return -EINVAL; } dobj->dev_addr = sg_dma_address(dobj->sgt->sgl); + dobj->mapped = true; return 0; } diff --git a/drivers/gpu/drm/armada/armada_gem.h b/drivers/gpu/drm/armada/armada_gem.h index b88d2b9853c7..6e524e0676bb 100644 --- a/drivers/gpu/drm/armada/armada_gem.h +++ b/drivers/gpu/drm/armada/armada_gem.h @@ -16,6 +16,7 @@ struct armada_gem_object { void *addr; phys_addr_t phys_addr; resource_size_t dev_addr; + bool mapped; struct drm_mm_node *linear; /* for linear backed */ struct page *page; /* for page backed */ struct sg_table *sgt; /* for imported */