to_hpa(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’« to_hpa(9) β€” the Kernel API Manual glow-up πŸ’«

okay bestie, gather round, because we're doing math today ✨ this little icon lives in the Kernel API Manual, and its whole job is literally just: calculate an HPA offset from a DPA offset and position. that's it. that's the gig. no cap. πŸŽ€


🌸 NAME 🌸

to_hpa β€” calculate an HPA offset from a DPA offset and position πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

u64 to_hpa (u64 dpa_offset , int pos , u8 r_eiw , u16 r_eig , u8 hb_ways
, u8 math );

look at her. six arguments. main character energy fr fr πŸ‘‘


✨ ARGUMENTS ✨

okay so the original is very mysterious about these and honestly? we respect the privacy. every single one is listed as "-- undescribed --" and we are NOT going to make stuff up, so here's the full roster, untouched, exactly as the page gives them:

  • dpa_offset β€” -- undescribed -- πŸ™ˆ
  • pos β€” -- undescribed -- πŸ™ˆ
  • r_eiw β€” -- undescribed -- πŸ™ˆ
  • r_eig β€” -- undescribed -- πŸ™ˆ
  • hb_ways β€” -- undescribed -- πŸ™ˆ
  • math β€” -- undescribed -- πŸ™ˆ
ngl the arguments section is giving "no thoughts, head empty" but that's literally what the manpage says, so we're keeping it πŸ’€ (the description below spills the tea though β€” keep reading 🫢)

πŸ’– DESCRIPTION πŸ’–

here's the actual lore, laid out one parameter at a time, because the original does it in one long run-on line and we're being nice to your eyeballs:

  • dpa_offset: device physical address offset
  • pos: devices position in interleave
  • r_eiw: region encoded interleave ways
  • r_eig: region encoded interleave granularity
  • hb_ways: host bridge interleave ways
  • math: interleave arithmetic (MODULO_MATH or XOR_MATH)

so you feed her a DPA offset, a position in the interleave, the region's encoded interleave ways and granularity, the host bridge interleave ways, and which flavor of interleave arithmetic you're vibing with β€” MODULO_MATH or XOR_MATH β€” and she does her thing. iconic. 🧚


πŸ”₯ RETURN πŸ”₯

host physical address offset 🫢 (that's the u64, bestie, that's the whole point)


🌈 SEE ALSO 🌈

go touch some more kernel grass, these are all right here in the kernel file ./tools/testing/cxl/test/cxl_translate.c:

iykyk πŸ‘‘


so yeah β€” that's to_hpa(9), short and sweet and absolutely slaying in the CXL test tooling ✨ big thanks to the ./tools/testing/cxl/test source for bringing us this baddie, dated October 2026. mwah πŸ’‹ go translate some addresses, bestie πŸ’œ

πŸ“¦ where this page comes from