Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Mak <makb@juniper.net>
To: <kexec@lists.infradead.org>
Cc: Baoquan He <bhe@redhat.com>, Alexander Graf <graf@amazon.com>,
	Brian Mak <makb@juniper.net>
Subject: [PATCH 1/3] kexec: Add support for disabling usage of CMA
Date: Fri, 12 Jun 2026 15:39:43 -0700	[thread overview]
Message-ID: <20260612223945.1400554-2-makb@juniper.net> (raw)
In-Reply-To: <20260612223945.1400554-1-makb@juniper.net>

Add support for disabling the use of CMA for placing kexec payloads.
This is done via the --no-cma flag.

Signed-off-by: Brian Mak <makb@juniper.net>
---
 kexec/kexec-syscall.h | 1 +
 kexec/kexec.c         | 4 ++++
 kexec/kexec.h         | 8 +++++---
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
index b60804f..77e6b81 100644
--- a/kexec/kexec-syscall.h
+++ b/kexec/kexec-syscall.h
@@ -128,6 +128,7 @@ static inline long kexec_file_load(int kernel_fd, int initrd_fd,
 #define KEXEC_FILE_ON_CRASH	0x00000002
 #define KEXEC_FILE_NO_INITRAMFS	0x00000004
 #define KEXEC_FILE_DEBUG	0x00000008
+#define KEXEC_FILE_NO_CMA	0x00000010
 
 /* These values match the ELF architecture values. 
  * Unless there is a good reason that should continue to be the case.
diff --git a/kexec/kexec.c b/kexec/kexec.c
index 4a49ad4..ccdf4cd 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -1102,6 +1102,7 @@ void usage(void)
 	       " --hotplug            Do in-kernel update of kexec segments on CPU/Memory\n"
 	       "                      hot add/remove events, avoiding the need to reload\n"
 	       "                      kdump kernel on online/offline events.\n"
+	       " --no-cma             Don't use CMA for placing kexec payloads.\n"
 	       " -d, --debug          Enable debugging to help spot a failure.\n"
 	       " -S, --status         Return 1 if the type (by default crash) is loaded,\n"
 	       "                      0 if not.\n"
@@ -1675,6 +1676,9 @@ int main(int argc, char *argv[])
 		case OPT_HOTPLUG:
 			do_hotplug = 1;
 			break;
+		case OPT_NO_CMA:
+			kexec_file_flags |= KEXEC_FILE_NO_CMA;
+			break;
 		default:
 			break;
 		}
diff --git a/kexec/kexec.h b/kexec/kexec.h
index d0bccb5..a1edc1e 100644
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -234,8 +234,9 @@ extern int file_types;
 #define OPT_PRINT_CKR_SIZE	262
 #define OPT_LOAD_LIVE_UPDATE	263
 #define OPT_EXEC_LIVE_UPDATE	264
-#define OPT_HOTPLUG		        265
-#define OPT_MAX		266
+#define OPT_HOTPLUG		265
+#define OPT_NO_CMA		266
+#define OPT_MAX		267
 #define KEXEC_OPTIONS \
 	{ "help",		0, 0, OPT_HELP }, \
 	{ "version",		0, 0, OPT_VERSION }, \
@@ -262,7 +263,8 @@ extern int file_types;
 	{ "debug",		0, 0, OPT_DEBUG }, \
 	{ "status",		0, 0, OPT_STATUS }, \
 	{ "print-ckr-size",     0, 0, OPT_PRINT_CKR_SIZE }, \
-	{ "hotplug",		    0, 0, OPT_HOTPLUG }, \
+	{ "hotplug",		0, 0, OPT_HOTPLUG }, \
+	{ "no-cma",		0, 0, OPT_NO_CMA }, \
 
 #define KEXEC_OPT_STR "h?vdfixyluet:pscaS"
 
-- 
2.34.1



  reply	other threads:[~2026-06-12 22:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12 22:39 [PATCH 0/3] kexec-tools: Add new KEXEC_FILE flags Brian Mak
2026-06-12 22:39 ` Brian Mak [this message]
2026-06-12 22:39 ` [PATCH 2/3] kexec: Add DTB carryover support on x86 Brian Mak
2026-06-12 22:39 ` [PATCH 3/3] kexec: Add kexec_file_load debug print Brian Mak
2026-07-20  9:40 ` [PATCH 0/3] kexec-tools: Add new KEXEC_FILE flags Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260612223945.1400554-2-makb@juniper.net \
    --to=makb@juniper.net \
    --cc=bhe@redhat.com \
    --cc=graf@amazon.com \
    --cc=kexec@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox