[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210205080621.3102035-3-john.stultz@linaro.org>
Date: Fri, 5 Feb 2021 08:06:16 +0000
From: John Stultz <john.stultz@...aro.org>
To: lkml <linux-kernel@...r.kernel.org>
Cc: John Stultz <john.stultz@...aro.org>,
Daniel Vetter <daniel@...ll.ch>,
Christian Koenig <christian.koenig@....com>,
Sumit Semwal <sumit.semwal@...aro.org>,
Liam Mark <lmark@...eaurora.org>,
Chris Goldsworthy <cgoldswo@...eaurora.org>,
Laura Abbott <labbott@...nel.org>,
Brian Starkey <Brian.Starkey@....com>,
Hridya Valsaraju <hridya@...gle.com>,
Suren Baghdasaryan <surenb@...gle.com>,
Sandeep Patil <sspatil@...gle.com>,
Daniel Mentz <danielmentz@...gle.com>,
Ørjan Eide <orjan.eide@....com>,
Robin Murphy <robin.murphy@....com>,
Ezequiel Garcia <ezequiel@...labora.com>,
Simon Ser <contact@...rsion.fr>,
James Jones <jajones@...dia.com>, linux-media@...r.kernel.org,
dri-devel@...ts.freedesktop.org
Subject: [RFC][PATCH v6 2/7] drm: ttm_pool: Rename the ttm_pool_dma structure to ttm_pool_page_dat
This patch simply renames the ttm_pool_dma structure to
ttm_pool_page_dat, as we will extend it to store more then just
dma related info in it.
Cc: Daniel Vetter <daniel@...ll.ch>
Cc: Christian Koenig <christian.koenig@....com>
Cc: Sumit Semwal <sumit.semwal@...aro.org>
Cc: Liam Mark <lmark@...eaurora.org>
Cc: Chris Goldsworthy <cgoldswo@...eaurora.org>
Cc: Laura Abbott <labbott@...nel.org>
Cc: Brian Starkey <Brian.Starkey@....com>
Cc: Hridya Valsaraju <hridya@...gle.com>
Cc: Suren Baghdasaryan <surenb@...gle.com>
Cc: Sandeep Patil <sspatil@...gle.com>
Cc: Daniel Mentz <danielmentz@...gle.com>
Cc: Ørjan Eide <orjan.eide@....com>
Cc: Robin Murphy <robin.murphy@....com>
Cc: Ezequiel Garcia <ezequiel@...labora.com>
Cc: Simon Ser <contact@...rsion.fr>
Cc: James Jones <jajones@...dia.com>
Cc: linux-media@...r.kernel.org
Cc: dri-devel@...ts.freedesktop.org
Signed-off-by: John Stultz <john.stultz@...aro.org>
---
drivers/gpu/drm/ttm/ttm_pool.c | 37 +++++++++++++++++-----------------
1 file changed, 18 insertions(+), 19 deletions(-)
diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c
index 11e0313db0ea..c0274e256be3 100644
--- a/drivers/gpu/drm/ttm/ttm_pool.c
+++ b/drivers/gpu/drm/ttm/ttm_pool.c
@@ -37,18 +37,17 @@
#ifdef CONFIG_X86
#include <asm/set_memory.h>
#endif
-
#include <drm/ttm/ttm_pool.h>
#include <drm/ttm/ttm_bo_driver.h>
#include <drm/ttm/ttm_tt.h>
/**
- * struct ttm_pool_dma - Helper object for coherent DMA mappings
+ * struct ttm_pool_page_dat - Helper object for coherent DMA mappings
*
* @addr: original DMA address returned for the mapping
* @vaddr: original vaddr return for the mapping and order in the lower bits
*/
-struct ttm_pool_dma {
+struct ttm_pool_page_dat {
dma_addr_t addr;
unsigned long vaddr;
};
@@ -75,7 +74,7 @@ static struct page *ttm_pool_alloc_page(struct ttm_pool *pool, gfp_t gfp_flags,
unsigned int order)
{
unsigned long attr = DMA_ATTR_FORCE_CONTIGUOUS;
- struct ttm_pool_dma *dma;
+ struct ttm_pool_page_dat *dat;
struct page *p;
void *vaddr;
@@ -94,15 +93,15 @@ static struct page *ttm_pool_alloc_page(struct ttm_pool *pool, gfp_t gfp_flags,
return p;
}
- dma = kmalloc(sizeof(*dma), GFP_KERNEL);
- if (!dma)
+ dat = kmalloc(sizeof(*dat), GFP_KERNEL);
+ if (!dat)
return NULL;
if (order)
attr |= DMA_ATTR_NO_WARN;
vaddr = dma_alloc_attrs(pool->dev, (1ULL << order) * PAGE_SIZE,
- &dma->addr, gfp_flags, attr);
+ &dat->addr, gfp_flags, attr);
if (!vaddr)
goto error_free;
@@ -114,12 +113,12 @@ static struct page *ttm_pool_alloc_page(struct ttm_pool *pool, gfp_t gfp_flags,
else
p = virt_to_page(vaddr);
- dma->vaddr = (unsigned long)vaddr | order;
- p->private = (unsigned long)dma;
+ dat->vaddr = (unsigned long)vaddr | order;
+ p->private = (unsigned long)dat;
return p;
error_free:
- kfree(dma);
+ kfree(dat);
return NULL;
}
@@ -128,7 +127,7 @@ static void ttm_pool_free_page(struct ttm_pool *pool, enum ttm_caching caching,
unsigned int order, struct page *p)
{
unsigned long attr = DMA_ATTR_FORCE_CONTIGUOUS;
- struct ttm_pool_dma *dma;
+ struct ttm_pool_page_dat *dat;
void *vaddr;
#ifdef CONFIG_X86
@@ -147,11 +146,11 @@ static void ttm_pool_free_page(struct ttm_pool *pool, enum ttm_caching caching,
if (order)
attr |= DMA_ATTR_NO_WARN;
- dma = (void *)p->private;
- vaddr = (void *)(dma->vaddr & PAGE_MASK);
- dma_free_attrs(pool->dev, (1UL << order) * PAGE_SIZE, vaddr, dma->addr,
+ dat = (void *)p->private;
+ vaddr = (void *)(dat->vaddr & PAGE_MASK);
+ dma_free_attrs(pool->dev, (1UL << order) * PAGE_SIZE, vaddr, dat->addr,
attr);
- kfree(dma);
+ kfree(dat);
}
/* Apply a new caching to an array of pages */
@@ -184,9 +183,9 @@ static int ttm_pool_map(struct ttm_pool *pool, unsigned int order,
unsigned int i;
if (pool->use_dma_alloc) {
- struct ttm_pool_dma *dma = (void *)p->private;
+ struct ttm_pool_page_dat *dat = (void *)p->private;
- addr = dma->addr;
+ addr = dat->addr;
} else {
size_t size = (1ULL << order) * PAGE_SIZE;
@@ -324,9 +323,9 @@ static unsigned int ttm_pool_shrink(void)
static unsigned int ttm_pool_page_order(struct ttm_pool *pool, struct page *p)
{
if (pool->use_dma_alloc) {
- struct ttm_pool_dma *dma = (void *)p->private;
+ struct ttm_pool_page_dat *dat = (void *)p->private;
- return dma->vaddr & ~PAGE_MASK;
+ return dat->vaddr & ~PAGE_MASK;
}
return p->private;
--
2.25.1
Powered by blists - more mailing lists