Skip to contentSkip to conversation

add machine state register support

PATCH In review Geoff Levand 3 participants 4 messages May 23, 2005 – May 24, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add machine state register support

This patch adds routines to get and set the machine state register. These are needed by power management code on some platforms.

--

Index:linux-2.6.11/arch/ppc/kernel/misc.S
===================================================================
--- linux-2.6.11.orig/arch/ppc/kernel/misc.S 2005-04-15 14:59:12.408518820 -0700
+++ linux-2.6.11/arch/ppc/kernel/misc.S 2005-04-15 14:59:34.005586781 -0700

@@ -1160,6 +1159,14 @@
addi r1,r1,16
blr

+_GLOBAL(_get_msr)
+ mfmsr r3
+ blr
+
+_GLOBAL(_set_msr)
+ mtmsr r3
+ blr
+
/*
* This routine is just here to keep GCC happy - sigh... */

#1 lore raw
Quoted 4 lines · Geoff Levand

This patch adds routines to get and set the machine state register. These are needed by power management code on some platforms.

Hi Geoff !

Can you tell me more about this power management code ? I tend to think that code that wants to do more than just using the existing accessors should be written in assembly...

Also, there is already

void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);

That you can use for manipulating MSR bits.

Finally, I tend to prefer such small register accessors to be written as inline assembly in some headers. But then, I don't think you actually need to add anything here.

Regards,
Ben.

#2 lore raw
Quoted 16 lines · Benjamin Herrenschmidt
Quoted 4 lines · Geoff Levand

This patch adds routines to get and set the machine state register. These are needed by power management code on some platforms.

Hi Geoff !

Can you tell me more about this power management code ? I tend to think that code that wants to do more than just using the existing accessors should be written in assembly...

Also, there is already

Quoted 8 lines

void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);

That you can use for manipulating MSR bits.

Finally, I tend to prefer such small register accessors to be written as inline assembly in some headers. But then, I don't think you actually need to add anything here.

Sorry for the trouble, Geert is right, there are already mfmsr() and mtmsr() in <ppc-asm/reg.h>. I found get_msr in ppc64 and assumed they were missing for ppc. I should have looked more carefully.

-Geoff

#3 lore raw
In reply to Geoff Levand
Quoted 14 lines · Geoff Levand

This patch adds routines to get and set the machine state register. These are needed by power management code on some platforms.

--

Index:linux-2.6.11/arch/ppc/kernel/misc.S
===================================================================

arch/ppc/kernel/misc.S +0 -0
@@ -1160,6 +1159,14 @@
 	addi	r1,r1,16

arch/ppc/kernel/misc.S line 1169

Quoted 10 lines
arch/ppc/kernel/misc.S +8 -0
 	blr
 
+_GLOBAL(_get_msr)
+	mfmsr   r3
+	blr
+
+_GLOBAL(_set_msr)
+	mtmsr   r3
+	blr
+

Please check m[ft]msr() in <asm/reg.h>.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds