[PATCH v4 05/19] kho: Add feature header for fine-grained ABI compatibility
Pasha Tatashin
pasha.tatashin at soleen.com
Tue Nov 10 07:12:22 PST 2026
On Tue Nov 10, 2026 at 12:01 AM EST, Tarun Sahu wrote:
> +/**
> + * DECLARE_KHO_SER - Register a serialized payload structure with KHO.
> + * @name: Structure tag name (e.g. luo_ser).
> + * @payload_size: Compile-time expected size of struct @name in bytes.
> + * @nr_required: Total number of defined required features.
> + * @nr_optional: Total number of defined optional features.
> + *
> + * Size and 8-byte alignment are asserted under CONFIG_64BIT: KHO and LUO are
> + * 64-bit only, while !CONFIG_KEXEC_HANDOVER stubs pull ABI headers into
> + * 32-bit builds where u64 has 4-byte or 2-byte alignment.
> + */
> +#define DECLARE_KHO_SER(name, payload_size, nr_required, nr_optional) \
> + static_assert(!IS_ENABLED(CONFIG_64BIT) || \
> + sizeof(struct name) == (payload_size), \
> + "struct " #name " size mismatch"); \
> + static_assert(!IS_ENABLED(CONFIG_64BIT) || \
> + __alignof__(struct name) == 8, \
> + "struct " #name " must be 8-byte aligned"); \
> + extern struct kho_ser_hdr __kho_ser_hdr_##name; \
Remove this extern.
> + enum { \
> + __KHO_SER_SIZE_##name = (payload_size), \
> + __KHO_SER_NR_REQUIRED_##name = (nr_required), \
> + __KHO_SER_NR_OPTIONAL_##name = (nr_optional), \
> + }
> +
> +/**
> + * DECLARE_KHO_SER_HDR - Declare a feature header variable, field, or parameter.
> + * @name: Structure tag name registered with DECLARE_KHO_SER().
> + * @decl: Declarator (e.g. *fhdr, **out_fhdr, or * inside DECLARE_KHOSER_PTR).
> + *
> + * Declares @decl with type struct kho_ser_hdr while checking at compile time
> + * that @name was registered with DECLARE_KHO_SER(), documenting which
> + * serialized payload structure a feature header pointer belongs to.
> + */
> +#define DECLARE_KHO_SER_HDR(name, decl) typeof(__kho_ser_hdr_##name) decl
Remove DECLARE_KHO_SER_HDR, use kho_ser_hdr directly.
--
Pasha
More information about the kexec
mailing list