db2268ea26be621725bf72bfb1ae4bbe726b1854
[openwrt/staging/linusw.git] /
1 From 56fda5adce0c9b4dc8ff2c7be9a704599e685001 Mon Sep 17 00:00:00 2001
2 From: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
3 Date: Wed, 17 Jul 2024 09:33:21 +0100
4 Subject: [PATCH 1341/1350] dma-buf: system_heap: Allow specifying maximum
5 allocation order
6
7 system_heap.max_order=<uint>
8
9 Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
10 ---
11 drivers/dma-buf/heaps/system_heap.c | 10 +++++++++-
12 1 file changed, 9 insertions(+), 1 deletion(-)
13
14 --- a/drivers/dma-buf/heaps/system_heap.c
15 +++ b/drivers/dma-buf/heaps/system_heap.c
16 @@ -54,6 +54,11 @@ static gfp_t order_flags[] = {HIGH_ORDER
17 static const unsigned int orders[] = {8, 4, 0};
18 #define NUM_ORDERS ARRAY_SIZE(orders)
19
20 +static unsigned int module_max_order = orders[0];
21 +
22 +module_param_named(max_order, module_max_order, uint, 0400);
23 +MODULE_PARM_DESC(max_order, "Maximum allocation order override.");
24 +
25 static struct sg_table *dup_sg_table(struct sg_table *table)
26 {
27 struct sg_table *new_table;
28 @@ -339,7 +344,7 @@ static struct dma_buf *system_heap_alloc
29 struct system_heap_buffer *buffer;
30 DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
31 unsigned long size_remaining = len;
32 - unsigned int max_order = orders[0];
33 + unsigned int max_order = module_max_order;
34 struct dma_buf *dmabuf;
35 struct sg_table *table;
36 struct scatterlist *sg;
37 @@ -433,6 +438,9 @@ static int system_heap_create(void)
38 if (IS_ERR(sys_heap))
39 return PTR_ERR(sys_heap);
40
41 + if (module_max_order > orders[0])
42 + module_max_order = orders[0];
43 +
44 return 0;
45 }
46 module_init(system_heap_create);