forked from rubenslte/android_kernel_samsung_msm8226
msm: kgsl: remove readl/writel use for dma memory
For dma_alloc_coherent() you don't need writel/readl because it's just a plain old void *. Linux tries very hard to make a distinction between io memory (void __iomem *) and memory (void *) so that drivers are portable to architectures that don't have a way to access registers via pointer dereferences. You can see http://lwn.net/Articles/102232/ and the Linus rant http://lwn.net/Articles/102240/ here for more details behind the motivation. Change-Id: I3da075c30304e4adf321cfb3edb1baa4a93fc2ce Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
This commit is contained in:
@@ -64,7 +64,7 @@ struct adreno_ringbuffer {
|
||||
|
||||
#define GSL_RB_WRITE(ring, gpuaddr, data) \
|
||||
do { \
|
||||
writel_relaxed(data, ring); \
|
||||
*ring = data; \
|
||||
wmb(); \
|
||||
kgsl_cffdump_setmem(gpuaddr, data, 4); \
|
||||
ring++; \
|
||||
@@ -93,7 +93,7 @@ struct adreno_ringbuffer {
|
||||
#define GSL_RB_CNTL_NO_UPDATE 0x0 /* enable */
|
||||
#define GSL_RB_GET_READPTR(rb, data) \
|
||||
do { \
|
||||
*(data) = readl_relaxed(&(rb)->memptrs->rptr); \
|
||||
*(data) = rb->memptrs->rptr; \
|
||||
} while (0)
|
||||
#else
|
||||
#define GSL_RB_CNTL_NO_UPDATE 0x1 /* disable */
|
||||
|
||||
@@ -382,15 +382,16 @@ static inline void
|
||||
kgsl_pt_map_set(struct kgsl_gpummu_pt *pt, uint32_t pte, uint32_t val)
|
||||
{
|
||||
uint32_t *baseptr = (uint32_t *)pt->base.hostptr;
|
||||
|
||||
writel_relaxed(val, &baseptr[pte]);
|
||||
BUG_ON(pte*sizeof(uint32_t) >= pt->base.size);
|
||||
baseptr[pte] = val;
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
kgsl_pt_map_get(struct kgsl_gpummu_pt *pt, uint32_t pte)
|
||||
{
|
||||
uint32_t *baseptr = (uint32_t *)pt->base.hostptr;
|
||||
return readl_relaxed(&baseptr[pte]) & GSL_PT_PAGE_ADDR_MASK;
|
||||
BUG_ON(pte*sizeof(uint32_t) >= pt->base.size);
|
||||
return baseptr[pte] & GSL_PT_PAGE_ADDR_MASK;
|
||||
}
|
||||
|
||||
static unsigned int kgsl_gpummu_pt_get_flags(struct kgsl_pagetable *pt,
|
||||
|
||||
@@ -636,13 +636,17 @@ kgsl_sharedmem_readl(const struct kgsl_memdesc *memdesc,
|
||||
uint32_t *dst,
|
||||
unsigned int offsetbytes)
|
||||
{
|
||||
uint32_t *src;
|
||||
BUG_ON(memdesc == NULL || memdesc->hostptr == NULL || dst == NULL);
|
||||
WARN_ON(offsetbytes + sizeof(unsigned int) > memdesc->size);
|
||||
WARN_ON(offsetbytes % sizeof(uint32_t) != 0);
|
||||
if (offsetbytes % sizeof(uint32_t) != 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (offsetbytes + sizeof(unsigned int) > memdesc->size)
|
||||
WARN_ON(offsetbytes + sizeof(uint32_t) > memdesc->size);
|
||||
if (offsetbytes + sizeof(uint32_t) > memdesc->size)
|
||||
return -ERANGE;
|
||||
|
||||
*dst = readl_relaxed(memdesc->hostptr + offsetbytes);
|
||||
src = (uint32_t *)(memdesc->hostptr + offsetbytes);
|
||||
*dst = *src;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(kgsl_sharedmem_readl);
|
||||
@@ -652,12 +656,19 @@ kgsl_sharedmem_writel(const struct kgsl_memdesc *memdesc,
|
||||
unsigned int offsetbytes,
|
||||
uint32_t src)
|
||||
{
|
||||
uint32_t *dst;
|
||||
BUG_ON(memdesc == NULL || memdesc->hostptr == NULL);
|
||||
BUG_ON(offsetbytes + sizeof(unsigned int) > memdesc->size);
|
||||
WARN_ON(offsetbytes % sizeof(uint32_t) != 0);
|
||||
if (offsetbytes % sizeof(uint32_t) != 0)
|
||||
return -EINVAL;
|
||||
|
||||
WARN_ON(offsetbytes + sizeof(uint32_t) > memdesc->size);
|
||||
if (offsetbytes + sizeof(uint32_t) > memdesc->size)
|
||||
return -ERANGE;
|
||||
kgsl_cffdump_setmem(memdesc->gpuaddr + offsetbytes,
|
||||
src, sizeof(uint));
|
||||
writel_relaxed(src, memdesc->hostptr + offsetbytes);
|
||||
src, sizeof(uint32_t));
|
||||
dst = (uint32_t *)(memdesc->hostptr + offsetbytes);
|
||||
*dst = src;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(kgsl_sharedmem_writel);
|
||||
|
||||
Reference in New Issue
Block a user