diff mbox series

[3/4] drm/i915/gtt: make ggtt.insert_page depend on mappable aperture

Message ID 20210203121119.481146-3-matthew.auld@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/4] drm/i915: Distinction of memory regions | expand

Commit Message

Matthew Auld Feb. 3, 2021, 12:11 p.m. UTC
The vm insert_page is useful to insert a vma-less page into the GGTT,
which so far is always to map something through the mappable aperture,
usually when the entire VMA doesn't fit, or if we specifically don't
want to hog it, since it's generally quite limited in size.

On platforms including DG1 the mappable aperture is gone, and so
insert_page is effectively unused and untested. In the next patch we
need to extend the flags to include the PTE_LM bit when binding into the
GGTT, so rather than extend insert_page to potentially account for this,
we can instead just drop support for the hook on such platforms, at
least until we come up with a valid use.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_ggtt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Chris Wilson Feb. 3, 2021, 12:15 p.m. UTC | #1
Quoting Matthew Auld (2021-02-03 12:11:18)
> The vm insert_page is useful to insert a vma-less page into the GGTT,
> which so far is always to map something through the mappable aperture,
> usually when the entire VMA doesn't fit, or if we specifically don't
> want to hog it, since it's generally quite limited in size.

I do believe I've sent patches to use it for other things, so I think
there is use outside (and equally ppgtt->insert_page is useful)... The
pte is fully describe by the flags we pass, so this is just being an
annoyance for annoyance's sake.
-Chris
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/intel_ggtt.c b/drivers/gpu/drm/i915/gt/intel_ggtt.c
index fc399ac16eda..30187483cd92 100644
--- a/drivers/gpu/drm/i915/gt/intel_ggtt.c
+++ b/drivers/gpu/drm/i915/gt/intel_ggtt.c
@@ -882,7 +882,9 @@  static int gen8_gmch_probe(struct i915_ggtt *ggtt)
 
 	ggtt->vm.total = (size / sizeof(gen8_pte_t)) * I915_GTT_PAGE_SIZE;
 	ggtt->vm.cleanup = gen6_gmch_remove;
-	ggtt->vm.insert_page = gen8_ggtt_insert_page;
+
+	if (ggtt->mappable_end)
+		ggtt->vm.insert_page = gen8_ggtt_insert_page;
 	ggtt->vm.clear_range = nop_clear_range;
 	if (intel_scanout_needs_vtd_wa(i915))
 		ggtt->vm.clear_range = gen8_ggtt_clear_range;