mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Brian Mak <makb@juniper.net>
To: Dave Young <dyoung@redhat.com>
Cc: Baoquan He <bhe@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Alexander Graf <graf@amazon.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>, Rob Herring <robh@kernel.org>,
	Saravana Kannan <saravanak@google.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"kexec@lists.infradead.org" <kexec@lists.infradead.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 0/2] x86/kexec: Carry forward the boot DTB on kexec
Date: Wed, 13 Aug 2025 19:24:37 +0000	[thread overview]
Message-ID: <A402BEF1-EB1A-48F0-997F-502429AAD92E@juniper.net> (raw)
In-Reply-To: <CALu+AoQnXfYtuKQxVKK32sC4D98Y+Yn30TjTr2xmXhZcHe0x=A@mail.gmail.com>

On Aug 12, 2025, at 8:54 PM, Dave Young <dyoung@redhat.com> wrote:

> Hi, The #ifdef CONFIG_* which can be replaced by #if defined(), but I
> do not have a strong opinion.  other than that do you have kexec-tools
> patch ready? It would be better to provide a link so that people can
> try and test it.

Hi Dave,

Thanks for looking at this! The #ifdef CONFIG_* is used, as it matches
the style of other ifdefs in this file. I'd like to keep it as-is for
consistency.

I do have a prototype kexec-tools patch ready for testing. The changes
can be found at this repo:

https://github.com/makb-juniper/kexec-tools.git

I've also placed the diff below.

Thanks,
Brian

diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
index 9b17578..8419b23 100644
--- a/kexec/kexec-syscall.h
+++ b/kexec/kexec-syscall.h
@@ -124,6 +124,8 @@ 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
+#define KEXEC_FILE_FORCE_DTB	0x00000020
 
 /* 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 6bf12d7..0e13b6b 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"
+	       " --force-dtb          Carry over the current boot's device tree blob (x86 only).\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"
@@ -1640,6 +1641,9 @@ int main(int argc, char *argv[])
 		case OPT_HOTPLUG:
 			do_hotplug = 1;
 			break;
+		case OPT_FORCE_DTB:
+			kexec_file_flags |= KEXEC_FILE_FORCE_DTB;
+			break;
 		default:
 			break;
 		}
diff --git a/kexec/kexec.h b/kexec/kexec.h
index a2e19c4..2235aa2 100644
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -235,7 +235,8 @@ extern int file_types;
 #define OPT_LOAD_LIVE_UPDATE	263
 #define OPT_EXEC_LIVE_UPDATE	264
 #define OPT_HOTPLUG		        265
-#define OPT_MAX		266
+#define OPT_FORCE_DTB		266
+#define OPT_MAX		267
 #define KEXEC_OPTIONS \
 	{ "help",		0, 0, OPT_HELP }, \
 	{ "version",		0, 0, OPT_VERSION }, \
@@ -263,6 +264,7 @@ extern int file_types;
 	{ "status",		0, 0, OPT_STATUS }, \
 	{ "print-ckr-size",     0, 0, OPT_PRINT_CKR_SIZE }, \
 	{ "hotplug",		    0, 0, OPT_HOTPLUG }, \
+	{ "force-dtb",          0, 0, OPT_FORCE_DTB }, \
 
 #define KEXEC_OPT_STR "h?vdfixyluet:pscaS"
 

base-commit: daa29443819d3045338792b5ba950ed90e79d7a5
-- 
2.25.1

  reply	other threads:[~2025-08-13 19:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-05 21:15 Brian Mak
2025-08-05 21:15 ` [PATCH v2 1/2] kexec: Add KEXEC_FILE_NO_CMA as a legal flag Brian Mak
2025-08-21  4:47   ` Andrew Morton
2025-08-21  8:33     ` Baoquan He
2025-08-21 11:53       ` Andrew Morton
2025-08-22  3:33         ` Baoquan He
2025-08-25 18:49           ` Brian Mak
2025-09-04 19:58             ` Brian Mak
2025-09-09  6:33               ` Baoquan He
2025-08-21 16:22     ` Brian Mak
2025-08-05 21:15 ` [PATCH v2 2/2] x86/kexec: Carry forward the boot DTB on kexec Brian Mak
2025-08-12 18:00 ` [PATCH v2 0/2] " Brian Mak
2025-08-13  3:54   ` Dave Young
2025-08-13 19:24     ` Brian Mak [this message]
2025-08-14  2:39       ` Baoquan He

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=A402BEF1-EB1A-48F0-997F-502429AAD92E@juniper.net \
    --to=makb@juniper.net \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dyoung@redhat.com \
    --cc=graf@amazon.com \
    --cc=hpa@zytor.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=robh@kernel.org \
    --cc=saravanak@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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

all inboxes | Powered by JetHome®