#include <linux/highmem.h>
#include <linux/prime_numbers.h>
#include "gem/i915_gem_internal.h"
#include "gem/i915_gem_lmem.h"
#include "gem/i915_gem_region.h"
#include "gem/i915_gem_ttm.h"
#include "gem/i915_gem_ttm_move.h"
#include "gt/intel_engine_pm.h"
#include "gt/intel_gpu_commands.h"
#include "gt/intel_gt.h"
#include "gt/intel_gt_pm.h"
#include "gt/intel_migrate.h"
#include "i915_reg.h"
#include "i915_ttm_buddy_manager.h"
#include "huge_gem_object.h"
#include "i915_selftest.h"
#include "selftests/i915_random.h"
#include "selftests/igt_flush_test.h"
#include "selftests/igt_reset.h"
#include "selftests/igt_mmap.h"
struct tile { … };
static u64 swizzle_bit(unsigned int bit, u64 offset)
{ … }
static u64 tiled_offset(const struct tile *tile, u64 v)
{ … }
static int check_partial_mapping(struct drm_i915_gem_object *obj,
const struct tile *tile,
struct rnd_state *prng)
{ … }
static int check_partial_mappings(struct drm_i915_gem_object *obj,
const struct tile *tile,
unsigned long end_time)
{ … }
static unsigned int
setup_tile_size(struct tile *tile, struct drm_i915_private *i915)
{ … }
static int igt_partial_tiling(void *arg)
{ … }
static int igt_smoke_tiling(void *arg)
{ … }
static int make_obj_busy(struct drm_i915_gem_object *obj)
{ … }
static enum i915_mmap_type default_mapping(struct drm_i915_private *i915)
{ … }
static struct drm_i915_gem_object *
create_sys_or_internal(struct drm_i915_private *i915,
unsigned long size)
{ … }
static bool assert_mmap_offset(struct drm_i915_private *i915,
unsigned long size,
int expected)
{ … }
static void disable_retire_worker(struct drm_i915_private *i915)
{ … }
static void restore_retire_worker(struct drm_i915_private *i915)
{ … }
static void mmap_offset_lock(struct drm_i915_private *i915)
__acquires(&i915->drm.vma_offset_manager->vm_lock)
{ … }
static void mmap_offset_unlock(struct drm_i915_private *i915)
__releases(&i915->drm.vma_offset_manager->vm_lock)
{ … }
static int igt_mmap_offset_exhaustion(void *arg)
{ … }
static int gtt_set(struct drm_i915_gem_object *obj)
{ … }
static int gtt_check(struct drm_i915_gem_object *obj)
{ … }
static int wc_set(struct drm_i915_gem_object *obj)
{ … }
static int wc_check(struct drm_i915_gem_object *obj)
{ … }
static bool can_mmap(struct drm_i915_gem_object *obj, enum i915_mmap_type type)
{ … }
#define expand32(x) …
static int __igt_mmap(struct drm_i915_private *i915,
struct drm_i915_gem_object *obj,
enum i915_mmap_type type)
{ … }
static int igt_mmap(void *arg)
{ … }
static void igt_close_objects(struct drm_i915_private *i915,
struct list_head *objects)
{ … }
static void igt_make_evictable(struct list_head *objects)
{ … }
static int igt_fill_mappable(struct intel_memory_region *mr,
struct list_head *objects)
{ … }
static int ___igt_mmap_migrate(struct drm_i915_private *i915,
struct drm_i915_gem_object *obj,
unsigned long addr,
bool unfaultable)
{ … }
#define IGT_MMAP_MIGRATE_TOPDOWN …
#define IGT_MMAP_MIGRATE_FILL …
#define IGT_MMAP_MIGRATE_EVICTABLE …
#define IGT_MMAP_MIGRATE_UNFAULTABLE …
#define IGT_MMAP_MIGRATE_FAIL_GPU …
static int __igt_mmap_migrate(struct intel_memory_region **placements,
int n_placements,
struct intel_memory_region *expected_mr,
unsigned int flags)
{ … }
static int igt_mmap_migrate(void *arg)
{ … }
static const char *repr_mmap_type(enum i915_mmap_type type)
{ … }
static bool can_access(struct drm_i915_gem_object *obj)
{ … }
static int __igt_mmap_access(struct drm_i915_private *i915,
struct drm_i915_gem_object *obj,
enum i915_mmap_type type)
{ … }
static int igt_mmap_access(void *arg)
{ … }
static int __igt_mmap_gpu(struct drm_i915_private *i915,
struct drm_i915_gem_object *obj,
enum i915_mmap_type type)
{ … }
static int igt_mmap_gpu(void *arg)
{ … }
static int check_present_pte(pte_t *pte, unsigned long addr, void *data)
{ … }
static int check_absent_pte(pte_t *pte, unsigned long addr, void *data)
{ … }
static int check_present(unsigned long addr, unsigned long len)
{ … }
static int check_absent(unsigned long addr, unsigned long len)
{ … }
static int prefault_range(u64 start, u64 len)
{ … }
static int __igt_mmap_revoke(struct drm_i915_private *i915,
struct drm_i915_gem_object *obj,
enum i915_mmap_type type)
{ … }
static int igt_mmap_revoke(void *arg)
{ … }
int i915_gem_mman_live_selftests(struct drm_i915_private *i915)
{ … }