to_hpa(9)
π« 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 offsetpos: devices position in interleaver_eiw: region encoded interleave waysr_eig: region encoded interleave granularityhb_ways: host bridge interleave waysmath: interleave arithmetic (MODULO_MATHorXOR_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
- 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