From patchwork Wed Jan 24 02:56:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gurchetan Singh X-Patchwork-Id: 10181311 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 7D3CB60467 for ; Wed, 24 Jan 2018 02:56:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70E52285BA for ; Wed, 24 Jan 2018 02:56:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 657AD28631; Wed, 24 Jan 2018 02:56:34 +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 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 28EA8285BA for ; Wed, 24 Jan 2018 02:56:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 23D1E6E4F6; Wed, 24 Jan 2018 02:56:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 426A16E4F6 for ; Wed, 24 Jan 2018 02:56:31 +0000 (UTC) Received: by mail-pf0-x241.google.com with SMTP id e11so1947350pff.6 for ; Tue, 23 Jan 2018 18:56:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Pvw/fFv0sJz28Gke8LckUBM2qySFeR7bKH+1k/6LlnU=; b=bRbQAxQqLEsfMXOWHLnq1pLB9lbh0lT2ZVQxSEBYU+mPOuUKjNWVaT4tkc3YCfpYAO wkKjfscIM330ePmwt2BqZfJcQrddDS7dhB0ZgUBST6hCB1+zsAuRhCSLQSmQGEMpVUwH lFSbHCITPDi4GeX3YFUwC8+FzOqFxIZABxkTM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Pvw/fFv0sJz28Gke8LckUBM2qySFeR7bKH+1k/6LlnU=; b=FEFv3h7IwGgf7tpbLF6KQPmHIH/Ft+dZbEdVrTr/cl6cSCTaC5xW28wGu/F+03dW71 fM2WQGgtwn0u6pGNFXC0fiUqs8b5xnth4s82LUFHObUrGuLCJ7gDGXRqUeGuhlAZmaAP vc2858rBY2p3D63JjdDD9LU5tG603FtFCg2zth1pp/2ON6r9U5yLiz8bHXyTelKyYEtm q/D6eGI/01yjyLeLUNT+OT7viKv8zf5vqEc39Ew4uvBFo5sXSVcCn2C4CXizNy13lFWb eRh+/k2T5LJeqFTJaEWDLANslwpJ3HRuGJtec1Y36rZmaxBKTim0TikL3RXs2ZLpEd1S O2CA== X-Gm-Message-State: AKwxytcgOgV6NWqxpNPIrdDhM6xubOWGSh+njov/uwloEMVZpvIiiJdi +cluElQ+54Y/vRAPryBwEeaCL498RvY= X-Google-Smtp-Source: AH8x224Fljg8vlqcLmCULuA4xRNcEdK0BSBDr8I2lFSw2o2fsPKz7Kf+jB7dsELfNwv4Bx++AyKrLg== X-Received: by 10.99.174.7 with SMTP id q7mr9618740pgf.170.1516762590511; Tue, 23 Jan 2018 18:56:30 -0800 (PST) Received: from gurchetansingh0.mtv.corp.google.com ([2620:0:1000:1600:f560:c8e6:9f8d:ba54]) by smtp.gmail.com with ESMTPSA id i20sm7041301pfj.58.2018.01.23.18.56.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Jan 2018 18:56:29 -0800 (PST) From: Gurchetan Singh To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/5] drm: add ARM64 flush implementations Date: Tue, 23 Jan 2018 18:56:04 -0800 Message-Id: <20180124025606.3020-3-gurchetansingh@chromium.org> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20180124025606.3020-2-gurchetansingh@chromium.org> References: <20180124025606.3020-2-gurchetansingh@chromium.org> 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: Gurchetan Singh , thierry.reding@gmail.com, laurent.pinchart@ideasonboard.com, daniel.vetter@intel.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch uses the __dma_map_area function to flush the cache on ARM64. v2: Don't use DMA API, call functions directly (Daniel) Signed-off-by: Gurchetan Singh --- drivers/gpu/drm/drm_cache.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gpu/drm/drm_cache.c b/drivers/gpu/drm/drm_cache.c index 5124582451c6..250cdfbb711f 100644 --- a/drivers/gpu/drm/drm_cache.c +++ b/drivers/gpu/drm/drm_cache.c @@ -159,6 +159,12 @@ drm_flush_pages(struct page *pages[], unsigned long num_pages) for (i = 0; i < num_pages; i++) drm_cache_maint_page(pages[i], 0, PAGE_SIZE, DMA_TO_DEVICE, dmac_map_area); +#elif defined(CONFIG_ARM64) + unsigned long i; + + for (i = 0; i < num_pages; i++) + __dma_map_area(phys_to_virt(page_to_phys(pages[i])), PAGE_SIZE, + DMA_TO_DEVICE); #else pr_err("Architecture has no drm_cache.c support\n"); WARN_ON_ONCE(1); @@ -196,6 +202,13 @@ drm_flush_sg(struct sg_table *st) for_each_sg_page(st->sgl, &sg_iter, st->nents, 0) drm_cache_maint_page(sg_page_iter_page(&sg_iter), 0, PAGE_SIZE, DMA_TO_DEVICE, dmac_map_area); +#elif defined(CONFIG_ARM64) + int i; + struct scatterlist *sg; + + for_each_sg(st->sgl, sg, st->nents, i) + __dma_map_area(phys_to_virt(sg_phys(sg)), sg->length, + DMA_TO_DEVICE); #else pr_err("Architecture has no drm_cache.c support\n"); WARN_ON_ONCE(1);