From: dyoung@redhat.com
To: kexec@lists.infradead.org
Cc: mjg59@srcf.ucam.org, linux-efi@vger.kernel.org, x86@kernel.org,
James.Bottomley@HansenPartnership.com, horms@verge.net.au,
bp@alien8.de, ebiederm@xmission.com, hpa@zytor.com,
Dave Young <dyoung@redhat.com>,
vgoyal@redhat.com
Subject: [patch 2/3 v2] Add efi_info in x86 setup header
Date: Tue, 05 Nov 2013 16:29:49 +0800 [thread overview]
Message-ID: <20131105083429.095506010@dhcp-16-126.nay.redhat.com> (raw)
In-Reply-To: 20131105082947.500512312@dhcp-16-126.nay.redhat.com
[-- Attachment #1: 02-kexec-padd-efi_info.patch --]
[-- Type: text/plain, Size: 3982 bytes --]
For supporting efi runtime on kexec kernel we need to
fill the efi_info struct in setup_header. I just get
the info in kernel exported boot_params data in debugfs.
v1->v2:
update comment for offset of reserved4_1[] in x87_linux_param_header
Address comment from mjg59: do not break old kernel when use newer kexec-tools.
add checking for xloadflags bit 4 XLF_EFI_KEXEC. Only fill
efi_info and pass acpi_rsdp when the kexec kernel support efi boot.
coding style fix, change internal function to be static
Signed-off-by: Dave Young <dyoung@redhat.com>
---
include/x86/x86-linux.h | 3 ++-
kexec/arch/i386/crashdump-x86.c | 4 +++-
kexec/arch/i386/x86-linux-setup.c | 9 +++++++++
kexec/arch/i386/x86-linux-setup.h | 1 +
kexec/arch/x86_64/kexec-bzImage64.c | 6 ++++++
5 files changed, 21 insertions(+), 2 deletions(-)
--- kexec-tools.orig/include/x86/x86-linux.h
+++ kexec-tools/include/x86/x86-linux.h
@@ -115,7 +115,8 @@ struct x86_linux_param_header {
uint32_t ext_ramdisk_image; /* 0xc0 */
uint32_t ext_ramdisk_size; /* 0xc4 */
uint32_t ext_cmd_line_ptr; /* 0xc8 */
- uint8_t reserved4_1[0x1e0 - 0xcc]; /* 0xcc */
+ uint8_t reserved4_1[0x1c0 - 0xcc]; /* 0xe4 */
+ uint8_t efi_info[32]; /* 0x1c0 */
uint32_t alt_mem_k; /* 0x1e0 */
uint8_t reserved5[4]; /* 0x1e4 */
uint8_t e820_map_nr; /* 0x1e8 */
--- kexec-tools.orig/kexec/arch/i386/x86-linux-setup.c
+++ kexec-tools/kexec/arch/i386/x86-linux-setup.c
@@ -466,6 +466,13 @@ void setup_subarch(struct x86_linux_para
get_bootparam(&real_mode->hardware_subarch, offset, sizeof(uint32_t));
}
+static void setup_efi_info(struct x86_linux_param_header *real_mode)
+{
+ off_t offset = offsetof(typeof(*real_mode), efi_info);
+
+ get_bootparam(&real_mode->efi_info, offset, 32);
+}
+
void setup_linux_system_parameters(struct kexec_info *info,
struct x86_linux_param_header *real_mode)
{
@@ -475,6 +482,8 @@ void setup_linux_system_parameters(struc
/* get subarch from running kernel */
setup_subarch(real_mode);
+ if (bzImage_support_efi_boot)
+ setup_efi_info(real_mode);
/* Default screen size */
real_mode->orig_x = 0;
--- kexec-tools.orig/kexec/arch/i386/crashdump-x86.c
+++ kexec-tools/kexec/arch/i386/crashdump-x86.c
@@ -41,6 +41,7 @@
#include "../../crashdump.h"
#include "kexec-x86.h"
#include "crashdump-x86.h"
+#include "x86-linux-setup.h"
#ifdef HAVE_LIBXENCTRL
#ifdef HAVE_XC_GET_MACHINE_MEMORY_MAP
@@ -1046,7 +1047,8 @@ int load_crashdump_segments(struct kexec
if (delete_memmap(memmap_p, elfcorehdr, memsz) < 0)
return -1;
cmdline_add_memmap(mod_cmdline, memmap_p);
- cmdline_add_efi(mod_cmdline);
+ if (!bzImage_support_efi_boot)
+ cmdline_add_efi(mod_cmdline);
cmdline_add_elfcorehdr(mod_cmdline, elfcorehdr);
/* Inform second kernel about the presence of ACPI tables. */
--- kexec-tools.orig/kexec/arch/i386/x86-linux-setup.h
+++ kexec-tools/kexec/arch/i386/x86-linux-setup.h
@@ -28,5 +28,6 @@ void setup_linux_system_parameters(struc
/* command line parameter may be appended by purgatory */
#define PURGATORY_CMDLINE_SIZE 64
+extern int bzImage_support_efi_boot;
#endif /* X86_LINUX_SETUP_H */
--- kexec-tools.orig/kexec/arch/x86_64/kexec-bzImage64.c
+++ kexec-tools/kexec/arch/x86_64/kexec-bzImage64.c
@@ -42,6 +42,7 @@
#include <arch/options.h>
static const int probe_debug = 0;
+int bzImage_support_efi_boot;
int bzImage64_probe(const char *buf, off_t len)
{
@@ -82,6 +83,11 @@ int bzImage64_probe(const char *buf, off
/* Must be KERNEL_64 and CAN_BE_LOADED_ABOVE_4G */
return -1;
}
+
+#define XLF_EFI_KEXEC (1 << 4)
+ if ((header->xloadflags & XLF_EFI_KEXEC) == XLF_EFI_KEXEC)
+ bzImage_support_efi_boot = 1;
+
/* I've got a relocatable bzImage64 */
if (probe_debug)
fprintf(stderr, "It's a relocatable bzImage64\n");
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2013-11-05 8:39 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-05 8:29 [patch 0/3 v2] kexec-tools: efi runtime support dyoung
2013-11-05 8:29 ` [patch 1/3 v2] Add function get_bootparam dyoung
2013-11-12 1:27 ` Toshi Kani
2013-11-12 2:14 ` Dave Young
2013-11-12 3:20 ` H. Peter Anvin
2013-11-12 3:53 ` Ingo Molnar
[not found] ` <aa0ccca4-b27b-41b6-8adb-3c969eb29bf7@email.android.com>
2013-11-12 14:26 ` Vivek Goyal
2013-11-12 7:58 ` Greg KH
2013-11-12 8:08 ` Dave Young
2013-11-12 8:30 ` Greg KH
2013-11-12 8:50 ` Dave Young
2013-11-12 9:37 ` H. Peter Anvin
2013-11-12 9:51 ` Greg KH
2013-11-13 0:50 ` Dave Young
2013-11-18 2:22 ` Dave Young
2013-11-18 3:29 ` H. Peter Anvin
2013-11-18 5:29 ` Dave Young
2013-11-18 5:36 ` H. Peter Anvin
2013-11-05 8:29 ` dyoung [this message]
2013-11-05 8:29 ` [patch 3/3 v2] Passing efi related data via setup_data dyoung
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=20131105083429.095506010@dhcp-16-126.nay.redhat.com \
--to=dyoung@redhat.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=bp@alien8.de \
--cc=ebiederm@xmission.com \
--cc=horms@verge.net.au \
--cc=hpa@zytor.com \
--cc=kexec@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=mjg59@srcf.ucam.org \
--cc=vgoyal@redhat.com \
--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