Commit ab53497b authored by Chris Wilson's avatar Chris Wilson

drm/i915: Rename i915_hw_ppgtt to i915_ppgtt

Keeping the _hw_ in there does not help to distinguish it from its
only brethren i915_ggtt, so drop it.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190611091238.15808-2-chris@chris-wilson.co.uk
parent e568ac38
...@@ -513,7 +513,7 @@ i915_gem_create_context(struct drm_i915_private *dev_priv, unsigned int flags) ...@@ -513,7 +513,7 @@ i915_gem_create_context(struct drm_i915_private *dev_priv, unsigned int flags)
return ctx; return ctx;
if (HAS_FULL_PPGTT(dev_priv)) { if (HAS_FULL_PPGTT(dev_priv)) {
struct i915_hw_ppgtt *ppgtt; struct i915_ppgtt *ppgtt;
ppgtt = i915_ppgtt_create(dev_priv); ppgtt = i915_ppgtt_create(dev_priv);
if (IS_ERR(ppgtt)) { if (IS_ERR(ppgtt)) {
...@@ -818,7 +818,7 @@ int i915_gem_vm_create_ioctl(struct drm_device *dev, void *data, ...@@ -818,7 +818,7 @@ int i915_gem_vm_create_ioctl(struct drm_device *dev, void *data,
struct drm_i915_private *i915 = to_i915(dev); struct drm_i915_private *i915 = to_i915(dev);
struct drm_i915_gem_vm_control *args = data; struct drm_i915_gem_vm_control *args = data;
struct drm_i915_file_private *file_priv = file->driver_priv; struct drm_i915_file_private *file_priv = file->driver_priv;
struct i915_hw_ppgtt *ppgtt; struct i915_ppgtt *ppgtt;
int err; int err;
if (!HAS_FULL_PPGTT(i915)) if (!HAS_FULL_PPGTT(i915))
...@@ -1037,7 +1037,7 @@ static int emit_ppgtt_update(struct i915_request *rq, void *data) ...@@ -1037,7 +1037,7 @@ static int emit_ppgtt_update(struct i915_request *rq, void *data)
int i; int i;
if (i915_vm_is_4lvl(vm)) { if (i915_vm_is_4lvl(vm)) {
struct i915_hw_ppgtt *ppgtt = i915_vm_to_ppgtt(vm); struct i915_ppgtt *ppgtt = i915_vm_to_ppgtt(vm);
const dma_addr_t pd_daddr = px_dma(&ppgtt->pml4); const dma_addr_t pd_daddr = px_dma(&ppgtt->pml4);
cs = intel_ring_begin(rq, 6); cs = intel_ring_begin(rq, 6);
...@@ -1054,7 +1054,7 @@ static int emit_ppgtt_update(struct i915_request *rq, void *data) ...@@ -1054,7 +1054,7 @@ static int emit_ppgtt_update(struct i915_request *rq, void *data)
*cs++ = MI_NOOP; *cs++ = MI_NOOP;
intel_ring_advance(rq, cs); intel_ring_advance(rq, cs);
} else if (HAS_LOGICAL_RING_CONTEXTS(engine->i915)) { } else if (HAS_LOGICAL_RING_CONTEXTS(engine->i915)) {
struct i915_hw_ppgtt *ppgtt = i915_vm_to_ppgtt(vm); struct i915_ppgtt *ppgtt = i915_vm_to_ppgtt(vm);
cs = intel_ring_begin(rq, 4 * GEN8_3LVL_PDPES + 2); cs = intel_ring_begin(rq, 4 * GEN8_3LVL_PDPES + 2);
if (IS_ERR(cs)) if (IS_ERR(cs))
......
...@@ -368,7 +368,7 @@ static int igt_check_page_sizes(struct i915_vma *vma) ...@@ -368,7 +368,7 @@ static int igt_check_page_sizes(struct i915_vma *vma)
static int igt_mock_exhaust_device_supported_pages(void *arg) static int igt_mock_exhaust_device_supported_pages(void *arg)
{ {
struct i915_hw_ppgtt *ppgtt = arg; struct i915_ppgtt *ppgtt = arg;
struct drm_i915_private *i915 = ppgtt->vm.i915; struct drm_i915_private *i915 = ppgtt->vm.i915;
unsigned int saved_mask = INTEL_INFO(i915)->page_sizes; unsigned int saved_mask = INTEL_INFO(i915)->page_sizes;
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
...@@ -447,7 +447,7 @@ static int igt_mock_exhaust_device_supported_pages(void *arg) ...@@ -447,7 +447,7 @@ static int igt_mock_exhaust_device_supported_pages(void *arg)
static int igt_mock_ppgtt_misaligned_dma(void *arg) static int igt_mock_ppgtt_misaligned_dma(void *arg)
{ {
struct i915_hw_ppgtt *ppgtt = arg; struct i915_ppgtt *ppgtt = arg;
struct drm_i915_private *i915 = ppgtt->vm.i915; struct drm_i915_private *i915 = ppgtt->vm.i915;
unsigned long supported = INTEL_INFO(i915)->page_sizes; unsigned long supported = INTEL_INFO(i915)->page_sizes;
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
...@@ -575,7 +575,7 @@ static int igt_mock_ppgtt_misaligned_dma(void *arg) ...@@ -575,7 +575,7 @@ static int igt_mock_ppgtt_misaligned_dma(void *arg)
} }
static void close_object_list(struct list_head *objects, static void close_object_list(struct list_head *objects,
struct i915_hw_ppgtt *ppgtt) struct i915_ppgtt *ppgtt)
{ {
struct drm_i915_gem_object *obj, *on; struct drm_i915_gem_object *obj, *on;
...@@ -595,7 +595,7 @@ static void close_object_list(struct list_head *objects, ...@@ -595,7 +595,7 @@ static void close_object_list(struct list_head *objects,
static int igt_mock_ppgtt_huge_fill(void *arg) static int igt_mock_ppgtt_huge_fill(void *arg)
{ {
struct i915_hw_ppgtt *ppgtt = arg; struct i915_ppgtt *ppgtt = arg;
struct drm_i915_private *i915 = ppgtt->vm.i915; struct drm_i915_private *i915 = ppgtt->vm.i915;
unsigned long max_pages = ppgtt->vm.total >> PAGE_SHIFT; unsigned long max_pages = ppgtt->vm.total >> PAGE_SHIFT;
unsigned long page_num; unsigned long page_num;
...@@ -716,7 +716,7 @@ static int igt_mock_ppgtt_huge_fill(void *arg) ...@@ -716,7 +716,7 @@ static int igt_mock_ppgtt_huge_fill(void *arg)
static int igt_mock_ppgtt_64K(void *arg) static int igt_mock_ppgtt_64K(void *arg)
{ {
struct i915_hw_ppgtt *ppgtt = arg; struct i915_ppgtt *ppgtt = arg;
struct drm_i915_private *i915 = ppgtt->vm.i915; struct drm_i915_private *i915 = ppgtt->vm.i915;
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
const struct object_info { const struct object_info {
...@@ -1683,7 +1683,7 @@ int i915_gem_huge_page_mock_selftests(void) ...@@ -1683,7 +1683,7 @@ int i915_gem_huge_page_mock_selftests(void)
SUBTEST(igt_mock_ppgtt_64K), SUBTEST(igt_mock_ppgtt_64K),
}; };
struct drm_i915_private *dev_priv; struct drm_i915_private *dev_priv;
struct i915_hw_ppgtt *ppgtt; struct i915_ppgtt *ppgtt;
int err; int err;
dev_priv = mock_gem_device(); dev_priv = mock_gem_device();
......
...@@ -38,7 +38,7 @@ mock_context(struct drm_i915_private *i915, ...@@ -38,7 +38,7 @@ mock_context(struct drm_i915_private *i915,
goto err_engines; goto err_engines;
if (name) { if (name) {
struct i915_hw_ppgtt *ppgtt; struct i915_ppgtt *ppgtt;
ctx->name = kstrdup(name, GFP_KERNEL); ctx->name = kstrdup(name, GFP_KERNEL);
if (!ctx->name) if (!ctx->name)
......
...@@ -1621,7 +1621,7 @@ static int gen8_emit_init_breadcrumb(struct i915_request *rq) ...@@ -1621,7 +1621,7 @@ static int gen8_emit_init_breadcrumb(struct i915_request *rq)
static int emit_pdps(struct i915_request *rq) static int emit_pdps(struct i915_request *rq)
{ {
const struct intel_engine_cs * const engine = rq->engine; const struct intel_engine_cs * const engine = rq->engine;
struct i915_hw_ppgtt * const ppgtt = struct i915_ppgtt * const ppgtt =
i915_vm_to_ppgtt(rq->gem_context->vm); i915_vm_to_ppgtt(rq->gem_context->vm);
int err, i; int err, i;
u32 *cs; u32 *cs;
...@@ -2825,7 +2825,7 @@ static void execlists_init_reg_state(u32 *regs, ...@@ -2825,7 +2825,7 @@ static void execlists_init_reg_state(u32 *regs,
struct intel_engine_cs *engine, struct intel_engine_cs *engine,
struct intel_ring *ring) struct intel_ring *ring)
{ {
struct i915_hw_ppgtt *ppgtt = i915_vm_to_ppgtt(ce->gem_context->vm); struct i915_ppgtt *ppgtt = i915_vm_to_ppgtt(ce->gem_context->vm);
bool rcs = engine->class == RENDER_CLASS; bool rcs = engine->class == RENDER_CLASS;
u32 base = engine->mmio_base; u32 base = engine->mmio_base;
......
...@@ -1508,8 +1508,7 @@ static const struct intel_context_ops ring_context_ops = { ...@@ -1508,8 +1508,7 @@ static const struct intel_context_ops ring_context_ops = {
.destroy = ring_context_destroy, .destroy = ring_context_destroy,
}; };
static int load_pd_dir(struct i915_request *rq, static int load_pd_dir(struct i915_request *rq, const struct i915_ppgtt *ppgtt)
const struct i915_hw_ppgtt *ppgtt)
{ {
const struct intel_engine_cs * const engine = rq->engine; const struct intel_engine_cs * const engine = rq->engine;
u32 *cs; u32 *cs;
...@@ -1713,7 +1712,7 @@ static int switch_context(struct i915_request *rq) ...@@ -1713,7 +1712,7 @@ static int switch_context(struct i915_request *rq)
GEM_BUG_ON(HAS_EXECLISTS(rq->i915)); GEM_BUG_ON(HAS_EXECLISTS(rq->i915));
if (vm) { if (vm) {
struct i915_hw_ppgtt *ppgtt = i915_vm_to_ppgtt(vm); struct i915_ppgtt *ppgtt = i915_vm_to_ppgtt(vm);
int loops; int loops;
/* /*
......
...@@ -368,7 +368,7 @@ static int set_context_ppgtt_from_shadow(struct intel_vgpu_workload *workload, ...@@ -368,7 +368,7 @@ static int set_context_ppgtt_from_shadow(struct intel_vgpu_workload *workload,
struct i915_gem_context *ctx) struct i915_gem_context *ctx)
{ {
struct intel_vgpu_mm *mm = workload->shadow_mm; struct intel_vgpu_mm *mm = workload->shadow_mm;
struct i915_hw_ppgtt *ppgtt = i915_vm_to_ppgtt(ctx->vm); struct i915_ppgtt *ppgtt = i915_vm_to_ppgtt(ctx->vm);
int i = 0; int i = 0;
if (mm->type != INTEL_GVT_MM_PPGTT || !mm->ppgtt_mm.shadowed) if (mm->type != INTEL_GVT_MM_PPGTT || !mm->ppgtt_mm.shadowed)
...@@ -1102,7 +1102,7 @@ int intel_gvt_init_workload_scheduler(struct intel_gvt *gvt) ...@@ -1102,7 +1102,7 @@ int intel_gvt_init_workload_scheduler(struct intel_gvt *gvt)
static void static void
i915_context_ppgtt_root_restore(struct intel_vgpu_submission *s, i915_context_ppgtt_root_restore(struct intel_vgpu_submission *s,
struct i915_hw_ppgtt *ppgtt) struct i915_ppgtt *ppgtt)
{ {
int i; int i;
...@@ -1160,7 +1160,7 @@ void intel_vgpu_reset_submission(struct intel_vgpu *vgpu, ...@@ -1160,7 +1160,7 @@ void intel_vgpu_reset_submission(struct intel_vgpu *vgpu,
static void static void
i915_context_ppgtt_root_save(struct intel_vgpu_submission *s, i915_context_ppgtt_root_save(struct intel_vgpu_submission *s,
struct i915_hw_ppgtt *ppgtt) struct i915_ppgtt *ppgtt)
{ {
int i; int i;
......
...@@ -792,7 +792,7 @@ struct i915_gem_mm { ...@@ -792,7 +792,7 @@ struct i915_gem_mm {
struct vfsmount *gemfs; struct vfsmount *gemfs;
/** PPGTT used for aliasing the PPGTT with the GTT */ /** PPGTT used for aliasing the PPGTT with the GTT */
struct i915_hw_ppgtt *aliasing_ppgtt; struct i915_ppgtt *aliasing_ppgtt;
struct notifier_block oom_notifier; struct notifier_block oom_notifier;
struct notifier_block vmap_notifier; struct notifier_block vmap_notifier;
......
...@@ -803,7 +803,7 @@ static void gen8_initialize_pml4(struct i915_address_space *vm, ...@@ -803,7 +803,7 @@ static void gen8_initialize_pml4(struct i915_address_space *vm,
* context switching/execlist queuing code takes extra steps * context switching/execlist queuing code takes extra steps
* to ensure that tlbs are flushed. * to ensure that tlbs are flushed.
*/ */
static void mark_tlbs_dirty(struct i915_hw_ppgtt *ppgtt) static void mark_tlbs_dirty(struct i915_ppgtt *ppgtt)
{ {
ppgtt->pd_dirty_engines = ALL_ENGINES; ppgtt->pd_dirty_engines = ALL_ENGINES;
} }
...@@ -944,7 +944,7 @@ static void gen8_ppgtt_set_pml4e(struct i915_pml4 *pml4, ...@@ -944,7 +944,7 @@ static void gen8_ppgtt_set_pml4e(struct i915_pml4 *pml4,
static void gen8_ppgtt_clear_4lvl(struct i915_address_space *vm, static void gen8_ppgtt_clear_4lvl(struct i915_address_space *vm,
u64 start, u64 length) u64 start, u64 length)
{ {
struct i915_hw_ppgtt *ppgtt = i915_vm_to_ppgtt(vm); struct i915_ppgtt *ppgtt = i915_vm_to_ppgtt(vm);
struct i915_pml4 *pml4 = &ppgtt->pml4; struct i915_pml4 *pml4 = &ppgtt->pml4;
struct i915_page_directory_pointer *pdp; struct i915_page_directory_pointer *pdp;
unsigned int pml4e; unsigned int pml4e;
...@@ -997,7 +997,7 @@ static __always_inline struct gen8_insert_pte gen8_insert_pte(u64 start) ...@@ -997,7 +997,7 @@ static __always_inline struct gen8_insert_pte gen8_insert_pte(u64 start)
} }
static __always_inline bool static __always_inline bool
gen8_ppgtt_insert_pte_entries(struct i915_hw_ppgtt *ppgtt, gen8_ppgtt_insert_pte_entries(struct i915_ppgtt *ppgtt,
struct i915_page_directory_pointer *pdp, struct i915_page_directory_pointer *pdp,
struct sgt_dma *iter, struct sgt_dma *iter,
struct gen8_insert_pte *idx, struct gen8_insert_pte *idx,
...@@ -1058,7 +1058,7 @@ static void gen8_ppgtt_insert_3lvl(struct i915_address_space *vm, ...@@ -1058,7 +1058,7 @@ static void gen8_ppgtt_insert_3lvl(struct i915_address_space *vm,
enum i915_cache_level cache_level, enum i915_cache_level cache_level,
u32 flags) u32 flags)
{ {
struct i915_hw_ppgtt *ppgtt = i915_vm_to_ppgtt(vm); struct i915_ppgtt *ppgtt = i915_vm_to_ppgtt(vm);
struct sgt_dma iter = sgt_dma(vma); struct sgt_dma iter = sgt_dma(vma);
struct gen8_insert_pte idx = gen8_insert_pte(vma->node.start); struct gen8_insert_pte idx = gen8_insert_pte(vma->node.start);
...@@ -1192,7 +1192,7 @@ static void gen8_ppgtt_insert_4lvl(struct i915_address_space *vm, ...@@ -1192,7 +1192,7 @@ static void gen8_ppgtt_insert_4lvl(struct i915_address_space *vm,
enum i915_cache_level cache_level, enum i915_cache_level cache_level,
u32 flags) u32 flags)
{ {
struct i915_hw_ppgtt *ppgtt = i915_vm_to_ppgtt(vm); struct i915_ppgtt *ppgtt = i915_vm_to_ppgtt(vm);
struct sgt_dma iter = sgt_dma(vma); struct sgt_dma iter = sgt_dma(vma);
struct i915_page_directory_pointer **pdps = ppgtt->pml4.pdps; struct i915_page_directory_pointer **pdps = ppgtt->pml4.pdps;
...@@ -1291,7 +1291,7 @@ static int gen8_init_scratch(struct i915_address_space *vm) ...@@ -1291,7 +1291,7 @@ static int gen8_init_scratch(struct i915_address_space *vm)
return ret; return ret;
} }
static int gen8_ppgtt_notify_vgt(struct i915_hw_ppgtt *ppgtt, bool create) static int gen8_ppgtt_notify_vgt(struct i915_ppgtt *ppgtt, bool create)
{ {
struct i915_address_space *vm = &ppgtt->vm; struct i915_address_space *vm = &ppgtt->vm;
struct drm_i915_private *dev_priv = vm->i915; struct drm_i915_private *dev_priv = vm->i915;
...@@ -1352,7 +1352,7 @@ static void gen8_ppgtt_cleanup_3lvl(struct i915_address_space *vm, ...@@ -1352,7 +1352,7 @@ static void gen8_ppgtt_cleanup_3lvl(struct i915_address_space *vm,
free_pdp(vm, pdp); free_pdp(vm, pdp);
} }
static void gen8_ppgtt_cleanup_4lvl(struct i915_hw_ppgtt *ppgtt) static void gen8_ppgtt_cleanup_4lvl(struct i915_ppgtt *ppgtt)
{ {
int i; int i;
...@@ -1369,7 +1369,7 @@ static void gen8_ppgtt_cleanup_4lvl(struct i915_hw_ppgtt *ppgtt) ...@@ -1369,7 +1369,7 @@ static void gen8_ppgtt_cleanup_4lvl(struct i915_hw_ppgtt *ppgtt)
static void gen8_ppgtt_cleanup(struct i915_address_space *vm) static void gen8_ppgtt_cleanup(struct i915_address_space *vm)
{ {
struct drm_i915_private *i915 = vm->i915; struct drm_i915_private *i915 = vm->i915;
struct i915_hw_ppgtt *ppgtt = i915_vm_to_ppgtt(vm); struct i915_ppgtt *ppgtt = i915_vm_to_ppgtt(vm);
if (intel_vgpu_active(i915)) if (intel_vgpu_active(i915))
gen8_ppgtt_notify_vgt(ppgtt, false); gen8_ppgtt_notify_vgt(ppgtt, false);
...@@ -1501,7 +1501,7 @@ static int gen8_ppgtt_alloc_3lvl(struct i915_address_space *vm, ...@@ -1501,7 +1501,7 @@ static int gen8_ppgtt_alloc_3lvl(struct i915_address_space *vm,
static int gen8_ppgtt_alloc_4lvl(struct i915_address_space *vm, static int gen8_ppgtt_alloc_4lvl(struct i915_address_space *vm,
u64 start, u64 length) u64 start, u64 length)
{ {
struct i915_hw_ppgtt *ppgtt = i915_vm_to_ppgtt(vm); struct i915_ppgtt *ppgtt = i915_vm_to_ppgtt(vm);
struct i915_pml4 *pml4 = &ppgtt->pml4; struct i915_pml4 *pml4 = &ppgtt->pml4;
struct i915_page_directory_pointer *pdp; struct i915_page_directory_pointer *pdp;
u64 from = start; u64 from = start;
...@@ -1557,7 +1557,7 @@ static int gen8_ppgtt_alloc_4lvl(struct i915_address_space *vm, ...@@ -1557,7 +1557,7 @@ static int gen8_ppgtt_alloc_4lvl(struct i915_address_space *vm,
return -ENOMEM; return -ENOMEM;
} }
static int gen8_preallocate_top_level_pdp(struct i915_hw_ppgtt *ppgtt) static int gen8_preallocate_top_level_pdp(struct i915_ppgtt *ppgtt)
{ {
struct i915_address_space *vm = &ppgtt->vm; struct i915_address_space *vm = &ppgtt->vm;
struct i915_page_directory_pointer *pdp = &ppgtt->pdp; struct i915_page_directory_pointer *pdp = &ppgtt->pdp;
...@@ -1590,7 +1590,7 @@ static int gen8_preallocate_top_level_pdp(struct i915_hw_ppgtt *ppgtt) ...@@ -1590,7 +1590,7 @@ static int gen8_preallocate_top_level_pdp(struct i915_hw_ppgtt *ppgtt)
} }
static void ppgtt_init(struct drm_i915_private *i915, static void ppgtt_init(struct drm_i915_private *i915,
struct i915_hw_ppgtt *ppgtt) struct i915_ppgtt *ppgtt)
{ {
ppgtt->vm.i915 = i915; ppgtt->vm.i915 = i915;
ppgtt->vm.dma = &i915->drm.pdev->dev; ppgtt->vm.dma = &i915->drm.pdev->dev;
...@@ -1611,9 +1611,9 @@ static void ppgtt_init(struct drm_i915_private *i915, ...@@ -1611,9 +1611,9 @@ static void ppgtt_init(struct drm_i915_private *i915,
* space. * space.
* *
*/ */
static struct i915_hw_ppgtt *gen8_ppgtt_create(struct drm_i915_private *i915) static struct i915_ppgtt *gen8_ppgtt_create(struct drm_i915_private *i915)
{ {
struct i915_hw_ppgtt *ppgtt; struct i915_ppgtt *ppgtt;
int err; int err;
ppgtt = kzalloc(sizeof(*ppgtt), GFP_KERNEL); ppgtt = kzalloc(sizeof(*ppgtt), GFP_KERNEL);
...@@ -1683,7 +1683,7 @@ static struct i915_hw_ppgtt *gen8_ppgtt_create(struct drm_i915_private *i915) ...@@ -1683,7 +1683,7 @@ static struct i915_hw_ppgtt *gen8_ppgtt_create(struct drm_i915_private *i915)
} }
/* Write pde (index) from the page directory @pd to the page table @pt */ /* Write pde (index) from the page directory @pd to the page table @pt */
static inline void gen6_write_pde(const struct gen6_hw_ppgtt *ppgtt, static inline void gen6_write_pde(const struct gen6_ppgtt *ppgtt,
const unsigned int pde, const unsigned int pde,
const struct i915_page_table *pt) const struct i915_page_table *pt)
{ {
...@@ -1740,7 +1740,7 @@ static void gen6_ppgtt_enable(struct drm_i915_private *dev_priv) ...@@ -1740,7 +1740,7 @@ static void gen6_ppgtt_enable(struct drm_i915_private *dev_priv)
static void gen6_ppgtt_clear_range(struct i915_address_space *vm, static void gen6_ppgtt_clear_range(struct i915_address_space *vm,
u64 start, u64 length) u64 start, u64 length)
{ {
struct gen6_hw_ppgtt *ppgtt = to_gen6_ppgtt(i915_vm_to_ppgtt(vm)); struct gen6_ppgtt *ppgtt = to_gen6_ppgtt(i915_vm_to_ppgtt(vm));
unsigned int first_entry = start / I915_GTT_PAGE_SIZE; unsigned int first_entry = start / I915_GTT_PAGE_SIZE;
unsigned int pde = first_entry / GEN6_PTES; unsigned int pde = first_entry / GEN6_PTES;
unsigned int pte = first_entry % GEN6_PTES; unsigned int pte = first_entry % GEN6_PTES;
...@@ -1780,7 +1780,7 @@ static void gen6_ppgtt_insert_entries(struct i915_address_space *vm, ...@@ -1780,7 +1780,7 @@ static void gen6_ppgtt_insert_entries(struct i915_address_space *vm,
enum i915_cache_level cache_level, enum i915_cache_level cache_level,
u32 flags) u32 flags)
{ {
struct i915_hw_ppgtt *ppgtt = i915_vm_to_ppgtt(vm); struct i915_ppgtt *ppgtt = i915_vm_to_ppgtt(vm);
unsigned first_entry = vma->node.start / I915_GTT_PAGE_SIZE; unsigned first_entry = vma->node.start / I915_GTT_PAGE_SIZE;
unsigned act_pt = first_entry / GEN6_PTES; unsigned act_pt = first_entry / GEN6_PTES;
unsigned act_pte = first_entry % GEN6_PTES; unsigned act_pte = first_entry % GEN6_PTES;
...@@ -1818,7 +1818,7 @@ static void gen6_ppgtt_insert_entries(struct i915_address_space *vm, ...@@ -1818,7 +1818,7 @@ static void gen6_ppgtt_insert_entries(struct i915_address_space *vm,
static int gen6_alloc_va_range(struct i915_address_space *vm, static int gen6_alloc_va_range(struct i915_address_space *vm,
u64 start, u64 length) u64 start, u64 length)
{ {
struct gen6_hw_ppgtt *ppgtt = to_gen6_ppgtt(i915_vm_to_ppgtt(vm)); struct gen6_ppgtt *ppgtt = to_gen6_ppgtt(i915_vm_to_ppgtt(vm));
struct i915_page_table *pt; struct i915_page_table *pt;
intel_wakeref_t wakeref; intel_wakeref_t wakeref;
u64 from = start; u64 from = start;
...@@ -1878,7 +1878,7 @@ static int gen6_alloc_va_range(struct i915_address_space *vm, ...@@ -1878,7 +1878,7 @@ static int gen6_alloc_va_range(struct i915_address_space *vm,
return -ENOMEM; return -ENOMEM;
} }
static int gen6_ppgtt_init_scratch(struct gen6_hw_ppgtt *ppgtt) static int gen6_ppgtt_init_scratch(struct gen6_ppgtt *ppgtt)
{ {
struct i915_address_space * const vm = &ppgtt->base.vm; struct i915_address_space * const vm = &ppgtt->base.vm;
struct i915_page_table *unused; struct i915_page_table *unused;
...@@ -1913,7 +1913,7 @@ static void gen6_ppgtt_free_scratch(struct i915_address_space *vm) ...@@ -1913,7 +1913,7 @@ static void gen6_ppgtt_free_scratch(struct i915_address_space *vm)
cleanup_scratch_page(vm); cleanup_scratch_page(vm);
} }
static void gen6_ppgtt_free_pd(struct gen6_hw_ppgtt *ppgtt) static void gen6_ppgtt_free_pd(struct gen6_ppgtt *ppgtt)
{ {
struct i915_page_table *pt; struct i915_page_table *pt;
u32 pde; u32 pde;
...@@ -1971,7 +1971,7 @@ static const struct i915_vma_ops nop_vma_ops = { ...@@ -1971,7 +1971,7 @@ static const struct i915_vma_ops nop_vma_ops = {
static void gen6_ppgtt_cleanup(struct i915_address_space *vm) static void gen6_ppgtt_cleanup(struct i915_address_space *vm)
{ {
struct gen6_hw_ppgtt *ppgtt = to_gen6_ppgtt(i915_vm_to_ppgtt(vm)); struct gen6_ppgtt *ppgtt = to_gen6_ppgtt(i915_vm_to_ppgtt(vm));
struct gen6_ppgtt_cleanup_work *work = ppgtt->work; struct gen6_ppgtt_cleanup_work *work = ppgtt->work;
/* FIXME remove the struct_mutex to bring the locking under control */ /* FIXME remove the struct_mutex to bring the locking under control */
...@@ -2002,7 +2002,7 @@ static int pd_vma_bind(struct i915_vma *vma, ...@@ -2002,7 +2002,7 @@ static int pd_vma_bind(struct i915_vma *vma,
u32 unused) u32 unused)
{ {
struct i915_ggtt *ggtt = i915_vm_to_ggtt(vma->vm); struct i915_ggtt *ggtt = i915_vm_to_ggtt(vma->vm);
struct gen6_hw_ppgtt *ppgtt = vma->private; struct gen6_ppgtt *ppgtt = vma->private;
u32 ggtt_offset = i915_ggtt_offset(vma) / I915_GTT_PAGE_SIZE; u32 ggtt_offset = i915_ggtt_offset(vma) / I915_GTT_PAGE_SIZE;
struct i915_page_table *pt; struct i915_page_table *pt;
unsigned int pde; unsigned int pde;
...@@ -2021,7 +2021,7 @@ static int pd_vma_bind(struct i915_vma *vma, ...@@ -2021,7 +2021,7 @@ static int pd_vma_bind(struct i915_vma *vma,
static void pd_vma_unbind(struct i915_vma *vma) static void pd_vma_unbind(struct i915_vma *vma)
{ {
struct gen6_hw_ppgtt *ppgtt = vma->private; struct gen6_ppgtt *ppgtt = vma->private;
struct i915_page_table * const scratch_pt = ppgtt->base.vm.scratch_pt; struct i915_page_table * const scratch_pt = ppgtt->base.vm.scratch_pt;
struct i915_page_table *pt; struct i915_page_table *pt;
unsigned int pde; unsigned int pde;
...@@ -2048,7 +2048,7 @@ static const struct i915_vma_ops pd_vma_ops = { ...@@ -2048,7 +2048,7 @@ static const struct i915_vma_ops pd_vma_ops = {
.unbind_vma = pd_vma_unbind, .unbind_vma = pd_vma_unbind,
}; };
static struct i915_vma *pd_vma_create(struct gen6_hw_ppgtt *ppgtt, int size) static struct i915_vma *pd_vma_create(struct gen6_ppgtt *ppgtt, int size)
{ {
struct drm_i915_private *i915 = ppgtt->base.vm.i915; struct drm_i915_private *i915 = ppgtt->base.vm.i915;
struct i915_ggtt *ggtt = &i915->ggtt; struct i915_ggtt *ggtt = &i915->ggtt;
...@@ -2083,9 +2083,9 @@ static struct i915_vma *pd_vma_create(struct gen6_hw_ppgtt *ppgtt, int size) ...@@ -2083,9 +2083,9 @@ static struct i915_vma *pd_vma_create(struct gen6_hw_ppgtt *ppgtt, int size)
return vma; return vma;
} }
int gen6_ppgtt_pin(struct i915_hw_ppgtt *base) int gen6_ppgtt_pin(struct i915_ppgtt *base)
{ {
struct gen6_hw_ppgtt *ppgtt = to_gen6_ppgtt(base); struct gen6_ppgtt *ppgtt = to_gen6_ppgtt(base);
int err; int err;
GEM_BUG_ON(ppgtt->base.vm.closed); GEM_BUG_ON(ppgtt->base.vm.closed);
...@@ -2117,9 +2117,9 @@ int gen6_ppgtt_pin(struct i915_hw_ppgtt *base) ...@@ -2117,9 +2117,9 @@ int gen6_ppgtt_pin(struct i915_hw_ppgtt *base)
return err; return err;
} }
void gen6_ppgtt_unpin(struct i915_hw_ppgtt *base) void gen6_ppgtt_unpin(struct i915_ppgtt *base)
{ {
struct gen6_hw_ppgtt *ppgtt = to_gen6_ppgtt(base); struct gen6_ppgtt *ppgtt = to_gen6_ppgtt(base);
GEM_BUG_ON(!ppgtt->pin_count); GEM_BUG_ON(!ppgtt->pin_count);
if (--ppgtt->pin_count) if (--ppgtt->pin_count)
...@@ -2128,9 +2128,9 @@ void gen6_ppgtt_unpin(struct i915_hw_ppgtt *base) ...@@ -2128,9 +2128,9 @@ void gen6_ppgtt_unpin(struct i915_hw_ppgtt *base)
i915_vma_unpin(ppgtt->vma); i915_vma_unpin(ppgtt->vma);
} }
void gen6_ppgtt_unpin_all(struct i915_hw_ppgtt *base) void gen6_ppgtt_unpin_all(struct i915_ppgtt *base)
{ {
struct gen6_hw_ppgtt *ppgtt = to_gen6_ppgtt(base); struct gen6_ppgtt *ppgtt = to_gen6_ppgtt(base);
if (!ppgtt->pin_count) if (!ppgtt->pin_count)
return; return;
...@@ -2139,10 +2139,10 @@ void gen6_ppgtt_unpin_all(struct i915_hw_ppgtt *base) ...@@ -2139,10 +2139,10 @@ void gen6_ppgtt_unpin_all(struct i915_hw_ppgtt *base)
i915_vma_unpin(ppgtt->vma); i915_vma_unpin(ppgtt->vma);
} }
static struct i915_hw_ppgtt *gen6_ppgtt_create(struct drm_i915_private *i915) static struct i915_ppgtt *gen6_ppgtt_create(struct drm_i915_private *i915)
{ {
struct i915_ggtt * const ggtt = &i915->ggtt; struct i915_ggtt * const ggtt = &i915->ggtt;
struct gen6_hw_ppgtt *ppgtt; struct gen6_ppgtt *ppgtt;
int err; int err;
ppgtt = kzalloc(sizeof(*ppgtt), GFP_KERNEL); ppgtt = kzalloc(sizeof(*ppgtt), GFP_KERNEL);
...@@ -2231,8 +2231,8 @@ int i915_ppgtt_init_hw(struct drm_i915_private *dev_priv) ...@@ -2231,8 +2231,8 @@ int i915_ppgtt_init_hw(struct drm_i915_private *dev_priv)
return 0; return 0;
} }
static struct i915_hw_ppgtt * static struct i915_ppgtt *
__hw_ppgtt_create(struct drm_i915_private *i915) __ppgtt_create(struct drm_i915_private *i915)
{ {
if (INTEL_GEN(i915) < 8) if (INTEL_GEN(i915) < 8)
return gen6_ppgtt_create(i915); return gen6_ppgtt_create(i915);
...@@ -2240,12 +2240,12 @@ __hw_ppgtt_create(struct drm_i915_private *i915) ...@@ -2240,12 +2240,12 @@ __hw_ppgtt_create(struct drm_i915_private *i915)
return gen8_ppgtt_create(i915); return gen8_ppgtt_create(i915);
} }
struct i915_hw_ppgtt * struct i915_ppgtt *
i915_ppgtt_create(struct drm_i915_private *i915) i915_ppgtt_create(struct drm_i915_private *i915)
{ {
struct i915_hw_ppgtt *ppgtt; struct i915_ppgtt *ppgtt;
ppgtt = __hw_ppgtt_create(i915); ppgtt = __ppgtt_create(i915);
if (IS_ERR(ppgtt)) if (IS_ERR(ppgtt))
return ppgtt; return ppgtt;
...@@ -2657,7 +2657,7 @@ static int aliasing_gtt_bind_vma(struct i915_vma *vma, ...@@ -2657,7 +2657,7 @@ static int aliasing_gtt_bind_vma(struct i915_vma *vma,
pte_flags |= PTE_READ_ONLY; pte_flags |= PTE_READ_ONLY;
if (flags & I915_VMA_LOCAL_BIND) { if (flags & I915_VMA_LOCAL_BIND) {
struct i915_hw_ppgtt *appgtt = i915->mm.aliasing_ppgtt; struct i915_ppgtt *appgtt = i915->mm.aliasing_ppgtt;
if (!(vma->flags & I915_VMA_LOCAL_BIND)) { if (!(vma->flags & I915_VMA_LOCAL_BIND)) {
ret = appgtt->vm.allocate_va_range(&appgtt->vm, ret = appgtt->vm.allocate_va_range(&appgtt->vm,
...@@ -2756,7 +2756,7 @@ static void i915_gtt_color_adjust(const struct drm_mm_node *node, ...@@ -2756,7 +2756,7 @@ static void i915_gtt_color_adjust(const struct drm_mm_node *node,
static int init_aliasing_ppgtt(struct drm_i915_private *i915) static int init_aliasing_ppgtt(struct drm_i915_private *i915)
{ {
struct i915_ggtt *ggtt = &i915->ggtt; struct i915_ggtt *ggtt = &i915->ggtt;
struct i915_hw_ppgtt *ppgtt; struct i915_ppgtt *ppgtt;
int err; int err;
ppgtt = i915_ppgtt_create(i915); ppgtt = i915_ppgtt_create(i915);
...@@ -2796,7 +2796,7 @@ static int init_aliasing_ppgtt(struct drm_i915_private *i915) ...@@ -2796,7 +2796,7 @@ static int init_aliasing_ppgtt(struct drm_i915_private *i915)
static void fini_aliasing_ppgtt(struct drm_i915_private *i915) static void fini_aliasing_ppgtt(struct drm_i915_private *i915)
{ {
struct i915_ggtt *ggtt = &i915->ggtt; struct i915_ggtt *ggtt = &i915->ggtt;
struct i915_hw_ppgtt *ppgtt; struct i915_ppgtt *ppgtt;
ppgtt = fetch_and_zero(&i915->mm.aliasing_ppgtt); ppgtt = fetch_and_zero(&i915->mm.aliasing_ppgtt);
if (!ppgtt) if (!ppgtt)
......
...@@ -412,7 +412,7 @@ struct i915_ggtt { ...@@ -412,7 +412,7 @@ struct i915_ggtt {
struct drm_mm_node uc_fw; struct drm_mm_node uc_fw;
}; };
struct i915_hw_ppgtt { struct i915_ppgtt {
struct i915_address_space vm; struct i915_address_space vm;
intel_engine_mask_t pd_dirty_engines; intel_engine_mask_t pd_dirty_engines;
...@@ -423,8 +423,8 @@ struct i915_hw_ppgtt { ...@@ -423,8 +423,8 @@ struct i915_hw_ppgtt {
}; };
}; };
struct gen6_hw_ppgtt { struct gen6_ppgtt {
struct i915_hw_ppgtt base; struct i915_ppgtt base;
struct i915_vma *vma; struct i915_vma *vma;
gen6_pte_t __iomem *pd_addr; gen6_pte_t __iomem *pd_addr;
...@@ -435,11 +435,11 @@ struct gen6_hw_ppgtt { ...@@ -435,11 +435,11 @@ struct gen6_hw_ppgtt {
struct gen6_ppgtt_cleanup_work *work; struct gen6_ppgtt_cleanup_work *work;
}; };
#define __to_gen6_ppgtt(base) container_of(base, struct gen6_hw_ppgtt, base) #define __to_gen6_ppgtt(base) container_of(base, struct gen6_ppgtt, base)
static inline struct gen6_hw_ppgtt *to_gen6_ppgtt(struct i915_hw_ppgtt *base) static inline struct gen6_ppgtt *to_gen6_ppgtt(struct i915_ppgtt *base)
{ {
BUILD_BUG_ON(offsetof(struct gen6_hw_ppgtt, base)); BUILD_BUG_ON(offsetof(struct gen6_ppgtt, base));
return __to_gen6_ppgtt(base); return __to_gen6_ppgtt(base);
} }
...@@ -575,7 +575,7 @@ static inline u64 gen8_pte_count(u64 address, u64 length) ...@@ -575,7 +575,7 @@ static inline u64 gen8_pte_count(u64 address, u64 length)
} }
static inline dma_addr_t static inline dma_addr_t
i915_page_dir_dma_addr(const struct i915_hw_ppgtt *ppgtt, const unsigned n) i915_page_dir_dma_addr(const struct i915_ppgtt *ppgtt, const unsigned int n)
{ {
return px_dma(ppgtt->pdp.page_directory[n]); return px_dma(ppgtt->pdp.page_directory[n]);
} }
...@@ -588,12 +588,12 @@ i915_vm_to_ggtt(struct i915_address_space *vm) ...@@ -588,12 +588,12 @@ i915_vm_to_ggtt(struct i915_address_space *vm)
return container_of(vm, struct i915_ggtt, vm); return container_of(vm, struct i915_ggtt, vm);
} }
static inline struct i915_hw_ppgtt * static inline struct i915_ppgtt *
i915_vm_to_ppgtt(struct i915_address_space *vm) i915_vm_to_ppgtt(struct i915_address_space *vm)
{ {
BUILD_BUG_ON(offsetof(struct i915_hw_ppgtt, vm)); BUILD_BUG_ON(offsetof(struct i915_ppgtt, vm));
GEM_BUG_ON(i915_is_ggtt(vm)); GEM_BUG_ON(i915_is_ggtt(vm));
return container_of(vm, struct i915_hw_ppgtt, vm); return container_of(vm, struct i915_ppgtt, vm);
} }
#define INTEL_MAX_PPAT_ENTRIES 8 #define INTEL_MAX_PPAT_ENTRIES 8
...@@ -637,7 +637,7 @@ void i915_ggtt_cleanup_hw(struct drm_i915_private *dev_priv); ...@@ -637,7 +637,7 @@ void i915_ggtt_cleanup_hw(struct drm_i915_private *dev_priv);
int i915_ppgtt_init_hw(struct drm_i915_private *dev_priv); int i915_ppgtt_init_hw(struct drm_i915_private *dev_priv);
struct i915_hw_ppgtt *i915_ppgtt_create(struct drm_i915_private *dev_priv); struct i915_ppgtt *i915_ppgtt_create(struct drm_i915_private *dev_priv);
static inline struct i915_address_space * static inline struct i915_address_space *
i915_vm_get(struct i915_address_space *vm) i915_vm_get(struct i915_address_space *vm)
...@@ -653,9 +653,9 @@ static inline void i915_vm_put(struct i915_address_space *vm) ...@@ -653,9 +653,9 @@ static inline void i915_vm_put(struct i915_address_space *vm)
kref_put(&vm->ref, i915_vm_release); kref_put(&vm->ref, i915_vm_release);
} }
int gen6_ppgtt_pin(struct i915_hw_ppgtt *base); int gen6_ppgtt_pin(struct i915_ppgtt *base);
void gen6_ppgtt_unpin(struct i915_hw_ppgtt *base); void gen6_ppgtt_unpin(struct i915_ppgtt *base);
void gen6_ppgtt_unpin_all(struct i915_hw_ppgtt *base); void gen6_ppgtt_unpin_all(struct i915_ppgtt *base);
void i915_gem_suspend_gtt_mappings(struct drm_i915_private *dev_priv); void i915_gem_suspend_gtt_mappings(struct drm_i915_private *dev_priv);
void i915_gem_restore_gtt_mappings(struct drm_i915_private *dev_priv); void i915_gem_restore_gtt_mappings(struct drm_i915_private *dev_priv);
......
...@@ -148,7 +148,7 @@ fake_dma_object(struct drm_i915_private *i915, u64 size) ...@@ -148,7 +148,7 @@ fake_dma_object(struct drm_i915_private *i915, u64 size)
static int igt_ppgtt_alloc(void *arg) static int igt_ppgtt_alloc(void *arg)
{ {
struct drm_i915_private *dev_priv = arg; struct drm_i915_private *dev_priv = arg;
struct i915_hw_ppgtt *ppgtt; struct i915_ppgtt *ppgtt;
u64 size, last, limit; u64 size, last, limit;
int err = 0; int err = 0;
...@@ -157,7 +157,7 @@ static int igt_ppgtt_alloc(void *arg) ...@@ -157,7 +157,7 @@ static int igt_ppgtt_alloc(void *arg)
if (!HAS_PPGTT(dev_priv)) if (!HAS_PPGTT(dev_priv))
return 0; return 0;
ppgtt = __hw_ppgtt_create(dev_priv); ppgtt = __ppgtt_create(dev_priv);
if (IS_ERR(ppgtt)) if (IS_ERR(ppgtt))
return PTR_ERR(ppgtt); return PTR_ERR(ppgtt);
...@@ -999,7 +999,7 @@ static int exercise_ppgtt(struct drm_i915_private *dev_priv, ...@@ -999,7 +999,7 @@ static int exercise_ppgtt(struct drm_i915_private *dev_priv,
unsigned long end_time)) unsigned long end_time))
{ {
struct drm_file *file; struct drm_file *file;
struct i915_hw_ppgtt *ppgtt; struct i915_ppgtt *ppgtt;
IGT_TIMEOUT(end_time); IGT_TIMEOUT(end_time);
int err; int err;
......
...@@ -55,11 +55,9 @@ static void mock_cleanup(struct i915_address_space *vm) ...@@ -55,11 +55,9 @@ static void mock_cleanup(struct i915_address_space *vm)
{ {
} }
struct i915_hw_ppgtt * struct i915_ppgtt *mock_ppgtt(struct drm_i915_private *i915, const char *name)
mock_ppgtt(struct drm_i915_private *i915,
const char *name)
{ {
struct i915_hw_ppgtt *ppgtt; struct i915_ppgtt *ppgtt;
ppgtt = kzalloc(sizeof(*ppgtt), GFP_KERNEL); ppgtt = kzalloc(sizeof(*ppgtt), GFP_KERNEL);
if (!ppgtt) if (!ppgtt)
......
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
void mock_init_ggtt(struct drm_i915_private *i915, struct i915_ggtt *ggtt); void mock_init_ggtt(struct drm_i915_private *i915, struct i915_ggtt *ggtt);
void mock_fini_ggtt(struct i915_ggtt *ggtt); void mock_fini_ggtt(struct i915_ggtt *ggtt);
struct i915_hw_ppgtt * struct i915_ppgtt *mock_ppgtt(struct drm_i915_private *i915, const char *name);
mock_ppgtt(struct drm_i915_private *i915,
const char *name);
#endif /* !__MOCK_GTT_H */ #endif /* !__MOCK_GTT_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment