Skip to content

Commit 898acad

Browse files
piorkovgregkh
authored andcommitted
drm/xe: Use devm_ioremap_wc for VRAM mapping and drop manual unmap
[ Upstream commit 922ae875230be91c7f05f2aa90d176b6693e2601 ] Let's replace the manual call to ioremap_wc function with devm_ioremap_wc function, ensuring that VRAM mappings are automatically released when the driver is detached. Since devm_ioremap_wc registers the mapping with the device's managed resources, the explicit iounmap call in vram_fini is no longer needed, so let's remove it. Signed-off-by: Piotr Piórkowski <[email protected]> Suggested-by: Matthew Auld <[email protected]> Reviewed-by: Matthew Auld <[email protected]> Acked-by: Matthew Brost <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lucas De Marchi <[email protected]> Stable-dep-of: d30203739be7 ("drm/xe: Move rebar to be done earlier") Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1dc1ab6 commit 898acad

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/gpu/drm/xe/xe_vram.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ static int determine_lmem_bar_size(struct xe_device *xe)
156156
xe->mem.vram.dpa_base = 0;
157157

158158
/* set up a map to the total memory area. */
159-
xe->mem.vram.mapping = ioremap_wc(xe->mem.vram.io_start, xe->mem.vram.io_size);
159+
xe->mem.vram.mapping = devm_ioremap_wc(&pdev->dev, xe->mem.vram.io_start,
160+
xe->mem.vram.io_size);
160161

161162
return 0;
162163
}
@@ -278,9 +279,6 @@ static void vram_fini(void *arg)
278279
struct xe_tile *tile;
279280
int id;
280281

281-
if (xe->mem.vram.mapping)
282-
iounmap(xe->mem.vram.mapping);
283-
284282
xe->mem.vram.mapping = NULL;
285283

286284
for_each_tile(tile, xe, id)

0 commit comments

Comments
 (0)