LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] powerpc: oprofile support for POWER6
From: Sonny Rao @ 2006-06-09 19:03 UTC (permalink / raw)
  To: Michael Neuling; +Cc: linuxppc-dev, paulus
In-Reply-To: <20060608042915.C568867B1A@ozlabs.org>

On Thu, Jun 08, 2006 at 02:29:01PM +1000, Michael Neuling wrote:
> > >  	/*
> > > -	 * SIHV / SIPR bits are only implemented on POWER4+ (GQ) and above.
> > > -	 * However we disable it on all POWER4 until we verify it works
> > > -	 * (I was seeing some strange behaviour last time I tried).
> > > -	 *
> > > -	 * It has been verified to work on POWER5 so we enable it there.
> > > -	 */
> > 
> > The patched code doesn't handle GQ at all.  Is this on purpose?  Add a
> > similar comment to the CPU feature tables perhaps?
> 
> Yeah, those bits are bust on POWER4+.  We didn't touch them previously
> and we still don't with this patch.
> 
> You're right, we should keep that comment. I'll update and retransmit.

I'm pretty sure SIHV is busted on GQ for sure

Sonny

^ permalink raw reply

* Re: help with inittab
From: Chris Dumoulin @ 2006-06-09 19:14 UTC (permalink / raw)
  To: Steve Iribarne (GMail); +Cc: linuxppc-embedded
In-Reply-To: <b4b98b690606091123q6a31a9d2xf7219de14b94003a@mail.gmail.com>

The init is from Busybox. Since I'm getting output from my serial port 
during the kernel boot process, I think it's safe to say that my 
/dev/ttyS0 is properly configured. Besides passing the kernel argument 
console=ttyS0,57600, is there anything else I need to do to properly 
configure the console? I've looked through my kernel configuration to 
make sure that any serial device or console related stuff was enabled 
and configured.

I'm feeling pretty stumped.

- Chris

Steve Iribarne (GMail) wrote:

> On 6/9/06, Chris Dumoulin <cdumoulin@ics-ltd.com> wrote:
>
>> I've now determined that my kernel seems to stop in the following line
>> of code, in the function init(void * unused), in init/main.c:
>> run_init_process("/sbin/init");
>
>
> Who's init are  you using??
>
> Are you using Busyboxes or sysinit from GNU?
>
>
>> I've determined that it stops at this call by stepping through the code
>> with a BDI2000.
>>
>> My boot arguments are:
>> console=ttyS0,57600n8 ip=off root=/dev/ram0 rw
>>
>> My current inittab is:
>> ::sysinit:/etc/rc.sh
>> ::ctrlaltdel:/sbin/reboot
>> ::shutdown:/sbin/swapoff -a
>> ::shutdown:/bin/umount -a -r
>> ::restart:/sbin/init
>> ::respawn:/bin/sh
>>
>> I've tried adding an "echo" command to the /etc/rc.sh script that is
>> called, but I don't see any output. I've also trying changing the
>> ::sysinit line in inittab to point to some non-existent script, to see
>> if I'll get some error message, but I still see nothing. Is it possible
>> that /sbin/init is dying before it gets to the point of reading inittab?
>> Any ideas?
>>
>> Regards,
>> Chris Dumoulin
>>
>>
>> Wolfgang Denk wrote:
>>
>> >In message <44888B92.40409@ics-ltd.com> you wrote:
>> >
>> >
>> >>I am using the linux kernel 2.6.15 and initrd ramdisk image from ELDK
>> >>4.0. Currently, I seem to be able to boot without errors, but after 
>> the
>> >>root filesystem is mounted, things just stop.
>> >>
>> >>
>> >
>> >And  what's  your  console  device?  Are  you  passing  any  console=
>> >arguments  on  the  command  line?  Is the corresponding device entry
>> >present in the /dev/directory?
>> >
>> >Best regards,
>> >
>> >Wolfgang Denk
>> >
>> >
>> >
>>
>> -- 
>> *--Christopher Dumoulin--*
>> Software Team Leader
>>
>> <http://ics-ltd.com/>
>> <http://ics-ltd.com/>
>>
>> Interactive Circuits and Systems Ltd.
>> 5430 Canotek Road
>> Ottawa, ON
>> K1J 9G2
>> (613)749-9241
>> 1-800-267-9794 (USA only)
>>
>> ------------------------------------------------------------------------
>> This e-mail is private and confidential and is for the addressee only.
>> If misdirected, please notify us by telephone and confirm that it has
>> been deleted from your system and any hard copies destroyed. You are
>> strictly prohibited from using, printing, distributing or disseminating
>> it or any information contained in it save to the intended recipient.
>> _______________________________________________
>> Linuxppc-embedded mailing list
>> Linuxppc-embedded@ozlabs.org
>> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>>
>


-- 
*--Christopher Dumoulin--*
Software Team Leader

<http://ics-ltd.com/>
<http://ics-ltd.com/>

Interactive Circuits and Systems Ltd.
5430 Canotek Road
Ottawa, ON
K1J 9G2
(613)749-9241
1-800-267-9794 (USA only)

------------------------------------------------------------------------
This e-mail is private and confidential and is for the addressee only. 
If misdirected, please notify us by telephone and confirm that it has 
been deleted from your system and any hard copies destroyed. You are 
strictly prohibited from using, printing, distributing or disseminating 
it or any information contained in it save to the intended recipient.

^ permalink raw reply

* Re: help with inittab
From: Steve Iribarne (GMail) @ 2006-06-09 18:23 UTC (permalink / raw)
  To: Chris Dumoulin; +Cc: linuxppc-embedded
In-Reply-To: <44899E7C.7080903@ics-ltd.com>

On 6/9/06, Chris Dumoulin <cdumoulin@ics-ltd.com> wrote:
> I've now determined that my kernel seems to stop in the following line
> of code, in the function init(void * unused), in init/main.c:
> run_init_process("/sbin/init");

Who's init are  you using??

Are you using Busyboxes or sysinit from GNU?


> I've determined that it stops at this call by stepping through the code
> with a BDI2000.
>
> My boot arguments are:
> console=ttyS0,57600n8 ip=off root=/dev/ram0 rw
>
> My current inittab is:
> ::sysinit:/etc/rc.sh
> ::ctrlaltdel:/sbin/reboot
> ::shutdown:/sbin/swapoff -a
> ::shutdown:/bin/umount -a -r
> ::restart:/sbin/init
> ::respawn:/bin/sh
>
> I've tried adding an "echo" command to the /etc/rc.sh script that is
> called, but I don't see any output. I've also trying changing the
> ::sysinit line in inittab to point to some non-existent script, to see
> if I'll get some error message, but I still see nothing. Is it possible
> that /sbin/init is dying before it gets to the point of reading inittab?
> Any ideas?
>
> Regards,
> Chris Dumoulin
>
>
> Wolfgang Denk wrote:
>
> >In message <44888B92.40409@ics-ltd.com> you wrote:
> >
> >
> >>I am using the linux kernel 2.6.15 and initrd ramdisk image from ELDK
> >>4.0. Currently, I seem to be able to boot without errors, but after the
> >>root filesystem is mounted, things just stop.
> >>
> >>
> >
> >And  what's  your  console  device?  Are  you  passing  any  console=
> >arguments  on  the  command  line?  Is the corresponding device entry
> >present in the /dev/directory?
> >
> >Best regards,
> >
> >Wolfgang Denk
> >
> >
> >
>
> --
> *--Christopher Dumoulin--*
> Software Team Leader
>
> <http://ics-ltd.com/>
> <http://ics-ltd.com/>
>
> Interactive Circuits and Systems Ltd.
> 5430 Canotek Road
> Ottawa, ON
> K1J 9G2
> (613)749-9241
> 1-800-267-9794 (USA only)
>
> ------------------------------------------------------------------------
> This e-mail is private and confidential and is for the addressee only.
> If misdirected, please notify us by telephone and confirm that it has
> been deleted from your system and any hard copies destroyed. You are
> strictly prohibited from using, printing, distributing or disseminating
> it or any information contained in it save to the intended recipient.
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>

