[PATCH] drm/xe: Fix arg to pci_iomap()

Matt Roper matthew.d.roper at intel.com
Fri Sep 6 14:50:26 UTC 2024


On Thu, Sep 05, 2024 at 08:25:07PM -0700, Lucas De Marchi wrote:
> Commit 2d8865b27724 ("drm/xe: Move BAR definitions to dedicated file")
> moved the BAR definition to the header, but replaced the wrong arg in
> the pci_iomap() function - the last arg is actuall the length, not the
> BAR. Luckily GTTMMADR_BAR == 0, so it still works. Fix the argument
> to avoid confusion.
> 
> Cc: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>

Reviewed-by: Matt Roper <matthew.d.roper at intel.com>

> ---
>  drivers/gpu/drm/xe/xe_mmio.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_mmio.c b/drivers/gpu/drm/xe/xe_mmio.c
> index 3fd462fda625..4aae30880bc6 100644
> --- a/drivers/gpu/drm/xe/xe_mmio.c
> +++ b/drivers/gpu/drm/xe/xe_mmio.c
> @@ -157,15 +157,14 @@ int xe_mmio_init(struct xe_device *xe)
>  {
>  	struct xe_tile *root_tile = xe_device_get_root_tile(xe);
>  	struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
> -	const int mmio_bar = 0;
>  
>  	/*
>  	 * Map the entire BAR.
>  	 * The first 16MB of the BAR, belong to the root tile, and include:
>  	 * registers (0-4MB), reserved space (4MB-8MB) and GGTT (8MB-16MB).
>  	 */
> -	xe->mmio.size = pci_resource_len(pdev, mmio_bar);
> -	xe->mmio.regs = pci_iomap(pdev, mmio_bar, GTTMMADR_BAR);
> +	xe->mmio.size = pci_resource_len(pdev, GTTMMADR_BAR);
> +	xe->mmio.regs = pci_iomap(pdev, GTTMMADR_BAR, 0);
>  	if (xe->mmio.regs == NULL) {
>  		drm_err(&xe->drm, "failed to map registers\n");
>  		return -EIO;
> -- 
> 2.43.0
> 

-- 
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation


More information about the Intel-xe mailing list