[PATCH] [POWERPC] Add the PC speaker only when requested so
This will cause this minor boot-time debugging error message to go away: [1.316451] calling add_pcspkr+0x0/0x84 [1.316478] initcall add_pcspkr+0x0/0x84 returned -19 after 0 msecs Signed-off-by: Emil Medve <[EMAIL PROTECTED]> --- > scripts/checkpatch.pl > 0001--POWERPC-Add-the-PC-speaker-only-when-requested-so.patch total: 0 errors, 0 warnings, 14 lines checked 0001--POWERPC-Add-the-PC-speaker-only-when-requested-so.patch has no obvious style problems and is ready for submission. arch/powerpc/kernel/setup-common.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index db540ea..61a3f41 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c @@ -500,6 +500,7 @@ void __init smp_setup_cpu_sibling_map(void) } #endif /* CONFIG_SMP */ +#ifdef CONFIG_PCSPKR_PLATFORM static __init int add_pcspkr(void) { struct device_node *np; @@ -522,6 +523,7 @@ static __init int add_pcspkr(void) return ret; } device_initcall(add_pcspkr); +#endif /* CONFIG_PCSPKR_PLATFORM */ void probe_machine(void) { -- 1.5.5.GIT ___ Linuxppc-embedded mailing list Linuxppc-embedded@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-embedded
[PATCH] [POWERPC] Fix return value check logic
debugfs_create_file() return a non-NULL (non-zero) value in case of success This fixes this non-critical boot-time debuging error message: [1.316386] calling irq_debugfs_init+0x0/0x50 [1.316399] initcall irq_debugfs_init+0x0/0x50 returned -12 after 0 msecs [1.316411] initcall irq_debugfs_init+0x0/0x50 returned with error code -12 Signed-off-by: Emil Medve <[EMAIL PROTECTED]> --- $ scripts/checkpatch.pl 0001--POWERPC-Fix-return-value-check-logic.patch total: 0 errors, 0 warnings, 8 lines checked 0001--POWERPC-Fix-return-value-check-logic.patch has no obvious style problems and is ready for submission. arch/powerpc/kernel/irq.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 2f73f70..bcc249d 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -1073,7 +1073,7 @@ static const struct file_operations virq_debug_fops = { static int __init irq_debugfs_init(void) { if (debugfs_create_file("virq_mapping", S_IRUGO, powerpc_debugfs_root, -NULL, &virq_debug_fops)) +NULL, &virq_debug_fops) == NULL) return -ENOMEM; return 0; -- 1.5.5.GIT ___ Linuxppc-embedded mailing list Linuxppc-embedded@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-embedded
[PATCH] [POWERPC] Fix a mm compile error
arch/powerpc/mm/init_32.c:102: error: conflicting types for '__initial_memory_limit_addr' arch/powerpc/mm/mmu_decl.h:51: error: previous declaration of '__initial_memory_limit_addr' was here Signed-off-by: Emil Medve <[EMAIL PROTECTED]> --- arch/powerpc/mm/init_32.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c index 555bb7e..63c5e3d 100644 --- a/arch/powerpc/mm/init_32.c +++ b/arch/powerpc/mm/init_32.c @@ -99,7 +99,7 @@ unsigned long __max_low_memory = MAX_LOW_MEM; * address of the limit of what is accessible with initial MMU setup - * 256MB usually, but only 16MB on 601. */ -unsigned long __initial_memory_limit_addr = 0x1000; +phys_addr_t __initial_memory_limit_addr = 0x1000; /* * Check for command-line options that affect what MMU_init will do. -- 1.5.4.GIT ___ Linuxppc-embedded mailing list Linuxppc-embedded@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-embedded
[PATCH v2] [POWERPC] Optimize counting distinct entries in the relocation sections
When a module has relocation sections with tens of thousands worth of entries, counting the distinct/unique entries only (i.e. no duplicates) at load time can take tens of seconds and up to minutes. The sore point is the count_relocs() function which is called as part of the architecture specific module loading processing path: -> load_module()generic -> module_frob_arch_sections() arch specific -> get_plt_size() 32-bit -> get_stubs_size() 64-bit -> count_relocs() (Not sure why the relocation tables could contain lots of duplicates and why they are not trimmed at compile time by the linker. In some test cases, out of 35K relocation entries only 1.5K were distinct/unique) The previous counting algorithm was having O(n^2) complexity. Basically two solutions were proposed on the e-mail list: a hash based approach and a sort based approach The hash based approach is the fastest (O(n)) but the has it needs additional memory and for certain corner cases it could take lots of memory due to the degeneration of the hash. One such proposal was submitted here: http://ozlabs.org/pipermail/linuxppc-dev/2007-June/037641.html In this proposal, the symbol + addendum are hashed to generate a key and a pointer to the relocation entry will be stored in it. The hash is implemented as a linked list of memory pages with PAGE_SIZE / sizeof(Elfxx_Rela *) entries. In case of collisions in all the existing pages, a new page is added to the list to accommodate the new distinct relocation entry For 32-bit PowerPCs with 4K pages, a page can accommodate 1K worth of pointers to relocation entries. In the 35K entries scenario, as much/little of six (6) pages could be allocated using 24K of extra memory during the module load The sort based approach is slower (O(n * log n + n)) but if the sorting is done "in place" it doesn't need additional memory. A proposal was submitted here: http://ozlabs.org/pipermail/linuxppc-dev/2007-November/045854.html (http://patchwork.ozlabs.org/linuxppc/patch?filter=default&id=14573) In this proposal an array of pointers to the relocation entries is built and then is sorted using the kernel sort() utility function. This is basically a heap sort algorithm with a stable O(n * log n) complexity. With this counting the distinct/unique entries is just linear (O(n)) complexity. The problem is the extra memory needed in this proposal, which in the 35K relocation entries test case it can be as much as 140K (for 32-bit PowerPCs; double for 64-bit). This is much more then the memory needed by the hash based approach described above/earlier but it doesn't hide potential degenerative corner cases The current patch is a happy compromise between the two proposals above: O(n + n * log n) performance with no additional memory requirements due to sorting in place the relocation table itself Signed-off-by: Emil Medve <[EMAIL PROTECTED]> --- This patch only tries to address counting the distinct R_PPC_REL24 entries for the purpose of sizing the PLT. This operation was/can be detected by the proper kernel logic as a soft lockup for large relocation tables A related optimization (that could cause rewriting the this patch) is to optimize the PLT search from do_plt_call() but that doesn't seem to be a problem right now The errors below are false positives due to the fact that Elfxx_Rela are falsely assumed to be variables/operands instead of types: linux-2.6> scripts/checkpatch.pl 0001-POWERPC-Optimize-counting-distinct-entries-in-the.patch ERROR: need consistent spacing around '*' (ctx:WxV) #116: FILE: arch/powerpc/kernel/module_32.c:78: + const Elf32_Rela *x, *y; ^ ERROR: need consistent spacing around '*' (ctx:WxV) #228: FILE: arch/powerpc/kernel/module_64.c:122: + const Elf64_Rela *x, *y; ^ total: 2 errors, 0 warnings, 218 lines checked Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. arch/powerpc/kernel/module_32.c | 77 ++--- arch/powerpc/kernel/module_64.c | 81 ++ 2 files changed, 127 insertions(+), 31 deletions(-) diff --git a/arch/powerpc/kernel/module_32.c b/arch/powerpc/kernel/module_32.c index 07a89a3..eab3138 100644 --- a/arch/powerpc/kernel/module_32.c +++ b/arch/powerpc/kernel/module_32.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "setup.h" @@ -54,22 +55,60 @@ void module_free(struct module *mod, void *module_region) addend) */ static unsigned int count_relocs(const Elf32_Rela *rela, unsigned int num) { - unsigned int i, j, ret = 0; - - /* Sure, this is order(n^2), but it's usually short, and not - t
[PATCH] [POWERPC] Optimize counting distinct entries in the relocation sections
When a module has relocation sections with tens of thousands worth of entries, counting the distinct/unique entries only (i.e. no duplicates) at load time can take tens of seconds and up to minutes. The sore point is the count_relocs() function which is called as part of the architecture specific module loading processing path: -> load_module()generic -> module_frob_arch_sections() arch specific -> get_plt_size() 32-bit -> get_stubs_size() 64-bit -> count_relocs() (Not sure why the relocation tables could contain lots of duplicates and why they are not trimmed at compile time by the linker. In some test cases, out of 35K relocation entries only 1.5K were distinct/unique) The previous counting algorithm was having O(n^2) complexity. Basically two solutions were proposed on the e-mail list: a hash based approach and a sort based approach The hash based approach is the fastest (O(n)) but the has it needs additional memory and for certain corner cases it could take lots of memory due to the degeneration of the hash. One such proposal was submitted here: http://ozlabs.org/pipermail/linuxppc-dev/2007-June/037641.html In this proposal, the symbol + addendum are hashed to generate a key and a pointer to the relocation entry will be stored in it. The hash is implemented as a linked list of memory pages with PAGE_SIZE / sizeof(Elfxx_Rela *) entries. In case of collisions in all the existing pages, a new page is added to the list to accommodate the new distinct relocation entry For 32-bit PowerPCs with 4K pages, a page can accommodate 1K worth of pointers to relocation entries. In the 35K entries scenario, as much/little of six (6) pages could be allocated using 24K of extra memory during the module load The sort based approach is slower (O(n * log n + n)) but if the sorting is done "in place" it doesn't need additional memory. A proposal was submitted here: http://ozlabs.org/pipermail/linuxppc-dev/2007-November/045854.html (http://patchwork.ozlabs.org/linuxppc/patch?filter=default&id=14573) In this proposal an array of pointers to the relocation entries is built and then is sorted using the kernel sort() utility function. This is basically a heap sort algorithm with a stable O(n * log n) complexity. With this counting the distinct/unique entries is just linear (O(n)) complexity. The problem is the extra memory needed in this proposal, which in the 35K relocation entries test case it can be as much as 140K (for 32-bit PowerPCs; double for 64-bit). This is much more then the memory needed by the hash based approach described above/earlier but it doesn't hide potential degenerative corner cases The current patch is a happy compromise between the two proposals above: O(n + n * log n) performance with no additional memory requirements due to sorting in place the relocation table itself Signed-off-by: Emil Medve <[EMAIL PROTECTED]> --- The style errors below are false positives because checkpatch understands the Elfxx_Rela as operands instead of types powerpc> scripts/checkpatch.pl 0001-POWERPC-Optimize-counting-distinct-entries-in-the.patch ERROR: need consistent spacing around '*' (ctx:WxV) #84: FILE: arch/powerpc/kernel/module_32.c:56: +static uint32_t count_relocs(const Elf32_Rela *rela, uint32_t num) ^ ERROR: need consistent spacing around '*' (ctx:WxV) #118: FILE: arch/powerpc/kernel/module_32.c:77: + const Elf32_Rela *x, *y; ^ ERROR: need consistent spacing around '*' (ctx:WxV) #190: FILE: arch/powerpc/kernel/module_64.c:83: +static uint64_t count_relocs(const Elf64_Rela *rela, uint64_t num) ^ ERROR: need consistent spacing around '*' (ctx:WxV) #235: FILE: arch/powerpc/kernel/module_64.c:124: + const Elf64_Rela *x, *y; ^ total: 4 errors, 0 warnings, 0 checks, 225 lines checked Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS. arch/powerpc/kernel/module_32.c | 78 +--- arch/powerpc/kernel/module_64.c | 85 ++ 2 files changed, 130 insertions(+), 33 deletions(-) diff --git a/arch/powerpc/kernel/module_32.c b/arch/powerpc/kernel/module_32.c index 07a89a3..866637a 100644 --- a/arch/powerpc/kernel/module_32.c +++ b/arch/powerpc/kernel/module_32.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "setup.h" @@ -52,24 +53,61 @@ void module_free(struct module *mod, void *module_region) /* Count how many different relocations (different symbol, different addend) */ -static unsigned int count_relocs(const Elf32_Rela *rela, unsigned int num) +st
[PATCH] Added missing CEURNR register
According to the publicly available MPC8360E RM (rev. 1 from 09/2006 and rev. 2 from 05/2007) and MPC8323E RM (rev. 1 from 09/2006), CEURNR is the QE microcode revision number register and is located at offset 0x1b8 within the QE internal register space Signed-off-by: Emil Medve <[EMAIL PROTECTED]> --- I'm writing a driver and I felt the need to know the microcode revision This patch is against Paul's tree: c4d5e375470862fd741f93bf0686d7ac2f7fdce4 powerpc> scripts/checkpatch.pl 0001-Added-missing-CEURNR-register.patch Your patch has no obvious style problems and is ready for submission. include/asm-powerpc/immap_qe.h |5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/asm-powerpc/immap_qe.h b/include/asm-powerpc/immap_qe.h index 1020b7f..02548f7 100644 --- a/include/asm-powerpc/immap_qe.h +++ b/include/asm-powerpc/immap_qe.h @@ -86,8 +86,9 @@ struct cp_qe { __be16 ceexe4; /* QE external request 4 event register */ u8 res11[0x2]; __be16 ceexm4; /* QE external request 4 mask register */ - u8 res12[0x2]; - u8 res13[0x280]; + u8 res12[0x3A]; + __be32 ceurnr; /* QE microcode revision number register */ + u8 res13[0x244]; } __attribute__ ((packed)); /* QE Multiplexer */ -- 1.5.3.GIT ___ Linuxppc-embedded mailing list Linuxppc-embedded@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-embedded
[PATCH v3] [POWERPC] Fix build errors when BLOCK=n
These are the symptom error messages: CC arch/powerpc/kernel/setup_32.o In file included from include/linux/blkdev.h:17, from include/linux/ide.h:13, from arch/powerpc/kernel/setup_32.c:13: include/linux/bsg.h:67: warning: 'struct request_queue' declared inside parameter list include/linux/bsg.h:67: warning: its scope is only this definition or declaration, which is probably not what you want include/linux/bsg.h:71: warning: 'struct request_queue' declared inside parameter list In file included from arch/powerpc/kernel/setup_32.c:13: include/linux/ide.h:857: error: field 'wrq' has incomplete type CC arch/powerpc/kernel/ppc_ksyms.o In file included from include/linux/blkdev.h:17, from include/linux/ide.h:13, from arch/powerpc/kernel/ppc_ksyms.c:15: include/linux/bsg.h:67: warning: 'struct request_queue' declared inside parameter list include/linux/bsg.h:67: warning: its scope is only this definition or declaration, which is probably not what you want include/linux/bsg.h:71: warning: 'struct request_queue' declared inside parameter list In file included from arch/powerpc/kernel/ppc_ksyms.c:15: include/linux/ide.h:857: error: field 'wrq' has incomplete type The fix tries to use the smallest scope CONFIG_* symbols that will fix the build problem. In this case needs to be included only if IDE=y or IDE=m were selected. Also, ppc_ide_md is needed only if BLK_DEV_IDE=y or BLK_DEV_IDE=m Moved the EXPORT_SYMBOL(ppc_ide_md) from ppc_ksysms.c next to its declaration in setup_32.c which made not needed. With gone from ppc_ksyms.c, is needed to address the following warnings and errors: CC arch/powerpc/kernel/ppc_ksyms.o arch/powerpc/kernel/ppc_ksyms.c:122: error: '__flush_icache_range' undeclared here (not in a function) arch/powerpc/kernel/ppc_ksyms.c:122: warning: type defaults to 'int' in declaration of '__flush_icache_range' arch/powerpc/kernel/ppc_ksyms.c:123: error: 'flush_dcache_range' undeclared here (not in a function) arch/powerpc/kernel/ppc_ksyms.c:123: warning: type defaults to 'int' in declaration of 'flush_dcache_range' Signed-off-by: Emil Medve <[EMAIL PROTECTED]> --- I tested that the code builds with this patch in various combinations of configuration options: all the combinations involving BLOCK, IDE and BLK_DEV_IDE A patch for the warnings above has been already commited here: http://git.kernel.org/?p=linux/kernel/git/jejb/scsi-misc-2.6.git;a=commitdiff;h=49892223f7d3a2333ef9e6cbdd526676e1fc517a This patch is against Paul's tree (75cdff9242c4e048cb830d359920719d29b9ee7c) powerpc> scripts/checkpatch.pl 0001-POWERPC-Fix-build-errors-when-BLOCK-n.patch Your patch has no obvious style problems and is ready for submission. arch/powerpc/kernel/ppc_ksyms.c |6 +- arch/powerpc/kernel/setup_32.c |5 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c index 430c502..c6b1aa3 100644 --- a/arch/powerpc/kernel/ppc_ksyms.c +++ b/arch/powerpc/kernel/ppc_ksyms.c @@ -12,12 +12,12 @@ #include #include #include -#include #include #include #include #include +#include #include #include #include @@ -95,10 +95,6 @@ EXPORT_SYMBOL(__strnlen_user); EXPORT_SYMBOL(copy_4K_page); #endif -#if defined(CONFIG_PPC32) && (defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)) -EXPORT_SYMBOL(ppc_ide_md); -#endif - #if defined(CONFIG_PCI) && defined(CONFIG_PPC32) EXPORT_SYMBOL(isa_io_base); EXPORT_SYMBOL(isa_mem_base); diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index a288a5f..7474502 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c @@ -10,7 +10,9 @@ #include #include #include +#if defined(CONFIG_IDE) || defined(CONFIG_IDE_MODULE) #include +#endif #include #include #include @@ -49,7 +51,10 @@ extern void bootx_init(unsigned long r4, unsigned long phys); +#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) struct ide_machdep_calls ppc_ide_md; +EXPORT_SYMBOL(ppc_ide_md); +#endif int boot_cpuid; EXPORT_SYMBOL_GPL(boot_cpuid); -- 1.5.3.GIT ___ Linuxppc-embedded mailing list Linuxppc-embedded@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-embedded
[PATCH v2] [POWERPC] Fix build errors when BLOCK=n
These are the symptom error messages: CC arch/powerpc/kernel/setup_32.o In file included from include/linux/blkdev.h:17, from include/linux/ide.h:13, from arch/powerpc/kernel/setup_32.c:13: include/linux/bsg.h:67: warning: 'struct request_queue' declared inside parameter list include/linux/bsg.h:67: warning: its scope is only this definition or declaration, which is probably not what you want include/linux/bsg.h:71: warning: 'struct request_queue' declared inside parameter list In file included from arch/powerpc/kernel/setup_32.c:13: include/linux/ide.h:857: error: field 'wrq' has incomplete type CC arch/powerpc/kernel/ppc_ksyms.o In file included from include/linux/blkdev.h:17, from include/linux/ide.h:13, from arch/powerpc/kernel/ppc_ksyms.c:15: include/linux/bsg.h:67: warning: 'struct request_queue' declared inside parameter list include/linux/bsg.h:67: warning: its scope is only this definition or declaration, which is probably not what you want include/linux/bsg.h:71: warning: 'struct request_queue' declared inside parameter list In file included from arch/powerpc/kernel/ppc_ksyms.c:15: include/linux/ide.h:857: error: field 'wrq' has incomplete type The fix tries to use the smallest scope CONFIG_* symbols that will fix the build problem. In this case needs to be included only if IDE=y or IDE=m were selected. Also, ppc_ide_md is needed only if BLK_DEV_IDE=y or BLK_DEV_IDE=m Moved the EXPORT_SYMBOL(ppc_ide_md) from ppc_ksysms.c next to its declaration in setup_32.c Signed-off-by: Emil Medve <[EMAIL PROTECTED]> --- I tested that the code builds with this patch in various combinations of configuration options: all the combinations involving BLOCK, IDE and BLK_DEV_IDE A patch for the warnings above has been already commited here: http://git.kernel.org/?p=linux/kernel/git/jejb/scsi-misc-2.6.git;a=commitdiff;h=49892223f7d3a2333ef9e6cbdd526676e1fc517a This a patch against Paul's tree (75cdff9242c4e048cb830d359920719d29b9ee7c) powerpc> scripts/checkpatch.pl 0001-POWERPC-Fix-build-errors-when-BLOCK-n.patch Your patch has no obvious style problems and is ready for submission. arch/powerpc/kernel/ppc_ksyms.c |7 +++ arch/powerpc/kernel/setup_32.c |5 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c index 430c502..f00cba3 100644 --- a/arch/powerpc/kernel/ppc_ksyms.c +++ b/arch/powerpc/kernel/ppc_ksyms.c @@ -12,12 +12,15 @@ #include #include #include +#if defined(CONFIG_IDE) || defined(CONFIG_IDE_MODULE) #include +#endif #include #include #include #include +#include #include #include #include @@ -95,10 +98,6 @@ EXPORT_SYMBOL(__strnlen_user); EXPORT_SYMBOL(copy_4K_page); #endif -#if defined(CONFIG_PPC32) && (defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)) -EXPORT_SYMBOL(ppc_ide_md); -#endif - #if defined(CONFIG_PCI) && defined(CONFIG_PPC32) EXPORT_SYMBOL(isa_io_base); EXPORT_SYMBOL(isa_mem_base); diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index a288a5f..7474502 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c @@ -10,7 +10,9 @@ #include #include #include +#if defined(CONFIG_IDE) || defined(CONFIG_IDE_MODULE) #include +#endif #include #include #include @@ -49,7 +51,10 @@ extern void bootx_init(unsigned long r4, unsigned long phys); +#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) struct ide_machdep_calls ppc_ide_md; +EXPORT_SYMBOL(ppc_ide_md); +#endif int boot_cpuid; EXPORT_SYMBOL_GPL(boot_cpuid); -- 1.5.3.GIT ___ Linuxppc-embedded mailing list Linuxppc-embedded@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-embedded