#include <linux/prime_numbers.h>
#include <linux/string_helpers.h>
#include <linux/swap.h>
#include "i915_selftest.h"
#include "gem/i915_gem_internal.h"
#include "gem/i915_gem_lmem.h"
#include "gem/i915_gem_pm.h"
#include "gem/i915_gem_region.h"
#include "gt/intel_gt.h"
#include "igt_gem_utils.h"
#include "mock_context.h"
#include "selftests/mock_drm.h"
#include "selftests/mock_gem_device.h"
#include "selftests/mock_region.h"
#include "selftests/i915_random.h"
static struct i915_gem_context *hugepage_ctx(struct drm_i915_private *i915,
struct file *file)
{ … }
static const unsigned int page_sizes[] = …;
static unsigned int get_largest_page_size(struct drm_i915_private *i915,
u64 rem)
{ … }
static void huge_pages_free_pages(struct sg_table *st)
{ … }
static int get_huge_pages(struct drm_i915_gem_object *obj)
{ … }
static void put_huge_pages(struct drm_i915_gem_object *obj,
struct sg_table *pages)
{ … }
static const struct drm_i915_gem_object_ops huge_page_ops = …;
static struct drm_i915_gem_object *
huge_pages_object(struct drm_i915_private *i915,
u64 size,
unsigned int page_mask)
{ … }
static int fake_get_huge_pages(struct drm_i915_gem_object *obj)
{ … }
static int fake_get_huge_pages_single(struct drm_i915_gem_object *obj)
{ … }
static void fake_free_huge_pages(struct drm_i915_gem_object *obj,
struct sg_table *pages)
{ … }
static void fake_put_huge_pages(struct drm_i915_gem_object *obj,
struct sg_table *pages)
{ … }
static const struct drm_i915_gem_object_ops fake_ops = …;
static const struct drm_i915_gem_object_ops fake_ops_single = …;
static struct drm_i915_gem_object *
fake_huge_pages_object(struct drm_i915_private *i915, u64 size, bool single)
{ … }
static int igt_check_page_sizes(struct i915_vma *vma)
{ … }
static int igt_mock_exhaust_device_supported_pages(void *arg)
{ … }
static int igt_mock_memory_region_huge_pages(void *arg)
{ … }
static int igt_mock_ppgtt_misaligned_dma(void *arg)
{ … }
static void close_object_list(struct list_head *objects)
{ … }
static int igt_ppgtt_huge_fill(void *arg)
{ … }
static int igt_ppgtt_64K(void *arg)
{ … }
static int gpu_write(struct intel_context *ce,
struct i915_vma *vma,
u32 dw,
u32 val)
{ … }
static int
__cpu_check_shmem(struct drm_i915_gem_object *obj, u32 dword, u32 val)
{ … }
static int __cpu_check_vmap(struct drm_i915_gem_object *obj, u32 dword, u32 val)
{ … }
static int cpu_check(struct drm_i915_gem_object *obj, u32 dword, u32 val)
{ … }
static int __igt_write_huge(struct intel_context *ce,
struct drm_i915_gem_object *obj,
u64 size, u64 offset,
u32 dword, u32 val)
{ … }
static int igt_write_huge(struct drm_i915_private *i915,
struct drm_i915_gem_object *obj)
{ … }
igt_create_fn;
static inline bool igt_can_allocate_thp(struct drm_i915_private *i915)
{ … }
static struct drm_i915_gem_object *
igt_create_shmem(struct drm_i915_private *i915, u32 size, u32 flags)
{ … }
static struct drm_i915_gem_object *
igt_create_internal(struct drm_i915_private *i915, u32 size, u32 flags)
{ … }
static struct drm_i915_gem_object *
igt_create_system(struct drm_i915_private *i915, u32 size, u32 flags)
{ … }
static struct drm_i915_gem_object *
igt_create_local(struct drm_i915_private *i915, u32 size, u32 flags)
{ … }
static u32 igt_random_size(struct rnd_state *prng,
u32 min_page_size,
u32 max_page_size)
{ … }
static int igt_ppgtt_smoke_huge(void *arg)
{ … }
static int igt_ppgtt_sanity_check(void *arg)
{ … }
static int igt_ppgtt_compact(void *arg)
{ … }
static int igt_ppgtt_mixed(void *arg)
{ … }
static int igt_tmpfs_fallback(void *arg)
{ … }
static int igt_shrink_thp(void *arg)
{ … }
int i915_gem_huge_page_mock_selftests(void)
{ … }
int i915_gem_huge_page_live_selftests(struct drm_i915_private *i915)
{ … }