Move the base i915 buddy allocator code into drm - Move i915_buddy.h to include/drm - Move i915_buddy.c to drm root folder - Rename "i915" string with "drm" string wherever applicable - Rename "I915" string with "DRM" string wherever applicable - Fix header file dependencies - Fix alignment issues - add Makefile support for drm buddy - export functions and write kerneldoc description - Remove i915 selftest config check condition as buddy selftest will be moved to drm selftest folder cleanup i915 buddy references in i915 driver module and replace with drm buddy v2: - include header file in alphabetical order(Thomas) - merged changes listed in the body section into a single patch to keep the build intact(Christian, Jani) v3: - make drm buddy a separate module(Thomas, Christian) v4: - Fix build error reported by kernel test robot <lkp@intel.com> - removed i915 buddy selftest from i915_mock_selftests.h to avoid build error - removed selftests/i915_buddy.c file as we create a new set of buddy test cases in drm/selftests folder v5: - Fix merge conflict issue v6: - replace drm_buddy_mm structure name as drm_buddy(Thomas, Christian) - replace drm_buddy_alloc() function name as drm_buddy_alloc_blocks() (Thomas) - replace drm_buddy_free() function name as drm_buddy_free_block() (Thomas) - export drm_buddy_free_block() function - fix multiple instances of KMEM_CACHE() entry v7: - fix warnings reported by kernel test robot <lkp@intel.com> - modify the license(Christian) v8: - fix warnings reported by kernel test robot <lkp@intel.com> Signed-off-by: Arunpravin <Arunpravin.PaneerSelvam@amd.com> Acked-by: Christian König <christian.koenig@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220118104504.2349-1-Arunpravin.PaneerSelvam@amd.com Signed-off-by: Christian König <christian.koenig@amd.com>
57 lines
1.4 KiB
C
57 lines
1.4 KiB
C
/* SPDX-License-Identifier: MIT */
|
|
/*
|
|
* Copyright © 2021 Intel Corporation
|
|
*/
|
|
|
|
#ifndef __I915_TTM_BUDDY_MANAGER_H__
|
|
#define __I915_TTM_BUDDY_MANAGER_H__
|
|
|
|
#include <linux/list.h>
|
|
#include <linux/types.h>
|
|
|
|
#include <drm/ttm/ttm_resource.h>
|
|
|
|
struct ttm_device;
|
|
struct ttm_resource_manager;
|
|
struct drm_buddy;
|
|
|
|
/**
|
|
* struct i915_ttm_buddy_resource
|
|
*
|
|
* @base: struct ttm_resource base class we extend
|
|
* @blocks: the list of struct i915_buddy_block for this resource/allocation
|
|
* @mm: the struct i915_buddy_mm for this resource
|
|
*
|
|
* Extends the struct ttm_resource to manage an address space allocation with
|
|
* one or more struct i915_buddy_block.
|
|
*/
|
|
struct i915_ttm_buddy_resource {
|
|
struct ttm_resource base;
|
|
struct list_head blocks;
|
|
struct drm_buddy *mm;
|
|
};
|
|
|
|
/**
|
|
* to_ttm_buddy_resource
|
|
*
|
|
* @res: the resource to upcast
|
|
*
|
|
* Upcast the struct ttm_resource object into a struct i915_ttm_buddy_resource.
|
|
*/
|
|
static inline struct i915_ttm_buddy_resource *
|
|
to_ttm_buddy_resource(struct ttm_resource *res)
|
|
{
|
|
return container_of(res, struct i915_ttm_buddy_resource, base);
|
|
}
|
|
|
|
int i915_ttm_buddy_man_init(struct ttm_device *bdev,
|
|
unsigned type, bool use_tt,
|
|
u64 size, u64 default_page_size, u64 chunk_size);
|
|
int i915_ttm_buddy_man_fini(struct ttm_device *bdev,
|
|
unsigned int type);
|
|
|
|
int i915_ttm_buddy_man_reserve(struct ttm_resource_manager *man,
|
|
u64 start, u64 size);
|
|
|
|
#endif
|