linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Rob Clark <robdclark@gmail.com>, David Airlie <airlied@linux.ie>
Cc: Arnd Bergmann <arnd@arndb.de>, Jonathan Marek <jonathan@marek.ca>,
	linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
	freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH] drm/msm: fix arm64 build error
Date: Mon, 10 Dec 2018 21:56:12 +0100	[thread overview]
Message-ID: <20181210205620.3041207-1-arnd@arndb.de> (raw)

The new a200 GPU MMU support fails to build on arm64 because
of a conflicting macro name:

drivers/gpu/drm/msm/msm_gpummu.c:17: error: "VA_START" redefined [-Werror]
 #define VA_START SZ_16M

In file included from arch/arm64/include/asm/pgtable-hwdef.h:19,
                 from arch/arm64/include/asm/processor.h:48,
                 from include/linux/mutex.h:19,
                 from include/linux/notifier.h:14,
                 from include/linux/clk.h:17,
                 from drivers/gpu/drm/msm/msm_drv.h:23,
                 from drivers/gpu/drm/msm/msm_gpummu.c:4:
arch/arm64/include/asm/memory.h:51: note: this is the location of the previous definition
 #define VA_START  (UL(0xffffffffffffffff) - \

Rename this and the related macros with a GPU_ prefix.

Fixes: 1c0088f255ae ("drm/msm: implement a2xx mmu")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/gpu/drm/msm/msm_gpummu.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_gpummu.c b/drivers/gpu/drm/msm/msm_gpummu.c
index f1dc2b7e5fd3..2a7ddd449d3d 100644
--- a/drivers/gpu/drm/msm/msm_gpummu.c
+++ b/drivers/gpu/drm/msm/msm_gpummu.c
@@ -14,10 +14,10 @@ struct msm_gpummu {
 };
 #define to_msm_gpummu(x) container_of(x, struct msm_gpummu, base)
 
-#define VA_START SZ_16M
-#define VA_RANGE (0xfff * SZ_64K)
-#define MMU_PAGE_SIZE SZ_4K
-#define TABLE_SIZE (sizeof(uint32_t) * VA_RANGE / MMU_PAGE_SIZE)
+#define GPU_VA_START SZ_16M
+#define GPU_VA_RANGE (0xfff * SZ_64K)
+#define GPU_MMU_PAGE_SIZE SZ_4K
+#define GPU_TABLE_SIZE (sizeof(uint32_t) * GPU_VA_RANGE / GPU_MMU_PAGE_SIZE)
 
 static int msm_gpummu_attach(struct msm_mmu *mmu, const char * const *names,
 		int cnt)
@@ -34,7 +34,7 @@ static int msm_gpummu_map(struct msm_mmu *mmu, uint64_t iova,
 		struct sg_table *sgt, unsigned len, int prot)
 {
 	struct msm_gpummu *gpummu = to_msm_gpummu(mmu);
-	unsigned idx = (iova - VA_START) / MMU_PAGE_SIZE;
+	unsigned idx = (iova - GPU_VA_START) / GPU_MMU_PAGE_SIZE;
 	struct scatterlist *sg;
 	unsigned prot_bits = 0;
 	unsigned i, j;
@@ -46,9 +46,9 @@ static int msm_gpummu_map(struct msm_mmu *mmu, uint64_t iova,
 
 	for_each_sg(sgt->sgl, sg, sgt->nents, i) {
 		dma_addr_t addr = sg->dma_address;
-		for (j = 0; j < sg->length / MMU_PAGE_SIZE; j++, idx++) {
+		for (j = 0; j < sg->length / GPU_MMU_PAGE_SIZE; j++, idx++) {
 			gpummu->table[idx] = addr | prot_bits;
-			addr += MMU_PAGE_SIZE;
+			addr += GPU_MMU_PAGE_SIZE;
 		}
 	}
 
@@ -62,10 +62,10 @@ static int msm_gpummu_map(struct msm_mmu *mmu, uint64_t iova,
 static int msm_gpummu_unmap(struct msm_mmu *mmu, uint64_t iova, unsigned len)
 {
 	struct msm_gpummu *gpummu = to_msm_gpummu(mmu);
-	unsigned idx = (iova - VA_START) / MMU_PAGE_SIZE;
+	unsigned idx = (iova - GPU_VA_START) / GPU_MMU_PAGE_SIZE;
 	unsigned i;
 
-	for (i = 0; i < len / MMU_PAGE_SIZE; i++, idx++)
+	for (i = 0; i < len / GPU_MMU_PAGE_SIZE; i++, idx++)
                 gpummu->table[idx] = 0;
 
 	gpu_write(gpummu->gpu, REG_A2XX_MH_MMU_INVALIDATE,
@@ -78,7 +78,7 @@ static void msm_gpummu_destroy(struct msm_mmu *mmu)
 {
 	struct msm_gpummu *gpummu = to_msm_gpummu(mmu);
 
-	dma_free_attrs(mmu->dev, TABLE_SIZE, gpummu->table, gpummu->pt_base,
+	dma_free_attrs(mmu->dev, GPU_TABLE_SIZE, gpummu->table, gpummu->pt_base,
 		DMA_ATTR_FORCE_CONTIGUOUS);
 
 	kfree(gpummu);
@@ -100,7 +100,7 @@ struct msm_mmu *msm_gpummu_new(struct device *dev, struct msm_gpu *gpu)
 	if (!gpummu)
 		return ERR_PTR(-ENOMEM);
 
-	gpummu->table = dma_alloc_attrs(dev, TABLE_SIZE + 32, &gpummu->pt_base,
+	gpummu->table = dma_alloc_attrs(dev, GPU_TABLE_SIZE + 32, &gpummu->pt_base,
 		GFP_KERNEL | __GFP_ZERO, DMA_ATTR_FORCE_CONTIGUOUS);
 	if (!gpummu->table) {
 		kfree(gpummu);
@@ -119,5 +119,5 @@ void msm_gpummu_params(struct msm_mmu *mmu, dma_addr_t *pt_base,
 	dma_addr_t base = to_msm_gpummu(mmu)->pt_base;
 
 	*pt_base = base;
-	*tran_error = base + TABLE_SIZE; /* 32-byte aligned */
+	*tran_error = base + GPU_TABLE_SIZE; /* 32-byte aligned */
 }
-- 
2.20.0


             reply	other threads:[~2018-12-10 20:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10 20:56 Arnd Bergmann [this message]
2018-12-11  0:47 ` [PATCH] drm/msm: fix arm64 build error Rob Clark

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=20181210205620.3041207-1-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jonathan@marek.ca \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robdclark@gmail.com \
    /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).