Loading Documentation/devicetree/bindings/arm/msm/msm_ion.txt +4 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,10 @@ Optional properties for Ion heaps - qti,memory-reservation-size: size of reserved memory for the ION heap. - qti,memory-reservation-type: type of memory to be reserved (see memory-reserve.txt for information about memory reservations) - qti,default-prefetch-size: Base value to be used for prefetching optimizations. Ignored if the heap does not support prefetching. Will set to a reasonable default value (e.g. the maximum heap size) if this option is not set. Example: qti,ion { Loading drivers/gpu/ion/ion_cma_secure_heap.c +10 −1 Original line number Diff line number Diff line Loading @@ -87,6 +87,7 @@ struct ion_cma_secure_heap { atomic_t total_allocated; atomic_t total_pool_size; unsigned long heap_size; unsigned long default_prefetch_size; }; static void ion_secure_pool_pages(struct work_struct *work); Loading Loading @@ -219,6 +220,9 @@ int ion_secure_cma_prefetch(struct ion_heap *heap, void *data) if ((int) heap->type != ION_HEAP_TYPE_SECURE_DMA) return -EINVAL; if (len == 0) len = sheap->default_prefetch_size; /* * Only prefetch as much space as there is left in the pool so * check against the current free size of the heap. Loading Loading @@ -655,14 +659,19 @@ struct ion_heap *ion_secure_cma_heap_create(struct ion_platform_heap *data) sheap->shrinker.seeks = DEFAULT_SEEKS; sheap->shrinker.batch = 0; sheap->shrinker.shrink = ion_secure_cma_shrinker; sheap->default_prefetch_size = sheap->heap_size; register_shrinker(&sheap->shrinker); if (!sheap->bitmap) { kfree(sheap); return ERR_PTR(-ENOMEM); } if (data->extra_data) { struct ion_cma_pdata *extra = data->extra_data; sheap->default_prefetch_size = extra->default_prefetch_size; } /* * we initially mark everything in the allocator as being free so that * allocations can come in later Loading drivers/gpu/ion/msm/msm_ion.c +26 −2 Original line number Diff line number Diff line Loading @@ -414,7 +414,8 @@ static void check_for_heap_overlap(const struct ion_platform_heap heap_list[], } #ifdef CONFIG_OF static int msm_init_extra_data(struct ion_platform_heap *heap, static int msm_init_extra_data(struct device_node *node, struct ion_platform_heap *heap, const struct ion_heap_desc *heap_desc) { int ret = 0; Loading @@ -440,6 +441,28 @@ static int msm_init_extra_data(struct ion_platform_heap *heap, ret = -ENOMEM; break; } case ION_HEAP_TYPE_SECURE_DMA: { unsigned int val; ret = of_property_read_u32(node, "qti,default-prefetch-size", &val); if (!ret) { heap->extra_data = kzalloc(sizeof(struct ion_cma_pdata), GFP_KERNEL); if (!heap->extra_data) { ret = -ENOMEM; } else { struct ion_cma_pdata *extra = heap->extra_data; extra->default_prefetch_size = val; } } else { ret = 0; } break; } default: heap->extra_data = 0; break; Loading Loading @@ -499,7 +522,8 @@ static int msm_ion_populate_heap(struct device_node *node, if (ret) break; heap->type = heap_type; ret = msm_init_extra_data(heap, &ion_heap_meta[i]); ret = msm_init_extra_data(node, heap, &ion_heap_meta[i]); break; } } Loading include/linux/msm_ion.h +8 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,14 @@ struct ion_co_heap_pdata { void *(*setup_region)(void); }; /** * struct ion_cma_pdata - extra data for CMA regions * @default_prefetch_size - default size to use for prefetching */ struct ion_cma_pdata { unsigned long default_prefetch_size; }; #ifdef CONFIG_ION /** * msm_ion_client_create - allocate a client using the ion_device specified in Loading Loading
Documentation/devicetree/bindings/arm/msm/msm_ion.txt +4 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,10 @@ Optional properties for Ion heaps - qti,memory-reservation-size: size of reserved memory for the ION heap. - qti,memory-reservation-type: type of memory to be reserved (see memory-reserve.txt for information about memory reservations) - qti,default-prefetch-size: Base value to be used for prefetching optimizations. Ignored if the heap does not support prefetching. Will set to a reasonable default value (e.g. the maximum heap size) if this option is not set. Example: qti,ion { Loading
drivers/gpu/ion/ion_cma_secure_heap.c +10 −1 Original line number Diff line number Diff line Loading @@ -87,6 +87,7 @@ struct ion_cma_secure_heap { atomic_t total_allocated; atomic_t total_pool_size; unsigned long heap_size; unsigned long default_prefetch_size; }; static void ion_secure_pool_pages(struct work_struct *work); Loading Loading @@ -219,6 +220,9 @@ int ion_secure_cma_prefetch(struct ion_heap *heap, void *data) if ((int) heap->type != ION_HEAP_TYPE_SECURE_DMA) return -EINVAL; if (len == 0) len = sheap->default_prefetch_size; /* * Only prefetch as much space as there is left in the pool so * check against the current free size of the heap. Loading Loading @@ -655,14 +659,19 @@ struct ion_heap *ion_secure_cma_heap_create(struct ion_platform_heap *data) sheap->shrinker.seeks = DEFAULT_SEEKS; sheap->shrinker.batch = 0; sheap->shrinker.shrink = ion_secure_cma_shrinker; sheap->default_prefetch_size = sheap->heap_size; register_shrinker(&sheap->shrinker); if (!sheap->bitmap) { kfree(sheap); return ERR_PTR(-ENOMEM); } if (data->extra_data) { struct ion_cma_pdata *extra = data->extra_data; sheap->default_prefetch_size = extra->default_prefetch_size; } /* * we initially mark everything in the allocator as being free so that * allocations can come in later Loading
drivers/gpu/ion/msm/msm_ion.c +26 −2 Original line number Diff line number Diff line Loading @@ -414,7 +414,8 @@ static void check_for_heap_overlap(const struct ion_platform_heap heap_list[], } #ifdef CONFIG_OF static int msm_init_extra_data(struct ion_platform_heap *heap, static int msm_init_extra_data(struct device_node *node, struct ion_platform_heap *heap, const struct ion_heap_desc *heap_desc) { int ret = 0; Loading @@ -440,6 +441,28 @@ static int msm_init_extra_data(struct ion_platform_heap *heap, ret = -ENOMEM; break; } case ION_HEAP_TYPE_SECURE_DMA: { unsigned int val; ret = of_property_read_u32(node, "qti,default-prefetch-size", &val); if (!ret) { heap->extra_data = kzalloc(sizeof(struct ion_cma_pdata), GFP_KERNEL); if (!heap->extra_data) { ret = -ENOMEM; } else { struct ion_cma_pdata *extra = heap->extra_data; extra->default_prefetch_size = val; } } else { ret = 0; } break; } default: heap->extra_data = 0; break; Loading Loading @@ -499,7 +522,8 @@ static int msm_ion_populate_heap(struct device_node *node, if (ret) break; heap->type = heap_type; ret = msm_init_extra_data(heap, &ion_heap_meta[i]); ret = msm_init_extra_data(node, heap, &ion_heap_meta[i]); break; } } Loading
include/linux/msm_ion.h +8 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,14 @@ struct ion_co_heap_pdata { void *(*setup_region)(void); }; /** * struct ion_cma_pdata - extra data for CMA regions * @default_prefetch_size - default size to use for prefetching */ struct ion_cma_pdata { unsigned long default_prefetch_size; }; #ifdef CONFIG_ION /** * msm_ion_client_create - allocate a client using the ion_device specified in Loading