[PATCH 16/20] drm/xe/mmio: move mmio_fini over to devm
Matthew Auld
matthew.auld at intel.com
Fri May 10 18:12:29 UTC 2024
Not valid to touch mmio once the device is removed, so make sure we
unmap on removal and not just when driver instance goes away. Also set
the mmio pointers to NULL to hopefully catch such issues more easily.
Signed-off-by: Matthew Auld <matthew.auld at intel.com>
Cc: Andrzej Hajda <andrzej.hajda at intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
---
drivers/gpu/drm/xe/xe_mmio.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_mmio.c b/drivers/gpu/drm/xe/xe_mmio.c
index 05edab0e085d..a3094e741db8 100644
--- a/drivers/gpu/drm/xe/xe_mmio.c
+++ b/drivers/gpu/drm/xe/xe_mmio.c
@@ -387,13 +387,16 @@ void xe_mmio_probe_tiles(struct xe_device *xe)
}
}
-static void mmio_fini(struct drm_device *drm, void *arg)
+static void mmio_fini(void *arg)
{
struct xe_device *xe = arg;
pci_iounmap(to_pci_dev(xe->drm.dev), xe->mmio.regs);
if (xe->mem.vram.mapping)
iounmap(xe->mem.vram.mapping);
+
+ xe->mem.vram.mapping = NULL;
+ xe->mmio.regs = NULL;
}
int xe_mmio_init(struct xe_device *xe)
@@ -418,7 +421,7 @@ int xe_mmio_init(struct xe_device *xe)
root_tile->mmio.size = SZ_16M;
root_tile->mmio.regs = xe->mmio.regs;
- return drmm_add_action_or_reset(&xe->drm, mmio_fini, xe);
+ return devm_add_action_or_reset(xe->drm.dev, mmio_fini, xe);
}
u8 xe_mmio_read8(struct xe_gt *gt, struct xe_reg reg)
--
2.45.0
More information about the Intel-xe
mailing list