drm/i915: define i915_ggtt_has_aperture
Subsystems (2)
PATCH v2 1/7 drm/i915: define i915_ggtt_has_aperture
From: Daniele Ceraolo Spurio <[email protected]>
The following patches in the series will use it to avoid certain operations when the mappable aperture is not available in HW.
--- drivers/gpu/drm/i915/i915_gem_gtt.h | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_gem_gtt.h +5 -0
@@ -575,6 +575,11 @@ void i915_ggtt_disable_guc(struct i915_ggtt *ggtt);int i915_init_ggtt (struct drm_i915_private *dev_priv);void i915_ggtt_driver_release (struct drm_i915_private *dev_priv); +static inline bool i915_ggtt_has_aperture (struct i915_ggtt *ggtt) +{ +return ggtt->mappable_end >0 ; +} +int i915_ppgtt_init_hw (struct intel_gt *gt);struct i915_ppgtt *i915_ppgtt_create (struct drm_i915_private *dev_priv);
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/7 drm/i915: do not map aperture if it is not available.
From: Daniele Ceraolo Spurio <[email protected]>
Skip both setup and cleanup of the aperture mapping if the HW doesn't have an aperture bar.
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 31 ++++++++++++++++++----------- 1 file changed, 19 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +19 -12
@@ -2770,7 +2770,9 @@ static void ggtt_cleanup_hw(struct i915_ggtt *ggtt)i915_address_space_fini (&ggtt->vm);arch_phys_wc_del (ggtt->mtrr); -io_mapping_fini (&ggtt->iomap); + +if (ggtt->iomap.size) +io_mapping_fini (&ggtt->iomap); }/**
@@ -2997,10 +2999,12 @@ static int gen8_gmch_probe(struct i915_ggtt *ggtt)int err;/* TODO: We're not aware of mappable constraints on gen8 yet */ - ggtt->gmadr = - (struct resource )DEFINE_RES_MEM (pci_resource_start (pdev,2 ), -pci_resource_len (pdev,2 )); - ggtt->mappable_end =resource_size (&ggtt->gmadr); +if (!IS_DGFX (dev_priv)) { + ggtt->gmadr = + (struct resource )DEFINE_RES_MEM (pci_resource_start (pdev,2 ), +pci_resource_len (pdev,2 )); + ggtt->mappable_end =resource_size (&ggtt->gmadr); + } err =pci_set_dma_mask (pdev,DMA_BIT_MASK (39 ));if (!err)
@@ -3223,14 +3227,17 @@ static int ggtt_init_hw(struct i915_ggtt *ggtt)if (!HAS_LLC (i915) && !HAS_PPGTT (i915)) ggtt->vm.mm.color_adjust = i915_ggtt_color_adjust; -if (!io_mapping_init_wc (&ggtt->iomap, - ggtt->gmadr.start, - ggtt->mappable_end)) { - ggtt->vm.cleanup (&ggtt->vm); -return -EIO ; - } +if (ggtt->mappable_end) { +if (!io_mapping_init_wc (&ggtt->iomap, + ggtt->gmadr.start, + ggtt->mappable_end)) { + ggtt->vm.cleanup (&ggtt->vm); +return -EIO ; + } - ggtt->mtrr =arch_phys_wc_add (ggtt->gmadr.start, ggtt->mappable_end); + ggtt->mtrr =arch_phys_wc_add (ggtt->gmadr.start, + ggtt->mappable_end); + }i915_ggtt_init_fences (ggtt);
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 3/7 drm/i915: set num_fence_regs to 0 if there is no aperture
In reply to Matthew AuldFrom: Daniele Ceraolo Spurio <[email protected]>
We can't fence anything without aperture.
--- drivers/gpu/drm/i915/i915_gem_fence_reg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_fence_reg.c +4 -2
@@ -846,8 +846,10 @@ void i915_ggtt_init_fences(struct i915_ggtt *ggtt)detect_bit_6_swizzle (ggtt); -if (INTEL_GEN (i915) >=7 && - !(IS_VALLEYVIEW (i915) ||IS_CHERRYVIEW (i915))) +if (!i915_ggtt_has_aperture (ggtt)) + num_fences =0 ; +else if (INTEL_GEN (i915) >=7 && + !(IS_VALLEYVIEW (i915) ||IS_CHERRYVIEW (i915))) num_fences =32 ; else if (INTEL_GEN(i915) >= 4 || IS_I945G(i915) || IS_I945GM(i915) ||
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 4/7 drm/i915: error capture with no ggtt slot
In reply to Matthew AuldFrom: Daniele Ceraolo Spurio <[email protected]>
If the aperture is not available in HW we can't use a ggtt slot and wc copy, so fall back to regular kmap.
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 19 ++++---- drivers/gpu/drm/i915/i915_gpu_error.c | 66 ++++++++++++++++++++++----- 2 files changed, 65 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +11 -8
@@ -2661,7 +2661,8 @@ static void ggtt_release_guc_top(struct i915_ggtt *ggtt)static void cleanup_init_ggtt (struct i915_ggtt *ggtt) {ggtt_release_guc_top (ggtt); -drm_mm_remove_node (&ggtt->error_capture); +if (drm_mm_node_allocated (&ggtt->error_capture)) +drm_mm_remove_node (&ggtt->error_capture); }static int init_ggtt (struct i915_ggtt *ggtt)
@@ -2692,13 +2693,15 @@ static int init_ggtt(struct i915_ggtt *ggtt)if (ret)return ret; -/* Reserve a mappable slot for our lockless error capture */ - ret =drm_mm_insert_node_in_range (&ggtt->vm.mm, &ggtt->error_capture, -PAGE_SIZE ,0 ,I915_COLOR_UNEVICTABLE , -0 , ggtt->mappable_end, -DRM_MM_INSERT_LOW ); -if (ret) -return ret; +if (ggtt->mappable_end) { +/* Reserve a mappable slot for our lockless error capture */ + ret =drm_mm_insert_node_in_range (&ggtt->vm.mm, &ggtt->error_capture, +PAGE_SIZE ,0 ,I915_COLOR_UNEVICTABLE , +0 , ggtt->mappable_end, +DRM_MM_INSERT_LOW ); +if (ret) +return ret; + }/* * The upper portion of the GuC address space has a sizeable hole
drivers/gpu/drm/i915/i915_gpu_error.c +54 -12
119 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 5/7 drm/i915: Don't try to place HWS in non-existing mappable region
In reply to Matthew AuldFrom: Michal Wajdeczko <[email protected]>
HWS placement restrictions can't just rely on HAS_LLC flag.
--- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/intel_engine_cs.c +1 -1
@@ -528,7 +528,7 @@ static int pin_ggtt_status_page(struct intel_engine_cs *engine,unsigned int flags; flags =PIN_GLOBAL ; -if (!HAS_LLC (engine->i915)) +if (!HAS_LLC (engine->i915) &&i915_ggtt_has_aperture (engine->gt->ggtt))/* * On g33, we cannot place HWS above 256MiB, so * restrict its pinning to the low mappable arena.
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 6/7 drm/i915: don't allocate the ring in stolen if we lack aperture
In reply to Matthew AuldSince we have no way access it from the CPU. For such cases just fallback to internal objects.
--- drivers/gpu/drm/i915/gt/intel_ring.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/intel_ring.c +3 -1
@@ -108,7 +108,9 @@ static struct i915_vma *create_ring_vma(struct i915_ggtt *ggtt, int size)struct drm_i915_gem_object *obj;struct i915_vma *vma; - obj =i915_gem_object_create_stolen (i915, size); + obj =ERR_PTR (-ENODEV ); +if (i915_ggtt_has_aperture (ggtt)) + obj =i915_gem_object_create_stolen (i915, size);if (IS_ERR (obj)) obj =i915_gem_object_create_internal (i915, size);if (IS_ERR (obj))
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 7/7 drm/i915/selftests: check for missing aperture
In reply to Matthew AuldWe may be missing support for the mappable aperture on some platforms.
--- .../drm/i915/gem/selftests/i915_gem_coherency.c | 7 ++++++- drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c | 6 ++++++ drivers/gpu/drm/i915/gt/selftest_hangcheck.c | 14 ++++++++++---- drivers/gpu/drm/i915/selftests/i915_gem.c | 4 ++++ drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 3 +++ 5 files changed, 29 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/gem/selftests/i915_gem_coherency.c +6 -1
@@ -250,7 +250,12 @@ static bool always_valid(struct context *ctx)static bool needs_fence_registers (struct context *ctx) { -return !intel_gt_is_wedged (ctx->engine->gt); +struct intel_gt *gt = ctx->engine->gt; + +if (intel_gt_is_wedged (gt)) +return false; + +return gt->ggtt->num_fences; }static bool needs_mi_store_dword (struct context *ctx)
drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c +6 -0
@@ -301,6 +301,9 @@ static int igt_partial_tiling(void *arg)int tiling;int err; +if (!i915_ggtt_has_aperture (&i915->ggtt)) +return 0 ; +/* We want to check the page mapping and fencing of a large object * mmapped through the GTT. The object we create is larger than can * possibly be mmaped as a whole, and so we must use partial GGTT vma.
@@ -431,6 +434,9 @@ static int igt_smoke_tiling(void *arg)IGT_TIMEOUT (end);int err; +if (!i915_ggtt_has_aperture (&i915->ggtt)) +return 0 ; +/* * igt_partial_tiling() does an exhastive check of partial tiling * chunking, but will undoubtably run out of time. Here, we do a
drivers/gpu/drm/i915/gt/selftest_hangcheck.c +10 -4
@@ -1149,8 +1149,12 @@ static int __igt_reset_evict_vma(struct intel_gt *gt,struct i915_request *rq;struct evict_vma arg;struct hang h; +unsigned int pin_flags;int err; +if (!gt->ggtt->num_fences && flags &EXEC_OBJECT_NEEDS_FENCE ) +return 0 ; +if (!engine || !intel_engine_can_store_dword (engine))return 0 ;
@@ -1186,10 +1190,12 @@ static int __igt_reset_evict_vma(struct intel_gt *gt, goto out_obj; } - err =i915_vma_pin (arg.vma,0 ,0 , -i915_vma_is_ggtt (arg.vma) ? -PIN_GLOBAL |PIN_MAPPABLE : -PIN_USER ); + pin_flags =i915_vma_is_ggtt (arg.vma) ?PIN_GLOBAL :PIN_USER ; + +if (flags &EXEC_OBJECT_NEEDS_FENCE ) + pin_flags |=PIN_MAPPABLE ; + + err =i915_vma_pin (arg.vma,0 ,0 , pin_flags);if (err) {i915_request_add (rq); goto out_obj;
drivers/gpu/drm/i915/selftests/i915_gem.c +4 -0
@@ -45,6 +45,10 @@ static void trash_stolen(struct drm_i915_private *i915)unsigned long page;u32 prng =0x12345678 ; +/* XXX: fsck. needs some more thought... */ +if (!i915_ggtt_has_aperture (ggtt)) +return ; +for (page =0 ; page < size; page +=PAGE_SIZE ) {const dma_addr_t dma = i915->dsm.start + page;u32 __iomem *s;
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +3 -0
@@ -1149,6 +1149,9 @@ static int igt_ggtt_page(void *arg)unsigned int *order, n;int err; +if (!i915_ggtt_has_aperture (ggtt)) +return 0 ; + obj =i915_gem_object_create_internal (i915,PAGE_SIZE );if (IS_ERR (obj))return PTR_ERR (obj);
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BUILD: failure for series starting with [v2,1/7] drm/i915: define i915_ggtt_has_aperture
In reply to Matthew Auld== Series Details ==
== Series Details ==
Series: series starting with [v2,1/7] drm/i915: define i915_ggtt_has_aperture
URL : https://patchwork.freedesktop.org/series/68710/
State : failure
== Summary ==
Applying: drm/i915: define i915_ggtt_has_aperture
Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/i915_gem_gtt.h
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/i915_gem_gtt.h
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/i915_gem_gtt.h
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch' to see the failed patch Patch failed at 0001 drm/i915: define i915_ggtt_has_aperture When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx