summaryrefstree
path: root/kernel/drivers/vision/vpu/include/vpu-slab.h
blob: 56f2e7f4ada34f60e3dc51d1b305cafe00fb8f32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
 * Samsung Exynos SoC series VPU driver
 *
 * Copyright (c) 2015 Samsung Electronics Co., Ltd
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */


#ifndef VPU_SLAB_H_
#define VPU_SLAB_H_

#define VPU_SLAB_MAX_LEVEL		3
#define VPU_SLAB_LEVEL0_SIZE		64
#define VPU_SLAB_LEVEL1_SIZE		512
#define VPU_SLAB_LEVEL2_SIZE		32768

struct vpu_slab_allocator {
	u32				cache_size[VPU_SLAB_MAX_LEVEL];
	struct kmem_cache		*cache[VPU_SLAB_MAX_LEVEL];
};

int vpu_slab_init(struct vpu_slab_allocator *allocator);
int vpu_slab_alloc(struct vpu_slab_allocator *allocator, void **target, size_t size);
int vpu_slab_free(struct vpu_slab_allocator *allocator, void *target, size_t size);

#endif