Skip to contentSkip to conversation

idle loop changes

RFC/PATCH Tom Rini 4 participants 11 messages Jul 31, 2002 – Aug 1, 2002

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

The following is based on the final patch that Armin posted a short while back. What this does is allow for the power_save() function to be overridden, but still provide a 'sane' default. This moves the existing power_save() function into ppc6xx_idle.c, as after talking with Hollis, the function won't work as-is on Power3/iSeries (bits have moved or are non-existant).

I'm not totally sure if it's better to do it this way, or to not provide a default power_save(), so that if we don't set pm_idle to something, we just never call power_save() (as opposed to a call, check for a bit & return). Comments?

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

arch/ppc/kernel/Makefile +1 -1
diff -Nru a/arch/ppc/kernel/Makefile b/arch/ppc/kernel/Makefile
@@ -41,7 +41,7 @@
 					process.o signal.o ptrace.o align.o \
 					semaphore.o syscalls.o setup.o \
 					cputable.o ppc_htab.o
-obj-$(CONFIG_6xx)		+= l2cr.o
+obj-$(CONFIG_6xx)		+= l2cr.o ppc6xx_idle.o
 obj-$(CONFIG_MODULES)		+= ppc_ksyms.o
 obj-$(CONFIG_PCI)		+= pci.o
 ifneq ($(CONFIG_PPC_ISERIES),y)
arch/ppc/kernel/idle.c +15 -33

83 lines not on this page · raw message

arch/ppc/kernel/ppc6xx_idle.c new file +76 -0

76 lines not on this page · raw message

arch/ppc/kernel/setup.c +7 -0
diff -Nru a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c
@@ -55,6 +55,9 @@
 extern void kgdb_map_scc(void);
 #endif
 
+extern void (*pm_idle)(void);
+extern void ppc6xx_pm_idle(void);
+
 extern boot_infos_t *boot_infos;
 char saved_command_line[512];
 extern char cmd_line[512];
@@ -511,6 +514,10 @@
 #endif /* CONFIG_CMDLINE */
 
 	platform_init(r3, r4, r5, r6, r7);
+
+#ifdef CONFIG_6xx
+	pm_idle = ppc6xx_pm_idle;
+#endif
 
 	if (ppc_md.progress)
 		ppc_md.progress("id mach(): done", 0x200);

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#1 lore raw
Quoted 4 lines · Tom Rini

I'm not totally sure if it's better to do it this way, or to not provide a default power_save(), so that if we don't set pm_idle to something, we just never call power_save() (as opposed to a call, check for a bit & return). Comments?

I think whether we force everything to have a power_save() function, even if it is empty, or initialize a pointer and have an indirect call doesn't make much difference. What does make a difference, is there could be power save functions that are unique to a board. Some processors have power save options that can cause a lower frequency clock to be used which will affect external devices. In such cases, the devices on a board may need some adjustment when these power save modes are entered/exited.

Thanks.

	-- Dan

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

author
#2 lore raw
Quoted 7 lines · Dan Malek
Quoted 4 lines · Tom Rini

I'm not totally sure if it's better to do it this way, or to not provide a default power_save(), so that if we don't set pm_idle to something, we just never call power_save() (as opposed to a call, check for a bit & return). Comments?

Quoted 7 lines

I think whether we force everything to have a power_save() function, even if it is empty, or initialize a pointer and have an indirect call doesn't make much difference. What does make a difference, is there could be power save functions that are unique to a board. Some processors have power save options that can cause a lower frequency clock to be used which will affect external devices. In such cases, the devices on a board may need some adjustment when these power save modes are entered/exited.

Well, this gets us part of the way there. This allows for the power_save() functionalility to be totally overridden. For things such as modifiying the clock, which may require additional device changes, I think that falls in as another problem, but this should allow for that problem to be taken care of.

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

author
#3 lore raw
Quoted 17 lines · Tom Rini
Quoted 7 lines · Dan Malek
Quoted 4 lines · Tom Rini

I'm not totally sure if it's better to do it this way, or to not provide a default power_save(), so that if we don't set pm_idle to something, we just never call power_save() (as opposed to a call, check for a bit & return). Comments?

Quoted 7 lines

I think whether we force everything to have a power_save() function, even if it is empty, or initialize a pointer and have an indirect call doesn't make much difference. What does make a difference, is there could be power save functions that are unique to a board. Some processors have power save options that can cause a lower frequency clock to be used which will affect external devices. In such cases, the devices on a board may need some adjustment when these power save modes are entered/exited.

Quoted 2 lines

Well, this gets us part of the way there. This allows for the power_save() functionalility to be totally overridden.

And in the case of CONFIG_6xx, if the assignment is moved above the call to platform_init(), it's even easier to override, if needed, so I've made that change locally.

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#9 lore raw
In reply to Tom Rini
Quoted 8 lines · Tom Rini

The following is based on the final patch that Armin posted a short while back. What this does is allow for the power_save() function to be overridden, but still provide a 'sane' default. This moves the existing power_save() function into ppc6xx_idle.c, as after talking with Hollis, the function won't work as-is on Power3/iSeries (bits have moved or are non-existant).

Quoted 4 lines

I'm not totally sure if it's better to do it this way, or to not provide a default power_save(), so that if we don't set pm_idle to something, we just never call power_save() (as opposed to a call, check for a bit & return). Comments?

To build it on non-6xx you need to move the powersave_nap declaration back to idle.c and extern it in ppc6xx_idle.c. It's required by sysctl. Other than that, this will work.

Regards,
--
Matt Porter
[email protected]
This is Linux Country. On a quiet night, you can hear Windows reboot.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#5 lore raw
In reply to Matt Porter
Quoted 2 lines · Matt Porter

So, some new machdep calls that you can populate on a per board basis? Are you just talking about them being used upon entering/exiting idle?

I was just thinking the power_save() function could be unique to a board. It has to be something combined with the power save mode chosen on the chip, so machdep calls may not be appropriate. We are using names like ppc6xx_pm_idle, ppc4xx, ppc8xx, when it could be my_custom_board_pm_idle......Just don't assume one type of chip will use the same function on different boards. When the idle/power save function is chosen, it should probably be done during board setup, not processor set up.

	-- Dan

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#4 lore raw
In reply to Dan Malek
Quoted 8 lines · Dan Malek
Quoted 4 lines · Tom Rini

I'm not totally sure if it's better to do it this way, or to not provide a default power_save(), so that if we don't set pm_idle to something, we just never call power_save() (as opposed to a call, check for a bit & return). Comments?

Quoted 7 lines

I think whether we force everything to have a power_save() function, even if it is empty, or initialize a pointer and have an indirect call doesn't make much difference. What does make a difference, is there could be power save functions that are unique to a board. Some processors have power save options that can cause a lower frequency clock to be used which will affect external devices. In such cases, the devices on a board may need some adjustment when these power save modes are entered/exited.

So, some new machdep calls that you can populate on a per board basis? Are you just talking about them being used upon entering/exiting idle?

Regards,
--
Matt Porter
[email protected]
This is Linux Country. On a quiet night, you can hear Windows reboot.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#6 lore raw
In reply to Dan Malek
Quoted 5 lines · Dan Malek
Quoted 2 lines · Matt Porter

So, some new machdep calls that you can populate on a per board basis? Are you just talking about them being used upon entering/exiting idle?

Quoted 8 lines

I was just thinking the power_save() function could be unique to a board. It has to be something combined with the power save mode chosen on the chip, so machdep calls may not be appropriate. We are using names like ppc6xx_pm_idle, ppc4xx, ppc8xx, when it could be my_custom_board_pm_idle......Just don't assume one type of chip will use the same function on different boards. When the idle/power save function is chosen, it should probably be done during board setup, not processor set up.

Why not use keep the ppc6xx_pm_idle, etc. as fallbacks (e.g., nothing special about your board so use generic 6xx one) and still use machdep calls so its easy to override in case there is something special you need to do for your board?

Mark

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#7 lore raw
Quoted 2 lines · Mark A. Greer

Why not use keep the ppc6xx_pm_idle, etc. as fallbacks (e.g., nothing special about your board so use generic 6xx one)

That's fine, except we aren't using machdep calls. The interaction between the external devices and the processor control may not allow (or we may not desire) using a "standard" processor function. For example, the MPC8xx has four powersave modes and four sleep modes. Only one of the modes is generic and isn't suitable to use if I use one of the other modes that may require external device management.

My comment was truly simple :-) Just don't assume the processor powersave modes are suitable for all boards. A board may wish to do something different, so I suggest keeping the power save function initialization local to a board rather than processor architecture. Many of them are likely to be generic and can use the same function, just allow the provision for them to be different at the board level, that's all.

Thanks.

	-- Dan

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

author
#10 lore raw
In reply to Matt Porter
Quoted 9 lines · Matt Porter
Quoted 8 lines · Tom Rini

The following is based on the final patch that Armin posted a short while back. What this does is allow for the power_save() function to be overridden, but still provide a 'sane' default. This moves the existing power_save() function into ppc6xx_idle.c, as after talking with Hollis, the function won't work as-is on Power3/iSeries (bits have moved or are non-existant).

Quoted 8 lines
Quoted 4 lines

I'm not totally sure if it's better to do it this way, or to not provide a default power_save(), so that if we don't set pm_idle to something, we just never call power_save() (as opposed to a call, check for a bit & return). Comments?

To build it on non-6xx you need to move the powersave_nap declaration back to idle.c and extern it in ppc6xx_idle.c. It's required by sysctl. Other than that, this will work.

Bleah. I'm not sure if the sysctl is wrong or not right now. IIRC, powersave_nap is only actually made use of on pmac, and from what I remember of talking to Ben, it's only really an option on 6xx anyhow. But good spotting none the less. :)

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

author
#8 lore raw
In reply to Dan Malek
Quoted 5 lines · Dan Malek
Quoted 2 lines · Matt Porter

So, some new machdep calls that you can populate on a per board basis? Are you just talking about them being used upon entering/exiting idle?

Quoted 8 lines

I was just thinking the power_save() function could be unique to a board. It has to be something combined with the power save mode chosen on the chip, so machdep calls may not be appropriate. We are using names like ppc6xx_pm_idle, ppc4xx, ppc8xx, when it could be my_custom_board_pm_idle......Just don't assume one type of chip will use the same function on different boards. When the idle/power save function is chosen, it should probably be done during board setup, not processor set up.

Right. ppc6xx_pm_idle happens to work in most cases on all of the 6xx boards, but once this gets in there is nothing stopping fooboard from overriding this in platform_init().

The whole reason behind these changes is that the current power_save() is dangerous on 4xx, and with the thought that maybe 8xx (or 405LP) would need to do something much different.

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/