ARM64 Binary Image Support
Subsystems (2)
v2 cover ARM64 Binary Image Support
These patches are discreet and for Geoff to apply on his tree, so that they can further be sent to upstream with other ARM64 patches.
Patch 1 will apply on top of [1].
Patch (2-9): I am not sending as they are from AKASHI Takahiro's tree [2].
Patch (10-11) will apply after pulling Takahiro's kdump patches[2].
Changes since V1:
-- --page-offset helper moved to image_arm64_usage
-- debug values are getting printed if user page offset did not match
with text page offset
Pratyush Anand (3):
arm64: Kexec: Add support for binary image
arm64: kdump: Add support for binary image
arm64: wait for transmit completion before next character transmission
[1] git://git.kernel.org/pub/scm/linux/kernel/git/geoff/kexec-tools.git
: master (2f5f0e06823c)
[2] git://git.linaro.org/people/takahiro.akashi/kexec-tools.git
:kdump/v0.12 (fcaad9577789..913c2ec2d045)
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
PATCH v2 1/11 arm64: Kexec: Add support for binary image
This patch adds support to use binary image ie arch/arm64/boot/Image.
Binary image does not have sufficient knowledge to extract page offset information, which is needed by kexec tool. Use a new command parameter --page-offset, so that user can provide page offset information for linear mapping.
--- kexec/arch/arm64/include/arch/options.h | 9 ++-- kexec/arch/arm64/kexec-arm64.c | 3 ++ kexec/arch/arm64/kexec-arm64.h | 2 + kexec/arch/arm64/kexec-image-arm64.c | 86 +++++++++++++++++++++++++++++++-- 4 files changed, 93 insertions(+), 7 deletions(-)
kexec/arch/arm64/include/arch/options.h +6 -3
@@ -5,9 +5,10 @@#define OPT_DTB ((OPT_MAX)+1)#define OPT_INITRD ((OPT_MAX)+2)#define OPT_LITE ((OPT_MAX)+3) -#define OPT_PORT ((OPT_MAX)+4) -#define OPT_REUSE_CMDLINE ((OPT_MAX+5)) -#define OPT_ARCH_MAX ((OPT_MAX)+6) +#define OPT_PAGE_OFFSET ((OPT_MAX)+4) +#define OPT_PORT ((OPT_MAX)+5) +#define OPT_REUSE_CMDLINE ((OPT_MAX+6)) +#define OPT_ARCH_MAX ((OPT_MAX)+7)#define KEXEC_ARCH_OPTIONS \ KEXEC_OPTIONS \
@@ -16,6 +17,7 @@ { "dtb", 1, NULL, OPT_DTB }, \ { "initrd", 1, NULL, OPT_INITRD }, \ { "lite", 0, NULL, OPT_LITE }, \ + { "page-offset", 1, NULL, OPT_PAGE_OFFSET }, \ { "port", 1, NULL, OPT_PORT }, \ { "ramdisk", 1, NULL, OPT_INITRD }, \ { "reuse-cmdline", 0, NULL, OPT_REUSE_CMDLINE }, \
@@ -38,6 +40,7 @@ struct arm64_opts {const char *command_line;const char *dtb;const char *initrd; +uint64_t page_offset;uint64_t port;int lite; };
kexec/arch/arm64/kexec-arm64.c +3 -0
@@ -100,6 +100,9 @@ int arch_process_options(int argc, char **argv)case OPT_PORT : arm64_opts.port =strtoull (optarg,NULL ,0 );break ; +case OPT_PAGE_OFFSET : + arm64_opts.page_offset =strtoull (optarg,NULL ,0 ); +break ;default :break ;/* Ignore core and unknown options. */ }
kexec/arch/arm64/kexec-arm64.h +2 -0
@@ -17,6 +17,8 @@#define BOOT_BLOCK_LAST_COMP_VERSION 16#define COMMAND_LINE_SIZE 512 +#define ARM64_DEFAULT_PAGE_OFFSET 0xfffffe0000000000 +int elf_arm64_probe (const char *kernel_buf,off_t kernel_size);int elf_arm64_load (int argc,char **argv,const char *kernel_buf,off_t kernel_size,struct kexec_info *info);
kexec/arch/arm64/kexec-image-arm64.c +82 -4
108 lines not on this page · raw message
Signature · 7 lines
2.1.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v2 10/11 arm64: kdump: Add support for binary image
In reply to Pratyush AnandThis patch adds support to use binary image ie arch/arm64/boot/Image with kdump.
--- kexec/arch/arm64/kexec-image-arm64.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
kexec/arch/arm64/kexec-image-arm64.c +18 -6
@@ -10,6 +10,7 @@#include <libfdt.h> #include <stdlib.h> +#include "crashdump-arm64.h" #include "dt-ops.h" #include "image-header.h" #include "kexec-arm64.h"
@@ -97,13 +98,23 @@ int image_arm64_load(int argc, char **argv, const char *kernel_buf, arm64_mem.page_offset =get_kernel_page_offset (); - result =parse_iomem_single ("Kernel code\n" , &start,NULL ); +if (info->kexec_flags &KEXEC_ON_CRASH ) { + result =load_crashdump_segments (info, &header_option); -if (result) { -fprintf (stderr,"kexec: Could not get kernel code address.\n" ); -return -1 ; +if (result) { +fprintf (stderr,"kexec: load crashdump segments failed.\n" ); +return -1 ; + } + start = crash_reserved_mem.start; + }else { + result =parse_iomem_single ("Kernel code\n" , &start,NULL ); + +if (result) { +fprintf (stderr,"kexec: Could not get kernel code address.\n" ); +return -1 ; + } + start -= arm64_mem.text_offset; } - start -= arm64_mem.text_offset;/* Add kernel */ add_segment_phys_virt(info, kernel_buf, kernel_size,
@@ -112,7 +123,8 @@ int image_arm64_load(int argc, char **argv, const char *kernel_buf, info->entry = (void *)start + arm64_mem.text_offset; - result =arm64_load_other_segments (info, (unsigned long )info->entry); + result =arm64_load_other_segments (info, (unsigned long )info->entry, + header_option);if (header_option)free (header_option);
Signature · 7 lines
2.1.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH v2 11/11 arm64: wait for transmit completion before next character transmission
In reply to Pratyush AnandPrevious transmission must be completed before next character to be transmitted, otherwise TX buffer may saturate and we will not see all the characters on screen.
--- purgatory/arch/arm64/purgatory-arm64.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
purgatory/arch/arm64/purgatory-arm64.c +23 -1
@@ -11,15 +11,37 @@ extern uint32_t *arm64_sink;extern void (*arm64_kernel_entry)(uint64_t );extern uint64_t arm64_dtb_addr; +static void wait_for_xmit_complete (void ) +{ +volatile uint32_t status; +volatile uint32_t *status_reg; + +/* +* Since most of the UART with ARM platform has LSR register at +* offset 0x14 and should have value as 0x60 for TX empty, so we +* have hardcoded these values. Can modify in future if need +* arises. +*/ + status_reg = (volatile uint32_t *)((uint64_t )arm64_sink +0x14 ); +while (1 ) { + status = *status_reg; +if ((status &0x60 ) ==0x60 ) +break ; + } +} +void putchar (int ch) {if (!arm64_sink)return ; +wait_for_xmit_complete (); *arm64_sink = ch; -if (ch =='\n' ) +if (ch =='\n' ) { +wait_for_xmit_complete (); *arm64_sink ='\r' ; + } }void setup_arch (void )
Signature · 7 lines
2.1.0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH V2 11/11] arm64: wait for transmit completion before next character transmission
Hi,
I tested this on the foundation model and it hangs.
-Geoff
Quoted 46 lines · Pratyush Anand
Previous transmission must be completed before next character to be transmitted, otherwise TX buffer may saturate and we will not see all the characters on screen.
Signed-off-by Pratyush Anand <[email protected]>--- purgatory/arch/arm64/purgatory-arm64.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)purgatory/arch/arm64/purgatory-arm64.c +7
-0@@ -11,15 +11,37 @@ extern uint32_t *arm64_sink;extern void (*arm64_kernel_entry)(uint64_t );extern uint64_t arm64_dtb_addr; +static void wait_for_xmit_complete (void ) +{ +volatile uint32_t status; +volatile uint32_t *status_reg; + +/* +* Since most of the UART with ARM platform has LSR register at
purgatory/arch/arm64/purgatory-arm64.c +1
-0+* offset 0x14 and should have value as 0x60 for TX empty, so we
purgatory/arch/arm64/purgatory-arm64.c +4
-0+* have hardcoded these values. Can modify in future if need +* arises. +*/ + status_reg = (volatile uint32_t *)((uint64_t)arm64_sink +
0x14);purgatory/arch/arm64/purgatory-arm64.c +8
-0+while (1 ) { + status = *status_reg; +if ((status &0x60 ) ==0x60 ) +break ; + } +} +void putchar (int ch) {if (!arm64_sink)return ; +wait_for_xmit_complete ();
purgatory/arch/arm64/purgatory-arm64.c extern uint32_t *arm64_sink; · line 47
Quoted 10 lines
purgatory/arch/arm64/purgatory-arm64.c +3
-1*arm64_sink = ch; -if (ch =='\n' ) +if (ch =='\n' ) { +wait_for_xmit_complete (); *arm64_sink ='\r' ; + } }void setup_arch (void )
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH V2 11/11] arm64: wait for transmit completion before next character transmission
On 19/10/2015:03:29:55 PM, Geoff Levand wrote:
Hi Geoff,
Quoted 2 lines
I tested this on the foundation model and it hangs.
Thanks for testing it.
Which uart model has been used in foundation model?
Does it have LSR register at offset 0x14? Should we expect 0x60 in LSR for TX buffer to be empty? May be I can do a V3 of this patch where we pass --port="uart_base","LSR","TX_EMPTY" (like --port=0x1c020000,0x14,0x60).
~Pratyush
Quoted 52 lines
-Geoff
Quoted 48 lines · Pratyush Anand
Previous transmission must be completed before next character to be transmitted, otherwise TX buffer may saturate and we will not see all the characters on screen.
Signed-off-by Pratyush Anand <[email protected]>--- purgatory/arch/arm64/purgatory-arm64.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)purgatory/arch/arm64/purgatory-arm64.c +7
-0@@ -11,15 +11,37 @@ extern uint32_t *arm64_sink;extern void (*arm64_kernel_entry)(uint64_t );extern uint64_t arm64_dtb_addr; +static void wait_for_xmit_complete (void ) +{ +volatile uint32_t status; +volatile uint32_t *status_reg; + +/* +* Since most of the UART with ARM platform has LSR register at
purgatory/arch/arm64/purgatory-arm64.c +1
-0+* offset 0x14 and should have value as 0x60 for TX empty, so we
purgatory/arch/arm64/purgatory-arm64.c +4
-0+* have hardcoded these values. Can modify in future if need +* arises. +*/ + status_reg = (volatile uint32_t *)((uint64_t)arm64_sink +
0x14);purgatory/arch/arm64/purgatory-arm64.c +8
-0+while (1 ) { + status = *status_reg; +if ((status &0x60 ) ==0x60 ) +break ; + } +} +void putchar (int ch) {if (!arm64_sink)return ; +wait_for_xmit_complete (); *arm64_sink = ch;
Quoted 8 lines
purgatory/arch/arm64/purgatory-arm64.c extern uint32_t *arm64_sink; · line 47
Quoted 8 lines
purgatory/arch/arm64/purgatory-arm64.c +3
-1-if (ch =='\n' ) +if (ch =='\n' ) { +wait_for_xmit_complete (); *arm64_sink ='\r' ; + } }void setup_arch (void )
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH V2 11/11] arm64: wait for transmit completion before next character transmission
Hi,
Quoted 6 lines · Pratyush Anand
On 19/10/2015:03:29:55 PM, Geoff Levand wrote:
I tested this on the foundation model and it hangs.Thanks for testing it.
Which uart model has been used in foundation model?
I only tested it, but did not look into it. The documentation should be on the ARM developer's site.
-Geoff
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Re: [PATCH V2 11/11] arm64: wait for transmit completion before next character transmission
Hi Geoff,
Quoted 6 lines · Geoff Levand
Hi,
Quoted 3 lines · Pratyush Anand
On 19/10/2015:03:29:55 PM, Geoff Levand wrote:
I tested this on the foundation model and it hangs.
Quoted 6 lines
Quoted 3 lines
Thanks for testing it.
Which uart model has been used in foundation model?
I only tested it, but did not look into it. The documentation should be on the ARM developer's site.
Line status register offset for pl011(which is in foundation model) and 8250 based uart are not same. I think, in that case we should keep separate argument for lsr. Can you please try patch[1] and let me know your feedback.
If you are using UART0 of foundation model, then you would be passing --port=0x1C090000. With patch[1], you may pass one more argument --port-lsr=0x1C090018,0x80. Even if --port-lsr is not passed to kexec() system call, it will not hang. However, one may not see all the printed character without --port-lsr.
~Pratyush
[1] https://github.com/pratyushanand/kexec-tools/commit/57344a8516447cefabc2372daf9a6b0b04bd9851
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Hi Geoff,
Quoted 3 lines · Pratyush Anand
These patches are discreet and for Geoff to apply on his tree, so that they can further be sent to upstream with other ARM64 patches.
please let me know if you find any more concern with these patches.
~Pratyush
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec