ioremap(9)
π ioremap(9) β the kernel API manual glow-up
okay so bestie, buckle up, we're talking about ioremap β the ioremap(9) page from the Kernel API Manual. it maps bus memory into CPU space and honestly it's giving bridge-between-worlds main character energy πβ¨
πΈ NAME πΈ
ioremap β map bus memory into CPU space. literally its whole job, no cap π
β¨ SYNOPSIS β¨
void __iomem * ioremap (resource_size_t phys_addr , unsigned long size );
π ARGUMENTS π
phys_addrβ the bus address of the memory, i.e. where the thing lives on the bus πsizeβ the size of the resource you wanna map, so the kernel knows how much to grab π«Ά
π¦ DESCRIPTION π¦
okay so ioremap performs a platform specific sequence of operations to make bus memory CPU accessible via the readb/readw/readl/writeb/writew/writel functions and the other mmio helpers. slay. that's the entire point of it existing π
but heads up: the returned address is not guaranteed to be usable directly as a virtual address. so like... don't just go dereferencing it raw, bestie, that's not the vibe π
this version of ioremap ensures that the memory is marked uncachable on the CPU as well as honouring existing caching rules from things like the PCI bus. note that there are other caches and buffers on many busses β so yes, ioremap did its part, but the world is bigger than one function π in particular, driver authors should read up on PCI writes. fr fr, go read up on PCI writes, it's important.
it's useful if some control registers are in such an area and write combining or read caching is not desirable:
π¨ and like, the actual rule that matters most: must be freed with iounmap. no leaking, no leaving it mapped forever, we don't do that here π
β SEE ALSO β
- Kernel file
./arch/x86/mm/ioremap.cπ ioremap_uc(9)ioremap_wc(9)ioremap_wt(9)iounmap(9)β the one you must call, remember? π«Ά
and that's the tea π this icon came from ./arch/x86/mm and it's dated October 2026 β so yeah, freshly stamped and still iconic. go map responsibly, bestie πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms