Merge "msm: kgsl: Use a token address for memstore"

This commit is contained in:
qctecmdr 2020-09-01 17:18:52 -07:00 • committed by Gerrit - the friendly Code Review server
commit ca144bfa19
4 changed files with 16 additions and 16 deletions

View file

@ -2305,12 +2305,8 @@ static int adreno_prop_device_shadow(struct kgsl_device *device,
struct kgsl_shadowprop shadowprop = { 0 };
if (device->memstore->hostptr) {
/*
* NOTE: with mmu enabled, gpuaddr doesn't mean
* anything to mmap().
*/
shadowprop.gpuaddr = (unsigned long)device->memstore->gpuaddr;
/* Pass a dummy address to identify memstore */
shadowprop.gpuaddr = KGSL_MEMSTORE_TOKEN_ADDRESS;
shadowprop.size = device->memstore->size;
shadowprop.flags = KGSL_FLAGS_INITIALIZED |

View file

@ -51,15 +51,9 @@ int adreno_getproperty_compat(struct kgsl_device *device,
}
memset(&shadowprop, 0, sizeof(shadowprop));
if (device->memstore->hostptr) {
/*
* NOTE: with mmu enabled, gpuaddr doesn't mean
* anything to mmap().
* NOTE: shadowprop.gpuaddr is uint32
* (because legacy) and the memstore gpuaddr is
* 64 bit. Cast the memstore gpuaddr to uint32.
*/
/* Give a token address to identify memstore */
shadowprop.gpuaddr = (unsigned int)
device->memstore->gpuaddr;
KGSL_MEMSTORE_TOKEN_ADDRESS;
shadowprop.size =
(unsigned int) device->memstore->size;
/*

View file

@ -4553,7 +4553,7 @@ kgsl_get_unmapped_area(struct file *file, unsigned long addr,
struct kgsl_device *device = dev_priv->device;
struct kgsl_mem_entry *entry = NULL;
if (vma_offset == (unsigned long) device->memstore->gpuaddr)
if (vma_offset == (unsigned long) KGSL_MEMSTORE_TOKEN_ADDRESS)
return get_unmapped_area(NULL, addr, len, pgoff, flags);
val = get_mmap_entry(private, &entry, pgoff, len);
@ -4597,7 +4597,7 @@ static int kgsl_mmap(struct file *file, struct vm_area_struct *vma)
/* Handle leagacy behavior for memstore */
if (vma_offset == (unsigned long) device->memstore->gpuaddr)
if (vma_offset == (unsigned long) KGSL_MEMSTORE_TOKEN_ADDRESS)
return kgsl_mmap_memstore(file, device, vma);
/*

View file

@ -15,6 +15,16 @@
#define KGSL_IOMMU_GLOBAL_MEM_BASE32 0xf8000000
#define KGSL_IOMMU_GLOBAL_MEM_BASE64 0xfc000000
/*
* This is a dummy token address that we use to identify memstore when the user
* wants to map it. mmap() uses a unsigned long for the offset so we need a 32
* bit value that works with all sized apps. We chose a value that was purposely
* unmapped so if you increase the global memory size make sure it doesn't
* conflict
*/
#define KGSL_MEMSTORE_TOKEN_ADDRESS 0xfff00000
#define KGSL_IOMMU_GLOBAL_MEM_BASE(__mmu) \
(test_bit(KGSL_MMU_64BIT, &(__mmu)->features) ? \
KGSL_IOMMU_GLOBAL_MEM_BASE64 : KGSL_IOMMU_GLOBAL_MEM_BASE32)