Commit d0d249d7 authored by Philipp Rudo's avatar Philipp Rudo Committed by Martin Schwidefsky

s390/kexec_file: Simplify parmarea access

Access the parmarea in head.S via a struct instead of individual offsets.

While at it make the fields in the parmarea .quads.
Signed-off-by: default avatarPhilipp Rudo <prudo@linux.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 4c0f032d
...@@ -323,13 +323,14 @@ ENTRY(startup_kdump) ...@@ -323,13 +323,14 @@ ENTRY(startup_kdump)
# #
# params at 10400 (setup.h) # params at 10400 (setup.h)
# Must be keept in sync with struct parmarea in setup.h
# #
.org PARMAREA .org PARMAREA
.long 0,0 # IPL_DEVICE .quad 0 # IPL_DEVICE
.long 0,0 # INITRD_START .quad 0 # INITRD_START
.long 0,0 # INITRD_SIZE .quad 0 # INITRD_SIZE
.long 0,0 # OLDMEM_BASE .quad 0 # OLDMEM_BASE
.long 0,0 # OLDMEM_SIZE .quad 0 # OLDMEM_SIZE
.org COMMAND_LINE .org COMMAND_LINE
.byte "root=/dev/ram0 ro" .byte "root=/dev/ram0 ro"
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/setup.h>
/* /*
* KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return. * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return.
* I.e. Maximum page that is mapped directly into kernel memory, * I.e. Maximum page that is mapped directly into kernel memory,
...@@ -51,11 +52,11 @@ struct s390_load_data { ...@@ -51,11 +52,11 @@ struct s390_load_data {
/* Pointer to the kernel buffer. Used to register cmdline etc.. */ /* Pointer to the kernel buffer. Used to register cmdline etc.. */
void *kernel_buf; void *kernel_buf;
/* Parmarea in the kernel buffer. */
struct parmarea *parm;
/* Total size of loaded segments in memory. Used as an offset. */ /* Total size of loaded segments in memory. Used as an offset. */
size_t memsz; size_t memsz;
/* Load address of initrd. Used to register INITRD_START in kernel. */
unsigned long initrd_load_addr;
}; };
int kexec_file_add_purgatory(struct kimage *image, int kexec_file_add_purgatory(struct kimage *image,
......
...@@ -65,6 +65,16 @@ ...@@ -65,6 +65,16 @@
#define OLDMEM_SIZE (*(unsigned long *) (OLDMEM_SIZE_OFFSET)) #define OLDMEM_SIZE (*(unsigned long *) (OLDMEM_SIZE_OFFSET))
#define COMMAND_LINE ((char *) (COMMAND_LINE_OFFSET)) #define COMMAND_LINE ((char *) (COMMAND_LINE_OFFSET))
struct parmarea {
unsigned long ipl_device; /* 0x10400 */
unsigned long initrd_start; /* 0x10408 */
unsigned long initrd_size; /* 0x10410 */
unsigned long oldmem_base; /* 0x10418 */
unsigned long oldmem_size; /* 0x10420 */
char pad1[0x10480 - 0x10428]; /* 0x10428 - 0x10480 */
char command_line[ARCH_COMMAND_LINE_SIZE]; /* 0x10480 */
};
extern int noexec_disabled; extern int noexec_disabled;
extern int memory_end_set; extern int memory_end_set;
extern unsigned long memory_end; extern unsigned long memory_end;
......
...@@ -42,6 +42,7 @@ static int kexec_file_add_elf_kernel(struct kimage *image, ...@@ -42,6 +42,7 @@ static int kexec_file_add_elf_kernel(struct kimage *image,
if (entry - phdr->p_paddr < phdr->p_memsz) { if (entry - phdr->p_paddr < phdr->p_memsz) {
data->kernel_buf = buf.buffer; data->kernel_buf = buf.buffer;
data->parm = buf.buffer + PARMAREA;
data->memsz += STARTUP_NORMAL_OFFSET; data->memsz += STARTUP_NORMAL_OFFSET;
buf.buffer += STARTUP_NORMAL_OFFSET; buf.buffer += STARTUP_NORMAL_OFFSET;
......
...@@ -32,6 +32,7 @@ static int kexec_file_add_image_kernel(struct kimage *image, ...@@ -32,6 +32,7 @@ static int kexec_file_add_image_kernel(struct kimage *image,
ret = kexec_add_buffer(&buf); ret = kexec_add_buffer(&buf);
data->kernel_buf = kernel; data->kernel_buf = kernel;
data->parm = (void *)kernel + PARMAREA;
data->memsz += buf.memsz + STARTUP_NORMAL_OFFSET; data->memsz += buf.memsz + STARTUP_NORMAL_OFFSET;
return ret; return ret;
......
...@@ -25,24 +25,12 @@ int *kexec_file_update_kernel(struct kimage *image, ...@@ -25,24 +25,12 @@ int *kexec_file_update_kernel(struct kimage *image,
if (image->cmdline_buf_len >= ARCH_COMMAND_LINE_SIZE) if (image->cmdline_buf_len >= ARCH_COMMAND_LINE_SIZE)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
if (image->cmdline_buf_len) memcpy(data->parm->command_line, image->cmdline_buf,
memcpy(data->kernel_buf + COMMAND_LINE_OFFSET, image->cmdline_buf_len);
image->cmdline_buf, image->cmdline_buf_len);
if (image->type == KEXEC_TYPE_CRASH) { if (image->type == KEXEC_TYPE_CRASH) {
loc = (unsigned long *)(data->kernel_buf + OLDMEM_BASE_OFFSET); data->parm->oldmem_base = crashk_res.start;
*loc = crashk_res.start; data->parm->oldmem_size = crashk_res.end - crashk_res.start + 1;
loc = (unsigned long *)(data->kernel_buf + OLDMEM_SIZE_OFFSET);
*loc = crashk_res.end - crashk_res.start + 1;
}
if (image->initrd_buf) {
loc = (unsigned long *)(data->kernel_buf + INITRD_START_OFFSET);
*loc = data->initrd_load_addr;
loc = (unsigned long *)(data->kernel_buf + INITRD_SIZE_OFFSET);
*loc = image->initrd_buf_len;
} }
return NULL; return NULL;
...@@ -127,7 +115,8 @@ int kexec_file_add_initrd(struct kimage *image, struct s390_load_data *data, ...@@ -127,7 +115,8 @@ int kexec_file_add_initrd(struct kimage *image, struct s390_load_data *data,
buf.mem += crashk_res.start; buf.mem += crashk_res.start;
buf.memsz = buf.bufsz; buf.memsz = buf.bufsz;
data->initrd_load_addr = buf.mem; data->parm->initrd_start = buf.mem;
data->parm->initrd_size = buf.memsz;
data->memsz += buf.memsz; data->memsz += buf.memsz;
ret = kexec_add_buffer(&buf); ret = kexec_add_buffer(&buf);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment