[RFC 2/3] of: kexec: Set up properties for reusing CMA in kdump

Pingfan Liu kernelfans at gmail.com
Sun Dec 17 21:23:24 PST 2023


From: Pingfan Liu <piliu at redhat.com>

Signed-off-by: Pingfan Liu <piliu at redhat.com>
Cc: Jiri Bohac <jbohac at suse.cz>
Cc: Michal Hocko <mhocko at suse.com>
Cc: Philipp Rudo <prudo at redhat.com>
Cc: Baoquan He <bhe at redhat.com>
Cc: Dave Young <dyoung at redhat.com>
To: kexec at lists.infradead.org
---
 drivers/of/kexec.c    | 14 ++++++++++++++
 include/linux/kexec.h |  4 ++++
 2 files changed, 18 insertions(+)

diff --git a/drivers/of/kexec.c b/drivers/of/kexec.c
index 68278340cecf..471b6cdf34ff 100644
--- a/drivers/of/kexec.c
+++ b/drivers/of/kexec.c
@@ -410,6 +410,20 @@ void *of_kexec_alloc_and_setup_fdt(const struct kimage *image,
 			if (ret)
 				goto out;
 		}
+
+		ret = fdt_appendprop_u64(fdt, chosen_node,
+				"kdump,cma_pfn", kdump_cma_pfn);
+		if (ret)
+			goto out;
+		ret = fdt_appendprop_u64(fdt, chosen_node,
+				"kdump,cma_pg_cnt", kdump_cma_pg_cnt);
+		if (ret)
+			goto out;
+		ret = fdt_appendprop_u64(fdt, chosen_node,
+				"kdump,cma_pg_paddr", kdump_cma_pg_paddr);
+		if (ret)
+			goto out;
+
 	}
 
 	/* add bootargs */
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 95e19c814c93..bf2d8b9d8c07 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -408,6 +408,10 @@ bool kexec_load_permitted(int kexec_image_type);
 /* flag to track if kexec reboot is in progress */
 extern bool kexec_in_progress;
 
+extern u64 kdump_cma_pfn;
+extern u64 kdump_cma_pg_cnt;
+extern u64 kdump_cma_pg_paddr;
+
 int crash_shrink_memory(unsigned long new_size);
 ssize_t crash_get_memory_size(void);
 void kdump_kernel_reuse_mem(void);
-- 
2.31.1




More information about the kexec mailing list