[PATCH v2 1/2] kho: add KHOSER_COPY_TYPE(UN)SAFE for phys copy
Tarun Sahu
tarunsahu at google.com
Tue Jun 16 06:23:50 PDT 2026
Adding KHOSER_COPY_TYPESAFE and KHOSER_COPY_TYPEUNSAFE to copy one
serializeable pointer to another. It basically allows copy of phys val
of the serializeable pointer.
Signed-off-by: Tarun Sahu <tarunsahu at google.com>
---
include/linux/kho/abi/kexec_handover.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/linux/kho/abi/kexec_handover.h b/include/linux/kho/abi/kexec_handover.h
index db9bda6dd310..1606369dc1ec 100644
--- a/include/linux/kho/abi/kexec_handover.h
+++ b/include/linux/kho/abi/kexec_handover.h
@@ -139,6 +139,18 @@
(typeof((s).ptr))((s).phys ? phys_to_virt((s).phys) : NULL); \
})
+/* Copies one serializable pointer to another of same type. */
+#define KHOSER_COPY_TYPESAFE(dest, src) \
+ ({ \
+ typecheck(typeof((dest).ptr), (src).ptr); \
+ (dest).phys = (src).phys; \
+ })
+
+/* Copies one serializable pointer to another. */
+#define KHOSER_COPY_TYPEUNSAFE(dest, src) \
+ ({ \
+ (dest).phys = (src).phys; \
+ })
/*
* This header is embedded at the beginning of each `kho_vmalloc_chunk`
* and contains a pointer to the next chunk in the linked list,
--
2.54.0.1136.gdb2ca164c4-goog
More information about the kexec
mailing list