From: Tony Lindgren <tony@atomide.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Juha Yrjola <juha.yrjola@solidboot.com>,
linux-arm-kernel@lists.arm.linux.org.uk,
Kevin Hilman <khilman@deeprootsystems.com>,
linux-omap@vger.kernel.org
Subject: Re: [PATCH 02/12] ARM: OMAP3: Store reboot mode in scratchpad on OMAP34xx
Date: Thu, 19 Mar 2009 08:56:44 -0700 [thread overview]
Message-ID: <20090319155642.GI29546@atomide.com> (raw)
In-Reply-To: <20090319000833.GE30132@n2100.arm.linux.org.uk>
* Russell King - ARM Linux <linux@arm.linux.org.uk> [090318 17:08]:
> On Wed, Mar 18, 2009 at 01:10:04PM -0700, Tony Lindgren wrote:
> > * Russell King - ARM Linux <linux@arm.linux.org.uk> [090318 12:26]:
> > > On Wed, Mar 18, 2009 at 11:28:06AM -0700, Tony Lindgren wrote:
> > > > * Russell King - ARM Linux <linux@arm.linux.org.uk> [090316 15:22]:
> > > > > On Mon, Mar 16, 2009 at 07:40:24PM +0200, Juha Yrjola wrote:
> > > > > > Russell King - ARM Linux wrote:
> > > > > >
> > > > > >> Right. You are aware that there is already a mechanism for doing this
> > > > > >> in the generic kernel (obviously not)?
> > > > > >
> > > > > > I am. Unfortunately, glibc fails to support this mechanism, as you say.
> > > > > > I didn't want to start making such intrusive changes for our trivial
> > > > > > need.
> > > > >
> > > > > Yes, glibc sucks with that - they hide the Linux reboot syscall.
> > > > > Luckily, it is accessible via the syscall() interface:
> > > > >
> > > > > #include <linux/reboot.h>
> > > > >
> > > > > int sys_reboot(const char *cmd)
> > > > > {
> > > > > return syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2C,
> > > > > LINUX_REBOOT_CMD_RESTART2, cmd);
> > > > > }
> > > > >
> > > > > >> sys_reboot() with LINUX_REBOOT_CMD_RESTART2 takes a string in addition
> > > > > >> to the standard parameters. This string is passed into machine_restart()
> > > > > >> which we currently ignore. If LINUX_REBOOT_CMD_RESTART is used, this
> > > > > >> string is NULL.
> > > > > >>
> > > > > >> We could change machine_restart() to pass this parameter through to
> > > > > >> arm_pm_restart() and ultimately down to arch_reset().
> > > > > >
> > > > > > Sure. With RESTART2, I could've even used the reboot notifier chain with
> > > > > > an OMAP3-specific driver to store the string.
> > > > >
> > > > > The notifier chain is called in any case.
> > > > >
> > > > > > Are you suggesting to get rid of reboot_mode altogether? If not, could
> > > > > > we still have the sysfs mechanism? A one-character reboot_mode would be
> > > > > > plenty enough for us.
> > > > >
> > > > > No, reboot mode tells _how_ to perform the reboot - whether that be
> > > > > by hardware reset, gpio reset or a soft call via the reset address.
> > > > > It's not supposed to tell the boot loader what to do.
> > > >
> > > > So if the reboot mode can't be used for this.. Should we change Juha's
> > > > sysfs interface patch to store something else like bootloader_mode?
> > > >
> > > > I guess we cannot use kexec for this either?
> > >
> > > Why not use the mechanism that's already there as I've already pointed
> > > out?
> >
> > Sorry I misunderstood, I thought you did not want to use reboot_mode
> > for this at all..
>
> I don't want to use reboot_mode for this. machine_restart() and the
> reboot syscall has a way of passing a string to the platform specific
> code, and I'm suggesting that if you want the boot loader to do some
> magic, that's the way to do it. Use the 'cmd' argument provided to
> arch_reset() by the patch below - this will either be NULL if the
> standard reboot call is used, or a string if the alternative version
> is used.
>
> > To recap, so we change machine_restart() like you described above, and then
> > this patch is still valid, except to update the description.
>
> No, you've still got the wrong end of the stick.
<snip>
> diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
> index 811be55..0a0d49a 100644
> --- a/arch/arm/include/asm/system.h
> +++ b/arch/arm/include/asm/system.h
> @@ -97,8 +97,8 @@ extern void __show_regs(struct pt_regs *);
> extern int cpu_architecture(void);
> extern void cpu_init(void);
>
> -void arm_machine_restart(char mode);
> -extern void (*arm_pm_restart)(char str);
> +void arm_machine_restart(char mode, const char *cmd);
> +extern void (*arm_pm_restart)(char str, const char *cmd);
>
> #define UDBG_UNDEFINED (1 << 0)
> #define UDBG_SYSCALL (1 << 1)
> diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
> index af377c7..2de14e2 100644
> --- a/arch/arm/kernel/process.c
> +++ b/arch/arm/kernel/process.c
> @@ -83,7 +83,7 @@ static int __init hlt_setup(char *__unused)
> __setup("nohlt", nohlt_setup);
> __setup("hlt", hlt_setup);
>
> -void arm_machine_restart(char mode)
> +void arm_machine_restart(char mode, const char *cmd)
> {
> /*
> * Clean and disable cache, and turn off interrupts
> @@ -100,7 +100,7 @@ void arm_machine_restart(char mode)
> /*
> * Now call the architecture specific reboot code.
> */
> - arch_reset(mode);
> + arch_reset(mode, cmd);
>
> /*
> * Whoops - the architecture was unable to reboot.
> @@ -120,7 +120,7 @@ EXPORT_SYMBOL(pm_idle);
> void (*pm_power_off)(void);
> EXPORT_SYMBOL(pm_power_off);
>
> -void (*arm_pm_restart)(char str) = arm_machine_restart;
> +void (*arm_pm_restart)(char str, const char *cmd) = arm_machine_restart;
> EXPORT_SYMBOL_GPL(arm_pm_restart);
>
>
> @@ -195,9 +195,9 @@ void machine_power_off(void)
> pm_power_off();
> }
>
> -void machine_restart(char * __unused)
> +void machine_restart(char *cmd)
> {
> - arm_pm_restart(reboot_mode);
> + arm_pm_restart(reboot_mode, cmd);
> }
>
> void __show_regs(struct pt_regs *regs)
<snip>
Got it now, looks good to me.
Acked-by: Tony Lindgren <tony@atomide.com>
next prev parent reply other threads:[~2009-03-19 15:56 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-10 21:00 [PATCH 00/12] Omap3 updates for the merge window after 2.6.29 Tony Lindgren
2009-03-10 21:02 ` [PATCH 01/12] ARM: OMAP3: Remove unused CONFIG_I2C2_OMAP_BEAGLE Tony Lindgren
2009-03-10 21:03 ` [PATCH 02/12] ARM: OMAP3: Store reboot mode in scratchpad on OMAP34xx Tony Lindgren
2009-03-15 15:51 ` Russell King - ARM Linux
2009-03-16 16:07 ` Juha Yrjola
2009-03-16 17:10 ` Russell King - ARM Linux
2009-03-16 17:40 ` Juha Yrjola
2009-03-16 22:21 ` Russell King - ARM Linux
2009-03-18 18:28 ` Tony Lindgren
2009-03-18 19:26 ` Russell King - ARM Linux
2009-03-18 20:10 ` Tony Lindgren
2009-03-18 20:15 ` Tony Lindgren
2009-03-19 0:08 ` Russell King - ARM Linux
2009-03-19 15:56 ` Tony Lindgren [this message]
2009-03-24 1:11 ` Tony Lindgren
2009-03-10 21:04 ` [PATCH 03/12] ARM: OMAP3: Add more GPIO mux options Tony Lindgren
2009-03-10 21:06 ` [PATCH 04/12] ARM: OMAP3: mmc-twl4030 fix name buffer length Tony Lindgren
2009-03-15 16:00 ` Russell King - ARM Linux
2009-03-16 10:04 ` Adrian Hunter
2009-03-16 10:14 ` Russell King - ARM Linux
2009-03-16 17:42 ` Tony Lindgren
2009-03-16 22:22 ` Russell King - ARM Linux
2009-03-10 21:07 ` [PATCH 05/12] ARM: OMAP3: mmc-twl4030 voltage cleanup Tony Lindgren
2009-03-10 21:08 ` [PATCH 06/12] ARM: OMAP3: mmc-twl4030 init passes device nodes back Tony Lindgren
2009-03-15 16:02 ` Russell King - ARM Linux
2009-03-16 17:44 ` Tony Lindgren
2009-03-16 22:22 ` Russell King - ARM Linux
2009-03-10 21:10 ` [PATCH 07/12] ARM: OMAP3: mmc-twl4030 add MMC3 support Tony Lindgren
2009-03-15 16:04 ` Russell King - ARM Linux
2009-03-15 17:27 ` Grazvydas Ignotas
2009-03-15 17:40 ` Russell King - ARM Linux
2009-03-16 17:56 ` [PATCH 07/12] ARM: OMAP3: mmc-twl4030 add MMC3 support, v2 Tony Lindgren
2009-03-10 21:11 ` [PATCH 08/12] ARM: OMAP3: mmc-twl4030 fix for vmmc = 0 Tony Lindgren
2009-03-10 21:12 ` [PATCH 09/12] ARM: OMAP3: mmc-twl4030 add cover switch Tony Lindgren
2009-03-10 21:13 ` [PATCH 10/12] ARM: OMAP3: mmc-twl4030 allow arbitrary slot names Tony Lindgren
2009-03-15 16:08 ` Russell King - ARM Linux
2009-03-16 10:04 ` Adrian Hunter
2009-03-16 10:05 ` Adrian Hunter
2009-03-16 10:16 ` Russell King - ARM Linux
2009-03-16 18:01 ` Tony Lindgren
2009-03-10 21:15 ` [PATCH 11/12] ARM: OMAP3: Add base address definitions and resources for OMAP 3 IS Tony Lindgren
2009-03-24 1:37 ` [PATCH 11/12] ARM: OMAP3: Add base address definitions and resources for OMAP 3 IS, v2 Tony Lindgren
2009-03-10 21:16 ` [PATCH 12/12] ARM: OMAP3: MUSB initialization for omap hw Tony Lindgren
2009-03-15 16:14 ` Russell King - ARM Linux
2009-03-15 18:46 ` David Brownell
2009-03-16 22:42 ` [PATCH] ARM: OMAP: Add name for musb clocks Tony Lindgren
2009-05-12 17:40 ` [APPLIED] " Tony Lindgren
2009-03-16 22:37 ` [PATCH 12/12] ARM: OMAP3: MUSB initialization for omap hw, v2 Tony Lindgren
2009-03-24 2:51 ` [PATCH 00/12] Omap3 updates for the merge window after 2.6.29 Tony Lindgren
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=20090319155642.GI29546@atomide.com \
--to=tony@atomide.com \
--cc=juha.yrjola@solidboot.com \
--cc=khilman@deeprootsystems.com \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-omap@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
/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