diff mbox series

[07/10] drm/i915/error: skip non-mappable pages

Message ID 20220525184337.491763-8-matthew.auld@intel.com (mailing list archive)
State New, archived
Headers show
Series small BAR uapi bits | expand

Commit Message

Matthew Auld May 25, 2022, 6:43 p.m. UTC
Skip capturing any lmem pages that can't be copied using the CPU. This
in now only best effort on platforms that have small BAR.

Testcase: igt@gem-exec-capture@capture-invisible
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Jon Bloomfield <jon.bloomfield@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Kenneth Graunke <kenneth@whitecape.org>
Cc: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
---
 drivers/gpu/drm/i915/i915_gpu_error.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Nirmoy Das June 1, 2022, 12:30 p.m. UTC | #1
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>

On 5/25/2022 8:43 PM, Matthew Auld wrote:
> Skip capturing any lmem pages that can't be copied using the CPU. This
> in now only best effort on platforms that have small BAR.
>
> Testcase: igt@gem-exec-capture@capture-invisible
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: Jon Bloomfield <jon.bloomfield@intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Kenneth Graunke <kenneth@whitecape.org>
> Cc: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_gpu_error.c | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index 0512c66fa4f3..77df899123c2 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -1116,11 +1116,15 @@ i915_vma_coredump_create(const struct intel_gt *gt,
>   		dma_addr_t dma;
>   
>   		for_each_sgt_daddr(dma, iter, vma_res->bi.pages) {
> +			dma_addr_t offset = dma - mem->region.start;
>   			void __iomem *s;
>   
> -			s = io_mapping_map_wc(&mem->iomap,
> -					      dma - mem->region.start,
> -					      PAGE_SIZE);
> +			if (offset + PAGE_SIZE > mem->io_size) {
> +				ret = -EINVAL;
> +				break;
> +			}
> +
> +			s = io_mapping_map_wc(&mem->iomap, offset, PAGE_SIZE);
>   			ret = compress_page(compress,
>   					    (void __force *)s, dst,
>   					    true);
Thomas Hellström (Intel) June 17, 2022, 2:26 p.m. UTC | #2
On 5/25/22 20:43, Matthew Auld wrote:
> Skip capturing any lmem pages that can't be copied using the CPU. This
> in now only best effort on platforms that have small BAR.
>
> Testcase: igt@gem-exec-capture@capture-invisible
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: Jon Bloomfield <jon.bloomfield@intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Kenneth Graunke <kenneth@whitecape.org>
> Cc: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_gpu_error.c | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index 0512c66fa4f3..77df899123c2 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -1116,11 +1116,15 @@ i915_vma_coredump_create(const struct intel_gt *gt,
>   		dma_addr_t dma;
>   
>   		for_each_sgt_daddr(dma, iter, vma_res->bi.pages) {
> +			dma_addr_t offset = dma - mem->region.start;
>   			void __iomem *s;
>   
> -			s = io_mapping_map_wc(&mem->iomap,
> -					      dma - mem->region.start,
> -					      PAGE_SIZE);
> +			if (offset + PAGE_SIZE > mem->io_size) {
> +				ret = -EINVAL;
> +				break;
> +			}
> +
> +			s = io_mapping_map_wc(&mem->iomap, offset, PAGE_SIZE);
>   			ret = compress_page(compress,
>   					    (void __force *)s, dst,
>   					    true);

Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 0512c66fa4f3..77df899123c2 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -1116,11 +1116,15 @@  i915_vma_coredump_create(const struct intel_gt *gt,
 		dma_addr_t dma;
 
 		for_each_sgt_daddr(dma, iter, vma_res->bi.pages) {
+			dma_addr_t offset = dma - mem->region.start;
 			void __iomem *s;
 
-			s = io_mapping_map_wc(&mem->iomap,
-					      dma - mem->region.start,
-					      PAGE_SIZE);
+			if (offset + PAGE_SIZE > mem->io_size) {
+				ret = -EINVAL;
+				break;
+			}
+
+			s = io_mapping_map_wc(&mem->iomap, offset, PAGE_SIZE);
 			ret = compress_page(compress,
 					    (void __force *)s, dst,
 					    true);