diff mbox series

[3/3] drm/i915/error: Fix object page offset within a region

Message ID 20210118141732.90173-3-matthew.auld@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/3] drm/i915: Fix the sgt.pfn sanity check | expand

Commit Message

Matthew Auld Jan. 18, 2021, 2:17 p.m. UTC
From: CQ Tang <cq.tang@intel.com>

io_mapping_map_wc() expects the offset to be relative to the iomapping
base address. Currently we just pass in the physical address for the
page which only works if the region.start starts at zero.

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

Comments

Chris Wilson Jan. 18, 2021, 2:56 p.m. UTC | #1
Quoting Matthew Auld (2021-01-18 14:17:32)
> From: CQ Tang <cq.tang@intel.com>
> 
> io_mapping_map_wc() expects the offset to be relative to the iomapping
> base address. Currently we just pass in the physical address for the
> page which only works if the region.start starts at zero.
> 
> Signed-off-by: CQ Tang <cq.tang@intel.com>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gpu_error.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index 8b163ee1b86d..f962693404b7 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -1051,7 +1051,9 @@ i915_vma_coredump_create(const struct intel_gt *gt,
>                 for_each_sgt_daddr(dma, iter, vma->pages) {
>                         void __iomem *s;
>  
> -                       s = io_mapping_map_wc(&mem->iomap, dma, PAGE_SIZE);
> +                       s = io_mapping_map_wc(&mem->iomap,
> +                                             dma - mem->region.start,
> +                                             PAGE_SIZE);

From i915_gem_object_get_pages_buddy:

 	sg_dma_address(sg) = mem->region.start + offset;

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
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 8b163ee1b86d..f962693404b7 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -1051,7 +1051,9 @@  i915_vma_coredump_create(const struct intel_gt *gt,
 		for_each_sgt_daddr(dma, iter, vma->pages) {
 			void __iomem *s;
 
-			s = io_mapping_map_wc(&mem->iomap, dma, PAGE_SIZE);
+			s = io_mapping_map_wc(&mem->iomap,
+					      dma - mem->region.start,
+					      PAGE_SIZE);
 			ret = compress_page(compress,
 					    (void __force *)s, dst,
 					    true);