#include <linux/shmem_fs.h>
#include <drm/ttm/ttm_placement.h>
#include <drm/ttm/ttm_tt.h>
#include <drm/drm_buddy.h>
#include "i915_drv.h"
#include "i915_ttm_buddy_manager.h"
#include "intel_memory_region.h"
#include "intel_region_ttm.h"
#include "gem/i915_gem_mman.h"
#include "gem/i915_gem_object.h"
#include "gem/i915_gem_region.h"
#include "gem/i915_gem_ttm.h"
#include "gem/i915_gem_ttm_move.h"
#include "gem/i915_gem_ttm_pm.h"
#include "gt/intel_gpu_commands.h"
#define I915_TTM_PRIO_PURGE …
#define I915_TTM_PRIO_NO_PAGES …
#define I915_TTM_PRIO_HAS_PAGES …
#define I915_TTM_PRIO_NEEDS_CPU_ACCESS …
#define I915_TTM_MAX_PLACEMENTS …
struct i915_ttm_tt { … };
static const struct ttm_place sys_placement_flags = …;
static struct ttm_placement i915_sys_placement = …;
struct ttm_placement *i915_ttm_sys_placement(void)
{ … }
static int i915_ttm_err_to_gem(int err)
{ … }
static enum ttm_caching
i915_ttm_select_tt_caching(const struct drm_i915_gem_object *obj)
{ … }
static void
i915_ttm_place_from_region(const struct intel_memory_region *mr,
struct ttm_place *place,
resource_size_t offset,
resource_size_t size,
unsigned int flags)
{ … }
static void
i915_ttm_placement_from_obj(const struct drm_i915_gem_object *obj,
struct ttm_place *places,
struct ttm_placement *placement)
{ … }
static int i915_ttm_tt_shmem_populate(struct ttm_device *bdev,
struct ttm_tt *ttm,
struct ttm_operation_ctx *ctx)
{ … }
static void i915_ttm_tt_shmem_unpopulate(struct ttm_tt *ttm)
{ … }
static void i915_ttm_tt_release(struct kref *ref)
{ … }
static const struct i915_refct_sgt_ops tt_rsgt_ops = …;
static struct ttm_tt *i915_ttm_tt_create(struct ttm_buffer_object *bo,
uint32_t page_flags)
{ … }
static int i915_ttm_tt_populate(struct ttm_device *bdev,
struct ttm_tt *ttm,
struct ttm_operation_ctx *ctx)
{ … }
static void i915_ttm_tt_unpopulate(struct ttm_device *bdev, struct ttm_tt *ttm)
{ … }
static void i915_ttm_tt_destroy(struct ttm_device *bdev, struct ttm_tt *ttm)
{ … }
static bool i915_ttm_eviction_valuable(struct ttm_buffer_object *bo,
const struct ttm_place *place)
{ … }
static void i915_ttm_evict_flags(struct ttm_buffer_object *bo,
struct ttm_placement *placement)
{ … }
void i915_ttm_free_cached_io_rsgt(struct drm_i915_gem_object *obj)
{ … }
int i915_ttm_purge(struct drm_i915_gem_object *obj)
{ … }
static int i915_ttm_shrink(struct drm_i915_gem_object *obj, unsigned int flags)
{ … }
static void i915_ttm_delete_mem_notify(struct ttm_buffer_object *bo)
{ … }
static struct i915_refct_sgt *i915_ttm_tt_get_st(struct ttm_tt *ttm)
{ … }
struct i915_refct_sgt *
i915_ttm_resource_get_st(struct drm_i915_gem_object *obj,
struct ttm_resource *res)
{ … }
static int i915_ttm_truncate(struct drm_i915_gem_object *obj)
{ … }
static void i915_ttm_swap_notify(struct ttm_buffer_object *bo)
{ … }
bool i915_ttm_resource_mappable(struct ttm_resource *res)
{ … }
static int i915_ttm_io_mem_reserve(struct ttm_device *bdev, struct ttm_resource *mem)
{ … }
static unsigned long i915_ttm_io_mem_pfn(struct ttm_buffer_object *bo,
unsigned long page_offset)
{ … }
static int i915_ttm_access_memory(struct ttm_buffer_object *bo,
unsigned long offset, void *buf,
int len, int write)
{ … }
static struct ttm_device_funcs i915_ttm_bo_driver = …;
struct ttm_device_funcs *i915_ttm_driver(void)
{ … }
static int __i915_ttm_get_pages(struct drm_i915_gem_object *obj,
struct ttm_placement *placement)
{ … }
static int i915_ttm_get_pages(struct drm_i915_gem_object *obj)
{ … }
static int __i915_ttm_migrate(struct drm_i915_gem_object *obj,
struct intel_memory_region *mr,
unsigned int flags)
{ … }
static int i915_ttm_migrate(struct drm_i915_gem_object *obj,
struct intel_memory_region *mr,
unsigned int flags)
{ … }
static void i915_ttm_put_pages(struct drm_i915_gem_object *obj,
struct sg_table *st)
{ … }
void i915_ttm_adjust_lru(struct drm_i915_gem_object *obj)
{ … }
static void i915_ttm_delayed_free(struct drm_i915_gem_object *obj)
{ … }
static vm_fault_t vm_fault_ttm(struct vm_fault *vmf)
{ … }
static int
vm_access_ttm(struct vm_area_struct *area, unsigned long addr,
void *buf, int len, int write)
{ … }
static void ttm_vm_open(struct vm_area_struct *vma)
{ … }
static void ttm_vm_close(struct vm_area_struct *vma)
{ … }
static const struct vm_operations_struct vm_ops_ttm = …;
static u64 i915_ttm_mmap_offset(struct drm_i915_gem_object *obj)
{ … }
static void i915_ttm_unmap_virtual(struct drm_i915_gem_object *obj)
{ … }
static const struct drm_i915_gem_object_ops i915_gem_ttm_obj_ops = …;
void i915_ttm_bo_destroy(struct ttm_buffer_object *bo)
{ … }
int __i915_gem_ttm_object_init(struct intel_memory_region *mem,
struct drm_i915_gem_object *obj,
resource_size_t offset,
resource_size_t size,
resource_size_t page_size,
unsigned int flags)
{ … }
static const struct intel_memory_region_ops ttm_system_region_ops = …;
struct intel_memory_region *
i915_gem_ttm_system_setup(struct drm_i915_private *i915,
u16 type, u16 instance)
{ … }