LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ehea: PPC - New hcall opcode defines
From: Thomas Klein @ 2006-08-11  9:40 UTC (permalink / raw)
  To: linux-ppc; +Cc: Thomas Klein, Christoph Raisch, Marcus Eder, Jan-Bernd Themann

Hi,

this patch adds additional hcall opcode defines in asm-powerpc/hvcall.h
which are required for the IBM eHEA Ethernet Device Driver which is
targeted for kernel inclusion in the near future.

Including those defines in hvcall.h was a request we got in reply to
posting our driver.

Driver post: http://ozlabs.org/pipermail/linuxppc-dev/2006-August/024947.html
Reply: http://ozlabs.org/pipermail/linuxppc-dev/2006-August/024971.html

I'm aware this does not fix a bug and we're already at rc4 but since it
adds only a few innocent defines it would be great if it could be included
in 2.6.18-rc5.

This patch replaces yesterday's patch with the same title. It contains
the modification requested by a comment I got.

Kind regards
Thomas


Signed-off-by: Thomas Klein <tklein@de.ibm.com>
Changelog-by:  Thomas Klein <tklein@de.ibm.com>

Differences to patch
http://ozlabs.org/pipermail/linuxppc-dev/2006-August/025000.html

Changelog:
- New defines rearranged according to their numerical value



  include/asm-powerpc/hvcall.h |   13 +++++++++++++
  1 file changed, 13 insertions(+)



diff -Nurp -X dontdiff linux-2.6.18-rc4/include/asm-powerpc/hvcall.h patched_kernel/include/asm-powerpc/hvcall.h
--- linux-2.6.18-rc4/include/asm-powerpc/hvcall.h	2006-08-06 11:20:11.000000000 -0700
+++ patched_kernel/include/asm-powerpc/hvcall.h	2006-08-11 01:54:49.696514466 -0700
@@ -198,6 +198,19 @@
  #define H_MANAGE_TRACE          0x1C0
  #define H_QUERY_INT_STATE       0x1E4
  #define H_POLL_PENDING		0x1D8
+#define H_MODIFY_HEA_QP		0x250
+#define H_QUERY_HEA_QP		0x254
+#define H_QUERY_HEA		0x258
+#define H_QUERY_HEA_PORT	0x25C
+#define H_MODIFY_HEA_PORT	0x260
+#define H_REG_BCMC		0x264
+#define H_DEREG_BCMC		0x268
+#define H_REGISTER_HEA_RPAGES	0x26C
+#define H_DISABLE_AND_GET_HEA	0x270
+#define H_GET_HEA_INFO		0x274
+#define H_ALLOC_HEA_RESOURCE	0x278
+#define H_ADD_CONN		0x284
+#define H_DEL_CONN		0x288
  #define H_JOIN			0x298
  #define H_VASI_STATE            0x2A4
  #define H_ENABLE_CRQ		0x2B0

^ permalink raw reply

* Re: [PATCH 3/6] ehea: queue management
From: Jörn Engel @ 2006-08-11  9:21 UTC (permalink / raw)
  To: Thomas Klein
  Cc: Thomas Klein, Michael Neuling, netdev, linux-kernel,
	Christoph Raisch, linuxppc-dev, Marcus Eder, Alexey Dobriyan
In-Reply-To: <44DC319A.10802@de.ibm.com>

On Fri, 11 August 2006 09:28:26 +0200, Thomas Klein wrote:
> Michael Neuling wrote:
> >>>>+static inline u32 map_swqe_size(u8 swqe_enc_size)
> >>>>+static inline u32|map_rwqe_size(u8 rwqe_enc_size)
> >  
> Agreed. Functions were replaced by a single map_wqe_size() function.

Just a general thing, try to avoid having two identifiers that are
near-100% identical.  As seen in this thread, they are _very_ easy to
confuse.

Ime, there are two methods to avoid this.  One is to make the
identifiers longer, something like "map_seek_wqe_size" and
"map_read_wqe_size".  The other is to make them shorter, just "s" and
"r" is less confusing than the above.

Which method works best depends on many things, including personal
taste.

Jörn

-- 
And spam is a useful source of entropy for /dev/random too!
-- Jasmine Strong

^ permalink raw reply

* Re: SystemAce Driver.
From: Ameet Patil @ 2006-08-11  9:34 UTC (permalink / raw)
  To: sudheer; +Cc: linuxppc-embedded
In-Reply-To: <44D9F9DF.5020100@gmail.com>

Hi Sudheer,
    Frank has already answered your questions. If you have any problems 
with the SysAce patch... do let me know. I have written a small tutorial 
here if it helps...

http://linux.get2knowmore.com


-Ameet

sudheer wrote:
> Hello Ameet Patil
> 
> I am looking for linux kernel source 2.6.16 with system ace controller 
> support. I downloaded the linux-2.6.16 and linux-2.6.17-1 source from 
> kernel.org but could not find any files related to system ace 
> controller  ( No xilinx_sysace directory in  drivers/block/) .  I have 
> checked penguinppc.org also but could not get it.
> 
> Can you please send to me the link where i could download the 
> linuxppc-2.6.16 source with system ace support.
> 
> Thanks & Regards
> Sudheer
> 
> Ameet Patil wrote:
>> Hi Raja,
>>     I have ported the Xilinx System ACE driver to 2.6 kernel. Find the 
>> latest one here:
>> http://www.cs.york.ac.uk/rtslab/demos/amos/xupv2pro/patches/linuxppc-2.6.17.1-sysace-1.2.patch
>>
>> NOTE: this patch wouldn't work if you are using the TEMAC driver. In 
>> which case use the -after-TEMAC patch found in the patches folder above.
>>
>> Check the following discussions (threads) for more details:
>> 1. "Xilinx SystemACE driver for 2.6"
>> 2. "Xilinx BSP for linux 2.6"
>> 3. "Kernel hangs after "Now booting the kernel"."
>>
>> cheers,
>> -Ameet
>>
>> Raja Chidambaram wrote:
>>   
>>>  Hi all,
>>>  We are working on customized board with amcc 440SPe
>>> processor & xilinx System Ace controller. The System
>>> Ace controller is connected to compact flash driver.
>>>
>>> We use u-boot 1.2 as bootloader & linux kernel
>>> 2.6.16-2.
>>>
>>> On the process the u-boot is able to detect compact
>>> flash through Xilinx SystemAce controller & able to
>>> load the kernel image into compact flash.But when the
>>> linux boot's up it not able to detect the System Ace
>>> controller or compact flash.
>>>
>>> Note:we need to have the root file system in compact
>>> flash.
>>>
>>> Is their any drivers available for SystemAce
>>> controller on linux 2.6,if their how to get it.please
>>> help me in this
>>>                                     with regards
>>>                                      raja
>>>
>>>
>>>
>>> __________________________________________________
>>> Do You Yahoo!?
>>> Tired of spam?  Yahoo! Mail has the best spam protection around 
>>> http://mail.yahoo.com 
>>> _______________________________________________
>>> Linuxppc-embedded mailing list
>>> Linuxppc-embedded@ozlabs.org
>>> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>>>
>>>     
>> _______________________________________________
>> Linuxppc-embedded mailing list
>> Linuxppc-embedded@ozlabs.org
>> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>>
>>   
> 

^ permalink raw reply

* RE: PCI driver on EB8347
From: rajan rai @ 2006-08-11  9:15 UTC (permalink / raw)
  To: Liu Dave-r63238, Gala Kumar K.-galak; +Cc: linuxppc-embedded
In-Reply-To: <995B09A8299C2C44B59866F6391D2635018CA7@zch01exm21.fsl.freescale.net>

[-- Attachment #1: Type: text/plain, Size: 1702 bytes --]

 
                      I'm using polling mechanism and not interrupts in my driver. Although I'm not using polling I see strange behavior When I do lspci -v I don't see any interrupts being allocated to PCI device behind PCI bridge !!!! But when I use same card directly on primary bus I do see interrupt being allocated to PCI device. Any advise why IRQ's being not allocated in case its attached to PCI bridge ?
 
                              Do I need to take care of any extra configuration in case of PCI card is attached to PCI bridge ?
 
Yaa you are correct I shouldn't use CONFIG_85xx_PCI2
 
Thanks,
-Rajan

________________________________

From: Liu Dave-r63238 [mailto:DaveLiu@freescale.com]
Sent: Thu 8/10/2006 10:40 PM
To: rajan rai; Gala Kumar K.-galak
Cc: linuxppc-embedded@ozlabs.org
Subject: RE: PCI driver on EB8347




Rajan>        I have written PCI driver which works fine along with
MPC8347 and two PCI
Rajan> card connected in a single PCI bus. When I try to communicate
same PCI card
Rajan> using PCI bridge ( PCI2050B ), Linux does detect PCI card on
Secondary bus
Rajan> but same driver doesn't work !!!!

PCI interrupt for secondary bus set up properly?
     
Rajan>        Do I need to enable support for second PCI host controller
at kernel level to
Rajan>make it work? Or I need to do something else ? I tried compiling
PPC-linux kernel
Rajan> after enabling CONFIG_85xx_PCI2 kernel doesn't compile it gives
me error while
Rajan>compiling "arch/ppc/syslib/ppc83xx_setup.c" Kernel version I'm
using is 2.6.13.

Why you enable CONFIG_85xx_PCI2 in kernel? It is for 85xx, but you are
using 8347 processor.

<snip>

Dave




[-- Attachment #2: Type: text/html, Size: 3177 bytes --]

^ permalink raw reply

* Re: XUPV2P, which kernel 2.6. device drivers are available?
From: Benjamin Heyne @ 2006-08-11  8:30 UTC (permalink / raw)
  To: linuxppc-embedded
In-Reply-To: <44D7644A.5070107@gmail.com>

And so it came to pass, that on Mon, 07 Aug 2006 17:03:22 +0100
Ameet Patil <ammubhai@gmail.com> wrote as thus:

> Hi Benjamin,
>     I had ported the ENET driver but it was a bit buggy. Could you send 
> me your driver patch so I can test it?
> 

Hi,
I have put all necessary files into an archive. I have implemented
the driver into a patched version of the 2.6.18-rc3 kernel, so
I thought it would be the best to provide all modified files in an
archive (also, I am not familiar with generating patches and stuff... ;-).
Please feel free to provide a "real" patch.

Ok, here we go:

http://www.dt.e-technik.uni-dortmund.de/mitarbeiter/heyne/xilinx/xilinx_emac_26.zip

Be warned:
This driver probably can be considered as BadHack(TM) -
It's the first one I am providing to the public. So if
you have any suggestions for improving it, please tell me.

TODO (As far as I can tell):
	- Make it a real platform device
	- Make use of the XILINX_EDK config of the TEMAC driver patch
	  (Btw.: Will this be officially integrated into the kernel?).

Any feedback will be appreciated...

Best regards
-- 
Benjamin Heyne

^ permalink raw reply

* Re: [PATCH 6/6] ehea: Kernel build (Kconfig / Makefile)
From: Thomas Q Klein @ 2006-08-11  8:03 UTC (permalink / raw)
  To: Michael Neuling; +Cc: linux-ppc, mikey, Christoph Raisch, osstklei
In-Reply-To: <20060810053024.C691F67A5E@ozlabs.org>

[-- Attachment #1: Type: text/plain, Size: 774 bytes --]

mikey@ozlabs.org wrote on 10.08.2006 07:30:24:

> > --- linux-2.6.18-rc4/drivers/net/Makefile   2006-08-06 
11:20:11.000000000 -
> 0700
> > +++ patched_kernel/drivers/net/Makefile   2006-08-08 
03:00:30.061451584 -
> 0700
> > @@ -10,6 +10,7 @@ obj-$(CONFIG_E1000) += e1000/
> >   obj-$(CONFIG_IBM_EMAC) += ibm_emac/
> >   obj-$(CONFIG_IXGB) += ixgb/
> >   obj-$(CONFIG_CHELSIO_T1) += chelsio/
> > +obj-$(CONFIG_EHEA) += ehea/
> >   obj-$(CONFIG_BONDING) += bonding/
> >   obj-$(CONFIG_GIANFAR) += gianfar_driver.o
> 
> Looks like the whitespace has been munged here... 
> 
> Mikey

I see it looks damaged but infact it isn't. All obj-$(CONFIG_*) lines in
the Makefile start at column 0 and so does the one I added. I don't know
why it appears in the diff like that.

Thomas

[-- Attachment #2: Type: text/html, Size: 1121 bytes --]

^ permalink raw reply

* Re: [PATCH 3/6] ehea: queue management
From: Thomas Klein @ 2006-08-11  7:28 UTC (permalink / raw)
  To: Michael Neuling
  Cc: Thomas Klein, netdev, linux-kernel, Christoph Raisch,
	linuxppc-dev, Marcus Eder, Alexey Dobriyan
In-Reply-To: <20060811004602.23EB467B64@ozlabs.org>

Michael Neuling wrote:
>>>> +static inline u32 map_swqe_size(u8 swqe_enc_size)
>>>> +{
>>>> +	return 128 << swqe_enc_size;
>>>> +}		      ^
>>>> +		      |
>>>> +static inline u32|map_rwqe_size(u8 rwqe_enc_size)
>>>> +{		      |
>>>> +	return 128 << rwqe_enc_size;
>>>>         
>> 		      ^
>>     
>>>> +}		      |
>>>>         
>>> 		      |
>>> Snap!  These are ide|tical...
>>>       
>> 		      |
>> No, they aren't. -----+
>>     
>
> Functionally identical.
>
> Mikey
>
>   
Agreed. Functions were replaced by a single map_wqe_size() function.

Thomas

^ permalink raw reply

* latest git: compile error: arch/powerpc/kernel/built-in.o
From: Niels Kristian Bech Jensen @ 2006-08-11  6:13 UTC (permalink / raw)
  To: linuxppc-dev

>   LD      .tmp_vmlinux1
> arch/powerpc/kernel/built-in.o: In function `__restore_cpu_setup':
> (.text+0xcd34): undefined reference to `kexec_sr_activated'
> arch/powerpc/kernel/built-in.o: In function `__restore_cpu_setup':
> (.text+0xcd44): undefined reference to `crash_kexec_secondary'
> arch/powerpc/kernel/built-in.o: In function `early_init_devtree':
> (.init.text+0x1cdc): undefined reference to `reserve_crashkernel'
> arch/powerpc/kernel/built-in.o: In function `early_init_devtree':
> (.init.text+0x1e1c): undefined reference to `overlaps_crashkernel'
> make[1]: *** [.tmp_vmlinux1] Error 1
> make[1]: Leaving directory `/home/shorty/kernel-factory/git.08102006/linux-2.6'
> make: *** [debian/stamp-build-kernel] Error 2

I've hit the same build error in 2.6.18-rc4. Maybe the patches should also be added to the main kernel tree?

Regards,
Niels Kristian

^ permalink raw reply

* how to apply a PowerPC patch to linux 2.4 kernel and port to memec board with vertex II pro FPGA?
From: Ujwal @ 2006-08-11  6:10 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 296 bytes --]

hi all,

im new to porting of Linux to PowerPC . Could anyone let me know

1) the procedure of how to Port a linux OS to PowerPC for a VirtexII Pro
memec board??

whats are the steps that i need to follow?

2) where can i find the power-pc patch for linux 2.4 kernel?


Thanks and Regards,
Ujwal

[-- Attachment #2: Type: text/html, Size: 480 bytes --]

^ permalink raw reply

* Re: [RFC PATCH 1/4] powerpc 2.6.16-rt17: to build on powerpc w/ RT
From: Tsutomu OWA @ 2006-08-11  6:08 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: mingo, tglx, linux-kernel, linuxppc-dev
In-Reply-To: <17628.4499.609213.401518@cargo.ozlabs.ibm.com>


Hi,

> On Fri, 11 Aug 2006 15:11:47 +1000
> Paul Mackerras <paulus@samba.org> said:

> I would be very surprised if this is all that is required for
> CONFIG_GENERIC_TIME to work correctly on powerpc.  Have you verified
> that the CONFIG_GENERIC_TIME stuff works correctly on powerpc and
> provides all the features provided by the current implementation?

  Well, probably no as you say so.

  What I did for CONFIG_GENERIC_TIME is just to fix a compile
error and to see if the kernel boots or not.  As I mentioned,
it's experimental and is posted to see whether I'm moving in the
right direction or not.

  I'm afraid I have not yet looked into any generic time related 
features/implementations.  Looks like generic time related things
should be on the ToDo list.

  Thanks a lot for your response.
-- owa

^ permalink raw reply

* Re: [RFC PATCH 1/4] powerpc 2.6.16-rt17: to build on powerpc w/ RT
From: Paul Mackerras @ 2006-08-11  5:11 UTC (permalink / raw)
  To: Tsutomu OWA; +Cc: linuxppc-dev, mingo, tglx, linux-kernel
In-Reply-To: <yyiodushvxs.wl@forest.swc.toshiba.co.jp>

Tsutomu OWA writes:

> diff -rup -x CVS 2.6.16-rt17/arch/powerpc/kernel/time.c rt-powerpc/arch/powerpc/kernel/time.c
> --- 2.6.16-rt17/arch/powerpc/kernel/time.c	2006-04-26 18:24:28.000000000 +0900
> +++ rt-powerpc/arch/powerpc/kernel/time.c	2006-07-12 13:45:31.000000000 +0900
> @@ -200,6 +200,7 @@ void udelay(unsigned long usecs)
>  }
>  EXPORT_SYMBOL(udelay);
>  
> +#ifndef CONFIG_GENERIC_TIME

I would be very surprised if this is all that is required for
CONFIG_GENERIC_TIME to work correctly on powerpc.  Have you verified
that the CONFIG_GENERIC_TIME stuff works correctly on powerpc and
provides all the features provided by the current implementation?

Paul.

^ permalink raw reply

* [PATCH 2/2]: powerpc: Cleanup CPU inits
From: Olof Johansson @ 2006-08-11  5:07 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20060811050159.GA5879@pb15.lixom.net>

Cleanup CPU inits a bit more, Geoff Levand already did some earlier.

* Move CPU state save to cpu_setup, since cpu_setup is only ever done
  on cpu 0 on 64-bit and save is never done more than once.
* Rename __restore_cpu_setup to __restore_cpu_ppc970 and add
  function pointers to the cputable to use instead. Powermac always
  has 970 so no need to check there.
* Rename __970_cpu_preinit to __cpu_preinit_ppc970 and check PVR before
  calling it instead of in it, it's too early to use cputable.
* Rename pSeries_secondary_smp_init to generic_secondary_smp_init since
  everyone but powermac and iSeries use it.


Signed-off-by: Olof Johansson <olof@lixom.net>


Index: linux-2.6/arch/powerpc/kernel/cpu_setup_ppc970.S
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/cpu_setup_ppc970.S
+++ linux-2.6/arch/powerpc/kernel/cpu_setup_ppc970.S
@@ -16,27 +16,12 @@
 #include <asm/asm-offsets.h>
 #include <asm/cache.h>
 
-_GLOBAL(__970_cpu_preinit)
-	/*
-	 * Do nothing if not running in HV mode
-	 */
+_GLOBAL(__cpu_preinit_ppc970)
+	/* Do nothing if not running in HV mode */
 	mfmsr	r0
 	rldicl.	r0,r0,4,63
 	beqlr
 
-	/*
-	 * Deal only with PPC970 and PPC970FX.
-	 */
-	mfspr	r0,SPRN_PVR
-	srwi	r0,r0,16
-	cmpwi	r0,0x39
-	beq	1f
-	cmpwi	r0,0x3c
-	beq	1f
-	cmpwi	r0,0x44
-	bnelr
-1:
-
 	/* Make sure HID4:rm_ci is off before MMU is turned off, that large
 	 * pages are enabled with HID4:61 and clear HID5:DCBZ_size and
 	 * HID5:DCBZ32_ill
@@ -72,21 +57,6 @@ _GLOBAL(__970_cpu_preinit)
 	isync
 	blr
 
-_GLOBAL(__setup_cpu_ppc970)
-	mfspr	r0,SPRN_HID0
-	li	r11,5			/* clear DOZE and SLEEP */
-	rldimi	r0,r11,52,8		/* set NAP and DPM */
-	mtspr	SPRN_HID0,r0
-	mfspr	r0,SPRN_HID0
-	mfspr	r0,SPRN_HID0
-	mfspr	r0,SPRN_HID0
-	mfspr	r0,SPRN_HID0
-	mfspr	r0,SPRN_HID0
-	mfspr	r0,SPRN_HID0
-	sync
-	isync
-	blr
-
 /* Definitions for the table use to save CPU states */
 #define CS_HID0		0
 #define CS_HID1		8
@@ -101,33 +71,28 @@ cpu_state_storage:
 	.balign	L1_CACHE_BYTES,0
 	.text
 
-/* Called in normal context to backup CPU 0 state. This
- * does not include cache settings. This function is also
- * called for machine sleep. This does not include the MMU
- * setup, BATs, etc... but rather the "special" registers
- * like HID0, HID1, HID4, etc...
- */
-_GLOBAL(__save_cpu_setup)
-	/* Some CR fields are volatile, we back it up all */
-	mfcr	r7
-
-	/* Get storage ptr */
-	LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
-
-	/* We only deal with 970 for now */
-	mfspr	r0,SPRN_PVR
-	srwi	r0,r0,16
-	cmpwi	r0,0x39
-	beq	1f
-	cmpwi	r0,0x3c
-	beq	1f
-	cmpwi	r0,0x44
-	bne	2f
 
-1:	/* skip if not running in HV mode */
+_GLOBAL(__setup_cpu_ppc970)
+	/* Do nothing if not running in HV mode */
 	mfmsr	r0
 	rldicl.	r0,r0,4,63
-	beq	2f
+	beqlr
+
+	mfspr	r0,SPRN_HID0
+	li	r11,5			/* clear DOZE and SLEEP */
+	rldimi	r0,r11,52,8		/* set NAP and DPM */
+	mtspr	SPRN_HID0,r0
+	mfspr	r0,SPRN_HID0
+	mfspr	r0,SPRN_HID0
+	mfspr	r0,SPRN_HID0
+	mfspr	r0,SPRN_HID0
+	mfspr	r0,SPRN_HID0
+	mfspr	r0,SPRN_HID0
+	sync
+	isync
+
+	/* Save away cpu state */
+	LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
 
 	/* Save HID0,1,4 and 5 */
 	mfspr	r3,SPRN_HID0
@@ -139,35 +104,19 @@ _GLOBAL(__save_cpu_setup)
 	mfspr	r3,SPRN_HID5
 	std	r3,CS_HID5(r5)
 
-2:
-	mtcr	r7
 	blr
 
 /* Called with no MMU context (typically MSR:IR/DR off) to
  * restore CPU state as backed up by the previous
  * function. This does not include cache setting
  */
-_GLOBAL(__restore_cpu_setup)
-	/* Get storage ptr (FIXME when using anton reloc as we
-	 * are running with translation disabled here
-	 */
-	LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
-
-	/* We only deal with 970 for now */
-	mfspr	r0,SPRN_PVR
-	srwi	r0,r0,16
-	cmpwi	r0,0x39
-	beq	1f
-	cmpwi	r0,0x3c
-	beq	1f
-	cmpwi	r0,0x44
-	bnelr
-
-1:	/* skip if not running in HV mode */
+_GLOBAL(__restore_cpu_ppc970)
+	/* Do nothing if not running in HV mode */
 	mfmsr	r0
 	rldicl.	r0,r0,4,63
 	beqlr
 
+	LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
 	/* Before accessing memory, we make sure rm_ci is clear */
 	li	r0,0
 	mfspr	r3,SPRN_HID4
Index: linux-2.6/arch/powerpc/kernel/head_64.S
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/head_64.S
+++ linux-2.6/arch/powerpc/kernel/head_64.S
@@ -132,7 +132,7 @@ _GLOBAL(__secondary_hold)
 	bne	100b
 
 #if defined(CONFIG_SMP) || defined(CONFIG_KEXEC)
-	LOAD_REG_IMMEDIATE(r4, .pSeries_secondary_smp_init)
+	LOAD_REG_IMMEDIATE(r4, .generic_secondary_smp_init)
 	mtctr	r4
 	mr	r3,r24
 	bctr
@@ -1484,19 +1484,17 @@ fwnmi_data_area:
         . = 0x8000
 
 /*
- * On pSeries, secondary processors spin in the following code.
+ * On pSeries and most other platforms, secondary processors spin
+ * in the following code.
  * At entry, r3 = this processor's number (physical cpu id)
  */
-_GLOBAL(pSeries_secondary_smp_init)
+_GLOBAL(generic_secondary_smp_init)
 	mr	r24,r3
 	
 	/* turn on 64-bit mode */
 	bl	.enable_64b_mode
 	isync
 
-	/* Copy some CPU settings from CPU 0 */
-	bl	.__restore_cpu_setup
-
 	/* Set up a paca value for this processor. Since we have the
 	 * physical cpu id in r24, we need to search the pacas to find
 	 * which logical id maps to our physical one.
@@ -1522,15 +1520,28 @@ _GLOBAL(pSeries_secondary_smp_init)
 					/* start.			 */
 	sync
 
-	/* Create a temp kernel stack for use before relocation is on.	*/
+#ifndef CONFIG_SMP
+	b	3b			/* Never go on non-SMP		 */
+#else
+	cmpwi	0,r23,0
+	beq	3b			/* Loop until told to go	 */
+
+	/* See if we need to call a cpu state restore handler */
+	LOAD_REG_IMMEDIATE(r23, cur_cpu_spec)
+	ld	r23,0(r23)
+	ld	r23,CPU_SPEC_RESTORE(r23)
+	cmpdi	0,r23,0
+	beq	4f
+	ld	r23,0(r23)
+	mtctr	r23
+	bctrl
+
+4:	/* Create a temp kernel stack for use before relocation is on.	*/
 	ld	r1,PACAEMERGSP(r13)
 	subi	r1,r1,STACK_FRAME_OVERHEAD
 
-	cmpwi	0,r23,0
-#ifdef CONFIG_SMP
-	bne	.__secondary_start
+	b	.__secondary_start
 #endif
-	b 	3b			/* Loop until told to go	 */
 
 #ifdef CONFIG_PPC_ISERIES
 _STATIC(__start_initialization_iSeries)
@@ -1611,7 +1622,16 @@ _GLOBAL(__start_initialization_multiplat
 	bl	.enable_64b_mode
 
 	/* Setup some critical 970 SPRs before switching MMU off */
-	bl	.__970_cpu_preinit
+	mfspr	r0,SPRN_PVR
+	srwi	r0,r0,16
+	cmpwi	r0,0x39		/* 970 */
+	beq	1f
+	cmpwi	r0,0x3c		/* 970FX */
+	beq	1f
+	cmpwi	r0,0x44		/* 970MP */
+	bne	2f
+1:	bl	.__cpu_preinit_ppc970
+2:
 
 	/* Switch off MMU if not already */
 	LOAD_REG_IMMEDIATE(r4, .__after_prom_start - KERNELBASE)
@@ -1782,7 +1802,7 @@ _GLOBAL(pmac_secondary_start)
 	isync
 
 	/* Copy some CPU settings from CPU 0 */
-	bl	.__restore_cpu_setup
+	bl	.__restore_cpu_ppc970
 
 	/* pSeries do that early though I don't think we really need it */
 	mfmsr	r3
@@ -1932,12 +1952,6 @@ _STATIC(start_here_multiplatform)
 	mr	r5,r26
 	bl	.identify_cpu
 
-	/* Save some low level config HIDs of CPU0 to be copied to
-	 * other CPUs later on, or used for suspend/resume
-	 */
-	bl	.__save_cpu_setup
-	sync
-
 	/* Do very early kernel initializations, including initial hash table,
 	 * stab and slb setup before we turn on relocation.	*/
 
Index: linux-2.6/arch/powerpc/platforms/cell/smp.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/cell/smp.c
+++ linux-2.6/arch/powerpc/platforms/cell/smp.c
@@ -57,7 +57,7 @@
  */
 static cpumask_t of_spin_map;
 
-extern void pSeries_secondary_smp_init(unsigned long);
+extern void generic_secondary_smp_init(unsigned long);
 
 /**
  * smp_startup_cpu() - start the given cpu
@@ -74,7 +74,7 @@ static inline int __devinit smp_startup_
 {
 	int status;
 	unsigned long start_here = __pa((u32)*((unsigned long *)
-					       pSeries_secondary_smp_init));
+					       generic_secondary_smp_init));
 	unsigned int pcpu;
 	int start_cpu;
 
Index: linux-2.6/arch/powerpc/platforms/pseries/smp.c
===================================================================
--- linux-2.6.orig/arch/powerpc/platforms/pseries/smp.c
+++ linux-2.6/arch/powerpc/platforms/pseries/smp.c
@@ -62,7 +62,7 @@
  */
 static cpumask_t of_spin_map;
 
-extern void pSeries_secondary_smp_init(unsigned long);
+extern void generic_secondary_smp_init(unsigned long);
 
 #ifdef CONFIG_HOTPLUG_CPU
 
@@ -270,7 +270,7 @@ static inline int __devinit smp_startup_
 {
 	int status;
 	unsigned long start_here = __pa((u32)*((unsigned long *)
-					       pSeries_secondary_smp_init));
+					       generic_secondary_smp_init));
 	unsigned int pcpu;
 	int start_cpu;
 
Index: linux-2.6/arch/powerpc/kernel/asm-offsets.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/asm-offsets.c
+++ linux-2.6/arch/powerpc/kernel/asm-offsets.c
@@ -241,6 +241,7 @@ int main(void)
 	DEFINE(CPU_SPEC_PVR_VALUE, offsetof(struct cpu_spec, pvr_value));
 	DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features));
 	DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup));
+	DEFINE(CPU_SPEC_RESTORE, offsetof(struct cpu_spec, cpu_restore));
 
 #ifndef CONFIG_PPC64
 	DEFINE(pbe_address, offsetof(struct pbe, address));
Index: linux-2.6/arch/powerpc/kernel/cputable.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/cputable.c
+++ linux-2.6/arch/powerpc/kernel/cputable.c
@@ -39,7 +39,10 @@ extern void __setup_cpu_7400(unsigned lo
 extern void __setup_cpu_7410(unsigned long offset, struct cpu_spec* spec);
 extern void __setup_cpu_745x(unsigned long offset, struct cpu_spec* spec);
 #endif /* CONFIG_PPC32 */
+#ifdef CONFIG_PPC64
 extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec);
+extern void __restore_cpu_ppc970(void);
+#endif /* CONFIG_PPC64 */
 
 /* This table only contains "desktop" CPUs, it need to be filled with embedded
  * ones as well...
@@ -184,6 +187,7 @@ struct cpu_spec	cpu_specs[] = {
 		.dcache_bsize		= 128,
 		.num_pmcs		= 8,
 		.cpu_setup		= __setup_cpu_ppc970,
+		.cpu_restore		= __restore_cpu_ppc970,
 		.oprofile_cpu_type	= "ppc64/970",
 		.oprofile_type		= PPC_OPROFILE_POWER4,
 		.platform		= "ppc970",
@@ -199,6 +203,7 @@ struct cpu_spec	cpu_specs[] = {
 		.dcache_bsize		= 128,
 		.num_pmcs		= 8,
 		.cpu_setup		= __setup_cpu_ppc970,
+		.cpu_restore		= __restore_cpu_ppc970,
 		.oprofile_cpu_type	= "ppc64/970",
 		.oprofile_type		= PPC_OPROFILE_POWER4,
 		.platform		= "ppc970",
@@ -214,6 +219,7 @@ struct cpu_spec	cpu_specs[] = {
 		.dcache_bsize		= 128,
 		.num_pmcs		= 8,
 		.cpu_setup		= __setup_cpu_ppc970,
+		.cpu_restore		= __restore_cpu_ppc970,
 		.oprofile_cpu_type	= "ppc64/970",
 		.oprofile_type		= PPC_OPROFILE_POWER4,
 		.platform		= "ppc970",
Index: linux-2.6/include/asm-powerpc/cputable.h
===================================================================
--- linux-2.6.orig/include/asm-powerpc/cputable.h
+++ linux-2.6/include/asm-powerpc/cputable.h
@@ -36,6 +36,7 @@
 struct cpu_spec;
 
 typedef	void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec);
+typedef	void (*cpu_restore_t)(void);
 
 enum powerpc_oprofile_type {
 	PPC_OPROFILE_INVALID = 0,
@@ -65,6 +66,8 @@ struct cpu_spec {
 	 * BHT, SPD, etc... from head.S before branching to identify_machine
 	 */
 	cpu_setup_t	cpu_setup;
+	/* Used to restore cpu setup on secondary processors and at resume */
+	cpu_restore_t	cpu_restore;
 
 	/* Used by oprofile userspace to select the right counters */
 	char		*oprofile_cpu_type;

^ permalink raw reply

* [PATCH 1/2] powerpc: Rename cpu_setup_power4.S to cpu_setup_ppc970.S
From: Olof Johansson @ 2006-08-11  5:03 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20060811050159.GA5879@pb15.lixom.net>

Rename cpu_setup_power4.S to cpu_setup_ppc970.S, since that's
really what it is.

No functional or other changes.


Signed-off-by: Olof Johansson <olof@lixom.net>

Index: linux-2.6/arch/powerpc/kernel/cpu_setup_power4.S
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/cpu_setup_power4.S
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * This file contains low level CPU setup functions.
- *    Copyright (C) 2003 Benjamin Herrenschmidt (benh@kernel.crashing.org)
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- *
- */
-
-#include <asm/processor.h>
-#include <asm/page.h>
-#include <asm/cputable.h>
-#include <asm/ppc_asm.h>
-#include <asm/asm-offsets.h>
-#include <asm/cache.h>
-
-_GLOBAL(__970_cpu_preinit)
-	/*
-	 * Do nothing if not running in HV mode
-	 */
-	mfmsr	r0
-	rldicl.	r0,r0,4,63
-	beqlr
-
-	/*
-	 * Deal only with PPC970 and PPC970FX.
-	 */
-	mfspr	r0,SPRN_PVR
-	srwi	r0,r0,16
-	cmpwi	r0,0x39
-	beq	1f
-	cmpwi	r0,0x3c
-	beq	1f
-	cmpwi	r0,0x44
-	bnelr
-1:
-
-	/* Make sure HID4:rm_ci is off before MMU is turned off, that large
-	 * pages are enabled with HID4:61 and clear HID5:DCBZ_size and
-	 * HID5:DCBZ32_ill
-	 */
-	li	r0,0
-	mfspr	r3,SPRN_HID4
-	rldimi	r3,r0,40,23	/* clear bit 23 (rm_ci) */
-	rldimi	r3,r0,2,61	/* clear bit 61 (lg_pg_en) */
-	sync
-	mtspr	SPRN_HID4,r3
-	isync
-	sync
-	mfspr	r3,SPRN_HID5
-	rldimi	r3,r0,6,56	/* clear bits 56 & 57 (DCBZ*) */
-	sync
-	mtspr	SPRN_HID5,r3
-	isync
-	sync
-
-	/* Setup some basic HID1 features */
-	mfspr	r0,SPRN_HID1
-	li	r3,0x1200		/* enable i-fetch cacheability */
-	sldi	r3,r3,44		/* and prefetch */
-	or	r0,r0,r3
-	mtspr	SPRN_HID1,r0
-	mtspr	SPRN_HID1,r0
-	isync
-
-	/* Clear HIOR */
-	li	r0,0
-	sync
-	mtspr	SPRN_HIOR,0		/* Clear interrupt prefix */
-	isync
-	blr
-
-_GLOBAL(__setup_cpu_ppc970)
-	mfspr	r0,SPRN_HID0
-	li	r11,5			/* clear DOZE and SLEEP */
-	rldimi	r0,r11,52,8		/* set NAP and DPM */
-	mtspr	SPRN_HID0,r0
-	mfspr	r0,SPRN_HID0
-	mfspr	r0,SPRN_HID0
-	mfspr	r0,SPRN_HID0
-	mfspr	r0,SPRN_HID0
-	mfspr	r0,SPRN_HID0
-	mfspr	r0,SPRN_HID0
-	sync
-	isync
-	blr
-
-/* Definitions for the table use to save CPU states */
-#define CS_HID0		0
-#define CS_HID1		8
-#define	CS_HID4		16
-#define CS_HID5		24
-#define CS_SIZE		32
-
-	.data
-	.balign	L1_CACHE_BYTES,0
-cpu_state_storage:
-	.space	CS_SIZE
-	.balign	L1_CACHE_BYTES,0
-	.text
-
-/* Called in normal context to backup CPU 0 state. This
- * does not include cache settings. This function is also
- * called for machine sleep. This does not include the MMU
- * setup, BATs, etc... but rather the "special" registers
- * like HID0, HID1, HID4, etc...
- */
-_GLOBAL(__save_cpu_setup)
-	/* Some CR fields are volatile, we back it up all */
-	mfcr	r7
-
-	/* Get storage ptr */
-	LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
-
-	/* We only deal with 970 for now */
-	mfspr	r0,SPRN_PVR
-	srwi	r0,r0,16
-	cmpwi	r0,0x39
-	beq	1f
-	cmpwi	r0,0x3c
-	beq	1f
-	cmpwi	r0,0x44
-	bne	2f
-
-1:	/* skip if not running in HV mode */
-	mfmsr	r0
-	rldicl.	r0,r0,4,63
-	beq	2f
-
-	/* Save HID0,1,4 and 5 */
-	mfspr	r3,SPRN_HID0
-	std	r3,CS_HID0(r5)
-	mfspr	r3,SPRN_HID1
-	std	r3,CS_HID1(r5)
-	mfspr	r3,SPRN_HID4
-	std	r3,CS_HID4(r5)
-	mfspr	r3,SPRN_HID5
-	std	r3,CS_HID5(r5)
-
-2:
-	mtcr	r7
-	blr
-
-/* Called with no MMU context (typically MSR:IR/DR off) to
- * restore CPU state as backed up by the previous
- * function. This does not include cache setting
- */
-_GLOBAL(__restore_cpu_setup)
-	/* Get storage ptr (FIXME when using anton reloc as we
-	 * are running with translation disabled here
-	 */
-	LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
-
-	/* We only deal with 970 for now */
-	mfspr	r0,SPRN_PVR
-	srwi	r0,r0,16
-	cmpwi	r0,0x39
-	beq	1f
-	cmpwi	r0,0x3c
-	beq	1f
-	cmpwi	r0,0x44
-	bnelr
-
-1:	/* skip if not running in HV mode */
-	mfmsr	r0
-	rldicl.	r0,r0,4,63
-	beqlr
-
-	/* Before accessing memory, we make sure rm_ci is clear */
-	li	r0,0
-	mfspr	r3,SPRN_HID4
-	rldimi	r3,r0,40,23	/* clear bit 23 (rm_ci) */
-	sync
-	mtspr	SPRN_HID4,r3
-	isync
-	sync
-
-	/* Clear interrupt prefix */
-	li	r0,0
-	sync
-	mtspr	SPRN_HIOR,0
-	isync
-
-	/* Restore HID0 */
-	ld	r3,CS_HID0(r5)
-	sync
-	isync
-	mtspr	SPRN_HID0,r3
-	mfspr	r3,SPRN_HID0
-	mfspr	r3,SPRN_HID0
-	mfspr	r3,SPRN_HID0
-	mfspr	r3,SPRN_HID0
-	mfspr	r3,SPRN_HID0
-	mfspr	r3,SPRN_HID0
-	sync
-	isync
-
-	/* Restore HID1 */
-	ld	r3,CS_HID1(r5)
-	sync
-	isync
-	mtspr	SPRN_HID1,r3
-	mtspr	SPRN_HID1,r3
-	sync
-	isync
-
-	/* Restore HID4 */
-	ld	r3,CS_HID4(r5)
-	sync
-	isync
-	mtspr	SPRN_HID4,r3
-	sync
-	isync
-
-	/* Restore HID5 */
-	ld	r3,CS_HID5(r5)
-	sync
-	isync
-	mtspr	SPRN_HID5,r3
-	sync
-	isync
-	blr
-
Index: linux-2.6/arch/powerpc/kernel/cpu_setup_ppc970.S
===================================================================
--- /dev/null
+++ linux-2.6/arch/powerpc/kernel/cpu_setup_ppc970.S
@@ -0,0 +1,225 @@
+/*
+ * This file contains low level CPU setup functions.
+ *    Copyright (C) 2003 Benjamin Herrenschmidt (benh@kernel.crashing.org)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ */
+
+#include <asm/processor.h>
+#include <asm/page.h>
+#include <asm/cputable.h>
+#include <asm/ppc_asm.h>
+#include <asm/asm-offsets.h>
+#include <asm/cache.h>
+
+_GLOBAL(__970_cpu_preinit)
+	/*
+	 * Do nothing if not running in HV mode
+	 */
+	mfmsr	r0
+	rldicl.	r0,r0,4,63
+	beqlr
+
+	/*
+	 * Deal only with PPC970 and PPC970FX.
+	 */
+	mfspr	r0,SPRN_PVR
+	srwi	r0,r0,16
+	cmpwi	r0,0x39
+	beq	1f
+	cmpwi	r0,0x3c
+	beq	1f
+	cmpwi	r0,0x44
+	bnelr
+1:
+
+	/* Make sure HID4:rm_ci is off before MMU is turned off, that large
+	 * pages are enabled with HID4:61 and clear HID5:DCBZ_size and
+	 * HID5:DCBZ32_ill
+	 */
+	li	r0,0
+	mfspr	r3,SPRN_HID4
+	rldimi	r3,r0,40,23	/* clear bit 23 (rm_ci) */
+	rldimi	r3,r0,2,61	/* clear bit 61 (lg_pg_en) */
+	sync
+	mtspr	SPRN_HID4,r3
+	isync
+	sync
+	mfspr	r3,SPRN_HID5
+	rldimi	r3,r0,6,56	/* clear bits 56 & 57 (DCBZ*) */
+	sync
+	mtspr	SPRN_HID5,r3
+	isync
+	sync
+
+	/* Setup some basic HID1 features */
+	mfspr	r0,SPRN_HID1
+	li	r3,0x1200		/* enable i-fetch cacheability */
+	sldi	r3,r3,44		/* and prefetch */
+	or	r0,r0,r3
+	mtspr	SPRN_HID1,r0
+	mtspr	SPRN_HID1,r0
+	isync
+
+	/* Clear HIOR */
+	li	r0,0
+	sync
+	mtspr	SPRN_HIOR,0		/* Clear interrupt prefix */
+	isync
+	blr
+
+_GLOBAL(__setup_cpu_ppc970)
+	mfspr	r0,SPRN_HID0
+	li	r11,5			/* clear DOZE and SLEEP */
+	rldimi	r0,r11,52,8		/* set NAP and DPM */
+	mtspr	SPRN_HID0,r0
+	mfspr	r0,SPRN_HID0
+	mfspr	r0,SPRN_HID0
+	mfspr	r0,SPRN_HID0
+	mfspr	r0,SPRN_HID0
+	mfspr	r0,SPRN_HID0
+	mfspr	r0,SPRN_HID0
+	sync
+	isync
+	blr
+
+/* Definitions for the table use to save CPU states */
+#define CS_HID0		0
+#define CS_HID1		8
+#define	CS_HID4		16
+#define CS_HID5		24
+#define CS_SIZE		32
+
+	.data
+	.balign	L1_CACHE_BYTES,0
+cpu_state_storage:
+	.space	CS_SIZE
+	.balign	L1_CACHE_BYTES,0
+	.text
+
+/* Called in normal context to backup CPU 0 state. This
+ * does not include cache settings. This function is also
+ * called for machine sleep. This does not include the MMU
+ * setup, BATs, etc... but rather the "special" registers
+ * like HID0, HID1, HID4, etc...
+ */
+_GLOBAL(__save_cpu_setup)
+	/* Some CR fields are volatile, we back it up all */
+	mfcr	r7
+
+	/* Get storage ptr */
+	LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
+
+	/* We only deal with 970 for now */
+	mfspr	r0,SPRN_PVR
+	srwi	r0,r0,16
+	cmpwi	r0,0x39
+	beq	1f
+	cmpwi	r0,0x3c
+	beq	1f
+	cmpwi	r0,0x44
+	bne	2f
+
+1:	/* skip if not running in HV mode */
+	mfmsr	r0
+	rldicl.	r0,r0,4,63
+	beq	2f
+
+	/* Save HID0,1,4 and 5 */
+	mfspr	r3,SPRN_HID0
+	std	r3,CS_HID0(r5)
+	mfspr	r3,SPRN_HID1
+	std	r3,CS_HID1(r5)
+	mfspr	r3,SPRN_HID4
+	std	r3,CS_HID4(r5)
+	mfspr	r3,SPRN_HID5
+	std	r3,CS_HID5(r5)
+
+2:
+	mtcr	r7
+	blr
+
+/* Called with no MMU context (typically MSR:IR/DR off) to
+ * restore CPU state as backed up by the previous
+ * function. This does not include cache setting
+ */
+_GLOBAL(__restore_cpu_setup)
+	/* Get storage ptr (FIXME when using anton reloc as we
+	 * are running with translation disabled here
+	 */
+	LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
+
+	/* We only deal with 970 for now */
+	mfspr	r0,SPRN_PVR
+	srwi	r0,r0,16
+	cmpwi	r0,0x39
+	beq	1f
+	cmpwi	r0,0x3c
+	beq	1f
+	cmpwi	r0,0x44
+	bnelr
+
+1:	/* skip if not running in HV mode */
+	mfmsr	r0
+	rldicl.	r0,r0,4,63
+	beqlr
+
+	/* Before accessing memory, we make sure rm_ci is clear */
+	li	r0,0
+	mfspr	r3,SPRN_HID4
+	rldimi	r3,r0,40,23	/* clear bit 23 (rm_ci) */
+	sync
+	mtspr	SPRN_HID4,r3
+	isync
+	sync
+
+	/* Clear interrupt prefix */
+	li	r0,0
+	sync
+	mtspr	SPRN_HIOR,0
+	isync
+
+	/* Restore HID0 */
+	ld	r3,CS_HID0(r5)
+	sync
+	isync
+	mtspr	SPRN_HID0,r3
+	mfspr	r3,SPRN_HID0
+	mfspr	r3,SPRN_HID0
+	mfspr	r3,SPRN_HID0
+	mfspr	r3,SPRN_HID0
+	mfspr	r3,SPRN_HID0
+	mfspr	r3,SPRN_HID0
+	sync
+	isync
+
+	/* Restore HID1 */
+	ld	r3,CS_HID1(r5)
+	sync
+	isync
+	mtspr	SPRN_HID1,r3
+	mtspr	SPRN_HID1,r3
+	sync
+	isync
+
+	/* Restore HID4 */
+	ld	r3,CS_HID4(r5)
+	sync
+	isync
+	mtspr	SPRN_HID4,r3
+	sync
+	isync
+
+	/* Restore HID5 */
+	ld	r3,CS_HID5(r5)
+	sync
+	isync
+	mtspr	SPRN_HID5,r3
+	sync
+	isync
+	blr
+
Index: linux-2.6/arch/powerpc/kernel/Makefile
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/Makefile
+++ linux-2.6/arch/powerpc/kernel/Makefile
@@ -16,7 +16,7 @@ obj-y				:= semaphore.o cputable.o ptrac
 obj-y				+= vdso32/
 obj-$(CONFIG_PPC64)		+= setup_64.o binfmt_elf32.o sys_ppc32.o \
 				   signal_64.o ptrace32.o \
-				   paca.o cpu_setup_power4.o \
+				   paca.o cpu_setup_ppc970.o \
 				   firmware.o sysfs.o
 obj-$(CONFIG_PPC64)		+= vdso64/
 obj-$(CONFIG_ALTIVEC)		+= vecemu.o vector.o

^ permalink raw reply

* [PATCH 0/2]: powerpc: Cpu init cleanups
From: Olof Johansson @ 2006-08-11  5:01 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

Hi,

Attached are two patches to cleanup the cpu inits a bit. First one just
renames cpu_setup_power4.S to cpu_setup_ppc970.S, since that's really
what it contains. No functional changes at all in there to simplify
review.

Second patch renames some of the setup functions, and make the restore
functions come of the cputable instead of being hardcoded. Current setup
makes it awkward to add new cpus without editing the ppc970 setup/restore
functions or add more PVR checks in the assembly, which would be nice
to avoid. Only the really early one is still needed in assembly, since
cputables have not yet been setup at that point.

Earlier patch submission was all baked together, which makes it harder
to review and tell what is new and not.

Boot tested on PowerMac and POWER5. Please consider for 2.6.19 merge
window.


Thanks,

Olof

^ permalink raw reply

* Re: [RFC] consolidated libdt proposal
From: Milton Miller @ 2006-08-11  4:55 UTC (permalink / raw)
  To: Mark A. Greer
  Cc: hollisb, pantelis, xen-ppc-devel, linuxppc-dev, linuxppc-embedded
In-Reply-To: <20060810185514.GA12848@mag.az.mvista.com>

On Aug 10, 2006, at 1:55 PM, Mark A. Greer wrote:
> On Thu, Aug 10, 2006 at 11:51:30AM -0500, Milton Miller wrote:
>> On Tue Aug  8 2006 01:04:08 PM CDT, Mark A. Greer wrote:
>>> If we're going to allow cmdline editing in the bootwrapper, we would
>>> need to extend the size of a property.
...
>> We already have replace the command line merged (it's why my patches
>> don't apply).
> That's different.
...

Yes, but it still requires changing the size or inserting a
property, which is the real requirement we were discussing.

Yes, editing at command line would require an input function.

milton

^ permalink raw reply

* Re: Gianfar eth driver on 8540 ppc - for 2.4 and 2.6 : different outputs
From: Kumar Gala @ 2006-08-11  4:10 UTC (permalink / raw)
  To: Prashant Yendigeri; +Cc: linuxppc-embedded
In-Reply-To: <OF403D77BC.13F5C3B5-ON652571C6.003D5A1C-652571C6.003E28AE@lntinfotech.com>


On Aug 10, 2006, at 6:18 AM, Prashant Yendigeri wrote:

>
> Hi,
>
> The gianfar driver of 2.6.12 and 2.4.20 give different outputs on  
> the same PPC 8540 board.
>
> What could be the reason ?
>
> Output on 2.4.20 :
> /root # ifconfig eth0 172.28.8.254 up
> eth0: PHY is Marvell 88E1011S (1410c62)
> eth0: Auto-negotiation done
> eth0: Half Duplex
> eth0: Speed 10BT
> eth0: Link is up
>
> Output on 2.6.12
> / # ifconfig eth0 172.28.8.254 up
>  eth0: PHY is Generic MII (ffffffff)

It looks like your 2.6.12 kernel isn't handling the PHY correctly.   
I'd recommend upgrading to something newer which has the phylib  
(can't remember which 2.6 that went into).

- kumar

^ permalink raw reply

* [RFC PATCH 0/4]  powerpc 2.6.16-rt17: to port rt patch to powerpc
From: Tsutomu OWA @ 2006-08-11  2:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: linuxppc-dev, mingo, tglx


Hi, I'm trying to port realtime-preempt patch to powerpc.  The primary
purpose to post an experimental work is for review and to see if I'm on
the right track.  The same material is placed on CE Linux Forum's wiki
page;
http://tree.celinuxforum.org/CelfPubWiki/RTPatchForPowerPC

This series of patches adds support to make rt patch work on powerpc64
targets. Currently two platforms (powermac and cell) are tested.

These patches apply to 2.6.16 kernel with realtime preempt patch
(patch-2.6.16-rt17) by Ingo Molnar at
http://people.redhat.com/mingo/realtime-preempt/.

Compile tested for both powermac and cell w/ and w/o PREEMPT_RT.

Boot tested for powermac w/ and w/o PREEMPT_RT on a Dual Power Mac
G5. (boots on initrd and CONFIG_BLK_DEV_IDE_PMAC is disabled (or with a
work around included in the patch) for PREEMPT_RT, see *1).

Boot tested for cell w/ and w/o PREEMPT_RT on the systemsim simulator
provided by IBM. Note that "iommu=off" command line option is applied.

[RFC PATCH 1/4] powerpc 2.6.16-rt17: to build on powerpc w/ RT
[RFC PATCH 2/4] powerpc 2.6.16-rt17: to boot on powerpc w/ RT
[RFC PATCH 3/4] powerpc 2.6.16-rt17: to support CONFIG_MCOUNT
[RFC PATCH 4/4] powerpc 2.6.16-rt29: to fix network driver (workaround)

These patches are provided under GNU GPL.

Comments and suggestions are welcome.

Thanks in advance.

*1: There seem to be some flaw(s) which make(s) some devices unavailable
 (namely a cdrom drive and a SATA drive so far) when PREEMPT_HARDIRQS is
 enabled. "hda: lost interrupt" and/or "ata1: command 0x50 host_stat
 0x4" show up. Other devices such as network, keyboard etc. seem to work
 fine. I've looked into this for a couple of weeks in vain. 

-- owa
Software Engineering Center, TOSHIBA.

^ permalink raw reply

* [RFC PATCH 4/4] powerpc 2.6.16-rt29: to fix network driver (workaround)
From: Tsutomu OWA @ 2006-08-11  2:04 UTC (permalink / raw)
  To: linux-kernel; +Cc: linuxppc-dev, mingo, tglx


  To make network driver available for rt29 (actually rt21 and later).
When doing "ping -f", the network driver seems to hang without this 
workaround for rt version 29.

-- owa
# I suppose this should be fixed in other way in future but for now...

--- rt29/kernel/irq/manage.c	2006-07-10 09:01:21.000000000 +0900
+++ rt-powerpc/kernel/irq/manage.c	2006-07-21 20:17:50.000000000 +0900
@@ -723,15 +723,24 @@ static int do_irqd(void * __desc)
 		set_current_state(TASK_INTERRUPTIBLE);
 		do_hardirq(desc);
 		cond_resched_all();
+#ifndef CONFIG_PPC_PMAC64 /* work around: to revert to patch-2.6.16-rt20 version */
 		local_irq_disable();
+#endif /* !CONFIG_PPC_PMAC64 */
 		__do_softirq();
 		local_irq_enable();
 #ifdef CONFIG_SMP
 		/*
 		 * Did IRQ affinities change?
 		 */
+#ifdef CONFIG_PPC_PMAC64 /* work around; revert to patch-2.6.16-rt20 version */
+		if (!cpu_isset(smp_processor_id(), irq_affinity[irq])) {
+			mask = cpumask_of_cpu(any_online_cpu(irq_affinity[irq]));
+			set_cpus_allowed(current, mask);
+		}
+#else
 		if (!cpus_equal(current->cpus_allowed, irq_affinity[irq]))
 			set_cpus_allowed(current, irq_affinity[irq]);
+#endif /* CONFIG_PPC_PMAC64 */
 #endif
 		schedule();
 	}

^ permalink raw reply

* [RFC PATCH 2/4] powerpc 2.6.16-rt17: to boot on powerpc w/ RT
From: Tsutomu OWA @ 2006-08-11  2:02 UTC (permalink / raw)
  To: linux-kernel; +Cc: linuxppc-dev, mingo, tglx


  To boot on powermac and cell.

---
with PREEMPT_RT
BUG: using smp_processor_id() in preemptible [00000000] code: init/1
caller is .hpte_update+0x4c/0x250
Call Trace:
[C000000001467850] [C00000000000F250] .show_stack+0x68/0x1b4
(unreliable)
[C000000001467900] [C00000000014C4A4] .debug_smp_processor_id+0xc4/0xf4
[C000000001467990] [C00000000002BEC0] .hpte_update+0x4c/0x250
[C000000001467A40] [C00000000008C670] .do_wp_page+0x474/0x618
[C000000001467B10] [C00000000008DC30] .__handle_mm_fault+0xd50/0xe68
[C000000001467C20] [C000000000029EFC] .do_page_fault+0x48c/0x674
[C000000001467E30] [C000000000004760] .handle_page_fault+0x20/0x54

o to enable drivers.
  powermac/low_i2c.c:
    struct semaphore -> struct compat_semaphore
    spinlock_t -> raw_spinlock_t
  drivers/net/sungem.c: transmit_tx_frame(). try_spinlock_irqsave()
  make spinlock_t to raw_spinlock_t for mpic and native_tlbie_lock.
  make struct semaphore to struct compat_semaphore for kw2_i2c.

* to boot on cell
  o port systemsim bogus disk and console.  (not included in this patch)
with PREEMPT_RT
BUG: swapper:0 task might have lost a preemption check!
Call Trace:
[C0000000002FFC40] [C00000000000F250] .show_stack+0x68/0x1b4
(unreliable)
[C0000000002FFCF0] [C0000000000425F8]
.preempt_enable_no_resched+0x68/0x80
[C0000000002FFD70] [C000000000032EC0] .cbe_idle+0x168/0x184
[C0000000002FFE00] [C000000000018DD0] .cpu_idle+0x4c/0x60
[C0000000002FFE70] [C000000000009290] .rest_init+0x60/0x78
[C0000000002FFEF0] [C0000000002CE890] .start_kernel+0x310/0x330
[C0000000002FFF90] [C000000000008574] .start_here_common+0x88/0x114

--
BUG: using smp_processor_id() in preemptible [00000000] code: init/1
caller is .hpte_update+0x4c/0x250
Call Trace:
[C000000001467850] [C00000000000F250] .show_stack+0x68/0x1b4
(unreliable)
[C000000001467900] [C00000000014C4A4] .debug_smp_processor_id+0xc4/0xf4
[C000000001467990] [C00000000002BEC0] .hpte_update+0x4c/0x250
[C000000001467A40] [C00000000008C670] .do_wp_page+0x474/0x618
[C000000001467B10] [C00000000008DC30] .__handle_mm_fault+0xd50/0xe68
[C000000001467C20] [C000000000029EFC] .do_page_fault+0x48c/0x674
[C000000001467E30] [C000000000004760] .handle_page_fault+0x20/0x54
-- owa

diff -rup -x CVS 2.6.16-rt17/arch/powerpc/mm/hash_native_64.c rt-powerpc/arch/powerpc/mm/hash_native_64.c
--- 2.6.16-rt17/arch/powerpc/mm/hash_native_64.c	2006-03-20 14:53:29.000000000 +0900
+++ rt-powerpc/arch/powerpc/mm/hash_native_64.c	2006-07-12 14:38:24.000000000 +0900
@@ -35,7 +35,10 @@
 
 #define HPTE_LOCK_BIT 3
 
-static DEFINE_SPINLOCK(native_tlbie_lock);
+/*
+ * to avoid "BUG: scheduling while atomic at native_flush_hash_range.
+ */
+static DEFINE_RAW_SPINLOCK(native_tlbie_lock);
 
 static inline void __tlbie(unsigned long va, unsigned int psize)
 {
diff -rup -x CVS 2.6.16-rt17/arch/powerpc/mm/tlb_64.c rt-powerpc/arch/powerpc/mm/tlb_64.c
--- 2.6.16-rt17/arch/powerpc/mm/tlb_64.c	2006-04-26 18:24:28.000000000 +0900
+++ rt-powerpc/arch/powerpc/mm/tlb_64.c	2006-07-12 13:47:32.000000000 +0900
@@ -95,9 +95,15 @@ static void pte_free_submit(struct pte_f
 
 void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf)
 {
+#ifndef CONFIG_PREEMPT_RT
 	/* This is safe since tlb_gather_mmu has disabled preemption */
         cpumask_t local_cpumask = cpumask_of_cpu(smp_processor_id());
 	struct pte_freelist_batch **batchp = &__get_cpu_var(pte_freelist_cur);
+#else
+        cpumask_t local_cpumask = cpumask_of_cpu(raw_smp_processor_id());
+	struct pte_freelist_batch **batchp = &get_cpu_var(pte_freelist_cur);
+	put_cpu_var(pte_freelist_cur);
+#endif /* !CONFIG_PREEMPT_RT */
 
 	if (atomic_read(&tlb->mm->mm_users) < 2 ||
 	    cpus_equal(tlb->mm->cpu_vm_mask, local_cpumask)) {
diff -rup -x CVS 2.6.16-rt17/arch/powerpc/platforms/cell/pervasive.c rt-powerpc/arch/powerpc/platforms/cell/pervasive.c
--- 2.6.16-rt17/arch/powerpc/platforms/cell/pervasive.c	2006-03-20 14:53:29.000000000 +0900
+++ rt-powerpc/arch/powerpc/platforms/cell/pervasive.c	2006-07-12 13:48:09.000000000 +0900
@@ -136,8 +136,8 @@ static void cbe_idle(void)
 		 */
 		ppc64_runlatch_on();
 
-		preempt_enable_no_resched();
-		schedule();
+		__preempt_enable_no_resched();
+		__schedule();
 		preempt_disable();
 	}
 }
diff -rup -x CVS 2.6.16-rt17/arch/powerpc/platforms/powermac/low_i2c.c rt-powerpc/arch/powerpc/platforms/powermac/low_i2c.c
--- 2.6.16-rt17/arch/powerpc/platforms/powermac/low_i2c.c	2006-03-20 14:53:29.000000000 +0900
+++ rt-powerpc/arch/powerpc/platforms/powermac/low_i2c.c	2006-07-12 13:49:09.000000000 +0900
@@ -85,7 +85,7 @@ struct pmac_i2c_bus
 	void			*hostdata;
 	int			channel;	/* some hosts have multiple */
 	int			mode;		/* current mode */
-	struct semaphore	sem;
+	struct compat_semaphore	sem;
 	int			opened;
 	int			polled;		/* open mode */
 	struct platform_device	*platform_dev;
@@ -105,7 +105,7 @@ static LIST_HEAD(pmac_i2c_busses);
 
 struct pmac_i2c_host_kw
 {
-	struct semaphore	mutex;		/* Access mutex for use by
+	struct compat_semaphore	mutex;		/* Access mutex for use by
 						 * i2c-keywest */
 	void __iomem		*base;		/* register base address */
 	int			bsteps;		/* register stepping */
@@ -119,6 +119,9 @@ struct pmac_i2c_host_kw
 	int			result;
 	struct completion	complete;
 	spinlock_t		lock;
+		/* "BUG: scheduling while at atomic" at del_timer() called
+		 * from kw_i2c_irq() if raw_spinlock_t.
+		 */
 	struct timer_list	timeout_timer;
 };
 
diff -rup -x CVS 2.6.16-rt17/arch/powerpc/sysdev/mpic.c rt-powerpc/arch/powerpc/sysdev/mpic.c
--- 2.6.16-rt17/arch/powerpc/sysdev/mpic.c	2006-03-20 14:53:29.000000000 +0900
+++ rt-powerpc/arch/powerpc/sysdev/mpic.c	2006-07-11 16:19:06.000000000 +0900
@@ -45,7 +45,7 @@
 
 static struct mpic *mpics;
 static struct mpic *mpic_primary;
-static DEFINE_SPINLOCK(mpic_lock);
+static DEFINE_RAW_SPINLOCK(mpic_lock);
 
 #ifdef CONFIG_PPC32	/* XXX for now */
 #ifdef CONFIG_IRQ_ALL_CPUS
@@ -1009,13 +1009,13 @@ void mpic_request_ipis(void)
 	printk("requesting IPIs ... \n");
 
 	/* IPIs are marked SA_INTERRUPT as they must run with irqs disabled */
-	request_irq(mpic->ipi_offset+0, mpic_ipi_action, SA_INTERRUPT,
+	request_irq(mpic->ipi_offset+0, mpic_ipi_action, SA_INTERRUPT | SA_NODELAY,
 		    "IPI0 (call function)", mpic);
-	request_irq(mpic->ipi_offset+1, mpic_ipi_action, SA_INTERRUPT,
+	request_irq(mpic->ipi_offset+1, mpic_ipi_action, SA_INTERRUPT | SA_NODELAY,
 		   "IPI1 (reschedule)", mpic);
-	request_irq(mpic->ipi_offset+2, mpic_ipi_action, SA_INTERRUPT,
+	request_irq(mpic->ipi_offset+2, mpic_ipi_action, SA_INTERRUPT | SA_NODELAY,
 		   "IPI2 (unused)", mpic);
-	request_irq(mpic->ipi_offset+3, mpic_ipi_action, SA_INTERRUPT,
+	request_irq(mpic->ipi_offset+3, mpic_ipi_action, SA_INTERRUPT | SA_NODELAY,
 		   "IPI3 (debugger break)", mpic);
 
 	printk("IPIs requested... \n");
diff -rup -x CVS 2.6.16-rt17/drivers/ide/ide-io.c rt-powerpc/drivers/ide/ide-io.c
--- 2.6.16-rt17/drivers/ide/ide-io.c	2006-04-26 18:24:28.000000000 +0900
+++ rt-powerpc/drivers/ide/ide-io.c	2006-07-12 13:50:47.000000000 +0900
@@ -1560,8 +1560,10 @@ irqreturn_t ide_intr (int irq, void *dev
 	del_timer(&hwgroup->timer);
 	spin_unlock(&ide_lock);
 
+#if !defined(CONFIG_PREEMPT_HARDIRQS) || !defined(CONFIG_PPC_PMAC64)
 	if (drive->unmask)
 		local_irq_enable_nort();
+#endif /* !(CONFIG_PREEMPT_HARDIRQS && CONFIG_PPC_PMAC64) */
 	/* service this interrupt, may set handler for next interrupt */
 	startstop = handler(drive);
 	spin_lock_irq(&ide_lock);
diff -rup -x CVS 2.6.16-rt17/drivers/ide/ide-probe.c rt-powerpc/drivers/ide/ide-probe.c
--- 2.6.16-rt17/drivers/ide/ide-probe.c	2006-04-26 18:24:28.000000000 +0900
+++ rt-powerpc/drivers/ide/ide-probe.c	2006-07-12 14:07:23.000000000 +0900
@@ -51,6 +51,7 @@
 #include <linux/spinlock.h>
 #include <linux/kmod.h>
 #include <linux/pci.h>
+#include <linux/irq.h>
 
 #include <asm/byteorder.h>
 #include <asm/irq.h>
@@ -1088,6 +1089,10 @@ static int init_irq (ide_hwif_t *hwif)
 		sa = SA_SHIRQ;
 #endif /* __mc68000__ || CONFIG_APUS */
 
+#if defined(CONFIG_PREEMPT_HARDIRQS) && defined(CONFIG_PPC_PMAC64)
+		sa |= SA_NODELAY | SA_INTERRUPT;
+#endif /* (CONFIG_PREEMPT_HARDIRQS && CONFIG_PPC_PMAC64) */
+
 		if (IDE_CHIPSET_IS_PCI(hwif->chipset)) {
 			sa = SA_SHIRQ;
 #ifndef CONFIG_IDEPCI_SHARE_IRQ
diff -rup -x CVS 2.6.16-rt17/drivers/net/sungem.c rt-powerpc/drivers/net/sungem.c
--- 2.6.16-rt17/drivers/net/sungem.c	2006-03-20 14:53:29.000000000 +0900
+++ rt-powerpc/drivers/net/sungem.c	2006-07-11 17:07:43.000000000 +0900
@@ -1036,10 +1036,8 @@ static int gem_start_xmit(struct sk_buff
 			(csum_stuff_off << 21));
 	}
 
-	local_irq_save(flags);
-	if (!spin_trylock(&gp->tx_lock)) {
+	if (!spin_trylock_irqsave(&gp->tx_lock, flags)) {
 		/* Tell upper layer to requeue */
-		local_irq_restore(flags);
 		return NETDEV_TX_LOCKED;
 	}
 	/* We raced with gem_do_stop() */
diff -rup -x CVS 2.6.16-rt17/include/asm-powerpc/mpic.h rt-powerpc/include/asm-powerpc/mpic.h
--- 2.6.16-rt17/include/asm-powerpc/mpic.h	2006-03-20 14:53:29.000000000 +0900
+++ rt-powerpc/include/asm-powerpc/mpic.h	2006-05-19 20:48:49.000000000 +0900
@@ -160,7 +160,7 @@ struct mpic
 #ifdef CONFIG_MPIC_BROKEN_U3
 	/* The fixup table */
 	struct mpic_irq_fixup	*fixups;
-	spinlock_t		fixup_lock;
+	raw_spinlock_t		fixup_lock;
 #endif
 
 	/* The various ioremap'ed bases */
diff -rup -x CVS 2.6.16-rt17/kernel/latency.c rt-powerpc/kernel/latency.c
--- 2.6.16-rt17/kernel/latency.c	2006-04-26 18:24:29.000000000 +0900
+++ rt-powerpc/kernel/latency.c	2006-07-12 13:57:31.000000000 +0900
@@ -1787,7 +1787,12 @@ void notrace add_preempt_count(unsigned 
 #endif
 
 	preempt_count() += val;
+
 #ifdef CONFIG_PREEMPT_TRACE
+#if 1 /* FIXME: somehow current is NULL. why? */
+	if (!current) 
+		return;
+#endif
 	

^ permalink raw reply

* [RFC PATCH 1/4] powerpc 2.6.16-rt17: to build on powerpc w/ RT
From: Tsutomu OWA @ 2006-08-11  2:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: linuxppc-dev, mingo, tglx


To fix following compile errors for powermac and cell.

--- 
with PREEMPT_NONE
o arch/powerpc/kernel/head_64.S
  include/asm-generic/bug.h: Assembler messages:
  include/asm-generic/bug.h:19: Error: Unrecognized opcode: `extern'

o missing percpu related macros
  arch/powerpc/mm/mem.c
  In file included from include/asm/tlb.h:53,
                 from arch/powerpc/mm/mem.c:45:
  include/asm-generic/tlb.h:50: error: parse error before "mmu_gathers"
  include/asm-generic/tlb.h:50: warning: type defaults to `int' in
  declaration of `DECLARE_PER_CPU_LOCKED'
  etc.

o kernel/time/clockevents.c:82: error: conflicting types for
 'timer_interrupt'
  include/asm/hw_irq.h:14: error: previous declaration of
  'timer_interrupt' was here
  kernel/time/clockevents.c:82: error: conflicting types for
  'timer_interrupt'
  include/asm/hw_irq.h:14: error: previous declaration of
  'timer_interrupt' was here

o kernel/built-in.o: In function `do_gettimeofday':
    : multiple definition of `do_gettimeofday'
  arch/powerpc/kernel/built-in.o:: first defined here
  kernel/built-in.o: In function `.do_gettimeofday':
    : multiple definition of `.do_gettimeofday'
  arch/powerpc/kernel/built-in.o:: first defined here
  /usr/local/sti/SDK0.29/bin/pu64-ld: Warning: size of symbol
  `.do_gettimeofday' changed from 120 in arch/powerpc/kernel/built-in.o
    to 372 in kernel/built-in.o
  arch/powerpc/kernel/built-in.o: In function `.do_gettimeofday':

o arch/powerpc/kernel/built-in.o: In function `.do_gettimeofday':
  : undefined reference to `.SCALE_XSEC'

with PREEMPT_RT

o arch/powerpc/platforms/powermac/.tmp_feature.o
  arch/powerpc/platforms/powermac/feature.c
  arch/powerpc/platforms/powermac/feature.c:65: error: conflicting types
  for 'feature_lock'
  include/asm/pmac_feature.h:381: error: previous declaration of
    'feature_lock' was here
  arch/powerpc/platforms/powermac/feature.c:65: error: conflicting types
    for 'feature_lock'
  include/asm/pmac_feature.h:381: error: previous declaration of
    'feature_lock' was here

diff -rup -x CVS 2.6.16-rt17/arch/powerpc/kernel/time.c rt-powerpc/arch/powerpc/kernel/time.c
--- 2.6.16-rt17/arch/powerpc/kernel/time.c	2006-04-26 18:24:28.000000000 +0900
+++ rt-powerpc/arch/powerpc/kernel/time.c	2006-07-12 13:45:31.000000000 +0900
@@ -200,6 +200,7 @@ void udelay(unsigned long usecs)
 }
 EXPORT_SYMBOL(udelay);
 
+#ifndef CONFIG_GENERIC_TIME
 /*
  * This version of gettimeofday has microsecond resolution.
  */
@@ -223,6 +224,7 @@ static inline void __do_gettimeofday(str
 	xsec = temp_stamp_xsec + mulhdu(tb_ticks, temp_tb_to_xs);
 	sec = xsec / XSEC_PER_SEC;
 	usec = (unsigned long)xsec & (XSEC_PER_SEC - 1);
+#define SCALE_XSEC(xsec, max)  (((xsec) * max) / XSEC_PER_SEC)
 	usec = SCALE_XSEC(usec, 1000000);
 
 	tv->tv_sec = sec;
@@ -254,6 +256,7 @@ void do_gettimeofday(struct timeval *tv)
 }
 
 EXPORT_SYMBOL(do_gettimeofday);
+#endif /* !CONFIG_GENERIC_TIME */
 
 /*
  * There are two copies of tb_to_xs and stamp_xsec so that no
diff -rup -x CVS 2.6.16-rt17/include/asm-generic/bug.h rt-powerpc/include/asm-generic/bug.h
--- 2.6.16-rt17/include/asm-generic/bug.h	2006-04-26 18:24:28.000000000 +0900
+++ rt-powerpc/include/asm-generic/bug.h	2006-06-08 17:18:06.000000000 +0900
@@ -16,7 +16,9 @@
 #define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
 #endif
 
+#ifndef __ASSEMBLY__
 extern void __WARN_ON(const char *func, const char *file, const int line);
+#endif /* __ASSEMBLY__ */
 
 #ifndef HAVE_ARCH_WARN_ON
 #define WARN_ON(condition) do { \
diff -rup -x CVS 2.6.16-rt17/include/asm-powerpc/hardirq.h rt-powerpc/include/asm-powerpc/hardirq.h
--- 2.6.16-rt17/include/asm-powerpc/hardirq.h	2006-03-20 14:53:29.000000000 +0900
+++ rt-powerpc/include/asm-powerpc/hardirq.h	2006-06-08 17:18:42.000000000 +0900
@@ -11,7 +11,7 @@
  * for uniformity.
  */
 typedef struct {
-	unsigned int __softirq_pending;	/* set_bit is used on this */
+	unsigned int __softirq_pending;	/* set_bit is not used on this */
 	unsigned int __last_jiffy_stamp;
 } ____cacheline_aligned irq_cpustat_t;
 
diff -rup -x CVS 2.6.16-rt17/include/asm-powerpc/hw_irq.h rt-powerpc/include/asm-powerpc/hw_irq.h
--- 2.6.16-rt17/include/asm-powerpc/hw_irq.h	2006-04-26 18:24:28.000000000 +0900
+++ rt-powerpc/include/asm-powerpc/hw_irq.h	2006-07-12 13:55:15.000000000 +0900
@@ -11,7 +11,11 @@
 #include <asm/ptrace.h>
 #include <asm/processor.h>
 
-extern void timer_interrupt(struct pt_regs *);
+/*
+ * this conflicts w/ the declaration of 'timer_interrupt' in
+ * kernel/time/clockevents.c
+ */
+/* extern void timer_interrupt(struct pt_regs *); */
 
 #ifdef CONFIG_PPC_ISERIES
 
diff -rup -x CVS 2.6.16-rt17/include/asm-powerpc/percpu.h rt-powerpc/include/asm-powerpc/percpu.h
--- 2.6.16-rt17/include/asm-powerpc/percpu.h	2006-03-20 14:53:29.000000000 +0900
+++ rt-powerpc/include/asm-powerpc/percpu.h	2006-06-08 21:03:28.000000000 +0900
@@ -18,11 +18,23 @@
 /* Separate out the type, so (int[3], foo) works. */
 #define DEFINE_PER_CPU(type, name) \
     __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name
+#define DEFINE_PER_CPU_LOCKED(type, name) \
+    __attribute__((__section__(".data.percpu"))) spinlock_t per_cpu_lock__##name##_locked = SPIN_LOCK_UNLOCKED; \
+    __attribute__((__section__(".data.percpu"))) __typeof__(type) per_cpu__##name##_locked
 
 /* var is in discarded region: offset to particular copy we want */
 #define per_cpu(var, cpu) (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset(cpu)))
 #define __get_cpu_var(var) (*RELOC_HIDE(&per_cpu__##var, __my_cpu_offset()))
 
+#define per_cpu_lock(var, cpu) \
+        (*RELOC_HIDE(&per_cpu_lock__##var##_locked, __per_cpu_offset(cpu)))
+#define per_cpu_var_locked(var, cpu) \
+	(*RELOC_HIDE(&per_cpu__##var##_locked, __per_cpu_offset(cpu)))
+#define __get_cpu_lock(var, cpu) \
+	per_cpu_lock(var, cpu)
+#define __get_cpu_var_locked(var, cpu) \
+	per_cpu_var_locked(var, cpu)
+
 /* A macro to avoid #include hell... */
 #define percpu_modcopy(pcpudst, src, size)			\
 do {								\
@@ -39,16 +51,27 @@ extern void setup_per_cpu_areas(void);
 
 #define DEFINE_PER_CPU(type, name) \
     __typeof__(type) per_cpu__##name
+#define DEFINE_PER_CPU_LOCKED(type, name) \
+    spinlock_t per_cpu_lock__##name##_locked = SPIN_LOCK_UNLOCKED; \
+    __typeof__(type) per_cpu__##name##_locked
 
 #define per_cpu(var, cpu)			(*((void)(cpu), &per_cpu__##var))
+#define per_cpu_var_locked(var, cpu)                   (*((void)(cpu), &per_cpu__##var##_locked))
 #define __get_cpu_var(var)			per_cpu__##var
+#define __get_cpu_lock(var, cpu)                per_cpu_lock__##var##_locked
+#define __get_cpu_var_locked(var, cpu)          per_cpu__##var##_locked
 
 #endif	/* SMP */
 
 #define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
+#define DECLARE_PER_CPU_LOCKED(type, name) \
+    extern spinlock_t per_cpu_lock__##name##_locked; \
+    extern __typeof__(type) per_cpu__##name##_locked
 
 #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
 #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
+#define EXPORT_PER_CPU_LOCKED_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu_lock__##var##_locked); EXPORT_SYMBOL_GPL(per_cpu__##var##_locked)
+
 
 #else
 #include <asm-generic/percpu.h>
diff -rup -x CVS 2.6.16-rt17/include/asm-powerpc/pmac_feature.h rt-powerpc/include/asm-powerpc/pmac_feature.h
--- 2.6.16-rt17/include/asm-powerpc/pmac_feature.h      2006-03-20 14:53:29.000000000 +0900
+++ rt-powerpc/include/asm-powerpc/pmac_feature.h       2006-05-10 13:52:58.000000000 +0900
@@ -378,7 +378,7 @@ extern struct macio_chip* macio_find(str
  * Those are exported by pmac feature for internal use by arch code
  * only like the platform function callbacks, do not use directly in drivers
  */
-extern spinlock_t feature_lock;
+extern raw_spinlock_t feature_lock;
 extern struct device_node *uninorth_node;
 extern u32 __iomem *uninorth_base;

diff -rup -x CVS 2.6.16-rt17/kernel/time/clockevents.c rt-powerpc/kernel/time/clockevents.c
--- 2.6.16-rt17/kernel/time/clockevents.c	2006-04-26 18:24:29.000000000 +0900
+++ rt-powerpc/kernel/time/clockevents.c	2006-07-12 13:58:28.000000000 +0900
@@ -29,6 +29,8 @@
 #include <linux/percpu.h>
 #include <linux/sysdev.h>
 #include <linux/hrtimer.h>
+#include <linux/irq.h>
+#include <linux/profile.h>
 
 #define MAX_CLOCK_EVENTS	4

^ permalink raw reply

* RE: PCI driver on EB8347
From: Liu Dave-r63238 @ 2006-08-11  3:40 UTC (permalink / raw)
  To: rajan rai, Gala Kumar K.-galak; +Cc: linuxppc-embedded
In-Reply-To: <4DA89577C33E194ABEBC978921E858541B8E38@exchange.ingenient.net>


Rajan>        I have written PCI driver which works fine along with
MPC8347 and two PCI
Rajan> card connected in a single PCI bus. When I try to communicate
same PCI card
Rajan> using PCI bridge ( PCI2050B ), Linux does detect PCI card on
Secondary bus=20
Rajan> but same driver doesn't work !!!!

PCI interrupt for secondary bus set up properly?
     =20
Rajan>        Do I need to enable support for second PCI host controller
at kernel level to=20
Rajan>make it work? Or I need to do something else ? I tried compiling
PPC-linux kernel
Rajan> after enabling CONFIG_85xx_PCI2 kernel doesn't compile it gives
me error while=20
Rajan>compiling "arch/ppc/syslib/ppc83xx_setup.c" Kernel version I'm
using is 2.6.13.

Why you enable CONFIG_85xx_PCI2 in kernel? It is for 85xx, but you are
using 8347 processor.

<snip>

Dave

^ permalink raw reply

* [RFC PATCH 3/4] powerpc 2.6.16-rt17: to support CONFIG_MCOUNT
From: Tsutomu OWA @ 2006-08-11  2:17 UTC (permalink / raw)
  To: linux-kernel; +Cc: linuxppc-dev, mingo, tglx
In-Reply-To: <yyilkpwhvwh.wl@forest.swc.toshiba.co.jp>


Please read the previous mail's subject as [RFC PATCH 3/4] powerpc 2.6.16-rt17: to support CONFIG_MCOUNT.

Sorry about that.

thanks.
-- owa
Software Engineering Center, TOSHIBA.

^ permalink raw reply

* Realtime preemption patch on PPC
From: Ben Weintraub @ 2006-08-11  0:55 UTC (permalink / raw)
  To: linuxppc-dev

(Sorry for those of you who see this message twice, it was originally  
posted in the linuxppc-embedded list, but Mark Greer suggested  
posting it here too)

Howdy,

I'm wondering if anyone has had success getting Ingo Molnar's realtime
preemption patch (the one here:
http://people.redhat.com/mingo/realtime-preempt/ ) working on the ppc
arch.

I'm working with patch-2.6.17-rt8 (the latest) and linux-2.6.17.  The
realtime-preempt patch seems to include the generic timeofday patch, but
with no support for the ppc arch, only powerpc, so I've hacked in
support for ppc by basically replicating the powerpc arch-specific stuff
found here:
http://sr71.net/~jstultz/tod/archive/linux-2.6.17-rc3_timekeeping_C2/ 
broken-out/linux-2.6.17-rc3_timeofday-arch-ppc_C2.patch

I can attach my patch if anyone would like, but for all I know it could
be wildly inaccurate.

Anyhow, when I boot on an MPC8555 with my hack, I get an endless stream
of:

BUG: sleeping function called from invalid context init(1) at
arch/powerpc/math-emu/math.c:226
in_atomic():0 [00000000], irqs_disabled():1
Call Trace:
[A0BB3E90] [A000934C] show_stack+0x48/0x194 (unreliable)
[A0BB3EC0] [A001B7DC] __might_sleep+0xe8/0xf4
[A0BB3EE0] [A00136C0] do_mathemu+0x30/0x8c8
[A0BB3F00] [A00036AC] program_check_exception+0x1ac/0x514
[A0BB3F40] [A0002A08] ret_from_except_full+0x0/0x4c

Line 226 in arch/powerpc/math-emu/math.c is part of the do_mathemu()
function, and contains a call to get_user(), which calls
__might_sleep(), causing this problem.

I did find this message in the LKML archives describing a very similar
problem:
http://lkml.org/lkml/2006/2/23/312

And so tried putting a call to local_irq_enable() before the call to
do_mathemu() in program_check_excpetion(), but this causes a hard lockup
with no messages printed when I try to bring up my network interface.  I
assume this means I've done something Very Bad with interrupts by adding
in local_irq_enable() at the wrong spot.  I also tried adding it at the
exact same spot as the patch given by Paul in his reply, but in this
case I still get the endless stream of BUG messages.

Can anyone offer some guidance or advice?

Thanks so much,
Ben

^ permalink raw reply

* Re: Realtime preemption patch on PPC
From: Lee Revell @ 2006-08-11  1:38 UTC (permalink / raw)
  To: Ben Weintraub; +Cc: linuxppc-embedded
In-Reply-To: <1155251072.5950.80.camel@localhost>

On Thu, 2006-08-10 at 16:04 -0700, Ben Weintraub wrote:
> Howdy,
> 
> I'm wondering if anyone has had success getting Ingo Molnar's realtime
> preemption patch (the one here:
> http://people.redhat.com/mingo/realtime-preempt/ ) working on the ppc
> arch.  
> 

This is probably a better question for the -rt people and LKML than this
list.

Lee

^ permalink raw reply

* PCI driver on EB8347
From: rajan rai @ 2006-08-11  0:49 UTC (permalink / raw)
  To: kumar.gala; +Cc: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 2322 bytes --]



        I have written PCI driver which works fine along with MPC8347 and two PCI card connected in a single PCI bus. When I try to communicate same PCI card using PCI bridge ( PCI2050B ), Linux does detect PCI card on Secondary bus but same driver doesn't work !!!!
       
                 Do I need to enable support for second PCI host controller at kernel level to make it work? Or I need to do something else ? I tried compiling PPC-linux kernel after enabling CONFIG_85xx_PCI2 kernel doesn't compile it gives me error while compiling "arch/ppc/syslib/ppc83xx_setup.c" Kernel version I'm using is 2.6.13.


****** Board along with which PCI card works ************
lspci -v
/demo # lspci -v
00:1b.0 Non-VGA unclassified device: Texas Instruments: Unknown device 9065 (rev 01)
        Flags: bus master, medium devsel, latency 128, IRQ 21
        Memory at 9fc00000 (32-bit, prefetchable) [size=4M]
        Memory at 9f000000 (32-bit, non-prefetchable) [size=8M]
        I/O ports at 3ffffff0 [size=16]
        Capabilities: [40] Power Management version 2

00:1c.0 Non-VGA unclassified device: Texas Instruments: Unknown device 9065 (rev 01)
        Flags: bus master, medium devsel, latency 128, IRQ 18
        Memory at 9ec00000 (32-bit, prefetchable) [size=4M]
        Memory at 9e000000 (32-bit, non-prefetchable) [size=8M]
        I/O ports at 3fffffe0 [size=16]
        Capabilities: [40] Power Management version 2


****** Board along with which PCI card doesn't work ************
lspci -v
PCI devices found:
  Bus  0, device  17, function  0:
    Class 0604: PCI device 104c:ac28 (rev 2).
  Bus  1, device   1, function  0:
    Class 0000: PCI device 104c:9065 (rev 1).
      Master Capable.  Latency=128.
      Prefetchable 32 bit memory at 0x9fc00000 [0x9fffffff].
      Non-prefetchable 32 bit memory at 0x9f000000 [0x9f7fffff].
      I/O at 0xfff0 [0xffff].
  Bus  1, device   2, function  0:
    Class 0000: PCI device 104c:9065 (rev 1).
      Master Capable.  Latency=128.
      Prefetchable 32 bit memory at 0x9ec00000 [0x9effffff].
      Non-prefetchable 32 bit memory at 0x9e000000 [0x9e7fffff].
      I/O at 0xffe0 [0xffef].

                     Any help would be appreciated I'm running out of ideas what to do next !!!!!!!!

Regards,
-Rajan Rai

[-- Attachment #2: Type: text/html, Size: 3795 bytes --]

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox