All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: malta: pass fw arguments on kexec
@ 2015-02-25 15:21 Aaro Koskinen
  2015-03-31 11:13 ` Ralf Baechle
  0 siblings, 1 reply; 4+ messages in thread
From: Aaro Koskinen @ 2015-02-25 15:21 UTC (permalink / raw)
  To: Ralf Baechle, Paul Burton, linux-mips; +Cc: Aaro Koskinen

Pass fw arguments on kexec to the new kernel.

Tested with MIPS64 QEMU. Without the patch the new kernel will default to
(likely) incorrect default memory and console setup, making kexec pretty
much useless.

Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
---
 arch/mips/mti-malta/malta-reset.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/mips/mti-malta/malta-reset.c b/arch/mips/mti-malta/malta-reset.c
index 2fd2cc2..f218ba8 100644
--- a/arch/mips/mti-malta/malta-reset.c
+++ b/arch/mips/mti-malta/malta-reset.c
@@ -8,8 +8,10 @@
  */
 #include <linux/io.h>
 #include <linux/pm.h>
+#include <linux/kexec.h>
 
 #include <asm/reboot.h>
+#include <asm/bootinfo.h>
 #include <asm/mach-malta/malta-pm.h>
 
 #define SOFTRES_REG	0x1f000500
@@ -36,8 +38,19 @@ static void mips_machine_power_off(void)
 	mips_machine_restart(NULL);
 }
 
+static int mips_kexec_prepare(struct kimage *image)
+{
+	kexec_args[0] = fw_arg0;
+	kexec_args[1] = fw_arg1;
+	kexec_args[2] = fw_arg2;
+	kexec_args[3] = fw_arg3;
+
+	return 0;
+}
+
 static int __init mips_reboot_setup(void)
 {
+	_machine_kexec_prepare = mips_kexec_prepare;
 	_machine_restart = mips_machine_restart;
 	_machine_halt = mips_machine_halt;
 	pm_power_off = mips_machine_power_off;
-- 
2.1.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] MIPS: malta: pass fw arguments on kexec
  2015-02-25 15:21 [PATCH] MIPS: malta: pass fw arguments on kexec Aaro Koskinen
@ 2015-03-31 11:13 ` Ralf Baechle
  2015-03-31 12:56   ` Aaro Koskinen
  0 siblings, 1 reply; 4+ messages in thread
From: Ralf Baechle @ 2015-03-31 11:13 UTC (permalink / raw)
  To: Aaro Koskinen; +Cc: Paul Burton, linux-mips

On Wed, Feb 25, 2015 at 05:21:05PM +0200, Aaro Koskinen wrote:

> Pass fw arguments on kexec to the new kernel.
> 
> Tested with MIPS64 QEMU. Without the patch the new kernel will default to
> (likely) incorrect default memory and console setup, making kexec pretty
> much useless.
> 
> Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
> ---
>  arch/mips/mti-malta/malta-reset.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/arch/mips/mti-malta/malta-reset.c b/arch/mips/mti-malta/malta-reset.c
> index 2fd2cc2..f218ba8 100644
> --- a/arch/mips/mti-malta/malta-reset.c
> +++ b/arch/mips/mti-malta/malta-reset.c
> @@ -8,8 +8,10 @@
>   */
>  #include <linux/io.h>
>  #include <linux/pm.h>
> +#include <linux/kexec.h>
>  
>  #include <asm/reboot.h>
> +#include <asm/bootinfo.h>
>  #include <asm/mach-malta/malta-pm.h>
>  
>  #define SOFTRES_REG	0x1f000500
> @@ -36,8 +38,19 @@ static void mips_machine_power_off(void)
>  	mips_machine_restart(NULL);
>  }
>  
> +static int mips_kexec_prepare(struct kimage *image)
> +{
> +	kexec_args[0] = fw_arg0;
> +	kexec_args[1] = fw_arg1;
> +	kexec_args[2] = fw_arg2;
> +	kexec_args[3] = fw_arg3;
> +
> +	return 0;
> +}

This makes arguments coming from the firmware non-overridable default?

  Ralf

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] MIPS: malta: pass fw arguments on kexec
  2015-03-31 11:13 ` Ralf Baechle
@ 2015-03-31 12:56   ` Aaro Koskinen
  2015-03-31 14:19     ` Ralf Baechle
  0 siblings, 1 reply; 4+ messages in thread
From: Aaro Koskinen @ 2015-03-31 12:56 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Paul Burton, linux-mips

Hi,

On Tue, Mar 31, 2015 at 01:13:00PM +0200, Ralf Baechle wrote:
> On Wed, Feb 25, 2015 at 05:21:05PM +0200, Aaro Koskinen wrote:
> >  #define SOFTRES_REG	0x1f000500
> > @@ -36,8 +38,19 @@ static void mips_machine_power_off(void)
> >  	mips_machine_restart(NULL);
> >  }
> >  
> > +static int mips_kexec_prepare(struct kimage *image)
> > +{
> > +	kexec_args[0] = fw_arg0;
> > +	kexec_args[1] = fw_arg1;
> > +	kexec_args[2] = fw_arg2;
> > +	kexec_args[3] = fw_arg3;
> > +
> > +	return 0;
> > +}
> 
> This makes arguments coming from the firmware non-overridable default?

Yes, the new kernel will boot with the same arguments as the old kernel...

I guess the kernel command line at least should be taken from kexec,
OCTEON seems to have some code for that.

A.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] MIPS: malta: pass fw arguments on kexec
  2015-03-31 12:56   ` Aaro Koskinen
@ 2015-03-31 14:19     ` Ralf Baechle
  0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2015-03-31 14:19 UTC (permalink / raw)
  To: Aaro Koskinen; +Cc: Paul Burton, linux-mips

On Tue, Mar 31, 2015 at 03:56:14PM +0300, Aaro Koskinen wrote:

> On Tue, Mar 31, 2015 at 01:13:00PM +0200, Ralf Baechle wrote:
> > On Wed, Feb 25, 2015 at 05:21:05PM +0200, Aaro Koskinen wrote:
> > >  #define SOFTRES_REG	0x1f000500
> > > @@ -36,8 +38,19 @@ static void mips_machine_power_off(void)
> > >  	mips_machine_restart(NULL);
> > >  }
> > >  
> > > +static int mips_kexec_prepare(struct kimage *image)
> > > +{
> > > +	kexec_args[0] = fw_arg0;
> > > +	kexec_args[1] = fw_arg1;
> > > +	kexec_args[2] = fw_arg2;
> > > +	kexec_args[3] = fw_arg3;
> > > +
> > > +	return 0;
> > > +}
> > 
> > This makes arguments coming from the firmware non-overridable default?
> 
> Yes, the new kernel will boot with the same arguments as the old kernel...
> 
> I guess the kernel command line at least should be taken from kexec,
> OCTEON seems to have some code for that.

The old command line can be obtained from /proc/cmdline.  As per
documentation some boot formats but not all support the options
--command-line=string or --reuse-cmdline which I think is how it should
be done.

Sorry but cmdline manipulation in the kernel is just bad for my blood
pressure.  Among the issues:

Many MIPS platforms are manipulating the cmdline so what you eventually
find in /proc/cmdline may not what the firmware originally fed to the
kernel.  That's another tradition which should end - for sanity and
kexec's sake.

A few platfroms even hardcode the entire cmdline and that was done without
considering something like kexec.

And more.

  Ralf

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-03-31 14:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-25 15:21 [PATCH] MIPS: malta: pass fw arguments on kexec Aaro Koskinen
2015-03-31 11:13 ` Ralf Baechle
2015-03-31 12:56   ` Aaro Koskinen
2015-03-31 14:19     ` Ralf Baechle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.