On 10/20/25 07:42, Sean Christopherson wrote: ... > If some form of type safety is the goal, why not do something like this? > > typedef void __private *tdx_page_t; > > Or maybe even define a new address space. > > # define __tdx __attribute__((noderef, address_space(__tdx))) Sean, I hacked up a TDX physical address namespace for sparse. It's not awful. It doesn't make the .c files any uglier (or prettier really). It definitely adds code because it needs a handful of conversion functions. But those are all one-liner functions. Net, this approach seems to add a few conversion functions versus the 'struct page' approach. That's because there are at least a couple of places that *need* a 'struct page' like tdx_unpin(). There's some wonkiness in this like using virtual addresses to back the "paddr" type. I did that so we could still do NULL checks instead of keeping some explicit "invalid paddr" value. It's hidden in the helpers and not exposed to the users, but it is weird for sure. The important part isn't what the type is in the end, it's that something is making it opaque. This can definitely be taken further like getting rid of tdx->vp.tdvpr_pa precalcuation. But it's mostly a straight s/struct page */tdx_paddr_t/ replacement. I'm not looking at this and jumping up and down for how much better it makes the code. It certainly *can* find a few things by leveraging sparse. But, honestly, after seeing that nobody runs or cares about sparse on this code, it's hard to take it seriously. Was this generally what you had in mind? Should I turn this into a real series?