arch_phys_wc_add(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 πŸ¦‹


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