^ permalink raw reply

* RFC: dma_mmap_coherent() for powerpc/ppc architecture and ALSA?
From: Gerhard Pircher @ 2006-06-09 18:01 UTC (permalink / raw)
  To: linuxppc-dev, linux-kernel

Hi,

I'm trying to adapt Linux for the AmigaOne, which is a G3/G4 PPC desktop system with a non cache coherent northbridge (MAI ArticiaS), a VIA82C686B southbridge and the U-boot firmware. Due to the cache coherency problem I compiled in the CONFIG_NOT_COHERENT_CACHE option (arch/ppc/kernel/dma-mapping.c) in the AmigaOne Linux kernel.

While that fixes the DMA data corruption problem, it causes a kernel oops or a complete system lookup after starting sound playback. With kernel versions =<2.6.14 the oops messages refered to a BUG() entry in mm/rmap.c. Therefore I tried out a newer kernel (2.6.16.15), where the oops refers to the ALSA function snd_pcm_mmap_data_nopage() implemented in pcm_native.c.

Well, after searching a while in some old linux kernel threads, I found this thread here:
http://www.thisishull.net/showthread.php?t=22080&page=3&pp=10

Based on the information in this thread, I came to the conclusion that ALSA simply won't work on non cache coherent architectures (except ARM), because the generic DMA API was never expanded to support the functionality required by ALSA (namely mapping dma pages into user space with dma_mmap_coherent()).

This leads me to the question, if there are any plans to include the dma_mmap_coherent() function (for powerpc/ppc and/or any other platform) in one of the next kernel versions and if an adapation of the ALSA drivers is planned. Or is there a simple way (hack) to fix this problem?

Thanks!

Regards,

Gerhard

-- 
--
-- email : gerhard_pircher -AT- gmx -DOT- net
--

Echte DSL-Flatrate dauerhaft für 0,- Euro*!
"Feel free" mit GMX DSL! http://www.gmx.net/de/go/dsl

^ permalink raw reply

* Re: [RFC/PATCH] powersave_nap cleanup
From: Nathan Lynch @ 2006-06-09 17:33 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev
In-Reply-To: <17545.15326.767523.342562@cargo.ozlabs.ibm.com>

Paul Mackerras wrote:
> Nathan Lynch writes:
> 
> > Rename machdep_calls.power_save to machdep_calls.powersave_nap to make
> > more apparent the connection with the powersave_nap sysctl.
> 
> Hmmm, it's possibly a bit confusing to have a variable and a function
> with the same name...

Heh, I thought you had suggested doing that, maybe I misunderstood.

So, what to do?  Leave the machdep_calls.power_save name as it is?

^ permalink raw reply

* Re: [PATCH 5/10 v2] Add 8641 CPU and i8259 Setup
From: Xianghua Xiao @ 2006-06-09 17:16 UTC (permalink / raw)
  To: Jon Loeliger; +Cc: linuxppc-dev@ozlabs.org
In-Reply-To: <E1FojUI-0004N5-E7@jdl.com>



Jon Loeliger wrote:

>So, like, the other day Benjamin Herrenschmidt mumbled:
>  
>
>>[A bunch of SMP issues.]
>>
>>The above is wrong, it prevents using the same kernel image on another
>>platform.
>>    
>>
>
>  
>
>>Same comment above... #ifdef is bad. You are entering from 0x100 with
>>address translation not disabled ?
>>    
>>
>
>  
>
>>>+	bl	clear_bats
>>> 	bl	load_up_mmu
>>>      
>>>
>>Why do you need to call clear_bats here ? load_up_mmu should load BATs.
>>If it doesn't handle the high BATs, then fix it :) 
>>    
>>
>
>  
>
I will fix this...

>>>+#ifdef CONFIG_I8259_LEVEL_TRIGGER
>>>+	outb(0xfa, 0x4d0); /* level triggered */
>>>+	outb(0xde, 0x4d1);
>>>+#endif
>>>      
>>>
>>Another change that breaks multiplatform... Can you explain precisely
>>what you are trying to acheive here ? If necessary, we can add an
>>argument to i8259_init. Or you could do the above in your platform
>>code ... though I agree it would be a bit ugly :) 
>>    
>>
>
>  
>
The above code is a must-have on our 8641D HPCN board to get PCI-Express 
ULI1575 southbridge going. The 8259(which is residing inside the 
southbridge) is collecting all PCI devices' interrupts( from both inside 
the ULI1575 and at its external PCI slots) before it reports to MPIC. 
PCI interrupts are level-triggered and shared thus we have to configure 
8259 to be level-triggered on this particular board.

>OK.  I don't have direct answers in hand for some of
>these questions and issues.  I'll get with original
>authors and see what we can do clean this up!
>
>Thanks!
>
>jdl
>_______________________________________________
>Linuxppc-dev mailing list
>Linuxppc-dev@ozlabs.org
>https://ozlabs.org/mailman/listinfo/linuxppc-dev
>  
>

^ permalink raw reply

* Re: help with inittab
From: Chris Dumoulin @ 2006-06-09 16:14 UTC (permalink / raw)
  To: Wolfgang Denk; +Cc: linuxppc-embedded
In-Reply-To: <20060608214239.A71EE35265D@atlas.denx.de>

I've now determined that my kernel seems to stop in the following line 
of code, in the function init(void * unused), in init/main.c:
run_init_process("/sbin/init");
I've determined that it stops at this call by stepping through the code 
with a BDI2000.

My boot arguments are:
console=ttyS0,57600n8 ip=off root=/dev/ram0 rw

My current inittab is:
::sysinit:/etc/rc.sh
::ctrlaltdel:/sbin/reboot
::shutdown:/sbin/swapoff -a
::shutdown:/bin/umount -a -r
::restart:/sbin/init
::respawn:/bin/sh

I've tried adding an "echo" command to the /etc/rc.sh script that is 
called, but I don't see any output. I've also trying changing the 
::sysinit line in inittab to point to some non-existent script, to see 
if I'll get some error message, but I still see nothing. Is it possible 
that /sbin/init is dying before it gets to the point of reading inittab?
Any ideas?

Regards,
Chris Dumoulin


Wolfgang Denk wrote:

>In message <44888B92.40409@ics-ltd.com> you wrote:
>  
>
>>I am using the linux kernel 2.6.15 and initrd ramdisk image from ELDK 
>>4.0. Currently, I seem to be able to boot without errors, but after the 
>>root filesystem is mounted, things just stop.
>>    
>>
>
>And  what's  your  console  device?  Are  you  passing  any  console=
>arguments  on  the  command  line?  Is the corresponding device entry
>present in the /dev/directory?
>
>Best regards,
>
>Wolfgang Denk
>
>  
>

-- 
*--Christopher Dumoulin--*
Software Team Leader

<http://ics-ltd.com/>
<http://ics-ltd.com/>

Interactive Circuits and Systems Ltd.
5430 Canotek Road
Ottawa, ON
K1J 9G2
(613)749-9241
1-800-267-9794 (USA only)

------------------------------------------------------------------------
This e-mail is private and confidential and is for the addressee only. 
If misdirected, please notify us by telephone and confirm that it has 
been deleted from your system and any hard copies destroyed. You are 
strictly prohibited from using, printing, distributing or disseminating 
it or any information contained in it save to the intended recipient.

^ permalink raw reply

* Re: a problem of kernel-module version mismatch.
From: Arnd Bergmann @ 2006-06-09 14:18 UTC (permalink / raw)
  To: Ming Liu; +Cc: linuxppc-embedded
In-Reply-To: <BAY110-F337711EB19C0B1D8417B18B2880@phx.gbl>

On Friday 09 June 2006 16:07, Ming Liu wrote:
> Are in_le32 and out_le32 two functions defined by the kernel to input and 
> output 32-bit data? When we define XIo_In32 and XIo_Out32 as them, which is 
> we use out_le32 and in_le32 to input and output data, they are still not 
> resolvable. Any other suggestions? Thanks a lot.

They should be defined in include/asm-powerpc/io.h, include <asm/io.h>
to get the definition.
If your kernel is too old, they may not be there however, so you need
to use readl/writel or inl/outl, also defined in that file.

	Arnd <><

^ permalink raw reply

* Re: [PATCH 3/10 v2] Add MPC8641 HPCN PCI and PCI-Express files.
From: Jon Loeliger @ 2006-06-09 16:09 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev@ozlabs.org
In-Reply-To: <1149827596.12687.53.camel@localhost.localdomain>

So, like, the other day Benjamin Herrenschmidt mumbled:
> On Thu, 2006-06-08 at 16:57 -0500, Jon Loeliger wrote:
> > Signed-off-by: Xianghua Xiao <x.xiao@freescale.com>
> > Signed-off-by: Wei Zhang <Wei.Zhang@freescale.com>
> > Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com>
> > Signed-off-by: Jon Loeliger <jdl@freescale.com>
> 
> There are various things in this code that duplicate names used by other
> platforms and thus makes the board unsuitable for use in a common
> kernel. That needs to be fixed. Try avoiding too generic names. Also,
> PCI Express shall be named "pcie" and not "pex" :)
> 
> I don't have time at the moment to go too deep in the details here.
> 
> Ben.

I will also prefix some routines with mpc86xx_ to avoid
the generic names problems.  But I'm not sure which other
platforms you expect this one kernel image to run on.
Specifically, this pcie code is very similar to the 8548
family, but not exactly the same.

My understanding is that we are shooting for a single 86xx
family kernel image here, with this 8641 HPCN platform being
the first such port.

I will s/pex/pcie/g and rename files accordingly.

jdl

^ permalink raw reply

* Re: [PATCH 5/10 v2] Add 8641 CPU and i8259 Setup
From: Jon Loeliger @ 2006-06-09 16:05 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev@ozlabs.org
In-Reply-To: <1149826989.12687.50.camel@localhost.localdomain>

So, like, the other day Benjamin Herrenschmidt mumbled:
> 
> [A bunch of SMP issues.]
> 
> The above is wrong, it prevents using the same kernel image on another
> platform.

> Same comment above... #ifdef is bad. You are entering from 0x100 with
> address translation not disabled ?

> > +	bl	clear_bats
> >  	bl	load_up_mmu
> 
> Why do you need to call clear_bats here ? load_up_mmu should load BATs.
> If it doesn't handle the high BATs, then fix it :) 

> > +#ifdef CONFIG_I8259_LEVEL_TRIGGER
> > +	outb(0xfa, 0x4d0); /* level triggered */
> > +	outb(0xde, 0x4d1);
> > +#endif
> 
> Another change that breaks multiplatform... Can you explain precisely
> what you are trying to acheive here ? If necessary, we can add an
> argument to i8259_init. Or you could do the above in your platform
> code ... though I agree it would be a bit ugly :) 

OK.  I don't have direct answers in hand for some of
these questions and issues.  I'll get with original
authors and see what we can do clean this up!

Thanks!

jdl

^ permalink raw reply

* Re: [PATCH 4/10 v2] Guard L3CR references with CPU_FTR_L3CR.
From: Jon Loeliger @ 2006-06-09 16:00 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev@ozlabs.org
In-Reply-To: <1149826679.12687.44.camel@localhost.localdomain>

So, like, the other day Benjamin Herrenschmidt mumbled:
> On Thu, 2006-06-08 at 16:58 -0500, Jon Loeliger wrote:
> > Signed-off-by: Jon Loeliger <jdl@freescale.com>
> 
> Beware about this one... the CPU setup code might run before the feature
> fixup in the future...
> ...
> or go read the feature bit directly in the structure
> rather than relying on the fixup mecanism.

OK.

> you should probably do a separate setup function for your core

Truth be told, this is a pretty generic fix for other
parts as well. If I recall correctly, 7447, 7448, 7448A and 7450
as well as the new 8641 now.

But I can certainly introduce a new setup function here
if you think that is the right thing to do.  No problem.

Thanks,
jdl

> > --- a/arch/powerpc/kernel/cpu_setup_6xx.S
> > +++ b/arch/powerpc/kernel/cpu_setup_6xx.S

> > +BEGIN_FTR_SECTION
> >  	mfspr	r11,SPRN_L3CR
> >  	andis.	r11,r11,L3CR_L3E@h
> >  	beq	1f
> > +END_FTR_SECTION_IFSET(CPU_FTR_L3CR)
> >  	lwz	r6,CPU_SPEC_FEATURES(r5)
> >  	andi.	r0,r6,CPU_FTR_L3_DISABLE_NAP
> >  	beq	1f

^ permalink raw reply

* Re: [PATCH 2/10 v2] Add the MPC8641 HPCN platform files.
From: Jon Loeliger @ 2006-06-09 15:55 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev@ozlabs.org
In-Reply-To: <1149826559.12687.41.camel@localhost.localdomain>

So, like, the other day Benjamin Herrenschmidt mumbled:
> On Thu, 2006-06-08 at 16:57 -0500, Jon Loeliger wrote:
> 
> > +void
> > +mpc86xx_restart(char *cmd)
> > +{
> > +	void __iomem *rstcr;
> > +
> > +	local_irq_disable();
> > +
> > +	/* Assert reset request to Reset Control Register */
> > +	rstcr = ioremap(get_immrbase() + MPC86XX_RSTCR_OFFSET, 0x100);
> > +	out_be32(rstcr, 0x2);
> > +
> > +	/* not reached */
> > +}
> 
> ioremap with irq disabled isn't great....  You should do the ioremap
> once at boot.

OK.  Would this be acceptable instead:

    mpc86xx_restart(char *cmd)
    {
	void __iomem *rstcr;

	rstcr = ioremap(get_immrbase() + MPC86XX_RSTCR_OFFSET, 0x100);

	local_irq_disable();

	/* Assert reset request to Reset Control Register */
	out_be32(rstcr, 0x2);
	/* not reached */
    }


> Overall, that file is too small :) Move those into your setup.c and make
> those static...

Will do.

> [SMP code snipped]
>
> This file could/should be called *_smp.c and not need #ifdef's :)

OK.


> Most of the values above should probably be retreived from the
> device-tree.

I'll see what I can remove.  Some of the PCI/PCI-e bits
_will_ be device tree derived, but just not quite there yet...
It's just not going to be a perfect first patch;  there
will have to be incremental development in that direction.

> As I suggested before, the 2 above should be static in your setup file.

Right.

> > +extern int __init add_bridge(struct device_node *dev);
> 
> Aren't we exposing that already via some header ?

Perhaps.  I'll look around for it.

> > +extern void __init setup_indirect_pex_nomap(struct pci_controller* hose,
> > +					    void __iomem * cfg_addr,
> > +					    void __iomem * cfg_data);
> > +
> > +extern struct smp_ops_t smp_8641_ops;
> 
> See my comments about the PCI stuff with the PCI patch.

and...

> All of the above should of course come from the device-tree. 2.6.18 will
> have the support for having interrupt routing from it without having
> nodes for all devices. I'll post it to the list in a week or so, I'm
> coding right now :)

Right.  We're not quite entirely able to convert it
all to device tree yet.  Working on it still...

> > +	phys_addr_t OpenPIC_PAddr;
> > +
> > +	/* Determine the Physical Address of the OpenPIC regs */
> > +	OpenPIC_PAddr = get_immrbase() + MPC86xx_OPENPIC_OFFSET;
> 
> Do you really _need_ studly caps ? I know we did that before but you
> don't have to copy ugly stuff :)

Uh, sorry.  No problem.

> In general, you -need- a device node for the interrupt controller. It
> will be made mandatory by the new code.

I know.  There is a fully defined node for that in my
device tree already.

> You'll have to provide proper
> interrupt informations in your device-tree (it's easy, really).

It's there.

> If you get that right, it will be very easy to "just work" with my new
> code.

I'll send that to the list too for reference
just to make sure we are in sync here.

> > +	/* Alloc mpic structure and per isu has 16 INT entries. */
> > +	mpic1 = mpic_alloc(OpenPIC_PAddr,
> > +			MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
> > +			16, MPC86xx_OPENPIC_IRQ_OFFSET, 0, 250,
> > +			mpc86xx_hpcn_openpic_initsenses,
> > +			sizeof(mpc86xx_hpcn_openpic_initsenses),
> > +			" MPIC     ");
> > +	BUG_ON(mpic1 == NULL);
> > +
> > +	/* 48 Internal Interrupts */
> > +	mpic_assign_isu(mpic1, 0, OpenPIC_PAddr + 0x10200);
> > +	mpic_assign_isu(mpic1, 1, OpenPIC_PAddr + 0x10400);
> > +	mpic_assign_isu(mpic1, 2, OpenPIC_PAddr + 0x10600);
> 
> I haven't looked in detail at your memory map, but do you need separate
> ISUs ? They seem to be quite close together to me... Also, you should
> invent properties in the mpic node for some of those things, like
> big-endian (like apple does) indicating it's a big endian openpic,
> etc... If you manage to get close enough to spec & common usage, you
> might not even need your own init function at all in the future.

OK.  We'll work in that direction, but incrementally.

> > +	/* 16 External interrupts */
> > +	mpic_assign_isu(mpic1, 3, OpenPIC_PAddr + 0x10000);
> 
> That looks like you used ISUs in order to "re-order" them... why ?

Heck if I know.  We'll have to ask around some here... :-)

> > +#ifdef CONFIG_PEX
> > +	mpic_setup_cascade(MPC86xx_IRQ_EXT9, i8259_irq_cascade, NULL);
> > +	i8259_init(0, I8259_OFFSET);
> > +#endif
> > +}
> 
> Cascade handling is changing with my genirq port. It will be easy to
> adapt though. Same comments howveer, you should have a device-tree node
> for the 8259 (under an ISA bridge, those shall really be in the
> device-tree). In general, on-board bridges should be in the device-tree,
> only slots or standardly routed child PCI devices need not.

Can you send me an example?

> 
> All of the above shall be in the device-tree.

Yes, eventually.  But not yet...  We're working on
this with other folks like Kumar, and Monta Vista,
and other folks.

> > +static void __init
> > +mpc86xx_hpcn_setup_arch(void)
> > +{
> > +	struct device_node *np;
> > +
> > +#ifdef CONFIG_SMP
> > +	phys_addr_t mcm_paddr;
> > +	void *mcm_vaddr = NULL;
> > +	unsigned long vaddr;
> > +#endif
> > +
> > +	if (ppc_md.progress)
> > +		ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0);
> > +
> > +	np = of_find_node_by_type(NULL, "cpu");
> > +	if (np != 0) {
> > +		unsigned int *fp;
> > +
> > +		fp = (int *)get_property(np, "clock-frequency", NULL);
> > +		if (fp != 0)
> > +			loops_per_jiffy = *fp / HZ;
> > +		else
> > +			loops_per_jiffy = 50000000 / HZ;
> > +		of_node_put(np);
> > +	}
> 
> The above looks dodgy... powerpc uses the timebase frequency for delays
> anyway, lpj will be initialized by the bogomips code, and should but
> unused mostly nowadays anyway.

Uh, you want I should rip it out, boss? :-)

> > +#ifdef CONFIG_PEX
> > +	for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
> > +		add_bridge(np);
> > +
> > +	ppc_md.pci_swizzle = common_swizzle;
> > +	ppc_md.pci_map_irq = mpc86xx_map_irq;
> > +	ppc_md.pci_exclude_device = mpc86xx_exclude_device;
> > +#endif
> 
> I'm not sure I like this CONFIG_PEX (in general). Just use CONFIG_PCI
> for now all over the place. PCI-E has it's own binding that we don't
> quite respect yet but will do and all of that will be in the
> device-tree. However, as far as the kernel is concerned, this is all
> under CONFIG_PCI.

But I think we are looking for independent PCI/PCI-E options
to be independently configurable still...?

> > +#ifdef CONFIG_SMP
> > +  	/* Release Core 1 in boot holdoff */
> > +	mcm_paddr = get_immrbase() + MPC86xx_MCM_OFFSET;
> > +	mcm_vaddr = ioremap(mcm_paddr, MPC86xx_MCM_SIZE);
> > +
> > +	vaddr = (unsigned long)mcm_vaddr +  MCM_PORT_CONFIG_OFFSET;
> > +	out_be32((volatile unsigned *)vaddr, CPU_ALL_RELEASED);
> > +	smp_ops = &smp_8641_ops;
> > +#endif
> > +}
> 
> Instead of ifdef's, just do a mpc86xx_smp_init() and put it somewhere
> with the other SMP things in the file that contains them (and remove the
> #ifdef's there too, just only build the file if CONFIG_SMP is set).

OK, I catch your drift, but if the file is missing and
there is a hard call to  mpc86xx_smp_init() here, how is
that resolved?  Is mpc86xx_smp_init #defined empty when
compiled non-SMP then?  Like in the header file:

    #ifndef CONFIG_SMP
        #define mpc86xx_smp_init()
    #endif

> > +void
> > +mpc86xx_hpcn_show_cpuinfo(struct seq_file *m)
> > +{
> > +	uint pvid, svid, phid1;
> > +	uint memsize = total_memory;
> > +
> > +	pvid = mfspr(SPRN_PVR);
> > +	svid = mfspr(SPRN_SVR);
> >
> > +	seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
> > +	seq_printf(m, "Machine\t\t: MPC86xx HPCN Board\n");
> > +	seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
> > +	seq_printf(m, "SVR\t\t: 0x%x\n", svid);
> 
> The PVR is probably a duplicate and the SVR should be added to per-cpu
> info instead.

I confess, I am not sure what you mean here.  Could you
clarify this a bit for me, or point to an example perhaps?

Thanks for you feedback!

jdl

^ permalink raw reply

* RE: does Gianfar Ethernet Controller Version 1.1 support MARVELL 88E1111?
From: Guo Jaffe @ 2006-06-09 15:43 UTC (permalink / raw)
  To: DaveLiu, afleming; +Cc: Linuxppc-embedded
In-Reply-To: <9FCDBA58F226D911B202000BDBAD4673026FD945@zch01exm40.ap.freescale.net>

Hi Dave,

The PHY ID I read is MARVELL 88E1101(1410cc2)

Today I took the MPC 8540 off the board, and checked the two GMII phy chips 
alone. I manually pulled up the phys's RST pins when the cable was in 
position. But the link LED still can't light up. So it turned out not the 
driver's problem. 

The hardware configuration of 88E1111 is GMII to copper, Auto-Neg, 
advertise all capabilities, prefer Master.

The PHY's power is correct and clean. And for interface between TESC and 
PHY I think even TESC power is set for 3.3V environment it still can work 
with the 88e1111 whose VDD is 2.5V. Because the datasheet of 88e1111 says 
that input pins are 3.3V tolerant. Am I right?

regards,
Jaffe

----------------------------------------------------------------------------

>As you said, the MDIO bus looks like well. If the PHY address it is right,
>You can read the PHY ID from PHY. What is the PHY ID you read?
>
>Please check the hardware status
>
>1) 8540 hardware reset configuration for GMII interface;
>Make sure it is GMII interface.
>
>2) MARVELL 88E1111 configuration and GMII interface connection.
>You can reference the 8540 ref board.
>
>3)TSEC and PHY power
>
>4)The 125M reference clock---GTX_CLK125, This looks
>well as you said.
>
>5)The GTX_CLK for GMII transmit clock, and TX_CLK for MII transmit clock.
>What speed ethernet does the TSEC  connect to? 1000Mbps or 100Mbps?
>
>6) The RX_CLK for receive clock.
>
>7)Of cause, need check the RX_DV and TX_EN to see if have some traffic.
>
>-Dave

^ permalink raw reply

* Re: does Gianfar Ethernet Controller Version 1.1 support MARVELL 88E1111?
From: Guo Jaffe @ 2006-06-09 14:56 UTC (permalink / raw)
  To: afleming, DaveLiu; +Cc: Linuxppc-embedded
In-Reply-To: <15BDF877-21B2-40BD-A5F6-9CD83E5BB2CE@freescale.com>




>From: Andy Fleming <afleming@freescale.com>
>To: Guo Jaffe <jianfei616@hotmail.com>
>CC: Linuxppc-embedded@ozlabs.org
>Subject: Re: does Gianfar Ethernet Controller Version 1.1 support MARVELL 
88E1111?
>Date: Thu, 8 Jun 2006 14:25:44 -0500
>
>
>On Jun 8, 2006, at 12:51, Guo Jaffe wrote:
>
>>Hi Andy,
>>
>>Thank you for your information. So the driver is not the issue, but 
>>  better to upgraded.
>>
>>I will check the board once more. The PHY doesn't work because the  
>>8bit bus between MAC and PHY is locked(TX_EN and RX_DV all disabled 
>>  from the scope's view) and also you can't see any signals exist 
>>at  the Magnetic side(nor LED signals). It seems that only MDC/MDIO 
>>and  CLOCK reference pin works. The PHY's ID must be read from 
>>MDC/MDIO  interface and Clocks are right showed on the scope.
>
>
>But what error are you getting?  What are the symptoms of your  
>problem?  The GMII interface (the 8-bit bus) is inconsequential to  
>PHY configuration and management.  Only the MDC/MDIO bus is used.   
>Therefore the PHY id should be quite readable.  What version of 
>Linux  are you using?  Please describe what the kernel prints out 
>when you  boot, and when you try to bring up the interface (assuming 
>you don't  do that at boot).
>
>Andy

^ permalink raw reply

* Re: a problem of kernel-module version mismatch.
From: Ming Liu @ 2006-06-09 14:07 UTC (permalink / raw)
  To: arnd.bergmann; +Cc: linuxppc-embedded
In-Reply-To: <200606081725.37621.arnd.bergmann@de.ibm.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb2312; format=flowed, Size: 4608 bytes --]

Dear Arnd,
I have tried to replace the original definations for XIn_In32 and XIn_Out32 
by what you suggested: 
           #define XIo_In32(p) in_le32(x)         (Should that be 
in_le32(p) instead of x?)
           #define XIO_Out32(p,v) out_le32(p, v)

The following warnings are generated: 
passing arg 1 of 'in_le32' (and 'out_le32') makes pointer from integer 
without a cast

Also, when I try to insmod FIFO.o, the following errors appeared:
insmod: unresolved symbol out_le32
insmod: unresolved symbol in_le32

Are in_le32 and out_le32 two functions defined by the kernel to input and 
output 32-bit data? When we define XIo_In32 and XIo_Out32 as them, which is 
we use out_le32 and in_le32 to input and output data, they are still not 
resolvable. Any other suggestions? Thanks a lot.

Regards
Ming


>From: Arnd Bergmann <arnd.bergmann@de.ibm.com>
>To: "Ming Liu" <eemingliu@hotmail.com>
>CC: linuxppc-embedded@ozlabs.org
>Subject: Re: a problem of kernel-module version mismatch.
>Date: Thu, 8 Jun 2006 17:25:37 +0200
>
>On Thursday 08 June 2006 15:52, Ming Liu wrote:
> > >The easiest way is usually to put the driver in your source tree
> > >and compile everything together. That also makes it easier to
> > >distribute the complete source tree to your users.
> >
> > Sorry that I am a novice in Linux. I don't know how can I put the 
driver in
> > my source tree and compile everything together. It looks like that 
there is
> > no option in the menuconfig to choose a specially customed peripheral. 
So I
> > think I only can include the customed peripheral as a module. Could you
> > please say in a detail on how to do that?
>
>The most simple way would be to put it into linux/drivers/misc and add it
>to the Makefile in there.
>
> > > > insmod: unresolved symbol XIo_In32
> > > > insmod: unresolved symbol XIO_Out32
> > >
> > >that looks like part of your module is missing. Try to find where 
thses
> > >functions are defined in there and why that isn't compiled.
> >
> > It's very strange because I have checked the source. In the header file 
of
> > xio.h, there are the following sentences,
> >
> > /************************** Function Prototypes
> > ******************************/
> >
> > /* The following functions allow the software to be transportable 
across
> > ? processors which may use memory mapped I/O or I/O which is mapped 
into a
> > ? seperate address space such as X86.  The functions are better suited 
for
> > ? debugging and are therefore the default implementation. Macros can
> > instead
> > ? be used if USE_IO_MACROS is defined.
> > ?/
> > #ifndef USE_IO_MACROS
>
>The comment tells you that you either need to implement these functions
>youself or #define USE_IO_MACROS in the code before this.
>
> > /* Functions */
> > Xuint8 XIo_In8(XIo_Address InAddress);
> > Xuint16 XIo_In16(XIo_Address InAddress);
> > Xuint32 XIo_In32(XIo_Address InAddress);
> >
> > void XIo_Out8(XIo_Address OutAddress, Xuint8 Value);
> > void XIo_Out16(XIo_Address OutAddress, Xuint16 Value);
> > void XIo_Out32(XIo_Address OutAddress, Xuint32 Value);
> >
> > #else
> >
> > /* The following macros allow optimized I/O operations for memory 
mapped
> > I/O
> > ? Note that the SYNCHRONIZE_IO may be moved by the compiler during
> > ? optimization.
> > ?/
> >
> > #define XIo_In8(InputPtr) ?*(volatile Xuint8 ?)(InputPtr));
> > SYNCHRONIZE_IO;
> > #define XIo_In16(InputPtr) (*(volatile Xuint16 *)(InputPtr));
> > SYNCHRONIZE_IO;
> > #define XIo_In32(InputPtr) (*(volatile Xuint32 *)(InputPtr));
> > SYNCHRONIZE_IO;
> >
> > #define XIo_Out8(OutputPtr, Value)  \
> > ??{ (*(volatile Xuint8 ?)(OutputPtr) = Value); SYNCHRONIZE_IO; }
> > #define XIo_Out16(OutputPtr, Value) \
> > ??{ (*(volatile Xuint16 *)(OutputPtr) = Value); SYNCHRONIZE_IO; }
> > #define XIo_Out32(OutputPtr, Value) \
> > ??{ (*(volatile Xuint32 *)(OutputPtr) = Value); SYNCHRONIZE_IO; }
> >
> > #endif
>
>These macros are probably broken on powerpc.
>
> >
> > I think these are the defination of XIo_In32 and XIo_Out32. Also, 
during
> > the compilation, there is no error to complain that "XIo_In32 or 
XIo_Out32
> > undeclared".
> >
>
>I would suggest you remove that part of the header file completely, and
>replace it with:
>
>#define XIo_In32(p) in_le32(x)
>#define XIO_Out32(p,v) out_le32(p, v)
>
>	Arnd <><
>_______________________________________________
>Linuxppc-embedded mailing list
>Linuxppc-embedded@ozlabs.org
>https://ozlabs.org/mailman/listinfo/linuxppc-embedded

_________________________________________________________________
ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£  http://www.hotmail.com  

^ permalink raw reply

* Re: a problem of kernel-module version mismatch.
From: Ming Liu @ 2006-06-09 14:02 UTC (permalink / raw)
  To: arnd.bergmann; +Cc: linuxppc-embedded

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb2312; format=flowed, Size: 4006 bytes --]

Dear Arnd, 
Thanks a lot for your help. Now I have solved the problem of version 
mismatch. The reason is I haven't include the sentence of "#define MODULE". 



However the problem of unresolved symbol XIo_In32 and XIo_Out32 still 
exists. I will try to solve it following your suggestion. If any question, 
I will ask you again. Thanks a lot for your help. 

Regards 
Ming 


From: Arnd Bergmann <arnd.bergmann@de.ibm.com> 
To: "Ming Liu" <eemingliu@hotmail.com> 
CC: linuxppc-embedded@ozlabs.org 
Subject: Re: a problem of kernel-module version mismatch. 
Date: Thu, 8 Jun 2006 17:25:37 +0200 

On Thursday 08 June 2006 15:52, Ming Liu wrote: 
> >The easiest way is usually to put the driver in your source tree 
> >and compile everything together. That also makes it easier to 
> >distribute the complete source tree to your users. 
> 
> Sorry that I am a novice in Linux. I don't know how can I put the 
 
driver in 
    > my source tree and compile everything together. It looks like that 
 
there is 
    > no option in the menuconfig to choose a specially customed 
peripheral. 
 
So I 
    > think I only can include the customed peripheral as a module. Could 
you 
> please say in a detail on how to do that? 

The most simple way would be to put it into linux/drivers/misc and add it 
to the Makefile in there. 

> > > insmod: unresolved symbol XIo_In32 
> > > insmod: unresolved symbol XIO_Out32 
> > 
> >that looks like part of your module is missing. Try to find where 
 
thses 
    > >functions are defined in there and why that isn't compiled. 
> 
> It's very strange because I have checked the source. In the header file 
 
of 
    > xio.h, there are the following sentences, 
> 
> /************************** Function Prototypes 
> ******************************/ 
> 
> /* The following functions allow the software to be transportable 
 
across 
    > ? processors which may use memory mapped I/O or I/O which is mapped 
 
into a 
    > ? seperate address space such as X86.  The functions are better 
suited 
 
for 
    > ? debugging and are therefore the default implementation. Macros can 
> instead 
> ? be used if USE_IO_MACROS is defined. 
> ?/ 
> #ifndef USE_IO_MACROS 

The comment tells you that you either need to implement these functions 
youself or #define USE_IO_MACROS in the code before this. 

> /* Functions */ 
> Xuint8 XIo_In8(XIo_Address InAddress); 
> Xuint16 XIo_In16(XIo_Address InAddress); 
> Xuint32 XIo_In32(XIo_Address InAddress); 
> 
> void XIo_Out8(XIo_Address OutAddress, Xuint8 Value); 
> void XIo_Out16(XIo_Address OutAddress, Xuint16 Value); 
> void XIo_Out32(XIo_Address OutAddress, Xuint32 Value); 
> 
> #else 
> 
> /* The following macros allow optimized I/O operations for memory 
 
mapped 
    > I/O 
> ? Note that the SYNCHRONIZE_IO may be moved by the compiler during 
> ? optimization. 
> ?/ 
> 
> #define XIo_In8(InputPtr) ?*(volatile Xuint8 ?)(InputPtr)); 
> SYNCHRONIZE_IO; 
> #define XIo_In16(InputPtr) (*(volatile Xuint16 *)(InputPtr)); 
> SYNCHRONIZE_IO; 
> #define XIo_In32(InputPtr) (*(volatile Xuint32 *)(InputPtr)); 
> SYNCHRONIZE_IO; 
> 
> #define XIo_Out8(OutputPtr, Value)  \ 
> ??{ (*(volatile Xuint8 ?)(OutputPtr) = Value); SYNCHRONIZE_IO; } 
> #define XIo_Out16(OutputPtr, Value) \ 
> ??{ (*(volatile Xuint16 *)(OutputPtr) = Value); SYNCHRONIZE_IO; } 
> #define XIo_Out32(OutputPtr, Value) \ 
> ??{ (*(volatile Xuint32 *)(OutputPtr) = Value); SYNCHRONIZE_IO; } 
> 
> #endif 

These macros are probably broken on powerpc. 

> 
> I think these are the defination of XIo_In32 and XIo_Out32. Also, 
 
during 
    > the compilation, there is no error to complain that "XIo_In32 or 
 
XIo_Out32 
    > undeclared". 
> 

I would suggest you remove that part of the header file completely, and 
replace it with: 

#define XIo_In32(p) in_le32(x) 
#define XIO_Out32(p,v) out_le32(p, v) 

Arnd <><

_________________________________________________________________
ÓëÁª»úµÄÅóÓѽøÐн»Á÷£¬ÇëʹÓà MSN Messenger:  http://messenger.msn.com/cn  

^ permalink raw reply

* Re: [PATCH 10/10 v2] Document I2C_MPC option for 86xx too.
From: Jon Loeliger @ 2006-06-09 13:50 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linuxppc-dev
In-Reply-To: <20060609093737.f66d5a41.khali@linux-fr.org>

So, like, the other day Jean Delvare mumbled:
> Hi Jon,
> 
> Please add a paragraph explaining what the patch does. It will be used
> as the git commit message.

Hi Jean,

There is a one-line commit message that will come from
the Subject: line.  If I add a paragraph, it will be

    "Document I2C_MPC option for 86xx too."

which will end up as a duplicate line in the commit message.

Thanks,
jdl

^ permalink raw reply

* [PATCH] Editable kernel command-line in zImage binary.
From: mostrows @ 2006-06-09 13:06 UTC (permalink / raw)
  To: linuxppc-dev, paulus
In-Reply-To: <17545.17329.227226.926906@cargo.ozlabs.ibm.com>

zImage will set /chosen/bootargs (if it is otherwise empty) with the
contents of a buffer in the section "__builtin_cmdline".  This permits
tools to edit zImage binaries to set the command-line eventually
processed by vmlinux.

--
Signed-off-by: Michal Ostrowski <mostrows@watson.ibm.com>

---

 arch/powerpc/boot/main.c |   27 +++++++++++++++++++++++++++
 arch/powerpc/boot/prom.h |    7 +++++++
 2 files changed, 34 insertions(+), 0 deletions(-)

40bea6ace95796a1575437d6dfdbef671012ffc1
diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c
index 816446f..c65a7ba 100644
--- a/arch/powerpc/boot/main.c
+++ b/arch/powerpc/boot/main.c
@@ -33,6 +33,14 @@ extern char _vmlinux_end[];
 extern char _initrd_start[];
 extern char _initrd_end[];
 
+/* A buffer that may be edited by tools operating on a zImage binary so as to
+ * edit the command line passed to vmlinux (by setting /chosen/bootargs).
+ * The buffer is put in it's own section so that tools may locate it easier.
+ */
+static char builtin_cmdline[512]
+	__attribute__((section("__builtin_cmdline")));
+
+
 struct addr_range {
 	unsigned long addr;
 	unsigned long size;
@@ -204,6 +212,23 @@ static int is_elf32(void *hdr)
 	return 1;
 }
 
+void export_cmdline(void* chosen_handle)
+{
+        int len;
+        char cmdline[2] = { 0, 0 };
+
+	if (builtin_cmdline[0] == 0) 
+		return;
+
+        len = getprop(chosen_handle, "bootargs", cmdline, sizeof(cmdline));
+        if (len > 0 && cmdline[0] != 0) 
+		return;
+
+	setprop(chosen_handle, "bootargs", builtin_cmdline,
+		strlen(builtin_cmdline) + 1);
+}
+
+
 void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
 {
 	int len;
@@ -289,6 +314,8 @@ void start(unsigned long a1, unsigned lo
 		memmove((void *)vmlinux.addr,(void *)vmlinuz.addr,vmlinuz.size);
 	}
 
+	export_cmdline(chosen_handle);
+
 	/* Skip over the ELF header */
 #ifdef DEBUG
 	printf("... skipping 0x%lx bytes of ELF header\n\r",
diff --git a/arch/powerpc/boot/prom.h b/arch/powerpc/boot/prom.h
index 3e2ddd4..a57b184 100644
--- a/arch/powerpc/boot/prom.h
+++ b/arch/powerpc/boot/prom.h
@@ -31,4 +31,11 @@ static inline int getprop(void *phandle,
 	return call_prom("getprop", 4, 1, phandle, name, buf, buflen);
 }
 
+
+static inline int setprop(void *phandle, const char *name,
+			  void *buf, int buflen)
+{
+	return call_prom("setprop", 4, 1, phandle, name, buf, buflen);
+}
+
 #endif				/* _PPC_BOOT_PROM_H_ */
-- 
1.1.4.g0b63-dirty

^ permalink raw reply related

* Re: [PATCH 0/5] Sizing zones and holes in an architecture independent manner V7
From: Mel Gorman @ 2006-06-09 12:57 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Andrew Morton, davej, tony.luck, linux-mm, linux-kernel,
	bob.picco, linuxppc-dev
In-Reply-To: <200606071720.22242.ak@suse.de>

On (07/06/06 17:20), Andi Kleen didst pronounce:
> 
> > Ok, while true, I'm not sure how it affects performance. The only "real" 
> > value affected by present_pages is the number of patches that are 
> > allocated in batches to the per-cpu allocator.
> 
> It affects the low/high water marks in the VM zone balancer.
> 
> Especially for the 16MB DMA zone it can make a difference if you
> account 4MB kernel in there or not.
> 

Ok, the following patch will account for memmap usage on all
architectures. Optionally, a set_dma_reserve() may be called to account
for pages in ZONE_DMA that will never be usable. In this patch, only
x86_64 uses it.

After this patch is applied, the zone->present_pages figures are very
similar before and after arch-independent zone-sizing and the watermarks
are the same.


diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.17-rc6-mm1-105-ia64_use_init_nodes/arch/x86_64/mm/init.c linux-2.6.17-rc6-mm1-106-account_kernel_mmap/arch/x86_64/mm/init.c
--- linux-2.6.17-rc6-mm1-105-ia64_use_init_nodes/arch/x86_64/mm/init.c	2006-06-08 13:45:07.000000000 +0100
+++ linux-2.6.17-rc6-mm1-106-account_kernel_mmap/arch/x86_64/mm/init.c	2006-06-09 09:18:55.000000000 +0100
@@ -660,8 +660,10 @@ void __init reserve_bootmem_generic(unsi
 #else       		
 	reserve_bootmem(phys, len);    
 #endif
-	if (phys+len <= MAX_DMA_PFN*PAGE_SIZE)
+	if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) {
 		dma_reserve += len / PAGE_SIZE;
+		set_dma_reserve(dma_reserve);
+	}
 }
 
 int kern_addr_valid(unsigned long addr) 
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.17-rc6-mm1-105-ia64_use_init_nodes/include/linux/mm.h linux-2.6.17-rc6-mm1-106-account_kernel_mmap/include/linux/mm.h
--- linux-2.6.17-rc6-mm1-105-ia64_use_init_nodes/include/linux/mm.h	2006-06-08 13:42:53.000000000 +0100
+++ linux-2.6.17-rc6-mm1-106-account_kernel_mmap/include/linux/mm.h	2006-06-09 09:18:55.000000000 +0100
@@ -969,6 +969,7 @@ extern void free_bootmem_with_active_reg
 						unsigned long max_low_pfn);
 extern void sparse_memory_present_with_active_regions(int nid);
 #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
+extern void set_dma_reserve(unsigned long new_dma_reserve);
 extern void memmap_init_zone(unsigned long, int, unsigned long, unsigned long);
 extern void setup_per_zone_pages_min(void);
 extern void mem_init(void);
diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.17-rc6-mm1-105-ia64_use_init_nodes/mm/page_alloc.c linux-2.6.17-rc6-mm1-106-account_kernel_mmap/mm/page_alloc.c
--- linux-2.6.17-rc6-mm1-105-ia64_use_init_nodes/mm/page_alloc.c	2006-06-08 13:42:53.000000000 +0100
+++ linux-2.6.17-rc6-mm1-106-account_kernel_mmap/mm/page_alloc.c	2006-06-09 09:18:55.000000000 +0100
@@ -88,6 +88,7 @@ int min_free_kbytes = 1024;
 
 unsigned long __meminitdata nr_kernel_pages;
 unsigned long __meminitdata nr_all_pages;
+unsigned long __initdata dma_reserve;
 
 #ifdef CONFIG_ARCH_POPULATES_NODE_MAP
   /*
@@ -2459,6 +2460,20 @@ unsigned long __init zone_absent_pages_i
 				arch_zone_lowest_possible_pfn[zone_type],
 				arch_zone_highest_possible_pfn[zone_type]);
 }
+
+/* Return the zone index a PFN is in */
+int memmap_zone_idx(struct page *lmem_map)
+{
+	int i;
+	unsigned long phys_addr = virt_to_phys(lmem_map);
+	unsigned long pfn = phys_addr >> PAGE_SHIFT;
+
+	for (i = 0; i < MAX_NR_ZONES; i++)
+		if (pfn < arch_zone_highest_possible_pfn[i])
+			break;
+
+	return i;
+}
 #else
 static inline unsigned long zone_spanned_pages_in_node(int nid,
 					unsigned long zone_type,
@@ -2476,6 +2491,11 @@ static inline unsigned long zone_absent_
 
 	return zholes_size[zone_type];
 }
+
+static inline int memmap_zone_idx(struct page *lmem_map)
+{
+	return MAX_NR_ZONES;
+}
 #endif
 
 static void __init calculate_node_totalpages(struct pglist_data *pgdat,
@@ -2499,6 +2519,58 @@ static void __init calculate_node_totalp
 							realtotalpages);
 }
 
+#ifdef CONFIG_FLAT_NODE_MEM_MAP
+/* Account for mem_map for CONFIG_FLAT_NODE_MEM_MAP */
+unsigned long __meminit account_memmap(struct pglist_data *pgdat,
+						int zone_index)
+{
+	unsigned long pages = 0;
+	if (zone_index == memmap_zone_idx(pgdat->node_mem_map)) {
+		pages = pgdat->node_spanned_pages;
+		pages = (pages * sizeof(struct page)) >> PAGE_SHIFT;
+		printk(KERN_DEBUG "%lu pages used for memmap\n", pages);
+	}
+	return pages;
+}
+#else
+/* Account for mem_map for CONFIG_SPARSEMEM */
+unsigned long account_memmap(struct pglist_data *pgdat, int zone_index)
+{
+	unsigned long pages = 0;
+	unsigned long memmap_pfn;
+	struct page *memmap_addr;
+	int pnum;
+	unsigned long pgdat_startpfn, pgdat_endpfn;
+	struct mem_section *section;
+
+	pgdat_startpfn = pgdat->node_start_pfn;
+	pgdat_endpfn = pgdat_startpfn + pgdat->node_spanned_pages;
+
+	/* Go through valid sections looking for memmap */
+	for (pnum = 0; pnum < NR_MEM_SECTIONS; pnum++) {
+		if (!valid_section_nr(pnum))
+			continue;
+
+		section = __nr_to_section(pnum);
+		if (!section_has_mem_map(section))
+			continue;
+
+		memmap_addr = __section_mem_map_addr(section);
+		memmap_pfn = (unsigned long)memmap_addr >> PAGE_SHIFT;
+
+		if (memmap_pfn < pgdat_startpfn || memmap_pfn >= pgdat_endpfn)
+			continue;
+
+		if (zone_index == memmap_zone_idx(memmap_addr))
+			pages += (PAGES_PER_SECTION * sizeof(struct page));
+	}
+
+	pages >>= PAGE_SHIFT;
+	printk(KERN_DEBUG "%lu pages used for SPARSE memmap\n", pages);
+	return pages;
+}
+#endif
+
 /*
  * Set up the zone data structures:
  *   - mark all pages reserved
@@ -2525,6 +2597,15 @@ static void __meminit free_area_init_cor
 		size = zone_spanned_pages_in_node(nid, j, zones_size);
 		realsize = size - zone_absent_pages_in_node(nid, j,
 								zholes_size);
+
+		realsize -= account_memmap(pgdat, j);
+		/* Account for reserved DMA pages */
+		if (j == ZONE_DMA && realsize > dma_reserve) {
+			realsize -= dma_reserve;
+			printk(KERN_DEBUG "%lu pages DMA reserved\n",
+								dma_reserve);
+		}
+
 		if (j < ZONE_HIGHMEM)
 			nr_kernel_pages += realsize;
 		nr_all_pages += realsize;
@@ -2849,6 +2930,21 @@ void __init free_area_init_nodes(unsigne
 }
 #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
 
+/**
+ * set_dma_reserve - Account the specified number of pages reserved in ZONE_DMA
+ * @new_dma_reserve - The number of pages to mark reserved
+ *
+ * The per-cpu batchsize and zone watermarks are determined by present_pages.
+ * In the DMA zone, a significant percentage may be consumed by kernel image
+ * and other unfreeable allocations which can skew the watermarks badly. This
+ * function may optionally be used to account for unfreeable pages in
+ * ZONE_DMA. The effect will be lower watermarks and smaller per-cpu batchsize
+ */
+void __init set_dma_reserve(unsigned long new_dma_reserve)
+{
+	dma_reserve = new_dma_reserve;
+}
+
 #ifndef CONFIG_NEED_MULTIPLE_NODES
 static bootmem_data_t contig_bootmem_data;
 struct pglist_data contig_page_data = { .bdata = &contig_bootmem_data };

-- 
-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

^ permalink raw reply

* Re: [Alsa-devel] [RFC 00/12] snd-aoa: add snd-aoa
From: Takashi Iwai @ 2006-06-09 12:34 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linuxppc-dev, alsa-devel, netstar
In-Reply-To: <1149855749.3864.21.camel@johannes.berg>

At Fri, 09 Jun 2006 14:22:29 +0200,
Johannes Berg wrote:
> 
> On Wed, 2006-06-07 at 20:22 +0200, Takashi Iwai wrote:
> 
> > Yes, I'll apply the patch to snd-powermac separately.
> 
> Ok.
> 
> 
> > Both for snd-aoa addition and for dropping layout-id support from
> > snd-powermac, please.
> 
> Will do. How do you want the code? Should I post the final version as
> mails again or just provide two download URLs with two patches and
> appropriate changelogs?

I don't mind both ways any more at this stage.  It's up to you.


thanks,

Takashi

^ permalink raw reply

* Re: [Alsa-devel] [RFC 05/12] snd-aoa: add i2sbus
From: Takashi Iwai @ 2006-06-09 12:23 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linuxppc-dev, alsa-devel, netstar
In-Reply-To: <1149855230.3864.19.camel@johannes.berg>

At Fri, 09 Jun 2006 14:13:49 +0200,
Johannes Berg wrote:
> 
> > ALSA has a helper function
> > release_and_free_resource() that also does NULL check and kfree:
> 
> Why's that helper in alsa of all things? :)

Yeah it's worth for core stuff indeed.


Takashi

^ permalink raw reply

* Re: [Alsa-devel] [RFC 00/12] snd-aoa: add snd-aoa
From: Johannes Berg @ 2006-06-09 12:22 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linuxppc-dev, alsa-devel, netstar
In-Reply-To: <s5hhd2w4yh2.wl%tiwai@suse.de>

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

On Wed, 2006-06-07 at 20:22 +0200, Takashi Iwai wrote:

> Yes, I'll apply the patch to snd-powermac separately.

Ok.


> Both for snd-aoa addition and for dropping layout-id support from
> snd-powermac, please.

Will do. How do you want the code? Should I post the final version as
mails again or just provide two download URLs with two patches and
appropriate changelogs?

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 793 bytes --]

^ permalink raw reply

* Re: [Alsa-devel] [RFC 05/12] snd-aoa: add i2sbus
From: Johannes Berg @ 2006-06-09 12:13 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linuxppc-dev, alsa-devel, netstar
In-Reply-To: <s5hfyig4xhm.wl%tiwai@suse.de>

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

On Wed, 2006-06-07 at 20:44 +0200, Takashi Iwai wrote:
> > +	if (I2S_CLOCK_SPEED_18MHz % (rate * mclk) == 0) {
> > +		if (!i2s_sf_mclkdiv(I2S_CLOCK_SPEED_18MHz / rate / mclk, out)) {
> 
> I'd use "I2S_CLOCK_SPEED_18MHZ / (rate * mclk)"

Yeah, I guess that's clearer then if the multiplication is there twice.

> release_resource() doesn't kfree the record returned from
> request_mem_region().  

Hah, ouch. I'll go through and fix them all.

> ALSA has a helper function
> release_and_free_resource() that also does NULL check and kfree:

Why's that helper in alsa of all things? :)

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 793 bytes --]

^ permalink raw reply

* Re: [Alsa-devel] [RFC 11/12] snd-aoa: add Kconfig and Makefile
From: Johannes Berg @ 2006-06-09 12:10 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linuxppc-dev, alsa-devel, netstar
In-Reply-To: <s5hejy04x7k.wl%tiwai@suse.de>

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

On Wed, 2006-06-07 at 20:50 +0200, Takashi Iwai wrote:

> Let's remove EXPERIMENTAL.  Or keep snd-powermac untouched.

Good point. It's been working for lots of people and I'm almost done
verifying that it works for all that snd-powermac handled, so I'll
remove the EXPERIMENTAL.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 793 bytes --]

^ permalink raw reply

* Re: [Alsa-devel] [RFC 03/12] snd-aoa: add aoa core
From: Johannes Berg @ 2006-06-09 12:10 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linuxppc-dev, alsa-devel, netstar
In-Reply-To: <s5hk67s4ywh.wl%tiwai@suse.de>

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

On Wed, 2006-06-07 at 20:13 +0200, Takashi Iwai wrote:
> At Wed, 07 Jun 2006 15:09:12 +0200,
> Johannes Berg wrote:
> > 
> > --- /dev/null
> > +++ b/sound/aoa/core/snd-aoa-gpio-pmf.c
> (snip)
> > +void pmf_handle_notify_irq(void *data)
> > +{
> 
> Missing static.

Added, thanks.

> > --- /dev/null
> > +++ b/sound/aoa/core/snd-aoa-gpio-feature.c
> (snip)
> > +static struct device_node *get_gpio(
> > +	char *name, char *altname, int *gpioptr, int *gpioactiveptr)
> 
> Unconventional style.

Heh ok, fixed.

> > +irqreturn_t ftr_handle_notify_irq(int xx, void *data, struct pt_regs *regs)
> > +{
> 
> Missing static.

Added.

> > +static int ftr_set_notify(struct gpio_runtime *rt,
> > +			  enum notify_type type,
> > +			  notify_func_t notify,
> > +			  void *data)
> (snip)
> > +	if (old && !notify) {
> > +		free_irq(irq, notif);
> > +	}
> > +	if (!old && notify) {
> > +		request_irq(irq, ftr_handle_notify_irq, 0, name, notif);
> > +	}
> 
> Remove braces.  

Right.

> Any error check from request_irq()?

Ah, I figured it didn't matter, but it indeed does. Fixed.

johannes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 793 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