Decouple the vmalloc preservation compatibility version from the global KHO compatibility version KHO_FDT_COMPATIBLE.
Define the independent compatibility version "vmalloc-v1" for vmalloc preservation KHO_VMALLOC_COMPATIBLE in vmalloc.h. Integrate KHO_VMALLOC_COMPATIBLE into the composite root compatibility string KHO_FDT_COMPATIBLE. Additionally, update the memfd compatibility string MEMFD_LUO_FH_COMPATIBLE to include the vmalloc compatibility dependency, and add a static assertion to verify its length limit. Signed-off-by: Pasha Tatashin <[email protected]> --- include/linux/kho/abi/kexec_handover.h | 4 +++- include/linux/kho/abi/memfd.h | 9 ++++++++- include/linux/kho/abi/vmalloc.h | 6 ++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/include/linux/kho/abi/kexec_handover.h b/include/linux/kho/abi/kexec_handover.h index 49ac4b47cc3d..f048bc95fed3 100644 --- a/include/linux/kho/abi/kexec_handover.h +++ b/include/linux/kho/abi/kexec_handover.h @@ -10,6 +10,7 @@ #define _LINUX_KHO_ABI_KEXEC_HANDOVER_H #include <linux/kho/abi/compat.h> #include <linux/kho/abi/radix_tree.h> +#include <linux/kho/abi/vmalloc.h> /** * DOC: Kexec Handover ABI @@ -87,7 +88,8 @@ #define KHO_FDT_COMPAT_BASE "kho-v4" #define KHO_FDT_COMPATIBLE \ KHO_FDT_COMPAT_BASE \ - KHO_SUB_COMPAT(KHO_RADIX_COMPATIBLE) + KHO_SUB_COMPAT(KHO_RADIX_COMPATIBLE) \ + KHO_SUB_COMPAT(KHO_VMALLOC_COMPATIBLE) /* The FDT property for the preserved memory map. */ #define KHO_FDT_MEMORY_MAP_PROP_NAME "preserved-memory-map" diff --git a/include/linux/kho/abi/memfd.h b/include/linux/kho/abi/memfd.h index af310c0c9fdf..24ecbf48cbe1 100644 --- a/include/linux/kho/abi/memfd.h +++ b/include/linux/kho/abi/memfd.h @@ -11,7 +11,9 @@ #ifndef _LINUX_KHO_ABI_MEMFD_H #define _LINUX_KHO_ABI_MEMFD_H +#include <linux/kho/abi/compat.h> #include <linux/kho/abi/kexec_handover.h> +#include <linux/kho/abi/luo.h> #include <linux/kho/abi/vmalloc.h> #include <linux/types.h> @@ -89,6 +91,11 @@ struct memfd_luo_ser { } __packed; /* The compatibility string for memfd file handler */ -#define MEMFD_LUO_FH_COMPATIBLE "memfd-v2" +#define MEMFD_LUO_FH_COMPAT_BASE "memfd-v2" +#define MEMFD_LUO_FH_COMPATIBLE \ + MEMFD_LUO_FH_COMPAT_BASE \ + KHO_SUB_COMPAT(KHO_VMALLOC_COMPATIBLE) + +static_assert(KHO_COMPAT_ALIGN(MEMFD_LUO_FH_COMPATIBLE) <= LIVEUPDATE_HNDL_COMPAT_LENGTH); #endif /* _LINUX_KHO_ABI_MEMFD_H */ diff --git a/include/linux/kho/abi/vmalloc.h b/include/linux/kho/abi/vmalloc.h index 87650e1dd774..1847b82e147b 100644 --- a/include/linux/kho/abi/vmalloc.h +++ b/include/linux/kho/abi/vmalloc.h @@ -9,13 +9,13 @@ * * The Kexec Handover ABI for preserving vmalloc'ed memory is defined by * a set of structures and helper macros. The layout of these structures is a - * stable contract between kernels and is versioned by the KHO_FDT_COMPATIBLE + * stable contract between kernels and is versioned by the KHO_VMALLOC_COMPATIBLE * string. * * This interface is a contract. Any modification to the structure fields, * compatible strings, or the layout of the serialization structures defined * here constitutes a breaking change. Such changes require incrementing the - * version number in the `KHO_FDT_COMPATIBLE` string to prevent a new kernel + * version number in the `KHO_VMALLOC_COMPATIBLE` string to prevent a new kernel * from misinterpreting data from an old kernel. * * Changes are allowed provided the compatibility version is incremented; @@ -36,6 +36,8 @@ #include <linux/types.h> #include <asm/page.h> +#define KHO_VMALLOC_COMPATIBLE "vmalloc-v1" + /* Helper macro to define a union for a serializable pointer. */ #define DECLARE_KHOSER_PTR(name, type) \ union { \ -- 2.53.0
