[PATCH 2/5] drm/xe/ggtt: Use ioread64 to dereference ggtt::gsm

Matthew Brost matthew.brost at intel.com
Tue Jan 30 17:11:00 UTC 2024


On Wed, Jan 17, 2024 at 02:40:45PM +0100, Thomas Hellström wrote:
> The pointer is an __iomem pointer.
> Silence the sparse warning.
> 
> Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
> Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
> Cc: Matthew Brost <matthew.brost at intel.com>
> Signed-off-by: Thomas Hellström <thomas.hellstrom at linux.intel.com>

This patch itself LGTM but wondering if we need also need a fixup for
the below code?

 73 void xe_ggtt_set_pte(struct xe_ggtt *ggtt, u64 addr, u64 pte)
 74 {
 75         xe_tile_assert(ggtt->tile, !(addr & XE_PTE_MASK));
 76         xe_tile_assert(ggtt->tile, addr < ggtt->size);
 77
 78         writeq(pte, &ggtt->gsm[addr >> XE_PTE_SHIFT]);
 79 }

With:
s/writeq(pte, &ggtt->gsm[addr >> XE_PTE_SHIFT])/iowrite64(pte, gtt->gsm + (addr >> XE_PTE_SHIFT)/ 

Anyways as I said this patch LGTM, with that:
Reviewed-by: Matthew Brost <matthew.brost at intel.com>

> ---
>  drivers/gpu/drm/xe/xe_ggtt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c
> index 6fdf830678b3..305f414b9b65 100644
> --- a/drivers/gpu/drm/xe/xe_ggtt.c
> +++ b/drivers/gpu/drm/xe/xe_ggtt.c
> @@ -307,11 +307,11 @@ void xe_ggtt_printk(struct xe_ggtt *ggtt, const char *prefix)
>  		unsigned int i = addr / XE_PAGE_SIZE;
>  
>  		xe_tile_assert(ggtt->tile, addr <= U32_MAX);
> -		if (ggtt->gsm[i] == scratch_pte)
> +		if (ioread64(ggtt->gsm + i) == scratch_pte)
>  			continue;
>  
>  		printk("%s    ggtt[0x%08x] = 0x%016llx",
> -		       prefix, (u32)addr, ggtt->gsm[i]);
> +		       prefix, (u32)addr, ioread64(ggtt->gsm + i));
>  	}
>  }
>  
> -- 
> 2.43.0
> 


More information about the Intel-xe mailing list