mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 01:49:46 +00:00
dma-buf: system_heap: Allow specifying maximum allocation order
system_heap.max_order=<uint> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
This commit is contained in:
committed by
Dom Cobley
parent
190d9ce168
commit
ca56df0d9d
@@ -49,9 +49,15 @@ static gfp_t order_flags[] = {HIGH_ORDER_GFP, HIGH_ORDER_GFP, LOW_ORDER_GFP};
|
||||
* of order 0 pages can significantly improve the performance of many IOMMUs
|
||||
* by reducing TLB pressure and time spent updating page tables.
|
||||
*/
|
||||
static const unsigned int orders[] = {8, 4, 0};
|
||||
#define MAX_ORDERS_VALUE 8
|
||||
static const unsigned int orders[] = {MAX_ORDERS_VALUE, 4, 0};
|
||||
#define NUM_ORDERS ARRAY_SIZE(orders)
|
||||
|
||||
static unsigned int module_max_order = MAX_ORDERS_VALUE;
|
||||
|
||||
module_param_named(max_order, module_max_order, uint, 0400);
|
||||
MODULE_PARM_DESC(max_order, "Maximum allocation order override.");
|
||||
|
||||
static int dup_sg_table(struct sg_table *from, struct sg_table *to)
|
||||
{
|
||||
struct scatterlist *sg, *new_sg;
|
||||
@@ -328,7 +334,7 @@ static struct dma_buf *system_heap_allocate(struct dma_heap *heap,
|
||||
struct system_heap_buffer *buffer;
|
||||
DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
|
||||
unsigned long size_remaining = len;
|
||||
unsigned int max_order = orders[0];
|
||||
unsigned int max_order = module_max_order;
|
||||
struct dma_buf *dmabuf;
|
||||
struct sg_table *table;
|
||||
struct scatterlist *sg;
|
||||
@@ -423,6 +429,9 @@ static int __init system_heap_create(void)
|
||||
if (IS_ERR(sys_heap))
|
||||
return PTR_ERR(sys_heap);
|
||||
|
||||
if (module_max_order > orders[0])
|
||||
module_max_order = orders[0];
|
||||
|
||||
return 0;
|
||||
}
|
||||
module_init(system_heap_create);
|
||||
|
||||
Reference in New Issue
Block a user