Re: [PATCH] resource: export iomem_get_mapping() for loadable modules
From: Ravi Kumar Bandi
Date: Mon May 11 2026 - 12:52:41 EST
On Mon, May 11, 2026 at 00:17:45 -0700, Christoph Hellwig wrote:
> And why?
On Mon, May 11, 2026 at 09:14:04 +0200, David Hildenbrand wrote:
> Which in-tree driver wants to make use of this?
Thank you both for reviewing the patch.
Currently this is needed by a PCIe endpoint driver that handles surprise
removal on a device without a hot-plug pin routed to the CPU. The link-down
event is detected by the in-tree Xilinx DMA PL PCIe controller driver
(drivers/pci/controller/pcie-xilinx-dma-pl.c), which notifies the endpoint
driver via the link-down callback.
When link-down is detected, the endpoint driver needs to zap existing
userspace BAR mappings (mmap'd via sysfs resource files) to deliver SIGBUS
rather than leaving stale mappings to a dead device, preventing kernel
crashes on subsequent accesses.
unmap_mapping_range() is already EXPORT_SYMBOL'd for this purpose
(mm/memory.c), but without iomem_get_mapping() being exported, loadable
modules cannot use it correctly for PCI BAR mappings, forcing ugly
workarounds such as walking all process VMAs.
Regards,
Ravi Kumar Bandi