linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: gurchetansingh@chromium.org (Gurchetan Singh)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/5] drm: add ARM64 flush implementations
Date: Tue, 23 Jan 2018 18:56:04 -0800	[thread overview]
Message-ID: <20180124025606.3020-3-gurchetansingh@chromium.org> (raw)
In-Reply-To: <20180124025606.3020-2-gurchetansingh@chromium.org>

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 <gurchetansingh@chromium.org>
---
 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);
-- 
2.13.5

  reply	other threads:[~2018-01-24  2:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24  2:56 [PATCH 2/5] drm: add ARM flush implementation Gurchetan Singh
2018-01-24  2:56 ` Gurchetan Singh [this message]
2018-01-24 12:00   ` [PATCH 3/5] drm: add ARM64 flush implementations Robin Murphy
2018-01-24 12:36     ` Russell King - ARM Linux
2018-01-24 13:14       ` Robin Murphy
2018-01-30  9:53     ` Daniel Vetter
2018-01-24  2:56 ` [PATCH 4/5] drm/vgem: flush page during page fault Gurchetan Singh
2018-01-24  2:56 ` [PATCH 5/5] drm: use drm_flush_sg where possible Gurchetan Singh
2018-01-24 11:50 ` [PATCH 2/5] drm: add ARM flush implementation Lucas Stach
2018-01-24 12:45 ` Russell King - ARM Linux
     [not found]   ` <CAAfnVBkwmrcr14ZhmhgAnLHwL8zotnnCeWAVwBGmVcU9oGRerA@mail.gmail.com>
2018-01-24 19:26     ` Russell King - ARM Linux
2018-01-24 23:43       ` Gurchetan Singh
2018-01-25 14:06       ` Thierry Reding
2018-01-30 10:14 ` Daniel Vetter
2018-01-30 11:31   ` Russell King - ARM Linux
2018-01-30 12:27     ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180124025606.3020-3-gurchetansingh@chromium.org \
    --to=gurchetansingh@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).