From patchwork Thu Apr 9 14:34:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 6187991 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 09A959F2EC for ; Thu, 9 Apr 2015 14:34:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1A1BA2035B for ; Thu, 9 Apr 2015 14:34:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 3153420380 for ; Thu, 9 Apr 2015 14:34:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B7883720FD; Thu, 9 Apr 2015 07:34:20 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) by gabe.freedesktop.org (Postfix) with ESMTP id E6E1F720F8; Thu, 9 Apr 2015 07:34:18 -0700 (PDT) Received: by wizk4 with SMTP id k4so94775258wiz.1; Thu, 09 Apr 2015 07:34:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FjuasdPrsE8We/YUW6cTWtW1Hsn+RI17cssC52UzdSk=; b=llI+ljg+5v1SdrlLBAkmBkt0yKEBiAfIs9cnFatLw7EED4YHaJmaN0zDG2UMFnTbyT spt/3FQ00seydaFQSPiPhozUWMjJOqH1wEeH96Krl5jDx8MMgFATjzZsKXM/92mJj1I9 KfcMClo1jxI9/fhw1NHdHXjb7R8JtE4PHIH3OXUnCOeQFqD5MGIqxgiFulT9HSaXOZoJ xwvazG+CiNmR450Ail1N7ubVO5P8bezpKX4KJh49r9vNTFjvVl072N1JBUHcjmUVpUfj TPKtLRVTcLTLFgg8PDxXVymxerahYb8Lls264rSeDuiLeErZPduTbyYsac+h87QACwIR OV4g== X-Received: by 10.194.89.195 with SMTP id bq3mr61520447wjb.123.1428590058006; Thu, 09 Apr 2015 07:34:18 -0700 (PDT) Received: from localhost (port-21116.pppoe.wtnet.de. [46.59.144.37]) by mx.google.com with ESMTPSA id wr2sm20366529wjb.45.2015.04.09.07.34.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Apr 2015 07:34:17 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Date: Thu, 9 Apr 2015 16:34:08 +0200 Message-Id: <1428590049-20357-5-git-send-email-thierry.reding@gmail.com> X-Mailer: git-send-email 2.3.2 In-Reply-To: <1428590049-20357-1-git-send-email-thierry.reding@gmail.com> References: <1428590049-20357-1-git-send-email-thierry.reding@gmail.com> Cc: Arnd Bergmann , David Airlie , Catalin Marinas , intel-gfx@lists.freedesktop.org, Will Deacon , Russell King , linux-arm-kernel@lists.infradead.org Subject: [Intel-gfx] [PATCH 5/6] drm/armada: gem: Use drm_clflush_*() functions X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Thierry Reding Instead of going through the DMA mapping API for cache maintenance, use the drm_clflush_*() family of functions to achieve the same effect. Cc: Russell King Signed-off-by: Thierry Reding --- drivers/gpu/drm/armada/Kconfig | 1 + drivers/gpu/drm/armada/armada_gem.c | 13 ++----------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/armada/Kconfig b/drivers/gpu/drm/armada/Kconfig index 50ae88ad4d76..7b7070128a05 100644 --- a/drivers/gpu/drm/armada/Kconfig +++ b/drivers/gpu/drm/armada/Kconfig @@ -4,6 +4,7 @@ config DRM_ARMADA select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select DRM_CACHE select DRM_KMS_HELPER select DRM_KMS_FB_HELPER help diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c index 580e10acaa3a..c2d4414031ab 100644 --- a/drivers/gpu/drm/armada/armada_gem.c +++ b/drivers/gpu/drm/armada/armada_gem.c @@ -453,19 +453,14 @@ armada_gem_prime_map_dma_buf(struct dma_buf_attachment *attach, sg_set_page(sg, page, PAGE_SIZE, 0); } - if (dma_map_sg(attach->dev, sgt->sgl, sgt->nents, dir) == 0) { - num = sgt->nents; - goto release; - } + drm_clflush_sg(sgt); } else if (dobj->page) { /* Single contiguous page */ if (sg_alloc_table(sgt, 1, GFP_KERNEL)) goto free_sgt; sg_set_page(sgt->sgl, dobj->page, dobj->obj.size, 0); - - if (dma_map_sg(attach->dev, sgt->sgl, sgt->nents, dir) == 0) - goto free_table; + drm_clflush_sg(sgt); } else if (dobj->linear) { /* Single contiguous physical region - no struct page */ if (sg_alloc_table(sgt, 1, GFP_KERNEL)) @@ -480,7 +475,6 @@ armada_gem_prime_map_dma_buf(struct dma_buf_attachment *attach, release: for_each_sg(sgt->sgl, sg, num, i) page_cache_release(sg_page(sg)); - free_table: sg_free_table(sgt); free_sgt: kfree(sgt); @@ -494,9 +488,6 @@ static void armada_gem_prime_unmap_dma_buf(struct dma_buf_attachment *attach, struct armada_gem_object *dobj = drm_to_armada_gem(obj); int i; - if (!dobj->linear) - dma_unmap_sg(attach->dev, sgt->sgl, sgt->nents, dir); - if (dobj->obj.filp) { struct scatterlist *sg; for_each_sg(sgt->sgl, sg, sgt->nents, i)