static struct kmem_cache *slab_blocks;
+static unsigned int
+gpu_buddy_block_state(struct gpu_buddy_block *block)
+{
+ return block->header & GPU_BUDDY_HEADER_STATE;
+}
+
+static bool
+gpu_buddy_block_is_allocated(struct gpu_buddy_block *block)
+{
+ return gpu_buddy_block_state(block) == GPU_BUDDY_ALLOCATED;
+}
+
+static bool
+gpu_buddy_block_is_split(struct gpu_buddy_block *block)
+{
+ return gpu_buddy_block_state(block) == GPU_BUDDY_SPLIT;
+}
+
static struct gpu_buddy_block *gpu_block_alloc(struct gpu_buddy *mm,
struct gpu_buddy_block *parent,
unsigned int order,
return 0;
}
-/**
- * gpu_get_buddy - get buddy address
- *
- * @block: GPU buddy block
- *
- * Returns the corresponding buddy block for @block, or NULL
- * if this is a root block and can't be merged further.
- * Requires some kind of locking to protect against
- * any concurrent allocate and free operations.
- */
-struct gpu_buddy_block *
-gpu_get_buddy(struct gpu_buddy_block *block)
-{
- return __get_buddy(block);
-}
-EXPORT_SYMBOL(gpu_get_buddy);
-
/**
* gpu_buddy_reset_clear - reset blocks clear state
*
return block->header & GPU_BUDDY_HEADER_ORDER;
}
-static inline unsigned int
-gpu_buddy_block_state(struct gpu_buddy_block *block)
-{
- return block->header & GPU_BUDDY_HEADER_STATE;
-}
-
static inline bool
-gpu_buddy_block_is_allocated(struct gpu_buddy_block *block)
+gpu_buddy_block_is_free(struct gpu_buddy_block *block)
{
- return gpu_buddy_block_state(block) == GPU_BUDDY_ALLOCATED;
+ return (block->header & GPU_BUDDY_HEADER_STATE) == GPU_BUDDY_FREE;
}
static inline bool
return block->header & GPU_BUDDY_HEADER_CLEAR;
}
-static inline bool
-gpu_buddy_block_is_free(struct gpu_buddy_block *block)
-{
- return gpu_buddy_block_state(block) == GPU_BUDDY_FREE;
-}
-
-static inline bool
-gpu_buddy_block_is_split(struct gpu_buddy_block *block)
-{
- return gpu_buddy_block_state(block) == GPU_BUDDY_SPLIT;
-}
-
static inline u64
gpu_buddy_block_size(struct gpu_buddy *mm,
struct gpu_buddy_block *block)
void gpu_buddy_fini(struct gpu_buddy *mm);
-struct gpu_buddy_block *
-gpu_get_buddy(struct gpu_buddy_block *block);
-
int gpu_buddy_alloc_blocks(struct gpu_buddy *mm,
u64 start, u64 end, u64 size,
u64 min_page_size,