Re: [PATCH RFC 12/20] ctlv: Add device and operation dispatch
From: Jason Gunthorpe
Date: Mon Oct 26 2026 - 10:11:52 EST
> [ ... 125 lines skipped ... ]
> +struct ctlv_priv_container {
> + struct ctlv_priv_container *parent;
> + struct ctlv_priv_container *child;
> + u8 priv[] __aligned(CTLV_PRIV_ALIGN);
> +};
This scheme with priv is very clever, but..
The usage in the tdx driver ends up having both the
ctlv_priv_parent() and ctlv_priv_child() calls, but there isn't any
type safety and it just seems worse off than using the normal
container_of approach.
I think it is a nice thing to have for someday if we get to a place
that needs more than two things, but for attestation subsystem I think
it would be clearer to have the normal container_of relationship and
some reliable way to get the 'struct attestation'
At the very least the parent/priv functions should take in the family
ID they are trying to seek too, for an assertin, and many cases are
probably better off with just a simple:
ctlv_priv_get(ctx, family);
That is slower but always gives the right thing..
--
Jason