arch_phys_wc_add(9)
π arch_phys_wc_add(9) β from the Kernel API Manual, bestie
okay so picture this: you're deep in kernel land, the manual name is literally arch_phys_wc_add, and you need to know what it does. say less. i got you. π«Ά
β¨ NAME β¨
arch_phys_wc_add β add a WC MTRR and handle errors if PAT is unavailable. that's the whole vibe. π«
π SYNOPSIS π
int arch_phys_wc_add (unsigned long base , unsigned long size );
like, it returns an int. remember that. it matters later, i promise. π
πΈ ARGUMENTS πΈ
baseβ the physical base address. where the region starts, periodt. πsizeβ size of region. how much of it we're talking about, bestie. π
π DESCRIPTION π
so here's the tea, and it's giving conditional logic. π΅
If PAT is available, this function literally does nothing. nothing. zero. it's a no-op and it's iconic for it. π§
If PAT is not available, then it actually gets to work: it attempts to add a WC MTRR covering size bytes starting at base β and if that fails, it logs an error. no cap, that's it. π¨
lowkey important: the caller should provide a power of two size on an equivalent power of two boundary. the sizes gotta line up like a perfect little grid. if they don'tβ¦ bestie. β οΈ
Also, drivers must store the return value so they can pass it to mtrr_del_wc_if_needed later β but drivers should not try to interpret that return value. store it, hand it off, don't read into it. it's not that kind of return value. ππ
π¦ SEE ALSO π¦
- Kernel file
./arch/x86/kernel/cpu/mtrr/mtrr.cπ mtrr_rendezvous_handler(9)set_mtrr(9)mtrr_add_page(9)mtrr_add(9)mtrr_del_page(9)mtrr_del(9)mtrr_bp_init(9)mtrr_save_state(9)
and that's the page!! π brought to you by ./arch/x86/kernel/cpu/mtrr, dated October 2026, in the arch_phys_wc_add(9) section of the Kernel API Manual. mwah. πβ¨π
π¦ 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