]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/amdgpu: fix aperture iounmap skipped on device removal
authorAsad Kamal <asad.kamal@amd.com>
Thu, 30 Jul 2026 07:00:00 +0000 (15:00 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 6 Aug 2026 18:34:02 +0000 (14:34 -0400)
commitf9e5f51549000e2665e3b5e02ff876b9e09cfe95
treed992d09fa1cb180a40d31b1c305a0105e4a6dcc6
parent3141e3d61469bba2624a91c5e2407f110b33b29e
drm/amdgpu: fix aperture iounmap skipped on device removal

amdgpu_pci_remove() calls drm_dev_unplug() before invoking the fini
routines. After drm_dev_unplug() the drm_dev_enter() guard in
amdgpu_ttm_fini() always returns false, so iounmap() for
aper_base_kaddr is silently skipped. On connected_to_cpu hardware
ioremap_cache() maps the aperture as WB; when iounmap() is skipped the
stale WB PAT entry persists. On reload IP discovery's
memremap(MEMREMAP_WC) on the same aperture range hits a WB/WC conflict,
producing an ioremap error and failing re-probe.

Remove the drm_dev_enter() guard and call iounmap() unconditionally.
The aperture mapping is plain MMIO and does not require device-presence
protection. Surprise-removal cleanup of aper_base_kaddr is already
handled unconditionally by amdgpu_device_unmap_mmio().

Fixes: 62d5f9f7110a ("drm/amdgpu: Unmap MMIO mappings when device is not unplugged")
Signed-off-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit fb3f68af9f6fce9343a2bd13b4d68a1c02d283df)
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c