msm: kgsl: Allocate global buffers through paged memory

The global buffers are allocated through cma, which can
be very limited on some targets. Add a flag to allocate
a global buffer through our page allocator.

CRs-Fixed: 1024295
Change-Id: Ie796b03ce152774535f593acdf00e900109d303a
Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
This commit is contained in:
Harshdeep Dhatt 2016-05-26 10:39:24 -06:00 committed by Carter Cooper
parent cc915a3931
commit d8b75e153f
4 changed files with 19 additions and 8 deletions

View file

@ -3913,7 +3913,7 @@ int kgsl_device_platform_probe(struct kgsl_device *device)
goto error_close_mmu; goto error_close_mmu;
status = kgsl_allocate_global(device, &device->memstore, status = kgsl_allocate_global(device, &device->memstore,
KGSL_MEMSTORE_SIZE, 0, 0); KGSL_MEMSTORE_SIZE, 0, KGSL_MEMDESC_CONTIG);
if (status != 0) if (status != 0)
goto error_close_mmu; goto error_close_mmu;

View file

@ -163,6 +163,8 @@ struct kgsl_memdesc_ops {
#define KGSL_MEMDESC_PRIVILEGED BIT(6) #define KGSL_MEMDESC_PRIVILEGED BIT(6)
/* The memdesc is TZ locked content protection */ /* The memdesc is TZ locked content protection */
#define KGSL_MEMDESC_TZ_LOCKED BIT(7) #define KGSL_MEMDESC_TZ_LOCKED BIT(7)
/* The memdesc is allocated through contiguous memory */
#define KGSL_MEMDESC_CONTIG BIT(8)
/** /**
* struct kgsl_memdesc - GPU memory object descriptor * struct kgsl_memdesc - GPU memory object descriptor

View file

@ -313,10 +313,6 @@ kgsl_sharedmem_init_sysfs(void)
drv_attr_list); drv_attr_list);
} }
static int kgsl_sharedmem_page_alloc_user(struct kgsl_memdesc *memdesc,
struct kgsl_pagetable *pagetable,
uint64_t size);
static int kgsl_cma_alloc_secure(struct kgsl_device *device, static int kgsl_cma_alloc_secure(struct kgsl_device *device,
struct kgsl_memdesc *memdesc, uint64_t size); struct kgsl_memdesc *memdesc, uint64_t size);
@ -672,7 +668,7 @@ static inline int get_page_size(size_t size, unsigned int align)
} }
#endif #endif
static int int
kgsl_sharedmem_page_alloc_user(struct kgsl_memdesc *memdesc, kgsl_sharedmem_page_alloc_user(struct kgsl_memdesc *memdesc,
struct kgsl_pagetable *pagetable, struct kgsl_pagetable *pagetable,
uint64_t size) uint64_t size)

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2002,2007-2015, The Linux Foundation. All rights reserved. /* Copyright (c) 2002,2007-2016, The Linux Foundation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and
@ -71,6 +71,10 @@ int kgsl_allocate_user(struct kgsl_device *device,
void kgsl_get_memory_usage(char *str, size_t len, uint64_t memflags); void kgsl_get_memory_usage(char *str, size_t len, uint64_t memflags);
int kgsl_sharedmem_page_alloc_user(struct kgsl_memdesc *memdesc,
struct kgsl_pagetable *pagetable,
uint64_t size);
#define MEMFLAGS(_flags, _mask, _shift) \ #define MEMFLAGS(_flags, _mask, _shift) \
((unsigned int) (((_flags) & (_mask)) >> (_shift))) ((unsigned int) (((_flags) & (_mask)) >> (_shift)))
@ -266,7 +270,16 @@ static inline int kgsl_allocate_global(struct kgsl_device *device,
memdesc->flags = flags; memdesc->flags = flags;
memdesc->priv = priv; memdesc->priv = priv;
ret = kgsl_sharedmem_alloc_contig(device, memdesc, NULL, (size_t) size); if ((memdesc->priv & KGSL_MEMDESC_CONTIG) != 0)
ret = kgsl_sharedmem_alloc_contig(device, memdesc, NULL,
(size_t) size);
else {
ret = kgsl_sharedmem_page_alloc_user(memdesc, NULL,
(size_t) size);
if (ret == 0)
kgsl_memdesc_map(memdesc);
}
if (ret == 0) if (ret == 0)
kgsl_mmu_add_global(device, memdesc); kgsl_mmu_add_global(device, memdesc);