* [PATCH] kexec/s390: Add support for kexec_file_load
@ 2018-05-16 12:27 Philipp Rudo
2018-05-21 6:24 ` Dave Young
0 siblings, 1 reply; 4+ messages in thread
From: Philipp Rudo @ 2018-05-16 12:27 UTC (permalink / raw)
To: Simon Horman, kexec; +Cc: linux-s390
Since kernel 4.17-rc2 s390 supports the kexec_file_load system call. Add
the new system call to kexec-tools and provide the -s (--kexec-file-syscall)
option for s390 to support this new feature.
Signed-off-by: Philipp Rudo <prudo@linux.ibm.com>
---
kexec/arch/s390/kexec-image.c | 46 +++++++++++++++++++++++++++++++++++++++++++
kexec/kexec-syscall.h | 3 +++
2 files changed, 49 insertions(+)
diff --git a/kexec/arch/s390/kexec-image.c b/kexec/arch/s390/kexec-image.c
index 0c8937b..8b39566 100644
--- a/kexec/arch/s390/kexec-image.c
+++ b/kexec/arch/s390/kexec-image.c
@@ -22,6 +22,7 @@
#include "../../kexec/crashdump.h"
#include "kexec-s390.h"
#include <arch/options.h>
+#include <fcntl.h>
static uint64_t crash_base, crash_end;
static char command_line[COMMAND_LINESIZE];
@@ -45,6 +46,48 @@ int command_line_add(const char *str)
return 0;
}
+int image_s390_load_file(int argc, char **argv, struct kexec_info *info)
+{
+ const char *ramdisk = NULL;
+ int opt;
+
+ static const struct option options[] =
+ {
+ KEXEC_OPTIONS
+ {"command-line", 1, 0, OPT_APPEND},
+ {"append", 1, 0, OPT_APPEND},
+ {"initrd", 1, 0, OPT_RAMDISK},
+ {0, 0, 0, 0},
+ };
+ static const char short_options[] = KEXEC_OPT_STR "";
+
+ while ((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) {
+ switch(opt) {
+ case OPT_APPEND:
+ if (command_line_add(optarg))
+ return -1;
+ break;
+ case OPT_RAMDISK:
+ ramdisk = optarg;
+ break;
+ }
+ }
+
+ if (ramdisk) {
+ info->initrd_fd = open(ramdisk, O_RDONLY);
+ if (info->initrd_fd == -1) {
+ fprintf(stderr, "Could not open initrd file %s:%s\n",
+ ramdisk, strerror(errno));
+ return -1;
+ }
+ }
+
+ info->command_line = command_line;
+ info->command_line_len = strlen (command_line) + 1;
+
+ return 0;
+}
+
int
image_s390_load(int argc, char **argv, const char *kernel_buf,
off_t kernel_size, struct kexec_info *info)
@@ -56,6 +99,9 @@ image_s390_load(int argc, char **argv, const char *kernel_buf,
unsigned int ramdisk_origin;
int opt;
+ if (info->file_mode)
+ return image_s390_load_file(argc, argv, info);
+
static const struct option options[] =
{
KEXEC_OPTIONS
diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
index 33638c2..b96e02a 100644
--- a/kexec/kexec-syscall.h
+++ b/kexec/kexec-syscall.h
@@ -64,6 +64,9 @@
#ifdef __powerpc64__
#define __NR_kexec_file_load 382
#endif
+#ifdef __s390x__
+#define __NR_kexec_file_load 381
+#endif
#ifndef __NR_kexec_file_load
/* system call not available for the arch */
--
2.16.3
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] kexec/s390: Add support for kexec_file_load
2018-05-16 12:27 [PATCH] kexec/s390: Add support for kexec_file_load Philipp Rudo
@ 2018-05-21 6:24 ` Dave Young
2018-05-22 8:11 ` Simon Horman
0 siblings, 1 reply; 4+ messages in thread
From: Dave Young @ 2018-05-21 6:24 UTC (permalink / raw)
To: Philipp Rudo; +Cc: linux-s390, Simon Horman, kexec
On 05/16/18 at 02:27pm, Philipp Rudo wrote:
> Since kernel 4.17-rc2 s390 supports the kexec_file_load system call. Add
> the new system call to kexec-tools and provide the -s (--kexec-file-syscall)
> option for s390 to support this new feature.
>
> Signed-off-by: Philipp Rudo <prudo@linux.ibm.com>
> ---
> kexec/arch/s390/kexec-image.c | 46 +++++++++++++++++++++++++++++++++++++++++++
> kexec/kexec-syscall.h | 3 +++
> 2 files changed, 49 insertions(+)
>
> diff --git a/kexec/arch/s390/kexec-image.c b/kexec/arch/s390/kexec-image.c
> index 0c8937b..8b39566 100644
> --- a/kexec/arch/s390/kexec-image.c
> +++ b/kexec/arch/s390/kexec-image.c
> @@ -22,6 +22,7 @@
> #include "../../kexec/crashdump.h"
> #include "kexec-s390.h"
> #include <arch/options.h>
> +#include <fcntl.h>
>
> static uint64_t crash_base, crash_end;
> static char command_line[COMMAND_LINESIZE];
> @@ -45,6 +46,48 @@ int command_line_add(const char *str)
> return 0;
> }
>
> +int image_s390_load_file(int argc, char **argv, struct kexec_info *info)
> +{
> + const char *ramdisk = NULL;
> + int opt;
> +
> + static const struct option options[] =
> + {
> + KEXEC_OPTIONS
> + {"command-line", 1, 0, OPT_APPEND},
> + {"append", 1, 0, OPT_APPEND},
> + {"initrd", 1, 0, OPT_RAMDISK},
> + {0, 0, 0, 0},
> + };
> + static const char short_options[] = KEXEC_OPT_STR "";
> +
> + while ((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) {
> + switch(opt) {
> + case OPT_APPEND:
> + if (command_line_add(optarg))
> + return -1;
> + break;
> + case OPT_RAMDISK:
> + ramdisk = optarg;
> + break;
> + }
> + }
> +
> + if (ramdisk) {
> + info->initrd_fd = open(ramdisk, O_RDONLY);
> + if (info->initrd_fd == -1) {
> + fprintf(stderr, "Could not open initrd file %s:%s\n",
> + ramdisk, strerror(errno));
> + return -1;
> + }
> + }
> +
> + info->command_line = command_line;
> + info->command_line_len = strlen (command_line) + 1;
> +
> + return 0;
> +}
> +
> int
> image_s390_load(int argc, char **argv, const char *kernel_buf,
> off_t kernel_size, struct kexec_info *info)
> @@ -56,6 +99,9 @@ image_s390_load(int argc, char **argv, const char *kernel_buf,
> unsigned int ramdisk_origin;
> int opt;
>
> + if (info->file_mode)
> + return image_s390_load_file(argc, argv, info);
> +
> static const struct option options[] =
> {
> KEXEC_OPTIONS
> diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
> index 33638c2..b96e02a 100644
> --- a/kexec/kexec-syscall.h
> +++ b/kexec/kexec-syscall.h
> @@ -64,6 +64,9 @@
> #ifdef __powerpc64__
> #define __NR_kexec_file_load 382
> #endif
> +#ifdef __s390x__
> +#define __NR_kexec_file_load 381
> +#endif
>
> #ifndef __NR_kexec_file_load
> /* system call not available for the arch */
> --
> 2.16.3
>
>
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
Acked-by: Dave Young <dyoung@redhat.com>
Thanks
Dave
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kexec/s390: Add support for kexec_file_load
2018-05-21 6:24 ` Dave Young
@ 2018-05-22 8:11 ` Simon Horman
2018-05-28 11:09 ` Philipp Rudo
0 siblings, 1 reply; 4+ messages in thread
From: Simon Horman @ 2018-05-22 8:11 UTC (permalink / raw)
To: Dave Young; +Cc: Philipp Rudo, linux-s390, kexec
On Mon, May 21, 2018 at 02:24:40PM +0800, Dave Young wrote:
> On 05/16/18 at 02:27pm, Philipp Rudo wrote:
> > Since kernel 4.17-rc2 s390 supports the kexec_file_load system call. Add
> > the new system call to kexec-tools and provide the -s (--kexec-file-syscall)
> > option for s390 to support this new feature.
> >
> > Signed-off-by: Philipp Rudo <prudo@linux.ibm.com>
...
> Acked-by: Dave Young <dyoung@redhat.com>
Thanks, applied.
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kexec/s390: Add support for kexec_file_load
2018-05-22 8:11 ` Simon Horman
@ 2018-05-28 11:09 ` Philipp Rudo
0 siblings, 0 replies; 4+ messages in thread
From: Philipp Rudo @ 2018-05-28 11:09 UTC (permalink / raw)
To: Simon Horman; +Cc: linux-s390, Dave Young, kexec
On Tue, 22 May 2018 10:11:04 +0200
Simon Horman <horms@verge.net.au> wrote:
> On Mon, May 21, 2018 at 02:24:40PM +0800, Dave Young wrote:
> > On 05/16/18 at 02:27pm, Philipp Rudo wrote:
> > > Since kernel 4.17-rc2 s390 supports the kexec_file_load system call. Add
> > > the new system call to kexec-tools and provide the -s (--kexec-file-syscall)
> > > option for s390 to support this new feature.
> > >
> > > Signed-off-by: Philipp Rudo <prudo@linux.ibm.com>
>
> ...
>
> > Acked-by: Dave Young <dyoung@redhat.com>
>
> Thanks, applied.
>
Sorry for the late answer, I had the last week off.
Nevertheless thanks to both of you.
Philipp
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-05-28 11:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-16 12:27 [PATCH] kexec/s390: Add support for kexec_file_load Philipp Rudo
2018-05-21 6:24 ` Dave Young
2018-05-22 8:11 ` Simon Horman
2018-05-28 11:09 ` Philipp Rudo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox