Re: ramdisk size is larger than 4MB
> I did more debugging and something is really weird though. When the > link address is changed to 0x80, when stepping through the kernel, > I actually got the kernel boot successfully. However I let the kernel > run through it would just crash. After crash the BDI2000 shows it > stopped at __delay(). Well, actually it's nothing to do with gdb. When the link address is changed to 0x80, if the PPC_EARLY_DEBUG and PPC_EARLY_DEBUG_CPM are on, the built kernel can boot successfully. But without these EARLY_DEBUG, the kernel fails to boot. => bootm 500 ## Booting image at 0500 ... Image Name: Linux-2.6.33.5 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size:1757354 Bytes = 1.7 MB Load Address: 0080 Entry Point: 00800554 Verifying Checksum ... OK Uncompressing Kernel Image ... OK Memory <- <0x0 0x800> (128MB) ENET0: local-mac-address <- 00:09:9b:01:58:64 CPU clock-frequency <- 0x7270e00 (120MHz) CPU timebase-frequency <- 0x7270e0 (8MHz) CPU bus-frequency <- 0x3938700 (60MHz) zImage starting: loaded at 0x0080 (sp: 0x07d1cbd0) Allocating 0x3a15a4 bytes for kernel ... gunzipping (0x <- 0x0080c000:0x00bd702c)...done 0x3886ec bytes Linux/PowerPC load: root=/dev/ram Finalizing device tree... flat tree at 0xbe4300 ^^The kernel stopped here. => bootm 500 ## Booting image at 0500 ... Image Name: Linux-2.6.33.5 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size:1757742 Bytes = 1.7 MB Load Address: 0080 Entry Point: 00800554 Verifying Checksum ... OK Uncompressing Kernel Image ... OK Memory <- <0x0 0x800> (128MB) ENET0: local-mac-address <- 00:09:9b:01:58:64 CPU clock-frequency <- 0x7270e00 (120MHz) CPU timebase-frequency <- 0x7270e0 (8MHz) CPU bus-frequency <- 0x3938700 (60MHz) zImage starting: loaded at 0x0080 (sp: 0x07d1cbd0) Allocating 0x3a15a4 bytes for kernel ... gunzipping (0x <- 0x0080c000:0x00bd702c)...done 0x3886ec bytes Linux/PowerPC load: root=/dev/ram Finalizing device tree... flat tree at 0xbe4300 id mach(): done MMU:enter MMU:hw init MMU:mapin MMU:setio MMU:exit Using My MPC870 machine description Linux version 2.6.33.5 (sh...@ubuntu) (gcc version 4.2.2) #5 Tue Aug 3 21:24:40 PDT 2010 bootconsole [udbg0] enabled ^The kernel continued booting. With the EARLY_DEBUG turned on, the link address is changed to 0x100, the built kernel can also boot successfully. However if the link address is changed to 0x200 or 0x400, the built kernel fails to boot. I think the kernel failure may be caused by some memory corruption. But will the bootwrapper relocation corrupt the kernel code? Thanks, -Shawn. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] memblock: Fix memblock_is_region_reserved() to return a boolean
All callers expect a boolean result which is true if the region overlaps a reserved region. However, the implementation actually returns -1 if there is no overlap, and a region index (0 based) if there is. Make it behave as callers (and common sense) expect. Signed-off-by: Benjamin Herrenschmidt --- Taking that out of my memblock rework branch as it should go in now regardless of whether my stuff goes or not (which is still under discussion, I'm fixing ARM up now). I'll send this fix to Linus tomorrow along with powerpc.git if there is no adverse comment. diff --git a/mm/memblock.c b/mm/memblock.c index 3024eb3..43840b3 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -504,7 +504,7 @@ int __init memblock_is_reserved(u64 addr) int memblock_is_region_reserved(u64 base, u64 size) { - return memblock_overlaps_region(&memblock.reserved, base, size); + return memblock_overlaps_region(&memblock.reserved, base, size) >= 0; } /* ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH 2/3] P4080/mtd: Only make elbc nand driver detect nand flash partitions
> -Original Message- > From: Kumar Gala [mailto:ga...@kernel.crashing.org] > Sent: Tuesday, August 03, 2010 20:58 PM > To: Zang Roy-R61911 > Cc: linuxppc-...@ozlabs.org list; Lan Chunhe-B25806; Gala Kumar-B11780 > Subject: Re: [PATCH 2/3] P4080/mtd: Only make elbc nand > driver detect nand flash partitions > > > On Aug 2, 2010, at 11:45 PM, Roy Zang wrote: > > > From: Lan Chunhe-B25806 > > > > The former driver had the two functions: > > > > 1. detecting nand flash partitions; > > 2. registering elbc interrupt. > > > > Now, second function is removed to fsl_lbc.c. > > > > Signed-off-by: Lan Chunhe-B25806 > > Signed-off-by: Roy Zang > > --- > > drivers/mtd/nand/Kconfig |1 + > > drivers/mtd/nand/fsl_elbc_nand.c | 464 > ++ > > 2 files changed, 170 insertions(+), 295 deletions(-) > > mtd list and maintainer should be CC'd on these. Make sense. I will forward these patch to mtd list. Thanks. Roy ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH 1/3 v2] sdhci: Add auto CMD12 support for eSDHC driver
> -Original Message- > From: Andrew Morton [mailto:a...@linux-foundation.org] > Sent: Wednesday, August 04, 2010 7:44 AM > To: Zang Roy-R61911 > Cc: linux-...@vger.kernel.org; linuxppc-...@ozlabs.org > Subject: Re: [PATCH 1/3 v2] sdhci: Add auto CMD12 support for > eSDHC driver > > On Tue, 3 Aug 2010 11:11:10 +0800 > Roy Zang wrote: > > > --- a/drivers/mmc/host/sdhci.h > > +++ b/drivers/mmc/host/sdhci.h > > @@ -240,6 +240,8 @@ struct sdhci_host { > > #define SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN (1<<25) > > /* Controller cannot support End Attribute in NOP ADMA > descriptor */ > > #define SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC (1<<26) > > +/* Controller uses Auto CMD12 command to stop the transfer */ > > +#define SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 (1<<27) > > This becomes 1<<29 in my tree. It also works. > > We're about to run out. :-( >What happens then? Rewrite the code to extend some bits, I suppose. Roy ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/3 v2] sdhci: Add auto CMD12 support for eSDHC driver
On Tue, 3 Aug 2010 11:11:10 +0800 Roy Zang wrote: > --- a/drivers/mmc/host/sdhci.h > +++ b/drivers/mmc/host/sdhci.h > @@ -240,6 +240,8 @@ struct sdhci_host { > #define SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN(1<<25) > /* Controller cannot support End Attribute in NOP ADMA descriptor */ > #define SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC(1<<26) > +/* Controller uses Auto CMD12 command to stop the transfer */ > +#define SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 (1<<27) This becomes 1<<29 in my tree. We're about to run out. What happens then? ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/3] powerpc: Optimise 64bit csum_partial
> > Hi Segher, > >> Not really. Do you know how many 16/32-bit words you can add before a >> 64-bit register can overflow? :-) > > Thats a very good point. I thought about using 32bit adds when writing > the copy and checksum routine, but came to the conclusion that it wouldn't > go > any faster than one using addes. Well, you now have one 64-bit word in two cycles, using one load and an adde. You can do 64-bits with two loads and two integer insns instead, or one load and three integer insns. It depends on your pipeline structure what is best, I don't remember what POWER6/7 have exactly, but I bet you do :-) If you don't have to deal with the carry, you don't have to care about the latency of your insns either, since you can just software pipeline it. > The checksum only routine was the same > loop > without the stores. The stores are just to copy, right? So two loads/two stores/two integer (per 64-bit), which probably works out to two cycles; or one load/ one store/ three integer, which is one or one and a half cycle. Segher ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/3] powerpc: Optimise 64bit csum_partial
Hi Segher, > Not really. Do you know how many 16/32-bit words you can add before a > 64-bit register can overflow? :-) Thats a very good point. I thought about using 32bit adds when writing the copy and checksum routine, but came to the conclusion that it wouldn't go any faster than one using addes. The checksum only routine was the same loop without the stores. We rarely use csum_partial now we have copy and checksum to and from user now, but I'll take a look at speeding it up in a follow on patch. Thanks! Anton ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc/kdump: Stop all other CPUs before running crash handlers
Anton Blanchard wrote: > During kdump we run the crash handlers first then stop all other CPUs. > We really want to stop all CPUs as close to the fail as possible and also > have a very controlled environment for running the crash handlers, so it > makes sense to reverse the order. > > Signed-off-by: Anton Blanchard Looks like a sensible idea! Acked-by: Matt Evans > --- > > Index: powerpc.git/arch/powerpc/kernel/crash.c > === > --- powerpc.git.orig/arch/powerpc/kernel/crash.c 2010-07-15 > 20:49:39.941991306 +1000 > +++ powerpc.git/arch/powerpc/kernel/crash.c 2010-08-03 16:36:08.451991018 > +1000 > @@ -402,6 +402,18 @@ void default_machine_crash_shutdown(stru >*/ > hard_irq_disable(); > > + /* > + * Make a note of crashing cpu. Will be used in machine_kexec > + * such that another IPI will not be sent. > + */ > + crashing_cpu = smp_processor_id(); > + crash_save_cpu(regs, crashing_cpu); > + crash_kexec_prepare_cpus(crashing_cpu); > + cpu_set(crashing_cpu, cpus_in_crash); > +#if defined(CONFIG_PPC_STD_MMU_64) && defined(CONFIG_SMP) > + crash_kexec_wait_realmode(crashing_cpu); > +#endif > + > for_each_irq(i) { > struct irq_desc *desc = irq_to_desc(i); > > @@ -438,18 +450,8 @@ void default_machine_crash_shutdown(stru > crash_shutdown_cpu = -1; > __debugger_fault_handler = old_handler; > > - /* > - * Make a note of crashing cpu. Will be used in machine_kexec > - * such that another IPI will not be sent. > - */ > - crashing_cpu = smp_processor_id(); > - crash_save_cpu(regs, crashing_cpu); > - crash_kexec_prepare_cpus(crashing_cpu); > - cpu_set(crashing_cpu, cpus_in_crash); > crash_kexec_stop_spus(); > -#if defined(CONFIG_PPC_STD_MMU_64) && defined(CONFIG_SMP) > - crash_kexec_wait_realmode(crashing_cpu); > -#endif > + > if (ppc_md.kexec_cpu_down) > ppc_md.kexec_cpu_down(1, 0); > } ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 8/9] arch/powerpc/kernel: Drop unnecessary null test
On Tue, Aug 3, 2010 at 3:51 PM, Dan Carpenter wrote: > On Tue, Aug 03, 2010 at 11:35:17PM +0200, Julia Lawall wrote: >> diff --git a/arch/powerpc/kernel/pci_of_scan.c >> b/arch/powerpc/kernel/pci_of_scan.c >> index 6ddb795..62dd363 100644 >> --- a/arch/powerpc/kernel/pci_of_scan.c >> +++ b/arch/powerpc/kernel/pci_of_scan.c >> @@ -336,8 +336,7 @@ static void __devinit __of_scan_bus(struct device_node >> *node, >> if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || >> dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) { >> struct device_node *child = pci_device_to_OF_node(dev); >> - if (dev) >> - of_scan_pci_bridge(child, dev); >> + of_scan_pci_bridge(child, dev); > > The intention was probably to check "child" instead of "dev". > pci_device_to_OF_node() can return NULL. On the other hand the code > has been this way for a year and no one has complained... Still, it should be fixed. It is likely that I'll be generalizing this code for other architectures in the near future. I'll spin a patch. g. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 8/9] arch/powerpc/kernel: Drop unnecessary null test
On Tue, Aug 03, 2010 at 11:35:17PM +0200, Julia Lawall wrote: > diff --git a/arch/powerpc/kernel/pci_of_scan.c > b/arch/powerpc/kernel/pci_of_scan.c > index 6ddb795..62dd363 100644 > --- a/arch/powerpc/kernel/pci_of_scan.c > +++ b/arch/powerpc/kernel/pci_of_scan.c > @@ -336,8 +336,7 @@ static void __devinit __of_scan_bus(struct device_node > *node, > if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || > dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) { > struct device_node *child = pci_device_to_OF_node(dev); > - if (dev) > - of_scan_pci_bridge(child, dev); > + of_scan_pci_bridge(child, dev); The intention was probably to check "child" instead of "dev". pci_device_to_OF_node() can return NULL. On the other hand the code has been this way for a year and no one has complained... regards, dan carpenter > } > } > } ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 8/9] arch/powerpc/kernel: Drop unnecessary null test
From: Julia Lawall list_for_each_entry binds its first argument to a non-null value, and thus any null test on the value of that argument is superfluous. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ iterator I; expression x,E,E1,E2; statement S,S1,S2; @@ I(x,...) { <... - if (x != NULL || ...) S ...> } // Signed-off-by: Julia Lawall --- arch/powerpc/kernel/pci_of_scan.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c index 6ddb795..62dd363 100644 --- a/arch/powerpc/kernel/pci_of_scan.c +++ b/arch/powerpc/kernel/pci_of_scan.c @@ -336,8 +336,7 @@ static void __devinit __of_scan_bus(struct device_node *node, if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) { struct device_node *child = pci_device_to_OF_node(dev); - if (dev) - of_scan_pci_bridge(child, dev); + of_scan_pci_bridge(child, dev); } } } ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 4/9] arch/powerpc/platforms/powermac: Drop unnecessary null test
From: Julia Lawall for_each_node_by_name binds its first argument to a non-null value, and thus any null test on the value of that argument is superfluous. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ iterator I; expression x,E; @@ I(x,...) { <... ( - (x != NULL) && E ...> } // Signed-off-by: Julia Lawall --- arch/powerpc/platforms/powermac/feature.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c index 9e1b9fd..537957b 100644 --- a/arch/powerpc/platforms/powermac/feature.c +++ b/arch/powerpc/platforms/powermac/feature.c @@ -2867,7 +2867,7 @@ set_initial_features(void) /* Switch airport off */ for_each_node_by_name(np, "radio") { - if (np && np->parent == macio_chips[0].of_node) { + if (np->parent == macio_chips[0].of_node) { macio_chips[0].flags |= MACIO_FLAG_AIRPORT_ON; core99_airport_enable(np, 0, 0); } ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] arch/powerpc: Drop unnecessary of_node_put
From: Julia Lawall for_each_node_by_name only exits when its first argument is NULL, and a subsequent call to of_node_put on that argument is unnecessary. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ iterator name for_each_node_by_name; expression np,E; identifier l; @@ for_each_node_by_name(np,...) { ... when != break; when != goto l; } ... when != np = E - of_node_put(np); // Signed-off-by: Julia Lawall --- arch/powerpc/platforms/powermac/feature.c |1 - arch/powerpc/platforms/powermac/pci.c |2 -- 2 files changed, 3 deletions(-) diff -u -p a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c --- a/arch/powerpc/platforms/powermac/feature.c +++ b/arch/powerpc/platforms/powermac/feature.c @@ -2872,7 +2872,6 @@ set_initial_features(void) core99_airport_enable(np, 0, 0); } } - of_node_put(np); } /* On all machines that support sound PM, switch sound off */ diff -u -p a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c --- a/arch/powerpc/platforms/powermac/pci.c +++ b/arch/powerpc/platforms/powermac/pci.c @@ -1155,13 +1155,11 @@ void __init pmac_pcibios_after_init(void pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, nd, 0, 0); } } - of_node_put(nd); for_each_node_by_name(nd, "ethernet") { if (nd->parent && of_device_is_compatible(nd, "gmac") && of_device_is_compatible(nd->parent, "uni-north")) pmac_call_feature(PMAC_FTR_GMAC_ENABLE, nd, 0, 0); } - of_node_put(nd); } void pmac_pci_fixup_cardbus(struct pci_dev* dev) ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: Commit 3da34aa brakes MSI support on MPC8308 (possibly all MPC83xx) [REPOST]
Hello Kumar, hello Kim, can you _please_ comment? Thanks. In message <20100729212043.4258c152...@gemini.denx.de> I wrote: > Dear Kumar & Kim, > > any comments on this issue? > > Thanks. > > In message <4c48b384.1020...@emcraft.com> Ilya Yanok wrote: > > Hi Kumar, Kim, Josh, everybody, > > > > I hope to disturb you but I haven't got any reply for my first posting... > > > > I've found that MSI work correctly with older kernels on my MPC8308RDB > > board and don't work with newer ones. After bisecting I've found that > > the source of the problem is commit 3da34aa: > > > > commit 3da34aae03d498ee62f75aa7467de93cce3030fd > > Author: Kumar Gala > > Date: Tue May 12 15:51:56 2009 -0500 > > > > powerpc/fsl: Support unique MSI addresses per PCIe Root Complex > > > > Its feasible based on how the PCI address map is setup that the region > > of PCI address space used for MSIs differs for each PHB on the same > > SoC. > > > > Instead of assuming that the address mappes to CCSRBAR 1:1 we read > > PEXCSRBAR (BAR0) for the PHB that the given pci_dev is on. > > > > Signed-off-by: Kumar Gala > > > > I can see BAR0 initialization for 85xx/86xx hardware but not for 83xx > > neigher in the kernel nor in U-Boot (that makes me think that all 83xx > > can be affected). > > I'm not actually an PCI expert so I've just tried to write IMMR base > > address to the BAR0 register from the U-Boot to get the correct address > > but this doesn't help. > > Please direct me how to init 83xx PCIE controller to make it compatible > > with this patch. > > > > Kim, I think MPC8315E is affected too, could you please test it? > > > > Thanks in advance. > > > > Regards, Ilya. > > Best regards, > > Wolfgang Denk Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de In the beginning, there was nothing, which exploded. - Terry Pratchett, _Lords and Ladies_ ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 00/27] KVM PPC PV framework v3
On Sun, 1 Aug 2010 22:21:37 +0200 Alexander Graf wrote: > > On 01.08.2010, at 16:02, Avi Kivity wrote: > > > Looks reasonable. Since it's fair to say I understand nothing about > > powerpc, I'd like someone who does to review it and ack, please, with an > > emphasis on the interfaces. > > Sounds good. Preferably someone with access to the ePAPR spec :). The ePAPR-relevant stuff in patches 7, 16, and 17 looks reasonable. Did I miss any ePAPR-relevant stuff in the other patches? -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc: Dont require a dma_ops struct to set dma mask
- Original Message > From: Kumar Gala > To: linuxppc-...@ozlabs.org > Sent: Mon, August 2, 2010 12:21:22 PM > Subject: [PATCH] powerpc: Dont require a dma_ops struct to set dma mask > > The only reason to require a dma_ops struct is to see if it has > implemented set_dma_mask. If not we can fall back to setting the mask > directly. > > This resolves an issue with how to sequence the setting of a DMA mask > for platform devices. Before we had an issue in that we have no way of > setting the DMA mask before the various low level bus notifiers get > called that might check it (swiotlb). > > So now we can do: > > pdev = platform_device_alloc("foobar", 0); > dma_set_mask(&pdev->dev, DMA_BIT_MASK(37)); > platform_device_register(pdev); > > And expect the right thing to happen with the bus notifiers get called > via platform_device_register. > > Signed-off-by: Kumar Gala > --- > arch/powerpc/include/asm/dma-mapping.h |4 +--- > 1 files changed, 1 insertions(+), 3 deletions(-) > > diff --git a/arch/powerpc/include/asm/dma-mapping.h >b/arch/powerpc/include/asm/dma-mapping.h > index c85ef23..17d5c17 100644 > --- a/arch/powerpc/include/asm/dma-mapping.h > +++ b/arch/powerpc/include/asm/dma-mapping.h > @@ -131,9 +131,7 @@ static inline int dma_set_mask(struct device *dev, u64 >dma_mask) > { > struct dma_map_ops *dma_ops = get_dma_ops(dev); > > -if (unlikely(dma_ops == NULL)) > -return -EIO; > -if (dma_ops->set_dma_mask != NULL) > +if (unlikely(dma_ops == NULL) && (dma_ops->set_dma_mask != NULL)) > return dma_ops->set_dma_mask(dev, dma_mask); > if (!dev->dma_mask || !dma_supported(dev, dma_mask)) > return -EIO; > -- > 1.6.0.6 > > ___ > Linuxppc-dev mailing list > Linuxppc-dev@lists.ozlabs.org > https://lists.ozlabs.org/listinfo/linuxppc-dev > Isn't that test wrong? Perhaps you meant to test for dma_ops non-null before dereferencing it? -roger ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/3] powerpc: Optimise 64bit csum_partial
On both POWER6 and POWER7 this should be as fast as we can go since we are limited by the latency of the adde instructions. Not really. Do you know how many 16/32-bit words you can add before a 64-bit register can overflow? :-) If you ever have to call this with more than 16GB of data to sum, that's easy to handle as well of course (just break it into pieces). Segher ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 9/9] v4 Update memory-hotplug documentation
Update the memory hotplug documentation to reflect the new behaviors of memory blocks reflected in sysfs. Signed-off-by: Nathan Fontenot --- Documentation/memory-hotplug.txt | 40 +++ 1 file changed, 24 insertions(+), 16 deletions(-) Index: linux-2.6/Documentation/memory-hotplug.txt === --- linux-2.6.orig/Documentation/memory-hotplug.txt 2010-08-02 14:09:28.0 -0500 +++ linux-2.6/Documentation/memory-hotplug.txt 2010-08-02 14:10:36.0 -0500 @@ -126,36 +126,44 @@ config options. 4 sysfs files for memory hotplug -All sections have their device information under /sys/devices/system/memory as +All sections have their device information in sysfs. Each section is part of +a memory block under /sys/devices/system/memory as /sys/devices/system/memory/memoryXXX -(XXX is section id.) +(XXX is the section id.) -Now, XXX is defined as start_address_of_section / section_size. +Now, XXX is defined as (start_address_of_section / section_size) of the first +section contained in the memory block. For example, assume 1GiB section size. A device for a memory starting at 0x1 is /sys/device/system/memory/memory4 (0x1 / 1Gib = 4) This device covers address range [0x1 ... 0x14000) -Under each section, you can see 4 files. +Under each section, you can see 5 files. -/sys/devices/system/memory/memoryXXX/phys_index +/sys/devices/system/memory/memoryXXX/start_phys_index +/sys/devices/system/memory/memoryXXX/end_phys_index /sys/devices/system/memory/memoryXXX/phys_device /sys/devices/system/memory/memoryXXX/state /sys/devices/system/memory/memoryXXX/removable -'phys_index' : read-only and contains section id, same as XXX. -'state' : read-write - at read: contains online/offline state of memory. - at write: user can specify "online", "offline" command -'phys_device': read-only: designed to show the name of physical memory device. - This is not well implemented now. -'removable' : read-only: contains an integer value indicating - whether the memory section is removable or not - removable. A value of 1 indicates that the memory - section is removable and a value of 0 indicates that - it is not removable. +'phys_index' : read-only and contains section id of the first section + in the memory block, same as XXX. +'end_phys_index' : read-only and contains section id of the last section + in the memory block. +'state' : read-write +at read: contains online/offline state of memory. +at write: user can specify "online", "offline" command +which will be performed on al sections in the block. +'phys_device' : read-only: designed to show the name of physical memory +device. This is not well implemented now. +'removable' : read-only: contains an integer value indicating +whether the memory block is removable or not +removable. A value of 1 indicates that the memory +block is removable and a value of 0 indicates that +it is not removable. A memory block is removable only if +every section in the block is removable. NOTE: These directories/files appear after physical memory hotplug phase. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
setting up of platform device archdata?
Greg, We are running into in issue in that we need the platform device archdata setup before platform_device_add gets called since we need some data in archdata setup to allow the bus notifiers to work properly. On PPC we need this to get the dma masks setup properly that we than use in the bus notifiers to determine if we need SWIOTLB support for a given device or not. Any suggestions on how to do this? Something like below? struct platform_device *platform_device_alloc(const char *name, int id) ... if (pa) { strcpy(pa->name, name); pa->pdev.name = pa->name; pa->pdev.id = id; device_initialize(&pa->pdev.dev); pa->pdev.dev.release = platform_device_release; #ifdef ARCH_HAS_PDEV_ARCHDATA_SETUP arch_setup_pdev_archdata(&pa->pdev.dev); #endif } - k ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 8/9] v4 Define memory_block_size_bytes() for ppc/pseries
Define a version of memory_block_size_bytes() for powerpc/pseries such that a memory block spans an entire lmb. Signed-off-by: Nathan Fontenot --- arch/powerpc/platforms/pseries/hotplug-memory.c | 66 +++- 1 file changed, 53 insertions(+), 13 deletions(-) Index: linux-2.6/arch/powerpc/platforms/pseries/hotplug-memory.c === --- linux-2.6.orig/arch/powerpc/platforms/pseries/hotplug-memory.c 2010-08-02 13:57:03.0 -0500 +++ linux-2.6/arch/powerpc/platforms/pseries/hotplug-memory.c 2010-08-02 14:09:52.0 -0500 @@ -17,6 +17,54 @@ #include #include +static u32 get_memblock_size(void) +{ + struct device_node *np; + unsigned int memblock_size = 0; + + np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); + if (np) { + const unsigned long *size; + + size = of_get_property(np, "ibm,lmb-size", NULL); + memblock_size = size ? *size : 0; + + of_node_put(np); + } else { + unsigned int memzero_size = 0; + const unsigned int *regs; + + np = of_find_node_by_path("/mem...@0"); + if (np) { + regs = of_get_property(np, "reg", NULL); + memzero_size = regs ? regs[3] : 0; + of_node_put(np); + } + + if (memzero_size) { + /* We now know the size of mem...@0, use this to find +* the first memoryblock and get its size. +*/ + char buf[64]; + + sprintf(buf, "/mem...@%x", memzero_size); + np = of_find_node_by_path(buf); + if (np) { + regs = of_get_property(np, "reg", NULL); + memblock_size = regs ? regs[3] : 0; + of_node_put(np); + } + } + } + + return memblock_size; +} + +u32 memory_block_size_bytes(void) +{ + return get_memblock_size(); +} + static int pseries_remove_memblock(unsigned long base, unsigned int memblock_size) { unsigned long start, start_pfn; @@ -127,30 +175,22 @@ static int pseries_add_memory(struct dev static int pseries_drconf_memory(unsigned long *base, unsigned int action) { - struct device_node *np; - const unsigned long *lmb_size; + unsigned long memblock_size; int rc; - np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); - if (!np) + memblock_size = get_memblock_size(); + if (!memblock_size) return -EINVAL; - lmb_size = of_get_property(np, "ibm,lmb-size", NULL); - if (!lmb_size) { - of_node_put(np); - return -EINVAL; - } - if (action == PSERIES_DRCONF_MEM_ADD) { - rc = memblock_add(*base, *lmb_size); + rc = memblock_add(*base, memblock_size); rc = (rc < 0) ? -EINVAL : 0; } else if (action == PSERIES_DRCONF_MEM_REMOVE) { - rc = pseries_remove_memblock(*base, *lmb_size); + rc = pseries_remove_memblock(*base, memblock_size); } else { rc = -EINVAL; } - of_node_put(np); return rc; } ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 7/9] v4 Update the node sysfs code
Update the node sysfs code to be aware of the new capability for a memory block to contain multiple memory sections. This requires an additional parameter to unregister_mem_sect_under_nodes so that we know which memory section of the memory block to unregister. Signed-off-by: Nathan Fontenot --- drivers/base/memory.c |2 +- drivers/base/node.c | 12 include/linux/node.h |6 -- 3 files changed, 13 insertions(+), 7 deletions(-) Index: linux-2.6/drivers/base/node.c === --- linux-2.6.orig/drivers/base/node.c 2010-08-02 13:57:20.0 -0500 +++ linux-2.6/drivers/base/node.c 2010-08-02 14:01:58.0 -0500 @@ -346,8 +346,10 @@ int register_mem_sect_under_node(struct return -EFAULT; if (!node_online(nid)) return 0; - sect_start_pfn = section_nr_to_pfn(mem_blk->phys_index); - sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1; + + sect_start_pfn = section_nr_to_pfn(mem_blk->start_phys_index); + sect_end_pfn = section_nr_to_pfn(mem_blk->end_phys_index); + sect_end_pfn += PAGES_PER_SECTION - 1; for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) { int page_nid; @@ -371,7 +373,8 @@ int register_mem_sect_under_node(struct } /* unregister memory section under all nodes that it spans */ -int unregister_mem_sect_under_nodes(struct memory_block *mem_blk) +int unregister_mem_sect_under_nodes(struct memory_block *mem_blk, + unsigned long phys_index) { NODEMASK_ALLOC(nodemask_t, unlinked_nodes, GFP_KERNEL); unsigned long pfn, sect_start_pfn, sect_end_pfn; @@ -383,7 +386,8 @@ int unregister_mem_sect_under_nodes(stru if (!unlinked_nodes) return -ENOMEM; nodes_clear(*unlinked_nodes); - sect_start_pfn = section_nr_to_pfn(mem_blk->phys_index); + + sect_start_pfn = section_nr_to_pfn(phys_index); sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1; for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) { int nid; Index: linux-2.6/drivers/base/memory.c === --- linux-2.6.orig/drivers/base/memory.c2010-08-02 14:01:04.0 -0500 +++ linux-2.6/drivers/base/memory.c 2010-08-02 14:01:58.0 -0500 @@ -555,9 +555,9 @@ int remove_memory_block(unsigned long no mutex_lock(&mem_sysfs_mutex); mem = find_memory_block(section); + unregister_mem_sect_under_nodes(mem, __section_nr(section)); if (atomic_dec_and_test(&mem->section_count)) { - unregister_mem_sect_under_nodes(mem); mem_remove_simple_file(mem, phys_index); mem_remove_simple_file(mem, end_phys_index); mem_remove_simple_file(mem, state); Index: linux-2.6/include/linux/node.h === --- linux-2.6.orig/include/linux/node.h 2010-08-02 13:57:20.0 -0500 +++ linux-2.6/include/linux/node.h 2010-08-02 14:01:58.0 -0500 @@ -44,7 +44,8 @@ extern int register_cpu_under_node(unsig extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid); extern int register_mem_sect_under_node(struct memory_block *mem_blk, int nid); -extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk); +extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk, + unsigned long phys_index); #ifdef CONFIG_HUGETLBFS extern void register_hugetlbfs_with_node(node_registration_func_t doregister, @@ -72,7 +73,8 @@ static inline int register_mem_sect_unde { return 0; } -static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk) +static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk, + unsigned long phys_index) { return 0; } ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 6/9] v4 Update the find_memory_block declaration
Update the find_memory_block declaration to to take a struct mem_section * so that it matches the definition. Signed-off-by: Nathan Fontenot --- include/linux/memory.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: linux-2.6/include/linux/memory.h === --- linux-2.6.orig/include/linux/memory.h 2010-08-02 13:58:41.0 -0500 +++ linux-2.6/include/linux/memory.h2010-08-02 14:01:15.0 -0500 @@ -116,7 +116,7 @@ extern int memory_dev_init(void); extern int remove_memory_block(unsigned long, struct mem_section *, int); extern int memory_notify(unsigned long val, void *v); extern int memory_isolate_notify(unsigned long val, void *v); -extern struct memory_block *find_memory_block(unsigned long); +extern struct memory_block *find_memory_block(struct mem_section *); extern int memory_is_hidden(struct mem_section *); #define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION
[PATCH 5/9] v4 Allow memory_block to span multiple memory sections
Update the memory sysfs code that each sysfs memory directory is now considered a memory block that can contain multiple memory sections per memory block. The default size of each memory block is SECTION_SIZE_BITS to maintain the current behavior of having a single memory section per memory block (i.e. one sysfs directory per memory section). For architectures that want to have memory blocks span multiple memory sections they need only define their own memory_block_size_bytes() routine. Signed-off-by: Nathan Fontenot --- drivers/base/memory.c | 148 ++ 1 file changed, 103 insertions(+), 45 deletions(-) Index: linux-2.6/drivers/base/memory.c === --- linux-2.6.orig/drivers/base/memory.c2010-08-02 13:45:34.0 -0500 +++ linux-2.6/drivers/base/memory.c 2010-08-02 14:01:04.0 -0500 @@ -30,6 +30,14 @@ static struct mutex mem_sysfs_mutex; #define MEMORY_CLASS_NAME "memory" +#define MIN_MEMORY_BLOCK_SIZE (1 << SECTION_SIZE_BITS) + +static int sections_per_block; + +static inline int base_memory_block_id(int section_nr) +{ + return (section_nr / sections_per_block) * sections_per_block; +} static struct sysdev_class memory_sysdev_class = { .name = MEMORY_CLASS_NAME, @@ -84,22 +92,21 @@ EXPORT_SYMBOL(unregister_memory_isolate_ * register_memory - Setup a sysfs device for a memory block */ static -int register_memory(struct memory_block *memory, struct mem_section *section) +int register_memory(struct memory_block *memory) { int error; memory->sysdev.cls = &memory_sysdev_class; - memory->sysdev.id = __section_nr(section); + memory->sysdev.id = memory->start_phys_index; error = sysdev_register(&memory->sysdev); return error; } static void -unregister_memory(struct memory_block *memory, struct mem_section *section) +unregister_memory(struct memory_block *memory) { BUG_ON(memory->sysdev.cls != &memory_sysdev_class); - BUG_ON(memory->sysdev.id != __section_nr(section)); /* drop the ref. we got in remove_memory_block() */ kobject_put(&memory->sysdev.kobj); @@ -133,13 +140,16 @@ static ssize_t show_mem_end_phys_index(s static ssize_t show_mem_removable(struct sys_device *dev, struct sysdev_attribute *attr, char *buf) { - unsigned long start_pfn; - int ret; + unsigned long i, pfn; + int ret = 1; struct memory_block *mem = container_of(dev, struct memory_block, sysdev); - start_pfn = section_nr_to_pfn(mem->start_phys_index); - ret = is_mem_section_removable(start_pfn, PAGES_PER_SECTION); + for (i = mem->start_phys_index; i <= mem->end_phys_index; i++) { + pfn = section_nr_to_pfn(i); + ret &= is_mem_section_removable(pfn, PAGES_PER_SECTION); + } + return sprintf(buf, "%d\n", ret); } @@ -192,17 +202,14 @@ int memory_isolate_notify(unsigned long * OK to have direct references to sparsemem variables in here. */ static int -memory_block_action(struct memory_block *mem, unsigned long action) +memory_section_action(unsigned long phys_index, unsigned long action) { int i; - unsigned long psection; unsigned long start_pfn, start_paddr; struct page *first_page; int ret; - int old_state = mem->state; - psection = mem->start_phys_index; - first_page = pfn_to_page(psection << PFN_SECTION_SHIFT); + first_page = pfn_to_page(phys_index << PFN_SECTION_SHIFT); /* * The probe routines leave the pages reserved, just @@ -215,8 +222,8 @@ memory_block_action(struct memory_block continue; printk(KERN_WARNING "section number %ld page number %d " - "not reserved, was it already online? \n", - psection, i); + "not reserved, was it already online?\n", + phys_index, i); return -EBUSY; } } @@ -227,18 +234,13 @@ memory_block_action(struct memory_block ret = online_pages(start_pfn, PAGES_PER_SECTION); break; case MEM_OFFLINE: - mem->state = MEM_GOING_OFFLINE; start_paddr = page_to_pfn(first_page) << PAGE_SHIFT; ret = remove_memory(start_paddr, PAGES_PER_SECTION << PAGE_SHIFT); - if (ret) { - mem->state = old_state; - break; - } break; default: - WARN(1, KERN_WARNING "%s(%p, %ld) unknown action: %ld\n", -
[PATCH 4/9] v4 Add mutex for add/remove of memory blocks
Add a new mutex for use in adding and removing of memory blocks. This is needed to avoid any race conditions in which the same memory block could be added and removed at the same time. Signed-off-by: Nathan Fontenot --- drivers/base/memory.c |9 + 1 file changed, 9 insertions(+) Index: linux-2.6/drivers/base/memory.c === --- linux-2.6.orig/drivers/base/memory.c2010-08-02 13:35:00.0 -0500 +++ linux-2.6/drivers/base/memory.c 2010-08-02 13:45:34.0 -0500 @@ -27,6 +27,8 @@ #include #include +static struct mutex mem_sysfs_mutex; + #define MEMORY_CLASS_NAME "memory" static struct sysdev_class memory_sysdev_class = { @@ -485,6 +487,8 @@ static int add_memory_block(int nid, str if (!mem) return -ENOMEM; + mutex_lock(&mem_sysfs_mutex); + mem->start_phys_index = __section_nr(section); mem->state = state; atomic_inc(&mem->section_count); @@ -508,6 +512,7 @@ static int add_memory_block(int nid, str ret = register_mem_sect_under_node(mem, nid); } + mutex_unlock(&mem_sysfs_mutex); return ret; } @@ -516,6 +521,7 @@ int remove_memory_block(unsigned long no { struct memory_block *mem; + mutex_lock(&mem_sysfs_mutex); mem = find_memory_block(section); if (atomic_dec_and_test(&mem->section_count)) { @@ -528,6 +534,7 @@ int remove_memory_block(unsigned long no unregister_memory(mem, section); } + mutex_unlock(&mem_sysfs_mutex); return 0; } @@ -562,6 +569,8 @@ int __init memory_dev_init(void) if (ret) goto out; + mutex_init(&mem_sysfs_mutex); + /* * Create entries for memory sections that were found * during boot and have been initialized ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 3/9] v4 Add section count to memory_block
Add a section count property to the memory_block struct to track the number of memory sections that have been added/removed from a memory block. This allows us to know when the last memory section of a memory block has been removed so we can remove the memory block. Signed-off-by: Nathan Fontenot --- drivers/base/memory.c | 18 +++--- include/linux/memory.h |2 ++ 2 files changed, 13 insertions(+), 7 deletions(-) Index: linux-2.6/drivers/base/memory.c === --- linux-2.6.orig/drivers/base/memory.c2010-08-02 13:33:27.0 -0500 +++ linux-2.6/drivers/base/memory.c 2010-08-02 13:35:00.0 -0500 @@ -487,6 +487,7 @@ static int add_memory_block(int nid, str mem->start_phys_index = __section_nr(section); mem->state = state; + atomic_inc(&mem->section_count); mutex_init(&mem->state_mutex); start_pfn = section_nr_to_pfn(mem->start_phys_index); mem->phys_device = arch_get_memory_phys_device(start_pfn); @@ -516,13 +517,16 @@ int remove_memory_block(unsigned long no struct memory_block *mem; mem = find_memory_block(section); - unregister_mem_sect_under_nodes(mem); - mem_remove_simple_file(mem, phys_index); - mem_remove_simple_file(mem, end_phys_index); - mem_remove_simple_file(mem, state); - mem_remove_simple_file(mem, phys_device); - mem_remove_simple_file(mem, removable); - unregister_memory(mem, section); + + if (atomic_dec_and_test(&mem->section_count)) { + unregister_mem_sect_under_nodes(mem); + mem_remove_simple_file(mem, phys_index); + mem_remove_simple_file(mem, end_phys_index); + mem_remove_simple_file(mem, state); + mem_remove_simple_file(mem, phys_device); + mem_remove_simple_file(mem, removable); + unregister_memory(mem, section); + } return 0; } Index: linux-2.6/include/linux/memory.h === --- linux-2.6.orig/include/linux/memory.h 2010-08-02 13:33:27.0 -0500 +++ linux-2.6/include/linux/memory.h2010-08-02 13:35:00.0 -0500 @@ -19,11 +19,13 @@ #include #include #include +#include struct memory_block { unsigned long start_phys_index; unsigned long end_phys_index; unsigned long state; + atomic_t section_count; /* * This serializes all state change requests. It isn't * held during creation because the control files are ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 2/9] v4 Add new phys_index properties
Update the 'phys_index' properties of a memory block to include a 'start_phys_index' which is the same as the current 'phys_index' property. The property still appears as 'phys_index' in sysfs but the memory_block struct name is updated to indicate the start and end values. This also adds an 'end_phys_index' property to indicate the id of the last section in th memory block. Signed-off-by: Nathan Fontenot --- drivers/base/memory.c | 28 include/linux/memory.h |3 ++- 2 files changed, 22 insertions(+), 9 deletions(-) Index: linux-2.6/drivers/base/memory.c === --- linux-2.6.orig/drivers/base/memory.c2010-08-02 13:32:21.0 -0500 +++ linux-2.6/drivers/base/memory.c 2010-08-02 13:33:27.0 -0500 @@ -109,12 +109,20 @@ unregister_memory(struct memory_block *m * uses. */ -static ssize_t show_mem_phys_index(struct sys_device *dev, +static ssize_t show_mem_start_phys_index(struct sys_device *dev, struct sysdev_attribute *attr, char *buf) { struct memory_block *mem = container_of(dev, struct memory_block, sysdev); - return sprintf(buf, "%08lx\n", mem->phys_index); + return sprintf(buf, "%08lx\n", mem->start_phys_index); +} + +static ssize_t show_mem_end_phys_index(struct sys_device *dev, + struct sysdev_attribute *attr, char *buf) +{ + struct memory_block *mem = + container_of(dev, struct memory_block, sysdev); + return sprintf(buf, "%08lx\n", mem->end_phys_index); } /* @@ -128,7 +136,7 @@ static ssize_t show_mem_removable(struct struct memory_block *mem = container_of(dev, struct memory_block, sysdev); - start_pfn = section_nr_to_pfn(mem->phys_index); + start_pfn = section_nr_to_pfn(mem->start_phys_index); ret = is_mem_section_removable(start_pfn, PAGES_PER_SECTION); return sprintf(buf, "%d\n", ret); } @@ -191,7 +199,7 @@ memory_block_action(struct memory_block int ret; int old_state = mem->state; - psection = mem->phys_index; + psection = mem->start_phys_index; first_page = pfn_to_page(psection << PFN_SECTION_SHIFT); /* @@ -264,7 +272,7 @@ store_mem_state(struct sys_device *dev, int ret = -EINVAL; mem = container_of(dev, struct memory_block, sysdev); - phys_section_nr = mem->phys_index; + phys_section_nr = mem->start_phys_index; if (!present_section_nr(phys_section_nr)) goto out; @@ -296,7 +304,8 @@ static ssize_t show_phys_device(struct s return sprintf(buf, "%d\n", mem->phys_device); } -static SYSDEV_ATTR(phys_index, 0444, show_mem_phys_index, NULL); +static SYSDEV_ATTR(phys_index, 0444, show_mem_start_phys_index, NULL); +static SYSDEV_ATTR(end_phys_index, 0444, show_mem_end_phys_index, NULL); static SYSDEV_ATTR(state, 0644, show_mem_state, store_mem_state); static SYSDEV_ATTR(phys_device, 0444, show_phys_device, NULL); static SYSDEV_ATTR(removable, 0444, show_mem_removable, NULL); @@ -476,16 +485,18 @@ static int add_memory_block(int nid, str if (!mem) return -ENOMEM; - mem->phys_index = __section_nr(section); + mem->start_phys_index = __section_nr(section); mem->state = state; mutex_init(&mem->state_mutex); - start_pfn = section_nr_to_pfn(mem->phys_index); + start_pfn = section_nr_to_pfn(mem->start_phys_index); mem->phys_device = arch_get_memory_phys_device(start_pfn); ret = register_memory(mem, section); if (!ret) ret = mem_create_simple_file(mem, phys_index); if (!ret) + ret = mem_create_simple_file(mem, end_phys_index); + if (!ret) ret = mem_create_simple_file(mem, state); if (!ret) ret = mem_create_simple_file(mem, phys_device); @@ -507,6 +518,7 @@ int remove_memory_block(unsigned long no mem = find_memory_block(section); unregister_mem_sect_under_nodes(mem); mem_remove_simple_file(mem, phys_index); + mem_remove_simple_file(mem, end_phys_index); mem_remove_simple_file(mem, state); mem_remove_simple_file(mem, phys_device); mem_remove_simple_file(mem, removable); Index: linux-2.6/include/linux/memory.h === --- linux-2.6.orig/include/linux/memory.h 2010-08-02 13:23:49.0 -0500 +++ linux-2.6/include/linux/memory.h2010-08-02 13:33:27.0 -0500 @@ -21,7 +21,8 @@ #include struct memory_block { - unsigned long phys_index; + unsigned long start_phys_index; + unsigned long end_phys_index; unsigned long state; /* * This serializes all state change requests. It isn't ___ Linuxppc-dev mailing list Linu
[PATCH 1/9] v4 Move the find_memory_block() routine up
Move the find_memory_block() routine up to avoid needing a forward declaration in subsequent patches. Signed-off-by: Nathan Fontenot --- drivers/base/memory.c | 62 +- 1 file changed, 31 insertions(+), 31 deletions(-) Index: linux-2.6/drivers/base/memory.c === --- linux-2.6.orig/drivers/base/memory.c2010-08-02 13:23:51.0 -0500 +++ linux-2.6/drivers/base/memory.c 2010-08-02 13:32:21.0 -0500 @@ -435,6 +435,37 @@ int __weak arch_get_memory_phys_device(u return 0; } +/* + * For now, we have a linear search to go find the appropriate + * memory_block corresponding to a particular phys_index. If + * this gets to be a real problem, we can always use a radix + * tree or something here. + * + * This could be made generic for all sysdev classes. + */ +struct memory_block *find_memory_block(struct mem_section *section) +{ + struct kobject *kobj; + struct sys_device *sysdev; + struct memory_block *mem; + char name[sizeof(MEMORY_CLASS_NAME) + 9 + 1]; + + /* +* This only works because we know that section == sysdev->id +* slightly redundant with sysdev_register() +*/ + sprintf(&name[0], "%s%d", MEMORY_CLASS_NAME, __section_nr(section)); + + kobj = kset_find_obj(&memory_sysdev_class.kset, name); + if (!kobj) + return NULL; + + sysdev = container_of(kobj, struct sys_device, kobj); + mem = container_of(sysdev, struct memory_block, sysdev); + + return mem; +} + static int add_memory_block(int nid, struct mem_section *section, unsigned long state, enum mem_add_context context) { @@ -468,37 +499,6 @@ static int add_memory_block(int nid, str return ret; } -/* - * For now, we have a linear search to go find the appropriate - * memory_block corresponding to a particular phys_index. If - * this gets to be a real problem, we can always use a radix - * tree or something here. - * - * This could be made generic for all sysdev classes. - */ -struct memory_block *find_memory_block(struct mem_section *section) -{ - struct kobject *kobj; - struct sys_device *sysdev; - struct memory_block *mem; - char name[sizeof(MEMORY_CLASS_NAME) + 9 + 1]; - - /* -* This only works because we know that section == sysdev->id -* slightly redundant with sysdev_register() -*/ - sprintf(&name[0], "%s%d", MEMORY_CLASS_NAME, __section_nr(section)); - - kobj = kset_find_obj(&memory_sysdev_class.kset, name); - if (!kobj) - return NULL; - - sysdev = container_of(kobj, struct sys_device, kobj); - mem = container_of(sysdev, struct memory_block, sysdev); - - return mem; -} - int remove_memory_block(unsigned long node_id, struct mem_section *section, int phys_device) { ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 0/9] v4 De-couple sysfs memory directories from memory sections
This set of patches de-couples the idea that there is a single directory in sysfs for each memory section. The intent of the patches is to reduce the number of sysfs directories created to resolve a boot-time performance issue. On very large systems boot time are getting very long (as seen on powerpc hardware) due to the enormous number of sysfs directories being created. On a system with 1 TB of memory we create ~63,000 directories. For even larger systems boot times are being measured in hours. This set of patches allows for each directory created in sysfs to cover more than one memory section. The default behavior for sysfs directory creation is the same, in that each directory represents a single memory section. A new file 'end_phys_index' in each directory contains the physical_id of the last memory section covered by the directory so that users can easily determine the memory section range of a directory. Updates for version 4 of the patchset includes an additional patch [4/9] that introduces a new mutex to be taken for any add or remove (not hotplug) of memory. The following updates are also included. Patch 2/9 Add new phys_index properties - The start_phys_index property was reverted to the original phys_index name. Patch 3/9 Add section count to memory_block - Use atomic_dec_and_test() Patch 7/9 Update the node sysfs code - Update the inline definition of unregister_mem_sects_under_nodes for !CONFIG_NUMA builds. Patch 8/9 Define memory_block_size_bytes() for ppc/pseries - Use an unsigned long for getting property value. Patch 9/9 Update memory-hotplug documentation - Minor updates for reversion of phys_index property name. Thanks, Nathan Fontenot ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH v2 5/7] powerpc/85xx: Add MChk handler for SRIO port
Yang Li pointed to these patches in his post from July 23, 2010. It would be nice to have these patches in mainline code. > -Original Message- > From: timur.t...@gmail.com [mailto:timur.t...@gmail.com] On Behalf Of Timur Tabi > Sent: Tuesday, August 03, 2010 9:02 AM > To: Bounine, Alexandre > Cc: Michael Neuling; Alexandre Bounine; linuxppc-dev@lists.ozlabs.org; linux-ker...@vger.kernel.org; > thomas.m...@sysgo.com; Kumar Gala > Subject: Re: [PATCH v2 5/7] powerpc/85xx: Add MChk handler for SRIO port > > On Tue, Aug 3, 2010 at 7:17 AM, Bounine, Alexandre > wrote: > > This happened after change to book-e definitions. > > There are patches that address this issue. > > And those patches should have been applied before 2.6.35 was released. > Someone dropped the ball. 2.6.35 is broken for a number of PowerPC > boards: > > $ make mpc85xx_defconfig > > $ make > > CC arch/powerpc/sysdev/fsl_rio.o > arch/powerpc/sysdev/fsl_rio.c: In function 'fsl_rio_mcheck_exception': > arch/powerpc/sysdev/fsl_rio.c:248: error: 'MCSR_MASK' undeclared > (first use in this function) > arch/powerpc/sysdev/fsl_rio.c:248: error: (Each undeclared identifier > is reported only once > arch/powerpc/sysdev/fsl_rio.c:248: error: for each function it appears in.) > make[1]: *** [arch/powerpc/sysdev/fsl_rio.o] Error 1 > > -- > Timur Tabi > Linux kernel developer at Freescale ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v2 5/7] powerpc/85xx: Add MChk handler for SRIO port
On Tue, Aug 3, 2010 at 7:17 AM, Bounine, Alexandre wrote: > This happened after change to book-e definitions. > There are patches that address this issue. And those patches should have been applied before 2.6.35 was released. Someone dropped the ball. 2.6.35 is broken for a number of PowerPC boards: $ make mpc85xx_defconfig ... $ make ... CC arch/powerpc/sysdev/fsl_rio.o arch/powerpc/sysdev/fsl_rio.c: In function 'fsl_rio_mcheck_exception': arch/powerpc/sysdev/fsl_rio.c:248: error: 'MCSR_MASK' undeclared (first use in this function) arch/powerpc/sysdev/fsl_rio.c:248: error: (Each undeclared identifier is reported only once arch/powerpc/sysdev/fsl_rio.c:248: error: for each function it appears in.) make[1]: *** [arch/powerpc/sysdev/fsl_rio.o] Error 1 -- Timur Tabi Linux kernel developer at Freescale ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 2/3] P4080/mtd: Only make elbc nand driver detect nand flash partitions
On Aug 2, 2010, at 11:45 PM, Roy Zang wrote: > From: Lan Chunhe-B25806 > > The former driver had the two functions: > > 1. detecting nand flash partitions; > 2. registering elbc interrupt. > > Now, second function is removed to fsl_lbc.c. > > Signed-off-by: Lan Chunhe-B25806 > Signed-off-by: Roy Zang > --- > drivers/mtd/nand/Kconfig |1 + > drivers/mtd/nand/fsl_elbc_nand.c | 464 ++ > 2 files changed, 170 insertions(+), 295 deletions(-) mtd list and maintainer should be CC'd on these. - k ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: Issues to access Compact Flash Card on MPC8360E
Thanks a lot Anton, I was confused with "ata-generic" entry at p...@3.0 node. Now the things are pretty much clear.. Earlier we thought that IORD and IOWR pins would be from GPIO, so thought had to do bit-banging. But after going through the schematics, we come to know that pins could be from LGPL0/1. On Mon, Aug 2, 2010 at 11:29 PM, Anton Vorontsov wrote: > On Mon, Aug 02, 2010 at 07:44:22PM +0530, Atul Deshmukh wrote: > > Thanks a lot Anton, > > From the dts entry given below, > > > > local...@e0005000 { > > #address-cells = <2>; > >#size-cells = <1>; > >compatible = "fsl,mpc8349e-localbus", > > "fsl,pq2pro-localbus"; > >reg = <0xe0005000 0xd8>; > >ranges = <0x3 0x0 0xf000 0x210>; > >p...@3,0 { > >compatible = "fsl,mpc8349emitx-pata", > > "ata-generic"; > >reg = <0x3 0x0 0x10 0x3 0x20c 0x4>; > >reg-shift = <1>; > >pio-mode = <6>; > >interrupts = <23 0x8>; > > interrupt-parent = <&ipic>; > >}; > >}; > > > > > The driver is drivers/ata/pata_of_platform.c. > > > controls PCI-based IDE-controller where we can plug in our CF card...Am I > > right??? > > Nope, no PCI involved. CF is almost* directly connected to > the localbus. > > > But in our design we don't use any controller we directly connects CF > card > > to local bus where UPM controls it.. > > Yes, that's exactly how CF is done on MPC8349EmITX boards. > > > Can you please explain how the interface is implemented in MPC8349.. > > Via localbus + UPM. > > * 'almost' is because there are some buffers and inverters, see > schematics: > > http://www.freescale.com/files/32bit/hardware_tools/schematics/MPC8349EMITXESCH.pdf > > -- > Anton Vorontsov > email: cbouatmai...@gmail.com > irc://irc.freenode.net/bd2 > -- Regards, Atul ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH v2 5/7] powerpc/85xx: Add MChk handler for SRIO port
This happened after change to book-e definitions. There are patches that address this issue. > -Original Message- > From: Michael Neuling [mailto:mi...@neuling.org] > Sent: Tuesday, August 03, 2010 2:07 AM > To: Timur Tabi > Cc: Alexandre Bounine; linuxppc-dev@lists.ozlabs.org; linux-ker...@vger.kernel.org; > thomas.m...@sysgo.com > Subject: Re: [PATCH v2 5/7] powerpc/85xx: Add MChk handler for SRIO port > > > > MCSR_MASK is not defined anywhere, so when I compile this code, I get this: > > > > Never mind. I see that it's been fixed already, and that the patch > > that removed MCSR_MASK was posted around the same time that this patch > > was posted. > > I don't know what happened here but 2.6.35 is broken because of this > problem: > > arch/powerpc/sysdev/fsl_rio.c:248: error: 'MCSR_MASK' undeclared (first use in this function) > arch/powerpc/sysdev/fsl_rio.c:248: error: (Each undeclared identifier is reported only once > arch/powerpc/sysdev/fsl_rio.c:248: error: for each function it appears in.) > arch/powerpc/sysdev/fsl_rio.c:250: error: 'MCSR_BUS_RBERR' undeclared (first use in this function) > > Mikey ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: ramdisk size is larger than 4MB
> I found the link_address in the wrapper shell script sets the _start > address. But after changing it to 0x80, the kernel failed to boot, > shown below. There must be something also needs proper adjustment. > What would that be? I did more debugging and something is really weird though. When the link address is changed to 0x80, when stepping through the kernel, I actually got the kernel boot successfully. However I let the kernel run through it would just crash. After crash the BDI2000 shows it stopped at __delay(). I also changed the link address to 0x400. During the function of_scan_flat_dt(early_init_dt_scan_chosen, NULL) called in early_init_devtree(), gdb shows the program (i.e. kernel) received a signal SIGSTOP. Why would the kernel crash during that time? of_scan_flat_dt() doesn't seem to be the cause of SIGSTOP. What would that be then? Thanks, -Shawn. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev