From david at gibson.dropbear.id.au Mon Aug 1 15:48:10 2005 From: david at gibson.dropbear.id.au (David Gibson) Date: Mon, 1 Aug 2005 15:48:10 +1000 Subject: [PATCH 0/8] Assorted cleanups to head.S Message-ID: <20050801054810.GA10853@localhost.localdomain> Hi Paul, Please forward upstream, if acceptable. This stack of 8 patches makes a number of cleanups to head.S, in the process removing several pages from the kernel runtime image, and a couple more from the vmlinux. [PATCH 1/8] Remove NACA fixed address constraint [PATCH 2/8] Move iSeries and common vectors into unused space in head.S [PATCH 3/8] Change address of ppc64 initial segment table [PATCH 4/8] Remove general use functions from head.S [PATCH 5/8] Fix apparent code overlap in ppc64 head.S [PATCH 6/8] Remove unneeded #defines in head.S [PATCH 7/8] Tweak comments in ppc64 head.S [PATCH 8/8] Move variables in ppc64 head.S from .data to .bss -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/people/dgibson From david at gibson.dropbear.id.au Mon Aug 1 15:53:51 2005 From: david at gibson.dropbear.id.au (David Gibson) Date: Mon, 1 Aug 2005 15:53:51 +1000 (EST) Subject: [PATCH 1/8] Remove NACA fixed address constraint In-Reply-To: <20050801054810.GA10853@localhost.localdomain> Message-ID: <20050801055351.E164D67E06@ozlabs.org> Comments in head.S suggest that the iSeries naca has a fixed address, because tools expect to find it there. The only tool which appears to access the naca is addRamDisk, but both the in-kernel version and the version used in RHEL and SuSE in fact locate the NACA the same way as the hypervisor does, by following the pointer in the hvReleaseData structure. Since the requirement for a fixed address seems to be obsolete, this patch removes the naca from head.S and replaces it with a normal C initializer. For good measure, it removes an old version of addRamDisk.c which was sitting, unused, in the ppc32 tree. Signed-off-by: David Gibson arch/ppc/boot/utils/addRamDisk.c | 203 --------------------------------------- arch/ppc64/kernel/LparData.c | 11 ++ arch/ppc64/kernel/head.S | 17 --- include/asm-ppc64/naca.h | 7 - 4 files changed, 12 insertions(+), 226 deletions(-) Index: working-2.6/arch/ppc/boot/utils/addRamDisk.c =================================================================== --- working-2.6.orig/arch/ppc/boot/utils/addRamDisk.c 2005-05-24 14:12:22.000000000 +1000 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,203 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#define ElfHeaderSize (64 * 1024) -#define ElfPages (ElfHeaderSize / 4096) -#define KERNELBASE (0xc0000000) - -void get4k(FILE *file, char *buf ) -{ - unsigned j; - unsigned num = fread(buf, 1, 4096, file); - for ( j=num; j<4096; ++j ) - buf[j] = 0; -} - -void put4k(FILE *file, char *buf ) -{ - fwrite(buf, 1, 4096, file); -} - -void death(const char *msg, FILE *fdesc, const char *fname) -{ - printf(msg); - fclose(fdesc); - unlink(fname); - exit(1); -} - -int main(int argc, char **argv) -{ - char inbuf[4096]; - FILE *ramDisk = NULL; - FILE *inputVmlinux = NULL; - FILE *outputVmlinux = NULL; - unsigned i = 0; - u_int32_t ramFileLen = 0; - u_int32_t ramLen = 0; - u_int32_t roundR = 0; - u_int32_t kernelLen = 0; - u_int32_t actualKernelLen = 0; - u_int32_t round = 0; - u_int32_t roundedKernelLen = 0; - u_int32_t ramStartOffs = 0; - u_int32_t ramPages = 0; - u_int32_t roundedKernelPages = 0; - u_int32_t hvReleaseData = 0; - u_int32_t eyeCatcher = 0xc8a5d9c4; - u_int32_t naca = 0; - u_int32_t xRamDisk = 0; - u_int32_t xRamDiskSize = 0; - if ( argc < 2 ) { - printf("Name of RAM disk file missing.\n"); - exit(1); - } - - if ( argc < 3 ) { - printf("Name of vmlinux file missing.\n"); - exit(1); - } - - if ( argc < 4 ) { - printf("Name of vmlinux output file missing.\n"); - exit(1); - } - - ramDisk = fopen(argv[1], "r"); - if ( ! ramDisk ) { - printf("RAM disk file \"%s\" failed to open.\n", argv[1]); - exit(1); - } - inputVmlinux = fopen(argv[2], "r"); - if ( ! inputVmlinux ) { - printf("vmlinux file \"%s\" failed to open.\n", argv[2]); - exit(1); - } - outputVmlinux = fopen(argv[3], "w+"); - if ( ! outputVmlinux ) { - printf("output vmlinux file \"%s\" failed to open.\n", argv[3]); - exit(1); - } - fseek(ramDisk, 0, SEEK_END); - ramFileLen = ftell(ramDisk); - fseek(ramDisk, 0, SEEK_SET); - printf("%s file size = %d\n", argv[1], ramFileLen); - - ramLen = ramFileLen; - - roundR = 4096 - (ramLen % 4096); - if ( roundR ) { - printf("Rounding RAM disk file up to a multiple of 4096, adding %d\n", roundR); - ramLen += roundR; - } - - printf("Rounded RAM disk size is %d\n", ramLen); - fseek(inputVmlinux, 0, SEEK_END); - kernelLen = ftell(inputVmlinux); - fseek(inputVmlinux, 0, SEEK_SET); - printf("kernel file size = %d\n", kernelLen); - if ( kernelLen == 0 ) { - printf("You must have a linux kernel specified as argv[2]\n"); - exit(1); - } - - actualKernelLen = kernelLen - ElfHeaderSize; - - printf("actual kernel length (minus ELF header) = %d\n", actualKernelLen); - - round = actualKernelLen % 4096; - roundedKernelLen = actualKernelLen; - if ( round ) - roundedKernelLen += (4096 - round); - - printf("actual kernel length rounded up to a 4k multiple = %d\n", roundedKernelLen); - - ramStartOffs = roundedKernelLen; - ramPages = ramLen / 4096; - - printf("RAM disk pages to copy = %d\n", ramPages); - - // Copy 64K ELF header - for (i=0; i<(ElfPages); ++i) { - get4k( inputVmlinux, inbuf ); - put4k( outputVmlinux, inbuf ); - } - - roundedKernelPages = roundedKernelLen / 4096; - - fseek(inputVmlinux, ElfHeaderSize, SEEK_SET); - - for ( i=0; i #include #include -#include #include #include #include @@ -510,24 +509,10 @@ mfspr r12,SPRG2 EXCEPTION_PROLOG_PSERIES(PACA_EXSLB, .do_stab_bolted) - - /* Space for the naca. Architected to be located at real address - * NACA_PHYS_ADDR. Various tools rely on this location being fixed. - * The first dword of the naca is required by iSeries LPAR to - * point to itVpdAreas. On pSeries native, this value is not used. - */ - . = NACA_PHYS_ADDR - .globl __end_interrupts -__end_interrupts: -#ifdef CONFIG_PPC_ISERIES - .globl naca -naca: - .llong itVpdAreas - .llong 0 /* xRamDisk */ - .llong 0 /* xRamDiskSize */ . = 0x6100 +#ifdef CONFIG_PPC_ISERIES /*** ISeries-LPAR interrupt handlers ***/ STD_EXCEPTION_ISERIES(0x200, machine_check, PACA_EXMC) arch/ppc/boot/utils/addRamDisk.c | 203 --------------------------------------- arch/ppc64/kernel/LparData.c | 11 ++ arch/ppc64/kernel/head.S | 17 --- include/asm-ppc64/naca.h | 7 - 4 files changed, 12 insertions(+), 226 deletions(-) Index: working-2.6/include/asm-ppc64/naca.h =================================================================== --- working-2.6.orig/include/asm-ppc64/naca.h 2005-05-24 14:12:25.000000000 +1000 +++ working-2.6/include/asm-ppc64/naca.h 2005-08-01 11:26:38.000000000 +1000 @@ -12,8 +12,6 @@ #include -#ifndef __ASSEMBLY__ - struct naca_struct { /* Kernel only data - undefined for user space */ void *xItVpdAreas; /* VPD Data 0x00 */ @@ -23,9 +21,4 @@ extern struct naca_struct naca; -#endif /* __ASSEMBLY__ */ - -#define NACA_PAGE 0x4 -#define NACA_PHYS_ADDR (NACA_PAGE< Message-ID: <20050801055351.23C3967E1A@ozlabs.org> In the ppc64 kernel head.S there is currently quite a lot of unused space between the naca (at fixed address 0x4000) and the fwnmi data area (at fixed address 0x7000). This patch moves various exception vectors and support code into this region to use the wasted space. The functions load_up_fpu and load_up_altivec are moved down as well, since they are essentially continuations of the fp_unavailable_common and altivec_unavailable_common vectors, respectively. Likewise, the fwnmi vectors themselves are moved down into this area, because while the location of the fwnmi data area is fixed by the RPA, the vectors themselves can be anywhere sufficiently low. Signed-off-by: David Gibson arch/ppc64/kernel/head.S | 350 +++++++++++++++++++++++------------------------ 1 files changed, 175 insertions(+), 175 deletions(-) Index: working-2.6/arch/ppc64/kernel/head.S =================================================================== --- working-2.6.orig/arch/ppc64/kernel/head.S 2005-08-01 15:19:04.000000000 +1000 +++ working-2.6/arch/ppc64/kernel/head.S 2005-08-01 15:20:17.000000000 +1000 @@ -51,9 +51,8 @@ * We layout physical memory as follows: * 0x0000 - 0x00ff : Secondary processor spin code * 0x0100 - 0x2fff : pSeries Interrupt prologs - * 0x3000 - 0x3fff : Interrupt support - * 0x4000 - 0x4fff : NACA - * 0x6000 : iSeries and common interrupt prologs + * 0x3000 - 0x6fff : interrupt support, iSeries and common interrupt prologs + * 0x7000 - 0x7fff : FWNMI data area * 0x9000 - 0x9fff : Initial segment table */ @@ -500,17 +499,35 @@ STD_EXCEPTION_PSERIES(0x1300, instruction_breakpoint) STD_EXCEPTION_PSERIES(0x1700, altivec_assist) + . = 0x3000 + +/*** pSeries interrupt support ***/ + /* moved from 0xf00 */ - STD_EXCEPTION_PSERIES(0x3000, performance_monitor) + STD_EXCEPTION_PSERIES(., performance_monitor) - . = 0x3100 + .align 7 _GLOBAL(do_stab_bolted_pSeries) mtcrf 0x80,r12 mfspr r12,SPRG2 EXCEPTION_PROLOG_PSERIES(PACA_EXSLB, .do_stab_bolted) +/* + * Vectors for the FWNMI option. Share common code. + */ + .globl system_reset_fwnmi +system_reset_fwnmi: + HMT_MEDIUM + mtspr SPRG1,r13 /* save r13 */ + RUNLATCH_ON(r13) + EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common) - . = 0x6100 + .globl machine_check_fwnmi +machine_check_fwnmi: + HMT_MEDIUM + mtspr SPRG1,r13 /* save r13 */ + RUNLATCH_ON(r13) + EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common) #ifdef CONFIG_PPC_ISERIES /*** ISeries-LPAR interrupt handlers ***/ @@ -655,45 +672,7 @@ ld r13,PACA_EXGEN+EX_R13(r13) rfid b . /* prevent speculative execution */ -#endif - -/* - * Data area reserved for FWNMI option. - */ - .= 0x7000 - .globl fwnmi_data_area -fwnmi_data_area: - -/* - * Vectors for the FWNMI option. Share common code. - */ - . = 0x8000 - .globl system_reset_fwnmi -system_reset_fwnmi: - HMT_MEDIUM - mtspr SPRG1,r13 /* save r13 */ - RUNLATCH_ON(r13) - EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common) - .globl machine_check_fwnmi -machine_check_fwnmi: - HMT_MEDIUM - mtspr SPRG1,r13 /* save r13 */ - RUNLATCH_ON(r13) - EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common) - - /* - * Space for the initial segment table - * For LPAR, the hypervisor must fill in at least one entry - * before we get control (with relocate on) - */ - . = STAB0_PHYS_ADDR - .globl __start_stab -__start_stab: - - . = (STAB0_PHYS_ADDR + PAGE_SIZE) - .globl __end_stab -__end_stab: - +#endif /* CONFIG_PPC_ISERIES */ /*** Common interrupt handlers ***/ @@ -885,6 +864,62 @@ bl .kernel_fp_unavailable_exception BUG_OPCODE +/* + * load_up_fpu(unused, unused, tsk) + * Disable FP for the task which had the FPU previously, + * and save its floating-point registers in its thread_struct. + * Enables the FPU for use in the kernel on return. + * On SMP we know the fpu is free, since we give it up every + * switch (ie, no lazy save of the FP registers). + * On entry: r13 == 'current' && last_task_used_math != 'current' + */ +_STATIC(load_up_fpu) + mfmsr r5 /* grab the current MSR */ + ori r5,r5,MSR_FP + mtmsrd r5 /* enable use of fpu now */ + isync +/* + * For SMP, we don't do lazy FPU switching because it just gets too + * horrendously complex, especially when a task switches from one CPU + * to another. Instead we call giveup_fpu in switch_to. + * + */ +#ifndef CONFIG_SMP + ld r3,last_task_used_math at got(r2) + ld r4,0(r3) + cmpdi 0,r4,0 + beq 1f + /* Save FP state to last_task_used_math's THREAD struct */ + addi r4,r4,THREAD + SAVE_32FPRS(0, r4) + mffs fr0 + stfd fr0,THREAD_FPSCR(r4) + /* Disable FP for last_task_used_math */ + ld r5,PT_REGS(r4) + ld r4,_MSR-STACK_FRAME_OVERHEAD(r5) + li r6,MSR_FP|MSR_FE0|MSR_FE1 + andc r4,r4,r6 + std r4,_MSR-STACK_FRAME_OVERHEAD(r5) +1: +#endif /* CONFIG_SMP */ + /* enable use of FP after return */ + ld r4,PACACURRENT(r13) + addi r5,r4,THREAD /* Get THREAD */ + ld r4,THREAD_FPEXC_MODE(r5) + ori r12,r12,MSR_FP + or r12,r12,r4 + std r12,_MSR(r1) + lfd fr0,THREAD_FPSCR(r5) + mtfsf 0xff,fr0 + REST_32FPRS(0, r5) +#ifndef CONFIG_SMP + /* Update last_task_used_math to 'current' */ + subi r4,r5,THREAD /* Back to 'current' */ + std r4,0(r3) +#endif /* CONFIG_SMP */ + /* restore registers and return */ + b fast_exception_return + .align 7 .globl altivec_unavailable_common altivec_unavailable_common: @@ -900,6 +935,80 @@ bl .altivec_unavailable_exception b .ret_from_except +#ifdef CONFIG_ALTIVEC +/* + * load_up_altivec(unused, unused, tsk) + * Disable VMX for the task which had it previously, + * and save its vector registers in its thread_struct. + * Enables the VMX for use in the kernel on return. + * On SMP we know the VMX is free, since we give it up every + * switch (ie, no lazy save of the vector registers). + * On entry: r13 == 'current' && last_task_used_altivec != 'current' + */ +_STATIC(load_up_altivec) + mfmsr r5 /* grab the current MSR */ + oris r5,r5,MSR_VEC at h + mtmsrd r5 /* enable use of VMX now */ + isync + +/* + * For SMP, we don't do lazy VMX switching because it just gets too + * horrendously complex, especially when a task switches from one CPU + * to another. Instead we call giveup_altvec in switch_to. + * VRSAVE isn't dealt with here, that is done in the normal context + * switch code. Note that we could rely on vrsave value to eventually + * avoid saving all of the VREGs here... + */ +#ifndef CONFIG_SMP + ld r3,last_task_used_altivec at got(r2) + ld r4,0(r3) + cmpdi 0,r4,0 + beq 1f + /* Save VMX state to last_task_used_altivec's THREAD struct */ + addi r4,r4,THREAD + SAVE_32VRS(0,r5,r4) + mfvscr vr0 + li r10,THREAD_VSCR + stvx vr0,r10,r4 + /* Disable VMX for last_task_used_altivec */ + ld r5,PT_REGS(r4) + ld r4,_MSR-STACK_FRAME_OVERHEAD(r5) + lis r6,MSR_VEC at h + andc r4,r4,r6 + std r4,_MSR-STACK_FRAME_OVERHEAD(r5) +1: +#endif /* CONFIG_SMP */ + /* Hack: if we get an altivec unavailable trap with VRSAVE + * set to all zeros, we assume this is a broken application + * that fails to set it properly, and thus we switch it to + * all 1's + */ + mfspr r4,SPRN_VRSAVE + cmpdi 0,r4,0 + bne+ 1f + li r4,-1 + mtspr SPRN_VRSAVE,r4 +1: + /* enable use of VMX after return */ + ld r4,PACACURRENT(r13) + addi r5,r4,THREAD /* Get THREAD */ + oris r12,r12,MSR_VEC at h + std r12,_MSR(r1) + li r4,1 + li r10,THREAD_VSCR + stw r4,THREAD_USED_VR(r5) + lvx vr0,r10,r5 + mtvscr vr0 + REST_32VRS(0,r4,r5) +#ifndef CONFIG_SMP + /* Update last_task_used_math to 'current' */ + subi r4,r5,THREAD /* Back to 'current' */ + std r4,0(r3) +#endif /* CONFIG_SMP */ + /* restore registers and return */ + b fast_exception_return +#endif /* CONFIG_ALTIVEC */ + /* * Hash table stuff */ @@ -1146,6 +1255,27 @@ bl .unrecoverable_exception b 1b +/* + * Data area reserved for FWNMI option. + * This address (0x7000) is fixed by the RPA. + */ + .= 0x7000 + .globl fwnmi_data_area +fwnmi_data_area: + .space PAGE_SIZE + + /* + * Space for the initial segment table + * For LPAR, the hypervisor must fill in at least one entry + * before we get control (with relocate on) + */ + . = STAB0_PHYS_ADDR + .globl __start_stab +__start_stab: + + . = (STAB0_PHYS_ADDR + PAGE_SIZE) + .globl __end_stab +__end_stab: /* * On pSeries, secondary processors spin in the following code. @@ -1410,62 +1540,6 @@ copy_to_here: /* - * load_up_fpu(unused, unused, tsk) - * Disable FP for the task which had the FPU previously, - * and save its floating-point registers in its thread_struct. - * Enables the FPU for use in the kernel on return. - * On SMP we know the fpu is free, since we give it up every - * switch (ie, no lazy save of the FP registers). - * On entry: r13 == 'current' && last_task_used_math != 'current' - */ -_STATIC(load_up_fpu) - mfmsr r5 /* grab the current MSR */ - ori r5,r5,MSR_FP - mtmsrd r5 /* enable use of fpu now */ - isync -/* - * For SMP, we don't do lazy FPU switching because it just gets too - * horrendously complex, especially when a task switches from one CPU - * to another. Instead we call giveup_fpu in switch_to. - * - */ -#ifndef CONFIG_SMP - ld r3,last_task_used_math at got(r2) - ld r4,0(r3) - cmpdi 0,r4,0 - beq 1f - /* Save FP state to last_task_used_math's THREAD struct */ - addi r4,r4,THREAD - SAVE_32FPRS(0, r4) - mffs fr0 - stfd fr0,THREAD_FPSCR(r4) - /* Disable FP for last_task_used_math */ - ld r5,PT_REGS(r4) - ld r4,_MSR-STACK_FRAME_OVERHEAD(r5) - li r6,MSR_FP|MSR_FE0|MSR_FE1 - andc r4,r4,r6 - std r4,_MSR-STACK_FRAME_OVERHEAD(r5) -1: -#endif /* CONFIG_SMP */ - /* enable use of FP after return */ - ld r4,PACACURRENT(r13) - addi r5,r4,THREAD /* Get THREAD */ - ld r4,THREAD_FPEXC_MODE(r5) - ori r12,r12,MSR_FP - or r12,r12,r4 - std r12,_MSR(r1) - lfd fr0,THREAD_FPSCR(r5) - mtfsf 0xff,fr0 - REST_32FPRS(0, r5) -#ifndef CONFIG_SMP - /* Update last_task_used_math to 'current' */ - subi r4,r5,THREAD /* Back to 'current' */ - std r4,0(r3) -#endif /* CONFIG_SMP */ - /* restore registers and return */ - b fast_exception_return - -/* * disable_kernel_fp() * Disable the FPU. */ @@ -1509,81 +1583,7 @@ #endif /* CONFIG_SMP */ blr - #ifdef CONFIG_ALTIVEC - -/* - * load_up_altivec(unused, unused, tsk) - * Disable VMX for the task which had it previously, - * and save its vector registers in its thread_struct. - * Enables the VMX for use in the kernel on return. - * On SMP we know the VMX is free, since we give it up every - * switch (ie, no lazy save of the vector registers). - * On entry: r13 == 'current' && last_task_used_altivec != 'current' - */ -_STATIC(load_up_altivec) - mfmsr r5 /* grab the current MSR */ - oris r5,r5,MSR_VEC at h - mtmsrd r5 /* enable use of VMX now */ - isync - -/* - * For SMP, we don't do lazy VMX switching because it just gets too - * horrendously complex, especially when a task switches from one CPU - * to another. Instead we call giveup_altvec in switch_to. - * VRSAVE isn't dealt with here, that is done in the normal context - * switch code. Note that we could rely on vrsave value to eventually - * avoid saving all of the VREGs here... - */ -#ifndef CONFIG_SMP - ld r3,last_task_used_altivec at got(r2) - ld r4,0(r3) - cmpdi 0,r4,0 - beq 1f - /* Save VMX state to last_task_used_altivec's THREAD struct */ - addi r4,r4,THREAD - SAVE_32VRS(0,r5,r4) - mfvscr vr0 - li r10,THREAD_VSCR - stvx vr0,r10,r4 - /* Disable VMX for last_task_used_altivec */ - ld r5,PT_REGS(r4) - ld r4,_MSR-STACK_FRAME_OVERHEAD(r5) - lis r6,MSR_VEC at h - andc r4,r4,r6 - std r4,_MSR-STACK_FRAME_OVERHEAD(r5) -1: -#endif /* CONFIG_SMP */ - /* Hack: if we get an altivec unavailable trap with VRSAVE - * set to all zeros, we assume this is a broken application - * that fails to set it properly, and thus we switch it to - * all 1's - */ - mfspr r4,SPRN_VRSAVE - cmpdi 0,r4,0 - bne+ 1f - li r4,-1 - mtspr SPRN_VRSAVE,r4 -1: - /* enable use of VMX after return */ - ld r4,PACACURRENT(r13) - addi r5,r4,THREAD /* Get THREAD */ - oris r12,r12,MSR_VEC at h - std r12,_MSR(r1) - li r4,1 - li r10,THREAD_VSCR - stw r4,THREAD_USED_VR(r5) - lvx vr0,r10,r5 - mtvscr vr0 - REST_32VRS(0,r4,r5) -#ifndef CONFIG_SMP - /* Update last_task_used_math to 'current' */ - subi r4,r5,THREAD /* Back to 'current' */ - std r4,0(r3) -#endif /* CONFIG_SMP */ - /* restore registers and return */ - b fast_exception_return - /* * disable_kernel_altivec() * Disable the VMX. From david at gibson.dropbear.id.au Mon Aug 1 15:53:52 2005 From: david at gibson.dropbear.id.au (David Gibson) Date: Mon, 1 Aug 2005 15:53:52 +1000 (EST) Subject: [PATCH 3/8] Change address of ppc64 initial segment table In-Reply-To: <20050801054810.GA10853@localhost.localdomain> Message-ID: <20050801055352.460EA67E22@ozlabs.org> On ppc64 machines with segment tables, CPU0's segment table is at a fixed address, currently 0x9000. This patch moves it to the free space at 0x6000, just below the fwnmi data area. This saves 8k of space in vmlinux and the runtime kernel image. Signed-off-by: David Gibson arch/ppc64/kernel/head.S | 32 +++++++++++++++++--------------- arch/ppc64/kernel/pacaData.c | 4 ++-- include/asm-ppc64/mmu.h | 7 +++++-- 3 files changed, 24 insertions(+), 19 deletions(-) Index: working-2.6/arch/ppc64/kernel/head.S =================================================================== --- working-2.6.orig/arch/ppc64/kernel/head.S 2005-07-28 14:23:09.000000000 +1000 +++ working-2.6/arch/ppc64/kernel/head.S 2005-07-28 14:23:15.000000000 +1000 @@ -51,9 +51,10 @@ * We layout physical memory as follows: * 0x0000 - 0x00ff : Secondary processor spin code * 0x0100 - 0x2fff : pSeries Interrupt prologs - * 0x3000 - 0x6fff : interrupt support, iSeries and common interrupt prologs + * 0x3000 - 0x5fff : interrupt support, iSeries and common interrupt prologs + * 0x6000 - 0x6fff : Initial (CPU0) segment table * 0x7000 - 0x7fff : FWNMI data area - * 0x9000 - 0x9fff : Initial segment table + * 0x8000 - : Early init and support code */ /* @@ -1256,6 +1257,20 @@ b 1b /* + * Space for CPU0's segment table. + * + * On iSeries, the hypervisor must fill in at least one entry before + * we get control (with relocate on). The address is give to the hv + * as a page number (see xLparMap in LparData.c), so this must be at a + * fixed address (the linker can't compute (u64)&initial_stab >> + * PAGE_SHIFT). + */ + . = STAB0_PHYS_ADDR /* 0x6000 */ + .globl initial_stab +initial_stab: + .space 4096 + +/* * Data area reserved for FWNMI option. * This address (0x7000) is fixed by the RPA. */ @@ -1264,19 +1279,6 @@ fwnmi_data_area: .space PAGE_SIZE - /* - * Space for the initial segment table - * For LPAR, the hypervisor must fill in at least one entry - * before we get control (with relocate on) - */ - . = STAB0_PHYS_ADDR - .globl __start_stab -__start_stab: - - . = (STAB0_PHYS_ADDR + PAGE_SIZE) - .globl __end_stab -__end_stab: - /* * On pSeries, secondary processors spin in the following code. * At entry, r3 = this processor's number (physical cpu id) arch/ppc64/kernel/head.S | 32 +++++++++++++++++--------------- arch/ppc64/kernel/pacaData.c | 4 ++-- include/asm-ppc64/mmu.h | 7 +++++-- 3 files changed, 24 insertions(+), 19 deletions(-) Index: working-2.6/arch/ppc64/kernel/pacaData.c =================================================================== --- working-2.6.orig/arch/ppc64/kernel/pacaData.c 2005-07-28 14:23:03.000000000 +1000 +++ working-2.6/arch/ppc64/kernel/pacaData.c 2005-07-28 14:23:15.000000000 +1000 @@ -78,7 +78,7 @@ #define BOOTCPU_PACA_INIT(number) \ { \ - PACA_INIT_COMMON(number, 1, 0, STAB0_VIRT_ADDR) \ + PACA_INIT_COMMON(number, 1, 0, (u64)&initial_stab) \ PACA_INIT_ISERIES(number) \ } @@ -90,7 +90,7 @@ #define BOOTCPU_PACA_INIT(number) \ { \ - PACA_INIT_COMMON(number, 1, STAB0_PHYS_ADDR, STAB0_VIRT_ADDR) \ + PACA_INIT_COMMON(number, 1, STAB0_PHYS_ADDR, (u64)&initial_stab) \ } #endif arch/ppc64/kernel/head.S | 32 +++++++++++++++++--------------- arch/ppc64/kernel/pacaData.c | 4 ++-- include/asm-ppc64/mmu.h | 7 +++++-- 3 files changed, 24 insertions(+), 19 deletions(-) Index: working-2.6/include/asm-ppc64/mmu.h =================================================================== --- working-2.6.orig/include/asm-ppc64/mmu.h 2005-07-28 14:23:03.000000000 +1000 +++ working-2.6/include/asm-ppc64/mmu.h 2005-07-28 14:23:15.000000000 +1000 @@ -28,9 +28,12 @@ #define STE_VSID_SHIFT 12 /* Location of cpu0's segment table */ -#define STAB0_PAGE 0x9 +#define STAB0_PAGE 0x6 #define STAB0_PHYS_ADDR (STAB0_PAGE< Message-ID: <20050801055352.7D2A367E23@ozlabs.org> As well as the interrupt vectors and initialization code, head.S contains several asm functions which are used during runtime. This patch moves these to misc.S, a more sensible location for random asm support code. A couple The functions moved are: disable_kernel_fp giveup_fpu disable_kernel_altivec giveup_altivec __setup_cpu_power3 (empty function) Signed-off-by: David Gibson arch/ppc64/kernel/head.S | 95 --------------------------------------------- arch/ppc64/kernel/misc.S | 98 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+), 95 deletions(-) Index: working-2.6/arch/ppc64/kernel/head.S =================================================================== --- working-2.6.orig/arch/ppc64/kernel/head.S 2005-07-28 14:23:16.000000000 +1000 +++ working-2.6/arch/ppc64/kernel/head.S 2005-07-28 14:23:18.000000000 +1000 @@ -1541,98 +1541,6 @@ .align 8 copy_to_here: -/* - * disable_kernel_fp() - * Disable the FPU. - */ -_GLOBAL(disable_kernel_fp) - mfmsr r3 - rldicl r0,r3,(63-MSR_FP_LG),1 - rldicl r3,r0,(MSR_FP_LG+1),0 - mtmsrd r3 /* disable use of fpu now */ - isync - blr - -/* - * giveup_fpu(tsk) - * Disable FP for the task given as the argument, - * and save the floating-point registers in its thread_struct. - * Enables the FPU for use in the kernel on return. - */ -_GLOBAL(giveup_fpu) - mfmsr r5 - ori r5,r5,MSR_FP - mtmsrd r5 /* enable use of fpu now */ - isync - cmpdi 0,r3,0 - beqlr- /* if no previous owner, done */ - addi r3,r3,THREAD /* want THREAD of task */ - ld r5,PT_REGS(r3) - cmpdi 0,r5,0 - SAVE_32FPRS(0, r3) - mffs fr0 - stfd fr0,THREAD_FPSCR(r3) - beq 1f - ld r4,_MSR-STACK_FRAME_OVERHEAD(r5) - li r3,MSR_FP|MSR_FE0|MSR_FE1 - andc r4,r4,r3 /* disable FP for previous task */ - std r4,_MSR-STACK_FRAME_OVERHEAD(r5) -1: -#ifndef CONFIG_SMP - li r5,0 - ld r4,last_task_used_math at got(r2) - std r5,0(r4) -#endif /* CONFIG_SMP */ - blr - -#ifdef CONFIG_ALTIVEC -/* - * disable_kernel_altivec() - * Disable the VMX. - */ -_GLOBAL(disable_kernel_altivec) - mfmsr r3 - rldicl r0,r3,(63-MSR_VEC_LG),1 - rldicl r3,r0,(MSR_VEC_LG+1),0 - mtmsrd r3 /* disable use of VMX now */ - isync - blr - -/* - * giveup_altivec(tsk) - * Disable VMX for the task given as the argument, - * and save the vector registers in its thread_struct. - * Enables the VMX for use in the kernel on return. - */ -_GLOBAL(giveup_altivec) - mfmsr r5 - oris r5,r5,MSR_VEC at h - mtmsrd r5 /* enable use of VMX now */ - isync - cmpdi 0,r3,0 - beqlr- /* if no previous owner, done */ - addi r3,r3,THREAD /* want THREAD of task */ - ld r5,PT_REGS(r3) - cmpdi 0,r5,0 - SAVE_32VRS(0,r4,r3) - mfvscr vr0 - li r4,THREAD_VSCR - stvx vr0,r4,r3 - beq 1f - ld r4,_MSR-STACK_FRAME_OVERHEAD(r5) - lis r3,MSR_VEC at h - andc r4,r4,r3 /* disable FP for previous task */ - std r4,_MSR-STACK_FRAME_OVERHEAD(r5) -1: -#ifndef CONFIG_SMP - li r5,0 - ld r4,last_task_used_altivec at got(r2) - std r5,0(r4) -#endif /* CONFIG_SMP */ - blr - -#endif /* CONFIG_ALTIVEC */ - #ifdef CONFIG_SMP #ifdef CONFIG_PPC_PMAC /* @@ -1983,9 +1891,6 @@ bl .start_kernel -_GLOBAL(__setup_cpu_power3) - blr - _GLOBAL(hmt_init) #ifdef CONFIG_HMT LOADADDR(r5, hmt_thread_data) arch/ppc64/kernel/head.S | 95 --------------------------------------------- arch/ppc64/kernel/misc.S | 98 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+), 95 deletions(-) Index: working-2.6/arch/ppc64/kernel/misc.S =================================================================== --- working-2.6.orig/arch/ppc64/kernel/misc.S 2005-07-28 14:23:03.000000000 +1000 +++ working-2.6/arch/ppc64/kernel/misc.S 2005-07-28 14:23:18.000000000 +1000 @@ -680,6 +680,104 @@ ld r30,-16(r1) blr +/* + * disable_kernel_fp() + * Disable the FPU. + */ +_GLOBAL(disable_kernel_fp) + mfmsr r3 + rldicl r0,r3,(63-MSR_FP_LG),1 + rldicl r3,r0,(MSR_FP_LG+1),0 + mtmsrd r3 /* disable use of fpu now */ + isync + blr + +/* + * giveup_fpu(tsk) + * Disable FP for the task given as the argument, + * and save the floating-point registers in its thread_struct. + * Enables the FPU for use in the kernel on return. + */ +_GLOBAL(giveup_fpu) + mfmsr r5 + ori r5,r5,MSR_FP + mtmsrd r5 /* enable use of fpu now */ + isync + cmpdi 0,r3,0 + beqlr- /* if no previous owner, done */ + addi r3,r3,THREAD /* want THREAD of task */ + ld r5,PT_REGS(r3) + cmpdi 0,r5,0 + SAVE_32FPRS(0, r3) + mffs fr0 + stfd fr0,THREAD_FPSCR(r3) + beq 1f + ld r4,_MSR-STACK_FRAME_OVERHEAD(r5) + li r3,MSR_FP|MSR_FE0|MSR_FE1 + andc r4,r4,r3 /* disable FP for previous task */ + std r4,_MSR-STACK_FRAME_OVERHEAD(r5) +1: +#ifndef CONFIG_SMP + li r5,0 + ld r4,last_task_used_math at got(r2) + std r5,0(r4) +#endif /* CONFIG_SMP */ + blr + +#ifdef CONFIG_ALTIVEC + +#if 0 /* this has no callers for now */ +/* + * disable_kernel_altivec() + * Disable the VMX. + */ +_GLOBAL(disable_kernel_altivec) + mfmsr r3 + rldicl r0,r3,(63-MSR_VEC_LG),1 + rldicl r3,r0,(MSR_VEC_LG+1),0 + mtmsrd r3 /* disable use of VMX now */ + isync + blr +#endif /* 0 */ + +/* + * giveup_altivec(tsk) + * Disable VMX for the task given as the argument, + * and save the vector registers in its thread_struct. + * Enables the VMX for use in the kernel on return. + */ +_GLOBAL(giveup_altivec) + mfmsr r5 + oris r5,r5,MSR_VEC at h + mtmsrd r5 /* enable use of VMX now */ + isync + cmpdi 0,r3,0 + beqlr- /* if no previous owner, done */ + addi r3,r3,THREAD /* want THREAD of task */ + ld r5,PT_REGS(r3) + cmpdi 0,r5,0 + SAVE_32VRS(0,r4,r3) + mfvscr vr0 + li r4,THREAD_VSCR + stvx vr0,r4,r3 + beq 1f + ld r4,_MSR-STACK_FRAME_OVERHEAD(r5) + lis r3,MSR_VEC at h + andc r4,r4,r3 /* disable FP for previous task */ + std r4,_MSR-STACK_FRAME_OVERHEAD(r5) +1: +#ifndef CONFIG_SMP + li r5,0 + ld r4,last_task_used_altivec at got(r2) + std r5,0(r4) +#endif /* CONFIG_SMP */ + blr + +#endif /* CONFIG_ALTIVEC */ + +_GLOBAL(__setup_cpu_power3) + blr + /* kexec_wait(phys_cpu) * * wait for the flag to change, indicating this kernel is going away but From david at gibson.dropbear.id.au Mon Aug 1 15:53:52 2005 From: david at gibson.dropbear.id.au (David Gibson) Date: Mon, 1 Aug 2005 15:53:52 +1000 (EST) Subject: [PATCH 5/8] Fix apparent code overlap in ppc64 head.S In-Reply-To: <20050801054810.GA10853@localhost.localdomain> Message-ID: <20050801055352.B0DD267E24@ozlabs.org> An #if/#else construct near the top of ppc64's head.S appears to create overlapping sections of code for iSeries and pSeries (i.e. one thing on iSeries and something different in the same place on pSeries). In fact, checking the various absolute offsets, it doesn't. This patch unravels the #ifdefs to make it more obvious what's going on. This accomplishes another microstep towards a single kernel image which can boot both iSeries and pSeries. Signed-off-by: David Gibson arch/ppc64/kernel/head.S | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: working-2.6/arch/ppc64/kernel/head.S =================================================================== --- working-2.6.orig/arch/ppc64/kernel/head.S 2005-07-28 14:23:18.000000000 +1000 +++ working-2.6/arch/ppc64/kernel/head.S 2005-07-28 14:23:20.000000000 +1000 @@ -92,6 +92,7 @@ /* Catch branch to 0 in real mode */ trap + #ifdef CONFIG_PPC_ISERIES /* * At offset 0x20, there is a pointer to iSeries LPAR data. @@ -118,7 +119,7 @@ embedded_sysmap_end: .llong 0 -#else /* CONFIG_PPC_ISERIES */ +#endif /* CONFIG_PPC_ISERIES */ /* Secondary processors spin on this value until it goes to 1. */ .globl __secondary_hold_spinloop @@ -168,7 +169,6 @@ BUG_OPCODE #endif #endif -#endif /* This value is used to mark exception frames on the stack. */ .section ".toc","aw" From david at gibson.dropbear.id.au Mon Aug 1 15:53:57 2005 From: david at gibson.dropbear.id.au (David Gibson) Date: Mon, 1 Aug 2005 15:53:57 +1000 (EST) Subject: [PATCH 6/8] Remove unneeded #defines in head.S In-Reply-To: <20050801054810.GA10853@localhost.localdomain> Message-ID: <20050801055357.94EE367E39@ozlabs.org> arch/ppc64/kernel/head.S #defines SECONDARY_PROCESSORS then has some #ifdefs based on it. Whatever purpose this had is long lost, this patch removes it. Likewise, head.S defines H_SET_ASR, which is now defined, along with other hypervisor call numbers in hvcall.h. This patch deletes it, as well, from head.S. Signed-off-by: David Gibson arch/ppc64/kernel/head.S | 11 ----------- 1 files changed, 11 deletions(-) Index: working-2.6/arch/ppc64/kernel/head.S =================================================================== --- working-2.6.orig/arch/ppc64/kernel/head.S 2005-07-28 14:23:20.000000000 +1000 +++ working-2.6/arch/ppc64/kernel/head.S 2005-07-28 14:23:22.000000000 +1000 @@ -23,8 +23,6 @@ * 2 of the License, or (at your option) any later version. */ -#define SECONDARY_PROCESSORS - #include #include #include @@ -43,11 +41,6 @@ #endif /* - * hcall interface to pSeries LPAR - */ -#define H_SET_ASR 0x30 - -/* * We layout physical memory as follows: * 0x0000 - 0x00ff : Secondary processor spin code * 0x0100 - 0x2fff : pSeries Interrupt prologs @@ -628,9 +621,7 @@ cmpwi 0,r23,0 beq iSeries_secondary_smp_loop /* Loop until told to go */ -#ifdef SECONDARY_PROCESSORS bne .__secondary_start /* Loop until told to go */ -#endif iSeries_secondary_smp_loop: /* Let the Hypervisor know we are alive */ /* 8002 is a call to HvCallCfg::getLps, a harmless Hypervisor function */ @@ -1324,10 +1315,8 @@ cmpwi 0,r23,0 #ifdef CONFIG_SMP -#ifdef SECONDARY_PROCESSORS bne .__secondary_start #endif -#endif b 3b /* Loop until told to go */ #ifdef CONFIG_PPC_ISERIES From david at gibson.dropbear.id.au Mon Aug 1 15:53:58 2005 From: david at gibson.dropbear.id.au (David Gibson) Date: Mon, 1 Aug 2005 15:53:58 +1000 (EST) Subject: [PATCH 7/8] Tweak comments in ppc64 head.S In-Reply-To: <20050801054810.GA10853@localhost.localdomain> Message-ID: <20050801055358.E366367E40@ozlabs.org> This patch adjust some comments in head.S for accuracy, clarity, and spelling. Signed-off-by: David Gibson arch/ppc64/kernel/head.S | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: working-2.6/arch/ppc64/kernel/head.S =================================================================== --- working-2.6.orig/arch/ppc64/kernel/head.S 2005-07-28 14:23:22.000000000 +1000 +++ working-2.6/arch/ppc64/kernel/head.S 2005-07-28 14:23:24.000000000 +1000 @@ -147,7 +147,7 @@ std r24,__secondary_hold_acknowledge at l(0) sync - /* All secondary cpu's wait here until told to start. */ + /* All secondary cpus wait here until told to start. */ 100: ld r4,__secondary_hold_spinloop at l(0) cmpdi 0,r4,1 bne 100b @@ -702,8 +702,8 @@ * R9 contains the saved CR, r13 points to the paca, * r10 contains the (bad) kernel stack pointer, * r11 and r12 contain the saved SRR0 and SRR1. - * We switch to using the paca guard page as an emergency stack, - * save the registers there, and call kernel_bad_stack(), which panics. + * We switch to using an emergency stack, save the registers there, + * and call kernel_bad_stack(), which panics. */ bad_stack: ld r1,PACAEMERGSP(r13) @@ -1302,7 +1302,7 @@ b .kexec_wait /* next kernel might do better */ 2: mtspr SPRG3,r13 /* Save vaddr of paca in SPRG3 */ - /* From now on, r24 is expected to be logica cpuid */ + /* From now on, r24 is expected to be logical cpuid */ mr r24,r5 3: HMT_LOW lbz r23,PACAPROCSTART(r13) /* Test if this processor should */ From david at gibson.dropbear.id.au Mon Aug 1 15:53:59 2005 From: david at gibson.dropbear.id.au (David Gibson) Date: Mon, 1 Aug 2005 15:53:59 +1000 (EST) Subject: [PATCH 8/8] Move variables in ppc64 head.S from .data to .bss In-Reply-To: <20050801054810.GA10853@localhost.localdomain> Message-ID: <20050801055359.9FFE567E46@ozlabs.org> The ppc64 head.S defines several zero-initialized structures, such as the empty_zero_page and the kernel top-level pagetable. Currently they are defined to be in the data section. However, they're not used until after the bss is cleared, so this patch moves them to the bss, saving two and a half pages from the vmlinux. Signed-off-by: David Gibson arch/ppc64/kernel/head.S | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-) Index: working-2.6/arch/ppc64/kernel/head.S =================================================================== --- working-2.6.orig/arch/ppc64/kernel/head.S 2005-07-28 15:07:47.000000000 +1000 +++ working-2.6/arch/ppc64/kernel/head.S 2005-07-28 15:52:43.000000000 +1000 @@ -1970,20 +1970,19 @@ /* * We put a few things here that have to be page-aligned. - * This stuff goes at the beginning of the data segment, - * which is page-aligned. + * This stuff goes at the beginning of the bss, which is page-aligned. */ - .data + .section ".bss" + .align 12 - .globl sdata -sdata: + .globl empty_zero_page empty_zero_page: - .space 4096 + .space PAGE_SIZE .globl swapper_pg_dir swapper_pg_dir: - .space 4096 + .space PAGE_SIZE /* * This space gets a copy of optional info passed to us by the bootstrap From olh at suse.de Mon Aug 1 16:19:04 2005 From: olh at suse.de (Olaf Hering) Date: Mon, 1 Aug 2005 08:19:04 +0200 Subject: RFC: Kill off addRamDisk In-Reply-To: <20050728033118.GC4543@localhost.localdomain> References: <20050728033118.GC4543@localhost.localdomain> Message-ID: <20050801061904.GA21952@suse.de> On Thu, Jul 28, David Gibson wrote: > Can anyone think of any problems with abolishing addRamDisk - the icky > iSeries-specific method of loading an initial ramdisk. If not, I'll > push this to Andrew. > > iSeries has a home-built method of attaching an initial ramdisk, which > relies on an addRamDisk helper program poking the data, location and > offset into the vmlinux after build. Both SLES and RHEL now use the > normal initramfs mechanisms instead of the iSeries specific initrd on > 2.6 kernels, so let's get rid of this obsolete mechanism. How is the initramfs vs. loop mounted file related? Maybe I miss the point, how is the initrd content passed to the kernel during boot after your change? pseries has its own section in zImage.initrd, and yaboot passes just the initrd memrange in r3+r4. Can the $O/usr/initramfs_data.cpio.gz file linked later into the vmlinux file? I see an '.init.ramfs' section there, perhaps you want to replace the addRamdisk binary with an addRamdisk shell script which calls objcopy. But this way we lose the overlay feature. A simple 'find . | cpio -H newc --create | gzip -9 > tmp_initrd.gz' would not work anymore as unprivileged user because mknod cant be done that way. From olh at suse.de Mon Aug 1 16:29:29 2005 From: olh at suse.de (Olaf Hering) Date: Mon, 1 Aug 2005 08:29:29 +0200 Subject: [PPC64] Remove another fixed address constraint In-Reply-To: <20050725061635.GD19817@localhost.localdomain> References: <20050725061635.GD19817@localhost.localdomain> Message-ID: <20050801062929.GA22102@suse.de> On Mon, Jul 25, David Gibson wrote: > Presently the LparMap, one of the structures the kernel shares with > the legacy iSeries hypervisor has a fixed offset address in head.S. > This patch changes this so the LparMap is a normally initialized > structure, without fixed address. This allows us to use macros to > compute some of the values in the structure, which wasn't previously > possible because the assembler always uses signed-% which gets the > wrong answers for the computations in question. > > Unfortunately, a gcc bug means that doing this requires another > structure (hvReleaseData) to be initialized in asm instead of C, but > on the whole the result is cleaner than before. I think this change caused this compile error in rc4: {standard input}: Assembler messages: {standard input}:254: Error: value of 4000000000002080 too large for field of 4 bytes at 0000000000002108 make[1]: *** [arch/ppc64/kernel/LparData.o] Error 1 binutils-2.16.91.0.2 gcc-4.0.2_20050727 From david at gibson.dropbear.id.au Mon Aug 1 16:31:07 2005 From: david at gibson.dropbear.id.au (David Gibson) Date: Mon, 1 Aug 2005 16:31:07 +1000 Subject: RFC: Kill off addRamDisk In-Reply-To: <20050801061904.GA21952@suse.de> References: <20050728033118.GC4543@localhost.localdomain> <20050801061904.GA21952@suse.de> Message-ID: <20050801063107.GB13052@localhost.localdomain> On Mon, Aug 01, 2005 at 08:19:04AM +0200, Olaf Hering wrote: > On Thu, Jul 28, David Gibson wrote: > > > Can anyone think of any problems with abolishing addRamDisk - the icky > > iSeries-specific method of loading an initial ramdisk. If not, I'll > > push this to Andrew. > > > > iSeries has a home-built method of attaching an initial ramdisk, which > > relies on an addRamDisk helper program poking the data, location and > > offset into the vmlinux after build. Both SLES and RHEL now use the > > normal initramfs mechanisms instead of the iSeries specific initrd on > > 2.6 kernels, so let's get rid of this obsolete mechanism. > > How is the initramfs vs. loop mounted file related? > Maybe I miss the point, how is the initrd content passed to the kernel > during boot after your change? pseries has its own section in zImage.initrd, > and yaboot passes just the initrd memrange in r3+r4. Yeah, check the rest of the thread - I realized I was mistaken and that the initramfs, too, needed addRamDisk. I've sent a new patch which removes the fixed address from the NACA without eliminating addRamDisk. Changing addRamDisk to use objcopy instead of direct poking might be something to look at later. > Can the $O/usr/initramfs_data.cpio.gz file linked later into the vmlinux > file? I see an '.init.ramfs' section there, perhaps you want to replace > the addRamdisk binary with an addRamdisk shell script which calls > objcopy. But this way we lose the overlay feature. I'm not sure what you mean by "the overlay feature". > A simple 'find . | cpio -H newc --create | gzip -9 > tmp_initrd.gz' > would not work anymore as unprivileged user because mknod cant be done > that way. How does the method used to combine the vmlinux and initrd have any bearing on what we can do when generating the initrd? -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/people/dgibson From david at gibson.dropbear.id.au Mon Aug 1 16:35:54 2005 From: david at gibson.dropbear.id.au (David Gibson) Date: Mon, 1 Aug 2005 16:35:54 +1000 Subject: [PPC64] Remove another fixed address constraint In-Reply-To: <20050801062929.GA22102@suse.de> References: <20050725061635.GD19817@localhost.localdomain> <20050801062929.GA22102@suse.de> Message-ID: <20050801063554.GC13052@localhost.localdomain> On Mon, Aug 01, 2005 at 08:29:29AM +0200, Olaf Hering wrote: > On Mon, Jul 25, David Gibson wrote: > > > Presently the LparMap, one of the structures the kernel shares with > > the legacy iSeries hypervisor has a fixed offset address in head.S. > > This patch changes this so the LparMap is a normally initialized > > structure, without fixed address. This allows us to use macros to > > compute some of the values in the structure, which wasn't previously > > possible because the assembler always uses signed-% which gets the > > wrong answers for the computations in question. > > > > Unfortunately, a gcc bug means that doing this requires another > > structure (hvReleaseData) to be initialized in asm instead of C, but > > on the whole the result is cleaner than before. > > I think this change caused this compile error in rc4: > > {standard input}: Assembler messages: > {standard input}:254: Error: value of 4000000000002080 too large for field of 4 bytes at 0000000000002108 > make[1]: *** [arch/ppc64/kernel/LparData.o] Error 1 > > binutils-2.16.91.0.2 > gcc-4.0.2_20050727 Hrm.. definitely works here. Is this with any other patches? Can you send the .s file? That might help be debug it. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/people/dgibson From olh at suse.de Mon Aug 1 16:44:05 2005 From: olh at suse.de (Olaf Hering) Date: Mon, 1 Aug 2005 08:44:05 +0200 Subject: RFC: Kill off addRamDisk In-Reply-To: <20050801063107.GB13052@localhost.localdomain> References: <20050728033118.GC4543@localhost.localdomain> <20050801061904.GA21952@suse.de> <20050801063107.GB13052@localhost.localdomain> Message-ID: <20050801064405.GA22175@suse.de> On Mon, Aug 01, David Gibson wrote: > > Can the $O/usr/initramfs_data.cpio.gz file linked later into the vmlinux > > file? I see an '.init.ramfs' section there, perhaps you want to replace > > the addRamdisk binary with an addRamdisk shell script which calls > > objcopy. But this way we lose the overlay feature. > > I'm not sure what you mean by "the overlay feature". The initrd content passed via the bootloader is extracted over the in-kernel cpio image. initramfs_data.cpio.gz contains per default /dev, /dev/console and /root. Thats enough to run udevstart to fill /dev with other required /sys/class/{mem,tty}/ device nodes. Maybe it will work also with an empty rootfs, if nothing fails when the stdin/stdout device node is missing. > > A simple 'find . | cpio -H newc --create | gzip -9 > tmp_initrd.gz' > > would not work anymore as unprivileged user because mknod cant be done > > that way. > > How does the method used to combine the vmlinux and initrd have any > bearing on what we can do when generating the initrd? an user process cant run 'mknod ./dev/console'. I see a panic() in init/main.c if /dev/console is missing. From olh at suse.de Mon Aug 1 16:45:02 2005 From: olh at suse.de (Olaf Hering) Date: Mon, 1 Aug 2005 08:45:02 +0200 Subject: [PPC64] Remove another fixed address constraint In-Reply-To: <20050801063554.GC13052@localhost.localdomain> References: <20050725061635.GD19817@localhost.localdomain> <20050801062929.GA22102@suse.de> <20050801063554.GC13052@localhost.localdomain> Message-ID: <20050801064502.GB22175@suse.de> On Mon, Aug 01, David Gibson wrote: > Hrm.. definitely works here. Is this with any other patches? Can you > send the .s file? That might help be debug it. It works with SLES9 gcc3, only gcc4 (or recent binutils) do not like it. From david at gibson.dropbear.id.au Mon Aug 1 17:09:35 2005 From: david at gibson.dropbear.id.au (David Gibson) Date: Mon, 1 Aug 2005 17:09:35 +1000 Subject: RFC: Kill off addRamDisk In-Reply-To: <20050801064405.GA22175@suse.de> References: <20050728033118.GC4543@localhost.localdomain> <20050801061904.GA21952@suse.de> <20050801063107.GB13052@localhost.localdomain> <20050801064405.GA22175@suse.de> Message-ID: <20050801070935.GD13052@localhost.localdomain> On Mon, Aug 01, 2005 at 08:44:05AM +0200, Olaf Hering wrote: > On Mon, Aug 01, David Gibson wrote: > > > > Can the $O/usr/initramfs_data.cpio.gz file linked later into the vmlinux > > > file? I see an '.init.ramfs' section there, perhaps you want to replace > > > the addRamdisk binary with an addRamdisk shell script which calls > > > objcopy. But this way we lose the overlay feature. > > > > I'm not sure what you mean by "the overlay feature". > > The initrd content passed via the bootloader is extracted over the > in-kernel cpio image. I assume you mean the fact the ramfs added by addRamDisk is overlayed on top of the one built into the vmlinux section? iSeries has no bootloader.. Hrm.. to address that in an objcopy solution we would need to either a) allow multiple initramfs sections, b) allow multiple, concatenated cpios within the ramfs section or c) have the user program extract the preexisting ramfs section, combine it with the new cpio, and replace the combined image into the ramfs. Still, doesn't matter for now, addRamDisk can stay for now. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/people/dgibson From david at gibson.dropbear.id.au Mon Aug 1 17:10:50 2005 From: david at gibson.dropbear.id.au (David Gibson) Date: Mon, 1 Aug 2005 17:10:50 +1000 Subject: [PPC64] Remove another fixed address constraint In-Reply-To: <20050801064502.GB22175@suse.de> References: <20050725061635.GD19817@localhost.localdomain> <20050801062929.GA22102@suse.de> <20050801063554.GC13052@localhost.localdomain> <20050801064502.GB22175@suse.de> Message-ID: <20050801071050.GE13052@localhost.localdomain> On Mon, Aug 01, 2005 at 08:45:02AM +0200, Olaf Hering wrote: > On Mon, Aug 01, David Gibson wrote: > > > Hrm.. definitely works here. Is this with any other patches? Can you > > send the .s file? That might help be debug it. > > It works with SLES9 gcc3, only gcc4 (or recent binutils) do not like > it. gcc4 can't be the problem; that's an assembler error. I am using: sneetch:~/kernel$ powerpc64-linux-as --version GNU assembler 2.15.94 20041116 Copyright 2002 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License. This program has absolutely no warranty. This assembler was configured for a target of `powerpc-linux'. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/people/dgibson From benh at kernel.crashing.org Mon Aug 1 18:37:57 2005 From: benh at kernel.crashing.org (Benjamin Herrenschmidt) Date: Mon, 01 Aug 2005 10:37:57 +0200 Subject: [PATCH 0/8] Assorted cleanups to head.S In-Reply-To: <20050801054810.GA10853@localhost.localdomain> References: <20050801054810.GA10853@localhost.localdomain> Message-ID: <1122885477.18835.103.camel@gaston> On Mon, 2005-08-01 at 15:48 +1000, David Gibson wrote: > Hi Paul, > > Please forward upstream, if acceptable. This stack of 8 patches makes > a number of cleanups to head.S, in the process removing several pages > from the kernel runtime image, and a couple more from the vmlinux. All looks good after a quick look... if it boots, I'd say submit it :) Ben. From amodra at bigpond.net.au Tue Aug 2 13:13:45 2005 From: amodra at bigpond.net.au (Alan Modra) Date: Tue, 2 Aug 2005 12:43:45 +0930 Subject: Error: value of 4000000000002080 too large for field of 4 bytes In-Reply-To: <20050801071050.GE13052@localhost.localdomain> References: <20050725061635.GD19817@localhost.localdomain> <20050801062929.GA22102@suse.de> <20050801063554.GC13052@localhost.localdomain> <20050801064502.GB22175@suse.de> <20050801071050.GE13052@localhost.localdomain> Message-ID: <20050802031345.GA2874@bubble.grove.modra.org> On Mon, Aug 01, 2005 at 05:10:50PM +1000, David Gibson wrote: > gcc4 can't be the problem; that's an assembler error. I am using: Yes, it is an assembler bug, present in current sources and all older versions I checked. PowerPC gas prior to 2005-03-02 didn't tickle the bug because it didn't reduce "lparMapPhys" to "xLparMap+0x400...00000" and from there to ".data+0x4000...02080". So with older gas, you had a reloc against lparMapPhys with offset 0, and an entry in the symbol table, section .data, value 0x4000...02080. With newer gas, you (try to) have a reloc against .data with offset 0x4000...02080. It's this offset that gas is complaining about, because ppc gas writes the value into the section contents. Of course, since ppc uses RELA type relocs (addend stored separately from the section contents), the section contents are immaterial; ld will overwrite them with the relocated value. * config/tc-ppc.c (md_apply_fix ): Don't warn on overflow if emitting a reloc. Index: gas/config/tc-ppc.c =================================================================== RCS file: /cvs/src/src/gas/config/tc-ppc.c,v retrieving revision 1.101 diff -u -p -r1.101 tc-ppc.c --- gas/config/tc-ppc.c 5 Jul 2005 13:25:52 -0000 1.101 +++ gas/config/tc-ppc.c 2 Aug 2005 03:06:18 -0000 @@ -6014,6 +6014,13 @@ md_apply_fix (fixP, valP, seg) #ifdef OBJ_ELF fixP->fx_addnumber = value; + + /* PowerPC uses RELA relocs, ie. the reloc addend is stored separately + from the section contents. If we are going to be emitting a reloc + then the section contents are immaterial, so don't warn if they + happen to overflow. Leave such warnings to ld. */ + if (!fixP->fx_done) + fixP->fx_no_overflow = 1; #else if (fixP->fx_r_type != BFD_RELOC_PPC_TOC16) fixP->fx_addnumber = 0; -- Alan Modra IBM OzLabs - Linux Technology Centre From dgibson at ozlabs.org Tue Aug 2 13:58:54 2005 From: dgibson at ozlabs.org (David Gibson) Date: Tue, 2 Aug 2005 13:58:54 +1000 Subject: Error: value of 4000000000002080 too large for field of 4 bytes In-Reply-To: <20050802031345.GA2874@bubble.grove.modra.org> References: <20050725061635.GD19817@localhost.localdomain> <20050801062929.GA22102@suse.de> <20050801063554.GC13052@localhost.localdomain> <20050801064502.GB22175@suse.de> <20050801071050.GE13052@localhost.localdomain> <20050802031345.GA2874@bubble.grove.modra.org> Message-ID: <20050802035854.GA3113@localhost.localdomain> On Tue, Aug 02, 2005 at 12:43:45PM +0930, Alan Modra wrote: > On Mon, Aug 01, 2005 at 05:10:50PM +1000, David Gibson wrote: > > gcc4 can't be the problem; that's an assembler error. I am using: > > Yes, it is an assembler bug, present in current sources and all older > versions I checked. PowerPC gas prior to 2005-03-02 didn't tickle the > bug because it didn't reduce "lparMapPhys" to "xLparMap+0x400...00000" > and from there to ".data+0x4000...02080". So with older gas, you > had a reloc against lparMapPhys with offset 0, and an entry in the > symbol table, section .data, value 0x4000...02080. With newer gas, > you (try to) have a reloc against .data with offset 0x4000...02080. > It's this offset that gas is complaining about, because ppc gas writes > the value into the section contents. Of course, since ppc uses RELA > type relocs (addend stored separately from the section contents), the > section contents are immaterial; ld will overwrite them with the > relocated value. > > * config/tc-ppc.c (md_apply_fix ): Don't warn on overflow > if emitting a reloc. Ah! Does this mean with the fix below, I shouldn't need the indirection of defining lparMapPhys, and could simply do: .long xLparMap - KERNELBASE Thanks Alan, have you pushed this fix upstream yet? > Index: gas/config/tc-ppc.c > =================================================================== > RCS file: /cvs/src/src/gas/config/tc-ppc.c,v > retrieving revision 1.101 > diff -u -p -r1.101 tc-ppc.c > --- gas/config/tc-ppc.c 5 Jul 2005 13:25:52 -0000 1.101 > +++ gas/config/tc-ppc.c 2 Aug 2005 03:06:18 -0000 > @@ -6014,6 +6014,13 @@ md_apply_fix (fixP, valP, seg) > > #ifdef OBJ_ELF > fixP->fx_addnumber = value; > + > + /* PowerPC uses RELA relocs, ie. the reloc addend is stored separately > + from the section contents. If we are going to be emitting a reloc > + then the section contents are immaterial, so don't warn if they > + happen to overflow. Leave such warnings to ld. */ > + if (!fixP->fx_done) > + fixP->fx_no_overflow = 1; > #else > if (fixP->fx_r_type != BFD_RELOC_PPC_TOC16) > fixP->fx_addnumber = 0; > -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/people/dgibson From bdc at carlstrom.com Tue Aug 2 15:18:04 2005 From: bdc at carlstrom.com (Brian D. Carlstrom) Date: 2 Aug 2005 05:18:04 -0000 Subject: Fan control for new PowerMac G5 2.7GHz machines? Message-ID: <20050802051804.29854.qmail@electricrain.com> I'm trying to get linuxppc64 fan control working on a 2.7GHz G5 machine. I started with YDL 4.0.1's 2.6.10 kernel and already have applied the fixup_device_tree code from: [PATCH] ppc64: Fix booting on latest G5 models http://ozlabs.org/pipermail/linuxppc64-dev/2005-May/004140.html Its nice to be up and running but the fans are running at full speed, similar to what I remember with YDL 4.0 and the therm_pm72 patch. /var/log/dmesg shows the following: PowerMac G5 Thermal control driver 1.1 adb: starting probe task... adb: finished probe task... Detected fan controls: 0: PWM fan, id 1, location: BACKSIDE,SYS CTRLR FAN 1: RPM fan, id 2, location: DRIVE BAY 2: PWM fan, id 2, location: SLOT,PCI FAN 3: RPM fan, id 3, location: CPU A INTAKE 4: RPM fan, id 4, location: CPU A EXHAUST 5: RPM fan, id 5, location: CPU B INTAKE 6: RPM fan, id 6, location: CPU B EXHAUST 7: RPM fan, id 1, location: CPU A PUMP 8: RPM fan, id 0, location: CPU B PUMP I noticed that YDL seems to have applied the main part of this patch to their 2.6.10 tree, as you can see from the "SYS CTRLR FAN" string, although they left the version as "1.1": Patch: Thermal control for Xserve http://patchwork.ozlabs.org/linuxppc64/patch?id=697 Beyond the fixup_device_tree patch, I haven't seen much talk about the status of linuxppc64 on the 2.7 GHz G5. There was this once post on yellowdog-devel: g5 2.7 works with 4.0.91 beta. http://lists.terrasoftsolutions.com/pipermail/yellowdog-devel/2005-June/000433.html but it's kind of sparse on the details. Can anyone shed some light on the fan support for these new machines? Am I just doing something simple wrong or missing something obvious? Thanks, -bri From jdl at freescale.com Wed Aug 3 08:59:35 2005 From: jdl at freescale.com (Jon Loeliger) Date: Tue, 02 Aug 2005 17:59:35 -0500 Subject: Beginning Merger Patch Message-ID: <1123023575.2614.25.camel@cashmere.sps.mot.com> Folks, I have grabbed my asbestos suit. Here is a patch to begin the process of merging the PPC32 and PPC64 include directories into a new common "powerpc" arch. This patch introduces the include/asm-powerpc directory. It then places into it, all of the files in asm-ppc and asm-ppc64 that are essentially identical. A stub is left in asm-ppc and asm-ppc64 pointing to the unified files. No real thought went into this set of files; these are the dead-simple identical files for starters! This patch can be rsync'ed from here: rsync www.jdl.com::pub/software/patches/linux-20050802-01.patch 20050802-01.patch It may be cg-pull'ed from this tree: cg-clone http://www.jdl.com/pub/software/linux-2.6-jdl.git or cg-clone rsync://www.jdl.com/pub/software/linux-2.6-jdl.git Oh yeah. jdl Signed-off-by: Jon Loeliger --- commit 2c6a0ac49cb3ec2b73fc48b015aa3550e2df27c7 tree f12b4db25885fb67cacf1597daf2a789140c974d parent 9a351e30d72d409ec62c83f380e330e0baa584b4 author Jon Loeliger Tue, 02 Aug 2005 14:27:26 -0500 committer Jon Loeliger Tue, 02 Aug 2005 14:27:26 -0500 include/asm-powerpc/8253pit.h | 10 +++++++++ include/asm-powerpc/agp.h | 23 +++++++++++++++++++++ include/asm-powerpc/cputime.h | 1 + include/asm-powerpc/emergency-restart.h | 1 + include/asm-powerpc/errno.h | 18 ++++++++++++++++ include/asm-powerpc/hdreg.h | 1 + include/asm-powerpc/ipc.h | 1 + include/asm-powerpc/linkage.h | 6 +++++ include/asm-powerpc/local.h | 1 + include/asm-powerpc/parport.h | 18 ++++++++++++++++ include/asm-powerpc/percpu.h | 1 + include/asm-powerpc/poll.h | 32 +++++++++++++++++++++++++++++ include/asm-powerpc/resource.h | 1 + include/asm-powerpc/shmparam.h | 13 ++++++++++++ include/asm-powerpc/xor.h | 1 + include/asm-ppc/8253pit.h | 12 ++--------- include/asm-ppc/agp.h | 25 ++--------------------- include/asm-ppc/cputime.h | 5 ----- include/asm-ppc/emergency-restart.h | 5 ----- include/asm-ppc/errno.h | 13 ++---------- include/asm-ppc/linkage.h | 8 ++----- include/asm-ppc/local.h | 5 ----- include/asm-ppc/parport.h | 19 +---------------- include/asm-ppc/percpu.h | 5 ----- include/asm-ppc/poll.h | 25 ++--------------------- include/asm-ppc/resource.h | 5 ----- include/asm-ppc/shmparam.h | 7 ++---- include/asm-ppc64/8253pit.h | 12 ++--------- include/asm-ppc64/agp.h | 25 ++--------------------- include/asm-ppc64/cputime.h | 5 ----- include/asm-ppc64/emergency-restart.h | 5 ----- include/asm-ppc64/errno.h | 20 ++---------------- include/asm-ppc64/linkage.h | 8 ++----- include/asm-ppc64/parport.h | 19 +---------------- include/asm-ppc64/percpu.h | 5 ----- include/asm-ppc64/poll.h | 34 ++----------------------------- include/asm-ppc64/resource.h | 5 ----- include/asm-ppc64/shmparam.h | 15 ++------------ 38 files changed, 154 insertions(+), 261 deletions(-) diff --git a/include/asm-powerpc/8253pit.h b/include/asm-powerpc/8253pit.h new file mode 100644 --- /dev/null +++ b/include/asm-powerpc/8253pit.h @@ -0,0 +1,10 @@ +/* + * 8253/8254 Programmable Interval Timer + */ + +#ifndef _ASM_POWERPC_8253PIT_H +#define _ASM_POWERPC_8253PIT_H + +#define PIT_TICK_RATE 1193182UL + +#endif /* _ASM_POWERPC_8253PIT_H */ diff --git a/include/asm-powerpc/agp.h b/include/asm-powerpc/agp.h new file mode 100644 --- /dev/null +++ b/include/asm-powerpc/agp.h @@ -0,0 +1,23 @@ +#ifndef _ASM_POWERPC_AGP_H +#define _ASM_POWERPC_AGP_H + +#include + +/* nothing much needed here */ + +#define map_page_into_agp(page) +#define unmap_page_from_agp(page) +#define flush_agp_mappings() +#define flush_agp_cache() mb() + +/* Convert a physical address to an address suitable for the GART. */ +#define phys_to_gart(x) (x) +#define gart_to_phys(x) (x) + +/* GATT allocation. Returns/accepts GATT kernel virtual address. */ +#define alloc_gatt_pages(order) \ + ((char *)__get_free_pages(GFP_KERNEL, (order))) +#define free_gatt_pages(table, order) \ + free_pages((unsigned long)(table), (order)) + +#endif /* _ASM_POWERPC_AGP_H */ diff --git a/include/asm-powerpc/cputime.h b/include/asm-powerpc/cputime.h new file mode 100644 --- /dev/null +++ b/include/asm-powerpc/cputime.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-powerpc/emergency-restart.h b/include/asm-powerpc/emergency-restart.h new file mode 100644 --- /dev/null +++ b/include/asm-powerpc/emergency-restart.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-powerpc/errno.h b/include/asm-powerpc/errno.h new file mode 100644 --- /dev/null +++ b/include/asm-powerpc/errno.h @@ -0,0 +1,18 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef _ASM_POWERPC_ERRNO_H +#define _ASM_POWERPC_ERRNO_H + +#include + +#undef EDEADLOCK +#define EDEADLOCK 58 /* File locking deadlock error */ + +#define _LAST_ERRNO 516 + +#endif /* _ASM_POWERPC_ERRNO_H */ diff --git a/include/asm-powerpc/hdreg.h b/include/asm-powerpc/hdreg.h new file mode 100644 --- /dev/null +++ b/include/asm-powerpc/hdreg.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-powerpc/ipc.h b/include/asm-powerpc/ipc.h new file mode 100644 --- /dev/null +++ b/include/asm-powerpc/ipc.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-powerpc/linkage.h b/include/asm-powerpc/linkage.h new file mode 100644 --- /dev/null +++ b/include/asm-powerpc/linkage.h @@ -0,0 +1,6 @@ +#ifndef _ASM_POWERPC_LINKAGE_H +#define _ASM_POWERPC_LINKAGE_H + +/* Nothing to see here... */ + +#endif /* _ASM_POWERPC_LINKAGE_H */ diff --git a/include/asm-powerpc/local.h b/include/asm-powerpc/local.h new file mode 100644 --- /dev/null +++ b/include/asm-powerpc/local.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-powerpc/parport.h b/include/asm-powerpc/parport.h new file mode 100644 --- /dev/null +++ b/include/asm-powerpc/parport.h @@ -0,0 +1,18 @@ +/* + * parport.h: platform-specific PC-style parport initialisation + * + * Copyright (C) 1999, 2000 Tim Waugh + * + * This file should only be included by drivers/parport/parport_pc.c. + */ + +#ifndef _ASM_POWERPC_PARPORT_H +#define _ASM_POWERPC_PARPORT_H + +static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma); +static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) +{ + return parport_pc_find_isa_ports (autoirq, autodma); +} + +#endif /* _ASM_POWERPC_PARPORT_H */ diff --git a/include/asm-powerpc/percpu.h b/include/asm-powerpc/percpu.h new file mode 100644 --- /dev/null +++ b/include/asm-powerpc/percpu.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-powerpc/poll.h b/include/asm-powerpc/poll.h new file mode 100644 --- /dev/null +++ b/include/asm-powerpc/poll.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2001 PPC64 Team, IBM Corp + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef _ASM_POWERPC_POLL_H +#define _ASM_POWERPC_POLL_H + +#define POLLIN 0x0001 +#define POLLPRI 0x0002 +#define POLLOUT 0x0004 +#define POLLERR 0x0008 +#define POLLHUP 0x0010 +#define POLLNVAL 0x0020 +#define POLLRDNORM 0x0040 +#define POLLRDBAND 0x0080 +#define POLLWRNORM 0x0100 +#define POLLWRBAND 0x0200 +#define POLLMSG 0x0400 +#define POLLREMOVE 0x1000 + +struct pollfd { + int fd; + short events; + short revents; +}; + +#endif /* _ASM_POWERPC_POLL_H */ diff --git a/include/asm-powerpc/resource.h b/include/asm-powerpc/resource.h new file mode 100644 --- /dev/null +++ b/include/asm-powerpc/resource.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-powerpc/shmparam.h b/include/asm-powerpc/shmparam.h new file mode 100644 --- /dev/null +++ b/include/asm-powerpc/shmparam.h @@ -0,0 +1,13 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef _ASM_POWERPC_SHMPARAM_H +#define _ASM_POWERPC_SHMPARAM_H + +#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ + +#endif /* _ASM_POWERPC_SHMPARAM_H */ diff --git a/include/asm-powerpc/xor.h b/include/asm-powerpc/xor.h new file mode 100644 --- /dev/null +++ b/include/asm-powerpc/xor.h @@ -0,0 +1 @@ +#include diff --git a/include/asm-ppc/8253pit.h b/include/asm-ppc/8253pit.h --- a/include/asm-ppc/8253pit.h +++ b/include/asm-ppc/8253pit.h @@ -1,10 +1,2 @@ -/* - * 8253/8254 Programmable Interval Timer - */ - -#ifndef _8253PIT_H -#define _8253PIT_H - -#define PIT_TICK_RATE 1193182UL - -#endif +/* ppc and ppc64 are being merged into powerpc */ +#include diff --git a/include/asm-ppc/agp.h b/include/asm-ppc/agp.h --- a/include/asm-ppc/agp.h +++ b/include/asm-ppc/agp.h @@ -1,23 +1,2 @@ -#ifndef AGP_H -#define AGP_H 1 - -#include - -/* nothing much needed here */ - -#define map_page_into_agp(page) -#define unmap_page_from_agp(page) -#define flush_agp_mappings() -#define flush_agp_cache() mb() - -/* Convert a physical address to an address suitable for the GART. */ -#define phys_to_gart(x) (x) -#define gart_to_phys(x) (x) - -/* GATT allocation. Returns/accepts GATT kernel virtual address. */ -#define alloc_gatt_pages(order) \ - ((char *)__get_free_pages(GFP_KERNEL, (order))) -#define free_gatt_pages(table, order) \ - free_pages((unsigned long)(table), (order)) - -#endif +/* ppc and ppc64 are being merged into powerpc */ +#include diff --git a/include/asm-ppc/cputime.h b/include/asm-ppc/cputime.h --- a/include/asm-ppc/cputime.h +++ b/include/asm-ppc/cputime.h @@ -1,6 +1 @@ -#ifndef __PPC_CPUTIME_H -#define __PPC_CPUTIME_H - #include - -#endif /* __PPC_CPUTIME_H */ diff --git a/include/asm-ppc/emergency-restart.h b/include/asm-ppc/emergency-restart.h --- a/include/asm-ppc/emergency-restart.h +++ b/include/asm-ppc/emergency-restart.h @@ -1,6 +1 @@ -#ifndef _ASM_EMERGENCY_RESTART_H -#define _ASM_EMERGENCY_RESTART_H - #include - -#endif /* _ASM_EMERGENCY_RESTART_H */ diff --git a/include/asm-ppc/errno.h b/include/asm-ppc/errno.h --- a/include/asm-ppc/errno.h +++ b/include/asm-ppc/errno.h @@ -1,11 +1,2 @@ -#ifndef _PPC_ERRNO_H -#define _PPC_ERRNO_H - -#include - -#undef EDEADLOCK -#define EDEADLOCK 58 /* File locking deadlock error */ - -#define _LAST_ERRNO 516 - -#endif +/* ppc and ppc64 are being merged into powerpc */ +#include diff --git a/include/asm-ppc/linkage.h b/include/asm-ppc/linkage.h --- a/include/asm-ppc/linkage.h +++ b/include/asm-ppc/linkage.h @@ -1,6 +1,2 @@ -#ifndef __ASM_LINKAGE_H -#define __ASM_LINKAGE_H - -/* Nothing to see here... */ - -#endif +/* ppc and ppc64 are being merged into powerpc */ +#include diff --git a/include/asm-ppc/local.h b/include/asm-ppc/local.h --- a/include/asm-ppc/local.h +++ b/include/asm-ppc/local.h @@ -1,6 +1 @@ -#ifndef __PPC_LOCAL_H -#define __PPC_LOCAL_H - #include - -#endif /* __PPC_LOCAL_H */ diff --git a/include/asm-ppc/parport.h b/include/asm-ppc/parport.h --- a/include/asm-ppc/parport.h +++ b/include/asm-ppc/parport.h @@ -1,18 +1 @@ -/* - * parport.h: platform-specific PC-style parport initialisation - * - * Copyright (C) 1999, 2000 Tim Waugh - * - * This file should only be included by drivers/parport/parport_pc.c. - */ - -#ifndef _ASM_PPC_PARPORT_H -#define _ASM_PPC_PARPORT_H - -static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma); -static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) -{ - return parport_pc_find_isa_ports (autoirq, autodma); -} - -#endif /* !(_ASM_PPC_PARPORT_H) */ +#include diff --git a/include/asm-ppc/percpu.h b/include/asm-ppc/percpu.h --- a/include/asm-ppc/percpu.h +++ b/include/asm-ppc/percpu.h @@ -1,6 +1 @@ -#ifndef __ARCH_PPC_PERCPU__ -#define __ARCH_PPC_PERCPU__ - #include - -#endif /* __ARCH_PPC_PERCPU__ */ diff --git a/include/asm-ppc/poll.h b/include/asm-ppc/poll.h --- a/include/asm-ppc/poll.h +++ b/include/asm-ppc/poll.h @@ -1,23 +1,2 @@ -#ifndef __PPC_POLL_H -#define __PPC_POLL_H - -#define POLLIN 0x0001 -#define POLLPRI 0x0002 -#define POLLOUT 0x0004 -#define POLLERR 0x0008 -#define POLLHUP 0x0010 -#define POLLNVAL 0x0020 -#define POLLRDNORM 0x0040 -#define POLLRDBAND 0x0080 -#define POLLWRNORM 0x0100 -#define POLLWRBAND 0x0200 -#define POLLMSG 0x0400 -#define POLLREMOVE 0x1000 - -struct pollfd { - int fd; - short events; - short revents; -}; - -#endif +/* ppc and ppc64 are being merged into powerpc */ +#include diff --git a/include/asm-ppc/resource.h b/include/asm-ppc/resource.h --- a/include/asm-ppc/resource.h +++ b/include/asm-ppc/resource.h @@ -1,6 +1 @@ -#ifndef _PPC_RESOURCE_H -#define _PPC_RESOURCE_H - #include - -#endif diff --git a/include/asm-ppc/shmparam.h b/include/asm-ppc/shmparam.h --- a/include/asm-ppc/shmparam.h +++ b/include/asm-ppc/shmparam.h @@ -1,6 +1,3 @@ -#ifndef _PPC_SHMPARAM_H -#define _PPC_SHMPARAM_H +/* ppc and ppc64 are being merged into powerpc */ +#include -#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ - -#endif /* _PPC_SHMPARAM_H */ diff --git a/include/asm-ppc64/8253pit.h b/include/asm-ppc64/8253pit.h --- a/include/asm-ppc64/8253pit.h +++ b/include/asm-ppc64/8253pit.h @@ -1,10 +1,2 @@ -/* - * 8253/8254 Programmable Interval Timer - */ - -#ifndef _8253PIT_H -#define _8253PIT_H - -#define PIT_TICK_RATE 1193182UL - -#endif +/* ppc and ppc64 are being merged into powerpc */ +#include diff --git a/include/asm-ppc64/agp.h b/include/asm-ppc64/agp.h --- a/include/asm-ppc64/agp.h +++ b/include/asm-ppc64/agp.h @@ -1,23 +1,2 @@ -#ifndef AGP_H -#define AGP_H 1 - -#include - -/* nothing much needed here */ - -#define map_page_into_agp(page) -#define unmap_page_from_agp(page) -#define flush_agp_mappings() -#define flush_agp_cache() mb() - -/* Convert a physical address to an address suitable for the GART. */ -#define phys_to_gart(x) (x) -#define gart_to_phys(x) (x) - -/* GATT allocation. Returns/accepts GATT kernel virtual address. */ -#define alloc_gatt_pages(order) \ - ((char *)__get_free_pages(GFP_KERNEL, (order))) -#define free_gatt_pages(table, order) \ - free_pages((unsigned long)(table), (order)) - -#endif +/* ppc and ppc64 are being merged into powerpc */ +#include diff --git a/include/asm-ppc64/cputime.h b/include/asm-ppc64/cputime.h --- a/include/asm-ppc64/cputime.h +++ b/include/asm-ppc64/cputime.h @@ -1,6 +1 @@ -#ifndef __PPC_CPUTIME_H -#define __PPC_CPUTIME_H - #include - -#endif /* __PPC_CPUTIME_H */ diff --git a/include/asm-ppc64/emergency-restart.h b/include/asm-ppc64/emergency-restart.h --- a/include/asm-ppc64/emergency-restart.h +++ b/include/asm-ppc64/emergency-restart.h @@ -1,6 +1 @@ -#ifndef _ASM_EMERGENCY_RESTART_H -#define _ASM_EMERGENCY_RESTART_H - #include - -#endif /* _ASM_EMERGENCY_RESTART_H */ diff --git a/include/asm-ppc64/errno.h b/include/asm-ppc64/errno.h --- a/include/asm-ppc64/errno.h +++ b/include/asm-ppc64/errno.h @@ -1,18 +1,2 @@ -#ifndef _PPC64_ERRNO_H -#define _PPC64_ERRNO_H - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include - -#undef EDEADLOCK -#define EDEADLOCK 58 /* File locking deadlock error */ - -#define _LAST_ERRNO 516 - -#endif +/* ppc and ppc64 are being merged into powerpc */ +#include diff --git a/include/asm-ppc64/linkage.h b/include/asm-ppc64/linkage.h --- a/include/asm-ppc64/linkage.h +++ b/include/asm-ppc64/linkage.h @@ -1,6 +1,2 @@ -#ifndef __ASM_LINKAGE_H -#define __ASM_LINKAGE_H - -/* Nothing to see here... */ - -#endif +/* ppc and ppc64 are being merged into powerpc */ +#include diff --git a/include/asm-ppc64/parport.h b/include/asm-ppc64/parport.h --- a/include/asm-ppc64/parport.h +++ b/include/asm-ppc64/parport.h @@ -1,18 +1 @@ -/* - * parport.h: platform-specific PC-style parport initialisation - * - * Copyright (C) 1999, 2000 Tim Waugh - * - * This file should only be included by drivers/parport/parport_pc.c. - */ - -#ifndef _ASM_PPC64_PARPORT_H -#define _ASM_PPC64_PARPORT_H - -static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma); -static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) -{ - return parport_pc_find_isa_ports (autoirq, autodma); -} - -#endif /* !(_ASM_PPC_PARPORT_H) */ +#include diff --git a/include/asm-ppc64/percpu.h b/include/asm-ppc64/percpu.h --- a/include/asm-ppc64/percpu.h +++ b/include/asm-ppc64/percpu.h @@ -1,6 +1 @@ -#ifndef __ARCH_PPC64_PERCPU__ -#define __ARCH_PPC64_PERCPU__ - #include - -#endif /* __ARCH_PPC64_PERCPU__ */ diff --git a/include/asm-ppc64/poll.h b/include/asm-ppc64/poll.h --- a/include/asm-ppc64/poll.h +++ b/include/asm-ppc64/poll.h @@ -1,32 +1,2 @@ -#ifndef __PPC64_POLL_H -#define __PPC64_POLL_H - -/* - * Copyright (C) 2001 PPC64 Team, IBM Corp - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#define POLLIN 0x0001 -#define POLLPRI 0x0002 -#define POLLOUT 0x0004 -#define POLLERR 0x0008 -#define POLLHUP 0x0010 -#define POLLNVAL 0x0020 -#define POLLRDNORM 0x0040 -#define POLLRDBAND 0x0080 -#define POLLWRNORM 0x0100 -#define POLLWRBAND 0x0200 -#define POLLMSG 0x0400 -#define POLLREMOVE 0x1000 - -struct pollfd { - int fd; - short events; - short revents; -}; - -#endif /* __PPC64_POLL_H */ +/* ppc and ppc64 are being merged into powerpc */ +#include diff --git a/include/asm-ppc64/resource.h b/include/asm-ppc64/resource.h --- a/include/asm-ppc64/resource.h +++ b/include/asm-ppc64/resource.h @@ -1,6 +1 @@ -#ifndef _PPC64_RESOURCE_H -#define _PPC64_RESOURCE_H - #include - -#endif /* _PPC64_RESOURCE_H */ diff --git a/include/asm-ppc64/shmparam.h b/include/asm-ppc64/shmparam.h --- a/include/asm-ppc64/shmparam.h +++ b/include/asm-ppc64/shmparam.h @@ -1,13 +1,2 @@ -#ifndef _PPC64_SHMPARAM_H -#define _PPC64_SHMPARAM_H - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ - -#endif /* _PPC64_SHMPARAM_H */ +/* ppc and ppc64 are being merged into powerpc */ +#include From ebs at ebshome.net Wed Aug 3 09:05:37 2005 From: ebs at ebshome.net (Eugene Surovegin) Date: Tue, 2 Aug 2005 16:05:37 -0700 Subject: Beginning Merger Patch In-Reply-To: <1123023575.2614.25.camel@cashmere.sps.mot.com> References: <1123023575.2614.25.camel@cashmere.sps.mot.com> Message-ID: <20050802230537.GA9125@gate.ebshome.net> On Tue, Aug 02, 2005 at 05:59:35PM -0500, Jon Loeliger wrote: > Here is a patch to begin the process of merging > the PPC32 and PPC64 include directories into a > new common "powerpc" arch. > > This patch introduces the include/asm-powerpc directory. > It then places into it, all of the files in asm-ppc and > asm-ppc64 that are essentially identical. A stub is left > in asm-ppc and asm-ppc64 pointing to the unified files. > No real thought went into this set of files; these are > the dead-simple identical files for starters! Hmm, I got an impression that we wouldn't touch ppc and ppc64 for now and just _copy_ or create clean stuff into powerpc. I think this will be much safer, at least at the beginning. -- Eugene From ebs at ebshome.net Wed Aug 3 09:17:09 2005 From: ebs at ebshome.net (Eugene Surovegin) Date: Tue, 2 Aug 2005 16:17:09 -0700 Subject: Beginning Merger Patch In-Reply-To: References: <1123023575.2614.25.camel@cashmere.sps.mot.com> <20050802230537.GA9125@gate.ebshome.net> Message-ID: <20050802231709.GB9125@gate.ebshome.net> On Tue, Aug 02, 2005 at 07:12:05PM -0400, Dan Malek wrote: > > On Aug 2, 2005, at 7:05 PM, Eugene Surovegin wrote: > > >Hmm, I got an impression that we wouldn't touch ppc and ppc64 for > >now and just _copy_ or create clean stuff into powerpc. I think this > >will be much safer, at least at the beginning. > > Shouldn't this be a 2.7 project? Maybe, I'm still waiting for official announcement from the maintainer :) -- Eugene From dan at embeddededge.com Wed Aug 3 09:10:56 2005 From: dan at embeddededge.com (Dan Malek) Date: Tue, 2 Aug 2005 19:10:56 -0400 Subject: Beginning Merger Patch In-Reply-To: <1123023575.2614.25.camel@cashmere.sps.mot.com> References: <1123023575.2614.25.camel@cashmere.sps.mot.com> Message-ID: <688ba2276de281a9473b030a16a514c0@embeddededge.com> On Aug 2, 2005, at 6:59 PM, Jon Loeliger wrote: > ..... A stub is left > in asm-ppc and asm-ppc64 pointing to the unified files. Why bother? You may as well change all of the source files, too, or else that will never get done :-) Thanks. -- Dan From dan at embeddededge.com Wed Aug 3 09:12:05 2005 From: dan at embeddededge.com (Dan Malek) Date: Tue, 2 Aug 2005 19:12:05 -0400 Subject: Beginning Merger Patch In-Reply-To: <20050802230537.GA9125@gate.ebshome.net> References: <1123023575.2614.25.camel@cashmere.sps.mot.com> <20050802230537.GA9125@gate.ebshome.net> Message-ID: On Aug 2, 2005, at 7:05 PM, Eugene Surovegin wrote: > Hmm, I got an impression that we wouldn't touch ppc and ppc64 for > now and just _copy_ or create clean stuff into powerpc. I think this > will be much safer, at least at the beginning. Shouldn't this be a 2.7 project? -- Dan From ntl at pobox.com Wed Aug 3 12:17:42 2005 From: ntl at pobox.com (Nathan Lynch) Date: Tue, 2 Aug 2005 21:17:42 -0500 Subject: Beginning Merger Patch In-Reply-To: <1123023575.2614.25.camel@cashmere.sps.mot.com> References: <1123023575.2614.25.camel@cashmere.sps.mot.com> Message-ID: <20050803021742.GB3985@otto> Jon Loeliger wrote: > Folks, > > I have grabbed my asbestos suit. > > Here is a patch to begin the process of merging > the PPC32 and PPC64 include directories into a > new common "powerpc" arch. Perhaps you could briefly explain the motivation for this? I think I've heard/read that something like this was in the works, but I'd like to know what the problem is, and why it should be solved this way instead of e.g. x86_64's method of including headers directly from asm-i386. Nathan From ebs at ebshome.net Wed Aug 3 12:58:06 2005 From: ebs at ebshome.net (Eugene Surovegin) Date: Tue, 2 Aug 2005 19:58:06 -0700 Subject: Beginning Merger Patch In-Reply-To: <20050803021742.GB3985@otto> References: <1123023575.2614.25.camel@cashmere.sps.mot.com> <20050803021742.GB3985@otto> Message-ID: <20050803025806.GC9125@gate.ebshome.net> On Tue, Aug 02, 2005 at 09:17:42PM -0500, Nathan Lynch wrote: > Jon Loeliger wrote: > > Folks, > > > > I have grabbed my asbestos suit. > > > > Here is a patch to begin the process of merging > > the PPC32 and PPC64 include directories into a > > new common "powerpc" arch. > > Perhaps you could briefly explain the motivation for this? > > I think I've heard/read that something like this was in the works, but > I'd like to know what the problem is, and why it should be solved this > way instead of e.g. x86_64's method of including headers directly from > asm-i386. I think the reason for such approach is that there will be no asm-ppc and asm-ppc64 in the end of this transition. This differs significantly from i386/x86_64 situation. -- Eugene From paulus at samba.org Wed Aug 3 13:08:57 2005 From: paulus at samba.org (Paul Mackerras) Date: Wed, 3 Aug 2005 13:08:57 +1000 Subject: Beginning Merger Patch In-Reply-To: References: <1123023575.2614.25.camel@cashmere.sps.mot.com> <20050802230537.GA9125@gate.ebshome.net> Message-ID: <17136.13641.777687.620155@cargo.ozlabs.ibm.com> Dan Malek writes: > Shouldn't this be a 2.7 project? I don't think so; I don't think it's going to be as dramatically invasive as to need to wait for a 2.7, and in any case, there is no sign of 2.7 on the horizon. Paul. From paulus at samba.org Wed Aug 3 13:07:34 2005 From: paulus at samba.org (Paul Mackerras) Date: Wed, 3 Aug 2005 13:07:34 +1000 Subject: Merging ppc32 and ppc64 Message-ID: <17136.13558.773102.465379@cargo.ozlabs.ibm.com> At OLS I discussed the idea of merging the ppc32 and ppc64 architectures in the Linux kernel with various ppc32 and ppc64 kernel hackers and users. There was broad agreement that this would be a good thing to do, so we are going to go ahead and do it. The plan is to create include/asm-powerpc and arch/powerpc directories for the merged architecture and move stuff in there as it gets merged. The existing ppc32 and ppc64 directories will stay around until they are no longer useful. The intention is not to break anything that currently works; however, we do not plan to move unused and unmaintained platforms into the merged architecture. The advantage of merging is that it will reduce the maintenance effort and reduce the instances where a common bug gets fixed in one architecture but not the other. It will also make it easier to support 64-bit embedded systems as they become more common. I don't see the merge as changing the actual code that gets executed on any given platform very much, except in one respect: we are going to standardize on a flattened device tree as the way that information about the platform gets passed from the boot loader to the kernel. Comments? Flames? :) Paul. From jwboyer at jdub.homelinux.org Wed Aug 3 12:38:15 2005 From: jwboyer at jdub.homelinux.org (Josh Boyer) Date: Tue, 02 Aug 2005 21:38:15 -0500 Subject: Beginning Merger Patch In-Reply-To: <20050802230537.GA9125@gate.ebshome.net> References: <1123023575.2614.25.camel@cashmere.sps.mot.com> <20050802230537.GA9125@gate.ebshome.net> Message-ID: <1123036695.4755.36.camel@yoda.jdub.homelinux.org> On Tue, 2005-08-02 at 16:05 -0700, Eugene Surovegin wrote: > On Tue, Aug 02, 2005 at 05:59:35PM -0500, Jon Loeliger wrote: > > Here is a patch to begin the process of merging > > the PPC32 and PPC64 include directories into a > > new common "powerpc" arch. > > > > This patch introduces the include/asm-powerpc directory. > > It then places into it, all of the files in asm-ppc and > > asm-ppc64 that are essentially identical. A stub is left > > in asm-ppc and asm-ppc64 pointing to the unified files. > > No real thought went into this set of files; these are > > the dead-simple identical files for starters! > > Hmm, I got an impression that we wouldn't touch ppc and ppc64 for > now and just _copy_ or create clean stuff into powerpc. I think this > will be much safer, at least at the beginning. Safer, maybe. But then you have triple maintenance, since all the files in question were just duplicates. Patches like this don't need to be applied right away. They take time and lots of vetting. They can live as separate entities until they are really ready to be committed. That being said, I say go whole-hog and do it as Jon has done. Especially considering that he has a git tree that can be worked from. josh From sfr at canb.auug.org.au Wed Aug 3 14:26:39 2005 From: sfr at canb.auug.org.au (Stephen Rothwell) Date: Wed, 3 Aug 2005 14:26:39 +1000 Subject: [PATCH] 0/4 abstract firmware feature checks Message-ID: <20050803142639.2bc38771.sfr@canb.auug.org.au> Hi all, This series of patches are intended to abstract the current firmware feature checks in such a way that they may be (sometimes) evaluated at compile time. This should hopefully, reduce the checks on CONFIG_PPC_[IP]SERIES. They also introduce a feature bit to identify the iSeries hypervisor. Thanks to Arnd Bergmann for the method I have taken from his CPU_HAS_FEATURE patch. arch/ppc64/kernel/Makefile | 2 arch/ppc64/kernel/cputable.c | 40 --------------- arch/ppc64/kernel/firmware.c | 47 +++++++++++++++++ arch/ppc64/kernel/iSeries_setup.c | 3 + arch/ppc64/kernel/lparcfg.c | 6 +- arch/ppc64/kernel/pSeries_iommu.c | 3 - arch/ppc64/kernel/pSeries_lpar.c | 1 arch/ppc64/kernel/pSeries_setup.c | 18 +++--- arch/ppc64/kernel/pSeries_smp.c | 3 - arch/ppc64/kernel/process.c | 12 +--- arch/ppc64/kernel/sysfs.c | 5 - arch/ppc64/kernel/time.c | 7 +- include/asm-ppc64/cputable.h | 47 +---------------- include/asm-ppc64/firmware.h | 101 ++++++++++++++++++++++++++++++++++++++ 14 files changed, 181 insertions(+), 114 deletions(-) -- Cheers, Stephen Rothwell sfr at canb.auug.org.au http://www.canb.auug.org.au/~sfr/ From sfr at canb.auug.org.au Wed Aug 3 14:32:30 2005 From: sfr at canb.auug.org.au (Stephen Rothwell) Date: Wed, 3 Aug 2005 14:32:30 +1000 Subject: [PATCH] 1/4 remove firmware features from cpu_spec In-Reply-To: <20050803142639.2bc38771.sfr@canb.auug.org.au> References: <20050803142639.2bc38771.sfr@canb.auug.org.au> Message-ID: <20050803143230.0500e9b3.sfr@canb.auug.org.au> The firmware_features field of struct cpu_spec should really be a separate variable as the firmware features do not depend on the chip and the bitmask is constructed independently. By removing it, we save 112 bytes from the cpu_specs array and we access the bitmask directly instead of via the cur_cpu_spec pointer. Signed-off-by: Stephen Rothwell -- Cheers, Stephen Rothwell sfr at canb.auug.org.au http://www.canb.auug.org.au/~sfr/ diff -ruNp linus/arch/ppc64/kernel/cputable.c linus-firmware.1/arch/ppc64/kernel/cputable.c --- linus/arch/ppc64/kernel/cputable.c 2005-07-15 14:37:43.000000000 +1000 +++ linus-firmware.1/arch/ppc64/kernel/cputable.c 2005-07-22 16:48:41.000000000 +1000 @@ -23,6 +23,7 @@ struct cpu_spec* cur_cpu_spec = NULL; EXPORT_SYMBOL(cur_cpu_spec); +unsigned long ppc64_firmware_features; /* NOTE: * Unlike ppc32, ppc64 will only call this once for the boot CPU, it's @@ -60,7 +61,6 @@ struct cpu_spec cpu_specs[] = { .icache_bsize = 128, .dcache_bsize = 128, .cpu_setup = __setup_cpu_power3, - .firmware_features = COMMON_PPC64_FW, }, { /* Power3+ */ .pvr_mask = 0xffff0000, @@ -73,7 +73,6 @@ struct cpu_spec cpu_specs[] = { .icache_bsize = 128, .dcache_bsize = 128, .cpu_setup = __setup_cpu_power3, - .firmware_features = COMMON_PPC64_FW, }, { /* Northstar */ .pvr_mask = 0xffff0000, @@ -86,7 +85,6 @@ struct cpu_spec cpu_specs[] = { .icache_bsize = 128, .dcache_bsize = 128, .cpu_setup = __setup_cpu_power3, - .firmware_features = COMMON_PPC64_FW, }, { /* Pulsar */ .pvr_mask = 0xffff0000, @@ -99,7 +97,6 @@ struct cpu_spec cpu_specs[] = { .icache_bsize = 128, .dcache_bsize = 128, .cpu_setup = __setup_cpu_power3, - .firmware_features = COMMON_PPC64_FW, }, { /* I-star */ .pvr_mask = 0xffff0000, @@ -112,7 +109,6 @@ struct cpu_spec cpu_specs[] = { .icache_bsize = 128, .dcache_bsize = 128, .cpu_setup = __setup_cpu_power3, - .firmware_features = COMMON_PPC64_FW, }, { /* S-star */ .pvr_mask = 0xffff0000, @@ -125,7 +121,6 @@ struct cpu_spec cpu_specs[] = { .icache_bsize = 128, .dcache_bsize = 128, .cpu_setup = __setup_cpu_power3, - .firmware_features = COMMON_PPC64_FW, }, { /* Power4 */ .pvr_mask = 0xffff0000, @@ -138,7 +133,6 @@ struct cpu_spec cpu_specs[] = { .icache_bsize = 128, .dcache_bsize = 128, .cpu_setup = __setup_cpu_power4, - .firmware_features = COMMON_PPC64_FW, }, { /* Power4+ */ .pvr_mask = 0xffff0000, @@ -151,7 +145,6 @@ struct cpu_spec cpu_specs[] = { .icache_bsize = 128, .dcache_bsize = 128, .cpu_setup = __setup_cpu_power4, - .firmware_features = COMMON_PPC64_FW, }, { /* PPC970 */ .pvr_mask = 0xffff0000, @@ -166,7 +159,6 @@ struct cpu_spec cpu_specs[] = { .icache_bsize = 128, .dcache_bsize = 128, .cpu_setup = __setup_cpu_ppc970, - .firmware_features = COMMON_PPC64_FW, }, { /* PPC970FX */ .pvr_mask = 0xffff0000, @@ -181,7 +173,6 @@ struct cpu_spec cpu_specs[] = { .icache_bsize = 128, .dcache_bsize = 128, .cpu_setup = __setup_cpu_ppc970, - .firmware_features = COMMON_PPC64_FW, }, { /* PPC970MP */ .pvr_mask = 0xffff0000, @@ -196,7 +187,6 @@ struct cpu_spec cpu_specs[] = { .icache_bsize = 128, .dcache_bsize = 128, .cpu_setup = __setup_cpu_ppc970, - .firmware_features = COMMON_PPC64_FW, }, { /* Power5 */ .pvr_mask = 0xffff0000, @@ -211,7 +201,6 @@ struct cpu_spec cpu_specs[] = { .icache_bsize = 128, .dcache_bsize = 128, .cpu_setup = __setup_cpu_power4, - .firmware_features = COMMON_PPC64_FW, }, { /* Power5 */ .pvr_mask = 0xffff0000, @@ -226,7 +215,6 @@ struct cpu_spec cpu_specs[] = { .icache_bsize = 128, .dcache_bsize = 128, .cpu_setup = __setup_cpu_power4, - .firmware_features = COMMON_PPC64_FW, }, { /* BE DD1.x */ .pvr_mask = 0xffff0000, @@ -241,7 +229,6 @@ struct cpu_spec cpu_specs[] = { .icache_bsize = 128, .dcache_bsize = 128, .cpu_setup = __setup_cpu_be, - .firmware_features = COMMON_PPC64_FW, }, { /* default match */ .pvr_mask = 0x00000000, @@ -254,7 +241,6 @@ struct cpu_spec cpu_specs[] = { .icache_bsize = 128, .dcache_bsize = 128, .cpu_setup = __setup_cpu_power4, - .firmware_features = COMMON_PPC64_FW, } }; diff -ruNp linus/arch/ppc64/kernel/lparcfg.c linus-firmware.1/arch/ppc64/kernel/lparcfg.c --- linus/arch/ppc64/kernel/lparcfg.c 2005-06-27 16:08:00.000000000 +1000 +++ linus-firmware.1/arch/ppc64/kernel/lparcfg.c 2005-07-22 16:38:40.000000000 +1000 @@ -377,7 +377,7 @@ static int lparcfg_data(struct seq_file partition_active_processors = lparcfg_count_active_processors(); - if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { + if (ppc64_firmware_features & FW_FEATURE_SPLPAR) { unsigned long h_entitled, h_unallocated; unsigned long h_aggregation, h_resource; unsigned long pool_idle_time, pool_procs; @@ -571,7 +571,7 @@ int __init lparcfg_init(void) mode_t mode = S_IRUSR; /* Allow writing if we have FW_FEATURE_SPLPAR */ - if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { + if (ppc64_firmware_features & FW_FEATURE_SPLPAR) { lparcfg_fops.write = lparcfg_write; mode |= S_IWUSR; } diff -ruNp linus/arch/ppc64/kernel/pSeries_iommu.c linus-firmware.1/arch/ppc64/kernel/pSeries_iommu.c --- linus/arch/ppc64/kernel/pSeries_iommu.c 2005-06-27 16:08:00.000000000 +1000 +++ linus-firmware.1/arch/ppc64/kernel/pSeries_iommu.c 2005-07-22 16:38:57.000000000 +1000 @@ -546,7 +546,7 @@ void iommu_init_early_pSeries(void) } if (systemcfg->platform & PLATFORM_LPAR) { - if (cur_cpu_spec->firmware_features & FW_FEATURE_MULTITCE) { + if (ppc64_firmware_features & FW_FEATURE_MULTITCE) { ppc_md.tce_build = tce_buildmulti_pSeriesLP; ppc_md.tce_free = tce_freemulti_pSeriesLP; } else { diff -ruNp linus/arch/ppc64/kernel/pSeries_setup.c linus-firmware.1/arch/ppc64/kernel/pSeries_setup.c --- linus/arch/ppc64/kernel/pSeries_setup.c 2005-07-08 15:18:27.000000000 +1000 +++ linus-firmware.1/arch/ppc64/kernel/pSeries_setup.c 2005-07-22 16:40:08.000000000 +1000 @@ -231,11 +231,11 @@ static void __init pSeries_setup_arch(vo pSeries_nvram_init(); - if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) + if (ppc64_firmware_features & FW_FEATURE_SPLPAR) vpa_init(boot_cpuid); /* Choose an idle loop */ - if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { + if (ppc64_firmware_features & FW_FEATURE_SPLPAR) { if (get_paca()->lppaca.shared_proc) { printk(KERN_INFO "Using shared processor idle loop\n"); ppc_md.idle_loop = pseries_shared_idle; @@ -260,7 +260,7 @@ static int __init pSeries_init_panel(voi arch_initcall(pSeries_init_panel); -/* Build up the firmware_features bitmask field +/* Build up the ppc64_firmware_features bitmask field * using contents of device-tree/ibm,hypertas-functions. * Ultimately this functionality may be moved into prom.c prom_init(). */ @@ -272,7 +272,7 @@ void __init fw_feature_init(void) DBG(" -> fw_feature_init()\n"); - cur_cpu_spec->firmware_features = 0; + ppc64_firmware_features = 0; dn = of_find_node_by_path("/rtas"); if (dn == NULL) { printk(KERN_ERR "WARNING ! Cannot find RTAS in device-tree !\n"); @@ -288,7 +288,7 @@ void __init fw_feature_init(void) if ((firmware_features_table[i].name) && (strcmp(firmware_features_table[i].name,hypertas))==0) { /* we have a match */ - cur_cpu_spec->firmware_features |= + ppc64_firmware_features |= (firmware_features_table[i].val); break; } @@ -302,7 +302,7 @@ void __init fw_feature_init(void) of_node_put(dn); no_rtas: printk(KERN_INFO "firmware_features = 0x%lx\n", - cur_cpu_spec->firmware_features); + ppc64_firmware_features); DBG(" <- fw_feature_init()\n"); } diff -ruNp linus/arch/ppc64/kernel/pSeries_smp.c linus-firmware.1/arch/ppc64/kernel/pSeries_smp.c --- linus/arch/ppc64/kernel/pSeries_smp.c 2005-06-27 16:08:00.000000000 +1000 +++ linus-firmware.1/arch/ppc64/kernel/pSeries_smp.c 2005-07-22 16:40:18.000000000 +1000 @@ -326,7 +326,7 @@ static void __devinit smp_xics_setup_cpu if (cpu != boot_cpuid) xics_setup_cpu(); - if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) + if (ppc64_firmware_features & FW_FEATURE_SPLPAR) vpa_init(cpu); cpu_clear(cpu, of_spin_map); diff -ruNp linus/arch/ppc64/kernel/process.c linus-firmware.1/arch/ppc64/kernel/process.c --- linus/arch/ppc64/kernel/process.c 2005-06-28 10:05:26.000000000 +1000 +++ linus-firmware.1/arch/ppc64/kernel/process.c 2005-07-22 16:40:26.000000000 +1000 @@ -206,7 +206,7 @@ struct task_struct *__switch_to(struct t /* purr is nothing but processor time base */ #if defined(CONFIG_PPC_PSERIES) - if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { + if (ppc64_firmware_features & FW_FEATURE_SPLPAR) { struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array); long unsigned start_tb, current_tb; start_tb = old_thread->start_tb; diff -ruNp linus/arch/ppc64/kernel/sysfs.c linus-firmware.1/arch/ppc64/kernel/sysfs.c --- linus/arch/ppc64/kernel/sysfs.c 2005-07-08 15:18:27.000000000 +1000 +++ linus-firmware.1/arch/ppc64/kernel/sysfs.c 2005-07-22 16:40:34.000000000 +1000 @@ -154,7 +154,7 @@ void ppc64_enable_pmcs(void) #ifdef CONFIG_PPC_PSERIES /* instruct hypervisor to maintain PMCs */ - if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) + if (ppc64_firmware_features & FW_FEATURE_SPLPAR) get_paca()->lppaca.pmcregs_in_use = 1; #endif /* CONFIG_PPC_PSERIES */ } diff -ruNp linus/arch/ppc64/kernel/time.c linus-firmware.1/arch/ppc64/kernel/time.c --- linus/arch/ppc64/kernel/time.c 2005-07-01 09:58:50.000000000 +1000 +++ linus-firmware.1/arch/ppc64/kernel/time.c 2005-07-22 16:40:43.000000000 +1000 @@ -372,7 +372,7 @@ int timer_interrupt(struct pt_regs * reg /* collect purr register values often, for accurate calculations */ #if defined(CONFIG_PPC_PSERIES) - if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) { + if (ppc64_firmware_features & FW_FEATURE_SPLPAR) { struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array); cu->current_tb = mfspr(SPRN_PURR); } diff -ruNp linus/include/asm-ppc64/cputable.h linus-firmware.1/include/asm-ppc64/cputable.h --- linus/include/asm-ppc64/cputable.h 2005-07-08 15:18:28.000000000 +1000 +++ linus-firmware.1/include/asm-ppc64/cputable.h 2005-07-22 16:42:23.000000000 +1000 @@ -56,11 +56,6 @@ struct cpu_spec { * BHT, SPD, etc... from head.S before branching to identify_machine */ cpu_setup_t cpu_setup; - - /* This is used to identify firmware features which are available - * to the kernel. - */ - unsigned long firmware_features; }; extern struct cpu_spec cpu_specs[]; @@ -72,6 +67,11 @@ static inline unsigned long cpu_has_feat } +/* This is used to identify firmware features which are available + * to the kernel. + */ +extern unsigned long ppc64_firmware_features; + /* firmware feature bitmask values */ #define FIRMWARE_MAX_FEATURES 63 From sfr at canb.auug.org.au Wed Aug 3 14:35:25 2005 From: sfr at canb.auug.org.au (Stephen Rothwell) Date: Wed, 3 Aug 2005 14:35:25 +1000 Subject: [PATCH] 2/4 create firmware_has_feature() In-Reply-To: <20050803142639.2bc38771.sfr@canb.auug.org.au> References: <20050803142639.2bc38771.sfr@canb.auug.org.au> Message-ID: <20050803143525.30f5582a.sfr@canb.auug.org.au> Create the firmware_has_feature() inline and move the firmware feature stuff into its own header file. Signed-off-by: Stephen Rothwell -- Cheers, Stephen Rothwell sfr at canb.auug.org.au http://www.canb.auug.org.au/~sfr/ diff -ruNp linus-firmware.1/arch/ppc64/kernel/cputable.c linus-firmware.2/arch/ppc64/kernel/cputable.c --- linus-firmware.1/arch/ppc64/kernel/cputable.c 2005-07-22 16:48:41.000000000 +1000 +++ linus-firmware.2/arch/ppc64/kernel/cputable.c 2005-07-22 17:09:21.000000000 +1000 @@ -20,6 +20,7 @@ #include #include +#include struct cpu_spec* cur_cpu_spec = NULL; EXPORT_SYMBOL(cur_cpu_spec); diff -ruNp linus-firmware.1/arch/ppc64/kernel/lparcfg.c linus-firmware.2/arch/ppc64/kernel/lparcfg.c --- linus-firmware.1/arch/ppc64/kernel/lparcfg.c 2005-07-22 16:38:40.000000000 +1000 +++ linus-firmware.2/arch/ppc64/kernel/lparcfg.c 2005-07-22 17:11:46.000000000 +1000 @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include @@ -377,7 +377,7 @@ static int lparcfg_data(struct seq_file partition_active_processors = lparcfg_count_active_processors(); - if (ppc64_firmware_features & FW_FEATURE_SPLPAR) { + if (firmware_has_feature(FW_FEATURE_SPLPAR)) { unsigned long h_entitled, h_unallocated; unsigned long h_aggregation, h_resource; unsigned long pool_idle_time, pool_procs; @@ -571,7 +571,7 @@ int __init lparcfg_init(void) mode_t mode = S_IRUSR; /* Allow writing if we have FW_FEATURE_SPLPAR */ - if (ppc64_firmware_features & FW_FEATURE_SPLPAR) { + if (firmware_has_feature(FW_FEATURE_SPLPAR)) { lparcfg_fops.write = lparcfg_write; mode |= S_IWUSR; } diff -ruNp linus-firmware.1/arch/ppc64/kernel/pSeries_iommu.c linus-firmware.2/arch/ppc64/kernel/pSeries_iommu.c --- linus-firmware.1/arch/ppc64/kernel/pSeries_iommu.c 2005-07-22 16:38:57.000000000 +1000 +++ linus-firmware.2/arch/ppc64/kernel/pSeries_iommu.c 2005-07-22 17:12:33.000000000 +1000 @@ -45,6 +45,7 @@ #include #include #include +#include #include "pci.h" #define DBG(fmt...) @@ -546,7 +547,7 @@ void iommu_init_early_pSeries(void) } if (systemcfg->platform & PLATFORM_LPAR) { - if (ppc64_firmware_features & FW_FEATURE_MULTITCE) { + if (firmware_has_feature(FW_FEATURE_MULTITCE)) { ppc_md.tce_build = tce_buildmulti_pSeriesLP; ppc_md.tce_free = tce_freemulti_pSeriesLP; } else { diff -ruNp linus-firmware.1/arch/ppc64/kernel/pSeries_setup.c linus-firmware.2/arch/ppc64/kernel/pSeries_setup.c --- linus-firmware.1/arch/ppc64/kernel/pSeries_setup.c 2005-07-22 16:40:08.000000000 +1000 +++ linus-firmware.2/arch/ppc64/kernel/pSeries_setup.c 2005-07-22 17:14:01.000000000 +1000 @@ -60,7 +60,7 @@ #include #include #include -#include +#include #include "i8259.h" #include "mpic.h" @@ -231,11 +231,11 @@ static void __init pSeries_setup_arch(vo pSeries_nvram_init(); - if (ppc64_firmware_features & FW_FEATURE_SPLPAR) + if (firmware_has_feature(FW_FEATURE_SPLPAR)) vpa_init(boot_cpuid); /* Choose an idle loop */ - if (ppc64_firmware_features & FW_FEATURE_SPLPAR) { + if (firmware_has_feature(FW_FEATURE_SPLPAR)) { if (get_paca()->lppaca.shared_proc) { printk(KERN_INFO "Using shared processor idle loop\n"); ppc_md.idle_loop = pseries_shared_idle; diff -ruNp linus-firmware.1/arch/ppc64/kernel/pSeries_smp.c linus-firmware.2/arch/ppc64/kernel/pSeries_smp.c --- linus-firmware.1/arch/ppc64/kernel/pSeries_smp.c 2005-07-22 16:40:18.000000000 +1000 +++ linus-firmware.2/arch/ppc64/kernel/pSeries_smp.c 2005-07-22 17:15:01.000000000 +1000 @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -326,7 +327,7 @@ static void __devinit smp_xics_setup_cpu if (cpu != boot_cpuid) xics_setup_cpu(); - if (ppc64_firmware_features & FW_FEATURE_SPLPAR) + if (firmware_has_feature(FW_FEATURE_SPLPAR)) vpa_init(cpu); cpu_clear(cpu, of_spin_map); diff -ruNp linus-firmware.1/arch/ppc64/kernel/process.c linus-firmware.2/arch/ppc64/kernel/process.c --- linus-firmware.1/arch/ppc64/kernel/process.c 2005-07-22 16:40:26.000000000 +1000 +++ linus-firmware.2/arch/ppc64/kernel/process.c 2005-07-22 17:15:35.000000000 +1000 @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -206,7 +207,7 @@ struct task_struct *__switch_to(struct t /* purr is nothing but processor time base */ #if defined(CONFIG_PPC_PSERIES) - if (ppc64_firmware_features & FW_FEATURE_SPLPAR) { + if (firmware_has_feature(FW_FEATURE_SPLPAR)) { struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array); long unsigned start_tb, current_tb; start_tb = old_thread->start_tb; diff -ruNp linus-firmware.1/arch/ppc64/kernel/sysfs.c linus-firmware.2/arch/ppc64/kernel/sysfs.c --- linus-firmware.1/arch/ppc64/kernel/sysfs.c 2005-07-22 16:40:34.000000000 +1000 +++ linus-firmware.2/arch/ppc64/kernel/sysfs.c 2005-07-22 17:15:57.000000000 +1000 @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -154,7 +155,7 @@ void ppc64_enable_pmcs(void) #ifdef CONFIG_PPC_PSERIES /* instruct hypervisor to maintain PMCs */ - if (ppc64_firmware_features & FW_FEATURE_SPLPAR) + if (firmware_has_feature(FW_FEATURE_SPLPAR)) get_paca()->lppaca.pmcregs_in_use = 1; #endif /* CONFIG_PPC_PSERIES */ } diff -ruNp linus-firmware.1/arch/ppc64/kernel/time.c linus-firmware.2/arch/ppc64/kernel/time.c --- linus-firmware.1/arch/ppc64/kernel/time.c 2005-07-22 16:40:43.000000000 +1000 +++ linus-firmware.2/arch/ppc64/kernel/time.c 2005-07-22 17:16:40.000000000 +1000 @@ -67,6 +67,7 @@ #include #include #include +#include u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES; @@ -372,7 +373,7 @@ int timer_interrupt(struct pt_regs * reg /* collect purr register values often, for accurate calculations */ #if defined(CONFIG_PPC_PSERIES) - if (ppc64_firmware_features & FW_FEATURE_SPLPAR) { + if (firmware_has_feature(FW_FEATURE_SPLPAR)) { struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array); cu->current_tb = mfspr(SPRN_PURR); } diff -ruNp linus-firmware.1/include/asm-ppc64/cputable.h linus-firmware.2/include/asm-ppc64/cputable.h --- linus-firmware.1/include/asm-ppc64/cputable.h 2005-07-22 16:42:23.000000000 +1000 +++ linus-firmware.2/include/asm-ppc64/cputable.h 2005-07-22 17:06:42.000000000 +1000 @@ -66,44 +66,6 @@ static inline unsigned long cpu_has_feat return cur_cpu_spec->cpu_features & feature; } - -/* This is used to identify firmware features which are available - * to the kernel. - */ -extern unsigned long ppc64_firmware_features; - -/* firmware feature bitmask values */ -#define FIRMWARE_MAX_FEATURES 63 - -#define FW_FEATURE_PFT (1UL<<0) -#define FW_FEATURE_TCE (1UL<<1) -#define FW_FEATURE_SPRG0 (1UL<<2) -#define FW_FEATURE_DABR (1UL<<3) -#define FW_FEATURE_COPY (1UL<<4) -#define FW_FEATURE_ASR (1UL<<5) -#define FW_FEATURE_DEBUG (1UL<<6) -#define FW_FEATURE_TERM (1UL<<7) -#define FW_FEATURE_PERF (1UL<<8) -#define FW_FEATURE_DUMP (1UL<<9) -#define FW_FEATURE_INTERRUPT (1UL<<10) -#define FW_FEATURE_MIGRATE (1UL<<11) -#define FW_FEATURE_PERFMON (1UL<<12) -#define FW_FEATURE_CRQ (1UL<<13) -#define FW_FEATURE_VIO (1UL<<14) -#define FW_FEATURE_RDMA (1UL<<15) -#define FW_FEATURE_LLAN (1UL<<16) -#define FW_FEATURE_BULK (1UL<<17) -#define FW_FEATURE_XDABR (1UL<<18) -#define FW_FEATURE_MULTITCE (1UL<<19) -#define FW_FEATURE_SPLPAR (1UL<<20) - -typedef struct { - unsigned long val; - char * name; -} firmware_feature_t; - -extern firmware_feature_t firmware_features_table[]; - #endif /* __ASSEMBLY__ */ /* CPU kernel features */ @@ -140,10 +102,8 @@ extern firmware_feature_t firmware_featu #define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000) #define CPU_FTR_CTRL ASM_CONST(0x0000100000000000) -/* Platform firmware features */ -#define FW_FTR_ ASM_CONST(0x0000000000000001) - #ifndef __ASSEMBLY__ + #define COMMON_USER_PPC64 (PPC_FEATURE_32 | PPC_FEATURE_64 | \ PPC_FEATURE_HAS_FPU | PPC_FEATURE_HAS_MMU) @@ -156,10 +116,9 @@ extern firmware_feature_t firmware_featu #define CPU_FTR_PPCAS_ARCH_V2 (CPU_FTR_PPCAS_ARCH_V2_BASE) #else #define CPU_FTR_PPCAS_ARCH_V2 (CPU_FTR_PPCAS_ARCH_V2_BASE | CPU_FTR_16M_PAGE) -#endif +#endif /* CONFIG_PPC_ISERIES */ -#define COMMON_PPC64_FW (0) -#endif +#endif /* __ASSEMBLY */ #ifdef __ASSEMBLY__ diff -ruNp linus-firmware.1/include/asm-ppc64/firmware.h linus-firmware.2/include/asm-ppc64/firmware.h --- linus-firmware.1/include/asm-ppc64/firmware.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-firmware.2/include/asm-ppc64/firmware.h 2005-07-22 17:18:19.000000000 +1000 @@ -0,0 +1,67 @@ +/* + * include/asm-ppc64/firmware.h + * + * Extracted from include/asm-ppc64/cputable.h + * + * Copyright (C) 2001 Ben. Herrenschmidt (benh at kernel.crashing.org) + * + * Modifications for ppc64: + * Copyright (C) 2003 Dave Engebretsen + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef __ASM_PPC_FIRMWARE_H +#define __ASM_PPC_FIRMWARE_H + +#ifdef __KERNEL__ + +#ifndef __ASSEMBLY__ + +/* firmware feature bitmask values */ +#define FIRMWARE_MAX_FEATURES 63 + +#define FW_FEATURE_PFT (1UL<<0) +#define FW_FEATURE_TCE (1UL<<1) +#define FW_FEATURE_SPRG0 (1UL<<2) +#define FW_FEATURE_DABR (1UL<<3) +#define FW_FEATURE_COPY (1UL<<4) +#define FW_FEATURE_ASR (1UL<<5) +#define FW_FEATURE_DEBUG (1UL<<6) +#define FW_FEATURE_TERM (1UL<<7) +#define FW_FEATURE_PERF (1UL<<8) +#define FW_FEATURE_DUMP (1UL<<9) +#define FW_FEATURE_INTERRUPT (1UL<<10) +#define FW_FEATURE_MIGRATE (1UL<<11) +#define FW_FEATURE_PERFMON (1UL<<12) +#define FW_FEATURE_CRQ (1UL<<13) +#define FW_FEATURE_VIO (1UL<<14) +#define FW_FEATURE_RDMA (1UL<<15) +#define FW_FEATURE_LLAN (1UL<<16) +#define FW_FEATURE_BULK (1UL<<17) +#define FW_FEATURE_XDABR (1UL<<18) +#define FW_FEATURE_MULTITCE (1UL<<19) +#define FW_FEATURE_SPLPAR (1UL<<20) + +/* This is used to identify firmware features which are available + * to the kernel. + */ +extern unsigned long ppc64_firmware_features; + +static inline unsigned long firmware_has_feature(unsigned long feature) +{ + return ppc64_firmware_features & feature; +} + +typedef struct { + unsigned long val; + char * name; +} firmware_feature_t; + +extern firmware_feature_t firmware_features_table[]; + +#endif /* __ASSEMBLY__ */ +#endif /* __KERNEL__ */ +#endif /* __ASM_PPC_FIRMWARE_H */ From sfr at canb.auug.org.au Wed Aug 3 14:40:16 2005 From: sfr at canb.auug.org.au (Stephen Rothwell) Date: Wed, 3 Aug 2005 14:40:16 +1000 Subject: [PATCH] 3/4 make firmware_has_feature() stronger In-Reply-To: <20050803142639.2bc38771.sfr@canb.auug.org.au> References: <20050803142639.2bc38771.sfr@canb.auug.org.au> Message-ID: <20050803144016.14f7964c.sfr@canb.auug.org.au> Make firmware_has_feature() evaluate at compile time for the non pSeries case and tidy up code where possible. Signed-off-by: Stephen Rothwell -- Cheers, Stephen Rothwell sfr at canb.auug.org.au http://www.canb.auug.org.au/~sfr/ diff -ruNp linus-firmware.2/arch/ppc64/kernel/Makefile linus-firmware.3/arch/ppc64/kernel/Makefile --- linus-firmware.2/arch/ppc64/kernel/Makefile 2005-06-27 16:08:00.000000000 +1000 +++ linus-firmware.3/arch/ppc64/kernel/Makefile 2005-07-22 17:42:16.000000000 +1000 @@ -11,7 +11,7 @@ obj-y := setup.o entry.o t udbg.o binfmt_elf32.o sys_ppc32.o ioctl32.o \ ptrace32.o signal32.o rtc.o init_task.o \ lmb.o cputable.o cpu_setup_power4.o idle_power4.o \ - iommu.o sysfs.o vdso.o pmc.o + iommu.o sysfs.o vdso.o pmc.o firmware.o obj-y += vdso32/ vdso64/ obj-$(CONFIG_PPC_OF) += of_device.o diff -ruNp linus-firmware.2/arch/ppc64/kernel/cputable.c linus-firmware.3/arch/ppc64/kernel/cputable.c --- linus-firmware.2/arch/ppc64/kernel/cputable.c 2005-07-22 17:09:21.000000000 +1000 +++ linus-firmware.3/arch/ppc64/kernel/cputable.c 2005-07-22 17:40:16.000000000 +1000 @@ -5,7 +5,7 @@ * * Modifications for ppc64: * Copyright (C) 2003 Dave Engebretsen - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version @@ -20,11 +20,9 @@ #include #include -#include struct cpu_spec* cur_cpu_spec = NULL; EXPORT_SYMBOL(cur_cpu_spec); -unsigned long ppc64_firmware_features; /* NOTE: * Unlike ppc32, ppc64 will only call this once for the boot CPU, it's @@ -244,26 +242,3 @@ struct cpu_spec cpu_specs[] = { .cpu_setup = __setup_cpu_power4, } }; - -firmware_feature_t firmware_features_table[FIRMWARE_MAX_FEATURES] = { - {FW_FEATURE_PFT, "hcall-pft"}, - {FW_FEATURE_TCE, "hcall-tce"}, - {FW_FEATURE_SPRG0, "hcall-sprg0"}, - {FW_FEATURE_DABR, "hcall-dabr"}, - {FW_FEATURE_COPY, "hcall-copy"}, - {FW_FEATURE_ASR, "hcall-asr"}, - {FW_FEATURE_DEBUG, "hcall-debug"}, - {FW_FEATURE_PERF, "hcall-perf"}, - {FW_FEATURE_DUMP, "hcall-dump"}, - {FW_FEATURE_INTERRUPT, "hcall-interrupt"}, - {FW_FEATURE_MIGRATE, "hcall-migrate"}, - {FW_FEATURE_PERFMON, "hcall-perfmon"}, - {FW_FEATURE_CRQ, "hcall-crq"}, - {FW_FEATURE_VIO, "hcall-vio"}, - {FW_FEATURE_RDMA, "hcall-rdma"}, - {FW_FEATURE_LLAN, "hcall-lLAN"}, - {FW_FEATURE_BULK, "hcall-bulk"}, - {FW_FEATURE_XDABR, "hcall-xdabr"}, - {FW_FEATURE_MULTITCE, "hcall-multi-tce"}, - {FW_FEATURE_SPLPAR, "hcall-splpar"}, -}; diff -ruNp linus-firmware.2/arch/ppc64/kernel/firmware.c linus-firmware.3/arch/ppc64/kernel/firmware.c --- linus-firmware.2/arch/ppc64/kernel/firmware.c 1970-01-01 10:00:00.000000000 +1000 +++ linus-firmware.3/arch/ppc64/kernel/firmware.c 2005-07-22 17:42:01.000000000 +1000 @@ -0,0 +1,47 @@ +/* + * arch/ppc64/kernel/firmware.c + * + * Extracted from cputable.c + * + * Copyright (C) 2001 Ben. Herrenschmidt (benh at kernel.crashing.org) + * + * Modifications for ppc64: + * Copyright (C) 2003 Dave Engebretsen + * Copyright (C) 2005 Stephen Rothwell, IBM Corporation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#include + +#include + +unsigned long ppc64_firmware_features; + +#ifdef CONFIG_PPC_PSERIES +firmware_feature_t firmware_features_table[FIRMWARE_MAX_FEATURES] = { + {FW_FEATURE_PFT, "hcall-pft"}, + {FW_FEATURE_TCE, "hcall-tce"}, + {FW_FEATURE_SPRG0, "hcall-sprg0"}, + {FW_FEATURE_DABR, "hcall-dabr"}, + {FW_FEATURE_COPY, "hcall-copy"}, + {FW_FEATURE_ASR, "hcall-asr"}, + {FW_FEATURE_DEBUG, "hcall-debug"}, + {FW_FEATURE_PERF, "hcall-perf"}, + {FW_FEATURE_DUMP, "hcall-dump"}, + {FW_FEATURE_INTERRUPT, "hcall-interrupt"}, + {FW_FEATURE_MIGRATE, "hcall-migrate"}, + {FW_FEATURE_PERFMON, "hcall-perfmon"}, + {FW_FEATURE_CRQ, "hcall-crq"}, + {FW_FEATURE_VIO, "hcall-vio"}, + {FW_FEATURE_RDMA, "hcall-rdma"}, + {FW_FEATURE_LLAN, "hcall-lLAN"}, + {FW_FEATURE_BULK, "hcall-bulk"}, + {FW_FEATURE_XDABR, "hcall-xdabr"}, + {FW_FEATURE_MULTITCE, "hcall-multi-tce"}, + {FW_FEATURE_SPLPAR, "hcall-splpar"}, +}; +#endif diff -ruNp linus-firmware.2/arch/ppc64/kernel/pSeries_setup.c linus-firmware.3/arch/ppc64/kernel/pSeries_setup.c --- linus-firmware.2/arch/ppc64/kernel/pSeries_setup.c 2005-07-22 17:14:01.000000000 +1000 +++ linus-firmware.3/arch/ppc64/kernel/pSeries_setup.c 2005-07-22 17:23:23.000000000 +1000 @@ -231,11 +231,9 @@ static void __init pSeries_setup_arch(vo pSeries_nvram_init(); - if (firmware_has_feature(FW_FEATURE_SPLPAR)) - vpa_init(boot_cpuid); - /* Choose an idle loop */ if (firmware_has_feature(FW_FEATURE_SPLPAR)) { + vpa_init(boot_cpuid); if (get_paca()->lppaca.shared_proc) { printk(KERN_INFO "Using shared processor idle loop\n"); ppc_md.idle_loop = pseries_shared_idle; diff -ruNp linus-firmware.2/arch/ppc64/kernel/process.c linus-firmware.3/arch/ppc64/kernel/process.c --- linus-firmware.2/arch/ppc64/kernel/process.c 2005-07-22 17:15:35.000000000 +1000 +++ linus-firmware.3/arch/ppc64/kernel/process.c 2005-07-22 17:24:53.000000000 +1000 @@ -203,10 +203,9 @@ struct task_struct *__switch_to(struct t new_thread = &new->thread; old_thread = ¤t->thread; -/* Collect purr utilization data per process and per processor wise */ -/* purr is nothing but processor time base */ - -#if defined(CONFIG_PPC_PSERIES) + /* Collect purr utilization data per process and per processor + * wise purr is nothing but processor time base + */ if (firmware_has_feature(FW_FEATURE_SPLPAR)) { struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array); long unsigned start_tb, current_tb; @@ -215,8 +214,6 @@ struct task_struct *__switch_to(struct t old_thread->accum_tb += (current_tb - start_tb); new_thread->start_tb = current_tb; } -#endif - local_irq_save(flags); last = _switch(old_thread, new_thread); diff -ruNp linus-firmware.2/arch/ppc64/kernel/sysfs.c linus-firmware.3/arch/ppc64/kernel/sysfs.c --- linus-firmware.2/arch/ppc64/kernel/sysfs.c 2005-07-22 17:15:57.000000000 +1000 +++ linus-firmware.3/arch/ppc64/kernel/sysfs.c 2005-07-22 17:25:24.000000000 +1000 @@ -153,11 +153,9 @@ void ppc64_enable_pmcs(void) break; } -#ifdef CONFIG_PPC_PSERIES /* instruct hypervisor to maintain PMCs */ if (firmware_has_feature(FW_FEATURE_SPLPAR)) get_paca()->lppaca.pmcregs_in_use = 1; -#endif /* CONFIG_PPC_PSERIES */ } #else diff -ruNp linus-firmware.2/arch/ppc64/kernel/time.c linus-firmware.3/arch/ppc64/kernel/time.c --- linus-firmware.2/arch/ppc64/kernel/time.c 2005-07-22 17:16:40.000000000 +1000 +++ linus-firmware.3/arch/ppc64/kernel/time.c 2005-07-22 17:25:50.000000000 +1000 @@ -371,13 +371,11 @@ int timer_interrupt(struct pt_regs * reg process_hvlpevents(regs); #endif -/* collect purr register values often, for accurate calculations */ -#if defined(CONFIG_PPC_PSERIES) + /* collect purr register values often, for accurate calculations */ if (firmware_has_feature(FW_FEATURE_SPLPAR)) { struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array); cu->current_tb = mfspr(SPRN_PURR); } -#endif irq_exit(); diff -ruNp linus-firmware.2/include/asm-ppc64/firmware.h linus-firmware.3/include/asm-ppc64/firmware.h --- linus-firmware.2/include/asm-ppc64/firmware.h 2005-07-22 17:18:19.000000000 +1000 +++ linus-firmware.3/include/asm-ppc64/firmware.h 2005-07-22 17:31:12.000000000 +1000 @@ -45,6 +45,22 @@ #define FW_FEATURE_MULTITCE (1UL<<19) #define FW_FEATURE_SPLPAR (1UL<<20) +enum { + FW_FEATURE_PSERIES = FW_FEATURE_PFT | FW_FEATURE_TCE | + FW_FEATURE_SPRG0 | FW_FEATURE_DABR | FW_FEATURE_COPY | + FW_FEATURE_ASR | FW_FEATURE_DEBUG | FW_FEATURE_TERM | + FW_FEATURE_PERF | FW_FEATURE_DUMP | FW_FEATURE_INTERRUPT | + FW_FEATURE_MIGRATE | FW_FEATURE_PERFMON | FW_FEATURE_CRQ | + FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN | + FW_FEATURE_BULK | FW_FEATURE_XDABR | FW_FEATURE_MULTITCE | + FW_FEATURE_SPLPAR, + FW_FEATURE_POSSIBLE = +#ifdef CONFIG_PPC_PSERIES + FW_FEATURE_PSERIES | +#endif + 0, +}; + /* This is used to identify firmware features which are available * to the kernel. */ @@ -52,15 +68,17 @@ extern unsigned long ppc64_firmware_feat static inline unsigned long firmware_has_feature(unsigned long feature) { - return ppc64_firmware_features & feature; + return ppc64_firmware_features & feature & FW_FEATURE_POSSIBLE; } +#ifdef CONFIG_PPC_PSERIES typedef struct { unsigned long val; char * name; } firmware_feature_t; extern firmware_feature_t firmware_features_table[]; +#endif #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ From sfr at canb.auug.org.au Wed Aug 3 14:43:21 2005 From: sfr at canb.auug.org.au (Stephen Rothwell) Date: Wed, 3 Aug 2005 14:43:21 +1000 Subject: [PATCH] 4/4 introduce FW_FEATURE_ISERIES In-Reply-To: <20050803142639.2bc38771.sfr@canb.auug.org.au> References: <20050803142639.2bc38771.sfr@canb.auug.org.au> Message-ID: <20050803144321.59b9f8d2.sfr@canb.auug.org.au> Signed-off-by: Stephen Rothwell -- Cheers, Stephen Rothwell sfr at canb.auug.org.au http://www.canb.auug.org.au/~sfr/ diff -ruNp linus-firmware.3/arch/ppc64/kernel/iSeries_setup.c linus-firmware.4/arch/ppc64/kernel/iSeries_setup.c --- linus-firmware.3/arch/ppc64/kernel/iSeries_setup.c 2005-07-15 14:37:43.000000000 +1000 +++ linus-firmware.4/arch/ppc64/kernel/iSeries_setup.c 2005-07-22 18:34:11.000000000 +1000 @@ -39,6 +39,7 @@ #include #include #include +#include #include #include "iSeries_setup.h" @@ -314,6 +315,8 @@ static void __init iSeries_init_early(vo DBG(" -> iSeries_init_early()\n"); + ppc64_firmware_features = FW_FEATURE_ISERIES; + ppcdbg_initialize(); #if defined(CONFIG_BLK_DEV_INITRD) diff -ruNp linus-firmware.3/arch/ppc64/kernel/pSeries_lpar.c linus-firmware.4/arch/ppc64/kernel/pSeries_lpar.c --- linus-firmware.3/arch/ppc64/kernel/pSeries_lpar.c 2005-07-15 14:37:43.000000000 +1000 +++ linus-firmware.4/arch/ppc64/kernel/pSeries_lpar.c 2005-07-22 18:17:24.000000000 +1000 @@ -52,7 +52,6 @@ EXPORT_SYMBOL(plpar_hcall_4out); EXPORT_SYMBOL(plpar_hcall_norets); EXPORT_SYMBOL(plpar_hcall_8arg_2ret); -extern void fw_feature_init(void); extern void pSeries_find_serial_port(void); diff -ruNp linus-firmware.3/arch/ppc64/kernel/pSeries_setup.c linus-firmware.4/arch/ppc64/kernel/pSeries_setup.c --- linus-firmware.3/arch/ppc64/kernel/pSeries_setup.c 2005-07-22 17:23:23.000000000 +1000 +++ linus-firmware.4/arch/ppc64/kernel/pSeries_setup.c 2005-07-22 18:20:38.000000000 +1000 @@ -262,7 +262,7 @@ arch_initcall(pSeries_init_panel); * using contents of device-tree/ibm,hypertas-functions. * Ultimately this functionality may be moved into prom.c prom_init(). */ -void __init fw_feature_init(void) +static void __init fw_feature_init(void) { struct device_node * dn; char * hypertas; diff -ruNp linus-firmware.3/include/asm-ppc64/firmware.h linus-firmware.4/include/asm-ppc64/firmware.h --- linus-firmware.3/include/asm-ppc64/firmware.h 2005-07-22 17:31:12.000000000 +1000 +++ linus-firmware.4/include/asm-ppc64/firmware.h 2005-07-22 18:35:35.000000000 +1000 @@ -44,9 +44,10 @@ #define FW_FEATURE_XDABR (1UL<<18) #define FW_FEATURE_MULTITCE (1UL<<19) #define FW_FEATURE_SPLPAR (1UL<<20) +#define FW_FEATURE_ISERIES (1UL<<21) enum { - FW_FEATURE_PSERIES = FW_FEATURE_PFT | FW_FEATURE_TCE | + FW_FEATURE_PSERIES_POSSIBLE = FW_FEATURE_PFT | FW_FEATURE_TCE | FW_FEATURE_SPRG0 | FW_FEATURE_DABR | FW_FEATURE_COPY | FW_FEATURE_ASR | FW_FEATURE_DEBUG | FW_FEATURE_TERM | FW_FEATURE_PERF | FW_FEATURE_DUMP | FW_FEATURE_INTERRUPT | @@ -54,11 +55,25 @@ enum { FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN | FW_FEATURE_BULK | FW_FEATURE_XDABR | FW_FEATURE_MULTITCE | FW_FEATURE_SPLPAR, + FW_FEATURE_PSERIES_ALWAYS = 0, + FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES, + FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES, FW_FEATURE_POSSIBLE = #ifdef CONFIG_PPC_PSERIES - FW_FEATURE_PSERIES | + FW_FEATURE_PSERIES_POSSIBLE | +#endif +#ifdef CONFIG_PPC_ISERIES + FW_FEATURE_ISERIES_POSSIBLE | #endif 0, + FW_FEATURE_ALWAYS = +#ifdef CONFIG_PPC_PSERIES + FW_FEATURE_PSERIES_ALWAYS & +#endif +#ifdef CONFIG_PPC_ISERIES + FW_FEATURE_ISERIES_ALWAYS & +#endif + FW_FEATURE_POSSIBLE, }; /* This is used to identify firmware features which are available @@ -68,7 +83,8 @@ extern unsigned long ppc64_firmware_feat static inline unsigned long firmware_has_feature(unsigned long feature) { - return ppc64_firmware_features & feature & FW_FEATURE_POSSIBLE; + return (FW_FEATURE_ALWAYS & feature) || + (FW_FEATURE_POSSIBLE & ppc64_firmware_features & feature); } #ifdef CONFIG_PPC_PSERIES From michael at ellerman.id.au Wed Aug 3 20:21:22 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Wed, 3 Aug 2005 20:21:22 +1000 (EST) Subject: [PATCH 0/10] Cleanup iSeries msChunks handling, and lmb code. Message-ID: <1123064479.417492.649639846705.qpatch@concordia> This series of patches cleans up the iSeries msChunks structure, and associated macros and functions. It also removes CONFIG_MSCHUNKS from the lmb code, and eventually removes CONFIG_MSCHUNKS entirely. The final patch rely's on Stephen's FW_FEATURE_ISERIES patches. Booted on Power3, G5, Power5 LPAR and iSeries. From michael at ellerman.id.au Wed Aug 3 20:21:23 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Wed, 3 Aug 2005 20:21:23 +1000 (EST) Subject: [PATCH 1/10] ppc64: Remove PTRRELOC() from msChunks code In-Reply-To: <1123064479.417492.649639846705.qpatch@concordia> Message-ID: <20050803102123.56F3467E87@ozlabs.org> The msChunks code was written to work on pSeries, but now it's only used on iSeries. This means there's no need to do PTRRELOC anymore, so remove it all. A few places were getting "extern reloc_offset()" from abs_addr.h, move it into system.h instead. Signed-off-by: Michael Ellerman arch/ppc64/kernel/LparData.c | 10 +--------- include/asm-ppc64/abs_addr.h | 36 ++++++++++-------------------------- include/asm-ppc64/system.h | 2 ++ 3 files changed, 13 insertions(+), 35 deletions(-) Index: work/include/asm-ppc64/abs_addr.h =================================================================== --- work.orig/include/asm-ppc64/abs_addr.h +++ work/include/asm-ppc64/abs_addr.h @@ -29,46 +29,30 @@ struct msChunks { extern struct msChunks msChunks; extern unsigned long msChunks_alloc(unsigned long, unsigned long, unsigned long); -extern unsigned long reloc_offset(void); #ifdef CONFIG_MSCHUNKS -static inline unsigned long -chunk_to_addr(unsigned long chunk) +static inline unsigned long chunk_to_addr(unsigned long chunk) { - unsigned long offset = reloc_offset(); - struct msChunks *_msChunks = PTRRELOC(&msChunks); - - return chunk << _msChunks->chunk_shift; + return chunk << msChunks.chunk_shift; } -static inline unsigned long -addr_to_chunk(unsigned long addr) +static inline unsigned long addr_to_chunk(unsigned long addr) { - unsigned long offset = reloc_offset(); - struct msChunks *_msChunks = PTRRELOC(&msChunks); - - return addr >> _msChunks->chunk_shift; + return addr >> msChunks.chunk_shift; } -static inline unsigned long -chunk_offset(unsigned long addr) +static inline unsigned long chunk_offset(unsigned long addr) { - unsigned long offset = reloc_offset(); - struct msChunks *_msChunks = PTRRELOC(&msChunks); - - return addr & _msChunks->chunk_mask; + return addr & msChunks.chunk_mask; } -static inline unsigned long -abs_chunk(unsigned long pchunk) +static inline unsigned long abs_chunk(unsigned long pchunk) { - unsigned long offset = reloc_offset(); - struct msChunks *_msChunks = PTRRELOC(&msChunks); - if ( pchunk >= _msChunks->num_chunks ) { + if (pchunk >= msChunks.num_chunks) return pchunk; - } - return PTRRELOC(_msChunks->abs)[pchunk]; + + return msChunks.abs[pchunk]; } /* A macro so it can take pointers or unsigned long. */ Index: work/arch/ppc64/kernel/LparData.c =================================================================== --- work.orig/arch/ppc64/kernel/LparData.c +++ work/arch/ppc64/kernel/LparData.c @@ -295,24 +295,16 @@ struct ItVpdAreas itVpdAreas = { struct msChunks msChunks; EXPORT_SYMBOL(msChunks); -/* Depending on whether this is called from iSeries or pSeries setup - * code, the location of the msChunks struct may or may not have - * to be reloc'd, so we force the caller to do that for us by passing - * in a pointer to the structure. - */ unsigned long msChunks_alloc(unsigned long mem, unsigned long num_chunks, unsigned long chunk_size) { - unsigned long offset = reloc_offset(); - struct msChunks *_msChunks = PTRRELOC(&msChunks); - _msChunks->num_chunks = num_chunks; _msChunks->chunk_size = chunk_size; _msChunks->chunk_shift = __ilog2(chunk_size); _msChunks->chunk_mask = (1UL<<_msChunks->chunk_shift)-1; mem = _ALIGN(mem, sizeof(msChunks_entry)); - _msChunks->abs = (msChunks_entry *)(mem + offset); + _msChunks->abs = (msChunks_entry *)mem; mem += num_chunks * sizeof(msChunks_entry); return mem; Index: work/include/asm-ppc64/system.h =================================================================== --- work.orig/include/asm-ppc64/system.h +++ work/include/asm-ppc64/system.h @@ -302,5 +302,7 @@ __cmpxchg(volatile void *ptr, unsigned l #define arch_align_stack(x) (x) +extern unsigned long reloc_offset(void); + #endif /* __KERNEL__ */ #endif From michael at ellerman.id.au Wed Aug 3 20:21:23 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Wed, 3 Aug 2005 20:21:23 +1000 (EST) Subject: [PATCH 2/10] ppc64: msChunks cleanups In-Reply-To: <1123064479.417492.649639846705.qpatch@concordia> Message-ID: <20050803102123.81CB367E87@ozlabs.org> Chunks are 256KB, so use constants for the size/shift/mask, rather than getting them from the msChunks struct. The iSeries debugger (??) might still need access to the values in the msChunks struct, so we keep them around for now, but set them from the constant values. Replace msChunks_entry typedef with regular u32. Simplify msChunks_alloc() to manipulate klimit directly, rather than via a parameter. Move msChunks_alloc() and msChunks into iSeries_setup.c, as that's where they're used. Signed-off-by: Michael Ellerman arch/ppc64/kernel/LparData.c | 18 ------------------ arch/ppc64/kernel/iSeries_setup.c | 20 ++++++++++++++++++-- include/asm-ppc64/abs_addr.h | 15 +++++++++------ 3 files changed, 27 insertions(+), 26 deletions(-) Index: work/include/asm-ppc64/abs_addr.h =================================================================== --- work.orig/include/asm-ppc64/abs_addr.h +++ work/include/asm-ppc64/abs_addr.h @@ -17,34 +17,37 @@ #include #include -typedef u32 msChunks_entry; struct msChunks { unsigned long num_chunks; unsigned long chunk_size; unsigned long chunk_shift; unsigned long chunk_mask; - msChunks_entry *abs; + u32 *abs; }; extern struct msChunks msChunks; -extern unsigned long msChunks_alloc(unsigned long, unsigned long, unsigned long); #ifdef CONFIG_MSCHUNKS +/* Chunks are 256 KB */ +#define MSCHUNKS_CHUNK_SHIFT (18) +#define MSCHUNKS_CHUNK_SIZE (1UL << MSCHUNKS_CHUNK_SHIFT) +#define MSCHUNKS_OFFSET_MASK (MSCHUNKS_CHUNK_SIZE - 1) + static inline unsigned long chunk_to_addr(unsigned long chunk) { - return chunk << msChunks.chunk_shift; + return chunk << MSCHUNKS_CHUNK_SHIFT; } static inline unsigned long addr_to_chunk(unsigned long addr) { - return addr >> msChunks.chunk_shift; + return addr >> MSCHUNKS_CHUNK_SHIFT; } static inline unsigned long chunk_offset(unsigned long addr) { - return addr & msChunks.chunk_mask; + return addr & MSCHUNKS_OFFSET_MASK; } static inline unsigned long abs_chunk(unsigned long pchunk) Index: work/arch/ppc64/kernel/iSeries_setup.c =================================================================== --- work.orig/arch/ppc64/kernel/iSeries_setup.c +++ work/arch/ppc64/kernel/iSeries_setup.c @@ -412,6 +412,22 @@ static void __init iSeries_init_early(vo DBG(" <- iSeries_init_early()\n"); } +struct msChunks msChunks = { + /* XXX We don't use these, but Piranha might need them. */ + .chunk_size = MSCHUNKS_CHUNK_SIZE, + .chunk_shift = MSCHUNKS_CHUNK_SHIFT, + .chunk_mask = MSCHUNKS_OFFSET_MASK, +}; +EXPORT_SYMBOL(msChunks); + +void msChunks_alloc(unsigned long num_chunks) +{ + klimit = _ALIGN(klimit, sizeof(u32)); + msChunks.abs = (u32 *)klimit; + klimit += num_chunks * sizeof(u32); + msChunks.num_chunks = num_chunks; +} + /* * The iSeries may have very large memories ( > 128 GB ) and a partition * may get memory in "chunks" that may be anywhere in the 2**52 real @@ -449,7 +465,7 @@ static void __init build_iSeries_Memory_ /* Chunk size on iSeries is 256K bytes */ totalChunks = (u32)HvLpConfig_getMsChunks(); - klimit = msChunks_alloc(klimit, totalChunks, 1UL << 18); + msChunks_alloc(totalChunks); /* * Get absolute address of our load area @@ -495,7 +511,7 @@ static void __init build_iSeries_Memory_ */ hptFirstChunk = (u32)addr_to_chunk(HvCallHpt_getHptAddress()); hptSizePages = (u32)HvCallHpt_getHptPages(); - hptSizeChunks = hptSizePages >> (msChunks.chunk_shift - PAGE_SHIFT); + hptSizeChunks = hptSizePages >> (MSCHUNKS_CHUNK_SHIFT - PAGE_SHIFT); hptLastChunk = hptFirstChunk + hptSizeChunks - 1; printk("HPT absolute addr = %016lx, size = %dK\n", Index: work/arch/ppc64/kernel/LparData.c =================================================================== --- work.orig/arch/ppc64/kernel/LparData.c +++ work/arch/ppc64/kernel/LparData.c @@ -291,21 +291,3 @@ struct ItVpdAreas itVpdAreas = { 0,0 } }; - -struct msChunks msChunks; -EXPORT_SYMBOL(msChunks); - -unsigned long -msChunks_alloc(unsigned long mem, unsigned long num_chunks, unsigned long chunk_size) -{ - _msChunks->num_chunks = num_chunks; - _msChunks->chunk_size = chunk_size; - _msChunks->chunk_shift = __ilog2(chunk_size); - _msChunks->chunk_mask = (1UL<<_msChunks->chunk_shift)-1; - - mem = _ALIGN(mem, sizeof(msChunks_entry)); - _msChunks->abs = (msChunks_entry *)mem; - mem += num_chunks * sizeof(msChunks_entry); - - return mem; -} From michael at ellerman.id.au Wed Aug 3 20:21:23 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Wed, 3 Aug 2005 20:21:23 +1000 (EST) Subject: [PATCH 3/10] ppc64: Rename msChunks structure In-Reply-To: <1123064479.417492.649639846705.qpatch@concordia> Message-ID: <20050803102123.B23FD67E87@ozlabs.org> Rename the msChunks struct to get rid of the StUdlY caps and make it a bit clearer what it's for. Signed-off-by: Michael Ellerman arch/ppc64/kernel/head.S | 4 ++-- arch/ppc64/kernel/iSeries_setup.c | 17 +++++++++-------- include/asm-ppc64/abs_addr.h | 15 +++++++-------- 3 files changed, 18 insertions(+), 18 deletions(-) Index: work/arch/ppc64/kernel/iSeries_setup.c =================================================================== --- work.orig/arch/ppc64/kernel/iSeries_setup.c +++ work/arch/ppc64/kernel/iSeries_setup.c @@ -412,20 +412,20 @@ static void __init iSeries_init_early(vo DBG(" <- iSeries_init_early()\n"); } -struct msChunks msChunks = { +struct mschunks_map mschunks_map = { /* XXX We don't use these, but Piranha might need them. */ .chunk_size = MSCHUNKS_CHUNK_SIZE, .chunk_shift = MSCHUNKS_CHUNK_SHIFT, .chunk_mask = MSCHUNKS_OFFSET_MASK, }; -EXPORT_SYMBOL(msChunks); +EXPORT_SYMBOL(mschunks_map); -void msChunks_alloc(unsigned long num_chunks) +void mschunks_alloc(unsigned long num_chunks) { klimit = _ALIGN(klimit, sizeof(u32)); - msChunks.abs = (u32 *)klimit; + mschunks_map.mapping = (u32 *)klimit; klimit += num_chunks * sizeof(u32); - msChunks.num_chunks = num_chunks; + mschunks_map.num_chunks = num_chunks; } /* @@ -465,7 +465,7 @@ static void __init build_iSeries_Memory_ /* Chunk size on iSeries is 256K bytes */ totalChunks = (u32)HvLpConfig_getMsChunks(); - msChunks_alloc(totalChunks); + mschunks_alloc(totalChunks); /* * Get absolute address of our load area @@ -502,7 +502,7 @@ static void __init build_iSeries_Memory_ printk("Load area size %dK\n", loadAreaSize * 256); for (nextPhysChunk = 0; nextPhysChunk < loadAreaSize; ++nextPhysChunk) - msChunks.abs[nextPhysChunk] = + mschunks_map.mapping[nextPhysChunk] = loadAreaFirstChunk + nextPhysChunk; /* @@ -568,7 +568,8 @@ static void __init build_iSeries_Memory_ (absChunk > hptLastChunk)) && ((absChunk < loadAreaFirstChunk) || (absChunk > loadAreaLastChunk))) { - msChunks.abs[nextPhysChunk] = absChunk; + mschunks_map.mapping[nextPhysChunk] = + absChunk; ++nextPhysChunk; } } Index: work/include/asm-ppc64/abs_addr.h =================================================================== --- work.orig/include/asm-ppc64/abs_addr.h +++ work/include/asm-ppc64/abs_addr.h @@ -17,18 +17,17 @@ #include #include -struct msChunks { +#ifdef CONFIG_MSCHUNKS + +struct mschunks_map { unsigned long num_chunks; unsigned long chunk_size; unsigned long chunk_shift; unsigned long chunk_mask; - u32 *abs; + u32 *mapping; }; -extern struct msChunks msChunks; - - -#ifdef CONFIG_MSCHUNKS +extern struct mschunks_map mschunks_map; /* Chunks are 256 KB */ #define MSCHUNKS_CHUNK_SHIFT (18) @@ -52,10 +51,10 @@ static inline unsigned long chunk_offset static inline unsigned long abs_chunk(unsigned long pchunk) { - if (pchunk >= msChunks.num_chunks) + if (pchunk >= mschunks_map.num_chunks) return pchunk; - return msChunks.abs[pchunk]; + return mschunks_map.mapping[pchunk]; } /* A macro so it can take pointers or unsigned long. */ Index: work/arch/ppc64/kernel/head.S =================================================================== --- work.orig/arch/ppc64/kernel/head.S +++ work/arch/ppc64/kernel/head.S @@ -102,12 +102,12 @@ END_FTR_SECTION(0, 1) .llong hvReleaseData-KERNELBASE /* - * At offset 0x28 and 0x30 are offsets to the msChunks + * At offset 0x28 and 0x30 are offsets to the mschunks_map * array (used by the iSeries LPAR debugger to do translation * between physical addresses and absolute addresses) and * to the pidhash table (also used by the debugger) */ - .llong msChunks-KERNELBASE + .llong mschunks_map-KERNELBASE .llong 0 /* pidhash-KERNELBASE SFRXXX */ /* Offset 0x38 - Pointer to start of embedded System.map */ From michael at ellerman.id.au Wed Aug 3 20:21:23 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Wed, 3 Aug 2005 20:21:23 +1000 (EST) Subject: [PATCH 4/10] ppc64: Consolidate some macros In-Reply-To: <1123064479.417492.649639846705.qpatch@concordia> Message-ID: <20050803102123.42BAA67E87@ozlabs.org> The only caller of chunk_offset() and abs_chunk() is phys_to_abs(), so fold the former two into the latter. Signed-off-by: Michael Ellerman include/asm-ppc64/abs_addr.h | 21 +++++++-------------- 1 files changed, 7 insertions(+), 14 deletions(-) Index: work/include/asm-ppc64/abs_addr.h =================================================================== --- work.orig/include/asm-ppc64/abs_addr.h +++ work/include/asm-ppc64/abs_addr.h @@ -44,24 +44,17 @@ static inline unsigned long addr_to_chun return addr >> MSCHUNKS_CHUNK_SHIFT; } -static inline unsigned long chunk_offset(unsigned long addr) +static inline unsigned long phys_to_abs(unsigned long pa) { - return addr & MSCHUNKS_OFFSET_MASK; -} + unsigned long chunk; -static inline unsigned long abs_chunk(unsigned long pchunk) -{ - if (pchunk >= mschunks_map.num_chunks) - return pchunk; + chunk = addr_to_chunk(pa); - return mschunks_map.mapping[pchunk]; -} + if (chunk < mschunks_map.num_chunks) + chunk = mschunks_map.mapping[chunk]; -/* A macro so it can take pointers or unsigned long. */ -#define phys_to_abs(pa) \ - ({ unsigned long _pa = (unsigned long)(pa); \ - chunk_to_addr(abs_chunk(addr_to_chunk(_pa))) + chunk_offset(_pa); \ - }) + return chunk_to_addr(chunk) + (pa & MSCHUNKS_OFFSET_MASK); +} static inline unsigned long physRpn_to_absRpn(unsigned long rpn) From michael at ellerman.id.au Wed Aug 3 20:21:24 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Wed, 3 Aug 2005 20:21:24 +1000 (EST) Subject: [PATCH 5/10] ppc64: Remove redundant uses of physRpn_to_absRpn In-Reply-To: <1123064479.417492.649639846705.qpatch@concordia> Message-ID: <20050803102124.9D5D467E91@ozlabs.org> physRpn_to_absRpn is a no-op on non-iSeries platforms, remove the two redundant calls. There's only one caller on iSeries so fold the logic in there so we can get rid of it completely. Signed-off-by: Michael Ellerman arch/ppc64/kernel/iSeries_htab.c | 5 ++++- arch/ppc64/kernel/pSeries_lpar.c | 3 +-- arch/ppc64/mm/hash_native.c | 3 +-- include/asm-ppc64/abs_addr.h | 8 -------- 4 files changed, 6 insertions(+), 13 deletions(-) Index: work/arch/ppc64/kernel/pSeries_lpar.c =================================================================== --- work.orig/arch/ppc64/kernel/pSeries_lpar.c +++ work/arch/ppc64/kernel/pSeries_lpar.c @@ -279,7 +279,6 @@ long pSeries_lpar_hpte_insert(unsigned l unsigned long va, unsigned long prpn, unsigned long vflags, unsigned long rflags) { - unsigned long arpn = physRpn_to_absRpn(prpn); unsigned long lpar_rc; unsigned long flags; unsigned long slot; @@ -290,7 +289,7 @@ long pSeries_lpar_hpte_insert(unsigned l if (vflags & HPTE_V_LARGE) hpte_v &= ~(1UL << HPTE_V_AVPN_SHIFT); - hpte_r = (arpn << HPTE_R_RPN_SHIFT) | rflags; + hpte_r = (prpn << HPTE_R_RPN_SHIFT) | rflags; /* Now fill in the actual HPTE */ /* Set CEC cookie to 0 */ Index: work/arch/ppc64/mm/hash_native.c =================================================================== --- work.orig/arch/ppc64/mm/hash_native.c +++ work/arch/ppc64/mm/hash_native.c @@ -51,7 +51,6 @@ long native_hpte_insert(unsigned long hp unsigned long prpn, unsigned long vflags, unsigned long rflags) { - unsigned long arpn = physRpn_to_absRpn(prpn); hpte_t *hptep = htab_address + hpte_group; unsigned long hpte_v, hpte_r; int i; @@ -74,7 +73,7 @@ long native_hpte_insert(unsigned long hp hpte_v = (va >> 23) << HPTE_V_AVPN_SHIFT | vflags | HPTE_V_VALID; if (vflags & HPTE_V_LARGE) va &= ~(1UL << HPTE_V_AVPN_SHIFT); - hpte_r = (arpn << HPTE_R_RPN_SHIFT) | rflags; + hpte_r = (prpn << HPTE_R_RPN_SHIFT) | rflags; hptep->r = hpte_r; /* Guarantee the second dword is visible before the valid bit */ Index: work/arch/ppc64/kernel/iSeries_htab.c =================================================================== --- work.orig/arch/ppc64/kernel/iSeries_htab.c +++ work/arch/ppc64/kernel/iSeries_htab.c @@ -41,6 +41,7 @@ static long iSeries_hpte_insert(unsigned unsigned long prpn, unsigned long vflags, unsigned long rflags) { + unsigned long arpn; long slot; hpte_t lhpte; int secondary = 0; @@ -70,8 +71,10 @@ static long iSeries_hpte_insert(unsigned slot &= 0x7fffffffffffffff; } + arpn = phys_to_abs(prpn << PAGE_SHIFT) >> PAGE_SHIFT; + lhpte.v = (va >> 23) << HPTE_V_AVPN_SHIFT | vflags | HPTE_V_VALID; - lhpte.r = (physRpn_to_absRpn(prpn) << HPTE_R_RPN_SHIFT) | rflags; + lhpte.r = (arpn << HPTE_R_RPN_SHIFT) | rflags; /* Now fill in the actual HPTE */ HvCallHpt_addValidate(slot, secondary, &lhpte); Index: work/include/asm-ppc64/abs_addr.h =================================================================== --- work.orig/include/asm-ppc64/abs_addr.h +++ work/include/asm-ppc64/abs_addr.h @@ -56,14 +56,6 @@ static inline unsigned long phys_to_abs( return chunk_to_addr(chunk) + (pa & MSCHUNKS_OFFSET_MASK); } -static inline unsigned long -physRpn_to_absRpn(unsigned long rpn) -{ - unsigned long pa = rpn << PAGE_SHIFT; - unsigned long aa = phys_to_abs(pa); - return (aa >> PAGE_SHIFT); -} - /* A macro so it can take pointers or unsigned long. */ #define abs_to_phys(aa) lmb_abs_to_phys((unsigned long)(aa)) From michael at ellerman.id.au Wed Aug 3 20:21:24 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Wed, 3 Aug 2005 20:21:24 +1000 (EST) Subject: [PATCH 6/10] ppc64: Remove redundant use of pointers in lmb code In-Reply-To: <1123064479.417492.649639846705.qpatch@concordia> Message-ID: <20050803102124.DA57167E87@ozlabs.org> The lmb code is all written to use a pointer to an lmb struct. But it's always the same lmb struct, called "lmb". So we take the address of lmb, call it _lmb and then start using _lmb->foo everywhere, which is silly. This patch removes the _lmb pointers and replaces them with direct references to the one "lmb" struct. We do the same for some _mem and _rsv pointers which point to lmb.memory and lmb.reserved respectively. This patch looks quite busy, but it's basically just: s/_lmb->/lmb./g s/_mem->/lmb.memory./g s/_rsv->/lmb.reserved./g s/_rsv/&lmb.reserved/g s/mem->/lmb.memory./g Signed-off-by: Michael Ellerman arch/ppc64/kernel/lmb.c | 100 ++++++++++++++++++++---------------------------- 1 files changed, 43 insertions(+), 57 deletions(-) Index: work/arch/ppc64/kernel/lmb.c =================================================================== --- work.orig/arch/ppc64/kernel/lmb.c +++ work/arch/ppc64/kernel/lmb.c @@ -28,33 +28,32 @@ void lmb_dump_all(void) { #ifdef DEBUG unsigned long i; - struct lmb *_lmb = &lmb; udbg_printf("lmb_dump_all:\n"); udbg_printf(" memory.cnt = 0x%lx\n", - _lmb->memory.cnt); + lmb.memory.cnt); udbg_printf(" memory.size = 0x%lx\n", - _lmb->memory.size); - for (i=0; i < _lmb->memory.cnt ;i++) { + lmb.memory.size); + for (i=0; i < lmb.memory.cnt ;i++) { udbg_printf(" memory.region[0x%x].base = 0x%lx\n", - i, _lmb->memory.region[i].base); + i, lmb.memory.region[i].base); udbg_printf(" .physbase = 0x%lx\n", - _lmb->memory.region[i].physbase); + lmb.memory.region[i].physbase); udbg_printf(" .size = 0x%lx\n", - _lmb->memory.region[i].size); + lmb.memory.region[i].size); } udbg_printf("\n reserved.cnt = 0x%lx\n", - _lmb->reserved.cnt); + lmb.reserved.cnt); udbg_printf(" reserved.size = 0x%lx\n", - _lmb->reserved.size); - for (i=0; i < _lmb->reserved.cnt ;i++) { + lmb.reserved.size); + for (i=0; i < lmb.reserved.cnt ;i++) { udbg_printf(" reserved.region[0x%x].base = 0x%lx\n", - i, _lmb->reserved.region[i].base); + i, lmb.reserved.region[i].base); udbg_printf(" .physbase = 0x%lx\n", - _lmb->reserved.region[i].physbase); + lmb.reserved.region[i].physbase); udbg_printf(" .size = 0x%lx\n", - _lmb->reserved.region[i].size); + lmb.reserved.region[i].size); } #endif /* DEBUG */ } @@ -108,19 +107,17 @@ lmb_coalesce_regions(struct lmb_region * void __init lmb_init(void) { - struct lmb *_lmb = &lmb; - /* Create a dummy zero size LMB which will get coalesced away later. * This simplifies the lmb_add() code below... */ - _lmb->memory.region[0].base = 0; - _lmb->memory.region[0].size = 0; - _lmb->memory.cnt = 1; + lmb.memory.region[0].base = 0; + lmb.memory.region[0].size = 0; + lmb.memory.cnt = 1; /* Ditto. */ - _lmb->reserved.region[0].base = 0; - _lmb->reserved.region[0].size = 0; - _lmb->reserved.cnt = 1; + lmb.reserved.region[0].base = 0; + lmb.reserved.region[0].size = 0; + lmb.reserved.cnt = 1; } /* This routine called with relocation disabled. */ @@ -130,27 +127,26 @@ lmb_analyze(void) unsigned long i; unsigned long mem_size = 0; unsigned long size_mask = 0; - struct lmb *_lmb = &lmb; #ifdef CONFIG_MSCHUNKS unsigned long physbase = 0; #endif - for (i=0; i < _lmb->memory.cnt; i++) { + for (i=0; i < lmb.memory.cnt; i++) { unsigned long lmb_size; - lmb_size = _lmb->memory.region[i].size; + lmb_size = lmb.memory.region[i].size; #ifdef CONFIG_MSCHUNKS - _lmb->memory.region[i].physbase = physbase; + lmb.memory.region[i].physbase = physbase; physbase += lmb_size; #else - _lmb->memory.region[i].physbase = _lmb->memory.region[i].base; + lmb.memory.region[i].physbase = lmb.memory.region[i].base; #endif mem_size += lmb_size; size_mask |= lmb_size; } - _lmb->memory.size = mem_size; + lmb.memory.size = mem_size; } /* This routine called with relocation disabled. */ @@ -213,12 +209,11 @@ lmb_add_region(struct lmb_region *rgn, u long __init lmb_add(unsigned long base, unsigned long size) { - struct lmb *_lmb = &lmb; - struct lmb_region *_rgn = &(_lmb->memory); + struct lmb_region *_rgn = &(lmb.memory); /* On pSeries LPAR systems, the first LMB is our RMO region. */ if ( base == 0 ) - _lmb->rmo_size = size; + lmb.rmo_size = size; return lmb_add_region(_rgn, base, size); @@ -227,8 +222,7 @@ lmb_add(unsigned long base, unsigned lon long __init lmb_reserve(unsigned long base, unsigned long size) { - struct lmb *_lmb = &lmb; - struct lmb_region *_rgn = &(_lmb->reserved); + struct lmb_region *_rgn = &(lmb.reserved); return lmb_add_region(_rgn, base, size); } @@ -260,13 +254,10 @@ lmb_alloc_base(unsigned long size, unsig { long i, j; unsigned long base = 0; - struct lmb *_lmb = &lmb; - struct lmb_region *_mem = &(_lmb->memory); - struct lmb_region *_rsv = &(_lmb->reserved); - for (i=_mem->cnt-1; i >= 0; i--) { - unsigned long lmbbase = _mem->region[i].base; - unsigned long lmbsize = _mem->region[i].size; + for (i=lmb.memory.cnt-1; i >= 0; i--) { + unsigned long lmbbase = lmb.memory.region[i].base; + unsigned long lmbsize = lmb.memory.region[i].size; if ( max_addr == LMB_ALLOC_ANYWHERE ) base = _ALIGN_DOWN(lmbbase+lmbsize-size, align); @@ -276,8 +267,8 @@ lmb_alloc_base(unsigned long size, unsig continue; while ( (lmbbase <= base) && - ((j = lmb_overlaps_region(_rsv,base,size)) >= 0) ) { - base = _ALIGN_DOWN(_rsv->region[j].base-size, align); + ((j = lmb_overlaps_region(&lmb.reserved,base,size)) >= 0) ) { + base = _ALIGN_DOWN(lmb.reserved.region[j].base-size, align); } if ( (base != 0) && (lmbbase <= base) ) @@ -287,7 +278,7 @@ lmb_alloc_base(unsigned long size, unsig if ( i < 0 ) return 0; - lmb_add_region(_rsv, base, size); + lmb_add_region(&lmb.reserved, base, size); return base; } @@ -295,17 +286,15 @@ lmb_alloc_base(unsigned long size, unsig unsigned long __init lmb_phys_mem_size(void) { - struct lmb *_lmb = &lmb; #ifdef CONFIG_MSCHUNKS - return _lmb->memory.size; + return lmb.memory.size; #else - struct lmb_region *_mem = &(_lmb->memory); unsigned long total = 0; int i; /* add all physical memory to the bootmem map */ - for (i=0; i < _mem->cnt; i++) - total += _mem->region[i].size; + for (i=0; i < lmb.memory.cnt; i++) + total += lmb.memory.region[i].size; return total; #endif /* CONFIG_MSCHUNKS */ } @@ -313,14 +302,12 @@ lmb_phys_mem_size(void) unsigned long __init lmb_end_of_DRAM(void) { - struct lmb *_lmb = &lmb; - struct lmb_region *_mem = &(_lmb->memory); - int idx = _mem->cnt - 1; + int idx = lmb.memory.cnt - 1; #ifdef CONFIG_MSCHUNKS - return (_mem->region[idx].physbase + _mem->region[idx].size); + return (lmb.memory.region[idx].physbase + lmb.memory.region[idx].size); #else - return (_mem->region[idx].base + _mem->region[idx].size); + return (lmb.memory.region[idx].base + lmb.memory.region[idx].size); #endif /* CONFIG_MSCHUNKS */ return 0; @@ -353,20 +340,19 @@ void __init lmb_enforce_memory_limit(voi { extern unsigned long memory_limit; unsigned long i, limit; - struct lmb_region *mem = &(lmb.memory); if (! memory_limit) return; limit = memory_limit; - for (i = 0; i < mem->cnt; i++) { - if (limit > mem->region[i].size) { - limit -= mem->region[i].size; + for (i = 0; i < lmb.memory.cnt; i++) { + if (limit > lmb.memory.region[i].size) { + limit -= lmb.memory.region[i].size; continue; } - mem->region[i].size = limit; - mem->cnt = i + 1; + lmb.memory.region[i].size = limit; + lmb.memory.cnt = i + 1; break; } } From michael at ellerman.id.au Wed Aug 3 20:21:25 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Wed, 3 Aug 2005 20:21:25 +1000 (EST) Subject: [PATCH 7/10] ppc64: Remove redundant abs_to_phys() macro In-Reply-To: <1123064479.417492.649639846705.qpatch@concordia> Message-ID: <20050803102125.6A5A767E91@ozlabs.org> abs_to_phys() is a macro that turns out to do nothing, and also has the unfortunate property that it's not the inverse of phys_to_abs() on iSeries. The following is for my benefit as much as everyone else. With CONFIG_MSCHUNKS enabled, the lmb code is changed such that it keeps a physbase variable for each lmb region. This is used to take the possibly discontiguous lmb regions and present them as a contiguous address space beginning from zero. In this context each lmb region's base address is its "absolute" base address, and its physbase is it's "physical" address (from Linux's point of view). The abs_to_phys() macro does the mapping from "absolute" to "physical". Note: This is not related to the iSeries mapping of physical to absolute (ie. Hypervisor) addresses which is maintained with the msChunks structure. And the msChunks structure is not controlled via CONFIG_MSCHUNKS. Once upon a time you could compile for non-iSeries with CONFIG_MSCHUNKS enabled. But these days CONFIG_MSCHUNKS depends on CONFIG_PPC_ISERIES, so for non-iSeries code abs_to_phys() is a no-op. On iSeries we always have one lmb region which spans from 0 to systemcfg->physicalMemorySize (arch/ppc64/kernel/iSeries_setup.c line 383). This region has a base (ie. absolute) address of 0, and a physbase address of 0 (as calculated in lmb_analyze() (arch/ppc64/kernel/lmb.c line 144)). On iSeries, abs_to_phys(aa) is defined as lmb_abs_to_phys(aa), which finds the lmb region containing aa (and there's only one, ie. 0), and then does: return lmb.memory.region[0].physbase + (aa - lmb.memory.region[0].base) physbase == base == 0, so you're left with "return aa". So remove abs_to_phys(), and lmb_abs_to_phys() which is the implementation of abs_to_phys() for iSeries. Signed-off-by: Michael Ellerman arch/ppc64/kernel/lmb.c | 19 ------------------- arch/ppc64/mm/init.c | 4 +--- include/asm-ppc64/abs_addr.h | 6 +----- include/asm-ppc64/lmb.h | 1 - 4 files changed, 2 insertions(+), 28 deletions(-) Index: work/arch/ppc64/mm/init.c =================================================================== --- work.orig/arch/ppc64/mm/init.c +++ work/arch/ppc64/mm/init.c @@ -42,7 +42,6 @@ #include #include -#include #include #include #include @@ -159,7 +158,6 @@ static int map_io_page(unsigned long ea, ptep = pte_alloc_kernel(&init_mm, pmdp, ea); if (!ptep) return -ENOMEM; - pa = abs_to_phys(pa); set_pte_at(&init_mm, ea, ptep, pfn_pte(pa >> PAGE_SHIFT, __pgprot(flags))); spin_unlock(&init_mm.page_table_lock); @@ -547,7 +545,7 @@ void __init do_init_bootmem(void) */ bootmap_pages = bootmem_bootmap_pages(total_pages); - start = abs_to_phys(lmb_alloc(bootmap_pages<> PAGE_SHIFT, total_pages); Index: work/include/asm-ppc64/abs_addr.h =================================================================== --- work.orig/include/asm-ppc64/abs_addr.h +++ work/include/asm-ppc64/abs_addr.h @@ -56,9 +56,6 @@ static inline unsigned long phys_to_abs( return chunk_to_addr(chunk) + (pa & MSCHUNKS_OFFSET_MASK); } -/* A macro so it can take pointers or unsigned long. */ -#define abs_to_phys(aa) lmb_abs_to_phys((unsigned long)(aa)) - #else /* !CONFIG_MSCHUNKS */ #define chunk_to_addr(chunk) ((unsigned long)(chunk)) @@ -68,12 +65,11 @@ static inline unsigned long phys_to_abs( #define phys_to_abs(pa) (pa) #define physRpn_to_absRpn(rpn) (rpn) -#define abs_to_phys(aa) (aa) #endif /* !CONFIG_MSCHUNKS */ /* Convenience macros */ #define virt_to_abs(va) phys_to_abs(__pa(va)) -#define abs_to_virt(aa) __va(abs_to_phys(aa)) +#define abs_to_virt(aa) __va(aa) #endif /* _ABS_ADDR_H */ Index: work/arch/ppc64/kernel/lmb.c =================================================================== --- work.orig/arch/ppc64/kernel/lmb.c +++ work/arch/ppc64/kernel/lmb.c @@ -313,25 +313,6 @@ lmb_end_of_DRAM(void) return 0; } -unsigned long __init -lmb_abs_to_phys(unsigned long aa) -{ - unsigned long i, pa = aa; - struct lmb *_lmb = &lmb; - struct lmb_region *_mem = &(_lmb->memory); - - for (i=0; i < _mem->cnt; i++) { - unsigned long lmbbase = _mem->region[i].base; - unsigned long lmbsize = _mem->region[i].size; - if ( lmb_addrs_overlap(aa,1,lmbbase,lmbsize) ) { - pa = _mem->region[i].physbase + (aa - lmbbase); - break; - } - } - - return pa; -} - /* * Truncate the lmb list to memory_limit if it's set * You must call lmb_analyze() after this. Index: work/include/asm-ppc64/lmb.h =================================================================== --- work.orig/include/asm-ppc64/lmb.h +++ work/include/asm-ppc64/lmb.h @@ -50,7 +50,6 @@ extern unsigned long __init lmb_alloc_ba unsigned long); extern unsigned long __init lmb_phys_mem_size(void); extern unsigned long __init lmb_end_of_DRAM(void); -extern unsigned long __init lmb_abs_to_phys(unsigned long); extern void __init lmb_enforce_memory_limit(void); extern void lmb_dump_all(void); From michael at ellerman.id.au Wed Aug 3 20:21:26 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Wed, 3 Aug 2005 20:21:26 +1000 (EST) Subject: [PATCH 9/10] ppc64: Simplify some lmb functions In-Reply-To: <1123064479.417492.649639846705.qpatch@concordia> Message-ID: <20050803102126.9938767E9B@ozlabs.org> lmb_phys_mem_size() can always return lmb.memory.size, as long as it's called after lmb_analyze(), which it is. There's no need to recalculate the size on every call. lmb_analyze() was calculating a few things we then threw away, so just don't calculate them to start with. Signed-off-by: Michael Ellerman arch/ppc64/kernel/lmb.c | 27 +++++---------------------- 1 files changed, 5 insertions(+), 22 deletions(-) Index: work/arch/ppc64/kernel/lmb.c =================================================================== --- work.orig/arch/ppc64/kernel/lmb.c +++ work/arch/ppc64/kernel/lmb.c @@ -119,20 +119,12 @@ lmb_init(void) void __init lmb_analyze(void) { - unsigned long i; - unsigned long mem_size = 0; - unsigned long size_mask = 0; - - for (i=0; i < lmb.memory.cnt; i++) { - unsigned long lmb_size; + int i; - lmb_size = lmb.memory.region[i].size; + lmb.memory.size = 0; - mem_size += lmb_size; - size_mask |= lmb_size; - } - - lmb.memory.size = mem_size; + for (i = 0; i < lmb.memory.cnt; i++) + lmb.memory.size += lmb.memory.region[i].size; } /* This routine called with relocation disabled. */ @@ -266,20 +258,11 @@ lmb_alloc_base(unsigned long size, unsig return base; } +/* You must call lmb_analyze() before this. */ unsigned long __init lmb_phys_mem_size(void) { -#ifdef CONFIG_MSCHUNKS return lmb.memory.size; -#else - unsigned long total = 0; - int i; - - /* add all physical memory to the bootmem map */ - for (i=0; i < lmb.memory.cnt; i++) - total += lmb.memory.region[i].size; - return total; -#endif /* CONFIG_MSCHUNKS */ } unsigned long __init From michael at ellerman.id.au Wed Aug 3 20:21:26 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Wed, 3 Aug 2005 20:21:26 +1000 (EST) Subject: [PATCH 8/10] ppc64: Remove physbase from the lmb_property struct In-Reply-To: <1123064479.417492.649639846705.qpatch@concordia> Message-ID: <20050803102126.30DA467E97@ozlabs.org> We no longer need the lmb code to know about abs and phys addresses, so remove the physbase variable from the lmb_property struct. Signed-off-by: Michael Ellerman arch/ppc64/kernel/lmb.c | 23 ----------------------- arch/ppc64/mm/hash_utils.c | 2 +- arch/ppc64/mm/init.c | 27 ++++++++++++--------------- arch/ppc64/mm/numa.c | 2 +- include/asm-ppc64/lmb.h | 1 - 5 files changed, 14 insertions(+), 41 deletions(-) Index: work/include/asm-ppc64/lmb.h =================================================================== --- work.orig/include/asm-ppc64/lmb.h +++ work/include/asm-ppc64/lmb.h @@ -22,7 +22,6 @@ struct lmb_property { unsigned long base; - unsigned long physbase; unsigned long size; }; Index: work/arch/ppc64/kernel/lmb.c =================================================================== --- work.orig/arch/ppc64/kernel/lmb.c +++ work/arch/ppc64/kernel/lmb.c @@ -37,8 +37,6 @@ void lmb_dump_all(void) for (i=0; i < lmb.memory.cnt ;i++) { udbg_printf(" memory.region[0x%x].base = 0x%lx\n", i, lmb.memory.region[i].base); - udbg_printf(" .physbase = 0x%lx\n", - lmb.memory.region[i].physbase); udbg_printf(" .size = 0x%lx\n", lmb.memory.region[i].size); } @@ -50,8 +48,6 @@ void lmb_dump_all(void) for (i=0; i < lmb.reserved.cnt ;i++) { udbg_printf(" reserved.region[0x%x].base = 0x%lx\n", i, lmb.reserved.region[i].base); - udbg_printf(" .physbase = 0x%lx\n", - lmb.reserved.region[i].physbase); udbg_printf(" .size = 0x%lx\n", lmb.reserved.region[i].size); } @@ -97,7 +93,6 @@ lmb_coalesce_regions(struct lmb_region * rgn->region[r1].size += rgn->region[r2].size; for (i=r2; i < rgn->cnt-1; i++) { rgn->region[i].base = rgn->region[i+1].base; - rgn->region[i].physbase = rgn->region[i+1].physbase; rgn->region[i].size = rgn->region[i+1].size; } rgn->cnt--; @@ -127,21 +122,12 @@ lmb_analyze(void) unsigned long i; unsigned long mem_size = 0; unsigned long size_mask = 0; -#ifdef CONFIG_MSCHUNKS - unsigned long physbase = 0; -#endif for (i=0; i < lmb.memory.cnt; i++) { unsigned long lmb_size; lmb_size = lmb.memory.region[i].size; -#ifdef CONFIG_MSCHUNKS - lmb.memory.region[i].physbase = physbase; - physbase += lmb_size; -#else - lmb.memory.region[i].physbase = lmb.memory.region[i].base; -#endif mem_size += lmb_size; size_mask |= lmb_size; } @@ -164,7 +150,6 @@ lmb_add_region(struct lmb_region *rgn, u adjacent = lmb_addrs_adjacent(base,size,rgnbase,rgnsize); if ( adjacent > 0 ) { rgn->region[i].base -= size; - rgn->region[i].physbase -= size; rgn->region[i].size += size; coalesced++; break; @@ -191,11 +176,9 @@ lmb_add_region(struct lmb_region *rgn, u for (i=rgn->cnt-1; i >= 0; i--) { if (base < rgn->region[i].base) { rgn->region[i+1].base = rgn->region[i].base; - rgn->region[i+1].physbase = rgn->region[i].physbase; rgn->region[i+1].size = rgn->region[i].size; } else { rgn->region[i+1].base = base; - rgn->region[i+1].physbase = lmb_abs_to_phys(base); rgn->region[i+1].size = size; break; } @@ -304,13 +287,7 @@ lmb_end_of_DRAM(void) { int idx = lmb.memory.cnt - 1; -#ifdef CONFIG_MSCHUNKS - return (lmb.memory.region[idx].physbase + lmb.memory.region[idx].size); -#else return (lmb.memory.region[idx].base + lmb.memory.region[idx].size); -#endif /* CONFIG_MSCHUNKS */ - - return 0; } /* Index: work/arch/ppc64/mm/init.c =================================================================== --- work.orig/arch/ppc64/mm/init.c +++ work/arch/ppc64/mm/init.c @@ -482,9 +482,9 @@ void __init mm_init_ppc64(void) for (i = 1; i < lmb.memory.cnt; i++) { unsigned long base, prevbase, prevsize; - prevbase = lmb.memory.region[i-1].physbase; + prevbase = lmb.memory.region[i-1].base; prevsize = lmb.memory.region[i-1].size; - base = lmb.memory.region[i].physbase; + base = lmb.memory.region[i].base; if (base > (prevbase + prevsize)) { io_hole_start = prevbase + prevsize; io_hole_size = base - (prevbase + prevsize); @@ -511,11 +511,8 @@ int page_is_ram(unsigned long pfn) for (i=0; i < lmb.memory.cnt; i++) { unsigned long base; -#ifdef CONFIG_MSCHUNKS - base = lmb.memory.region[i].physbase; -#else base = lmb.memory.region[i].base; -#endif + if ((paddr >= base) && (paddr < (base + lmb.memory.region[i].size))) { return 1; @@ -556,25 +553,25 @@ void __init do_init_bootmem(void) * present. */ for (i=0; i < lmb.memory.cnt; i++) { - unsigned long physbase, size; + unsigned long base, size; unsigned long start_pfn, end_pfn; - physbase = lmb.memory.region[i].physbase; + base = lmb.memory.region[i].base; size = lmb.memory.region[i].size; - start_pfn = physbase >> PAGE_SHIFT; + start_pfn = base >> PAGE_SHIFT; end_pfn = start_pfn + (size >> PAGE_SHIFT); memory_present(0, start_pfn, end_pfn); - free_bootmem(physbase, size); + free_bootmem(base, size); } /* reserve the sections we're already using */ for (i=0; i < lmb.reserved.cnt; i++) { - unsigned long physbase = lmb.reserved.region[i].physbase; + unsigned long base = lmb.reserved.region[i].base; unsigned long size = lmb.reserved.region[i].size; - reserve_bootmem(physbase, size); + reserve_bootmem(base, size); } } @@ -613,10 +610,10 @@ static int __init setup_kcore(void) int i; for (i=0; i < lmb.memory.cnt; i++) { - unsigned long physbase, size; + unsigned long base, size; struct kcore_list *kcore_mem; - physbase = lmb.memory.region[i].physbase; + base = lmb.memory.region[i].base; size = lmb.memory.region[i].size; /* GFP_ATOMIC to avoid might_sleep warnings during boot */ @@ -624,7 +621,7 @@ static int __init setup_kcore(void) if (!kcore_mem) panic("mem_init: kmalloc failed\n"); - kclist_add(kcore_mem, __va(physbase), size); + kclist_add(kcore_mem, __va(base), size); } kclist_add(&kcore_vmem, (void *)VMALLOC_START, VMALLOC_END-VMALLOC_START); Index: work/arch/ppc64/mm/hash_utils.c =================================================================== --- work.orig/arch/ppc64/mm/hash_utils.c +++ work/arch/ppc64/mm/hash_utils.c @@ -210,7 +210,7 @@ void __init htab_initialize(void) /* create bolted the linear mapping in the hash table */ for (i=0; i < lmb.memory.cnt; i++) { - base = lmb.memory.region[i].physbase + KERNELBASE; + base = lmb.memory.region[i].base + KERNELBASE; size = lmb.memory.region[i].size; DBG("creating mapping for region: %lx : %lx\n", base, size); Index: work/arch/ppc64/mm/numa.c =================================================================== --- work.orig/arch/ppc64/mm/numa.c +++ work/arch/ppc64/mm/numa.c @@ -671,7 +671,7 @@ new_range: * Mark reserved regions on this node */ for (i = 0; i < lmb.reserved.cnt; i++) { - unsigned long physbase = lmb.reserved.region[i].physbase; + unsigned long physbase = lmb.reserved.region[i].base; unsigned long size = lmb.reserved.region[i].size; if (pa_to_nid(physbase) != nid && From michael at ellerman.id.au Wed Aug 3 20:21:26 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Wed, 3 Aug 2005 20:21:26 +1000 (EST) Subject: [PATCH 10/10] ppc64: Remove CONFIG_MSCHUNKS In-Reply-To: <1123064479.417492.649639846705.qpatch@concordia> Message-ID: <20050803102126.0729967E9E@ozlabs.org> We can now remove CONFIG_MSCHUNKS as it doesn't do anything interesting anymore. The only macro in abs_addr.h which is called by non-iSeries code is phys_to_abs(), so remove the other dummy implementations, and we add a firmware feature check to phys_to_abs(). Signed-off-by: Michael Ellerman arch/ppc64/Kconfig | 6 ------ arch/ppc64/configs/iSeries_defconfig | 1 - include/asm-ppc64/abs_addr.h | 19 +++++-------------- 3 files changed, 5 insertions(+), 21 deletions(-) Index: work/arch/ppc64/Kconfig =================================================================== --- work.orig/arch/ppc64/Kconfig +++ work/arch/ppc64/Kconfig @@ -302,12 +302,6 @@ config GENERIC_HARDIRQS bool default y -config MSCHUNKS - bool - depends on PPC_ISERIES - default y - - config PPC_RTAS bool depends on PPC_PSERIES || PPC_BPA Index: work/include/asm-ppc64/abs_addr.h =================================================================== --- work.orig/include/asm-ppc64/abs_addr.h +++ work/include/asm-ppc64/abs_addr.h @@ -16,8 +16,7 @@ #include #include #include - -#ifdef CONFIG_MSCHUNKS +#include struct mschunks_map { unsigned long num_chunks; @@ -48,6 +47,10 @@ static inline unsigned long phys_to_abs( { unsigned long chunk; + /* This is a no-op on non-iSeries */ + if (!firmware_has_feature(FW_FEATURE_ISERIES)) + return pa; + chunk = addr_to_chunk(pa); if (chunk < mschunks_map.num_chunks) @@ -56,18 +59,6 @@ static inline unsigned long phys_to_abs( return chunk_to_addr(chunk) + (pa & MSCHUNKS_OFFSET_MASK); } -#else /* !CONFIG_MSCHUNKS */ - -#define chunk_to_addr(chunk) ((unsigned long)(chunk)) -#define addr_to_chunk(addr) (addr) -#define chunk_offset(addr) (0) -#define abs_chunk(pchunk) (pchunk) - -#define phys_to_abs(pa) (pa) -#define physRpn_to_absRpn(rpn) (rpn) - -#endif /* !CONFIG_MSCHUNKS */ - /* Convenience macros */ #define virt_to_abs(va) phys_to_abs(__pa(va)) #define abs_to_virt(aa) __va(aa) Index: work/arch/ppc64/configs/iSeries_defconfig =================================================================== --- work.orig/arch/ppc64/configs/iSeries_defconfig +++ work/arch/ppc64/configs/iSeries_defconfig @@ -99,7 +99,6 @@ CONFIG_HZ_100=y # CONFIG_HZ_1000 is not set CONFIG_HZ=100 CONFIG_GENERIC_HARDIRQS=y -CONFIG_MSCHUNKS=y CONFIG_LPARCFG=y CONFIG_SECCOMP=y CONFIG_ISA_DMA_API=y From benh at kernel.crashing.org Wed Aug 3 21:51:33 2005 From: benh at kernel.crashing.org (Benjamin Herrenschmidt) Date: Wed, 03 Aug 2005 13:51:33 +0200 Subject: Fan control for new PowerMac G5 2.7GHz machines? In-Reply-To: <20050802051804.29854.qmail@electricrain.com> References: <20050802051804.29854.qmail@electricrain.com> Message-ID: <1123069894.30257.39.camel@gaston> > > Can anyone shed some light on the fan support for these new machines? > Am I just doing something simple wrong or missing something obvious? I though it was "just working" but maybe I'm wrong ... Have you tried a 2.6.12 upstream kernel ? Ben. From geoffrey.levand at am.sony.com Thu Aug 4 02:09:59 2005 From: geoffrey.levand at am.sony.com (Geoff Levand) Date: Wed, 03 Aug 2005 09:09:59 -0700 Subject: Fan control for new PowerMac G5 2.7GHz machines? In-Reply-To: <1123069894.30257.39.camel@gaston> References: <1123069894.30257.39.camel@gaston> Message-ID: <42F0EC57.9010503@am.sony.com> Benjamin Herrenschmidt wrote: >>Can anyone shed some light on the fan support for these new machines? >>Am I just doing something simple wrong or missing something obvious? > > > I though it was "just working" but maybe I'm wrong ... Have you tried a > 2.6.12 upstream kernel ? > > Ben. It doesn't work for me with 2.6.12.3. Any clue as to what's wrong? -Geoff From jdl at freescale.com Thu Aug 4 05:01:45 2005 From: jdl at freescale.com (Jon Loeliger) Date: Wed, 03 Aug 2005 14:01:45 -0500 Subject: [PATCH 0/10] Cleanup iSeries msChunks handling, and lmb code. In-Reply-To: <1123064479.417492.649639846705.qpatch@concordia> References: <1123064479.417492.649639846705.qpatch@concordia> Message-ID: <1123095705.8638.14.camel@cashmere.sps.mot.com> On Wed, 2005-08-03 at 05:21, Michael Ellerman wrote: > This series of patches cleans up the iSeries msChunks structure, and > associated macros and functions. > > It also removes CONFIG_MSCHUNKS from the lmb code, and eventually removes > CONFIG_MSCHUNKS entirely. > > The final patch rely's on Stephen's FW_FEATURE_ISERIES patches. > > Booted on Power3, G5, Power5 LPAR and iSeries. Excellent. This patch, especially the LMB simplification and removal of the physbase bits, greatly simplifies the notion of merging LMB form 64 land and the mem_pieces. I have previously submitted patches against the ppc32 code that enhance the mem_pieces towards the LMB structure as well. Given an eventual merger of the two bodies of code, I'd like to make the merger of these two structures more complete. I'll work towards that goal if that's a Good Idea. Advice here? Thanks, jdl From benh at kernel.crashing.org Thu Aug 4 05:58:00 2005 From: benh at kernel.crashing.org (Benjamin Herrenschmidt) Date: Wed, 03 Aug 2005 21:58:00 +0200 Subject: Fan control for new PowerMac G5 2.7GHz machines? In-Reply-To: <42F0EC57.9010503@am.sony.com> References: <1123069894.30257.39.camel@gaston> <42F0EC57.9010503@am.sony.com> Message-ID: <1123099081.30257.41.camel@gaston> On Wed, 2005-08-03 at 09:09 -0700, Geoff Levand wrote: > Benjamin Herrenschmidt wrote: > >>Can anyone shed some light on the fan support for these new machines? > >>Am I just doing something simple wrong or missing something obvious? > > > > > > I though it was "just working" but maybe I'm wrong ... Have you tried a > > 2.6.12 upstream kernel ? > > > > Ben. > > It doesn't work for me with 2.6.12.3. Any clue as to what's wrong? Not really. It's a PowerMac7,2 model ? (in /proc/cpuinfo) ? Can you maybe add some printk's around in the driver to see what's wrong ? Ben. From bdc at carlstrom.com Thu Aug 4 08:01:38 2005 From: bdc at carlstrom.com (Brian D. Carlstrom) Date: Wed, 3 Aug 2005 15:01:38 -0700 Subject: Fan control for new PowerMac G5 2.7GHz machines? In-Reply-To: <1123099081.30257.41.camel@gaston> References: <1123069894.30257.39.camel@gaston> <42F0EC57.9010503@am.sony.com> <1123099081.30257.41.camel@gaston> Message-ID: <17137.16066.91475.699906@zot.electricrain.com> Benjamin Herrenschmidt writes: > Not really. It's a PowerMac7,2 model ? (in /proc/cpuinfo) ? Can you > maybe add some printk's around in the driver to see what's wrong ? It reports PowerMac7,3: $ cat /proc/cpuinfo processor : 0 cpu : PPC970FX, altivec supported clock : 2700.000000MHz revision : 3.1 processor : 1 cpu : PPC970FX, altivec supported clock : 2700.000000MHz revision : 3.1 timebase : 33333333 machine : PowerMac7,3 motherboard : PowerMac7,3 MacRISC4 Power Macintosh detected as : 336 (PowerMac G5) pmac flags : 00000000 pmac-generation : NewWorld At the moment several people are working on the machine setting up services so I haven't been able to reboot to try the 2.6.12.3 linux-stable kernel yet. -bri From cfriesen at nortel.com Thu Aug 4 08:06:46 2005 From: cfriesen at nortel.com (Christopher Friesen) Date: Wed, 03 Aug 2005 16:06:46 -0600 Subject: Fan control for new PowerMac G5 2.7GHz machines? In-Reply-To: <17137.16066.91475.699906@zot.electricrain.com> References: <1123069894.30257.39.camel@gaston> <42F0EC57.9010503@am.sony.com> <1123099081.30257.41.camel@gaston> <17137.16066.91475.699906@zot.electricrain.com> Message-ID: <42F13FF6.8010701@nortel.com> Brian D. Carlstrom wrote: > Benjamin Herrenschmidt writes: > > Not really. It's a PowerMac7,2 model ? (in /proc/cpuinfo) ? Can you > > maybe add some printk's around in the driver to see what's wrong ? > > It reports PowerMac7,3: I think Ben must have made a mistake. My G5 that I've had for some time now also reports as 7,3, but it doesn't have the FX cpu revisions. processor : 0 cpu : PPC970, altivec supported clock : 2000.000000MHz revision : 2.2 processor : 1 cpu : PPC970, altivec supported clock : 2000.000000MHz revision : 2.2 timebase : 33333333 machine : PowerMac7,3 motherboard : PowerMac7,3 MacRISC4 Power Macintosh detected as : 336 (PowerMac G5) pmac flags : 00000000 pmac-generation : NewWorld Chris From geoffrey.levand at am.sony.com Thu Aug 4 08:19:47 2005 From: geoffrey.levand at am.sony.com (Geoff Levand) Date: Wed, 03 Aug 2005 15:19:47 -0700 Subject: Fan control for new PowerMac G5 2.7GHz machines? In-Reply-To: <1123099081.30257.41.camel@gaston> References: <1123099081.30257.41.camel@gaston> Message-ID: <42F14303.2000304@am.sony.com> Benjamin Herrenschmidt wrote: > On Wed, 2005-08-03 at 09:09 -0700, Geoff Levand wrote: > >>Benjamin Herrenschmidt wrote: >> >>>>Can anyone shed some light on the fan support for these new > > machines? > >>>>Am I just doing something simple wrong or missing something obvious? >>> >>> >>>I though it was "just working" but maybe I'm wrong ... Have you > > tried a > >>>2.6.12 upstream kernel ? >>> >>>Ben. >> >>It doesn't work for me with 2.6.12.3. Any clue as to what's wrong? > > > Not really. It's a PowerMac7,2 model ? (in /proc/cpuinfo) ? Can you > maybe add some printk's around in the driver to see what's wrong ? > Here's what it says... [geoff at g5 ~]$ cat /proc/cpuinfo processor : 0 cpu : PPC970FX, altivec supported clock : 2000.000000MHz revision : 3.0 processor : 1 cpu : PPC970FX, altivec supported clock : 2000.000000MHz revision : 3.0 timebase : 33333333 machine : PowerMac7,3 motherboard : PowerMac7,3 MacRISC4 Power Macintosh detected as : 336 (PowerMac G5) pmac flags : 00000000 pmac-generation : NewWorld This might be the problem, not sure how to fix though: i2c /dev entries driver /u3 at 0,f8000000/i2c at f8001000: Missing interrupt or address ! In therm_pm72_attach() it hits 'Found K2', but u3_0 and u3_1 are never set, so start_control_loops() is never called. I'll look at it more when I have some time. -Geoff From michael at ellerman.id.au Thu Aug 4 10:17:50 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Thu, 4 Aug 2005 10:17:50 +1000 Subject: [PATCH 0/10] Cleanup iSeries msChunks handling, and lmb code. In-Reply-To: <1123095705.8638.14.camel@cashmere.sps.mot.com> References: <1123064479.417492.649639846705.qpatch@concordia> <1123095705.8638.14.camel@cashmere.sps.mot.com> Message-ID: <200508041017.54208.michael@ellerman.id.au> On Thu, 4 Aug 2005 05:01, Jon Loeliger wrote: > On Wed, 2005-08-03 at 05:21, Michael Ellerman wrote: > > This series of patches cleans up the iSeries msChunks structure, and > > associated macros and functions. > > > > It also removes CONFIG_MSCHUNKS from the lmb code, and eventually removes > > CONFIG_MSCHUNKS entirely. > > > > The final patch rely's on Stephen's FW_FEATURE_ISERIES patches. > > > > Booted on Power3, G5, Power5 LPAR and iSeries. > > Excellent. This patch, especially the LMB simplification > and removal of the physbase bits, greatly simplifies the > notion of merging LMB form 64 land and the mem_pieces. Cool. I wasn't really thinking of 32 <-> 64 merging when I did the patches, but it's good to be heading in the right direction. > I have previously submitted patches against the ppc32 code > that enhance the mem_pieces towards the LMB structure as well. > > Given an eventual merger of the two bodies of code, I'd > like to make the merger of these two structures more complete. > I'll work towards that goal if that's a Good Idea. I don't know the ppc32 code (guess I'll need to soon), so I can't comment on specifics, but it sounds like a "Good Idea" to me. cheers -- Michael Ellerman IBM OzLabs email: michael:ellerman.id.au inmsg: mpe:jabber.org wwweb: http://michael.ellerman.id.au phone: +61 2 6212 1183 (tie line 70 21183) We do not inherit the earth from our ancestors, we borrow it from our children. - S.M.A.R.T Person -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20050804/635ba5e6/attachment.pgp From olof at lixom.net Thu Aug 4 11:30:10 2005 From: olof at lixom.net (Olof Johansson) Date: Wed, 3 Aug 2005 20:30:10 -0500 Subject: [PATCH] PPC64: Fix UP kernel build Message-ID: <20050804013010.GA10556@austin.ibm.com> Hi, CONFIG_KEXEC breaks UP builds because of a misspelled smp_release_cpus(). Also, the function isn't defined unless built with CONFIG_SMP but it is needed if we are to go from a UP to SMP kernel. Enable it and document it. Thanks to Steven Winiecki for reporting this and to Milton for remembering how it's supposed to work and why. -Olof Signed-off-by: Olof Johansson Index: 2.6/arch/ppc64/kernel/machine_kexec.c =================================================================== --- 2.6.orig/arch/ppc64/kernel/machine_kexec.c 2005-08-03 19:53:16.000000000 -0500 +++ 2.6/arch/ppc64/kernel/machine_kexec.c 2005-08-03 20:39:49.000000000 -0500 @@ -243,13 +243,17 @@ static void kexec_prepare_cpus(void) static void kexec_prepare_cpus(void) { + extern void smp_release_cpus(void); /* * move the secondarys to us so that we can copy * the new kernel 0-0x100 safely * * do this if kexec in setup.c ? + * + * We need to release the cpus if we are ever going from an + * UP to an SMP kernel. */ - smp_relase_cpus(); + smp_release_cpus(); if (ppc_md.cpu_irq_down) ppc_md.cpu_irq_down(); local_irq_disable(); Index: 2.6/arch/ppc64/kernel/head.S =================================================================== --- 2.6.orig/arch/ppc64/kernel/head.S 2005-08-03 19:53:16.000000000 -0500 +++ 2.6/arch/ppc64/kernel/head.S 2005-08-03 20:37:22.000000000 -0500 @@ -2071,7 +2071,7 @@ _GLOBAL(hmt_start_secondary) blr #endif -#if defined(CONFIG_SMP) && !defined(CONFIG_PPC_ISERIES) +#if defined(CONFIG_KEXEC) || (defined(CONFIG_SMP) && !defined(CONFIG_PPC_ISERIES)) _GLOBAL(smp_release_cpus) /* All secondary cpus are spinning on a common * spinloop, release them all now so they can start From david at gibson.dropbear.id.au Thu Aug 4 15:13:07 2005 From: david at gibson.dropbear.id.au (David Gibson) Date: Thu, 4 Aug 2005 15:13:07 +1000 Subject: [PATCH] Four level pagetables for ppc64 Message-ID: <20050804051307.GA27961@localhost.localdomain> Paul, Please forward upstream for -mm, and, after 2.6.13, mainline also. Implement 4-level pagetables for ppc64 This patch implements full four-level page tables for ppc64, thereby extending the usable user address range to 44 bits (16T). The patch uses a full page for the tables at the bottom and top level, and a quarter page for the intermediate levels. It uses full 64-bit pointers at every level, thus also increasing the addressable range of physical memory. This patch also tweaks the VSID allocation to allow matching range for user addresses (this halves the number of available contexts) and adds some #if and BUILD_BUG sanity checks. Signed-off-by: David Gibson arch/ppc64/mm/hash_utils.c | 2 arch/ppc64/mm/hugetlbpage.c | 187 +++++++++++++----------------------------- arch/ppc64/mm/imalloc.c | 2 arch/ppc64/mm/init.c | 62 +++++++++---- arch/ppc64/mm/slb_low.S | 2 arch/ppc64/mm/tlb.c | 95 ++++++++++++--------- include/asm-ppc64/imalloc.h | 2 include/asm-ppc64/mmu.h | 7 - include/asm-ppc64/page.h | 26 +++-- include/asm-ppc64/pgalloc.h | 90 +++++++++++++------- include/asm-ppc64/pgtable.h | 81 +++++++++++------- include/asm-ppc64/processor.h | 4 12 files changed, 291 insertions(+), 269 deletions(-) Index: working-2.6/include/asm-ppc64/pgtable.h =================================================================== --- working-2.6.orig/include/asm-ppc64/pgtable.h 2005-08-04 13:22:21.000000000 +1000 +++ working-2.6/include/asm-ppc64/pgtable.h 2005-08-04 13:22:22.000000000 +1000 @@ -15,19 +15,24 @@ #include #endif /* __ASSEMBLY__ */ -#include - /* * Entries per page directory level. The PTE level must use a 64b record * for each page table entry. The PMD and PGD level use a 32b record for * each entry by assuming that each entry is page aligned. */ #define PTE_INDEX_SIZE 9 -#define PMD_INDEX_SIZE 10 -#define PGD_INDEX_SIZE 10 +#define PMD_INDEX_SIZE 7 +#define PUD_INDEX_SIZE 7 +#define PGD_INDEX_SIZE 9 + +#define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_INDEX_SIZE) +#define PMD_TABLE_SIZE (sizeof(pmd_t) << PMD_INDEX_SIZE) +#define PUD_TABLE_SIZE (sizeof(pud_t) << PUD_INDEX_SIZE) +#define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE) #define PTRS_PER_PTE (1 << PTE_INDEX_SIZE) #define PTRS_PER_PMD (1 << PMD_INDEX_SIZE) +#define PTRS_PER_PUD (1 << PMD_INDEX_SIZE) #define PTRS_PER_PGD (1 << PGD_INDEX_SIZE) /* PMD_SHIFT determines what a second-level page table entry can map */ @@ -35,8 +40,13 @@ #define PMD_SIZE (1UL << PMD_SHIFT) #define PMD_MASK (~(PMD_SIZE-1)) -/* PGDIR_SHIFT determines what a third-level page table entry can map */ -#define PGDIR_SHIFT (PMD_SHIFT + PMD_INDEX_SIZE) +/* PUD_SHIFT determines what a third-level page table entry can map */ +#define PUD_SHIFT (PMD_SHIFT + PMD_INDEX_SIZE) +#define PUD_SIZE (1UL << PUD_SHIFT) +#define PUD_MASK (~(PUD_SIZE-1)) + +/* PGDIR_SHIFT determines what a fourth-level page table entry can map */ +#define PGDIR_SHIFT (PUD_SHIFT + PUD_INDEX_SIZE) #define PGDIR_SIZE (1UL << PGDIR_SHIFT) #define PGDIR_MASK (~(PGDIR_SIZE-1)) @@ -45,15 +55,23 @@ /* * Size of EA range mapped by our pagetables. */ -#define EADDR_SIZE (PTE_INDEX_SIZE + PMD_INDEX_SIZE + \ - PGD_INDEX_SIZE + PAGE_SHIFT) -#define EADDR_MASK ((1UL << EADDR_SIZE) - 1) +#define PGTABLE_EADDR_SIZE (PTE_INDEX_SIZE + PMD_INDEX_SIZE + \ + PUD_INDEX_SIZE + PGD_INDEX_SIZE + PAGE_SHIFT) +#define PGTABLE_RANGE (1UL << PGTABLE_EADDR_SIZE) + +#if TASK_SIZE_USER64 > PGTABLE_RANGE +#error TASK_SIZE_USER64 exceeds pagetable range +#endif + +#if TASK_SIZE_USER64 > (1UL << (USER_ESID_BITS + SID_SHIFT)) +#error TASK_SIZE_USER64 exceeds user VSID range +#endif /* * Define the address range of the vmalloc VM area. */ #define VMALLOC_START (0xD000000000000000ul) -#define VMALLOC_SIZE (0x10000000000UL) +#define VMALLOC_SIZE (0x80000000000UL) #define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE) /* @@ -154,8 +172,6 @@ #ifndef __ASSEMBLY__ int hash_huge_page(struct mm_struct *mm, unsigned long access, unsigned long ea, unsigned long vsid, int local); - -void hugetlb_mm_free_pgd(struct mm_struct *mm); #endif /* __ASSEMBLY__ */ #define HAVE_ARCH_UNMAPPED_AREA @@ -163,7 +179,6 @@ #else #define hash_huge_page(mm,a,ea,vsid,local) -1 -#define hugetlb_mm_free_pgd(mm) do {} while (0) #endif @@ -197,39 +212,45 @@ #define pte_pfn(x) ((unsigned long)((pte_val(x) >> PTE_SHIFT))) #define pte_page(x) pfn_to_page(pte_pfn(x)) -#define pmd_set(pmdp, ptep) \ - (pmd_val(*(pmdp)) = __ba_to_bpn(ptep)) +#define pmd_set(pmdp, ptep) (pmd_val(*(pmdp)) = (unsigned long)(ptep)) #define pmd_none(pmd) (!pmd_val(pmd)) #define pmd_bad(pmd) (pmd_val(pmd) == 0) #define pmd_present(pmd) (pmd_val(pmd) != 0) #define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0) -#define pmd_page_kernel(pmd) (__bpn_to_ba(pmd_val(pmd))) +#define pmd_page_kernel(pmd) (pmd_val(pmd)) #define pmd_page(pmd) virt_to_page(pmd_page_kernel(pmd)) -#define pud_set(pudp, pmdp) (pud_val(*(pudp)) = (__ba_to_bpn(pmdp))) +#define pud_set(pudp, pmdp) (pud_val(*(pudp)) = (unsigned long)(pmdp)) #define pud_none(pud) (!pud_val(pud)) -#define pud_bad(pud) ((pud_val(pud)) == 0UL) -#define pud_present(pud) (pud_val(pud) != 0UL) -#define pud_clear(pudp) (pud_val(*(pudp)) = 0UL) -#define pud_page(pud) (__bpn_to_ba(pud_val(pud))) +#define pud_bad(pud) ((pud_val(pud)) == 0) +#define pud_present(pud) (pud_val(pud) != 0) +#define pud_clear(pudp) (pud_val(*(pudp)) = 0) +#define pud_page(pud) (pud_val(pud)) + +#define pgd_set(pgdp, pudp) ({pgd_val(*(pgdp)) = (unsigned long)(pudp);}) +#define pgd_none(pgd) (!pgd_val(pgd)) +#define pgd_bad(pgd) (pgd_val(pgd) == 0) +#define pgd_present(pgd) (pgd_val(pgd) != 0) +#define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0) +#define pgd_page(pgd) (pgd_val(pgd)) /* * Find an entry in a page-table-directory. We combine the address region * (the high order N bits) and the pgd portion of the address. */ /* to avoid overflow in free_pgtables we don't use PTRS_PER_PGD here */ -#define pgd_index(address) (((address) >> (PGDIR_SHIFT)) & 0x7ff) +#define pgd_index(address) (((address) >> (PGDIR_SHIFT)) & 0x1ff) #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) -/* Find an entry in the second-level page table.. */ +#define pud_offset(pgdp, addr) \ + (((pud_t *) pgd_page(*(pgdp))) + (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))) + #define pmd_offset(pudp,addr) \ - ((pmd_t *) pud_page(*(pudp)) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) + (((pmd_t *) pud_page(*(pudp))) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) -/* Find an entry in the third-level page table.. */ #define pte_offset_kernel(dir,addr) \ - ((pte_t *) pmd_page_kernel(*(dir)) \ - + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) + (((pte_t *) pmd_page_kernel(*(dir))) + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) #define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr)) #define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir), (addr)) @@ -458,9 +479,11 @@ #define pte_same(A,B) (((pte_val(A) ^ pte_val(B)) & ~_PAGE_HPTEFLAGS) == 0) #define pmd_ERROR(e) \ - printk("%s:%d: bad pmd %08x.\n", __FILE__, __LINE__, pmd_val(e)) + printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e)) +#define pud_ERROR(e) \ + printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pud_val(e)) #define pgd_ERROR(e) \ - printk("%s:%d: bad pgd %08x.\n", __FILE__, __LINE__, pgd_val(e)) + printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) extern pgd_t swapper_pg_dir[]; Index: working-2.6/include/asm-ppc64/page.h =================================================================== --- working-2.6.orig/include/asm-ppc64/page.h 2005-08-04 13:22:21.000000000 +1000 +++ working-2.6/include/asm-ppc64/page.h 2005-08-04 13:22:22.000000000 +1000 @@ -46,6 +46,7 @@ #define ARCH_HAS_HUGEPAGE_ONLY_RANGE #define ARCH_HAS_PREPARE_HUGEPAGE_RANGE +#define ARCH_HAS_SETCLEAR_HUGE_PTE #define touches_hugepage_low_range(mm, addr, len) \ (LOW_ESID_MASK((addr), (len)) & mm->context.htlb_segs) @@ -125,36 +126,42 @@ * Entries in the pte table are 64b, while entries in the pgd & pmd are 32b. */ typedef struct { unsigned long pte; } pte_t; -typedef struct { unsigned int pmd; } pmd_t; -typedef struct { unsigned int pgd; } pgd_t; +typedef struct { unsigned long pmd; } pmd_t; +typedef struct { unsigned long pud; } pud_t; +typedef struct { unsigned long pgd; } pgd_t; typedef struct { unsigned long pgprot; } pgprot_t; #define pte_val(x) ((x).pte) #define pmd_val(x) ((x).pmd) +#define pud_val(x) ((x).pud) #define pgd_val(x) ((x).pgd) #define pgprot_val(x) ((x).pgprot) -#define __pte(x) ((pte_t) { (x) } ) -#define __pmd(x) ((pmd_t) { (x) } ) -#define __pgd(x) ((pgd_t) { (x) } ) -#define __pgprot(x) ((pgprot_t) { (x) } ) +#define __pte(x) ((pte_t) { (x) }) +#define __pmd(x) ((pmd_t) { (x) }) +#define __pud(x) ((pud_t) { (x) }) +#define __pgd(x) ((pgd_t) { (x) }) +#define __pgprot(x) ((pgprot_t) { (x) }) #else /* * .. while these make it easier on the compiler */ typedef unsigned long pte_t; -typedef unsigned int pmd_t; -typedef unsigned int pgd_t; +typedef unsigned long pmd_t; +typedef unsigned long pud_t; +typedef unsigned long pgd_t; typedef unsigned long pgprot_t; #define pte_val(x) (x) #define pmd_val(x) (x) +#define pud_val(x) (x) #define pgd_val(x) (x) #define pgprot_val(x) (x) #define __pte(x) (x) #define __pmd(x) (x) +#define __pud(x) (x) #define __pgd(x) (x) #define __pgprot(x) (x) @@ -208,9 +215,6 @@ #define USER_REGION_ID (0UL) #define REGION_ID(ea) (((unsigned long)(ea)) >> REGION_SHIFT) -#define __bpn_to_ba(x) ((((unsigned long)(x)) << PAGE_SHIFT) + KERNELBASE) -#define __ba_to_bpn(x) ((((unsigned long)(x)) & ~REGION_MASK) >> PAGE_SHIFT) - #define __va(x) ((void *)((unsigned long)(x) + KERNELBASE)) #ifdef CONFIG_DISCONTIGMEM Index: working-2.6/include/asm-ppc64/pgalloc.h =================================================================== --- working-2.6.orig/include/asm-ppc64/pgalloc.h 2005-08-04 13:22:21.000000000 +1000 +++ working-2.6/include/asm-ppc64/pgalloc.h 2005-08-04 13:22:36.000000000 +1000 @@ -6,7 +6,12 @@ #include #include -extern kmem_cache_t *zero_cache; +extern kmem_cache_t *pgtable_cache[]; + +#define PTE_CACHE_NUM 0 +#define PMD_CACHE_NUM 1 +#define PUD_CACHE_NUM 1 +#define PGD_CACHE_NUM 0 /* * This program is free software; you can redistribute it and/or @@ -15,30 +20,40 @@ * 2 of the License, or (at your option) any later version. */ -static inline pgd_t * -pgd_alloc(struct mm_struct *mm) +static inline pgd_t *pgd_alloc(struct mm_struct *mm) { - return kmem_cache_alloc(zero_cache, GFP_KERNEL); + return kmem_cache_alloc(pgtable_cache[PGD_CACHE_NUM], GFP_KERNEL); } -static inline void -pgd_free(pgd_t *pgd) +static inline void pgd_free(pgd_t *pgd) { - kmem_cache_free(zero_cache, pgd); + kmem_cache_free(pgtable_cache[PGD_CACHE_NUM], pgd); +} + +#define pgd_populate(MM, PGD, PUD) pgd_set(PGD, PUD) + +static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr) +{ + return kmem_cache_alloc(pgtable_cache[PUD_CACHE_NUM], + GFP_KERNEL|__GFP_REPEAT); +} + +static inline void pud_free(pud_t *pud) +{ + kmem_cache_free(pgtable_cache[PUD_CACHE_NUM], pud); } #define pud_populate(MM, PUD, PMD) pud_set(PUD, PMD) -static inline pmd_t * -pmd_alloc_one(struct mm_struct *mm, unsigned long addr) +static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) { - return kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT); + return kmem_cache_alloc(pgtable_cache[PMD_CACHE_NUM], + GFP_KERNEL|__GFP_REPEAT); } -static inline void -pmd_free(pmd_t *pmd) +static inline void pmd_free(pmd_t *pmd) { - kmem_cache_free(zero_cache, pmd); + kmem_cache_free(pgtable_cache[PMD_CACHE_NUM], pmd); } #define pmd_populate_kernel(mm, pmd, pte) pmd_set(pmd, pte) @@ -47,44 +62,55 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) { - return kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT); + return kmem_cache_alloc(pgtable_cache[PTE_CACHE_NUM], + GFP_KERNEL|__GFP_REPEAT); } static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) { - pte_t *pte = kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT); - if (pte) - return virt_to_page(pte); - return NULL; + return virt_to_page(pte_alloc_one_kernel(mm, address)); } static inline void pte_free_kernel(pte_t *pte) { - kmem_cache_free(zero_cache, pte); + kmem_cache_free(pgtable_cache[PTE_CACHE_NUM], pte); } static inline void pte_free(struct page *ptepage) { - kmem_cache_free(zero_cache, page_address(ptepage)); + pte_free_kernel(page_address(ptepage)); } -struct pte_freelist_batch +#define PGF_CACHENUM_MASK 0xf + +typedef struct pgtable_free { + unsigned long val; +} pgtable_free_t; + +static inline pgtable_free_t pgtable_free_cache(void *p, int cachenum) { - struct rcu_head rcu; - unsigned int index; - struct page * pages[0]; -}; + BUG_ON((unsigned long)p & PGF_CACHENUM_MASK); + BUG_ON(cachenum & ~PGF_CACHENUM_MASK); + return (pgtable_free_t){.val = ((unsigned long) p) | cachenum}; +} -#define PTE_FREELIST_SIZE ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) / \ - sizeof(struct page *)) +static inline void pgtable_free(pgtable_free_t pgf) +{ + void *p = (void *)(pgf.val & ~PGF_CACHENUM_MASK); + int cachenum = pgf.val & PGF_CACHENUM_MASK; -extern void pte_free_now(struct page *ptepage); -extern void pte_free_submit(struct pte_freelist_batch *batch); + kmem_cache_free(pgtable_cache[cachenum], p); +} -DECLARE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur); +void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf); -void __pte_free_tlb(struct mmu_gather *tlb, struct page *ptepage); -#define __pmd_free_tlb(tlb, pmd) __pte_free_tlb(tlb, virt_to_page(pmd)) +#define __pte_free_tlb(tlb, ptepage) \ + pgtable_free_tlb(tlb, pgtable_free_cache(page_address(ptepage), \ + PTE_CACHE_NUM)) +#define __pmd_free_tlb(tlb, pmd) \ + pgtable_free_tlb(tlb, pgtable_free_cache(pmd, PMD_CACHE_NUM)) +#define __pud_free_tlb(tlb, pmd) \ + pgtable_free_tlb(tlb, pgtable_free_cache(pud, PUD_CACHE_NUM )) #define check_pgt_cache() do { } while (0) Index: working-2.6/arch/ppc64/mm/init.c =================================================================== --- working-2.6.orig/arch/ppc64/mm/init.c 2005-08-04 13:22:21.000000000 +1000 +++ working-2.6/arch/ppc64/mm/init.c 2005-08-04 13:22:36.000000000 +1000 @@ -66,6 +66,14 @@ #include #include +#if PGTABLE_RANGE > USER_VSID_RANGE +#warning Limited user VSID range means pagetable space is wasted +#endif + +#if (TASK_SIZE_USER64 < PGTABLE_RANGE) && (TASK_SIZE_USER64 < USER_VSID_RANGE) +#warning TASK_SIZE is smaller than it needs to be. +#endif + int mem_init_done; unsigned long ioremap_bot = IMALLOC_BASE; static unsigned long phbs_io_bot = PHBS_IO_BASE; @@ -226,7 +234,7 @@ * Before that, we map using addresses going * up from ioremap_bot. imalloc will use * the addresses from ioremap_bot through - * IMALLOC_END (0xE000001fffffffff) + * IMALLOC_END * */ pa = addr & PAGE_MASK; @@ -417,12 +425,6 @@ int index; int err; -#ifdef CONFIG_HUGETLB_PAGE - /* We leave htlb_segs as it was, but for a fork, we need to - * clear the huge_pgdir. */ - mm->context.huge_pgdir = NULL; -#endif - again: if (!idr_pre_get(&mmu_context_idr, GFP_KERNEL)) return -ENOMEM; @@ -453,8 +455,6 @@ spin_unlock(&mmu_context_lock); mm->context.id = NO_CONTEXT; - - hugetlb_mm_free_pgd(mm); } /* @@ -833,23 +833,43 @@ return virt_addr; } -kmem_cache_t *zero_cache; - -static void zero_ctor(void *pte, kmem_cache_t *cache, unsigned long flags) +static void zero_ctor(void *addr, kmem_cache_t *cache, unsigned long flags) { - memset(pte, 0, PAGE_SIZE); + memset(addr, 0, kmem_cache_size(cache)); } +static const int pgtable_cache_size[2] = { + PTE_TABLE_SIZE, PMD_TABLE_SIZE +}; +static const char *pgtable_cache_name[ARRAY_SIZE(pgtable_cache_size)] = { + "pgd_pte_cache", "pud_pmd_cache", +}; + +kmem_cache_t *pgtable_cache[ARRAY_SIZE(pgtable_cache_size)]; + void pgtable_cache_init(void) { - zero_cache = kmem_cache_create("zero", - PAGE_SIZE, - 0, - SLAB_HWCACHE_ALIGN | SLAB_MUST_HWCACHE_ALIGN, - zero_ctor, - NULL); - if (!zero_cache) - panic("pgtable_cache_init(): could not create zero_cache!\n"); + int i; + + BUILD_BUG_ON(PTE_TABLE_SIZE != pgtable_cache_size[PTE_CACHE_NUM]); + BUILD_BUG_ON(PMD_TABLE_SIZE != pgtable_cache_size[PMD_CACHE_NUM]); + BUILD_BUG_ON(PUD_TABLE_SIZE != pgtable_cache_size[PUD_CACHE_NUM]); + BUILD_BUG_ON(PGD_TABLE_SIZE != pgtable_cache_size[PGD_CACHE_NUM]); + + for (i = 0; i < ARRAY_SIZE(pgtable_cache_size); i++) { + int size = pgtable_cache_size[i]; + const char *name = pgtable_cache_name[i]; + + pgtable_cache[i] = kmem_cache_create(name, + size, size, + SLAB_HWCACHE_ALIGN + | SLAB_MUST_HWCACHE_ALIGN, + zero_ctor, + NULL); + if (! pgtable_cache[i]) + panic("pgtable_cache_init(): could not create %s!\n", + name); + } } pgprot_t phys_mem_access_prot(struct file *file, unsigned long addr, Index: working-2.6/include/asm-ppc64/processor.h =================================================================== --- working-2.6.orig/include/asm-ppc64/processor.h 2005-08-04 13:22:21.000000000 +1000 +++ working-2.6/include/asm-ppc64/processor.h 2005-08-04 13:22:22.000000000 +1000 @@ -382,8 +382,8 @@ extern struct task_struct *last_task_used_math; extern struct task_struct *last_task_used_altivec; -/* 64-bit user address space is 41-bits (2TBs user VM) */ -#define TASK_SIZE_USER64 (0x0000020000000000UL) +/* 64-bit user address space is 44-bits (16TB user VM) */ +#define TASK_SIZE_USER64 (0x0000100000000000UL) /* * 32-bit user address space is 4GB - 1 page Index: working-2.6/arch/ppc64/mm/imalloc.c =================================================================== --- working-2.6.orig/arch/ppc64/mm/imalloc.c 2005-08-04 13:22:21.000000000 +1000 +++ working-2.6/arch/ppc64/mm/imalloc.c 2005-08-04 13:22:22.000000000 +1000 @@ -31,7 +31,7 @@ break; if ((unsigned long)tmp->addr >= ioremap_bot) addr = tmp->size + (unsigned long) tmp->addr; - if (addr > IMALLOC_END-size) + if (addr >= IMALLOC_END-size) return 1; } *im_addr = addr; Index: working-2.6/arch/ppc64/mm/hash_utils.c =================================================================== --- working-2.6.orig/arch/ppc64/mm/hash_utils.c 2005-08-04 13:22:21.000000000 +1000 +++ working-2.6/arch/ppc64/mm/hash_utils.c 2005-08-04 13:22:22.000000000 +1000 @@ -302,7 +302,7 @@ int local = 0; cpumask_t tmp; - if ((ea & ~REGION_MASK) > EADDR_MASK) + if ((ea & ~REGION_MASK) >= PGTABLE_RANGE) return 1; switch (REGION_ID(ea)) { Index: working-2.6/include/asm-ppc64/mmu.h =================================================================== --- working-2.6.orig/include/asm-ppc64/mmu.h 2005-08-04 13:22:21.000000000 +1000 +++ working-2.6/include/asm-ppc64/mmu.h 2005-08-04 13:22:22.000000000 +1000 @@ -259,8 +259,10 @@ #define VSID_BITS 36 #define VSID_MODULUS ((1UL<index; i++) + pgtable_free(batch->tables[i]); + + free_page((unsigned long)batch); +} + +static void pte_free_submit(struct pte_freelist_batch *batch) +{ + INIT_RCU_HEAD(&batch->rcu); + call_rcu(&batch->rcu, pte_free_rcu_callback); +} + +void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf) { /* This is safe as we are holding page_table_lock */ cpumask_t local_cpumask = cpumask_of_cpu(smp_processor_id()); @@ -49,19 +100,19 @@ if (atomic_read(&tlb->mm->mm_users) < 2 || cpus_equal(tlb->mm->cpu_vm_mask, local_cpumask)) { - pte_free(ptepage); + pgtable_free(pgf); return; } if (*batchp == NULL) { *batchp = (struct pte_freelist_batch *)__get_free_page(GFP_ATOMIC); if (*batchp == NULL) { - pte_free_now(ptepage); + pgtable_free_now(pgf); return; } (*batchp)->index = 0; } - (*batchp)->pages[(*batchp)->index++] = ptepage; + (*batchp)->tables[(*batchp)->index++] = pgf; if ((*batchp)->index == PTE_FREELIST_SIZE) { pte_free_submit(*batchp); *batchp = NULL; @@ -132,42 +183,6 @@ put_cpu(); } -#ifdef CONFIG_SMP -static void pte_free_smp_sync(void *arg) -{ - /* Do nothing, just ensure we sync with all CPUs */ -} -#endif - -/* This is only called when we are critically out of memory - * (and fail to get a page in pte_free_tlb). - */ -void pte_free_now(struct page *ptepage) -{ - pte_freelist_forced_free++; - - smp_call_function(pte_free_smp_sync, NULL, 0, 1); - - pte_free(ptepage); -} - -static void pte_free_rcu_callback(struct rcu_head *head) -{ - struct pte_freelist_batch *batch = - container_of(head, struct pte_freelist_batch, rcu); - unsigned int i; - - for (i = 0; i < batch->index; i++) - pte_free(batch->pages[i]); - free_page((unsigned long)batch); -} - -void pte_free_submit(struct pte_freelist_batch *batch) -{ - INIT_RCU_HEAD(&batch->rcu); - call_rcu(&batch->rcu, pte_free_rcu_callback); -} - void pte_free_finish(void) { /* This is safe as we are holding page_table_lock */ Index: working-2.6/arch/ppc64/mm/hugetlbpage.c =================================================================== --- working-2.6.orig/arch/ppc64/mm/hugetlbpage.c 2005-08-04 13:22:21.000000000 +1000 +++ working-2.6/arch/ppc64/mm/hugetlbpage.c 2005-08-04 13:22:22.000000000 +1000 @@ -27,124 +27,93 @@ #include -#define HUGEPGDIR_SHIFT (HPAGE_SHIFT + PAGE_SHIFT - 3) -#define HUGEPGDIR_SIZE (1UL << HUGEPGDIR_SHIFT) -#define HUGEPGDIR_MASK (~(HUGEPGDIR_SIZE-1)) - -#define HUGEPTE_INDEX_SIZE 9 -#define HUGEPGD_INDEX_SIZE 10 - -#define PTRS_PER_HUGEPTE (1 << HUGEPTE_INDEX_SIZE) -#define PTRS_PER_HUGEPGD (1 << HUGEPGD_INDEX_SIZE) - -static inline int hugepgd_index(unsigned long addr) +/* Modelled after find_linux_pte() */ +pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) { - return (addr & ~REGION_MASK) >> HUGEPGDIR_SHIFT; -} + pgd_t *pg; + pud_t *pu; + pmd_t *pm; + pte_t *pt; -static pud_t *hugepgd_offset(struct mm_struct *mm, unsigned long addr) -{ - int index; + BUG_ON(! in_hugepage_area(mm->context, addr)); - if (! mm->context.huge_pgdir) - return NULL; + addr &= HPAGE_MASK; + pg = pgd_offset(mm, addr); + if (!pgd_none(*pg)) { + pu = pud_offset(pg, addr); + if (!pud_none(*pu)) { + pm = pmd_offset(pu, addr); + pt = (pte_t *)pm; + BUG_ON(!pmd_none(*pm) + && !(pte_present(*pt) && pte_huge(*pt))); + return pt; + } + } - index = hugepgd_index(addr); - BUG_ON(index >= PTRS_PER_HUGEPGD); - return (pud_t *)(mm->context.huge_pgdir + index); + return NULL; } -static inline pte_t *hugepte_offset(pud_t *dir, unsigned long addr) +pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr) { - int index; - - if (pud_none(*dir)) - return NULL; - - index = (addr >> HPAGE_SHIFT) % PTRS_PER_HUGEPTE; - return (pte_t *)pud_page(*dir) + index; -} + pgd_t *pg; + pud_t *pu; + pmd_t *pm; + pte_t *pt; -static pud_t *hugepgd_alloc(struct mm_struct *mm, unsigned long addr) -{ BUG_ON(! in_hugepage_area(mm->context, addr)); - if (! mm->context.huge_pgdir) { - pgd_t *new; - spin_unlock(&mm->page_table_lock); - /* Don't use pgd_alloc(), because we want __GFP_REPEAT */ - new = kmem_cache_alloc(zero_cache, GFP_KERNEL | __GFP_REPEAT); - BUG_ON(memcmp(new, empty_zero_page, PAGE_SIZE)); - spin_lock(&mm->page_table_lock); - - /* - * Because we dropped the lock, we should re-check the - * entry, as somebody else could have populated it.. - */ - if (mm->context.huge_pgdir) - pgd_free(new); - else - mm->context.huge_pgdir = new; - } - return hugepgd_offset(mm, addr); -} - -static pte_t *hugepte_alloc(struct mm_struct *mm, pud_t *dir, unsigned long addr) -{ - if (! pud_present(*dir)) { - pte_t *new; + addr &= HPAGE_MASK; - spin_unlock(&mm->page_table_lock); - new = kmem_cache_alloc(zero_cache, GFP_KERNEL | __GFP_REPEAT); - BUG_ON(memcmp(new, empty_zero_page, PAGE_SIZE)); - spin_lock(&mm->page_table_lock); - /* - * Because we dropped the lock, we should re-check the - * entry, as somebody else could have populated it.. - */ - if (pud_present(*dir)) { - if (new) - kmem_cache_free(zero_cache, new); - } else { - struct page *ptepage; + pg = pgd_offset(mm, addr); + pu = pud_alloc(mm, pg, addr); - if (! new) - return NULL; - ptepage = virt_to_page(new); - ptepage->mapping = (void *) mm; - ptepage->index = addr & HUGEPGDIR_MASK; - pud_populate(mm, dir, new); + if (pu) { + pm = pmd_alloc(mm, pu, addr); + if (pm) { + pt = (pte_t *)pm; + BUG_ON(!pmd_none(*pm) + && !(pte_present(*pt) && pte_huge(*pt))); + return pt; } } - return hugepte_offset(dir, addr); + return NULL; } -pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) -{ - pud_t *pud; +#define HUGEPTE_BATCH_SIZE (HPAGE_SIZE / PMD_SIZE) - BUG_ON(! in_hugepage_area(mm->context, addr)); +void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, + pte_t *ptep, pte_t pte) +{ + int i; - pud = hugepgd_offset(mm, addr); - if (! pud) - return NULL; + if (pte_present(*ptep)) { + pte_clear(mm, addr, ptep); + flush_tlb_pending(); + } - return hugepte_offset(pud, addr); + for (i = 0; i < HUGEPTE_BATCH_SIZE; i++) { + *ptep = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS); + ptep++; + } } -pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr) +pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, + pte_t *ptep) { - pud_t *pud; + unsigned long old = pte_update(ptep, ~0UL); + int i; - BUG_ON(! in_hugepage_area(mm->context, addr)); + if (old & _PAGE_HASHPTE) + hpte_update(mm, addr, old, 0); - pud = hugepgd_alloc(mm, addr); - if (! pud) - return NULL; + for (i = 1; i < HUGEPTE_BATCH_SIZE; i++) { + *ptep = __pte(0); + ptep++; + } - return hugepte_alloc(mm, pud, addr); + return __pte(old); } /* @@ -541,42 +510,6 @@ } } -void hugetlb_mm_free_pgd(struct mm_struct *mm) -{ - int i; - pgd_t *pgdir; - - spin_lock(&mm->page_table_lock); - - pgdir = mm->context.huge_pgdir; - if (! pgdir) - goto out; - - mm->context.huge_pgdir = NULL; - - /* cleanup any hugepte pages leftover */ - for (i = 0; i < PTRS_PER_HUGEPGD; i++) { - pud_t *pud = (pud_t *)(pgdir + i); - - if (! pud_none(*pud)) { - pte_t *pte = (pte_t *)pud_page(*pud); - struct page *ptepage = virt_to_page(pte); - - ptepage->mapping = NULL; - - BUG_ON(memcmp(pte, empty_zero_page, PAGE_SIZE)); - kmem_cache_free(zero_cache, pte); - } - pud_clear(pud); - } - - BUG_ON(memcmp(pgdir, empty_zero_page, PAGE_SIZE)); - kmem_cache_free(zero_cache, pgdir); - - out: - spin_unlock(&mm->page_table_lock); -} - int hash_huge_page(struct mm_struct *mm, unsigned long access, unsigned long ea, unsigned long vsid, int local) { Index: working-2.6/arch/ppc64/mm/slb_low.S =================================================================== --- working-2.6.orig/arch/ppc64/mm/slb_low.S 2005-08-04 13:22:21.000000000 +1000 +++ working-2.6/arch/ppc64/mm/slb_low.S 2005-08-04 13:22:22.000000000 +1000 @@ -91,7 +91,7 @@ 0: /* user address: proto-VSID = context<<15 | ESID */ li r11,SLB_VSID_USER - srdi. r9,r3,13 + srdi. r9,r3,USER_ESID_BITS bne- 8f /* invalid ea bits set */ #ifdef CONFIG_HUGETLB_PAGE -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/people/dgibson From michael at ellerman.id.au Thu Aug 4 17:14:56 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Thu, 4 Aug 2005 17:14:56 +1000 (EST) Subject: [PATCH 0/3] Make kexec work with ibmvscsi/ibmveth Message-ID: <1123139692.552248.494888583145.qpatch@concordia> On our Power5 we have vscsi and veth installed. When trying to kexec a new kernel the vscsi and veth initialisation fails because the previous kernel didn't clean up properly and as far as the Hypervisor is concerned is still connected. The fix is, perhaps, to add a shutdown() function to the vio_driver struct so that vscsi and veth have a chance to disconnect from the Hypervisor at reboot. The veth seems to work fine just by calling its remove method. Just calling remove didn't work for vscsi, so I trialed-and-errored and came up with something that works. With these patches I can kexec happily on our Power5 LPAR. cheers From michael at ellerman.id.au Thu Aug 4 17:14:58 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Thu, 4 Aug 2005 17:14:58 +1000 (EST) Subject: [PATCH 2/3] ibmvscsi: Add a shutdown() function to ibmvscsi In-Reply-To: <1123139692.552248.494888583145.qpatch@concordia> Message-ID: <20050804071458.F3AC067EB5@ozlabs.org> Add a shutdown() function to the ibmvscsi driver. I originally just used ibmvscsi_remove() for shutdown, but this was causing errors as something was trying to do I/O to the disk when we removed it. The following works for me on our Power5 box, in that it doesn't many errors on shutdown and it allows the ibmvscsi to come up again after kexec. It may not be the "Right Thing" to do though. Signed-off-by: Michael Ellerman drivers/scsi/ibmvscsi/ibmvscsi.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletion(-) Index: kexec/drivers/scsi/ibmvscsi/ibmvscsi.c =================================================================== --- kexec.orig/drivers/scsi/ibmvscsi/ibmvscsi.c +++ kexec/drivers/scsi/ibmvscsi/ibmvscsi.c @@ -1436,6 +1436,15 @@ static int ibmvscsi_remove(struct vio_de return 0; } +static void ibmvscsi_shutdown(struct vio_dev *vdev) +{ + struct ibmvscsi_host_data *hostdata = vdev->dev.driver_data; + + atomic_set(&hostdata->request_limit, -1); + release_event_pool(&hostdata->pool, hostdata); + ibmvscsi_release_crq_queue(&hostdata->queue, hostdata, max_requests); +} + /** * ibmvscsi_device_table: Used by vio.c to match devices in the device tree we * support. @@ -1450,7 +1459,8 @@ static struct vio_driver ibmvscsi_driver .name = "ibmvscsi", .id_table = ibmvscsi_device_table, .probe = ibmvscsi_probe, - .remove = ibmvscsi_remove + .remove = ibmvscsi_remove, + .shutdown = ibmvscsi_shutdown }; int __init ibmvscsi_module_init(void) From michael at ellerman.id.au Thu Aug 4 17:14:58 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Thu, 4 Aug 2005 17:14:58 +1000 (EST) Subject: [PATCH 1/3] ppc64: Add a shutdown member to vio_driver In-Reply-To: <1123139692.552248.494888583145.qpatch@concordia> Message-ID: <20050804071458.1868D67EB2@ozlabs.org> Add a shutdown member to struct vio_driver. We also need vio_bus_shutdown() which converts from struct device to struct vio_dev and knows how to extract the struct vio_driver. Cleanup the vio_driver definition to fit 80 columns while we're there. Signed-off-by: Michael Ellerman arch/ppc64/kernel/vio.c | 13 +++++++++++++ include/asm-ppc64/vio.h | 16 +++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) Index: kexec/arch/ppc64/kernel/vio.c =================================================================== --- kexec.orig/arch/ppc64/kernel/vio.c +++ kexec/arch/ppc64/kernel/vio.c @@ -105,6 +105,18 @@ static int vio_bus_remove(struct device return 1; } +/* convert from struct device to struct vio_dev and pass to driver. */ +static void vio_bus_shutdown(struct device *dev) +{ + struct vio_dev *viodev = to_vio_dev(dev); + struct vio_driver *viodrv = to_vio_driver(dev->driver); + + DBGENTER(); + + if (viodrv->shutdown) + viodrv->shutdown(viodev); +} + /** * vio_register_driver: - Register a new vio driver * @drv: The vio_driver structure to be registered. @@ -119,6 +131,7 @@ int vio_register_driver(struct vio_drive viodrv->driver.bus = &vio_bus_type; viodrv->driver.probe = vio_bus_probe; viodrv->driver.remove = vio_bus_remove; + viodrv->driver.shutdown = vio_bus_shutdown; return driver_register(&viodrv->driver); } Index: kexec/include/asm-ppc64/vio.h =================================================================== --- kexec.orig/include/asm-ppc64/vio.h +++ kexec/include/asm-ppc64/vio.h @@ -69,9 +69,19 @@ struct vio_device_id { struct vio_driver { struct list_head node; char *name; - const struct vio_device_id *id_table; /* NULL if wants all devices */ - int (*probe) (struct vio_dev *dev, const struct vio_device_id *id); /* New device inserted */ - int (*remove) (struct vio_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ + + /* NULL if wants all devices */ + const struct vio_device_id *id_table; + + /* New device inserted */ + int (*probe)(struct vio_dev *dev, const struct vio_device_id *id); + + /* Device removed (NULL if not a hot-plug capable driver) */ + int (*remove) (struct vio_dev *dev); + + /* Shutdown the device (NULL if no action required) */ + void (*shutdown) (struct vio_dev *dev); + unsigned long driver_data; struct device_driver driver; From michael at ellerman.id.au Thu Aug 4 17:15:00 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Thu, 4 Aug 2005 17:15:00 +1000 (EST) Subject: [PATCH 3/3] ibmveth: Add a shutdown() function to ibmveth In-Reply-To: <1123139692.552248.494888583145.qpatch@concordia> Message-ID: <20050804071500.783BC67EAB@ozlabs.org> Add a shutdown() function to the ibmveth driver. Simply calling ibmveth_remove() appears to be sufficient. I think I need to remove __devexit from ibmveth_remove(), because it will be called even when the driver's built in. Signed-off-by: Michael Ellerman drivers/net/ibmveth.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: kexec/drivers/net/ibmveth.c =================================================================== --- kexec.orig/drivers/net/ibmveth.c +++ kexec/drivers/net/ibmveth.c @@ -994,7 +994,7 @@ static int __devinit ibmveth_probe(struc return 0; } -static int __devexit ibmveth_remove(struct vio_dev *dev) +static int ibmveth_remove(struct vio_dev *dev) { struct net_device *netdev = dev->dev.driver_data; struct ibmveth_adapter *adapter = netdev->priv; @@ -1153,7 +1153,8 @@ static struct vio_driver ibmveth_driver .name = (char *)ibmveth_driver_name, .id_table = ibmveth_device_table, .probe = ibmveth_probe, - .remove = ibmveth_remove + .remove = ibmveth_remove, + .shutdown = ibmveth_remove }; static int __init ibmveth_module_init(void) From benh at kernel.crashing.org Thu Aug 4 19:20:00 2005 From: benh at kernel.crashing.org (Benjamin Herrenschmidt) Date: Thu, 04 Aug 2005 11:20:00 +0200 Subject: Fan control for new PowerMac G5 2.7GHz machines? In-Reply-To: <42F14303.2000304@am.sony.com> References: <1123099081.30257.41.camel@gaston> <42F14303.2000304@am.sony.com> Message-ID: <1123147202.30257.50.camel@gaston> > > i2c /dev entries driver > /u3 at 0,f8000000/i2c at f8001000: Missing interrupt or address ! > > In therm_pm72_attach() it hits 'Found K2', but u3_0 and u3_1 > are never set, so start_control_loops() is never called. > > I'll look at it more when I have some time. Ah yes, this is indeed the problem ! There is a bug in Apple device tree on these machines that is breaking Linux. I should have a workaround upstream, but for some reason, it seems it's not working for you. Can you look at arch/ppc64/kernel/prom_init.c, more specifically, the function static void __init fixup_device_tree(void) And see if it's going all the way to the fixup code at the end or not ? If not, then one of the tests isn't triggering the right way on your machine, possibly the U3 revision. Ben. From schwab at suse.de Thu Aug 4 22:08:43 2005 From: schwab at suse.de (Andreas Schwab) Date: Thu, 04 Aug 2005 14:08:43 +0200 Subject: [PATCH] PPC64: Fix UP kernel build In-Reply-To: <20050804013010.GA10556@austin.ibm.com> (Olof Johansson's message of "Wed, 3 Aug 2005 20:30:10 -0500") References: <20050804013010.GA10556@austin.ibm.com> Message-ID: Olof Johansson writes: > Index: 2.6/arch/ppc64/kernel/machine_kexec.c > =================================================================== > --- 2.6.orig/arch/ppc64/kernel/machine_kexec.c 2005-08-03 19:53:16.000000000 -0500 > +++ 2.6/arch/ppc64/kernel/machine_kexec.c 2005-08-03 20:39:49.000000000 -0500 > @@ -243,13 +243,17 @@ static void kexec_prepare_cpus(void) > > static void kexec_prepare_cpus(void) > { > + extern void smp_release_cpus(void); Please put this in a header. Andreas. -- Andreas Schwab, SuSE Labs, schwab at suse.de SuSE Linux Products GmbH, Maxfeldstra?e 5, 90409 N?rnberg, Germany Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From boutcher at us.ibm.com Fri Aug 5 00:31:37 2005 From: boutcher at us.ibm.com (David Boutcher) Date: Thu, 4 Aug 2005 09:31:37 -0500 Subject: [PATCH 0/3] Make kexec work with ibmvscsi/ibmveth In-Reply-To: <1123139692.552248.494888583145.qpatch@concordia> Message-ID: Michael Ellerman wrote on 08/04/2005 02:14:56 AM: > On our Power5 we have vscsi and veth installed. When trying to kexec a new > kernel the vscsi and veth initialisation fails because the previous kernel > didn't clean up properly and as far as the Hypervisor is concerned is still > connected. > > The fix is, perhaps, to add a shutdown() function to the vio_driver struct so > that vscsi and veth have a chance to disconnect from the Hypervisor at reboot. > > The veth seems to work fine just by calling its remove method. > > Just calling remove didn't work for vscsi, so I trialed-and-errored and came > up with something that works. > > With these patches I can kexec happily on our Power5 LPAR. Hmmm....before we commit this I would prefer to figure out why vscsi remove doesn't work. I'll dig into that. Dave Boutcher IBM Linux Technology Center From olh at suse.de Fri Aug 5 03:26:42 2005 From: olh at suse.de (Olaf Hering) Date: Thu, 4 Aug 2005 19:26:42 +0200 Subject: [PATCH] allow xmon=off on ppc64 Message-ID: <20050804172642.GA23306@suse.de> If both CONFIG_XMON and CONFIG_XMON_DEFAULT is enabled in the .config, there is no way to disable xmon again. setup_system calls first xmon_init, later parse_early_param. So a new 'xmon=off' cmdline option will do the right thing. Signed-off-by: Olaf Hering arch/ppc64/kernel/setup.c | 8 +++++--- arch/ppc64/xmon/start.c | 2 +- arch/ppc64/xmon/xmon.c | 26 ++++++++++++++++++-------- include/asm-ppc64/system.h | 2 +- 4 files changed, 25 insertions(+), 13 deletions(-) Index: linux-2.6.12/arch/ppc64/kernel/setup.c =================================================================== --- linux-2.6.12.orig/arch/ppc64/kernel/setup.c +++ linux-2.6.12/arch/ppc64/kernel/setup.c @@ -627,7 +627,7 @@ void __init setup_system(void) * Initialize xmon */ #ifdef CONFIG_XMON_DEFAULT - xmon_init(); + xmon_init(1); #endif /* * Register early console @@ -1350,11 +1350,13 @@ static int __init early_xmon(char *p) /* ensure xmon is enabled */ if (p) { if (strncmp(p, "on", 2) == 0) - xmon_init(); + xmon_init(1); + if (strncmp(p, "off", 3) == 0) + xmon_init(0); if (strncmp(p, "early", 5) != 0) return 0; } - xmon_init(); + xmon_init(1); debugger(NULL); return 0; Index: linux-2.6.12/arch/ppc64/xmon/start.c =================================================================== --- linux-2.6.12.orig/arch/ppc64/xmon/start.c +++ linux-2.6.12/arch/ppc64/xmon/start.c @@ -27,7 +27,7 @@ static void sysrq_handle_xmon(int key, s struct tty_struct *tty) { /* ensure xmon is enabled */ - xmon_init(); + xmon_init(1); debugger(pt_regs); } Index: linux-2.6.12/arch/ppc64/xmon/xmon.c =================================================================== --- linux-2.6.12.orig/arch/ppc64/xmon/xmon.c +++ linux-2.6.12/arch/ppc64/xmon/xmon.c @@ -2496,15 +2496,25 @@ static void dump_stab(void) } } -void xmon_init(void) +void xmon_init(int enable) { - __debugger = xmon; - __debugger_ipi = xmon_ipi; - __debugger_bpt = xmon_bpt; - __debugger_sstep = xmon_sstep; - __debugger_iabr_match = xmon_iabr_match; - __debugger_dabr_match = xmon_dabr_match; - __debugger_fault_handler = xmon_fault_handler; + if (enable) { + __debugger = xmon; + __debugger_ipi = xmon_ipi; + __debugger_bpt = xmon_bpt; + __debugger_sstep = xmon_sstep; + __debugger_iabr_match = xmon_iabr_match; + __debugger_dabr_match = xmon_dabr_match; + __debugger_fault_handler = xmon_fault_handler; + } else { + __debugger = NULL; + __debugger_ipi = NULL; + __debugger_bpt = NULL; + __debugger_sstep = NULL; + __debugger_iabr_match = NULL; + __debugger_dabr_match = NULL; + __debugger_fault_handler = NULL; + } } void dump_segments(void) Index: linux-2.6.12/include/asm-ppc64/system.h =================================================================== --- linux-2.6.12.orig/include/asm-ppc64/system.h +++ linux-2.6.12/include/asm-ppc64/system.h @@ -88,7 +88,7 @@ DEBUGGER_BOILERPLATE(debugger_dabr_match DEBUGGER_BOILERPLATE(debugger_fault_handler) #ifdef CONFIG_XMON -extern void xmon_init(void); +extern void xmon_init(int enable); #endif #else From olh at suse.de Fri Aug 5 03:28:09 2005 From: olh at suse.de (Olaf Hering) Date: Thu, 4 Aug 2005 19:28:09 +0200 Subject: [PATCH] update xmon helptext In-Reply-To: <20050804172642.GA23306@suse.de> References: <20050804172642.GA23306@suse.de> Message-ID: <20050804172809.GB23306@suse.de> xmon will do nothing but noise on a G5 if BOOTX_TEXT is not enabled. mention the recognized kernel cmdline options for xmon. Signed-off-by: Olaf Hering arch/ppc64/Kconfig.debug | 9 +++++++++ 1 files changed, 9 insertions(+) Index: linux-2.6.12/arch/ppc64/Kconfig.debug =================================================================== --- linux-2.6.12.orig/arch/ppc64/Kconfig.debug +++ linux-2.6.12/arch/ppc64/Kconfig.debug @@ -41,10 +41,19 @@ config XMON help Include in-kernel hooks for the xmon kernel monitor/debugger. Unless you are intending to debug the kernel, say N here. + Make sure to enable also CONFIG_BOOTX_TEXT on Macs. Otherwise + nothing will appear on the screen (xmon writes directly to the + framebuffer memory). + The cmdline option 'xmon' or 'xmon=early' will drop into xmon very + early during boot. 'xmon=on' will just enable the xmon debugger hooks. + 'xmon=off' will disable the debugger hooks if CONFIG_XMON_DEFAULT is set. config XMON_DEFAULT bool "Enable xmon by default" depends on XMON + help + xmon is normally disabled unless booted with 'xmon=on'. + Use 'xmon=off' to disable xmon init during runtime. config PPCDBG bool "Include PPCDBG realtime debugging" From paulus at samba.org Fri Aug 5 08:39:01 2005 From: paulus at samba.org (Paul Mackerras) Date: Fri, 5 Aug 2005 08:39:01 +1000 Subject: [PATCH 0/3] Make kexec work with ibmvscsi/ibmveth In-Reply-To: <1123139692.552248.494888583145.qpatch@concordia> References: <1123139692.552248.494888583145.qpatch@concordia> Message-ID: <17138.39173.312034.227658@cargo.ozlabs.ibm.com> Michael Ellerman writes: > On our Power5 we have vscsi and veth installed. When trying to kexec a new > kernel the vscsi and veth initialisation fails because the previous kernel > didn't clean up properly and as far as the Hypervisor is concerned is still > connected. > > The fix is, perhaps, to add a shutdown() function to the vio_driver struct so > that vscsi and veth have a chance to disconnect from the Hypervisor at reboot. But if we are using kexec to do kdump, and the kernel panics, the driver's shutdown method won't get called. We should instead harden the driver so that it can cope with the error from the hypervisor and recover, I think. Paul. From haren at us.ibm.com Fri Aug 5 10:44:33 2005 From: haren at us.ibm.com (Haren Myneni) Date: Thu, 04 Aug 2005 17:44:33 -0700 Subject: [PATCH 0/3] Make kexec work with ibmvscsi/ibmveth In-Reply-To: References: Message-ID: <42F2B671.2030207@us.ibm.com> > > Michael Ellerman writes: > > > On our Power5 we have vscsi and veth installed. When trying to kexec > a new > > kernel the vscsi and veth initialisation fails because the previous > kernel > > didn't clean up properly and as far as the Hypervisor is concerned > is still > > connected. > > > > The fix is, perhaps, to add a shutdown() function to the vio_driver > struct so > > that vscsi and veth have a chance to disconnect from the Hypervisor > at reboot. > > But if we are using kexec to do kdump, and the kernel panics, the > driver's shutdown method won't get called. We should instead harden > the driver so that it can cope with the error from the hypervisor and > recover, I think. > > Paul. > BTW, When I tested kexec boot without calling device_shutdown(), had the device initialization issue for IPR. However, the system was booted with some EEH traces after I applied Linas's EEH Error recovery patches (reset the PCI slot). I need to do some more testing. Thanks Haren But, in the normal kexec boot, > _______________________________________________ > Linuxppc64-dev mailing list > Linuxppc64-dev at ozlabs.org > https://ozlabs.org/mailman/listinfo/linuxppc64-dev > From michael at ellerman.id.au Fri Aug 5 11:21:54 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Fri, 5 Aug 2005 11:21:54 +1000 Subject: [PATCH 0/3] Make kexec work with ibmvscsi/ibmveth In-Reply-To: <17138.39173.312034.227658@cargo.ozlabs.ibm.com> References: <1123139692.552248.494888583145.qpatch@concordia> <17138.39173.312034.227658@cargo.ozlabs.ibm.com> Message-ID: <200508051121.54574.michael@ellerman.id.au> On Fri, 5 Aug 2005 08:39, Paul Mackerras wrote: > Michael Ellerman writes: > > On our Power5 we have vscsi and veth installed. When trying to kexec a > > new kernel the vscsi and veth initialisation fails because the previous > > kernel didn't clean up properly and as far as the Hypervisor is concerned > > is still connected. > > > > The fix is, perhaps, to add a shutdown() function to the vio_driver > > struct so that vscsi and veth have a chance to disconnect from the > > Hypervisor at reboot. > > But if we are using kexec to do kdump, and the kernel panics, the > driver's shutdown method won't get called. We should instead harden > the driver so that it can cope with the error from the hypervisor and > recover, I think. You're right, that's a much better idea. cheers -- Michael Ellerman IBM OzLabs email: michael:ellerman.id.au inmsg: mpe:jabber.org wwweb: http://michael.ellerman.id.au phone: +61 2 6212 1183 (tie line 70 21183) We do not inherit the earth from our ancestors, we borrow it from our children. - S.M.A.R.T Person -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20050805/145b12ad/attachment.pgp From olof at lixom.net Fri Aug 5 14:02:26 2005 From: olof at lixom.net (Olof Johansson) Date: Thu, 4 Aug 2005 23:02:26 -0500 Subject: [PATCH] PPC64: Add VMX save flag to VPA Message-ID: <20050805040225.GA13865@austin.ibm.com> Hi, We need to indicate to the hypervisor that it needs to save our VMX registers when switching partitions on a shared-processor system, just as it needs to for FP and PMC registers. This could be made to be on-demand when VMX is used, but we don't do that for FP nor PMC right now either so let's not overcomplicate things. Signed-off-by: Olof Johansson Index: 2.6/arch/ppc64/kernel/pacaData.c =================================================================== --- 2.6.orig/arch/ppc64/kernel/pacaData.c 2005-08-03 19:53:16.000000000 -0500 +++ 2.6/arch/ppc64/kernel/pacaData.c 2005-08-04 19:26:26.000000000 -0500 @@ -59,6 +59,7 @@ extern unsigned long __toc_start; .fpregs_in_use = 1, \ .end_of_quantum = 0xfffffffffffffffful, \ .slb_count = 64, \ + .vmxregs_in_use = 0, \ }, \ #ifdef CONFIG_PPC_ISERIES Index: 2.6/include/asm-ppc64/lppaca.h =================================================================== --- 2.6.orig/include/asm-ppc64/lppaca.h 2005-08-04 19:25:54.000000000 -0500 +++ 2.6/include/asm-ppc64/lppaca.h 2005-08-04 19:26:15.000000000 -0500 @@ -108,7 +108,7 @@ struct lppaca volatile u32 virtual_decr; // Virtual DECR for shared procsx78-x7B u16 slb_count; // # of SLBs to maintain x7C-x7D u8 idle; // Indicate OS is idle x7E - u8 reserved5; // Reserved x7F + u8 vmxregs_in_use; // VMX registers in use x7F //============================================================================= Index: 2.6/arch/ppc64/kernel/pSeries_lpar.c =================================================================== --- 2.6.orig/arch/ppc64/kernel/pSeries_lpar.c 2005-08-03 19:53:16.000000000 -0500 +++ 2.6/arch/ppc64/kernel/pSeries_lpar.c 2005-08-04 19:35:41.000000000 -0500 @@ -267,6 +267,10 @@ void vpa_init(int cpu) /* Register the Virtual Processor Area (VPA) */ flags = 1UL << (63 - 18); + + if (cpu_has_feature(CPU_FTR_ALTIVEC)) + paca[cpu].lppaca.vmxregs_in_use = 1; + ret = register_vpa(flags, hwcpu, __pa(vpa)); if (ret) From sfr at canb.auug.org.au Fri Aug 5 17:47:05 2005 From: sfr at canb.auug.org.au (Stephen Rothwell) Date: Fri, 5 Aug 2005 17:47:05 +1000 Subject: [PATCH] 1/2 Start header file merger (Was: Re: Beginning Merger Patch) In-Reply-To: <688ba2276de281a9473b030a16a514c0@embeddededge.com> References: <1123023575.2614.25.camel@cashmere.sps.mot.com> <688ba2276de281a9473b030a16a514c0@embeddededge.com> Message-ID: <20050805174705.731ffa05.sfr@canb.auug.org.au> On Tue, 2 Aug 2005 19:10:56 -0400 Dan Malek wrote: > > On Aug 2, 2005, at 6:59 PM, Jon Loeliger wrote: > > > ..... A stub is left > > in asm-ppc and asm-ppc64 pointing to the unified files. > > Why bother? You may as well change all of the source > files, too, or else that will never get done :-) You actually don't need to modify (m)any source files. Here is an alternative approach. These patches depend on Olaf's boot code cleanup for ppc64 (or similar). Do the following: cd linux/include mkdir asm-powerpc cd asm-ppc for i in * do [ -e ../asm-ppc64/$i ] || mv $i ../asm-powerpc/$i done cd ../asm-ppc64 for i in * do [ -e ../asm-ppc/$i ] || mv $i ../asm-powerpc/$i done for i in * do [ -f ../asm-ppc64/$i ] && cmp -s $i ../asm-ppc64/$i && mv $i ../asm-powerpc/$i && rm ../asm-ppc64/$i done Then apply the patch below and the patch in the following email. I have built this kernel for ppc (defconfig), ppc64 (iSeries, pSeries and pmac). -- Cheers, Stephen Rothwell sfr at canb.auug.org.au http://www.canb.auug.org.au/~sfr/ diff -ruNp linus-powerpc.xx/arch/ppc/Makefile linus-powerpc.1/arch/ppc/Makefile --- linus-powerpc.xx/arch/ppc/Makefile 2005-06-27 16:08:00.000000000 +1000 +++ linus-powerpc.1/arch/ppc/Makefile 2005-08-05 11:19:25.000000000 +1000 @@ -21,11 +21,13 @@ CC := $(CC) -m32 endif LDFLAGS_vmlinux := -Ttext $(KERNELLOAD) -Bstatic -CPPFLAGS += -Iarch/$(ARCH) +CPPFLAGS += -Iarch/$(ARCH) -Iinclude3 AFLAGS += -Iarch/$(ARCH) CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe \ -ffixed-r2 -mmultiple CPP = $(CC) -E $(CFLAGS) +# Temporary hack until we have migrated to asm-powerpc +LINUXINCLUDE += -Iinclude3 CHECKFLAGS += -D__powerpc__ @@ -101,6 +103,7 @@ endef archclean: $(Q)$(MAKE) $(clean)=arch/ppc/boot + $(Q)rm -rf include3 prepare: include/asm-$(ARCH)/offsets.h checkbin @@ -110,6 +113,12 @@ arch/$(ARCH)/kernel/asm-offsets.s: inclu include/asm-$(ARCH)/offsets.h: arch/$(ARCH)/kernel/asm-offsets.s $(call filechk,gen-asm-offsets) +# Temporary hack until we have migrated to asm-powerpc +include/asm: include3/asm +include3/asm: + $(Q)if [ ! -d include3 ]; then mkdir -p include3; fi; + $(Q)ln -fsn $(srctree)/include/asm-powerpc include3/asm + # Use the file '.tmp_gas_check' for binutils tests, as gas won't output # to stdout and these checks are run even on install targets. TOUT := .tmp_gas_check diff -ruNp linus-powerpc.xx/arch/ppc64/Makefile linus-powerpc.1/arch/ppc64/Makefile --- linus-powerpc.xx/arch/ppc64/Makefile 2005-06-27 16:08:00.000000000 +1000 +++ linus-powerpc.1/arch/ppc64/Makefile 2005-08-05 11:19:50.000000000 +1000 @@ -55,6 +55,8 @@ LDFLAGS := -m elf64ppc LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD) CFLAGS += -msoft-float -pipe -mminimal-toc -mtraceback=none \ -mcall-aixdesc +# Temporary hack until we have migrated to asm-powerpc +CPPFLAGS += -Iinclude3 GCC_VERSION := $(call cc-version) GCC_BROKEN_VEC := $(shell if [ $(GCC_VERSION) -lt 0400 ] ; then echo "y"; fi ;) @@ -112,6 +114,7 @@ all: $(KBUILD_IMAGE) archclean: $(Q)$(MAKE) $(clean)=$(boot) + $(Q)rm -rf include3 prepare: include/asm-ppc64/offsets.h @@ -121,6 +124,12 @@ arch/ppc64/kernel/asm-offsets.s: include include/asm-ppc64/offsets.h: arch/ppc64/kernel/asm-offsets.s $(call filechk,gen-asm-offsets) +# Temporary hack until we have migrated to asm-powerpc +include/asm: include3/asm +include3/asm: + $(Q)if [ ! -d include3 ]; then mkdir -p include3; fi; + $(Q)ln -fsn $(srctree)/include/asm-powerpc include3/asm + define archhelp echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)' echo ' zImage.initrd- Compressed kernel image with initrd attached,' From sfr at canb.auug.org.au Fri Aug 5 17:50:09 2005 From: sfr at canb.auug.org.au (Stephen Rothwell) Date: Fri, 5 Aug 2005 17:50:09 +1000 Subject: [PATCH] 2/2 merge the easy ones In-Reply-To: <20050805174705.731ffa05.sfr@canb.auug.org.au> References: <1123023575.2614.25.camel@cashmere.sps.mot.com> <688ba2276de281a9473b030a16a514c0@embeddededge.com> <20050805174705.731ffa05.sfr@canb.auug.org.au> Message-ID: <20050805175009.48761e9e.sfr@canb.auug.org.au> Here is the rest of the easy headers to merge. -- Cheers, Stephen Rothwell sfr at canb.auug.org.au http://www.canb.auug.org.au/~sfr/ diff -ruNp linus-powerpc.1a/include/asm-powerpc/cputime.h linus-powerpc.2/include/asm-powerpc/cputime.h --- linus-powerpc.1a/include/asm-powerpc/cputime.h 2005-06-27 16:08:08.000000000 +1000 +++ linus-powerpc.2/include/asm-powerpc/cputime.h 2005-08-05 15:04:55.000000000 +1000 @@ -1,6 +1 @@ -#ifndef __PPC_CPUTIME_H -#define __PPC_CPUTIME_H - #include - -#endif /* __PPC_CPUTIME_H */ diff -ruNp linus-powerpc.1a/include/asm-powerpc/div64.h linus-powerpc.2/include/asm-powerpc/div64.h --- linus-powerpc.1a/include/asm-powerpc/div64.h 2005-06-27 16:08:08.000000000 +1000 +++ linus-powerpc.2/include/asm-powerpc/div64.h 1970-01-01 10:00:00.000000000 +1000 @@ -1 +0,0 @@ -#include diff -ruNp linus-powerpc.1a/include/asm-powerpc/emergency-restart.h linus-powerpc.2/include/asm-powerpc/emergency-restart.h --- linus-powerpc.1a/include/asm-powerpc/emergency-restart.h 2005-07-27 10:17:26.000000000 +1000 +++ linus-powerpc.2/include/asm-powerpc/emergency-restart.h 2005-08-05 15:04:55.000000000 +1000 @@ -1,6 +1 @@ -#ifndef _ASM_EMERGENCY_RESTART_H -#define _ASM_EMERGENCY_RESTART_H - #include - -#endif /* _ASM_EMERGENCY_RESTART_H */ diff -ruNp linus-powerpc.1a/include/asm-powerpc/errno.h linus-powerpc.2/include/asm-powerpc/errno.h --- linus-powerpc.1a/include/asm-powerpc/errno.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-powerpc.2/include/asm-powerpc/errno.h 2005-08-05 15:04:55.000000000 +1000 @@ -0,0 +1,11 @@ +#ifndef _ASM_ERRNO_H +#define _ASM_ERRNO_H + +#include + +#undef EDEADLOCK +#define EDEADLOCK 58 /* File locking deadlock error */ + +#define _LAST_ERRNO 516 + +#endif /* _ASM_ERRNO_H */ diff -ruNp linus-powerpc.1a/include/asm-powerpc/ioctl.h linus-powerpc.2/include/asm-powerpc/ioctl.h --- linus-powerpc.1a/include/asm-powerpc/ioctl.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-powerpc.2/include/asm-powerpc/ioctl.h 2005-08-05 15:04:55.000000000 +1000 @@ -0,0 +1,69 @@ +#ifndef _ASM_IOCTL_H +#define _ASM_IOCTL_H + + +/* + * This was copied from the alpha as it's a bit cleaner there. + * -- Cort + */ + +#define _IOC_NRBITS 8 +#define _IOC_TYPEBITS 8 +#define _IOC_SIZEBITS 13 +#define _IOC_DIRBITS 3 + +#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) +#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) +#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) +#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) + +#define _IOC_NRSHIFT 0 +#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) +#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) +#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) + +/* + * Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit. + * And this turns out useful to catch old ioctl numbers in header + * files for us. + */ +#define _IOC_NONE 1U +#define _IOC_READ 2U +#define _IOC_WRITE 4U + +#define _IOC(dir,type,nr,size) \ + (((dir) << _IOC_DIRSHIFT) | \ + ((type) << _IOC_TYPESHIFT) | \ + ((nr) << _IOC_NRSHIFT) | \ + ((size) << _IOC_SIZESHIFT)) + +/* provoke compile error for invalid uses of size argument */ +extern unsigned int __invalid_size_argument_for_IOC; +#define _IOC_TYPECHECK(t) \ + ((sizeof(t) == sizeof(t[1]) && \ + sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ + sizeof(t) : __invalid_size_argument_for_IOC) + +/* used to create numbers */ +#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) +#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) +#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) +#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) +#define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) +#define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) +#define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) + +/* used to decode them.. */ +#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) +#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) +#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) +#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) + +/* various drivers, such as the pcmcia stuff, need these... */ +#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) +#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) +#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) +#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) +#define IOCSIZE_SHIFT (_IOC_SIZESHIFT) + +#endif /* _ASM_IOCTL_H */ diff -ruNp linus-powerpc.1a/include/asm-powerpc/ioctls.h linus-powerpc.2/include/asm-powerpc/ioctls.h --- linus-powerpc.1a/include/asm-powerpc/ioctls.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-powerpc.2/include/asm-powerpc/ioctls.h 2005-08-05 15:04:55.000000000 +1000 @@ -0,0 +1,107 @@ +#ifndef _ASM_IOCTLS_H +#define _ASM_IOCTLS_H + +#include + +#define FIOCLEX _IO('f', 1) +#define FIONCLEX _IO('f', 2) +#define FIOASYNC _IOW('f', 125, int) +#define FIONBIO _IOW('f', 126, int) +#define FIONREAD _IOR('f', 127, int) +#define TIOCINQ FIONREAD +#define FIOQSIZE _IOR('f', 128, loff_t) + +#define TIOCGETP _IOR('t', 8, struct sgttyb) +#define TIOCSETP _IOW('t', 9, struct sgttyb) +#define TIOCSETN _IOW('t', 10, struct sgttyb) /* TIOCSETP wo flush */ + +#define TIOCSETC _IOW('t', 17, struct tchars) +#define TIOCGETC _IOR('t', 18, struct tchars) +#define TCGETS _IOR('t', 19, struct termios) +#define TCSETS _IOW('t', 20, struct termios) +#define TCSETSW _IOW('t', 21, struct termios) +#define TCSETSF _IOW('t', 22, struct termios) + +#define TCGETA _IOR('t', 23, struct termio) +#define TCSETA _IOW('t', 24, struct termio) +#define TCSETAW _IOW('t', 25, struct termio) +#define TCSETAF _IOW('t', 28, struct termio) + +#define TCSBRK _IO('t', 29) +#define TCXONC _IO('t', 30) +#define TCFLSH _IO('t', 31) + +#define TIOCSWINSZ _IOW('t', 103, struct winsize) +#define TIOCGWINSZ _IOR('t', 104, struct winsize) +#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ +#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ +#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ + +#define TIOCGLTC _IOR('t', 116, struct ltchars) +#define TIOCSLTC _IOW('t', 117, struct ltchars) +#define TIOCSPGRP _IOW('t', 118, int) +#define TIOCGPGRP _IOR('t', 119, int) + +#define TIOCEXCL 0x540C +#define TIOCNXCL 0x540D +#define TIOCSCTTY 0x540E + +#define TIOCSTI 0x5412 +#define TIOCMGET 0x5415 +#define TIOCMBIS 0x5416 +#define TIOCMBIC 0x5417 +#define TIOCMSET 0x5418 +# define TIOCM_LE 0x001 +# define TIOCM_DTR 0x002 +# define TIOCM_RTS 0x004 +# define TIOCM_ST 0x008 +# define TIOCM_SR 0x010 +# define TIOCM_CTS 0x020 +# define TIOCM_CAR 0x040 +# define TIOCM_RNG 0x080 +# define TIOCM_DSR 0x100 +# define TIOCM_CD TIOCM_CAR +# define TIOCM_RI TIOCM_RNG + +#define TIOCGSOFTCAR 0x5419 +#define TIOCSSOFTCAR 0x541A +#define TIOCLINUX 0x541C +#define TIOCCONS 0x541D +#define TIOCGSERIAL 0x541E +#define TIOCSSERIAL 0x541F +#define TIOCPKT 0x5420 +# define TIOCPKT_DATA 0 +# define TIOCPKT_FLUSHREAD 1 +# define TIOCPKT_FLUSHWRITE 2 +# define TIOCPKT_STOP 4 +# define TIOCPKT_START 8 +# define TIOCPKT_NOSTOP 16 +# define TIOCPKT_DOSTOP 32 + + +#define TIOCNOTTY 0x5422 +#define TIOCSETD 0x5423 +#define TIOCGETD 0x5424 +#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ +#define TIOCSBRK 0x5427 /* BSD compatibility */ +#define TIOCCBRK 0x5428 /* BSD compatibility */ +#define TIOCGSID 0x5429 /* Return the session ID of FD */ +#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ +#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ + +#define TIOCSERCONFIG 0x5453 +#define TIOCSERGWILD 0x5454 +#define TIOCSERSWILD 0x5455 +#define TIOCGLCKTRMIOS 0x5456 +#define TIOCSLCKTRMIOS 0x5457 +#define TIOCSERGSTRUCT 0x5458 /* For debugging only */ +#define TIOCSERGETLSR 0x5459 /* Get line status register */ + /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ +# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ +#define TIOCSERGETMULTI 0x545A /* Get multiport config */ +#define TIOCSERSETMULTI 0x545B /* Set multiport config */ + +#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ +#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ + +#endif /* _ASM_IOCTLS_H */ diff -ruNp linus-powerpc.1a/include/asm-powerpc/linkage.h linus-powerpc.2/include/asm-powerpc/linkage.h --- linus-powerpc.1a/include/asm-powerpc/linkage.h 2005-06-27 16:08:08.000000000 +1000 +++ linus-powerpc.2/include/asm-powerpc/linkage.h 2005-08-05 15:04:55.000000000 +1000 @@ -1,6 +1 @@ -#ifndef __ASM_LINKAGE_H -#define __ASM_LINKAGE_H - /* Nothing to see here... */ - -#endif diff -ruNp linus-powerpc.1a/include/asm-powerpc/local.h linus-powerpc.2/include/asm-powerpc/local.h --- linus-powerpc.1a/include/asm-powerpc/local.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-powerpc.2/include/asm-powerpc/local.h 2005-08-05 15:04:55.000000000 +1000 @@ -0,0 +1 @@ +#include diff -ruNp linus-powerpc.1a/include/asm-powerpc/mman.h linus-powerpc.2/include/asm-powerpc/mman.h --- linus-powerpc.1a/include/asm-powerpc/mman.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-powerpc.2/include/asm-powerpc/mman.h 2005-08-05 15:04:55.000000000 +1000 @@ -0,0 +1,44 @@ +#ifndef _ASM_MMAN_H +#define _ASM_MMAN_H + +#define PROT_READ 0x1 /* page can be read */ +#define PROT_WRITE 0x2 /* page can be written */ +#define PROT_EXEC 0x4 /* page can be executed */ +#define PROT_SEM 0x8 /* page may be used for atomic ops */ +#define PROT_NONE 0x0 /* page can not be accessed */ +#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ +#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ + +#define MAP_SHARED 0x01 /* Share changes */ +#define MAP_PRIVATE 0x02 /* Changes are private */ +#define MAP_TYPE 0x0f /* Mask for type of mapping */ +#define MAP_FIXED 0x10 /* Interpret addr exactly */ +#define MAP_ANONYMOUS 0x20 /* don't use a file */ +#define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */ +#define MAP_NORESERVE 0x40 /* don't reserve swap pages */ +#define MAP_LOCKED 0x80 + +#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ +#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ +#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ +#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ +#define MAP_NONBLOCK 0x10000 /* do not block on IO */ + +#define MS_ASYNC 1 /* sync memory asynchronously */ +#define MS_INVALIDATE 2 /* invalidate the caches */ +#define MS_SYNC 4 /* synchronous memory sync */ + +#define MCL_CURRENT 0x2000 /* lock all currently mapped pages */ +#define MCL_FUTURE 0x4000 /* lock all additions to address space */ + +#define MADV_NORMAL 0x0 /* default page-in behavior */ +#define MADV_RANDOM 0x1 /* page-in minimum required */ +#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ +#define MADV_WILLNEED 0x3 /* pre-fault pages */ +#define MADV_DONTNEED 0x4 /* discard these pages */ + +/* compatibility flags */ +#define MAP_ANON MAP_ANONYMOUS +#define MAP_FILE 0 + +#endif /* _ASM_MMAN_H */ diff -ruNp linus-powerpc.1a/include/asm-powerpc/param.h linus-powerpc.2/include/asm-powerpc/param.h --- linus-powerpc.1a/include/asm-powerpc/param.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-powerpc.2/include/asm-powerpc/param.h 2005-08-05 15:04:55.000000000 +1000 @@ -0,0 +1,29 @@ +#ifndef _ASM_PARAM_H +#define _ASM_PARAM_H + +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifdef __KERNEL__ +# define HZ 1000 /* Internal kernel timer frequency */ +# define USER_HZ 100 /* .. some user interfaces are in "ticks" */ +# define CLOCKS_PER_SEC (USER_HZ) /* like times() */ +#endif + +#ifndef HZ +#define HZ 100 +#endif + +#define EXEC_PAGESIZE 4096 + +#ifndef NOGROUP +#define NOGROUP (-1) +#endif + +#define MAXHOSTNAMELEN 64 /* max length of hostname */ + +#endif /* _ASM_PARAM_H */ diff -ruNp linus-powerpc.1a/include/asm-powerpc/parport.h linus-powerpc.2/include/asm-powerpc/parport.h --- linus-powerpc.1a/include/asm-powerpc/parport.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-powerpc.2/include/asm-powerpc/parport.h 2005-08-05 15:04:55.000000000 +1000 @@ -0,0 +1,18 @@ +/* + * parport.h: platform-specific PC-style parport initialisation + * + * Copyright (C) 1999, 2000 Tim Waugh + * + * This file should only be included by drivers/parport/parport_pc.c. + */ + +#ifndef _ASM_PARPORT_H +#define _ASM_PARPORT_H + +static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma); +static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) +{ + return parport_pc_find_isa_ports (autoirq, autodma); +} + +#endif /* !(_ASM_PARPORT_H) */ diff -ruNp linus-powerpc.1a/include/asm-powerpc/percpu.h linus-powerpc.2/include/asm-powerpc/percpu.h --- linus-powerpc.1a/include/asm-powerpc/percpu.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-powerpc.2/include/asm-powerpc/percpu.h 2005-08-05 15:04:55.000000000 +1000 @@ -0,0 +1 @@ +#include diff -ruNp linus-powerpc.1a/include/asm-powerpc/poll.h linus-powerpc.2/include/asm-powerpc/poll.h --- linus-powerpc.1a/include/asm-powerpc/poll.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-powerpc.2/include/asm-powerpc/poll.h 2005-08-05 15:04:55.000000000 +1000 @@ -0,0 +1,32 @@ +#ifndef _ASM_POLL_H +#define _ASM_POLL_H + +/* + * Copyright (C) 2001 PPC64 Team, IBM Corp + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#define POLLIN 0x0001 +#define POLLPRI 0x0002 +#define POLLOUT 0x0004 +#define POLLERR 0x0008 +#define POLLHUP 0x0010 +#define POLLNVAL 0x0020 +#define POLLRDNORM 0x0040 +#define POLLRDBAND 0x0080 +#define POLLWRNORM 0x0100 +#define POLLWRBAND 0x0200 +#define POLLMSG 0x0400 +#define POLLREMOVE 0x1000 + +struct pollfd { + int fd; + short events; + short revents; +}; + +#endif /* _ASM_POLL_H */ diff -ruNp linus-powerpc.1a/include/asm-powerpc/resource.h linus-powerpc.2/include/asm-powerpc/resource.h --- linus-powerpc.1a/include/asm-powerpc/resource.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-powerpc.2/include/asm-powerpc/resource.h 2005-08-05 15:04:55.000000000 +1000 @@ -0,0 +1 @@ +#include diff -ruNp linus-powerpc.1a/include/asm-powerpc/shmparam.h linus-powerpc.2/include/asm-powerpc/shmparam.h --- linus-powerpc.1a/include/asm-powerpc/shmparam.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-powerpc.2/include/asm-powerpc/shmparam.h 2005-08-05 15:04:55.000000000 +1000 @@ -0,0 +1,6 @@ +#ifndef _ASM_SHMPARAM_H +#define _ASM_SHMPARAM_H + +#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ + +#endif /* _ASM_SHMPARAM_H */ diff -ruNp linus-powerpc.1a/include/asm-powerpc/string.h linus-powerpc.2/include/asm-powerpc/string.h --- linus-powerpc.1a/include/asm-powerpc/string.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-powerpc.2/include/asm-powerpc/string.h 2005-08-05 15:04:55.000000000 +1000 @@ -0,0 +1,32 @@ +#ifndef _ASM_STRING_H +#define _ASM_STRING_H + +#ifdef __KERNEL__ + +#define __HAVE_ARCH_STRCPY +#define __HAVE_ARCH_STRNCPY +#define __HAVE_ARCH_STRLEN +#define __HAVE_ARCH_STRCMP +#define __HAVE_ARCH_STRCAT +#define __HAVE_ARCH_MEMSET +#define __HAVE_ARCH_MEMCPY +#define __HAVE_ARCH_MEMMOVE +#define __HAVE_ARCH_MEMCMP +#define __HAVE_ARCH_MEMCHR + +extern int strcasecmp(const char *, const char *); +extern int strncasecmp(const char *, const char *, int); +extern char * strcpy(char *,const char *); +extern char * strncpy(char *,const char *, __kernel_size_t); +extern __kernel_size_t strlen(const char *); +extern int strcmp(const char *,const char *); +extern char * strcat(char *, const char *); +extern void * memset(void *,int,__kernel_size_t); +extern void * memcpy(void *,const void *,__kernel_size_t); +extern void * memmove(void *,const void *,__kernel_size_t); +extern int memcmp(const void *,const void *,__kernel_size_t); +extern void * memchr(const void *,int,__kernel_size_t); + +#endif /* __KERNEL__ */ + +#endif /* _ASM_STRING_H */ diff -ruNp linus-powerpc.1a/include/asm-powerpc/termbits.h linus-powerpc.2/include/asm-powerpc/termbits.h --- linus-powerpc.1a/include/asm-powerpc/termbits.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-powerpc.2/include/asm-powerpc/termbits.h 2005-08-05 15:04:55.000000000 +1000 @@ -0,0 +1,184 @@ +#ifndef _ASM_TERMBITS_H +#define _ASM_TERMBITS_H + +typedef unsigned char cc_t; +typedef unsigned int speed_t; +typedef unsigned int tcflag_t; + +/* + * termios type and macro definitions. Be careful about adding stuff + * to this file since it's used in GNU libc and there are strict rules + * concerning namespace pollution. + */ + +#define NCCS 19 +struct termios { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_cc[NCCS]; /* control characters */ + cc_t c_line; /* line discipline (== c_cc[19]) */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ +}; + +/* c_cc characters */ +#define VINTR 0 +#define VQUIT 1 +#define VERASE 2 +#define VKILL 3 +#define VEOF 4 +#define VMIN 5 +#define VEOL 6 +#define VTIME 7 +#define VEOL2 8 +#define VSWTC 9 +#define VWERASE 10 +#define VREPRINT 11 +#define VSUSP 12 +#define VSTART 13 +#define VSTOP 14 +#define VLNEXT 15 +#define VDISCARD 16 + +/* c_iflag bits */ +#define IGNBRK 0000001 +#define BRKINT 0000002 +#define IGNPAR 0000004 +#define PARMRK 0000010 +#define INPCK 0000020 +#define ISTRIP 0000040 +#define INLCR 0000100 +#define IGNCR 0000200 +#define ICRNL 0000400 +#define IXON 0001000 +#define IXOFF 0002000 +#define IXANY 0004000 +#define IUCLC 0010000 +#define IMAXBEL 0020000 +#define IUTF8 0040000 + +/* c_oflag bits */ +#define OPOST 0000001 +#define ONLCR 0000002 +#define OLCUC 0000004 + +#define OCRNL 0000010 +#define ONOCR 0000020 +#define ONLRET 0000040 + +#define OFILL 00000100 +#define OFDEL 00000200 +#define NLDLY 00001400 +#define NL0 00000000 +#define NL1 00000400 +#define NL2 00001000 +#define NL3 00001400 +#define TABDLY 00006000 +#define TAB0 00000000 +#define TAB1 00002000 +#define TAB2 00004000 +#define TAB3 00006000 +#define XTABS 00006000 /* required by POSIX to == TAB3 */ +#define CRDLY 00030000 +#define CR0 00000000 +#define CR1 00010000 +#define CR2 00020000 +#define CR3 00030000 +#define FFDLY 00040000 +#define FF0 00000000 +#define FF1 00040000 +#define BSDLY 00100000 +#define BS0 00000000 +#define BS1 00100000 +#define VTDLY 00200000 +#define VT0 00000000 +#define VT1 00200000 + +/* c_cflag bit meaning */ +#define CBAUD 0000377 +#define B0 0000000 /* hang up */ +#define B50 0000001 +#define B75 0000002 +#define B110 0000003 +#define B134 0000004 +#define B150 0000005 +#define B200 0000006 +#define B300 0000007 +#define B600 0000010 +#define B1200 0000011 +#define B1800 0000012 +#define B2400 0000013 +#define B4800 0000014 +#define B9600 0000015 +#define B19200 0000016 +#define B38400 0000017 +#define EXTA B19200 +#define EXTB B38400 +#define CBAUDEX 0000000 +#define B57600 00020 +#define B115200 00021 +#define B230400 00022 +#define B460800 00023 +#define B500000 00024 +#define B576000 00025 +#define B921600 00026 +#define B1000000 00027 +#define B1152000 00030 +#define B1500000 00031 +#define B2000000 00032 +#define B2500000 00033 +#define B3000000 00034 +#define B3500000 00035 +#define B4000000 00036 + +#define CSIZE 00001400 +#define CS5 00000000 +#define CS6 00000400 +#define CS7 00001000 +#define CS8 00001400 + +#define CSTOPB 00002000 +#define CREAD 00004000 +#define PARENB 00010000 +#define PARODD 00020000 +#define HUPCL 00040000 + +#define CLOCAL 00100000 +#define CRTSCTS 020000000000 /* flow control */ + +/* c_lflag bits */ +#define ISIG 0x00000080 +#define ICANON 0x00000100 +#define XCASE 0x00004000 +#define ECHO 0x00000008 +#define ECHOE 0x00000002 +#define ECHOK 0x00000004 +#define ECHONL 0x00000010 +#define NOFLSH 0x80000000 +#define TOSTOP 0x00400000 +#define ECHOCTL 0x00000040 +#define ECHOPRT 0x00000020 +#define ECHOKE 0x00000001 +#define FLUSHO 0x00800000 +#define PENDIN 0x20000000 +#define IEXTEN 0x00000400 + +/* Values for the ACTION argument to `tcflow'. */ +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + +/* Values for the QUEUE_SELECTOR argument to `tcflush'. */ +#define TCIFLUSH 0 +#define TCOFLUSH 1 +#define TCIOFLUSH 2 + +/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */ +#define TCSANOW 0 +#define TCSADRAIN 1 +#define TCSAFLUSH 2 + +#endif /* _ASM_TERMBITS_H */ diff -ruNp linus-powerpc.1a/include/asm-powerpc/termios.h linus-powerpc.2/include/asm-powerpc/termios.h --- linus-powerpc.1a/include/asm-powerpc/termios.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-powerpc.2/include/asm-powerpc/termios.h 2005-08-05 15:04:55.000000000 +1000 @@ -0,0 +1,231 @@ +#ifndef _ASM_TERMIOS_H +#define _ASM_TERMIOS_H + +/* + * Liberally adapted from alpha/termios.h. In particular, the c_cc[] + * fields have been reordered so that termio & termios share the + * common subset in the same order (for brain dead programs that don't + * know or care about the differences). + */ + +#include +#include + +struct sgttyb { + char sg_ispeed; + char sg_ospeed; + char sg_erase; + char sg_kill; + short sg_flags; +}; + +struct tchars { + char t_intrc; + char t_quitc; + char t_startc; + char t_stopc; + char t_eofc; + char t_brkc; +}; + +struct ltchars { + char t_suspc; + char t_dsuspc; + char t_rprntc; + char t_flushc; + char t_werasc; + char t_lnextc; +}; + +struct winsize { + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; +}; + +#define NCC 10 +struct termio { + unsigned short c_iflag; /* input mode flags */ + unsigned short c_oflag; /* output mode flags */ + unsigned short c_cflag; /* control mode flags */ + unsigned short c_lflag; /* local mode flags */ + unsigned char c_line; /* line discipline */ + unsigned char c_cc[NCC]; /* control characters */ +}; + +/* c_cc characters */ +#define _VINTR 0 +#define _VQUIT 1 +#define _VERASE 2 +#define _VKILL 3 +#define _VEOF 4 +#define _VMIN 5 +#define _VEOL 6 +#define _VTIME 7 +#define _VEOL2 8 +#define _VSWTC 9 + +/* line disciplines */ +#define N_TTY 0 +#define N_SLIP 1 +#define N_MOUSE 2 +#define N_PPP 3 +#define N_STRIP 4 +#define N_AX25 5 +#define N_X25 6 /* X.25 async */ +#define N_6PACK 7 +#define N_MASC 8 /* Reserved for Mobitex module */ +#define N_R3964 9 /* Reserved for Simatic R3964 module */ +#define N_PROFIBUS_FDL 10 /* Reserved for Profibus */ +#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */ +#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ +#define N_HDLC 13 /* synchronous HDLC */ +#define N_SYNC_PPP 14 +#define N_HCI 15 /* Bluetooth HCI UART */ + +#ifdef __KERNEL__ +/* ^C ^\ del ^U ^D 1 0 0 0 0 ^W ^R ^Z ^Q ^S ^V ^U */ +#define INIT_C_CC "\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025" +#endif /* __KERNEL__ */ + +#define FIOCLEX _IO('f', 1) +#define FIONCLEX _IO('f', 2) +#define FIOASYNC _IOW('f', 125, int) +#define FIONBIO _IOW('f', 126, int) +#define FIONREAD _IOR('f', 127, int) +#define TIOCINQ FIONREAD + +#define TIOCGETP _IOR('t', 8, struct sgttyb) +#define TIOCSETP _IOW('t', 9, struct sgttyb) +#define TIOCSETN _IOW('t', 10, struct sgttyb) /* TIOCSETP wo flush */ + +#define TIOCSETC _IOW('t', 17, struct tchars) +#define TIOCGETC _IOR('t', 18, struct tchars) +#define TCGETS _IOR('t', 19, struct termios) +#define TCSETS _IOW('t', 20, struct termios) +#define TCSETSW _IOW('t', 21, struct termios) +#define TCSETSF _IOW('t', 22, struct termios) + +#define TCGETA _IOR('t', 23, struct termio) +#define TCSETA _IOW('t', 24, struct termio) +#define TCSETAW _IOW('t', 25, struct termio) +#define TCSETAF _IOW('t', 28, struct termio) + +#define TCSBRK _IO('t', 29) +#define TCXONC _IO('t', 30) +#define TCFLSH _IO('t', 31) + +#define TIOCSWINSZ _IOW('t', 103, struct winsize) +#define TIOCGWINSZ _IOR('t', 104, struct winsize) +#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ +#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ +#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ + +#define TIOCGLTC _IOR('t', 116, struct ltchars) +#define TIOCSLTC _IOW('t', 117, struct ltchars) +#define TIOCSPGRP _IOW('t', 118, int) +#define TIOCGPGRP _IOR('t', 119, int) + +#define TIOCEXCL 0x540C +#define TIOCNXCL 0x540D +#define TIOCSCTTY 0x540E + +#define TIOCSTI 0x5412 +#define TIOCMGET 0x5415 +#define TIOCMBIS 0x5416 +#define TIOCMBIC 0x5417 +#define TIOCMSET 0x5418 +#define TIOCGSOFTCAR 0x5419 +#define TIOCSSOFTCAR 0x541A +#define TIOCLINUX 0x541C +#define TIOCCONS 0x541D +#define TIOCGSERIAL 0x541E +#define TIOCSSERIAL 0x541F +#define TIOCPKT 0x5420 + +#define TIOCNOTTY 0x5422 +#define TIOCSETD 0x5423 +#define TIOCGETD 0x5424 +#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ + +#define TIOCSERCONFIG 0x5453 +#define TIOCSERGWILD 0x5454 +#define TIOCSERSWILD 0x5455 +#define TIOCGLCKTRMIOS 0x5456 +#define TIOCSLCKTRMIOS 0x5457 +#define TIOCSERGSTRUCT 0x5458 /* For debugging only */ +#define TIOCSERGETLSR 0x5459 /* Get line status register */ +#define TIOCSERGETMULTI 0x545A /* Get multiport config */ +#define TIOCSERSETMULTI 0x545B /* Set multiport config */ + +#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ +#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ + +/* Used for packet mode */ +#define TIOCPKT_DATA 0 +#define TIOCPKT_FLUSHREAD 1 +#define TIOCPKT_FLUSHWRITE 2 +#define TIOCPKT_STOP 4 +#define TIOCPKT_START 8 +#define TIOCPKT_NOSTOP 16 +#define TIOCPKT_DOSTOP 32 + +/* modem lines */ +#define TIOCM_LE 0x001 +#define TIOCM_DTR 0x002 +#define TIOCM_RTS 0x004 +#define TIOCM_ST 0x008 +#define TIOCM_SR 0x010 +#define TIOCM_CTS 0x020 +#define TIOCM_CAR 0x040 +#define TIOCM_RNG 0x080 +#define TIOCM_DSR 0x100 +#define TIOCM_CD TIOCM_CAR +#define TIOCM_RI TIOCM_RNG +#define TIOCM_OUT1 0x2000 +#define TIOCM_OUT2 0x4000 +#define TIOCM_LOOP 0x8000 + +/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ +#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ + +#ifdef __KERNEL__ + +/* + * Translate a "termio" structure into a "termios". Ugh. + */ +#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \ + unsigned short __tmp; \ + get_user(__tmp,&(termio)->x); \ + (termios)->x = (0xffff0000 & (termios)->x) | __tmp; \ +} + +#define user_termio_to_kernel_termios(termios, termio) \ +({ \ + SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \ + SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \ + SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \ + SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \ + copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ +}) + +/* + * Translate a "termios" structure into a "termio". Ugh. + */ +#define kernel_termios_to_user_termio(termio, termios) \ +({ \ + put_user((termios)->c_iflag, &(termio)->c_iflag); \ + put_user((termios)->c_oflag, &(termio)->c_oflag); \ + put_user((termios)->c_cflag, &(termio)->c_cflag); \ + put_user((termios)->c_lflag, &(termio)->c_lflag); \ + put_user((termios)->c_line, &(termio)->c_line); \ + copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ +}) + +#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) +#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) + +#endif /* __KERNEL__ */ + +#endif /* _ASM_TERMIOS_H */ diff -ruNp linus-powerpc.1a/include/asm-powerpc/unaligned.h linus-powerpc.2/include/asm-powerpc/unaligned.h --- linus-powerpc.1a/include/asm-powerpc/unaligned.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-powerpc.2/include/asm-powerpc/unaligned.h 2005-08-05 15:04:55.000000000 +1000 @@ -0,0 +1,18 @@ +#ifdef __KERNEL__ +#ifndef _ASM_UNALIGNED_H +#define _ASM_UNALIGNED_H + +/* + * The PowerPC can do unaligned accesses itself in big endian mode. + * + * The strange macros are there to make sure these can't + * be misused in a way that makes them not work on other + * architectures where unaligned accesses aren't as simple. + */ + +#define get_unaligned(ptr) (*(ptr)) + +#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) + +#endif /* _ASM_UNALIGNED_H */ +#endif /* __KERNEL__ */ diff -ruNp linus-powerpc.1a/include/asm-ppc/div64.h linus-powerpc.2/include/asm-ppc/div64.h --- linus-powerpc.1a/include/asm-ppc/div64.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc/div64.h 2005-06-27 16:08:08.000000000 +1000 @@ -0,0 +1 @@ +#include diff -ruNp linus-powerpc.1a/include/asm-ppc/errno.h linus-powerpc.2/include/asm-ppc/errno.h --- linus-powerpc.1a/include/asm-ppc/errno.h 2005-06-27 16:08:08.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc/errno.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,11 +0,0 @@ -#ifndef _PPC_ERRNO_H -#define _PPC_ERRNO_H - -#include - -#undef EDEADLOCK -#define EDEADLOCK 58 /* File locking deadlock error */ - -#define _LAST_ERRNO 516 - -#endif diff -ruNp linus-powerpc.1a/include/asm-ppc/ioctl.h linus-powerpc.2/include/asm-ppc/ioctl.h --- linus-powerpc.1a/include/asm-ppc/ioctl.h 2005-06-27 16:08:08.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc/ioctl.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,69 +0,0 @@ -#ifndef _PPC_IOCTL_H -#define _PPC_IOCTL_H - - -/* - * this was copied from the alpha as it's a bit cleaner there. - * -- Cort - */ - -#define _IOC_NRBITS 8 -#define _IOC_TYPEBITS 8 -#define _IOC_SIZEBITS 13 -#define _IOC_DIRBITS 3 - -#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) -#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) -#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) -#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) - -#define _IOC_NRSHIFT 0 -#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) -#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) -#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) - -/* - * Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit. - * And this turns out useful to catch old ioctl numbers in header - * files for us. - */ -#define _IOC_NONE 1U -#define _IOC_READ 2U -#define _IOC_WRITE 4U - -#define _IOC(dir,type,nr,size) \ - (((dir) << _IOC_DIRSHIFT) | \ - ((type) << _IOC_TYPESHIFT) | \ - ((nr) << _IOC_NRSHIFT) | \ - ((size) << _IOC_SIZESHIFT)) - -/* provoke compile error for invalid uses of size argument */ -extern unsigned int __invalid_size_argument_for_IOC; -#define _IOC_TYPECHECK(t) \ - ((sizeof(t) == sizeof(t[1]) && \ - sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ - sizeof(t) : __invalid_size_argument_for_IOC) - -/* used to create numbers */ -#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) -#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) -#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) -#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) -#define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) -#define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) -#define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) - -/* used to decode them.. */ -#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) -#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) -#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) -#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) - -/* various drivers, such as the pcmcia stuff, need these... */ -#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) -#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) -#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) -#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) -#define IOCSIZE_SHIFT (_IOC_SIZESHIFT) - -#endif diff -ruNp linus-powerpc.1a/include/asm-ppc/ioctls.h linus-powerpc.2/include/asm-ppc/ioctls.h --- linus-powerpc.1a/include/asm-ppc/ioctls.h 2005-06-27 16:08:08.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc/ioctls.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,107 +0,0 @@ -#ifndef _ASM_PPC_IOCTLS_H -#define _ASM_PPC_IOCTLS_H - -#include - -#define FIOCLEX _IO('f', 1) -#define FIONCLEX _IO('f', 2) -#define FIOASYNC _IOW('f', 125, int) -#define FIONBIO _IOW('f', 126, int) -#define FIONREAD _IOR('f', 127, int) -#define TIOCINQ FIONREAD -#define FIOQSIZE _IOR('f', 128, loff_t) - -#define TIOCGETP _IOR('t', 8, struct sgttyb) -#define TIOCSETP _IOW('t', 9, struct sgttyb) -#define TIOCSETN _IOW('t', 10, struct sgttyb) /* TIOCSETP wo flush */ - -#define TIOCSETC _IOW('t', 17, struct tchars) -#define TIOCGETC _IOR('t', 18, struct tchars) -#define TCGETS _IOR('t', 19, struct termios) -#define TCSETS _IOW('t', 20, struct termios) -#define TCSETSW _IOW('t', 21, struct termios) -#define TCSETSF _IOW('t', 22, struct termios) - -#define TCGETA _IOR('t', 23, struct termio) -#define TCSETA _IOW('t', 24, struct termio) -#define TCSETAW _IOW('t', 25, struct termio) -#define TCSETAF _IOW('t', 28, struct termio) - -#define TCSBRK _IO('t', 29) -#define TCXONC _IO('t', 30) -#define TCFLSH _IO('t', 31) - -#define TIOCSWINSZ _IOW('t', 103, struct winsize) -#define TIOCGWINSZ _IOR('t', 104, struct winsize) -#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ -#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ -#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ - -#define TIOCGLTC _IOR('t', 116, struct ltchars) -#define TIOCSLTC _IOW('t', 117, struct ltchars) -#define TIOCSPGRP _IOW('t', 118, int) -#define TIOCGPGRP _IOR('t', 119, int) - -#define TIOCEXCL 0x540C -#define TIOCNXCL 0x540D -#define TIOCSCTTY 0x540E - -#define TIOCSTI 0x5412 -#define TIOCMGET 0x5415 -#define TIOCMBIS 0x5416 -#define TIOCMBIC 0x5417 -#define TIOCMSET 0x5418 -# define TIOCM_LE 0x001 -# define TIOCM_DTR 0x002 -# define TIOCM_RTS 0x004 -# define TIOCM_ST 0x008 -# define TIOCM_SR 0x010 -# define TIOCM_CTS 0x020 -# define TIOCM_CAR 0x040 -# define TIOCM_RNG 0x080 -# define TIOCM_DSR 0x100 -# define TIOCM_CD TIOCM_CAR -# define TIOCM_RI TIOCM_RNG - -#define TIOCGSOFTCAR 0x5419 -#define TIOCSSOFTCAR 0x541A -#define TIOCLINUX 0x541C -#define TIOCCONS 0x541D -#define TIOCGSERIAL 0x541E -#define TIOCSSERIAL 0x541F -#define TIOCPKT 0x5420 -# define TIOCPKT_DATA 0 -# define TIOCPKT_FLUSHREAD 1 -# define TIOCPKT_FLUSHWRITE 2 -# define TIOCPKT_STOP 4 -# define TIOCPKT_START 8 -# define TIOCPKT_NOSTOP 16 -# define TIOCPKT_DOSTOP 32 - - -#define TIOCNOTTY 0x5422 -#define TIOCSETD 0x5423 -#define TIOCGETD 0x5424 -#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ -#define TIOCSBRK 0x5427 /* BSD compatibility */ -#define TIOCCBRK 0x5428 /* BSD compatibility */ -#define TIOCGSID 0x5429 /* Return the session ID of FD */ -#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ -#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ - -#define TIOCSERCONFIG 0x5453 -#define TIOCSERGWILD 0x5454 -#define TIOCSERSWILD 0x5455 -#define TIOCGLCKTRMIOS 0x5456 -#define TIOCSLCKTRMIOS 0x5457 -#define TIOCSERGSTRUCT 0x5458 /* For debugging only */ -#define TIOCSERGETLSR 0x5459 /* Get line status register */ - /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ -# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ -#define TIOCSERGETMULTI 0x545A /* Get multiport config */ -#define TIOCSERSETMULTI 0x545B /* Set multiport config */ - -#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ -#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ - -#endif /* _ASM_PPC_IOCTLS_H */ diff -ruNp linus-powerpc.1a/include/asm-ppc/local.h linus-powerpc.2/include/asm-ppc/local.h --- linus-powerpc.1a/include/asm-ppc/local.h 2005-06-27 16:08:08.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc/local.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,6 +0,0 @@ -#ifndef __PPC_LOCAL_H -#define __PPC_LOCAL_H - -#include - -#endif /* __PPC_LOCAL_H */ diff -ruNp linus-powerpc.1a/include/asm-ppc/mman.h linus-powerpc.2/include/asm-ppc/mman.h --- linus-powerpc.1a/include/asm-ppc/mman.h 2005-06-27 16:08:08.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc/mman.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,44 +0,0 @@ -#ifndef __PPC_MMAN_H__ -#define __PPC_MMAN_H__ - -#define PROT_READ 0x1 /* page can be read */ -#define PROT_WRITE 0x2 /* page can be written */ -#define PROT_EXEC 0x4 /* page can be executed */ -#define PROT_SEM 0x8 /* page may be used for atomic ops */ -#define PROT_NONE 0x0 /* page can not be accessed */ -#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ -#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ - -#define MAP_SHARED 0x01 /* Share changes */ -#define MAP_PRIVATE 0x02 /* Changes are private */ -#define MAP_TYPE 0x0f /* Mask for type of mapping */ -#define MAP_FIXED 0x10 /* Interpret addr exactly */ -#define MAP_ANONYMOUS 0x20 /* don't use a file */ -#define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */ -#define MAP_NORESERVE 0x40 /* don't reserve swap pages */ -#define MAP_LOCKED 0x80 - -#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ -#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ -#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ -#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ -#define MAP_NONBLOCK 0x10000 /* do not block on IO */ - -#define MS_ASYNC 1 /* sync memory asynchronously */ -#define MS_INVALIDATE 2 /* invalidate the caches */ -#define MS_SYNC 4 /* synchronous memory sync */ - -#define MCL_CURRENT 0x2000 /* lock all currently mapped pages */ -#define MCL_FUTURE 0x4000 /* lock all additions to address space */ - -#define MADV_NORMAL 0x0 /* default page-in behavior */ -#define MADV_RANDOM 0x1 /* page-in minimum required */ -#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ -#define MADV_WILLNEED 0x3 /* pre-fault pages */ -#define MADV_DONTNEED 0x4 /* discard these pages */ - -/* compatibility flags */ -#define MAP_ANON MAP_ANONYMOUS -#define MAP_FILE 0 - -#endif /* __PPC_MMAN_H__ */ diff -ruNp linus-powerpc.1a/include/asm-ppc/param.h linus-powerpc.2/include/asm-ppc/param.h --- linus-powerpc.1a/include/asm-ppc/param.h 2005-06-27 16:08:08.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc/param.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,22 +0,0 @@ -#ifndef _ASM_PPC_PARAM_H -#define _ASM_PPC_PARAM_H - -#ifdef __KERNEL__ -#define HZ 1000 /* internal timer frequency */ -#define USER_HZ 100 /* for user interfaces in "ticks" */ -#define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */ -#endif /* __KERNEL__ */ - -#ifndef HZ -#define HZ 100 -#endif - -#define EXEC_PAGESIZE 4096 - -#ifndef NOGROUP -#define NOGROUP (-1) -#endif - -#define MAXHOSTNAMELEN 64 /* max length of hostname */ - -#endif diff -ruNp linus-powerpc.1a/include/asm-ppc/parport.h linus-powerpc.2/include/asm-ppc/parport.h --- linus-powerpc.1a/include/asm-ppc/parport.h 2005-06-27 16:08:08.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc/parport.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,18 +0,0 @@ -/* - * parport.h: platform-specific PC-style parport initialisation - * - * Copyright (C) 1999, 2000 Tim Waugh - * - * This file should only be included by drivers/parport/parport_pc.c. - */ - -#ifndef _ASM_PPC_PARPORT_H -#define _ASM_PPC_PARPORT_H - -static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma); -static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) -{ - return parport_pc_find_isa_ports (autoirq, autodma); -} - -#endif /* !(_ASM_PPC_PARPORT_H) */ diff -ruNp linus-powerpc.1a/include/asm-ppc/percpu.h linus-powerpc.2/include/asm-ppc/percpu.h --- linus-powerpc.1a/include/asm-ppc/percpu.h 2005-06-27 16:08:08.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc/percpu.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,6 +0,0 @@ -#ifndef __ARCH_PPC_PERCPU__ -#define __ARCH_PPC_PERCPU__ - -#include - -#endif /* __ARCH_PPC_PERCPU__ */ diff -ruNp linus-powerpc.1a/include/asm-ppc/poll.h linus-powerpc.2/include/asm-ppc/poll.h --- linus-powerpc.1a/include/asm-ppc/poll.h 2005-06-27 16:08:08.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc/poll.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,23 +0,0 @@ -#ifndef __PPC_POLL_H -#define __PPC_POLL_H - -#define POLLIN 0x0001 -#define POLLPRI 0x0002 -#define POLLOUT 0x0004 -#define POLLERR 0x0008 -#define POLLHUP 0x0010 -#define POLLNVAL 0x0020 -#define POLLRDNORM 0x0040 -#define POLLRDBAND 0x0080 -#define POLLWRNORM 0x0100 -#define POLLWRBAND 0x0200 -#define POLLMSG 0x0400 -#define POLLREMOVE 0x1000 - -struct pollfd { - int fd; - short events; - short revents; -}; - -#endif diff -ruNp linus-powerpc.1a/include/asm-ppc/resource.h linus-powerpc.2/include/asm-ppc/resource.h --- linus-powerpc.1a/include/asm-ppc/resource.h 2005-06-27 16:08:08.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc/resource.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,6 +0,0 @@ -#ifndef _PPC_RESOURCE_H -#define _PPC_RESOURCE_H - -#include - -#endif diff -ruNp linus-powerpc.1a/include/asm-ppc/shmparam.h linus-powerpc.2/include/asm-ppc/shmparam.h --- linus-powerpc.1a/include/asm-ppc/shmparam.h 2005-06-27 16:08:08.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc/shmparam.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,6 +0,0 @@ -#ifndef _PPC_SHMPARAM_H -#define _PPC_SHMPARAM_H - -#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ - -#endif /* _PPC_SHMPARAM_H */ diff -ruNp linus-powerpc.1a/include/asm-ppc/string.h linus-powerpc.2/include/asm-ppc/string.h --- linus-powerpc.1a/include/asm-ppc/string.h 2005-06-27 16:08:08.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc/string.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,32 +0,0 @@ -#ifndef _PPC_STRING_H_ -#define _PPC_STRING_H_ - -#ifdef __KERNEL__ - -#define __HAVE_ARCH_STRCPY -#define __HAVE_ARCH_STRNCPY -#define __HAVE_ARCH_STRLEN -#define __HAVE_ARCH_STRCMP -#define __HAVE_ARCH_STRCAT -#define __HAVE_ARCH_MEMSET -#define __HAVE_ARCH_MEMCPY -#define __HAVE_ARCH_MEMMOVE -#define __HAVE_ARCH_MEMCMP -#define __HAVE_ARCH_MEMCHR - -extern int strcasecmp(const char *, const char *); -extern int strncasecmp(const char *, const char *, int); -extern char * strcpy(char *,const char *); -extern char * strncpy(char *,const char *, __kernel_size_t); -extern __kernel_size_t strlen(const char *); -extern int strcmp(const char *,const char *); -extern char * strcat(char *, const char *); -extern void * memset(void *,int,__kernel_size_t); -extern void * memcpy(void *,const void *,__kernel_size_t); -extern void * memmove(void *,const void *,__kernel_size_t); -extern int memcmp(const void *,const void *,__kernel_size_t); -extern void * memchr(const void *,int,__kernel_size_t); - -#endif /* __KERNEL__ */ - -#endif diff -ruNp linus-powerpc.1a/include/asm-ppc/termbits.h linus-powerpc.2/include/asm-ppc/termbits.h --- linus-powerpc.1a/include/asm-ppc/termbits.h 2005-06-27 16:08:08.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc/termbits.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,185 +0,0 @@ -#ifndef _PPC_TERMBITS_H -#define _PPC_TERMBITS_H - -typedef unsigned char cc_t; -typedef unsigned int speed_t; -typedef unsigned int tcflag_t; - -/* - * termios type and macro definitions. Be careful about adding stuff - * to this file since it's used in GNU libc and there are strict rules - * concerning namespace pollution. - */ - -#define NCCS 19 -struct termios { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - cc_t c_cc[NCCS]; /* control characters */ - cc_t c_line; /* line discipline (== c_cc[19]) */ - speed_t c_ispeed; /* input speed */ - speed_t c_ospeed; /* output speed */ -}; - -/* c_cc characters */ -#define VINTR 0 -#define VQUIT 1 -#define VERASE 2 -#define VKILL 3 -#define VEOF 4 -#define VMIN 5 -#define VEOL 6 -#define VTIME 7 -#define VEOL2 8 -#define VSWTC 9 - -#define VWERASE 10 -#define VREPRINT 11 -#define VSUSP 12 -#define VSTART 13 -#define VSTOP 14 -#define VLNEXT 15 -#define VDISCARD 16 - -/* c_iflag bits */ -#define IGNBRK 0000001 -#define BRKINT 0000002 -#define IGNPAR 0000004 -#define PARMRK 0000010 -#define INPCK 0000020 -#define ISTRIP 0000040 -#define INLCR 0000100 -#define IGNCR 0000200 -#define ICRNL 0000400 -#define IXON 0001000 -#define IXOFF 0002000 -#define IXANY 0004000 -#define IUCLC 0010000 -#define IMAXBEL 0020000 -#define IUTF8 0040000 - -/* c_oflag bits */ -#define OPOST 0000001 -#define ONLCR 0000002 -#define OLCUC 0000004 - -#define OCRNL 0000010 -#define ONOCR 0000020 -#define ONLRET 0000040 - -#define OFILL 00000100 -#define OFDEL 00000200 -#define NLDLY 00001400 -#define NL0 00000000 -#define NL1 00000400 -#define NL2 00001000 -#define NL3 00001400 -#define TABDLY 00006000 -#define TAB0 00000000 -#define TAB1 00002000 -#define TAB2 00004000 -#define TAB3 00006000 -#define XTABS 00006000 /* required by POSIX to == TAB3 */ -#define CRDLY 00030000 -#define CR0 00000000 -#define CR1 00010000 -#define CR2 00020000 -#define CR3 00030000 -#define FFDLY 00040000 -#define FF0 00000000 -#define FF1 00040000 -#define BSDLY 00100000 -#define BS0 00000000 -#define BS1 00100000 -#define VTDLY 00200000 -#define VT0 00000000 -#define VT1 00200000 - -/* c_cflag bit meaning */ -#define CBAUD 0000377 -#define B0 0000000 /* hang up */ -#define B50 0000001 -#define B75 0000002 -#define B110 0000003 -#define B134 0000004 -#define B150 0000005 -#define B200 0000006 -#define B300 0000007 -#define B600 0000010 -#define B1200 0000011 -#define B1800 0000012 -#define B2400 0000013 -#define B4800 0000014 -#define B9600 0000015 -#define B19200 0000016 -#define B38400 0000017 -#define EXTA B19200 -#define EXTB B38400 -#define CBAUDEX 0000000 -#define B57600 00020 -#define B115200 00021 -#define B230400 00022 -#define B460800 00023 -#define B500000 00024 -#define B576000 00025 -#define B921600 00026 -#define B1000000 00027 -#define B1152000 00030 -#define B1500000 00031 -#define B2000000 00032 -#define B2500000 00033 -#define B3000000 00034 -#define B3500000 00035 -#define B4000000 00036 - -#define CSIZE 00001400 -#define CS5 00000000 -#define CS6 00000400 -#define CS7 00001000 -#define CS8 00001400 - -#define CSTOPB 00002000 -#define CREAD 00004000 -#define PARENB 00010000 -#define PARODD 00020000 -#define HUPCL 00040000 - -#define CLOCAL 00100000 -#define CRTSCTS 020000000000 /* flow control */ - -/* c_lflag bits */ -#define ISIG 0x00000080 -#define ICANON 0x00000100 -#define XCASE 0x00004000 -#define ECHO 0x00000008 -#define ECHOE 0x00000002 -#define ECHOK 0x00000004 -#define ECHONL 0x00000010 -#define NOFLSH 0x80000000 -#define TOSTOP 0x00400000 -#define ECHOCTL 0x00000040 -#define ECHOPRT 0x00000020 -#define ECHOKE 0x00000001 -#define FLUSHO 0x00800000 -#define PENDIN 0x20000000 -#define IEXTEN 0x00000400 - -/* Values for the ACTION argument to `tcflow'. */ -#define TCOOFF 0 -#define TCOON 1 -#define TCIOFF 2 -#define TCION 3 - -/* Values for the QUEUE_SELECTOR argument to `tcflush'. */ -#define TCIFLUSH 0 -#define TCOFLUSH 1 -#define TCIOFLUSH 2 - -/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */ -#define TCSANOW 0 -#define TCSADRAIN 1 -#define TCSAFLUSH 2 - -#endif /* _PPC_TERMBITS_H */ diff -ruNp linus-powerpc.1a/include/asm-ppc/termios.h linus-powerpc.2/include/asm-ppc/termios.h --- linus-powerpc.1a/include/asm-ppc/termios.h 2005-06-27 16:08:08.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc/termios.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,232 +0,0 @@ -#ifndef _PPC_TERMIOS_H -#define _PPC_TERMIOS_H - -/* - * Liberally adapted from alpha/termios.h. In particular, the c_cc[] - * fields have been reordered so that termio & termios share the - * common subset in the same order (for brain dead programs that don't - * know or care about the differences). - */ - -#include -#include - -struct sgttyb { - char sg_ispeed; - char sg_ospeed; - char sg_erase; - char sg_kill; - short sg_flags; -}; - -struct tchars { - char t_intrc; - char t_quitc; - char t_startc; - char t_stopc; - char t_eofc; - char t_brkc; -}; - -struct ltchars { - char t_suspc; - char t_dsuspc; - char t_rprntc; - char t_flushc; - char t_werasc; - char t_lnextc; -}; - -#define FIOCLEX _IO('f', 1) -#define FIONCLEX _IO('f', 2) -#define FIOASYNC _IOW('f', 125, int) -#define FIONBIO _IOW('f', 126, int) -#define FIONREAD _IOR('f', 127, int) -#define TIOCINQ FIONREAD -#define FIOQSIZE _IOR('f', 128, loff_t) - -#define TIOCGETP _IOR('t', 8, struct sgttyb) -#define TIOCSETP _IOW('t', 9, struct sgttyb) -#define TIOCSETN _IOW('t', 10, struct sgttyb) /* TIOCSETP wo flush */ - -#define TIOCSETC _IOW('t', 17, struct tchars) -#define TIOCGETC _IOR('t', 18, struct tchars) -#define TCGETS _IOR('t', 19, struct termios) -#define TCSETS _IOW('t', 20, struct termios) -#define TCSETSW _IOW('t', 21, struct termios) -#define TCSETSF _IOW('t', 22, struct termios) - -#define TCGETA _IOR('t', 23, struct termio) -#define TCSETA _IOW('t', 24, struct termio) -#define TCSETAW _IOW('t', 25, struct termio) -#define TCSETAF _IOW('t', 28, struct termio) - -#define TCSBRK _IO('t', 29) -#define TCXONC _IO('t', 30) -#define TCFLSH _IO('t', 31) - -#define TIOCSWINSZ _IOW('t', 103, struct winsize) -#define TIOCGWINSZ _IOR('t', 104, struct winsize) -#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ -#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ -#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ - -#define TIOCGLTC _IOR('t', 116, struct ltchars) -#define TIOCSLTC _IOW('t', 117, struct ltchars) -#define TIOCSPGRP _IOW('t', 118, int) -#define TIOCGPGRP _IOR('t', 119, int) - -#define TIOCEXCL 0x540C -#define TIOCNXCL 0x540D -#define TIOCSCTTY 0x540E - -#define TIOCSTI 0x5412 -#define TIOCMGET 0x5415 -#define TIOCMBIS 0x5416 -#define TIOCMBIC 0x5417 -#define TIOCMSET 0x5418 -#define TIOCGSOFTCAR 0x5419 -#define TIOCSSOFTCAR 0x541A -#define TIOCLINUX 0x541C -#define TIOCCONS 0x541D -#define TIOCGSERIAL 0x541E -#define TIOCSSERIAL 0x541F -#define TIOCPKT 0x5420 - -#define TIOCNOTTY 0x5422 -#define TIOCSETD 0x5423 -#define TIOCGETD 0x5424 -#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ - -#define TIOCSERCONFIG 0x5453 -#define TIOCSERGWILD 0x5454 -#define TIOCSERSWILD 0x5455 -#define TIOCGLCKTRMIOS 0x5456 -#define TIOCSLCKTRMIOS 0x5457 -#define TIOCSERGSTRUCT 0x5458 /* For debugging only */ -#define TIOCSERGETLSR 0x5459 /* Get line status register */ -#define TIOCSERGETMULTI 0x545A /* Get multiport config */ -#define TIOCSERSETMULTI 0x545B /* Set multiport config */ - -#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ -#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ - -/* Used for packet mode */ -#define TIOCPKT_DATA 0 -#define TIOCPKT_FLUSHREAD 1 -#define TIOCPKT_FLUSHWRITE 2 -#define TIOCPKT_STOP 4 -#define TIOCPKT_START 8 -#define TIOCPKT_NOSTOP 16 -#define TIOCPKT_DOSTOP 32 - -struct winsize { - unsigned short ws_row; - unsigned short ws_col; - unsigned short ws_xpixel; - unsigned short ws_ypixel; -}; - -#define NCC 10 -struct termio { - unsigned short c_iflag; /* input mode flags */ - unsigned short c_oflag; /* output mode flags */ - unsigned short c_cflag; /* control mode flags */ - unsigned short c_lflag; /* local mode flags */ - unsigned char c_line; /* line discipline */ - unsigned char c_cc[NCC]; /* control characters */ -}; - -/* c_cc characters */ -#define _VINTR 0 -#define _VQUIT 1 -#define _VERASE 2 -#define _VKILL 3 -#define _VEOF 4 -#define _VMIN 5 -#define _VEOL 6 -#define _VTIME 7 -#define _VEOL2 8 -#define _VSWTC 9 - -#ifdef __KERNEL__ -/* ^C ^\ del ^U ^D 1 0 0 0 0 ^W ^R ^Z ^Q ^S ^V ^U */ -#define INIT_C_CC "\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025" -#endif /* __KERNEL__ */ - -/* modem lines */ -#define TIOCM_LE 0x001 -#define TIOCM_DTR 0x002 -#define TIOCM_RTS 0x004 -#define TIOCM_ST 0x008 -#define TIOCM_SR 0x010 -#define TIOCM_CTS 0x020 -#define TIOCM_CAR 0x040 -#define TIOCM_RNG 0x080 -#define TIOCM_DSR 0x100 -#define TIOCM_CD TIOCM_CAR -#define TIOCM_RI TIOCM_RNG -#define TIOCM_OUT1 0x2000 -#define TIOCM_OUT2 0x4000 -#define TIOCM_LOOP 0x8000 - -/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ -#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ - -/* line disciplines */ -#define N_TTY 0 -#define N_SLIP 1 -#define N_MOUSE 2 -#define N_PPP 3 -#define N_STRIP 4 -#define N_AX25 5 -#define N_X25 6 /* X.25 async */ -#define N_6PACK 7 -#define N_MASC 8 /* Reserved for Mobitex module */ -#define N_R3964 9 /* Reserved for Simatic R3964 module */ -#define N_PROFIBUS_FDL 10 /* Reserved for Profibus */ -#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */ -#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ -#define N_HDLC 13 /* synchronous HDLC */ -#define N_SYNC_PPP 14 -#define N_HCI 15 /* Bluetooth HCI UART */ - -#ifdef __KERNEL__ - -/* - * Translate a "termio" structure into a "termios". Ugh. - */ -#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \ - unsigned short __tmp; \ - get_user(__tmp,&(termio)->x); \ - (termios)->x = (0xffff0000 & (termios)->x) | __tmp; \ -} - -#define user_termio_to_kernel_termios(termios, termio) \ -({ \ - SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \ - SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \ - SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \ - SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \ - copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ -}) - -/* - * Translate a "termios" structure into a "termio". Ugh. - */ -#define kernel_termios_to_user_termio(termio, termios) \ -({ \ - put_user((termios)->c_iflag, &(termio)->c_iflag); \ - put_user((termios)->c_oflag, &(termio)->c_oflag); \ - put_user((termios)->c_cflag, &(termio)->c_cflag); \ - put_user((termios)->c_lflag, &(termio)->c_lflag); \ - put_user((termios)->c_line, &(termio)->c_line); \ - copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ -}) - -#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) -#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) - -#endif /* __KERNEL__ */ - -#endif /* _PPC_TERMIOS_H */ diff -ruNp linus-powerpc.1a/include/asm-ppc/unaligned.h linus-powerpc.2/include/asm-ppc/unaligned.h --- linus-powerpc.1a/include/asm-ppc/unaligned.h 2005-06-27 16:08:08.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc/unaligned.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,18 +0,0 @@ -#ifdef __KERNEL__ -#ifndef __PPC_UNALIGNED_H -#define __PPC_UNALIGNED_H - -/* - * The PowerPC can do unaligned accesses itself in big endian mode. - * - * The strange macros are there to make sure these can't - * be misused in a way that makes them not work on other - * architectures where unaligned accesses aren't as simple. - */ - -#define get_unaligned(ptr) (*(ptr)) - -#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) - -#endif -#endif /* __KERNEL__ */ diff -ruNp linus-powerpc.1a/include/asm-ppc64/div64.h linus-powerpc.2/include/asm-ppc64/div64.h --- linus-powerpc.1a/include/asm-ppc64/div64.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc64/div64.h 2005-06-27 16:08:08.000000000 +1000 @@ -0,0 +1 @@ +#include diff -ruNp linus-powerpc.1a/include/asm-ppc64/errno.h linus-powerpc.2/include/asm-ppc64/errno.h --- linus-powerpc.1a/include/asm-ppc64/errno.h 2005-06-27 17:55:59.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc64/errno.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,18 +0,0 @@ -#ifndef _PPC64_ERRNO_H -#define _PPC64_ERRNO_H - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include - -#undef EDEADLOCK -#define EDEADLOCK 58 /* File locking deadlock error */ - -#define _LAST_ERRNO 516 - -#endif diff -ruNp linus-powerpc.1a/include/asm-ppc64/ioctl.h linus-powerpc.2/include/asm-ppc64/ioctl.h --- linus-powerpc.1a/include/asm-ppc64/ioctl.h 2005-06-27 17:55:59.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc64/ioctl.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,74 +0,0 @@ -#ifndef _PPC64_IOCTL_H -#define _PPC64_IOCTL_H - - -/* - * This was copied from the alpha as it's a bit cleaner there. - * -- Cort - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#define _IOC_NRBITS 8 -#define _IOC_TYPEBITS 8 -#define _IOC_SIZEBITS 13 -#define _IOC_DIRBITS 3 - -#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) -#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) -#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) -#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) - -#define _IOC_NRSHIFT 0 -#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) -#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) -#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) - -/* - * Direction bits _IOC_NONE could be 0, but OSF/1 gives it a bit. - * And this turns out useful to catch old ioctl numbers in header - * files for us. - */ -#define _IOC_NONE 1U -#define _IOC_READ 2U -#define _IOC_WRITE 4U - -#define _IOC(dir,type,nr,size) \ - (((dir) << _IOC_DIRSHIFT) | \ - ((type) << _IOC_TYPESHIFT) | \ - ((nr) << _IOC_NRSHIFT) | \ - ((size) << _IOC_SIZESHIFT)) - -/* provoke compile error for invalid uses of size argument */ -extern unsigned int __invalid_size_argument_for_IOC; -#define _IOC_TYPECHECK(t) \ - ((sizeof(t) == sizeof(t[1]) && \ - sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ - sizeof(t) : __invalid_size_argument_for_IOC) - -/* used to create numbers */ -#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) -#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) -#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) -#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) -#define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) -#define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) -#define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) - -/* used to decode them.. */ -#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) -#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) -#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) -#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) - -/* various drivers, such as the pcmcia stuff, need these... */ -#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) -#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) -#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) -#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT) -#define IOCSIZE_SHIFT (_IOC_SIZESHIFT) - -#endif /* _PPC64_IOCTL_H */ diff -ruNp linus-powerpc.1a/include/asm-ppc64/ioctls.h linus-powerpc.2/include/asm-ppc64/ioctls.h --- linus-powerpc.1a/include/asm-ppc64/ioctls.h 2005-06-27 17:55:59.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc64/ioctls.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,114 +0,0 @@ -#ifndef _ASM_PPC64_IOCTLS_H -#define _ASM_PPC64_IOCTLS_H - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include - -#define FIOCLEX _IO('f', 1) -#define FIONCLEX _IO('f', 2) -#define FIOASYNC _IOW('f', 125, int) -#define FIONBIO _IOW('f', 126, int) -#define FIONREAD _IOR('f', 127, int) -#define TIOCINQ FIONREAD -#define FIOQSIZE _IOR('f', 128, loff_t) - -#define TIOCGETP _IOR('t', 8, struct sgttyb) -#define TIOCSETP _IOW('t', 9, struct sgttyb) -#define TIOCSETN _IOW('t', 10, struct sgttyb) /* TIOCSETP wo flush */ - -#define TIOCSETC _IOW('t', 17, struct tchars) -#define TIOCGETC _IOR('t', 18, struct tchars) -#define TCGETS _IOR('t', 19, struct termios) -#define TCSETS _IOW('t', 20, struct termios) -#define TCSETSW _IOW('t', 21, struct termios) -#define TCSETSF _IOW('t', 22, struct termios) - -#define TCGETA _IOR('t', 23, struct termio) -#define TCSETA _IOW('t', 24, struct termio) -#define TCSETAW _IOW('t', 25, struct termio) -#define TCSETAF _IOW('t', 28, struct termio) - -#define TCSBRK _IO('t', 29) -#define TCXONC _IO('t', 30) -#define TCFLSH _IO('t', 31) - -#define TIOCSWINSZ _IOW('t', 103, struct winsize) -#define TIOCGWINSZ _IOR('t', 104, struct winsize) -#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ -#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ -#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ - -#define TIOCGLTC _IOR('t', 116, struct ltchars) -#define TIOCSLTC _IOW('t', 117, struct ltchars) -#define TIOCSPGRP _IOW('t', 118, int) -#define TIOCGPGRP _IOR('t', 119, int) - -#define TIOCEXCL 0x540C -#define TIOCNXCL 0x540D -#define TIOCSCTTY 0x540E - -#define TIOCSTI 0x5412 -#define TIOCMGET 0x5415 -#define TIOCMBIS 0x5416 -#define TIOCMBIC 0x5417 -#define TIOCMSET 0x5418 -# define TIOCM_LE 0x001 -# define TIOCM_DTR 0x002 -# define TIOCM_RTS 0x004 -# define TIOCM_ST 0x008 -# define TIOCM_SR 0x010 -# define TIOCM_CTS 0x020 -# define TIOCM_CAR 0x040 -# define TIOCM_RNG 0x080 -# define TIOCM_DSR 0x100 -# define TIOCM_CD TIOCM_CAR -# define TIOCM_RI TIOCM_RNG - -#define TIOCGSOFTCAR 0x5419 -#define TIOCSSOFTCAR 0x541A -#define TIOCLINUX 0x541C -#define TIOCCONS 0x541D -#define TIOCGSERIAL 0x541E -#define TIOCSSERIAL 0x541F -#define TIOCPKT 0x5420 -# define TIOCPKT_DATA 0 -# define TIOCPKT_FLUSHREAD 1 -# define TIOCPKT_FLUSHWRITE 2 -# define TIOCPKT_STOP 4 -# define TIOCPKT_START 8 -# define TIOCPKT_NOSTOP 16 -# define TIOCPKT_DOSTOP 32 - - -#define TIOCNOTTY 0x5422 -#define TIOCSETD 0x5423 -#define TIOCGETD 0x5424 -#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ -#define TIOCSBRK 0x5427 /* BSD compatibility */ -#define TIOCCBRK 0x5428 /* BSD compatibility */ -#define TIOCGSID 0x5429 /* Return the session ID of FD */ -#define TIOCGPTN _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */ -#define TIOCSPTLCK _IOW('T',0x31, int) /* Lock/unlock Pty */ - -#define TIOCSERCONFIG 0x5453 -#define TIOCSERGWILD 0x5454 -#define TIOCSERSWILD 0x5455 -#define TIOCGLCKTRMIOS 0x5456 -#define TIOCSLCKTRMIOS 0x5457 -#define TIOCSERGSTRUCT 0x5458 /* For debugging only */ -#define TIOCSERGETLSR 0x5459 /* Get line status register */ - /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ -# define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ -#define TIOCSERGETMULTI 0x545A /* Get multiport config */ -#define TIOCSERSETMULTI 0x545B /* Set multiport config */ - -#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ -#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ - -#endif /* _ASM_PPC64_IOCTLS_H */ diff -ruNp linus-powerpc.1a/include/asm-ppc64/local.h linus-powerpc.2/include/asm-ppc64/local.h --- linus-powerpc.1a/include/asm-ppc64/local.h 2005-06-27 16:08:08.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc64/local.h 1970-01-01 10:00:00.000000000 +1000 @@ -1 +0,0 @@ -#include diff -ruNp linus-powerpc.1a/include/asm-ppc64/mman.h linus-powerpc.2/include/asm-ppc64/mman.h --- linus-powerpc.1a/include/asm-ppc64/mman.h 2005-06-27 17:55:59.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc64/mman.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,52 +0,0 @@ -#ifndef __PPC64_MMAN_H__ -#define __PPC64_MMAN_H__ - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#define PROT_READ 0x1 /* page can be read */ -#define PROT_WRITE 0x2 /* page can be written */ -#define PROT_EXEC 0x4 /* page can be executed */ -#define PROT_SEM 0x8 /* page may be used for atomic ops */ -#define PROT_NONE 0x0 /* page can not be accessed */ -#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ -#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ - -#define MAP_SHARED 0x01 /* Share changes */ -#define MAP_PRIVATE 0x02 /* Changes are private */ -#define MAP_TYPE 0x0f /* Mask for type of mapping */ -#define MAP_FIXED 0x10 /* Interpret addr exactly */ -#define MAP_ANONYMOUS 0x20 /* don't use a file */ -#define MAP_RENAME MAP_ANONYMOUS /* In SunOS terminology */ -#define MAP_NORESERVE 0x40 /* don't reserve swap pages */ -#define MAP_LOCKED 0x80 - -#define MAP_GROWSDOWN 0x0100 /* stack-like segment */ -#define MAP_DENYWRITE 0x0800 /* ETXTBSY */ -#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ - -#define MS_ASYNC 1 /* sync memory asynchronously */ -#define MS_INVALIDATE 2 /* invalidate the caches */ -#define MS_SYNC 4 /* synchronous memory sync */ - -#define MCL_CURRENT 0x2000 /* lock all currently mapped pages */ -#define MCL_FUTURE 0x4000 /* lock all additions to address space */ - -#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ -#define MAP_NONBLOCK 0x10000 /* do not block on IO */ - -#define MADV_NORMAL 0x0 /* default page-in behavior */ -#define MADV_RANDOM 0x1 /* page-in minimum required */ -#define MADV_SEQUENTIAL 0x2 /* read-ahead aggressively */ -#define MADV_WILLNEED 0x3 /* pre-fault pages */ -#define MADV_DONTNEED 0x4 /* discard these pages */ - -/* compatibility flags */ -#define MAP_ANON MAP_ANONYMOUS -#define MAP_FILE 0 - -#endif /* __PPC64_MMAN_H__ */ diff -ruNp linus-powerpc.1a/include/asm-ppc64/param.h linus-powerpc.2/include/asm-ppc64/param.h --- linus-powerpc.1a/include/asm-ppc64/param.h 2005-06-27 17:55:59.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc64/param.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,29 +0,0 @@ -#ifndef _ASM_PPC64_PARAM_H -#define _ASM_PPC64_PARAM_H - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#ifdef __KERNEL__ -# define HZ 1000 /* Internal kernel timer frequency */ -# define USER_HZ 100 /* .. some user interfaces are in "ticks" */ -# define CLOCKS_PER_SEC (USER_HZ) /* like times() */ -#endif - -#ifndef HZ -#define HZ 100 -#endif - -#define EXEC_PAGESIZE 4096 - -#ifndef NOGROUP -#define NOGROUP (-1) -#endif - -#define MAXHOSTNAMELEN 64 /* max length of hostname */ - -#endif /* _ASM_PPC64_PARAM_H */ diff -ruNp linus-powerpc.1a/include/asm-ppc64/parport.h linus-powerpc.2/include/asm-ppc64/parport.h --- linus-powerpc.1a/include/asm-ppc64/parport.h 2005-06-27 17:55:59.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc64/parport.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,18 +0,0 @@ -/* - * parport.h: platform-specific PC-style parport initialisation - * - * Copyright (C) 1999, 2000 Tim Waugh - * - * This file should only be included by drivers/parport/parport_pc.c. - */ - -#ifndef _ASM_PPC64_PARPORT_H -#define _ASM_PPC64_PARPORT_H - -static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma); -static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma) -{ - return parport_pc_find_isa_ports (autoirq, autodma); -} - -#endif /* !(_ASM_PPC_PARPORT_H) */ diff -ruNp linus-powerpc.1a/include/asm-ppc64/percpu.h linus-powerpc.2/include/asm-ppc64/percpu.h --- linus-powerpc.1a/include/asm-ppc64/percpu.h 2005-06-27 16:08:08.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc64/percpu.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,6 +0,0 @@ -#ifndef __ARCH_PPC64_PERCPU__ -#define __ARCH_PPC64_PERCPU__ - -#include - -#endif /* __ARCH_PPC64_PERCPU__ */ diff -ruNp linus-powerpc.1a/include/asm-ppc64/poll.h linus-powerpc.2/include/asm-ppc64/poll.h --- linus-powerpc.1a/include/asm-ppc64/poll.h 2005-06-27 17:55:59.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc64/poll.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,32 +0,0 @@ -#ifndef __PPC64_POLL_H -#define __PPC64_POLL_H - -/* - * Copyright (C) 2001 PPC64 Team, IBM Corp - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#define POLLIN 0x0001 -#define POLLPRI 0x0002 -#define POLLOUT 0x0004 -#define POLLERR 0x0008 -#define POLLHUP 0x0010 -#define POLLNVAL 0x0020 -#define POLLRDNORM 0x0040 -#define POLLRDBAND 0x0080 -#define POLLWRNORM 0x0100 -#define POLLWRBAND 0x0200 -#define POLLMSG 0x0400 -#define POLLREMOVE 0x1000 - -struct pollfd { - int fd; - short events; - short revents; -}; - -#endif /* __PPC64_POLL_H */ diff -ruNp linus-powerpc.1a/include/asm-ppc64/resource.h linus-powerpc.2/include/asm-ppc64/resource.h --- linus-powerpc.1a/include/asm-ppc64/resource.h 2005-06-27 16:08:08.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc64/resource.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,6 +0,0 @@ -#ifndef _PPC64_RESOURCE_H -#define _PPC64_RESOURCE_H - -#include - -#endif /* _PPC64_RESOURCE_H */ diff -ruNp linus-powerpc.1a/include/asm-ppc64/shmparam.h linus-powerpc.2/include/asm-ppc64/shmparam.h --- linus-powerpc.1a/include/asm-ppc64/shmparam.h 2005-06-27 17:55:59.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc64/shmparam.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,13 +0,0 @@ -#ifndef _PPC64_SHMPARAM_H -#define _PPC64_SHMPARAM_H - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ - -#endif /* _PPC64_SHMPARAM_H */ diff -ruNp linus-powerpc.1a/include/asm-ppc64/string.h linus-powerpc.2/include/asm-ppc64/string.h --- linus-powerpc.1a/include/asm-ppc64/string.h 2005-06-27 17:55:59.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc64/string.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,35 +0,0 @@ -#ifndef _PPC64_STRING_H_ -#define _PPC64_STRING_H_ - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#define __HAVE_ARCH_STRCPY -#define __HAVE_ARCH_STRNCPY -#define __HAVE_ARCH_STRLEN -#define __HAVE_ARCH_STRCMP -#define __HAVE_ARCH_STRCAT -#define __HAVE_ARCH_MEMSET -#define __HAVE_ARCH_MEMCPY -#define __HAVE_ARCH_MEMMOVE -#define __HAVE_ARCH_MEMCMP -#define __HAVE_ARCH_MEMCHR - -extern int strcasecmp(const char *, const char *); -extern int strncasecmp(const char *, const char *, int); -extern char * strcpy(char *,const char *); -extern char * strncpy(char *,const char *, __kernel_size_t); -extern __kernel_size_t strlen(const char *); -extern int strcmp(const char *,const char *); -extern char * strcat(char *, const char *); -extern void * memset(void *,int,__kernel_size_t); -extern void * memcpy(void *,const void *,__kernel_size_t); -extern void * memmove(void *,const void *,__kernel_size_t); -extern int memcmp(const void *,const void *,__kernel_size_t); -extern void * memchr(const void *,int,__kernel_size_t); - -#endif /* _PPC64_STRING_H_ */ diff -ruNp linus-powerpc.1a/include/asm-ppc64/termbits.h linus-powerpc.2/include/asm-ppc64/termbits.h --- linus-powerpc.1a/include/asm-ppc64/termbits.h 2005-06-27 17:55:59.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc64/termbits.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,193 +0,0 @@ -#ifndef _PPC64_TERMBITS_H -#define _PPC64_TERMBITS_H - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include - -typedef unsigned char cc_t; -typedef unsigned int speed_t; -typedef unsigned int tcflag_t; - -/* - * termios type and macro definitions. Be careful about adding stuff - * to this file since it's used in GNU libc and there are strict rules - * concerning namespace pollution. - */ - -#define NCCS 19 -struct termios { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - cc_t c_cc[NCCS]; /* control characters */ - cc_t c_line; /* line discipline (== c_cc[19]) */ - speed_t c_ispeed; /* input speed */ - speed_t c_ospeed; /* output speed */ -}; - -/* c_cc characters */ -#define VINTR 0 -#define VQUIT 1 -#define VERASE 2 -#define VKILL 3 -#define VEOF 4 -#define VMIN 5 -#define VEOL 6 -#define VTIME 7 -#define VEOL2 8 -#define VSWTC 9 -#define VWERASE 10 -#define VREPRINT 11 -#define VSUSP 12 -#define VSTART 13 -#define VSTOP 14 -#define VLNEXT 15 -#define VDISCARD 16 - -/* c_iflag bits */ -#define IGNBRK 0000001 -#define BRKINT 0000002 -#define IGNPAR 0000004 -#define PARMRK 0000010 -#define INPCK 0000020 -#define ISTRIP 0000040 -#define INLCR 0000100 -#define IGNCR 0000200 -#define ICRNL 0000400 -#define IXON 0001000 -#define IXOFF 0002000 -#define IXANY 0004000 -#define IUCLC 0010000 -#define IMAXBEL 0020000 -#define IUTF8 0040000 - -/* c_oflag bits */ -#define OPOST 0000001 -#define ONLCR 0000002 -#define OLCUC 0000004 - -#define OCRNL 0000010 -#define ONOCR 0000020 -#define ONLRET 0000040 - -#define OFILL 00000100 -#define OFDEL 00000200 -#define NLDLY 00001400 -#define NL0 00000000 -#define NL1 00000400 -#define NL2 00001000 -#define NL3 00001400 -#define TABDLY 00006000 -#define TAB0 00000000 -#define TAB1 00002000 -#define TAB2 00004000 -#define TAB3 00006000 -#define XTABS 00006000 /* required by POSIX to == TAB3 */ -#define CRDLY 00030000 -#define CR0 00000000 -#define CR1 00010000 -#define CR2 00020000 -#define CR3 00030000 -#define FFDLY 00040000 -#define FF0 00000000 -#define FF1 00040000 -#define BSDLY 00100000 -#define BS0 00000000 -#define BS1 00100000 -#define VTDLY 00200000 -#define VT0 00000000 -#define VT1 00200000 - -/* c_cflag bit meaning */ -#define CBAUD 0000377 -#define B0 0000000 /* hang up */ -#define B50 0000001 -#define B75 0000002 -#define B110 0000003 -#define B134 0000004 -#define B150 0000005 -#define B200 0000006 -#define B300 0000007 -#define B600 0000010 -#define B1200 0000011 -#define B1800 0000012 -#define B2400 0000013 -#define B4800 0000014 -#define B9600 0000015 -#define B19200 0000016 -#define B38400 0000017 -#define EXTA B19200 -#define EXTB B38400 -#define CBAUDEX 0000000 -#define B57600 00020 -#define B115200 00021 -#define B230400 00022 -#define B460800 00023 -#define B500000 00024 -#define B576000 00025 -#define B921600 00026 -#define B1000000 00027 -#define B1152000 00030 -#define B1500000 00031 -#define B2000000 00032 -#define B2500000 00033 -#define B3000000 00034 -#define B3500000 00035 -#define B4000000 00036 - -#define CSIZE 00001400 -#define CS5 00000000 -#define CS6 00000400 -#define CS7 00001000 -#define CS8 00001400 - -#define CSTOPB 00002000 -#define CREAD 00004000 -#define PARENB 00010000 -#define PARODD 00020000 -#define HUPCL 00040000 - -#define CLOCAL 00100000 -#define CRTSCTS 020000000000 /* flow control */ - -/* c_lflag bits */ -#define ISIG 0x00000080 -#define ICANON 0x00000100 -#define XCASE 0x00004000 -#define ECHO 0x00000008 -#define ECHOE 0x00000002 -#define ECHOK 0x00000004 -#define ECHONL 0x00000010 -#define NOFLSH 0x80000000 -#define TOSTOP 0x00400000 -#define ECHOCTL 0x00000040 -#define ECHOPRT 0x00000020 -#define ECHOKE 0x00000001 -#define FLUSHO 0x00800000 -#define PENDIN 0x20000000 -#define IEXTEN 0x00000400 - -/* Values for the ACTION argument to `tcflow'. */ -#define TCOOFF 0 -#define TCOON 1 -#define TCIOFF 2 -#define TCION 3 - -/* Values for the QUEUE_SELECTOR argument to `tcflush'. */ -#define TCIFLUSH 0 -#define TCOFLUSH 1 -#define TCIOFLUSH 2 - -/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */ -#define TCSANOW 0 -#define TCSADRAIN 1 -#define TCSAFLUSH 2 - -#endif /* _PPC64_TERMBITS_H */ diff -ruNp linus-powerpc.1a/include/asm-ppc64/termios.h linus-powerpc.2/include/asm-ppc64/termios.h --- linus-powerpc.1a/include/asm-ppc64/termios.h 2005-06-27 17:55:59.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc64/termios.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,235 +0,0 @@ -#ifndef _PPC64_TERMIOS_H -#define _PPC64_TERMIOS_H - -/* - * Liberally adapted from alpha/termios.h. In particular, the c_cc[] - * fields have been reordered so that termio & termios share the - * common subset in the same order (for brain dead programs that don't - * know or care about the differences). - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include -#include - -struct sgttyb { - char sg_ispeed; - char sg_ospeed; - char sg_erase; - char sg_kill; - short sg_flags; -}; - -struct tchars { - char t_intrc; - char t_quitc; - char t_startc; - char t_stopc; - char t_eofc; - char t_brkc; -}; - -struct ltchars { - char t_suspc; - char t_dsuspc; - char t_rprntc; - char t_flushc; - char t_werasc; - char t_lnextc; -}; - -struct winsize { - unsigned short ws_row; - unsigned short ws_col; - unsigned short ws_xpixel; - unsigned short ws_ypixel; -}; - -#define NCC 10 -struct termio { - unsigned short c_iflag; /* input mode flags */ - unsigned short c_oflag; /* output mode flags */ - unsigned short c_cflag; /* control mode flags */ - unsigned short c_lflag; /* local mode flags */ - unsigned char c_line; /* line discipline */ - unsigned char c_cc[NCC]; /* control characters */ -}; - -/* c_cc characters */ -#define _VINTR 0 -#define _VQUIT 1 -#define _VERASE 2 -#define _VKILL 3 -#define _VEOF 4 -#define _VMIN 5 -#define _VEOL 6 -#define _VTIME 7 -#define _VEOL2 8 -#define _VSWTC 9 - -/* line disciplines */ -#define N_TTY 0 -#define N_SLIP 1 -#define N_MOUSE 2 -#define N_PPP 3 -#define N_STRIP 4 -#define N_AX25 5 -#define N_X25 6 /* X.25 async */ -#define N_6PACK 7 -#define N_MASC 8 /* Reserved for Mobitex module */ -#define N_R3964 9 /* Reserved for Simatic R3964 module */ -#define N_PROFIBUS_FDL 10 /* Reserved for Profibus */ -#define N_IRDA 11 /* Linux IrDa - http://www.cs.uit.no/~dagb/irda/irda.html */ -#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards about SMS messages */ -#define N_HDLC 13 /* synchronous HDLC */ -#define N_SYNC_PPP 14 - -#ifdef __KERNEL__ -/* ^C ^\ del ^U ^D 1 0 0 0 0 ^W ^R ^Z ^Q ^S ^V ^U */ -#define INIT_C_CC "\003\034\177\025\004\001\000\000\000\000\027\022\032\021\023\026\025" -#endif - -#define FIOCLEX _IO('f', 1) -#define FIONCLEX _IO('f', 2) -#define FIOASYNC _IOW('f', 125, int) -#define FIONBIO _IOW('f', 126, int) -#define FIONREAD _IOR('f', 127, int) -#define TIOCINQ FIONREAD - -#define TIOCGETP _IOR('t', 8, struct sgttyb) -#define TIOCSETP _IOW('t', 9, struct sgttyb) -#define TIOCSETN _IOW('t', 10, struct sgttyb) /* TIOCSETP wo flush */ - -#define TIOCSETC _IOW('t', 17, struct tchars) -#define TIOCGETC _IOR('t', 18, struct tchars) -#define TCGETS _IOR('t', 19, struct termios) -#define TCSETS _IOW('t', 20, struct termios) -#define TCSETSW _IOW('t', 21, struct termios) -#define TCSETSF _IOW('t', 22, struct termios) - -#define TCGETA _IOR('t', 23, struct termio) -#define TCSETA _IOW('t', 24, struct termio) -#define TCSETAW _IOW('t', 25, struct termio) -#define TCSETAF _IOW('t', 28, struct termio) - -#define TCSBRK _IO('t', 29) -#define TCXONC _IO('t', 30) -#define TCFLSH _IO('t', 31) - -#define TIOCSWINSZ _IOW('t', 103, struct winsize) -#define TIOCGWINSZ _IOR('t', 104, struct winsize) -#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ -#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ -#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ - -#define TIOCGLTC _IOR('t', 116, struct ltchars) -#define TIOCSLTC _IOW('t', 117, struct ltchars) -#define TIOCSPGRP _IOW('t', 118, int) -#define TIOCGPGRP _IOR('t', 119, int) - -#define TIOCEXCL 0x540C -#define TIOCNXCL 0x540D -#define TIOCSCTTY 0x540E - -#define TIOCSTI 0x5412 -#define TIOCMGET 0x5415 -#define TIOCMBIS 0x5416 -#define TIOCMBIC 0x5417 -#define TIOCMSET 0x5418 -#define TIOCGSOFTCAR 0x5419 -#define TIOCSSOFTCAR 0x541A -#define TIOCLINUX 0x541C -#define TIOCCONS 0x541D -#define TIOCGSERIAL 0x541E -#define TIOCSSERIAL 0x541F -#define TIOCPKT 0x5420 - -#define TIOCNOTTY 0x5422 -#define TIOCSETD 0x5423 -#define TIOCGETD 0x5424 -#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ - -#define TIOCSERCONFIG 0x5453 -#define TIOCSERGWILD 0x5454 -#define TIOCSERSWILD 0x5455 -#define TIOCGLCKTRMIOS 0x5456 -#define TIOCSLCKTRMIOS 0x5457 -#define TIOCSERGSTRUCT 0x5458 /* For debugging only */ -#define TIOCSERGETLSR 0x5459 /* Get line status register */ -#define TIOCSERGETMULTI 0x545A /* Get multiport config */ -#define TIOCSERSETMULTI 0x545B /* Set multiport config */ - -#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ -#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ - -/* Used for packet mode */ -#define TIOCPKT_DATA 0 -#define TIOCPKT_FLUSHREAD 1 -#define TIOCPKT_FLUSHWRITE 2 -#define TIOCPKT_STOP 4 -#define TIOCPKT_START 8 -#define TIOCPKT_NOSTOP 16 -#define TIOCPKT_DOSTOP 32 - -/* modem lines */ -#define TIOCM_LE 0x001 -#define TIOCM_DTR 0x002 -#define TIOCM_RTS 0x004 -#define TIOCM_ST 0x008 -#define TIOCM_SR 0x010 -#define TIOCM_CTS 0x020 -#define TIOCM_CAR 0x040 -#define TIOCM_RNG 0x080 -#define TIOCM_DSR 0x100 -#define TIOCM_CD TIOCM_CAR -#define TIOCM_RI TIOCM_RNG -#define TIOCM_OUT1 0x2000 -#define TIOCM_OUT2 0x4000 -#define TIOCM_LOOP 0x8000 - -/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ -#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ - -#ifdef __KERNEL__ - -/* - * Translate a "termio" structure into a "termios". Ugh. - */ -#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \ - unsigned short __tmp; \ - get_user(__tmp,&(termio)->x); \ - (termios)->x = (0xffff0000 & (termios)->x) | __tmp; \ -} - -#define user_termio_to_kernel_termios(termios, termio) \ -({ \ - SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \ - SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \ - SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \ - SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \ - copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ -}) - -/* - * Translate a "termios" structure into a "termio". Ugh. - */ -#define kernel_termios_to_user_termio(termio, termios) \ -({ \ - put_user((termios)->c_iflag, &(termio)->c_iflag); \ - put_user((termios)->c_oflag, &(termio)->c_oflag); \ - put_user((termios)->c_cflag, &(termio)->c_cflag); \ - put_user((termios)->c_lflag, &(termio)->c_lflag); \ - put_user((termios)->c_line, &(termio)->c_line); \ - copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ -}) - -#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) -#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) - -#endif /* __KERNEL__ */ - -#endif /* _PPC64_TERMIOS_H */ diff -ruNp linus-powerpc.1a/include/asm-ppc64/unaligned.h linus-powerpc.2/include/asm-ppc64/unaligned.h --- linus-powerpc.1a/include/asm-ppc64/unaligned.h 2005-06-27 17:55:59.000000000 +1000 +++ linus-powerpc.2/include/asm-ppc64/unaligned.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,21 +0,0 @@ -#ifndef __PPC64_UNALIGNED_H -#define __PPC64_UNALIGNED_H - -/* - * The PowerPC can do unaligned accesses itself in big endian mode. - * - * The strange macros are there to make sure these can't - * be misused in a way that makes them not work on other - * architectures where unaligned accesses aren't as simple. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#define get_unaligned(ptr) (*(ptr)) - -#define put_unaligned(val, ptr) ((void)( *(ptr) = (val) )) - -#endif /* __PPC64_UNALIGNED_H */ From sfr at canb.auug.org.au Fri Aug 5 18:37:56 2005 From: sfr at canb.auug.org.au (Stephen Rothwell) Date: Fri, 5 Aug 2005 18:37:56 +1000 Subject: [PATCH] 1/2 Start header file merger (Was: Re: Beginning Merger Patch) In-Reply-To: <20050805174705.731ffa05.sfr@canb.auug.org.au> References: <1123023575.2614.25.camel@cashmere.sps.mot.com> <688ba2276de281a9473b030a16a514c0@embeddededge.com> <20050805174705.731ffa05.sfr@canb.auug.org.au> Message-ID: <20050805183756.25c65e08.sfr@canb.auug.org.au> On Fri, 5 Aug 2005 17:47:05 +1000 Stephen Rothwell wrote: > > for i in * > do > [ -f ../asm-ppc64/$i ] && cmp -s $i ../asm-ppc64/$i && > mv $i ../asm-powerpc/$i && rm ../asm-ppc64/$i > done note to self: Never modify stuff in an email :-( that should be [While in .../asm-ppc64 ] for i in * do [ -f ../asm-ppc/$i ] && cmp -s $i ../asm-ppc/$i && mv $i ../asm-powerpc/$i && rm ../asm-ppc/$i done Sorry about that! -- Cheers, Stephen Rothwell sfr at canb.auug.org.au http://www.canb.auug.org.au/~sfr/ From michael at ellerman.id.au Fri Aug 5 19:08:20 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Fri, 5 Aug 2005 19:08:20 +1000 Subject: [PATCH] 1/2 Start header file merger (Was: Re: Beginning Merger Patch) In-Reply-To: <20050805174705.731ffa05.sfr@canb.auug.org.au> References: <1123023575.2614.25.camel@cashmere.sps.mot.com> <688ba2276de281a9473b030a16a514c0@embeddededge.com> <20050805174705.731ffa05.sfr@canb.auug.org.au> Message-ID: <200508051908.24019.michael@ellerman.id.au> And for the faint of heart there's a patch at: http://michael.ellerman.id.au/files/misc/header-merge.patch cheers On Fri, 5 Aug 2005 17:47, Stephen Rothwell wrote: > On Tue, 2 Aug 2005 19:10:56 -0400 Dan Malek wrote: > > On Aug 2, 2005, at 6:59 PM, Jon Loeliger wrote: > > > ..... A stub is left > > > in asm-ppc and asm-ppc64 pointing to the unified files. > > > > Why bother? You may as well change all of the source > > files, too, or else that will never get done :-) > > You actually don't need to modify (m)any source files. > > Here is an alternative approach. These patches depend on Olaf's > boot code cleanup for ppc64 (or similar). Do the following: > > cd linux/include > mkdir asm-powerpc > cd asm-ppc > for i in * > do > [ -e ../asm-ppc64/$i ] || mv $i ../asm-powerpc/$i > done > cd ../asm-ppc64 > for i in * > do > [ -e ../asm-ppc/$i ] || mv $i ../asm-powerpc/$i > done > for i in * > do > [ -f ../asm-ppc64/$i ] && cmp -s $i ../asm-ppc64/$i && > mv $i ../asm-powerpc/$i && rm ../asm-ppc64/$i > done > > Then apply the patch below and the patch in the following email. > > I have built this kernel for ppc (defconfig), ppc64 (iSeries, pSeries and > pmac). -- Michael Ellerman IBM OzLabs email: michael:ellerman.id.au inmsg: mpe:jabber.org wwweb: http://michael.ellerman.id.au phone: +61 2 6212 1183 (tie line 70 21183) We do not inherit the earth from our ancestors, we borrow it from our children. - S.M.A.R.T Person -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20050805/aafd2187/attachment.pgp From david at gibson.dropbear.id.au Fri Aug 5 19:39:06 2005 From: david at gibson.dropbear.id.au (David Gibson) Date: Fri, 5 Aug 2005 19:39:06 +1000 Subject: [PATCH] Four level pagetables for ppc64 In-Reply-To: <20050804051307.GA27961@localhost.localdomain> References: <20050804051307.GA27961@localhost.localdomain> Message-ID: <20050805093906.GA3780@localhost.localdomain> On Thu, Aug 04, 2005 at 03:13:07PM +1000, David Gibson wrote: > Paul, > > Please forward upstream for -mm, and, after 2.6.13, mainline also. > > Implement 4-level pagetables for ppc64 Oops, just discovered that that version had some bugs in the hugepage handling. Corrected version below Implement 4-level pagetables for ppc64 This patch implements full four-level page tables for ppc64, thereby extending the usable user address range to 44 bits (16T). The patch uses a full page for the tables at the bottom and top level, and a quarter page for the intermediate levels. It uses full 64-bit pointers at every level, thus also increasing the addressable range of physical memory. This patch also tweaks the VSID allocation to allow matching range for user addresses (this halves the number of available contexts) and adds some #if and BUILD_BUG sanity checks. Signed-off-by: David Gibson arch/ppc64/mm/hash_utils.c | 2 arch/ppc64/mm/hugetlbpage.c | 185 +++++++++++++----------------------------- arch/ppc64/mm/imalloc.c | 2 arch/ppc64/mm/init.c | 62 +++++++++----- arch/ppc64/mm/slb_low.S | 2 arch/ppc64/mm/tlb.c | 95 ++++++++++++--------- include/asm-ppc64/imalloc.h | 2 include/asm-ppc64/mmu.h | 7 - include/asm-ppc64/page.h | 26 +++-- include/asm-ppc64/pgalloc.h | 93 +++++++++++++-------- include/asm-ppc64/pgtable.h | 90 ++++++++++++-------- include/asm-ppc64/processor.h | 4 12 files changed, 293 insertions(+), 277 deletions(-) Index: working-2.6/include/asm-ppc64/pgtable.h =================================================================== --- working-2.6.orig/include/asm-ppc64/pgtable.h 2005-07-28 16:44:21.000000000 +1000 +++ working-2.6/include/asm-ppc64/pgtable.h 2005-08-05 18:10:07.000000000 +1000 @@ -15,19 +15,24 @@ #include #endif /* __ASSEMBLY__ */ -#include - /* * Entries per page directory level. The PTE level must use a 64b record * for each page table entry. The PMD and PGD level use a 32b record for * each entry by assuming that each entry is page aligned. */ #define PTE_INDEX_SIZE 9 -#define PMD_INDEX_SIZE 10 -#define PGD_INDEX_SIZE 10 +#define PMD_INDEX_SIZE 7 +#define PUD_INDEX_SIZE 7 +#define PGD_INDEX_SIZE 9 + +#define PTE_TABLE_SIZE (sizeof(pte_t) << PTE_INDEX_SIZE) +#define PMD_TABLE_SIZE (sizeof(pmd_t) << PMD_INDEX_SIZE) +#define PUD_TABLE_SIZE (sizeof(pud_t) << PUD_INDEX_SIZE) +#define PGD_TABLE_SIZE (sizeof(pgd_t) << PGD_INDEX_SIZE) #define PTRS_PER_PTE (1 << PTE_INDEX_SIZE) #define PTRS_PER_PMD (1 << PMD_INDEX_SIZE) +#define PTRS_PER_PUD (1 << PMD_INDEX_SIZE) #define PTRS_PER_PGD (1 << PGD_INDEX_SIZE) /* PMD_SHIFT determines what a second-level page table entry can map */ @@ -35,8 +40,13 @@ #define PMD_SIZE (1UL << PMD_SHIFT) #define PMD_MASK (~(PMD_SIZE-1)) -/* PGDIR_SHIFT determines what a third-level page table entry can map */ -#define PGDIR_SHIFT (PMD_SHIFT + PMD_INDEX_SIZE) +/* PUD_SHIFT determines what a third-level page table entry can map */ +#define PUD_SHIFT (PMD_SHIFT + PMD_INDEX_SIZE) +#define PUD_SIZE (1UL << PUD_SHIFT) +#define PUD_MASK (~(PUD_SIZE-1)) + +/* PGDIR_SHIFT determines what a fourth-level page table entry can map */ +#define PGDIR_SHIFT (PUD_SHIFT + PUD_INDEX_SIZE) #define PGDIR_SIZE (1UL << PGDIR_SHIFT) #define PGDIR_MASK (~(PGDIR_SIZE-1)) @@ -45,15 +55,23 @@ /* * Size of EA range mapped by our pagetables. */ -#define EADDR_SIZE (PTE_INDEX_SIZE + PMD_INDEX_SIZE + \ - PGD_INDEX_SIZE + PAGE_SHIFT) -#define EADDR_MASK ((1UL << EADDR_SIZE) - 1) +#define PGTABLE_EADDR_SIZE (PTE_INDEX_SIZE + PMD_INDEX_SIZE + \ + PUD_INDEX_SIZE + PGD_INDEX_SIZE + PAGE_SHIFT) +#define PGTABLE_RANGE (1UL << PGTABLE_EADDR_SIZE) + +#if TASK_SIZE_USER64 > PGTABLE_RANGE +#error TASK_SIZE_USER64 exceeds pagetable range +#endif + +#if TASK_SIZE_USER64 > (1UL << (USER_ESID_BITS + SID_SHIFT)) +#error TASK_SIZE_USER64 exceeds user VSID range +#endif /* * Define the address range of the vmalloc VM area. */ #define VMALLOC_START (0xD000000000000000ul) -#define VMALLOC_SIZE (0x10000000000UL) +#define VMALLOC_SIZE (0x80000000000UL) #define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE) /* @@ -154,8 +172,6 @@ #ifndef __ASSEMBLY__ int hash_huge_page(struct mm_struct *mm, unsigned long access, unsigned long ea, unsigned long vsid, int local); - -void hugetlb_mm_free_pgd(struct mm_struct *mm); #endif /* __ASSEMBLY__ */ #define HAVE_ARCH_UNMAPPED_AREA @@ -163,7 +179,6 @@ #else #define hash_huge_page(mm,a,ea,vsid,local) -1 -#define hugetlb_mm_free_pgd(mm) do {} while (0) #endif @@ -197,39 +212,45 @@ #define pte_pfn(x) ((unsigned long)((pte_val(x) >> PTE_SHIFT))) #define pte_page(x) pfn_to_page(pte_pfn(x)) -#define pmd_set(pmdp, ptep) \ - (pmd_val(*(pmdp)) = __ba_to_bpn(ptep)) +#define pmd_set(pmdp, ptep) ({BUG_ON((u64)ptep < KERNELBASE); pmd_val(*(pmdp)) = (unsigned long)(ptep);}) #define pmd_none(pmd) (!pmd_val(pmd)) #define pmd_bad(pmd) (pmd_val(pmd) == 0) #define pmd_present(pmd) (pmd_val(pmd) != 0) #define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0) -#define pmd_page_kernel(pmd) (__bpn_to_ba(pmd_val(pmd))) +#define pmd_page_kernel(pmd) (pmd_val(pmd)) #define pmd_page(pmd) virt_to_page(pmd_page_kernel(pmd)) -#define pud_set(pudp, pmdp) (pud_val(*(pudp)) = (__ba_to_bpn(pmdp))) +#define pud_set(pudp, pmdp) (pud_val(*(pudp)) = (unsigned long)(pmdp)) #define pud_none(pud) (!pud_val(pud)) -#define pud_bad(pud) ((pud_val(pud)) == 0UL) -#define pud_present(pud) (pud_val(pud) != 0UL) -#define pud_clear(pudp) (pud_val(*(pudp)) = 0UL) -#define pud_page(pud) (__bpn_to_ba(pud_val(pud))) +#define pud_bad(pud) ((pud_val(pud)) == 0) +#define pud_present(pud) (pud_val(pud) != 0) +#define pud_clear(pudp) (pud_val(*(pudp)) = 0) +#define pud_page(pud) (pud_val(pud)) + +#define pgd_set(pgdp, pudp) ({pgd_val(*(pgdp)) = (unsigned long)(pudp);}) +#define pgd_none(pgd) (!pgd_val(pgd)) +#define pgd_bad(pgd) (pgd_val(pgd) == 0) +#define pgd_present(pgd) (pgd_val(pgd) != 0) +#define pgd_clear(pgdp) (pgd_val(*(pgdp)) = 0) +#define pgd_page(pgd) (pgd_val(pgd)) /* * Find an entry in a page-table-directory. We combine the address region * (the high order N bits) and the pgd portion of the address. */ /* to avoid overflow in free_pgtables we don't use PTRS_PER_PGD here */ -#define pgd_index(address) (((address) >> (PGDIR_SHIFT)) & 0x7ff) +#define pgd_index(address) (((address) >> (PGDIR_SHIFT)) & 0x1ff) #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) -/* Find an entry in the second-level page table.. */ +#define pud_offset(pgdp, addr) \ + (((pud_t *) pgd_page(*(pgdp))) + (((addr) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))) + #define pmd_offset(pudp,addr) \ - ((pmd_t *) pud_page(*(pudp)) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) + (((pmd_t *) pud_page(*(pudp))) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1))) -/* Find an entry in the third-level page table.. */ #define pte_offset_kernel(dir,addr) \ - ((pte_t *) pmd_page_kernel(*(dir)) \ - + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) + (((pte_t *) pmd_page_kernel(*(dir))) + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) #define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr)) #define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir), (addr)) @@ -458,23 +479,18 @@ #define pte_same(A,B) (((pte_val(A) ^ pte_val(B)) & ~_PAGE_HPTEFLAGS) == 0) #define pmd_ERROR(e) \ - printk("%s:%d: bad pmd %08x.\n", __FILE__, __LINE__, pmd_val(e)) + printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e)) +#define pud_ERROR(e) \ + printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pud_val(e)) #define pgd_ERROR(e) \ - printk("%s:%d: bad pgd %08x.\n", __FILE__, __LINE__, pgd_val(e)) + printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) extern pgd_t swapper_pg_dir[]; extern void paging_init(void); -/* - * Because the huge pgtables are only 2 level, they can take - * at most around 4M, much less than one hugepage which the - * process is presumably entitled to use. So we don't bother - * freeing up the pagetables on unmap, and wait until - * destroy_context() to clean up the lot. - */ #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) \ - do { } while (0) + free_pgd_range(tlb, addr, end, floor, ceiling) /* * This gets called at the end of handling a page fault, when Index: working-2.6/include/asm-ppc64/page.h =================================================================== --- working-2.6.orig/include/asm-ppc64/page.h 2005-07-28 16:44:21.000000000 +1000 +++ working-2.6/include/asm-ppc64/page.h 2005-08-05 18:10:07.000000000 +1000 @@ -46,6 +46,7 @@ #define ARCH_HAS_HUGEPAGE_ONLY_RANGE #define ARCH_HAS_PREPARE_HUGEPAGE_RANGE +#define ARCH_HAS_SETCLEAR_HUGE_PTE #define touches_hugepage_low_range(mm, addr, len) \ (LOW_ESID_MASK((addr), (len)) & mm->context.htlb_segs) @@ -125,36 +126,42 @@ * Entries in the pte table are 64b, while entries in the pgd & pmd are 32b. */ typedef struct { unsigned long pte; } pte_t; -typedef struct { unsigned int pmd; } pmd_t; -typedef struct { unsigned int pgd; } pgd_t; +typedef struct { unsigned long pmd; } pmd_t; +typedef struct { unsigned long pud; } pud_t; +typedef struct { unsigned long pgd; } pgd_t; typedef struct { unsigned long pgprot; } pgprot_t; #define pte_val(x) ((x).pte) #define pmd_val(x) ((x).pmd) +#define pud_val(x) ((x).pud) #define pgd_val(x) ((x).pgd) #define pgprot_val(x) ((x).pgprot) -#define __pte(x) ((pte_t) { (x) } ) -#define __pmd(x) ((pmd_t) { (x) } ) -#define __pgd(x) ((pgd_t) { (x) } ) -#define __pgprot(x) ((pgprot_t) { (x) } ) +#define __pte(x) ((pte_t) { (x) }) +#define __pmd(x) ((pmd_t) { (x) }) +#define __pud(x) ((pud_t) { (x) }) +#define __pgd(x) ((pgd_t) { (x) }) +#define __pgprot(x) ((pgprot_t) { (x) }) #else /* * .. while these make it easier on the compiler */ typedef unsigned long pte_t; -typedef unsigned int pmd_t; -typedef unsigned int pgd_t; +typedef unsigned long pmd_t; +typedef unsigned long pud_t; +typedef unsigned long pgd_t; typedef unsigned long pgprot_t; #define pte_val(x) (x) #define pmd_val(x) (x) +#define pud_val(x) (x) #define pgd_val(x) (x) #define pgprot_val(x) (x) #define __pte(x) (x) #define __pmd(x) (x) +#define __pud(x) (x) #define __pgd(x) (x) #define __pgprot(x) (x) @@ -208,9 +215,6 @@ #define USER_REGION_ID (0UL) #define REGION_ID(ea) (((unsigned long)(ea)) >> REGION_SHIFT) -#define __bpn_to_ba(x) ((((unsigned long)(x)) << PAGE_SHIFT) + KERNELBASE) -#define __ba_to_bpn(x) ((((unsigned long)(x)) & ~REGION_MASK) >> PAGE_SHIFT) - #define __va(x) ((void *)((unsigned long)(x) + KERNELBASE)) #ifdef CONFIG_DISCONTIGMEM Index: working-2.6/include/asm-ppc64/pgalloc.h =================================================================== --- working-2.6.orig/include/asm-ppc64/pgalloc.h 2005-06-08 15:46:24.000000000 +1000 +++ working-2.6/include/asm-ppc64/pgalloc.h 2005-08-05 18:10:07.000000000 +1000 @@ -6,7 +6,12 @@ #include #include -extern kmem_cache_t *zero_cache; +extern kmem_cache_t *pgtable_cache[]; + +#define PTE_CACHE_NUM 0 +#define PMD_CACHE_NUM 1 +#define PUD_CACHE_NUM 1 +#define PGD_CACHE_NUM 0 /* * This program is free software; you can redistribute it and/or @@ -15,30 +20,40 @@ * 2 of the License, or (at your option) any later version. */ -static inline pgd_t * -pgd_alloc(struct mm_struct *mm) +static inline pgd_t *pgd_alloc(struct mm_struct *mm) +{ + return kmem_cache_alloc(pgtable_cache[PGD_CACHE_NUM], GFP_KERNEL); +} + +static inline void pgd_free(pgd_t *pgd) +{ + kmem_cache_free(pgtable_cache[PGD_CACHE_NUM], pgd); +} + +#define pgd_populate(MM, PGD, PUD) pgd_set(PGD, PUD) + +static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr) { - return kmem_cache_alloc(zero_cache, GFP_KERNEL); + return kmem_cache_alloc(pgtable_cache[PUD_CACHE_NUM], + GFP_KERNEL|__GFP_REPEAT); } -static inline void -pgd_free(pgd_t *pgd) +static inline void pud_free(pud_t *pud) { - kmem_cache_free(zero_cache, pgd); + kmem_cache_free(pgtable_cache[PUD_CACHE_NUM], pud); } #define pud_populate(MM, PUD, PMD) pud_set(PUD, PMD) -static inline pmd_t * -pmd_alloc_one(struct mm_struct *mm, unsigned long addr) +static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) { - return kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT); + return kmem_cache_alloc(pgtable_cache[PMD_CACHE_NUM], + GFP_KERNEL|__GFP_REPEAT); } -static inline void -pmd_free(pmd_t *pmd) +static inline void pmd_free(pmd_t *pmd) { - kmem_cache_free(zero_cache, pmd); + kmem_cache_free(pgtable_cache[PMD_CACHE_NUM], pmd); } #define pmd_populate_kernel(mm, pmd, pte) pmd_set(pmd, pte) @@ -47,44 +62,58 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) { - return kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT); + return kmem_cache_alloc(pgtable_cache[PTE_CACHE_NUM], + GFP_KERNEL|__GFP_REPEAT); } static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) { - pte_t *pte = kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT); - if (pte) - return virt_to_page(pte); - return NULL; + return virt_to_page(pte_alloc_one_kernel(mm, address)); } static inline void pte_free_kernel(pte_t *pte) { - kmem_cache_free(zero_cache, pte); + kmem_cache_free(pgtable_cache[PTE_CACHE_NUM], pte); } static inline void pte_free(struct page *ptepage) { - kmem_cache_free(zero_cache, page_address(ptepage)); + pte_free_kernel(page_address(ptepage)); } -struct pte_freelist_batch +#define PGF_CACHENUM_MASK 0xf + +typedef struct pgtable_free { + unsigned long val; +} pgtable_free_t; + +static inline pgtable_free_t pgtable_free_cache(void *p, int cachenum, + unsigned long mask) { - struct rcu_head rcu; - unsigned int index; - struct page * pages[0]; -}; + BUG_ON(cachenum > PGF_CACHENUM_MASK); -#define PTE_FREELIST_SIZE ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) / \ - sizeof(struct page *)) + return (pgtable_free_t){.val = ((unsigned long) p & ~mask) | cachenum}; +} -extern void pte_free_now(struct page *ptepage); -extern void pte_free_submit(struct pte_freelist_batch *batch); +static inline void pgtable_free(pgtable_free_t pgf) +{ + void *p = (void *)(pgf.val & ~PGF_CACHENUM_MASK); + int cachenum = pgf.val & PGF_CACHENUM_MASK; + + kmem_cache_free(pgtable_cache[cachenum], p); +} -DECLARE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur); +void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf); -void __pte_free_tlb(struct mmu_gather *tlb, struct page *ptepage); -#define __pmd_free_tlb(tlb, pmd) __pte_free_tlb(tlb, virt_to_page(pmd)) +#define __pte_free_tlb(tlb, ptepage) \ + pgtable_free_tlb(tlb, pgtable_free_cache(page_address(ptepage), \ + PTE_CACHE_NUM, PTE_TABLE_SIZE-1)) +#define __pmd_free_tlb(tlb, pmd) \ + pgtable_free_tlb(tlb, pgtable_free_cache(pmd, \ + PMD_CACHE_NUM, PMD_TABLE_SIZE-1)) +#define __pud_free_tlb(tlb, pmd) \ + pgtable_free_tlb(tlb, pgtable_free_cache(pud, \ + PUD_CACHE_NUM, PUD_TABLE_SIZE-1)) #define check_pgt_cache() do { } while (0) Index: working-2.6/arch/ppc64/mm/init.c =================================================================== --- working-2.6.orig/arch/ppc64/mm/init.c 2005-08-01 10:50:44.000000000 +1000 +++ working-2.6/arch/ppc64/mm/init.c 2005-08-05 18:10:07.000000000 +1000 @@ -66,6 +66,14 @@ #include #include +#if PGTABLE_RANGE > USER_VSID_RANGE +#warning Limited user VSID range means pagetable space is wasted +#endif + +#if (TASK_SIZE_USER64 < PGTABLE_RANGE) && (TASK_SIZE_USER64 < USER_VSID_RANGE) +#warning TASK_SIZE is smaller than it needs to be. +#endif + int mem_init_done; unsigned long ioremap_bot = IMALLOC_BASE; static unsigned long phbs_io_bot = PHBS_IO_BASE; @@ -226,7 +234,7 @@ * Before that, we map using addresses going * up from ioremap_bot. imalloc will use * the addresses from ioremap_bot through - * IMALLOC_END (0xE000001fffffffff) + * IMALLOC_END * */ pa = addr & PAGE_MASK; @@ -417,12 +425,6 @@ int index; int err; -#ifdef CONFIG_HUGETLB_PAGE - /* We leave htlb_segs as it was, but for a fork, we need to - * clear the huge_pgdir. */ - mm->context.huge_pgdir = NULL; -#endif - again: if (!idr_pre_get(&mmu_context_idr, GFP_KERNEL)) return -ENOMEM; @@ -453,8 +455,6 @@ spin_unlock(&mmu_context_lock); mm->context.id = NO_CONTEXT; - - hugetlb_mm_free_pgd(mm); } /* @@ -833,23 +833,43 @@ return virt_addr; } -kmem_cache_t *zero_cache; - -static void zero_ctor(void *pte, kmem_cache_t *cache, unsigned long flags) +static void zero_ctor(void *addr, kmem_cache_t *cache, unsigned long flags) { - memset(pte, 0, PAGE_SIZE); + memset(addr, 0, kmem_cache_size(cache)); } +static const int pgtable_cache_size[2] = { + PTE_TABLE_SIZE, PMD_TABLE_SIZE +}; +static const char *pgtable_cache_name[ARRAY_SIZE(pgtable_cache_size)] = { + "pgd_pte_cache", "pud_pmd_cache", +}; + +kmem_cache_t *pgtable_cache[ARRAY_SIZE(pgtable_cache_size)]; + void pgtable_cache_init(void) { - zero_cache = kmem_cache_create("zero", - PAGE_SIZE, - 0, - SLAB_HWCACHE_ALIGN | SLAB_MUST_HWCACHE_ALIGN, - zero_ctor, - NULL); - if (!zero_cache) - panic("pgtable_cache_init(): could not create zero_cache!\n"); + int i; + + BUILD_BUG_ON(PTE_TABLE_SIZE != pgtable_cache_size[PTE_CACHE_NUM]); + BUILD_BUG_ON(PMD_TABLE_SIZE != pgtable_cache_size[PMD_CACHE_NUM]); + BUILD_BUG_ON(PUD_TABLE_SIZE != pgtable_cache_size[PUD_CACHE_NUM]); + BUILD_BUG_ON(PGD_TABLE_SIZE != pgtable_cache_size[PGD_CACHE_NUM]); + + for (i = 0; i < ARRAY_SIZE(pgtable_cache_size); i++) { + int size = pgtable_cache_size[i]; + const char *name = pgtable_cache_name[i]; + + pgtable_cache[i] = kmem_cache_create(name, + size, size, + SLAB_HWCACHE_ALIGN + | SLAB_MUST_HWCACHE_ALIGN, + zero_ctor, + NULL); + if (! pgtable_cache[i]) + panic("pgtable_cache_init(): could not create %s!\n", + name); + } } pgprot_t phys_mem_access_prot(struct file *file, unsigned long addr, Index: working-2.6/include/asm-ppc64/processor.h =================================================================== --- working-2.6.orig/include/asm-ppc64/processor.h 2005-07-28 16:44:21.000000000 +1000 +++ working-2.6/include/asm-ppc64/processor.h 2005-08-05 18:10:07.000000000 +1000 @@ -382,8 +382,8 @@ extern struct task_struct *last_task_used_math; extern struct task_struct *last_task_used_altivec; -/* 64-bit user address space is 41-bits (2TBs user VM) */ -#define TASK_SIZE_USER64 (0x0000020000000000UL) +/* 64-bit user address space is 44-bits (16TB user VM) */ +#define TASK_SIZE_USER64 (0x0000100000000000UL) /* * 32-bit user address space is 4GB - 1 page Index: working-2.6/arch/ppc64/mm/imalloc.c =================================================================== --- working-2.6.orig/arch/ppc64/mm/imalloc.c 2005-07-28 16:43:47.000000000 +1000 +++ working-2.6/arch/ppc64/mm/imalloc.c 2005-08-05 18:10:07.000000000 +1000 @@ -31,7 +31,7 @@ break; if ((unsigned long)tmp->addr >= ioremap_bot) addr = tmp->size + (unsigned long) tmp->addr; - if (addr > IMALLOC_END-size) + if (addr >= IMALLOC_END-size) return 1; } *im_addr = addr; Index: working-2.6/arch/ppc64/mm/hash_utils.c =================================================================== --- working-2.6.orig/arch/ppc64/mm/hash_utils.c 2005-08-01 10:50:44.000000000 +1000 +++ working-2.6/arch/ppc64/mm/hash_utils.c 2005-08-05 18:10:07.000000000 +1000 @@ -302,7 +302,7 @@ int local = 0; cpumask_t tmp; - if ((ea & ~REGION_MASK) > EADDR_MASK) + if ((ea & ~REGION_MASK) >= PGTABLE_RANGE) return 1; switch (REGION_ID(ea)) { Index: working-2.6/include/asm-ppc64/mmu.h =================================================================== --- working-2.6.orig/include/asm-ppc64/mmu.h 2005-08-01 10:50:46.000000000 +1000 +++ working-2.6/include/asm-ppc64/mmu.h 2005-08-05 18:10:07.000000000 +1000 @@ -259,8 +259,10 @@ #define VSID_BITS 36 #define VSID_MODULUS ((1UL<index; i++) + pgtable_free(batch->tables[i]); + + free_page((unsigned long)batch); +} + +static void pte_free_submit(struct pte_freelist_batch *batch) +{ + INIT_RCU_HEAD(&batch->rcu); + call_rcu(&batch->rcu, pte_free_rcu_callback); +} + +void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf) { /* This is safe as we are holding page_table_lock */ cpumask_t local_cpumask = cpumask_of_cpu(smp_processor_id()); @@ -49,19 +100,19 @@ if (atomic_read(&tlb->mm->mm_users) < 2 || cpus_equal(tlb->mm->cpu_vm_mask, local_cpumask)) { - pte_free(ptepage); + pgtable_free(pgf); return; } if (*batchp == NULL) { *batchp = (struct pte_freelist_batch *)__get_free_page(GFP_ATOMIC); if (*batchp == NULL) { - pte_free_now(ptepage); + pgtable_free_now(pgf); return; } (*batchp)->index = 0; } - (*batchp)->pages[(*batchp)->index++] = ptepage; + (*batchp)->tables[(*batchp)->index++] = pgf; if ((*batchp)->index == PTE_FREELIST_SIZE) { pte_free_submit(*batchp); *batchp = NULL; @@ -132,42 +183,6 @@ put_cpu(); } -#ifdef CONFIG_SMP -static void pte_free_smp_sync(void *arg) -{ - /* Do nothing, just ensure we sync with all CPUs */ -} -#endif - -/* This is only called when we are critically out of memory - * (and fail to get a page in pte_free_tlb). - */ -void pte_free_now(struct page *ptepage) -{ - pte_freelist_forced_free++; - - smp_call_function(pte_free_smp_sync, NULL, 0, 1); - - pte_free(ptepage); -} - -static void pte_free_rcu_callback(struct rcu_head *head) -{ - struct pte_freelist_batch *batch = - container_of(head, struct pte_freelist_batch, rcu); - unsigned int i; - - for (i = 0; i < batch->index; i++) - pte_free(batch->pages[i]); - free_page((unsigned long)batch); -} - -void pte_free_submit(struct pte_freelist_batch *batch) -{ - INIT_RCU_HEAD(&batch->rcu); - call_rcu(&batch->rcu, pte_free_rcu_callback); -} - void pte_free_finish(void) { /* This is safe as we are holding page_table_lock */ Index: working-2.6/arch/ppc64/mm/hugetlbpage.c =================================================================== --- working-2.6.orig/arch/ppc64/mm/hugetlbpage.c 2005-08-01 10:50:44.000000000 +1000 +++ working-2.6/arch/ppc64/mm/hugetlbpage.c 2005-08-05 18:10:07.000000000 +1000 @@ -27,124 +27,91 @@ #include -#define HUGEPGDIR_SHIFT (HPAGE_SHIFT + PAGE_SHIFT - 3) -#define HUGEPGDIR_SIZE (1UL << HUGEPGDIR_SHIFT) -#define HUGEPGDIR_MASK (~(HUGEPGDIR_SIZE-1)) - -#define HUGEPTE_INDEX_SIZE 9 -#define HUGEPGD_INDEX_SIZE 10 - -#define PTRS_PER_HUGEPTE (1 << HUGEPTE_INDEX_SIZE) -#define PTRS_PER_HUGEPGD (1 << HUGEPGD_INDEX_SIZE) - -static inline int hugepgd_index(unsigned long addr) +/* Modelled after find_linux_pte() */ +pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) { - return (addr & ~REGION_MASK) >> HUGEPGDIR_SHIFT; -} + pgd_t *pg; + pud_t *pu; + pmd_t *pm; + pte_t *pt; -static pud_t *hugepgd_offset(struct mm_struct *mm, unsigned long addr) -{ - int index; + BUG_ON(! in_hugepage_area(mm->context, addr)); - if (! mm->context.huge_pgdir) - return NULL; + addr &= HPAGE_MASK; + pg = pgd_offset(mm, addr); + if (!pgd_none(*pg)) { + pu = pud_offset(pg, addr); + if (!pud_none(*pu)) { + pm = pmd_offset(pu, addr); + pt = (pte_t *)pm; + BUG_ON(!pmd_none(*pm) + && !(pte_present(*pt) && pte_huge(*pt))); + return pt; + } + } - index = hugepgd_index(addr); - BUG_ON(index >= PTRS_PER_HUGEPGD); - return (pud_t *)(mm->context.huge_pgdir + index); + return NULL; } -static inline pte_t *hugepte_offset(pud_t *dir, unsigned long addr) +pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr) { - int index; - - if (pud_none(*dir)) - return NULL; - - index = (addr >> HPAGE_SHIFT) % PTRS_PER_HUGEPTE; - return (pte_t *)pud_page(*dir) + index; -} + pgd_t *pg; + pud_t *pu; + pmd_t *pm; + pte_t *pt; -static pud_t *hugepgd_alloc(struct mm_struct *mm, unsigned long addr) -{ BUG_ON(! in_hugepage_area(mm->context, addr)); - if (! mm->context.huge_pgdir) { - pgd_t *new; - spin_unlock(&mm->page_table_lock); - /* Don't use pgd_alloc(), because we want __GFP_REPEAT */ - new = kmem_cache_alloc(zero_cache, GFP_KERNEL | __GFP_REPEAT); - BUG_ON(memcmp(new, empty_zero_page, PAGE_SIZE)); - spin_lock(&mm->page_table_lock); - - /* - * Because we dropped the lock, we should re-check the - * entry, as somebody else could have populated it.. - */ - if (mm->context.huge_pgdir) - pgd_free(new); - else - mm->context.huge_pgdir = new; - } - return hugepgd_offset(mm, addr); -} - -static pte_t *hugepte_alloc(struct mm_struct *mm, pud_t *dir, unsigned long addr) -{ - if (! pud_present(*dir)) { - pte_t *new; + addr &= HPAGE_MASK; - spin_unlock(&mm->page_table_lock); - new = kmem_cache_alloc(zero_cache, GFP_KERNEL | __GFP_REPEAT); - BUG_ON(memcmp(new, empty_zero_page, PAGE_SIZE)); - spin_lock(&mm->page_table_lock); - /* - * Because we dropped the lock, we should re-check the - * entry, as somebody else could have populated it.. - */ - if (pud_present(*dir)) { - if (new) - kmem_cache_free(zero_cache, new); - } else { - struct page *ptepage; + pg = pgd_offset(mm, addr); + pu = pud_alloc(mm, pg, addr); - if (! new) - return NULL; - ptepage = virt_to_page(new); - ptepage->mapping = (void *) mm; - ptepage->index = addr & HUGEPGDIR_MASK; - pud_populate(mm, dir, new); + if (pu) { + pm = pmd_alloc(mm, pu, addr); + if (pm) { + pt = (pte_t *)pm; + BUG_ON(!pmd_none(*pm) + && !(pte_present(*pt) && pte_huge(*pt))); + return pt; } } - return hugepte_offset(dir, addr); + return NULL; } -pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) -{ - pud_t *pud; +#define HUGEPTE_BATCH_SIZE (HPAGE_SIZE / PMD_SIZE) - BUG_ON(! in_hugepage_area(mm->context, addr)); +void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, + pte_t *ptep, pte_t pte) +{ + int i; - pud = hugepgd_offset(mm, addr); - if (! pud) - return NULL; + if (pte_present(*ptep)) { + pte_clear(mm, addr, ptep); + flush_tlb_pending(); + } - return hugepte_offset(pud, addr); + for (i = 0; i < HUGEPTE_BATCH_SIZE; i++) { + *ptep = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS); + ptep++; + } } -pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr) +pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, + pte_t *ptep) { - pud_t *pud; + unsigned long old = pte_update(ptep, ~0UL); + int i; - BUG_ON(! in_hugepage_area(mm->context, addr)); + if (old & _PAGE_HASHPTE) + hpte_update(mm, addr, old, 0); - pud = hugepgd_alloc(mm, addr); - if (! pud) - return NULL; + for (i = 1; i < HUGEPTE_BATCH_SIZE; i++) + ptep[i] = __pte(0); - return hugepte_alloc(mm, pud, addr); + return __pte(old); } /* @@ -541,42 +508,6 @@ } } -void hugetlb_mm_free_pgd(struct mm_struct *mm) -{ - int i; - pgd_t *pgdir; - - spin_lock(&mm->page_table_lock); - - pgdir = mm->context.huge_pgdir; - if (! pgdir) - goto out; - - mm->context.huge_pgdir = NULL; - - /* cleanup any hugepte pages leftover */ - for (i = 0; i < PTRS_PER_HUGEPGD; i++) { - pud_t *pud = (pud_t *)(pgdir + i); - - if (! pud_none(*pud)) { - pte_t *pte = (pte_t *)pud_page(*pud); - struct page *ptepage = virt_to_page(pte); - - ptepage->mapping = NULL; - - BUG_ON(memcmp(pte, empty_zero_page, PAGE_SIZE)); - kmem_cache_free(zero_cache, pte); - } - pud_clear(pud); - } - - BUG_ON(memcmp(pgdir, empty_zero_page, PAGE_SIZE)); - kmem_cache_free(zero_cache, pgdir); - - out: - spin_unlock(&mm->page_table_lock); -} - int hash_huge_page(struct mm_struct *mm, unsigned long access, unsigned long ea, unsigned long vsid, int local) { Index: working-2.6/arch/ppc64/mm/slb_low.S =================================================================== --- working-2.6.orig/arch/ppc64/mm/slb_low.S 2005-05-24 14:12:22.000000000 +1000 +++ working-2.6/arch/ppc64/mm/slb_low.S 2005-08-05 18:10:07.000000000 +1000 @@ -91,7 +91,7 @@ 0: /* user address: proto-VSID = context<<15 | ESID */ li r11,SLB_VSID_USER - srdi. r9,r3,13 + srdi. r9,r3,USER_ESID_BITS bne- 8f /* invalid ea bits set */ #ifdef CONFIG_HUGETLB_PAGE -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/people/dgibson From arnd at arndb.de Fri Aug 5 21:53:22 2005 From: arnd at arndb.de (Arnd Bergmann) Date: Fri, 5 Aug 2005 13:53:22 +0200 Subject: [PATCH] 1/2 Start header file merger (Was: Re: Beginning Merger Patch) In-Reply-To: <20050805174705.731ffa05.sfr@canb.auug.org.au> References: <1123023575.2614.25.camel@cashmere.sps.mot.com> <688ba2276de281a9473b030a16a514c0@embeddededge.com> <20050805174705.731ffa05.sfr@canb.auug.org.au> Message-ID: <200508051353.23750.arnd@arndb.de> On Freedag 05 August 2005 09:47, Stephen Rothwell wrote: > cd linux/include > mkdir asm-powerpc > cd asm-ppc > for i in * > do > ????????[ -e ../asm-ppc64/$i ] || mv $i ../asm-powerpc/$i > done > cd ../asm-ppc64 > for i in * > do > ????????[ -e ../asm-ppc/$i ] || mv $i ../asm-powerpc/$i > done While I really like your approach in general (I've done it the same way when merging asm-s390{,x]), I think we should take a little care to move only the files that we really want in asm/powerpc. E.g, most of the files that are in asm-ppc but not in asm-ppc64 seem so be board-specific or cpu-specific, so I'd not move them around before (unless) moving the platform code for those as well. Also, for everything below include/asm-ppc64/iSeries, it would make sense to rename the files to lowercase in the same step and change all their users. > for i in * > do > ????????[ -f ../asm-ppc64/$i ] && cmp -s $i ../asm-ppc64/$i && > ????????????????mv $i ../asm-powerpc/$i && rm ../asm-ppc64/$i > done Another help for merging further is to do for i in `ls include/asm-ppc` ; do if [ -e include/asm-ppc64/$i ] ; then diff --ifdef __powerpc64__ include/asm-{ppc,ppc64}/$i > \ include/asm-generic/$i ; fi done Note that you need to hand-edit practically every file that you get from this, but many of them become trivial to merge. Another interesting point about it is which define to use. For s390, we decided to '#ifdef __s390x__' rather than '#ifdef CONFIG_ARCH_S390X' or 'ifdef CONFIG_64BIT', because CONFIG_* does not work when including the headers from user space. Using CONFIG_64BIT instead of __powerpc64__ only within #ifdef __KERNEL__ would be correct but less consistant. Arnd <>< From sfr at canb.auug.org.au Sat Aug 6 00:59:41 2005 From: sfr at canb.auug.org.au (Stephen Rothwell) Date: Sat, 6 Aug 2005 00:59:41 +1000 Subject: [PATCH] 1/2 Start header file merger (Was: Re: Beginning Merger Patch) In-Reply-To: <200508051353.23750.arnd@arndb.de> References: <1123023575.2614.25.camel@cashmere.sps.mot.com> <688ba2276de281a9473b030a16a514c0@embeddededge.com> <20050805174705.731ffa05.sfr@canb.auug.org.au> <200508051353.23750.arnd@arndb.de> Message-ID: <20050806005941.5d1fe432.sfr@canb.auug.org.au> Hi Arnd, On Fri, 5 Aug 2005 13:53:22 +0200 Arnd Bergmann wrote: > > While I really like your approach in general (I've done it the > same way when merging asm-s390{,x]), I think we should take > a little care to move only the files that we really want in > asm/powerpc. Sure, this was just a first pass - really to demonstrate that we can remove header files from their original directories as we go. > E.g, most of the files that are in asm-ppc but not in asm-ppc64 > seem so be board-specific or cpu-specific, so I'd not move them > around before (unless) moving the platform code for those as well. Indeed. > Also, for everything below include/asm-ppc64/iSeries, it would > make sense to rename the files to lowercase in the same > step and change all their users. That would definitely be a separate set of patches (those include files are referenced in 47 different files). > Another help for merging further is to do > > for i in `ls include/asm-ppc` ; do > if [ -e include/asm-ppc64/$i ] ; then > diff --ifdef __powerpc64__ include/asm-{ppc,ppc64}/$i > \ > include/asm-generic/$i ; ^^^^^^^ (I assume you meant powerpc as we are not the generic architecture, yet :-)) > fi > done > > Note that you need to hand-edit practically every file that you get from > this, but many of them become trivial to merge. I'll have a go and see what happens. > Another interesting point about it is which define to use. For s390, we > decided to '#ifdef __s390x__' rather than '#ifdef CONFIG_ARCH_S390X' or > 'ifdef CONFIG_64BIT', because CONFIG_* does not work when including the > headers from user space. Well noone should even include kernel headers from user space :-) and my understanding is that glibc "sanitizes" its version of the kernel headers anyway. > Using CONFIG_64BIT instead of __powerpc64__ only within #ifdef __KERNEL__ > would be correct but less consistant. The advantage of using CONFIG_64BIT as much as possible is that it shows us places that can be consolidated across the various architectures (which is a bit of a passion of mine :-)). And more consolidation should make life easier for the glibc folks in the long run. -- Cheers, Stephen Rothwell sfr at canb.auug.org.au http://www.canb.auug.org.au/~sfr/ From arnd at arndb.de Sat Aug 6 02:24:16 2005 From: arnd at arndb.de (Arnd Bergmann) Date: Fri, 5 Aug 2005 18:24:16 +0200 Subject: [PATCH] 1/2 Start header file merger (Was: Re: Beginning Merger Patch) In-Reply-To: <20050806005941.5d1fe432.sfr@canb.auug.org.au> References: <1123023575.2614.25.camel@cashmere.sps.mot.com> <200508051353.23750.arnd@arndb.de> <20050806005941.5d1fe432.sfr@canb.auug.org.au> Message-ID: <200508051824.17947.arnd@arndb.de> On Freedag 05 August 2005 16:59, Stephen Rothwell wrote: > Well noone should even include kernel headers from user space :-) and my > understanding is that glibc "sanitizes" its version of the kernel headers > anyway. Glibc doesn't change the header files too much, most of that is done in the linux-libc-headers package, which is maintained separately from the kernel and from glibc. There is some effort being put into keeping the difference between that package and the kernel headers small. Also, while using kernel headers directly from user space should be considered a bug, Linus has stated before that he wants source code that is broken in that way to keep working instead of breaking it even more. There is also klibc, which heavily relies on kernel headers by design. > > Using CONFIG_64BIT instead of __powerpc64__ only within #ifdef __KERNEL__ > > would be correct but less consistant. > > The advantage of using CONFIG_64BIT as much as possible is that it shows > us places that can be consolidated across the various architectures > (which is a bit of a passion of mine :-)). ?And more consolidation should > make life easier for the glibc folks in the long run. AFAIK, in linux-libc-headers every usage of CONFIG_* outside of __KERNEL__ is a bug that needs to be fixed by the maintainer, so we really should not do that. I think it might be ok to use CONFIG_64BIT for files that are completely inside #ifdef __KERNEL__, but I'd like to avoid stuff like: #ifndef __powerpc64__ #define __NR_sendfile64?? 226 /* only for 32 bit */ #endif /* __powerpc64__ */ ... #ifdef __KERNEL__ #ifndef CONFIG_64BIT #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") #else /* CONFIG_64BIT */ #define cond_syscall(x) asm(".weak\t." #x "\n\t.set\t." #x ",.sys_ni_syscall") #endif /* CONFIG_64BIT */ #endif /* __KERNEL__ */ in a single file. Using __powerpc64__ consistantly has the advantage that the casual reader can easily find all places that rely on 32/64 bit definitions without having to understand why there are two different ways to do the same thing. Perhaps it works out better if this is combined with the split into include/asm-powerpc/ and include/asm-powerpc/user, as mentioned in the thread around http://www.ussg.iu.edu/hypermail/linux/kernel/0411.3/1663.html. Then we could have CONFIG_64BIT everywhere in the real kernel headers and __powerpc64__ in the user interface headers. Arnd <>< From kumar.gala at freescale.com Sat Aug 6 03:38:50 2005 From: kumar.gala at freescale.com (Kumar Gala) Date: Fri, 5 Aug 2005 12:38:50 -0500 Subject: [PATCH] PPC64: Add VMX save flag to VPA In-Reply-To: <20050805040225.GA13865@austin.ibm.com> References: <20050805040225.GA13865@austin.ibm.com> Message-ID: Olaf, Out of interest, I'm assuming this extension to pacaData is part of some software spec? Or is this specific to Linux. I ask because one of the issues we are going to run into when merging ppc32/ppc64 is the lack of public information about hypervisor interfaces. - kumar On Aug 4, 2005, at 11:02 PM, Olof Johansson wrote: > Hi, > > We need to indicate to the hypervisor that it needs to save our VMX > registers when switching partitions on a shared-processor system, just > as it needs to for FP and PMC registers. > > This could be made to be on-demand when VMX is used, but we don't do > that for FP nor PMC right now either so let's not overcomplicate > things. > > > Signed-off-by: Olof Johansson > > > Index: 2.6/arch/ppc64/kernel/pacaData.c > =================================================================== > --- 2.6.orig/arch/ppc64/kernel/pacaData.c 2005-08-03 > 19:53:16.000000000 -0500 > +++ 2.6/arch/ppc64/kernel/pacaData.c 2005-08-04 19:26:26.000000000 > -0500 > @@ -59,6 +59,7 @@ extern unsigned long __toc_start; > .fpregs_in_use = 1, > \ > .end_of_quantum = 0xfffffffffffffffful, > \ > .slb_count = 64, > \ > + .vmxregs_in_use = 0, > \ > }, > \ > > #ifdef CONFIG_PPC_ISERIES > Index: 2.6/include/asm-ppc64/lppaca.h > =================================================================== > --- 2.6.orig/include/asm-ppc64/lppaca.h 2005-08-04 > 19:25:54.000000000 > -0500 > +++ 2.6/include/asm-ppc64/lppaca.h 2005-08-04 19:26:15.000000000 > -0500 > @@ -108,7 +108,7 @@ struct lppaca > volatile u32 virtual_decr; // Virtual DECR for shared > procsx78-x7B > u16 slb_count; // # of SLBs to maintain > x7C-x7D > u8 idle; // Indicate OS is idle > x7E > - u8 reserved5; // Reserved > x7F > + u8 vmxregs_in_use; // VMX registers in use > x7F > > > > // > ====================================================================== > ======= > Index: 2.6/arch/ppc64/kernel/pSeries_lpar.c > =================================================================== > --- 2.6.orig/arch/ppc64/kernel/pSeries_lpar.c 2005-08-03 > 19:53:16.000000000 -0500 > +++ 2.6/arch/ppc64/kernel/pSeries_lpar.c 2005-08-04 > 19:35:41.000000000 -0500 > @@ -267,6 +267,10 @@ void vpa_init(int cpu) > > /* Register the Virtual Processor Area (VPA) */ > flags = 1UL << (63 - 18); > + > + if (cpu_has_feature(CPU_FTR_ALTIVEC)) > + paca[cpu].lppaca.vmxregs_in_use = 1; > + > ret = register_vpa(flags, hwcpu, __pa(vpa)); > > if (ret) > _______________________________________________ > Linuxppc64-dev mailing list > Linuxppc64-dev at ozlabs.org > https://ozlabs.org/mailman/listinfo/linuxppc64-dev > From olof at lixom.net Sat Aug 6 04:02:33 2005 From: olof at lixom.net (Olof Johansson) Date: Fri, 5 Aug 2005 13:02:33 -0500 Subject: [PATCH] PPC64: Add VMX save flag to VPA In-Reply-To: References: <20050805040225.GA13865@austin.ibm.com> Message-ID: <20050805180233.GB13865@austin.ibm.com> On Fri, Aug 05, 2005 at 12:38:50PM -0500, Kumar Gala wrote: > Out of interest, I'm assuming this extension to pacaData is part of > some software spec? Or is this specific to Linux. > > I ask because one of the issues we are going to run into when merging > ppc32/ppc64 is the lack of public information about hypervisor > interfaces. Yes, this is architected in a document called PAPR (Power Architecture Platform Requirements). It used to be called RPA (Risc Platform Archiecture). At this time there is no publically available version of this document. -Olof From bdc at carlstrom.com Sat Aug 6 09:52:18 2005 From: bdc at carlstrom.com (Brian D. Carlstrom) Date: Fri, 5 Aug 2005 16:52:18 -0700 Subject: Fan control for new PowerMac G5 2.7GHz machines? In-Reply-To: <1123147202.30257.50.camel@gaston> References: <1123099081.30257.41.camel@gaston> <42F14303.2000304@am.sony.com> <1123147202.30257.50.camel@gaston> Message-ID: <17139.64434.831070.403355@zot.electricrain.com> Benjamin Herrenschmidt writes: > > i2c /dev entries driver > > /u3 at 0,f8000000/i2c at f8001000: Missing interrupt or address ! > > > > In therm_pm72_attach() it hits 'Found K2', but u3_0 and u3_1 > > are never set, so start_control_loops() is never called. > > > > I'll look at it more when I have some time. > > Ah yes, this is indeed the problem ! There is a bug in Apple device tree > on these machines that is breaking Linux. I should have a workaround > upstream, but for some reason, it seems it's not working for you. Well, I have good news and bad news. I switched from the patched YDL 2.6.10-1 to linux-stable 2.6.12.3 to debug the fan issue. The good news is that my fans control now works. Since Geoff is having problems, I'll include my DBG output from therm_pm72 below. For me it is reporting "found U3-1, attaching FCU" and not "Found K2". The bad news is that ybin is having trouble: # ybin ofpath: /proc/device-tree is broken. Do not use BootX to boot, use yaboot. ofpath: The yaboot HOWTO can be found here: http://www.alaska.net/~erbenson/doc ybin: Unable to find OpenFirmware path for boot=/dev/sda2 ybin: Please add ofboot= where is the OpenFirmware path to /dev/sda2 to /etc/yaboot.conf I've heard a newer yaboot might fix this but for now I just booted to my old kernel to update yaboot.conf. -bri found U3-0 counted 2 CPUs in the device-tree Liquid cooling pumps detected, using new algorithm ! CPU 0 Using 6 power history entries CPU 1 Using 6 power history entries all control loops up ! found U3-1, attaching FCU FCU attached everything up, starting control loops main_control_loop started Found KeyWest i2c on "u3", 2 channels, stepping: 4 bits ADC config reg: 00 ADC config reg: 00 cpu 0, exhaust RPM: 1000 cpu 0, temp raw: 01f2, m_diode: 9fc5, b_diode: fffff67d temp: 39.653 cpu 0, current: 17.333, voltage: 1.413, power: 24.502 W cpu 1, exhaust RPM: 1000 cpu 1, temp raw: 01e9, m_diode: 9dbb, b_diode: fffff674 temp: 37.134 cpu 1, current: 19.409, voltage: 1.408, power: 27.341 W power target: 85.000, error: 57.658 integral: 0159f366 integ_p: 29 adj_in_target: 53.594, ttarget: 81 deriv_p: 0 prop_p: -140 sum: -140 ** CPU 1 RPM: 860 Ex, 834, Pump: 1250, In, overtemp: 0 backside: current pwm: 26 temp: 49.000, target: 75.000 integral: fefc0000 integ_p: 0 deriv_p: 0 prop_p: -130 sum: -130 ** BACKSIDE PWM: 20 drives: current rpm: 1000 temp: 21.500, target: 40.000 integral: ff470000 integ_p: 0 deriv_p: 0 prop_p: -93 sum: -93 ** DRIVES RPM: 907 From benh at kernel.crashing.org Sun Aug 7 17:41:54 2005 From: benh at kernel.crashing.org (Benjamin Herrenschmidt) Date: Sun, 07 Aug 2005 09:41:54 +0200 Subject: Fan control for new PowerMac G5 2.7GHz machines? In-Reply-To: <17139.64434.831070.403355@zot.electricrain.com> References: <1123099081.30257.41.camel@gaston> <42F14303.2000304@am.sony.com> <1123147202.30257.50.camel@gaston> <17139.64434.831070.403355@zot.electricrain.com> Message-ID: <1123400515.30257.100.camel@gaston> On Fri, 2005-08-05 at 16:52 -0700, Brian D. Carlstrom wrote: > Benjamin Herrenschmidt writes: > > > i2c /dev entries driver > > > /u3 at 0,f8000000/i2c at f8001000: Missing interrupt or address ! > > > > > > In therm_pm72_attach() it hits 'Found K2', but u3_0 and u3_1 > > > are never set, so start_control_loops() is never called. > > > > > > I'll look at it more when I have some time. > > > > Ah yes, this is indeed the problem ! There is a bug in Apple device tree > > on these machines that is breaking Linux. I should have a workaround > > upstream, but for some reason, it seems it's not working for you. > > Well, I have good news and bad news. I switched from the patched YDL > 2.6.10-1 to linux-stable 2.6.12.3 to debug the fan issue. The problem is realted to the device-tree fixup code as I posted. > The good news is that my fans control now works. Since Geoff is having > problems, I'll include my DBG output from therm_pm72 below. For me it > is reporting "found U3-1, attaching FCU" and not "Found K2". > > The bad news is that ybin is having trouble: > > # ybin > ofpath: /proc/device-tree is broken. Do not use BootX to boot, use yaboot. > ofpath: The yaboot HOWTO can be found here: http://www.alaska.net/~erbenson/doc > ybin: Unable to find OpenFirmware path for boot=/dev/sda2 > ybin: Please add ofboot= where is the OpenFirmware path to /dev/sda2 to /etc/yaboot.conf > > I've heard a newer yaboot might fix this but for now I just booted to my > old kernel to update yaboot.conf. Just edit "ofpath" (it's a shell script) and simply remove the test that trigger this error, it's bogus. Ben. From paulus at samba.org Mon Aug 8 13:24:38 2005 From: paulus at samba.org (Paul Mackerras) Date: Mon, 8 Aug 2005 13:24:38 +1000 Subject: [PATCH] make arch/ppc64/boot standalone In-Reply-To: <20050507215801.GC26918@suse.de> References: <20050507215801.GC26918@suse.de> Message-ID: <17142.53366.96808.266798@cargo.ozlabs.ibm.com> Olaf Hering writes: > make the bootheader for ppc64 independent from kernel and libc headers > add -nostdinc -isystem $gccincludes to not include libc headers > declare all functions in header files, also the stuff from string.S > declare some functions static > use stddef.h to get size_t (hopefully ok) > remove ppc32-types.h, only elf.h used the __NN types Here is a new version, munged somewhat by Stephen Rothwell and me. I'll send this upstream after 2.6.13 is out. Paul. diff -ruN linus/arch/ppc64/boot/Makefile linus-boot.2/arch/ppc64/boot/Makefile --- linus/arch/ppc64/boot/Makefile 2005-07-01 09:58:50.000000000 +1000 +++ linus-boot.2/arch/ppc64/boot/Makefile 2005-08-05 11:50:15.000000000 +1000 @@ -22,8 +22,8 @@ HOSTCC := gcc -BOOTCFLAGS := $(HOSTCFLAGS) $(LINUXINCLUDE) -fno-builtin -BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional +BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem $(shell $(CROSS32CC) -print-file-name=include) +BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc BOOTLFLAGS := -Ttext 0x00400000 -e _start -T $(srctree)/$(src)/zImage.lds OBJCOPYFLAGS := contents,alloc,load,readonly,data diff -ruN linus/arch/ppc64/boot/addnote.c linus-boot.2/arch/ppc64/boot/addnote.c --- linus/arch/ppc64/boot/addnote.c 2005-06-27 16:08:00.000000000 +1000 +++ linus-boot.2/arch/ppc64/boot/addnote.c 2005-08-05 11:28:36.000000000 +1000 @@ -157,7 +157,7 @@ PUT_32BE(ns, strlen(arch) + 1); PUT_32BE(ns + 4, N_DESCR * 4); PUT_32BE(ns + 8, 0x1275); - strcpy(&buf[ns + 12], arch); + strcpy((char *) &buf[ns + 12], arch); ns += 12 + strlen(arch) + 1; for (i = 0; i < N_DESCR; ++i, ns += 4) PUT_32BE(ns, descr[i]); @@ -172,7 +172,7 @@ PUT_32BE(ns, strlen(rpaname) + 1); PUT_32BE(ns + 4, sizeof(rpanote)); PUT_32BE(ns + 8, 0x12759999); - strcpy(&buf[ns + 12], rpaname); + strcpy((char *) &buf[ns + 12], rpaname); ns += 12 + ROUNDUP(strlen(rpaname) + 1); for (i = 0; i < N_RPA_DESCR; ++i, ns += 4) PUT_32BE(ns, rpanote[i]); diff -ruN linus/arch/ppc64/boot/crt0.S linus-boot.2/arch/ppc64/boot/crt0.S --- linus/arch/ppc64/boot/crt0.S 2005-06-27 16:08:00.000000000 +1000 +++ linus-boot.2/arch/ppc64/boot/crt0.S 2005-08-05 11:46:30.000000000 +1000 @@ -9,7 +9,7 @@ * NOTE: this code runs in 32 bit mode and is packaged as ELF32. */ -#include +#include "ppc_asm.h" .text .globl _start diff -ruN linus/arch/ppc64/boot/div64.S linus-boot.2/arch/ppc64/boot/div64.S --- linus/arch/ppc64/boot/div64.S 2005-06-27 16:08:00.000000000 +1000 +++ linus-boot.2/arch/ppc64/boot/div64.S 2005-08-05 11:48:25.000000000 +1000 @@ -13,7 +13,7 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ -#include +#include "ppc_asm.h" .globl __div64_32 __div64_32: diff -ruN linus/arch/ppc64/boot/elf.h linus-boot.2/arch/ppc64/boot/elf.h --- linus/arch/ppc64/boot/elf.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-boot.2/arch/ppc64/boot/elf.h 2005-08-05 11:28:36.000000000 +1000 @@ -0,0 +1,149 @@ +#ifndef _PPC_BOOT_ELF_H_ +#define _PPC_BOOT_ELF_H_ + +/* 32-bit ELF base types. */ +typedef unsigned int Elf32_Addr; +typedef unsigned short Elf32_Half; +typedef unsigned int Elf32_Off; +typedef signed int Elf32_Sword; +typedef unsigned int Elf32_Word; + +/* 64-bit ELF base types. */ +typedef unsigned long long Elf64_Addr; +typedef unsigned short Elf64_Half; +typedef signed short Elf64_SHalf; +typedef unsigned long long Elf64_Off; +typedef signed int Elf64_Sword; +typedef unsigned int Elf64_Word; +typedef unsigned long long Elf64_Xword; +typedef signed long long Elf64_Sxword; + +/* These constants are for the segment types stored in the image headers */ +#define PT_NULL 0 +#define PT_LOAD 1 +#define PT_DYNAMIC 2 +#define PT_INTERP 3 +#define PT_NOTE 4 +#define PT_SHLIB 5 +#define PT_PHDR 6 +#define PT_TLS 7 /* Thread local storage segment */ +#define PT_LOOS 0x60000000 /* OS-specific */ +#define PT_HIOS 0x6fffffff /* OS-specific */ +#define PT_LOPROC 0x70000000 +#define PT_HIPROC 0x7fffffff +#define PT_GNU_EH_FRAME 0x6474e550 + +#define PT_GNU_STACK (PT_LOOS + 0x474e551) + +/* These constants define the different elf file types */ +#define ET_NONE 0 +#define ET_REL 1 +#define ET_EXEC 2 +#define ET_DYN 3 +#define ET_CORE 4 +#define ET_LOPROC 0xff00 +#define ET_HIPROC 0xffff + +/* These constants define the various ELF target machines */ +#define EM_NONE 0 +#define EM_PPC 20 /* PowerPC */ +#define EM_PPC64 21 /* PowerPC64 */ + +#define EI_NIDENT 16 + +typedef struct elf32_hdr { + unsigned char e_ident[EI_NIDENT]; + Elf32_Half e_type; + Elf32_Half e_machine; + Elf32_Word e_version; + Elf32_Addr e_entry; /* Entry point */ + Elf32_Off e_phoff; + Elf32_Off e_shoff; + Elf32_Word e_flags; + Elf32_Half e_ehsize; + Elf32_Half e_phentsize; + Elf32_Half e_phnum; + Elf32_Half e_shentsize; + Elf32_Half e_shnum; + Elf32_Half e_shstrndx; +} Elf32_Ehdr; + +typedef struct elf64_hdr { + unsigned char e_ident[16]; /* ELF "magic number" */ + Elf64_Half e_type; + Elf64_Half e_machine; + Elf64_Word e_version; + Elf64_Addr e_entry; /* Entry point virtual address */ + Elf64_Off e_phoff; /* Program header table file offset */ + Elf64_Off e_shoff; /* Section header table file offset */ + Elf64_Word e_flags; + Elf64_Half e_ehsize; + Elf64_Half e_phentsize; + Elf64_Half e_phnum; + Elf64_Half e_shentsize; + Elf64_Half e_shnum; + Elf64_Half e_shstrndx; +} Elf64_Ehdr; + +/* These constants define the permissions on sections in the program + header, p_flags. */ +#define PF_R 0x4 +#define PF_W 0x2 +#define PF_X 0x1 + +typedef struct elf32_phdr { + Elf32_Word p_type; + Elf32_Off p_offset; + Elf32_Addr p_vaddr; + Elf32_Addr p_paddr; + Elf32_Word p_filesz; + Elf32_Word p_memsz; + Elf32_Word p_flags; + Elf32_Word p_align; +} Elf32_Phdr; + +typedef struct elf64_phdr { + Elf64_Word p_type; + Elf64_Word p_flags; + Elf64_Off p_offset; /* Segment file offset */ + Elf64_Addr p_vaddr; /* Segment virtual address */ + Elf64_Addr p_paddr; /* Segment physical address */ + Elf64_Xword p_filesz; /* Segment size in file */ + Elf64_Xword p_memsz; /* Segment size in memory */ + Elf64_Xword p_align; /* Segment alignment, file & memory */ +} Elf64_Phdr; + +#define EI_MAG0 0 /* e_ident[] indexes */ +#define EI_MAG1 1 +#define EI_MAG2 2 +#define EI_MAG3 3 +#define EI_CLASS 4 +#define EI_DATA 5 +#define EI_VERSION 6 +#define EI_OSABI 7 +#define EI_PAD 8 + +#define ELFMAG0 0x7f /* EI_MAG */ +#define ELFMAG1 'E' +#define ELFMAG2 'L' +#define ELFMAG3 'F' +#define ELFMAG "\177ELF" +#define SELFMAG 4 + +#define ELFCLASSNONE 0 /* EI_CLASS */ +#define ELFCLASS32 1 +#define ELFCLASS64 2 +#define ELFCLASSNUM 3 + +#define ELFDATANONE 0 /* e_ident[EI_DATA] */ +#define ELFDATA2LSB 1 +#define ELFDATA2MSB 2 + +#define EV_NONE 0 /* e_version, EI_VERSION */ +#define EV_CURRENT 1 +#define EV_NUM 2 + +#define ELFOSABI_NONE 0 +#define ELFOSABI_LINUX 3 + +#endif /* _PPC_BOOT_ELF_H_ */ diff -ruN linus/arch/ppc64/boot/main.c linus-boot.2/arch/ppc64/boot/main.c --- linus/arch/ppc64/boot/main.c 2005-07-01 09:58:50.000000000 +1000 +++ linus-boot.2/arch/ppc64/boot/main.c 2005-08-05 11:47:53.000000000 +1000 @@ -8,36 +8,28 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ -#include "ppc32-types.h" +#include +#include +#include "elf.h" +#include "page.h" +#include "string.h" +#include "stdio.h" +#include "prom.h" #include "zlib.h" -#include -#include -#include -#include - -extern void *finddevice(const char *); -extern int getprop(void *, const char *, void *, int); -extern void printf(const char *fmt, ...); -extern int sprintf(char *buf, const char *fmt, ...); -void gunzip(void *, int, unsigned char *, int *); -void *claim(unsigned int, unsigned int, unsigned int); -void flush_cache(void *, unsigned long); -void pause(void); -extern void exit(void); - -unsigned long strlen(const char *s); -void *memmove(void *dest, const void *src, unsigned long n); -void *memcpy(void *dest, const void *src, unsigned long n); + +static void gunzip(void *, int, unsigned char *, int *); +extern void flush_cache(void *, unsigned long); + /* Value picked to match that used by yaboot */ #define PROG_START 0x01400000 #define RAM_END (256<<20) // Fixme: use OF */ -char *avail_ram; -char *begin_avail, *end_avail; -char *avail_high; -unsigned int heap_use; -unsigned int heap_max; +static char *avail_ram; +static char *begin_avail, *end_avail; +static char *avail_high; +static unsigned int heap_use; +static unsigned int heap_max; extern char _start[]; extern char _vmlinux_start[]; @@ -52,9 +44,9 @@ unsigned long size; unsigned long memsize; }; -struct addr_range vmlinux = {0, 0, 0}; -struct addr_range vmlinuz = {0, 0, 0}; -struct addr_range initrd = {0, 0, 0}; +static struct addr_range vmlinux = {0, 0, 0}; +static struct addr_range vmlinuz = {0, 0, 0}; +static struct addr_range initrd = {0, 0, 0}; static char scratch[128<<10]; /* 128kB of scratch space for gunzip */ @@ -64,13 +56,6 @@ void *); -int (*prom)(void *); - -void *chosen_handle; -void *stdin; -void *stdout; -void *stderr; - #undef DEBUG static unsigned long claim_base = PROG_START; @@ -277,7 +262,7 @@ #define DEFLATED 8 -void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp) +static void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp) { z_stream s; int r, i, flags; diff -ruN linus/arch/ppc64/boot/page.h linus-boot.2/arch/ppc64/boot/page.h --- linus/arch/ppc64/boot/page.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-boot.2/arch/ppc64/boot/page.h 2005-08-05 11:28:36.000000000 +1000 @@ -0,0 +1,34 @@ +#ifndef _PPC_BOOT_PAGE_H +#define _PPC_BOOT_PAGE_H +/* + * Copyright (C) 2001 PPC64 Team, IBM Corp + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifdef __ASSEMBLY__ +#define ASM_CONST(x) x +#else +#define __ASM_CONST(x) x##UL +#define ASM_CONST(x) __ASM_CONST(x) +#endif + +/* PAGE_SHIFT determines the page size */ +#define PAGE_SHIFT 12 +#define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE-1)) + +/* align addr on a size boundary - adjust address up/down if needed */ +#define _ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1))) +#define _ALIGN_DOWN(addr,size) ((addr)&(~((size)-1))) + +/* align addr on a size boundary - adjust address up if needed */ +#define _ALIGN(addr,size) _ALIGN_UP(addr,size) + +/* to align the pointer to the (next) page boundary */ +#define PAGE_ALIGN(addr) _ALIGN(addr, PAGE_SIZE) + +#endif /* _PPC_BOOT_PAGE_H */ diff -ruN linus/arch/ppc64/boot/ppc32-types.h linus-boot.2/arch/ppc64/boot/ppc32-types.h --- linus/arch/ppc64/boot/ppc32-types.h 2005-06-27 16:08:00.000000000 +1000 +++ linus-boot.2/arch/ppc64/boot/ppc32-types.h 1970-01-01 10:00:00.000000000 +1000 @@ -1,36 +0,0 @@ -#ifndef _PPC64_TYPES_H -#define _PPC64_TYPES_H - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -typedef __signed__ long long __s64; -typedef unsigned long long __u64; - -typedef signed char s8; -typedef unsigned char u8; - -typedef signed short s16; -typedef unsigned short u16; - -typedef signed int s32; -typedef unsigned int u32; - -typedef signed long long s64; -typedef unsigned long long u64; - -typedef struct { - __u32 u[4]; -} __attribute((aligned(16))) __vector128; - -#define BITS_PER_LONG 32 - -typedef __vector128 vector128; - -#endif /* _PPC64_TYPES_H */ diff -ruN linus/arch/ppc64/boot/ppc_asm.h linus-boot.2/arch/ppc64/boot/ppc_asm.h --- linus/arch/ppc64/boot/ppc_asm.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-boot.2/arch/ppc64/boot/ppc_asm.h 2005-08-05 11:28:36.000000000 +1000 @@ -0,0 +1,62 @@ +#ifndef _PPC64_PPC_ASM_H +#define _PPC64_PPC_ASM_H +/* + * + * Definitions used by various bits of low-level assembly code on PowerPC. + * + * Copyright (C) 1995-1999 Gary Thomas, Paul Mackerras, Cort Dougan. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +/* Condition Register Bit Fields */ + +#define cr0 0 +#define cr1 1 +#define cr2 2 +#define cr3 3 +#define cr4 4 +#define cr5 5 +#define cr6 6 +#define cr7 7 + + +/* General Purpose Registers (GPRs) */ + +#define r0 0 +#define r1 1 +#define r2 2 +#define r3 3 +#define r4 4 +#define r5 5 +#define r6 6 +#define r7 7 +#define r8 8 +#define r9 9 +#define r10 10 +#define r11 11 +#define r12 12 +#define r13 13 +#define r14 14 +#define r15 15 +#define r16 16 +#define r17 17 +#define r18 18 +#define r19 19 +#define r20 20 +#define r21 21 +#define r22 22 +#define r23 23 +#define r24 24 +#define r25 25 +#define r26 26 +#define r27 27 +#define r28 28 +#define r29 29 +#define r30 30 +#define r31 31 + +#endif /* _PPC64_PPC_ASM_H */ diff -ruN linus/arch/ppc64/boot/prom.c linus-boot.2/arch/ppc64/boot/prom.c --- linus/arch/ppc64/boot/prom.c 2005-07-01 09:58:50.000000000 +1000 +++ linus-boot.2/arch/ppc64/boot/prom.c 2005-08-05 11:47:19.000000000 +1000 @@ -7,43 +7,19 @@ * 2 of the License, or (at your option) any later version. */ #include -#include -#include -#include - -extern __u32 __div64_32(unsigned long long *dividend, __u32 divisor); - -/* The unnecessary pointer compare is there - * to check for type safety (n must be 64bit) - */ -# define do_div(n,base) ({ \ - __u32 __base = (base); \ - __u32 __rem; \ - (void)(((typeof((n)) *)0) == ((unsigned long long *)0)); \ - if (((n) >> 32) == 0) { \ - __rem = (__u32)(n) % __base; \ - (n) = (__u32)(n) / __base; \ - } else \ - __rem = __div64_32(&(n), __base); \ - __rem; \ - }) +#include +#include "string.h" +#include "stdio.h" +#include "prom.h" int (*prom)(void *); void *chosen_handle; + void *stdin; void *stdout; void *stderr; -void exit(void); -void *finddevice(const char *name); -int getprop(void *phandle, const char *name, void *buf, int buflen); -void chrpboot(int a1, int a2, void *prom); /* in main.c */ - -int printf(char *fmt, ...); - -/* there is no convenient header to get this from... -- paulus */ -extern unsigned long strlen(const char *); int write(void *handle, void *ptr, int nb) @@ -210,107 +186,6 @@ return write(f, str, n) == n? 0: -1; } -int -readchar(void) -{ - char ch; - - for (;;) { - switch (read(stdin, &ch, 1)) { - case 1: - return ch; - case -1: - printf("read(stdin) returned -1\r\n"); - return -1; - } - } -} - -static char line[256]; -static char *lineptr; -static int lineleft; - -int -getchar(void) -{ - int c; - - if (lineleft == 0) { - lineptr = line; - for (;;) { - c = readchar(); - if (c == -1 || c == 4) - break; - if (c == '\r' || c == '\n') { - *lineptr++ = '\n'; - putchar('\n'); - break; - } - switch (c) { - case 0177: - case '\b': - if (lineptr > line) { - putchar('\b'); - putchar(' '); - putchar('\b'); - --lineptr; - } - break; - case 'U' & 0x1F: - while (lineptr > line) { - putchar('\b'); - putchar(' '); - putchar('\b'); - --lineptr; - } - break; - default: - if (lineptr >= &line[sizeof(line) - 1]) - putchar('\a'); - else { - putchar(c); - *lineptr++ = c; - } - } - } - lineleft = lineptr - line; - lineptr = line; - } - if (lineleft == 0) - return -1; - --lineleft; - return *lineptr++; -} - - - -/* String functions lifted from lib/vsprintf.c and lib/ctype.c */ -unsigned char _ctype[] = { -_C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ -_C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */ -_C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */ -_C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */ -_S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */ -_P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */ -_D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */ -_D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */ -_P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */ -_U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */ -_U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */ -_U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */ -_P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */ -_L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */ -_L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */ -_L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */ -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */ -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */ -_S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 160-175 */ -_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 176-191 */ -_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U, /* 192-207 */ -_U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L, /* 208-223 */ -_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L, /* 224-239 */ -_L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L}; /* 240-255 */ - size_t strnlen(const char * s, size_t count) { const char *sc; @@ -320,44 +195,30 @@ return sc - s; } -unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base) -{ - unsigned long result = 0,value; +extern unsigned int __div64_32(unsigned long long *dividend, + unsigned int divisor); - if (!base) { - base = 10; - if (*cp == '0') { - base = 8; - cp++; - if ((*cp == 'x') && isxdigit(cp[1])) { - cp++; - base = 16; - } - } - } - while (isxdigit(*cp) && - (value = isdigit(*cp) ? *cp-'0' : toupper(*cp)-'A'+10) < base) { - result = result*base + value; - cp++; - } - if (endp) - *endp = (char *)cp; - return result; -} - -long simple_strtol(const char *cp,char **endp,unsigned int base) -{ - if(*cp=='-') - return -simple_strtoul(cp+1,endp,base); - return simple_strtoul(cp,endp,base); -} +/* The unnecessary pointer compare is there + * to check for type safety (n must be 64bit) + */ +# define do_div(n,base) ({ \ + unsigned int __base = (base); \ + unsigned int __rem; \ + (void)(((typeof((n)) *)0) == ((unsigned long long *)0)); \ + if (((n) >> 32) == 0) { \ + __rem = (unsigned int)(n) % __base; \ + (n) = (unsigned int)(n) / __base; \ + } else \ + __rem = __div64_32(&(n), __base); \ + __rem; \ + }) static int skip_atoi(const char **s) { - int i=0; + int i, c; - while (isdigit(**s)) - i = i*10 + *((*s)++) - '0'; + for (i = 0; '0' <= (c = **s) && c <= '9'; ++*s) + i = i*10 + c - '0'; return i; } @@ -436,9 +297,6 @@ return str; } -/* Forward decl. needed for IP address printing stuff... */ -int sprintf(char * buf, const char *fmt, ...); - int vsprintf(char *buf, const char *fmt, va_list args) { int len; @@ -477,7 +335,7 @@ /* get field width */ field_width = -1; - if (isdigit(*fmt)) + if ('0' <= *fmt && *fmt <= '9') field_width = skip_atoi(&fmt); else if (*fmt == '*') { ++fmt; @@ -493,7 +351,7 @@ precision = -1; if (*fmt == '.') { ++fmt; - if (isdigit(*fmt)) + if ('0' <= *fmt && *fmt <= '9') precision = skip_atoi(&fmt); else if (*fmt == '*') { ++fmt; @@ -628,7 +486,7 @@ static char sprint_buf[1024]; int -printf(char *fmt, ...) +printf(const char *fmt, ...) { va_list args; int n; diff -ruN linus/arch/ppc64/boot/prom.h linus-boot.2/arch/ppc64/boot/prom.h --- linus/arch/ppc64/boot/prom.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-boot.2/arch/ppc64/boot/prom.h 2005-08-05 11:28:36.000000000 +1000 @@ -0,0 +1,18 @@ +#ifndef _PPC_BOOT_PROM_H_ +#define _PPC_BOOT_PROM_H_ + +extern int (*prom) (void *); +extern void *chosen_handle; + +extern void *stdin; +extern void *stdout; +extern void *stderr; + +extern int write(void *handle, void *ptr, int nb); +extern int read(void *handle, void *ptr, int nb); +extern void exit(void); +extern void pause(void); +extern void *finddevice(const char *); +extern void *claim(unsigned long virt, unsigned long size, unsigned long align); +extern int getprop(void *phandle, const char *name, void *buf, int buflen); +#endif /* _PPC_BOOT_PROM_H_ */ diff -ruN linus/arch/ppc64/boot/stdio.h linus-boot.2/arch/ppc64/boot/stdio.h --- linus/arch/ppc64/boot/stdio.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-boot.2/arch/ppc64/boot/stdio.h 2005-08-05 11:28:36.000000000 +1000 @@ -0,0 +1,16 @@ +#ifndef _PPC_BOOT_STDIO_H_ +#define _PPC_BOOT_STDIO_H_ + +extern int printf(const char *fmt, ...); + +extern int sprintf(char *buf, const char *fmt, ...); + +extern int vsprintf(char *buf, const char *fmt, va_list args); + +extern int putc(int c, void *f); +extern int putchar(int c); +extern int getchar(void); + +extern int fputs(char *str, void *f); + +#endif /* _PPC_BOOT_STDIO_H_ */ diff -ruN linus/arch/ppc64/boot/string.S linus-boot.2/arch/ppc64/boot/string.S --- linus/arch/ppc64/boot/string.S 2005-06-27 16:08:00.000000000 +1000 +++ linus-boot.2/arch/ppc64/boot/string.S 2005-08-05 11:46:40.000000000 +1000 @@ -9,7 +9,7 @@ * NOTE: this code runs in 32 bit mode and is packaged as ELF32. */ -#include +#include "ppc_asm.h" .text .globl strcpy diff -ruN linus/arch/ppc64/boot/string.h linus-boot.2/arch/ppc64/boot/string.h --- linus/arch/ppc64/boot/string.h 1970-01-01 10:00:00.000000000 +1000 +++ linus-boot.2/arch/ppc64/boot/string.h 2005-08-05 11:28:36.000000000 +1000 @@ -0,0 +1,16 @@ +#ifndef _PPC_BOOT_STRING_H_ +#define _PPC_BOOT_STRING_H_ + +extern char *strcpy(char *dest, const char *src); +extern char *strncpy(char *dest, const char *src, size_t n); +extern char *strcat(char *dest, const char *src); +extern int strcmp(const char *s1, const char *s2); +extern size_t strlen(const char *s); +extern size_t strnlen(const char *s, size_t count); + +extern void *memset(void *s, int c, size_t n); +extern void *memmove(void *dest, const void *src, unsigned long n); +extern void *memcpy(void *dest, const void *src, unsigned long n); +extern int memcmp(const void *s1, const void *s2, size_t n); + +#endif /* _PPC_BOOT_STRING_H_ */ diff -ruN linus/arch/ppc64/boot/zlib.c linus-boot.2/arch/ppc64/boot/zlib.c --- linus/arch/ppc64/boot/zlib.c 2005-06-27 16:08:00.000000000 +1000 +++ linus-boot.2/arch/ppc64/boot/zlib.c 2005-08-05 11:48:13.000000000 +1000 @@ -107,7 +107,7 @@ /* Diagnostic functions */ #ifdef DEBUG_ZLIB -# include +# include "stdio.h" # ifndef verbose # define verbose 0 # endif From michael at ellerman.id.au Mon Aug 8 13:55:33 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Mon, 8 Aug 2005 13:55:33 +1000 (EST) Subject: [PATCH 0/2] Make kexec work with ibmvscsi/ibmveth Message-ID: <1123473326.905217.26508543874.qpatch@concordia> On our Power5 we have vscsi and veth installed. When trying to kexec a new kernel the vscsi and veth initialisation fails because the previous kernel didn't clean up properly and as far as the Hypervisor is concerned is still connected. The fix is to harden the driver initialisation routines to cope with this condition and free the resource and retry. With these patches I can kexec happily on our Power5 LPAR. cheers From michael at ellerman.id.au Mon Aug 8 13:55:37 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Mon, 8 Aug 2005 13:55:37 +1000 (EST) Subject: [PATCH 1/2] ppc64: ibmvscsi: Harden driver initilisation for kexec In-Reply-To: <1123473326.905217.26508543874.qpatch@concordia> Message-ID: <20050808035537.D65FF67F3F@ozlabs.org> After a kexec the vscsi driver will fail when trying to register with the Hypervisor because the previous kernel has not unregistered. So if the registration fails, we unregister and then try again. Signed-off-by: Michael Ellerman drivers/scsi/ibmvscsi/rpa_vscsi.c | 27 ++++++++++++++++++++++++--- 1 files changed, 24 insertions(+), 3 deletions(-) Index: kexec/drivers/scsi/ibmvscsi/rpa_vscsi.c =================================================================== --- kexec.orig/drivers/scsi/ibmvscsi/rpa_vscsi.c +++ kexec/drivers/scsi/ibmvscsi/rpa_vscsi.c @@ -194,6 +194,28 @@ static void set_adapter_info(struct ibmv hostdata->madapter_info.os_type = 2; } +static int ibmvscsi_reg_crq_queue(uint32_t unit_addr, dma_addr_t token) +{ + int rc, try_again = 1; + + /* After a kexec the crq will still be open, so our attempt to + * open it will fail. So if we get a failure we free the crq and + * try again, but only once. */ +retry: + rc = plpar_hcall_norets(H_REG_CRQ, unit_addr, token, PAGE_SIZE); + + if (rc != H_Success && rc != 2 && try_again) { + do { + rc = plpar_hcall_norets(H_FREE_CRQ, unit_addr); + } while ((rc == H_Busy) || (H_isLongBusy(rc))); + + try_again = 0; + goto retry; + } + + return rc; +} + /** * initialize_crq_queue: - Initializes and registers CRQ with hypervisor * @queue: crq_queue to initialize and register @@ -226,9 +248,8 @@ int ibmvscsi_init_crq_queue(struct crq_q gather_partition_info(); set_adapter_info(hostdata); - rc = plpar_hcall_norets(H_REG_CRQ, - vdev->unit_address, - queue->msg_token, PAGE_SIZE); + rc = ibmvscsi_reg_crq_queue(vdev->unit_address, queue->msg_token); + if (rc == 2) { /* Adapter is good, but other end is not ready */ printk(KERN_WARNING "ibmvscsi: Partner adapter not ready\n"); From michael at ellerman.id.au Mon Aug 8 13:55:44 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Mon, 8 Aug 2005 13:55:44 +1000 (EST) Subject: [PATCH 2/2] ppc64: ibmveth: Harden driver initilisation for kexec In-Reply-To: <1123473326.905217.26508543874.qpatch@concordia> Message-ID: <20050808035544.9649567F46@ozlabs.org> After a kexec the veth driver will fail when trying to register with the Hypervisor because the previous kernel has not unregistered. So if the registration fails, we unregister and then try again. Signed-off-by: Michael Ellerman drivers/net/ibmveth.c | 32 ++++++++++++++++++++++++++------ 1 files changed, 26 insertions(+), 6 deletions(-) Index: kexec/drivers/net/ibmveth.c =================================================================== --- kexec.orig/drivers/net/ibmveth.c +++ kexec/drivers/net/ibmveth.c @@ -448,6 +448,31 @@ static void ibmveth_cleanup(struct ibmve ibmveth_free_buffer_pool(adapter, &adapter->rx_buff_pool[2]); } +static int ibmveth_register_logical_lan(struct ibmveth_adapter *adapter, + union ibmveth_buf_desc rxq_desc, u64 mac_address) +{ + int rc, try_again = 1; + + /* After a kexec the adapter will still be open, so our attempt to + * open it will fail. So if we get a failure we free the adapter and + * try again, but only once. */ +retry: + rc = h_register_logical_lan(adapter->vdev->unit_address, + adapter->buffer_list_dma, rxq_desc.desc, + adapter->filter_list_dma, mac_address); + + if (rc != H_Success && try_again) { + do { + rc = h_free_logical_lan(adapter->vdev->unit_address); + } while (H_isLongBusy(rc) || (rc == H_Busy)); + + try_again = 0; + goto retry; + } + + return rc; +} + static int ibmveth_open(struct net_device *netdev) { struct ibmveth_adapter *adapter = netdev->priv; @@ -523,12 +548,7 @@ static int ibmveth_open(struct net_devic ibmveth_debug_printk("filter list @ 0x%p\n", adapter->filter_list_addr); ibmveth_debug_printk("receive q @ 0x%p\n", adapter->rx_queue.queue_addr); - - lpar_rc = h_register_logical_lan(adapter->vdev->unit_address, - adapter->buffer_list_dma, - rxq_desc.desc, - adapter->filter_list_dma, - mac_address); + lpar_rc = ibmveth_register_logical_lan(adapter, rxq_desc, mac_address); if(lpar_rc != H_Success) { ibmveth_error_printk("h_register_logical_lan failed with %ld\n", lpar_rc); From paulus at samba.org Mon Aug 8 15:32:32 2005 From: paulus at samba.org (Paul Mackerras) Date: Mon, 8 Aug 2005 15:32:32 +1000 Subject: [PATCH] Externally visible buffer for CONFIG_CMDLINE In-Reply-To: <20050704193652.23980d26@brick.watson.ibm.com> References: <20050704193652.23980d26@brick.watson.ibm.com> Message-ID: <17142.61040.804303.329948@cargo.ozlabs.ibm.com> Michal Ostrowski writes: > Define a fixed buffer to store the CONFIG_CMDLINE string and the buffer > in it's own section. This allows for one to easily locate this buffer > in the vmlinux file (using objdump) and then use dd to change the > command line. (Allows one to avoid re-building everything to change the > command line when using hardware where the only command line is the > built-in one.) > +#ifdef CONFIG_CMDLINE > +const char builtin_cmdline[COMMAND_LINE_SIZE] > + __attribute__((section("__builtin_cmdline"))) = CONFIG_CMDLINE; > +#endif Where does the __builtin_cmdline section get linked, given that it isn't mentioned explicitly in the vmlinux.lds? > #ifdef CONFIG_CMDLINE > - if (l == 0 || (l == 1 && (*p) == 0)) > - strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); > -#endif /* CONFIG_CMDLINE */ > + if (l == 0 || (l == 1 && (*p) == 0)) { > + strlcpy(cmd_line, builtin_cmdline, sizeof(builtin_cmdline)); > + } > +#endif We seem to have gained an extra unnecessary pair of braces and lost the comment on the #endif. Paul. From paulus at samba.org Mon Aug 8 15:39:11 2005 From: paulus at samba.org (Paul Mackerras) Date: Mon, 8 Aug 2005 15:39:11 +1000 Subject: [RFC/PATCH] ppc64: Move ppc64_enable_pmcs() logic into a ppc_md function In-Reply-To: <200507121707.31061.michael@ellerman.id.au> References: <200507121707.31061.michael@ellerman.id.au> Message-ID: <17142.61439.561755.747453@cargo.ozlabs.ibm.com> Michael Ellerman writes: > This patch adds an enable_pmc entry to the ppc_md structure, and moves code > from arch/ppc64/kerne/sysfs.c into the various platform files. There should be > no functional changes. Not a bad idea, but why don't you make separate functions for bare-metal and hypervisor versions of pSeries_enable_pmcs, and set ppc_md.enable_pmcs to one or the other as appropriate? Paul. From michael at ellerman.id.au Mon Aug 8 18:45:39 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Mon, 8 Aug 2005 18:45:39 +1000 (EST) Subject: [PATCH] ppc64: Move ppc64_enable_pmcs() logic into a ppc_md function In-Reply-To: <17142.61439.561755.747453@cargo.ozlabs.ibm.com> Message-ID: <20050808084539.26A1B67F4A@ozlabs.org> Ok, here's an updated version. I've tested it on P5 LPAR and P4. It does what it used to. It still doesn't seem to actually work on P5, with or without this patch, ie. the counters never increment. I take it that's normal. Signed-off-by: Michael Ellerman arch/ppc64/kernel/iSeries_setup.c | 2 + arch/ppc64/kernel/pSeries_setup.c | 20 ++++++++++++ arch/ppc64/kernel/pmac_setup.c | 1 arch/ppc64/kernel/sysfs.c | 54 ++-------------------------------- arch/ppc64/oprofile/op_model_power4.c | 21 +++++++++++++ include/asm-ppc64/machdep.h | 5 +++ 6 files changed, 53 insertions(+), 50 deletions(-) Index: work/arch/ppc64/kernel/iSeries_setup.c =================================================================== --- work.orig/arch/ppc64/kernel/iSeries_setup.c +++ work/arch/ppc64/kernel/iSeries_setup.c @@ -947,6 +947,8 @@ void __init iSeries_early_setup(void) ppc_md.calibrate_decr = iSeries_calibrate_decr; ppc_md.progress = iSeries_progress; + /* XXX Implement enable_pmcs for iSeries */ + if (get_paca()->lppaca.shared_proc) { ppc_md.idle_loop = iseries_shared_idle; printk(KERN_INFO "Using shared processor idle loop\n"); Index: work/arch/ppc64/kernel/pSeries_setup.c =================================================================== --- work.orig/arch/ppc64/kernel/pSeries_setup.c +++ work/arch/ppc64/kernel/pSeries_setup.c @@ -187,6 +187,21 @@ static void __init pSeries_setup_mpic(vo " MPIC "); } +static void pseries_lpar_enable_pmcs(void) +{ + unsigned long set, reset; + + power4_enable_pmcs(); + + set = 1UL << 63; + reset = 0; + plpar_hcall_norets(H_PERFMON, set, reset); + + /* instruct hypervisor to maintain PMCs */ + if (firmware_has_feature(FW_FEATURE_SPLPAR)) + get_paca()->lppaca.pmcregs_in_use = 1; +} + static void __init pSeries_setup_arch(void) { /* Fixup ppc_md depending on the type of interrupt controller */ @@ -245,6 +260,11 @@ static void __init pSeries_setup_arch(vo printk(KERN_INFO "Using default idle loop\n"); ppc_md.idle_loop = default_idle; } + + if (systemcfg->platform & PLATFORM_LPAR) + ppc_md.enable_pmcs = pseries_lpar_enable_pmcs; + else + ppc_md.enable_pmcs = power4_enable_pmcs; } static int __init pSeries_init_panel(void) Index: work/arch/ppc64/kernel/pmac_setup.c =================================================================== --- work.orig/arch/ppc64/kernel/pmac_setup.c +++ work/arch/ppc64/kernel/pmac_setup.c @@ -511,4 +511,5 @@ struct machdep_calls __initdata pmac_md .progress = pmac_progress, .check_legacy_ioport = pmac_check_legacy_ioport, .idle_loop = native_idle, + .enable_pmcs = power4_enable_cpus, }; Index: work/arch/ppc64/kernel/sysfs.c =================================================================== --- work.orig/arch/ppc64/kernel/sysfs.c +++ work/arch/ppc64/kernel/sysfs.c @@ -101,6 +101,8 @@ static int __init setup_smt_snooze_delay } __setup("smt-snooze-delay=", setup_smt_snooze_delay); +#endif /* CONFIG_PPC_MULTIPLATFORM */ + /* * Enabling PMCs will slow partition context switch times so we only do * it the first time we write to the PMCs. @@ -110,63 +112,15 @@ static DEFINE_PER_CPU(char, pmcs_enabled void ppc64_enable_pmcs(void) { - unsigned long hid0; -#ifdef CONFIG_PPC_PSERIES - unsigned long set, reset; -#endif /* CONFIG_PPC_PSERIES */ - /* Only need to enable them once */ if (__get_cpu_var(pmcs_enabled)) return; __get_cpu_var(pmcs_enabled) = 1; - switch (systemcfg->platform) { - case PLATFORM_PSERIES: - case PLATFORM_POWERMAC: - hid0 = mfspr(HID0); - hid0 |= 1UL << (63 - 20); - - /* POWER4 requires the following sequence */ - asm volatile( - "sync\n" - "mtspr %1, %0\n" - "mfspr %0, %1\n" - "mfspr %0, %1\n" - "mfspr %0, %1\n" - "mfspr %0, %1\n" - "mfspr %0, %1\n" - "mfspr %0, %1\n" - "isync" : "=&r" (hid0) : "i" (HID0), "0" (hid0): - "memory"); - break; - -#ifdef CONFIG_PPC_PSERIES - case PLATFORM_PSERIES_LPAR: - set = 1UL << 63; - reset = 0; - plpar_hcall_norets(H_PERFMON, set, reset); - break; -#endif /* CONFIG_PPC_PSERIES */ - - default: - break; - } - - /* instruct hypervisor to maintain PMCs */ - if (firmware_has_feature(FW_FEATURE_SPLPAR)) - get_paca()->lppaca.pmcregs_in_use = 1; + if (ppc_md.enable_pmcs) + ppc_md.enable_pmcs(); } - -#else - -/* PMC stuff */ -void ppc64_enable_pmcs(void) -{ - /* XXX Implement for iseries */ -} -#endif /* CONFIG_PPC_MULTIPLATFORM */ - EXPORT_SYMBOL(ppc64_enable_pmcs); /* XXX convert to rusty's on_one_cpu */ Index: work/arch/ppc64/oprofile/op_model_power4.c =================================================================== --- work.orig/arch/ppc64/oprofile/op_model_power4.c +++ work/arch/ppc64/oprofile/op_model_power4.c @@ -83,6 +83,27 @@ static void power4_reg_setup(struct op_c mmcr0_val |= MMCR0_PROBLEM_DISABLE; } +void power4_enable_pmcs(void) +{ + unsigned long hid0; + + hid0 = mfspr(HID0); + hid0 |= 1UL << (63 - 20); + + /* POWER4 requires the following sequence */ + asm volatile( + "sync\n" + "mtspr %1, %0\n" + "mfspr %0, %1\n" + "mfspr %0, %1\n" + "mfspr %0, %1\n" + "mfspr %0, %1\n" + "mfspr %0, %1\n" + "mfspr %0, %1\n" + "isync" : "=&r" (hid0) : "i" (HID0), "0" (hid0): + "memory"); +} + extern void ppc64_enable_pmcs(void); static void power4_cpu_setup(void *unused) Index: work/include/asm-ppc64/machdep.h =================================================================== --- work.orig/include/asm-ppc64/machdep.h +++ work/include/asm-ppc64/machdep.h @@ -140,11 +140,16 @@ struct machdep_calls { /* Idle loop for this platform, leave empty for default idle loop */ int (*idle_loop)(void); + + /* Function to enable pmcs for this platform, called once per cpu. */ + void (*enable_pmcs)(void); }; extern int default_idle(void); extern int native_idle(void); +extern void power4_enable_pmcs(void); + extern struct machdep_calls ppc_md; extern char cmd_line[COMMAND_LINE_SIZE]; From michael at ellerman.id.au Mon Aug 8 18:47:08 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Mon, 8 Aug 2005 18:47:08 +1000 Subject: [PATCH] ppc64: Move ppc64_enable_pmcs() logic into a ppc_md function In-Reply-To: <20050808084539.26A1B67F4A@ozlabs.org> References: <20050808084539.26A1B67F4A@ozlabs.org> Message-ID: <200508081847.11327.michael@ellerman.id.au> Sorry, I should add this depends on Stephen's firmware feature patches. On Mon, 8 Aug 2005 18:45, Michael Ellerman wrote: > Ok, here's an updated version. > > I've tested it on P5 LPAR and P4. It does what it used to. > > It still doesn't seem to actually work on P5, with or without this patch, > ie. the counters never increment. I take it that's normal. > > Signed-off-by: Michael Ellerman > > arch/ppc64/kernel/iSeries_setup.c | 2 + > arch/ppc64/kernel/pSeries_setup.c | 20 ++++++++++++ > arch/ppc64/kernel/pmac_setup.c | 1 > arch/ppc64/kernel/sysfs.c | 54 > ++-------------------------------- arch/ppc64/oprofile/op_model_power4.c | > 21 +++++++++++++ > include/asm-ppc64/machdep.h | 5 +++ > 6 files changed, 53 insertions(+), 50 deletions(-) > > Index: work/arch/ppc64/kernel/iSeries_setup.c > =================================================================== > --- work.orig/arch/ppc64/kernel/iSeries_setup.c > +++ work/arch/ppc64/kernel/iSeries_setup.c > @@ -947,6 +947,8 @@ void __init iSeries_early_setup(void) > ppc_md.calibrate_decr = iSeries_calibrate_decr; > ppc_md.progress = iSeries_progress; > > + /* XXX Implement enable_pmcs for iSeries */ > + > if (get_paca()->lppaca.shared_proc) { > ppc_md.idle_loop = iseries_shared_idle; > printk(KERN_INFO "Using shared processor idle loop\n"); > Index: work/arch/ppc64/kernel/pSeries_setup.c > =================================================================== > --- work.orig/arch/ppc64/kernel/pSeries_setup.c > +++ work/arch/ppc64/kernel/pSeries_setup.c > @@ -187,6 +187,21 @@ static void __init pSeries_setup_mpic(vo > " MPIC "); > } > > +static void pseries_lpar_enable_pmcs(void) > +{ > + unsigned long set, reset; > + > + power4_enable_pmcs(); > + > + set = 1UL << 63; > + reset = 0; > + plpar_hcall_norets(H_PERFMON, set, reset); > + > + /* instruct hypervisor to maintain PMCs */ > + if (firmware_has_feature(FW_FEATURE_SPLPAR)) > + get_paca()->lppaca.pmcregs_in_use = 1; > +} > + > static void __init pSeries_setup_arch(void) > { > /* Fixup ppc_md depending on the type of interrupt controller */ > @@ -245,6 +260,11 @@ static void __init pSeries_setup_arch(vo > printk(KERN_INFO "Using default idle loop\n"); > ppc_md.idle_loop = default_idle; > } > + > + if (systemcfg->platform & PLATFORM_LPAR) > + ppc_md.enable_pmcs = pseries_lpar_enable_pmcs; > + else > + ppc_md.enable_pmcs = power4_enable_pmcs; > } > > static int __init pSeries_init_panel(void) > Index: work/arch/ppc64/kernel/pmac_setup.c > =================================================================== > --- work.orig/arch/ppc64/kernel/pmac_setup.c > +++ work/arch/ppc64/kernel/pmac_setup.c > @@ -511,4 +511,5 @@ struct machdep_calls __initdata pmac_md > .progress = pmac_progress, > .check_legacy_ioport = pmac_check_legacy_ioport, > .idle_loop = native_idle, > + .enable_pmcs = power4_enable_cpus, > }; > Index: work/arch/ppc64/kernel/sysfs.c > =================================================================== > --- work.orig/arch/ppc64/kernel/sysfs.c > +++ work/arch/ppc64/kernel/sysfs.c > @@ -101,6 +101,8 @@ static int __init setup_smt_snooze_delay > } > __setup("smt-snooze-delay=", setup_smt_snooze_delay); > > +#endif /* CONFIG_PPC_MULTIPLATFORM */ > + > /* > * Enabling PMCs will slow partition context switch times so we only do > * it the first time we write to the PMCs. > @@ -110,63 +112,15 @@ static DEFINE_PER_CPU(char, pmcs_enabled > > void ppc64_enable_pmcs(void) > { > - unsigned long hid0; > -#ifdef CONFIG_PPC_PSERIES > - unsigned long set, reset; > -#endif /* CONFIG_PPC_PSERIES */ > - > /* Only need to enable them once */ > if (__get_cpu_var(pmcs_enabled)) > return; > > __get_cpu_var(pmcs_enabled) = 1; > > - switch (systemcfg->platform) { > - case PLATFORM_PSERIES: > - case PLATFORM_POWERMAC: > - hid0 = mfspr(HID0); > - hid0 |= 1UL << (63 - 20); > - > - /* POWER4 requires the following sequence */ > - asm volatile( > - "sync\n" > - "mtspr %1, %0\n" > - "mfspr %0, %1\n" > - "mfspr %0, %1\n" > - "mfspr %0, %1\n" > - "mfspr %0, %1\n" > - "mfspr %0, %1\n" > - "mfspr %0, %1\n" > - "isync" : "=&r" (hid0) : "i" (HID0), "0" (hid0): > - "memory"); > - break; > - > -#ifdef CONFIG_PPC_PSERIES > - case PLATFORM_PSERIES_LPAR: > - set = 1UL << 63; > - reset = 0; > - plpar_hcall_norets(H_PERFMON, set, reset); > - break; > -#endif /* CONFIG_PPC_PSERIES */ > - > - default: > - break; > - } > - > - /* instruct hypervisor to maintain PMCs */ > - if (firmware_has_feature(FW_FEATURE_SPLPAR)) > - get_paca()->lppaca.pmcregs_in_use = 1; > + if (ppc_md.enable_pmcs) > + ppc_md.enable_pmcs(); > } > - > -#else > - > -/* PMC stuff */ > -void ppc64_enable_pmcs(void) > -{ > - /* XXX Implement for iseries */ > -} > -#endif /* CONFIG_PPC_MULTIPLATFORM */ > - > EXPORT_SYMBOL(ppc64_enable_pmcs); > > /* XXX convert to rusty's on_one_cpu */ > Index: work/arch/ppc64/oprofile/op_model_power4.c > =================================================================== > --- work.orig/arch/ppc64/oprofile/op_model_power4.c > +++ work/arch/ppc64/oprofile/op_model_power4.c > @@ -83,6 +83,27 @@ static void power4_reg_setup(struct op_c > mmcr0_val |= MMCR0_PROBLEM_DISABLE; > } > > +void power4_enable_pmcs(void) > +{ > + unsigned long hid0; > + > + hid0 = mfspr(HID0); > + hid0 |= 1UL << (63 - 20); > + > + /* POWER4 requires the following sequence */ > + asm volatile( > + "sync\n" > + "mtspr %1, %0\n" > + "mfspr %0, %1\n" > + "mfspr %0, %1\n" > + "mfspr %0, %1\n" > + "mfspr %0, %1\n" > + "mfspr %0, %1\n" > + "mfspr %0, %1\n" > + "isync" : "=&r" (hid0) : "i" (HID0), "0" (hid0): > + "memory"); > +} > + > extern void ppc64_enable_pmcs(void); > > static void power4_cpu_setup(void *unused) > Index: work/include/asm-ppc64/machdep.h > =================================================================== > --- work.orig/include/asm-ppc64/machdep.h > +++ work/include/asm-ppc64/machdep.h > @@ -140,11 +140,16 @@ struct machdep_calls { > > /* Idle loop for this platform, leave empty for default idle loop */ > int (*idle_loop)(void); > + > + /* Function to enable pmcs for this platform, called once per cpu. */ > + void (*enable_pmcs)(void); > }; > > extern int default_idle(void); > extern int native_idle(void); > > +extern void power4_enable_pmcs(void); > + > extern struct machdep_calls ppc_md; > extern char cmd_line[COMMAND_LINE_SIZE]; > > _______________________________________________ > Linuxppc64-dev mailing list > Linuxppc64-dev at ozlabs.org > https://ozlabs.org/mailman/listinfo/linuxppc64-dev -- Michael Ellerman IBM OzLabs email: michael:ellerman.id.au inmsg: mpe:jabber.org wwweb: http://michael.ellerman.id.au phone: +61 2 6212 1183 (tie line 70 21183) We do not inherit the earth from our ancestors, we borrow it from our children. - S.M.A.R.T Person -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20050808/85ff0d73/attachment.pgp From mostrows at watson.ibm.com Mon Aug 8 23:32:16 2005 From: mostrows at watson.ibm.com (Michal Ostrowski) Date: Mon, 8 Aug 2005 09:32:16 -0400 Subject: [PATCH] Externally visible buffer for CONFIG_CMDLINE In-Reply-To: <17142.61040.804303.329948@cargo.ozlabs.ibm.com> References: <20050704193652.23980d26@brick.watson.ibm.com> <17142.61040.804303.329948@cargo.ozlabs.ibm.com> Message-ID: <20050808093216.4027bd6f@brick.watson.ibm.com> I've included a better patch which does similar things to the bzImage wrapper code as we discussed at OLS. On Mon, 8 Aug 2005 15:32:32 +1000 Paul Mackerras wrote: > Michal Ostrowski writes: > > > +#ifdef CONFIG_CMDLINE > > +const char builtin_cmdline[COMMAND_LINE_SIZE] > > + __attribute__((section("__builtin_cmdline"))) = CONFIG_CMDLINE; > > +#endif > > Where does the __builtin_cmdline section get linked, given that it > isn't mentioned explicitly in the vmlinux.lds? There is no need to actually specify it in vmlinux.lds. The linker will simply create that section. The linker will also create symbols which let me reference the boundaries of this section (e.g. __start___builtin_cmdline). In my builds it ends up after .rodata and before .pci_fixup. -- Michal Ostrowski # HG changeset patch # User mostrows at heater.watson.ibm.com # Node ID 8b371ee4b3b31923857f540a28fdcd3d2a42233c # Parent 9f5416993abdaa44f3ecc9095372eeb5e9816704 Allow for built-in command line to be edited in binary images. Define buffers for the built-in command-line strings in the bzImage wrapper and in the early boot program. The buffers reside in sections called "__builtin_cmdline" and so can be easily accessed and modified by tools. This avoid the need to reconfigure and re-build in order to change a built-in command line. Precedence is always given to an existing /chosen/bootargs property (but if one is not present bzImage wrapper will create one with the contents of it's built-in command-line buffer). Signed-off-by: Michal Ostrowski diff -r 9f5416993abd -r 8b371ee4b3b3 arch/ppc64/boot/main.c --- a/arch/ppc64/boot/main.c Mon Aug 8 03:00:07 2005 +++ b/arch/ppc64/boot/main.c Mon Aug 8 13:28:34 2005 @@ -14,9 +14,11 @@ #include #include #include +#include extern void *finddevice(const char *); extern int getprop(void *, const char *, void *, int); +extern int setprop(void *, const char *, void *, int); extern void printf(const char *fmt, ...); extern int sprintf(char *buf, const char *fmt, ...); void gunzip(void *, int, unsigned char *, int *); @@ -73,6 +75,11 @@ #undef DEBUG +#ifdef CONFIG_CMDLINE +char builtin_cmdline[COMMAND_LINE_SIZE] + __attribute__((section("__builtin_cmdline"))) = CONFIG_CMDLINE; +#endif + static unsigned long claim_base = PROG_START; static unsigned long try_claim(unsigned long size) @@ -97,6 +104,7 @@ { unsigned long i; kernel_entry_t kernel_entry; + char cmdline[COMMAND_LINE_SIZE]; Elf64_Ehdr *elf64; Elf64_Phdr *elf64ph; @@ -109,6 +117,15 @@ stderr = stdout; if (getprop(chosen_handle, "stdin", &stdin, sizeof(stdin)) != 4) exit(); + +#ifdef CONFIG_CMDLINE + i = getprop(chosen_handle, "bootargs", cmdline, sizeof(cmdline)); + if (i <= 0 || cmdline[0] == 0) { + setprop(chosen_handle, "bootargs", builtin_cmdline, + strlen(builtin_cmdline)); + } + +#endif /* CONFIG_CMDLINE */ printf("\n\rzImage starting: loaded at 0x%x\n\r", (unsigned)_start); diff -r 9f5416993abd -r 8b371ee4b3b3 arch/ppc64/boot/prom.c --- a/arch/ppc64/boot/prom.c Mon Aug 8 03:00:07 2005 +++ b/arch/ppc64/boot/prom.c Mon Aug 8 13:28:34 2005 @@ -38,6 +38,7 @@ void exit(void); void *finddevice(const char *name); int getprop(void *phandle, const char *name, void *buf, int buflen); +int setprop(void *phandle, const char *name, void *buf, int buflen); void chrpboot(int a1, int a2, void *prom); /* in main.c */ int printf(char *fmt, ...); @@ -175,6 +176,32 @@ } args; args.service = "getprop"; + args.nargs = 4; + args.nret = 1; + args.phandle = phandle; + args.name = name; + args.buf = buf; + args.buflen = buflen; + args.size = -1; + (*prom)(&args); + return args.size; +} + +int +setprop(void *phandle, const char *name, void *buf, int buflen) +{ + struct prom_args { + char *service; + int nargs; + int nret; + void *phandle; + const char *name; + void *buf; + int buflen; + int size; + } args; + + args.service = "setprop"; args.nargs = 4; args.nret = 1; args.phandle = phandle; diff -r 9f5416993abd -r 8b371ee4b3b3 arch/ppc64/kernel/prom.c --- a/arch/ppc64/kernel/prom.c Mon Aug 8 03:00:07 2005 +++ b/arch/ppc64/kernel/prom.c Mon Aug 8 13:28:34 2005 @@ -72,6 +72,10 @@ u32 size; }; +#ifdef CONFIG_CMDLINE +const char builtin_cmdline[COMMAND_LINE_SIZE] + __attribute__((section("__builtin_cmdline"))) = CONFIG_CMDLINE; +#endif typedef int interpret_func(struct device_node *, unsigned long *, int, int, int); @@ -870,7 +874,7 @@ } #ifdef CONFIG_CMDLINE if (l == 0 || (l == 1 && (*p) == 0)) - strlcpy(cmd_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); + strlcpy(cmd_line, builtin_cmdline, sizeof(builtin_cmdline)); #endif /* CONFIG_CMDLINE */ DBG("Command line is: %s\n", cmd_line); diff -r 9f5416993abd -r 8b371ee4b3b3 arch/ppc64/kernel/prom_init.c --- a/arch/ppc64/kernel/prom_init.c Mon Aug 8 03:00:07 2005 +++ b/arch/ppc64/kernel/prom_init.c Mon Aug 8 13:28:34 2005 @@ -56,6 +56,10 @@ extern const struct linux_logo logo_linux_clut224; #endif +#ifdef CONFIG_CMDLINE +extern const char builtin_cmdline[COMMAND_LINE_SIZE]; +#endif + /* * Properties whose value is longer than this get excluded from our * copy of the device tree. This value does need to be big enough to @@ -477,7 +481,7 @@ #ifdef CONFIG_CMDLINE if (l == 0) /* dbl check */ strlcpy(RELOC(prom_cmd_line), - RELOC(CONFIG_CMDLINE), sizeof(prom_cmd_line)); + RELOC(builtin_cmdline), sizeof(prom_cmd_line)); #endif /* CONFIG_CMDLINE */ prom_printf("command line: %s\n", RELOC(prom_cmd_line)); -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20050808/0b5c1514/attachment.pgp From sharada at in.ibm.com Tue Aug 9 01:23:48 2005 From: sharada at in.ibm.com (R Sharada) Date: Mon, 8 Aug 2005 20:53:48 +0530 Subject: kexec-tools for ppc64 - RFC Message-ID: <20050808152348.GA4898@in.ibm.com> Hello, Finally, here is a first draft of the kexec-tools support for ppc64. This has been tested on Power4 p630 machine, in both lpar and non-lpar environments, with kexec-tools-1.101 and linux kernel version 2.6.13-rc5. Current Status --------------- kexec-tools can now be used to kexec load and reboot into a second kernel. This integration uses the old tools primarily written by Milton Miller and enables the old tools to work from within the kexec-tools package. - fs2dt which is the device-tree flattening code is still retained as a separate source file, but converted into a function call, which is called from within kexec-tools code. - v2wrap is still retained as a separate assembly stub and is being compiled and built from within the kexec/arch/ppc64 directory. - v2wrap + flat device-tree is still loaded as a single segment. - default compilation is 64-bit. Current Limitations -------------------- - User has to supply the load addresses (or range in which the load address is to start at) for 2 segments that are currently supported - vmlinux, and v2wrap. This is because of a limitation in the amount of data currently available from get_memory_ranges on ppc64. get_memory_ranges currently reads the memory range from /proc/device-tree which does not provide information about the memory ranges occupied by the hash page tables (in non-lpar case), as well as the rmo boundary for both lpar and non-lpar. - Hackish way to find the device-tree load address (by calling locate_hole in advance) to fill up the reserve_mem address for device-tree. - initrd loading is currently not supported. Work in Progress ----------------- - Clean up build to put v2wrap binary into objdir - Fix and clean up the get_memory_range support in ppc64 so that we do not have to have the user to supply load addresses for the segments. - Adding support to load initrd image. ToDo ----- - Integrate v2wrap to be built from within purgatory Example Usage -------------- A sample load call would be: kexec -l vmlinux --v2wrap=v2wrap --append="v2wrap-base=0x5000000 vmlinux-base=0x6000000" To kexec reboot: kexec -e ps: I still seem to have to do an occasional ifdown on the network interface prior to a kexec -e This however still needs lots of testing and cleanups some of which will be posted shortly. Kindly review / test and provide comments. Thanks and Regards, Sharada --- kexec-tools-1.101-sharada/Makefile | 4 kexec-tools-1.101-sharada/configure | 7 kexec-tools-1.101-sharada/kexec/arch/ppc64/Makefile | 5 kexec-tools-1.101-sharada/kexec/arch/ppc64/fs2dt.c | 314 ++++++++++ kexec-tools-1.101-sharada/kexec/arch/ppc64/kexec-elf-ppc64.c | 201 +++++- kexec-tools-1.101-sharada/kexec/arch/ppc64/kexec-elf-rel-ppc64.c | 2 kexec-tools-1.101-sharada/kexec/arch/ppc64/kexec-ppc64.c | 168 +++++ kexec-tools-1.101-sharada/kexec/arch/ppc64/kexec-ppc64.h | 6 kexec-tools-1.101-sharada/kexec/arch/ppc64/make_v2wrap | 13 kexec-tools-1.101-sharada/kexec/arch/ppc64/v2wrap.S | 114 +++ kexec-tools-1.101-sharada/purgatory/Makefile | 5 11 files changed, 799 insertions(+), 40 deletions(-) diff -puN configure~kexec-tools-ppc64 configure --- kexec-tools-1.101/configure~kexec-tools-ppc64 2005-08-08 20:26:12.000000000 +0530 +++ kexec-tools-1.101-sharada/configure 2005-08-08 20:27:19.000000000 +0530 @@ -1384,6 +1384,9 @@ case $host_cpu in powerpc ) host_cpu="ppc" ;; + powerpc64 ) + host_cpu="ppc64" + ;; * ) host_cpu="$host_cpu" ;; @@ -1421,6 +1424,10 @@ if test "${with_gamecube+set}" = set; th EXTRA_CFLAGS="$EXTRA_CFLAGS -DCONFIG_GAMECUBE=1" fi; +# Check whether ppc64. Add -m64 for building 64-bit binary +if test "$ARCH"=ppc64; then + EXTRA_CFLAGS="$EXTRA_CFLAGS -m64" +fi; # Check whether --with-zlib or --without-zlib was given. if test "${with_zlib+set}" = set; then diff -puN Makefile~kexec-tools-ppc64 Makefile --- kexec-tools-1.101/Makefile~kexec-tools-ppc64 2005-08-08 20:26:12.000000000 +0530 +++ kexec-tools-1.101-sharada/Makefile 2005-08-08 20:35:13.000000000 +0530 @@ -89,6 +89,10 @@ endif ifeq ($(ARCH),x86_64) include kexec_test/Makefile endif +ifeq ($(ARCH),ppc64) +include kexec/arch/ppc64/make_v2wrap +endif + GENERATED_SRCS:= ./configure SPEC=$(OBJDIR)/$(PACKAGE)-$(VERSION).spec diff -puN /dev/null kexec/arch/ppc64/fs2dt.c --- /dev/null 2005-08-08 20:42:13.772546000 +0530 +++ kexec-tools-1.101-sharada/kexec/arch/ppc64/fs2dt.c 2005-08-08 20:39:26.000000000 +0530 @@ -0,0 +1,314 @@ +/* + * fs2dt: creates a flattened device-tree + * + * Copyright (C) 2004,2005 Milton D Miller II, IBM Corporation + * Copyright (C) 2005 R Sharada (sharada at in.ibm.com), IBM Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation (version 2 of the License). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include "kexec-ppc64.h" + +#define MAXPATH 1024 /* max path name length */ +#define NAMESPACE 16384 /* max bytes for property names */ +#define TREEWORDS 65536 /* max 32 bit words for property values */ +#define MEMRESERVE 256 /* max number of reserved memory blocks */ + +enum { + ERR_NONE, + ERR_USAGE, + ERR_OPENDIR, + ERR_READDIR, + ERR_STAT, + ERR_OPEN, + ERR_READ, + ERR_RESERVE, +}; + +void err(const char *str, int rc) +{ + if (errno) + perror(str); + else + fprintf(stderr, "%s: unrecoverable error\n", str); + exit(rc); +} + +typedef unsigned dvt; +struct stat statbuf[1]; +char pathname[MAXPATH], *pathstart; +char propnames[NAMESPACE]; +dvt dtstruct[TREEWORDS], *dt; +unsigned long long mem_rsrv[2*MEMRESERVE]; + +extern unsigned long initrd_base; +extern unsigned long initrd_size; + +void reserve(unsigned long long where, unsigned long long length) +{ + unsigned long long *mr; + + mr = mem_rsrv; + + while(mr[1]) + mr += 2; + + mr[0] = where; + mr[1] = length; +} + +/* look for properties we need to reserve memory space for */ +void checkprop(char *name, dvt *data) +{ + static unsigned long long base, size, end; + + if ((data == NULL) && (base || size || end)) + err((void *)data, ERR_RESERVE); + else if (!strcmp(name, "linux,rtas-base")) + base = *data; + else if (!strcmp(name, "linux,initrd-start")) { + if (initrd_base) + base = initrd_base; + else + base = *(unsigned long long *) data; + } + else if (!strcmp(name, "linux,tce-base")) + base = *(unsigned long long *) data; + else if (!strcmp(name, "rtas-size") || + !strcmp(name, "linux,tce-size")) + size = *data; + else if (!strcmp(name, "linux,initrd-end")) { + if (initrd_size) + size = initrd_size; + else + end = *(unsigned long long *) data; + } + if (size && end) + err(name, ERR_RESERVE); + if (base && size) { + reserve(base, size); + base = size = 0; + } + if (base && end) { + reserve(base, end-base); + base = end = 0; + } +} + +/* + * return the property index for a property name, creating a new one + * if needed. + */ +dvt propnum(const char *name) +{ + dvt offset = 0; + + while(propnames[offset]) + if (strcmp(name, propnames+offset)) + offset += strlen(propnames+offset)+1; + else + return offset; + + strcpy(propnames+offset, name); + + return offset; +} + +/* put all properties (files) in the property structure */ +void putprops(char *fn, DIR *dir) +{ + struct dirent *dp; + + while ((dp = readdir(dir)) != NULL) { + strcpy(fn, dp->d_name); + + if (lstat(pathname, statbuf)) + err(pathname, ERR_STAT); + + if (S_ISREG(statbuf[0].st_mode)) { + int fd, len = statbuf[0].st_size; + + *dt++ = 3; + *dt++ = len; + *dt++ = propnum(fn); + + if ((len >= 8) && ((unsigned long)dt & 0x4)) + dt++; + + fd = open(pathname, O_RDONLY); + if (fd == -1) + err(pathname, ERR_OPEN); + if (read(fd, dt, len) != len) + err(pathname, ERR_READ); + close(fd); + + checkprop(fn, dt); + + dt += (len + 3)/4; + } + } + fn[0] = '\0'; + if(errno == ENOSYS) + errno = 0; + if (errno) + err(pathname, ERR_READDIR); + checkprop(pathname, NULL); +} + +/* + * put a node (directory) in the property structure. first properties + * then children. + */ +void putnode(void) +{ + DIR *dir; + char *dn; + struct dirent *dp; + + *dt++ = 1; + strcpy((void *)dt, *pathstart ? pathstart : "/"); + while(*dt) + dt++; + if (dt[-1] & 0xff) + dt++; + + dir = opendir(pathname); + + if (!dir) + err(pathname, ERR_OPENDIR); + + strcat(pathname, "/"); + dn = pathname + strlen(pathname); + + putprops(dn, dir); + + rewinddir(dir); + + while ((dp = readdir(dir)) != NULL) { + strcpy(dn, dp->d_name); + + if (!strcmp(dn, ".") || !strcmp(dn, "..")) + continue; + + if (lstat(pathname, statbuf)) + err(pathname, ERR_STAT); + + if (S_ISDIR(statbuf[0].st_mode)) + putnode(); + } + if (errno) + err(pathname, ERR_READDIR); + + *dt++ = 2; + closedir(dir); + dn[-1] = '\0'; +} + +/* boot block version 2 as defined by the linux kernel */ +struct bootblock { + unsigned magic, + totalsize, + off_dt_struct, + off_dt_strings, + off_mem_rsvmap, + version, + last_comp_version, + boot_physid; +} bb[1]; + +struct devtree_data { + unsigned long load_addr; + unsigned long initrd_start; + unsigned long initrd_size; +}; + +int create_flatten_tree(struct kexec_info *info, unsigned char **bufp, unsigned long *sizep) +{ + unsigned long len; + unsigned long tlen; + unsigned char *buf; + unsigned long me; + unsigned long base_addr; + unsigned long size; + + me = 0; + base_addr = 0; + + strcpy(pathname, "/proc/device-tree/"); + + pathstart = pathname + strlen(pathname); + dt = dtstruct; + + putnode(); + *dt++ = 9; + + len = sizeof(bb[0]); + len += 7; len &= ~7; + + bb->off_mem_rsvmap = len; + + for (len = 1; mem_rsrv[len]; len += 2) + ; + len+= 3; + len *= sizeof(mem_rsrv[0]); + + bb->off_dt_struct = bb->off_mem_rsvmap + len; + + len = dt - dtstruct; + len *= sizeof(dvt); + bb->off_dt_strings = bb->off_dt_struct + len; + + len = propnum(""); + len += 3; len &= ~3; + bb->totalsize = bb->off_dt_strings + len; + + bb->magic = 0xd00dfeed; + bb->version = 2; + bb->last_comp_version = 2; + + size = bb->totalsize + 0x100; + /* Hacks - should clean this up so that we can set a logical and valid + * min and max addr to pass into locate_hole + */ + unsigned long max_addr = v2wrap_base + 0x1000000; + base_addr = (unsigned long)locate_hole(info, size, 0, v2wrap_base, max_addr, -1); + if (base_addr) { + me = base_addr + 0x100; + } + + reserve(me, bb->totalsize); + + buf = (unsigned char *) realloc(*bufp, *sizep + bb->totalsize); + *bufp = buf; + memcpy(buf+(*sizep), bb, bb->off_mem_rsvmap); + tlen = *sizep + bb->off_mem_rsvmap; + memcpy(buf+tlen, mem_rsrv, bb->off_dt_struct - bb->off_mem_rsvmap); + tlen = tlen + (bb->off_dt_struct - bb->off_mem_rsvmap); + memcpy(buf+tlen, dtstruct, bb->off_dt_strings - bb->off_dt_struct); + tlen = tlen + (bb->off_dt_strings - bb->off_dt_struct); + memcpy(buf+tlen, propnames, bb->totalsize - bb->off_dt_strings); + tlen = tlen + bb->totalsize - bb->off_dt_strings; + *sizep = tlen; + return 0; +} diff -puN kexec/arch/ppc64/kexec-elf-ppc64.c~kexec-tools-ppc64 kexec/arch/ppc64/kexec-elf-ppc64.c --- kexec-tools-1.101/kexec/arch/ppc64/kexec-elf-ppc64.c~kexec-tools-ppc64 2005-08-08 20:26:13.000000000 +0530 +++ kexec-tools-1.101-sharada/kexec/arch/ppc64/kexec-elf-ppc64.c 2005-08-08 20:39:50.000000000 +0530 @@ -3,6 +3,7 @@ * * Copyright (C) 2004 Adam Litke (agl at us.ibm.com) * Copyright (C) 2004 IBM Corp. + * Copyright (C) 2005 R Sharada (sharada at in.ibm.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,45 +34,14 @@ #include "../../kexec.h" #include "../../kexec-elf.h" #include "kexec-ppc64.h" +#include #define BOOTLOADER "kexec" #define BOOTLOADER_VERSION VERSION #define MAX_COMMAND_LINE 256 -#define UPSZ(X) ((sizeof(X) + 3) & ~3) -static struct boot_notes { - Elf_Bhdr hdr; - Elf_Nhdr bl_hdr; - unsigned char bl_desc[UPSZ(BOOTLOADER)]; - Elf_Nhdr blv_hdr; - unsigned char blv_desc[UPSZ(BOOTLOADER_VERSION)]; - Elf_Nhdr cmd_hdr; - unsigned char command_line[0]; -} elf_boot_notes = { - .hdr = { - .b_signature = 0x0E1FB007, - .b_size = sizeof(elf_boot_notes), - .b_checksum = 0, - .b_records = 3, - }, - .bl_hdr = { - .n_namesz = 0, - .n_descsz = sizeof(BOOTLOADER), - .n_type = EBN_BOOTLOADER_NAME, - }, - .bl_desc = BOOTLOADER, - .blv_hdr = { - .n_namesz = 0, - .n_descsz = sizeof(BOOTLOADER_VERSION), - .n_type = EBN_BOOTLOADER_VERSION, - }, - .blv_desc = BOOTLOADER_VERSION, - .cmd_hdr = { - .n_namesz = 0, - .n_descsz = 0, - .n_type = EBN_COMMAND_LINE, - }, -}; +int create_flatten_tree(struct kexec_info *, unsigned char*, unsigned long *); +int parse_options(char *); int elf_ppc64_probe(const char *buf, off_t len) { @@ -98,8 +68,67 @@ int elf_ppc64_load(int argc, char **argv struct kexec_info *info) { struct mem_ehdr ehdr; + const char *command_line; + const char *input_options; + int command_line_len; + const char *ramdisk; + const char *v2wrap; + unsigned long *lp; + int result; + int opt; +#define OPT_APPEND (OPT_ARCH_MAX+0) +#define OPT_V2WRAP (OPT_ARCH_MAX+1) +#define OPT_RAMDISK (OPT_ARCH_MAX+2) + + static const struct option options[] = { + KEXEC_ARCH_OPTIONS + { "append", 1, NULL, OPT_APPEND }, + { "v2wrap", 1, NULL, OPT_V2WRAP }, + { "ramdisk", 1, NULL, OPT_RAMDISK }, + { 0, 0, NULL, 0 }, + }; + + static const char short_options[] = KEXEC_OPT_STR ""; + + initrd_base = 0; + initrd_size = 0; + v2wrap_base = 0; + vmlinux_base = 0; /* Parse command line arguments */ + command_line = 0; + input_options = 0; + ramdisk = 0; + v2wrap = 0; + + while ((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) { + switch (opt) { + default: + /* Ignore core options */ + if (opt < OPT_ARCH_MAX) { + break; + } + case '?': + usage(); + return -1; + case OPT_APPEND: + input_options = optarg; + break; + case OPT_V2WRAP: + v2wrap = optarg; + break; + case OPT_RAMDISK: + ramdisk = optarg; + break; + } + } + + command_line_len = 0; + if (command_line) { + command_line_len = strlen(command_line) + 1; + } + + parse_options(input_options); /* Parse the Elf file */ result = build_elf_exec_info(buf, len, &ehdr); @@ -108,16 +137,116 @@ int elf_ppc64_load(int argc, char **argv return result; } - /* Load the Elf data */ + /* Load the Elf data. Physical load addresses in elf64 header do not + * show up correctly. Use user supplied address for now to patch the + * elf header + */ + ehdr.e_phdr[0].p_paddr=vmlinux_base; result = elf_exec_load(&ehdr, info); if (result < 0) { free_elf_info(&ehdr); return result; } - return 1; + + /* Add v2wrap to the current image */ + if (v2wrap) { + unsigned char *v2wrap_buf = NULL; + off_t v2wrap_size = 0; + unsigned long hole_base = 0; + unsigned long max_addr; + + v2wrap_buf = slurp_file(v2wrap, &v2wrap_size); + create_flatten_tree(info, &v2wrap_buf, &v2wrap_size); + max_addr = v2wrap_base + 0x1000000; + add_buffer(info, v2wrap_buf, v2wrap_size, v2wrap_size, 0, v2wrap_base, max_addr, -1); + } + + lp = info->segment[1].buf + 0x100; + lp--; + *lp = info->segment[0].mem; + info->entry = info->segment[1].mem; + printf("segment[0].mem:%lx, segment[1].mem:" + "%lx\n", info->segment[0].mem, info->segment[1].mem); + + /* Add a ram-disk to the current image */ + if (ramdisk) { + /* Not supported at the moment - coming soon */ + } + + return 0; } void elf_ppc64_usage(void) { fprintf(stderr, "elf support is still broken\n"); } + +struct param_struct { + const char *name; + void *val; +}; +struct param_struct params; + +static char *next_arg(char *args, char **param, char **val) +{ + unsigned int i, equals = 0; + char *next; + + /* Chew any extra spaces */ + while (*args == ' ') args++; + + for (i = 0; args[i]; i++) { + if (args[i] == ' ') + break; + if (equals == 0) { + if (args[i] == '=') + equals = i; + } + } + + *param = args; + if (!equals) + *val = NULL; + else { + args[equals] = '\0'; + *val = args + equals + 1; + } + + if (args[i]) { + args[i] = '\0'; + next = args + i + 1; + } else + next = args + i; + return next; +} + +static int add_arg(char *param, char*val) +{ + int ret = 0; + if (strcmp(param, "initrd-base")==0) + initrd_base=strtoul(val, NULL, 0); + else if (strcmp(param, "initrd-size")==0) + initrd_size=strtoul(val, NULL, 0); + else if (strcmp(param, "v2wrap-base")==0) + v2wrap_base=strtoul(val, NULL, 0); + else if (strcmp(param, "vmlinux-base")==0) + vmlinux_base=strtoul(val, NULL, 0); + else { + printf("invalid option\n"); + ret = 1; + } + return ret; +} + +int parse_options(char *options) +{ + char *param, *val; + /* initrd-addr , initrd-size, v2wrap-addr, vmlinux-addr */ + while (*options) { + int ret; + options = next_arg(options, ¶m, &val); + ret = add_arg(param, val); + } + /* All parsed OK */ + return 0; +} diff -puN kexec/arch/ppc64/kexec-elf-rel-ppc64.c~kexec-tools-ppc64 kexec/arch/ppc64/kexec-elf-rel-ppc64.c --- kexec-tools-1.101/kexec/arch/ppc64/kexec-elf-rel-ppc64.c~kexec-tools-ppc64 2005-08-08 20:26:13.000000000 +0530 +++ kexec-tools-1.101-sharada/kexec/arch/ppc64/kexec-elf-rel-ppc64.c 2005-08-08 20:38:37.000000000 +0530 @@ -22,7 +22,7 @@ static struct mem_shdr *toc_section(cons struct mem_shdr *shdr, *shdr_end; unsigned char *strtab; strtab = ehdr->e_shdr[ehdr->e_shstrndx].sh_data; - shdr_end = &ehdr->e_shdr[ehdr->shnum]; + shdr_end = &ehdr->e_shdr[ehdr->e_shnum]; for(shdr = ehdr->e_shdr; shdr != shdr_end; shdr++) { if (strcmp(shdr->sh_name, ".toc") == 0) { return shdr; diff -puN /dev/null kexec/arch/ppc64/kexec-ppc64.c --- /dev/null 2005-08-08 20:42:13.772546000 +0530 +++ kexec-tools-1.101-sharada/kexec/arch/ppc64/kexec-ppc64.c 2005-08-08 20:40:13.000000000 +0530 @@ -0,0 +1,168 @@ +/* + * kexec: Linux boots Linux + * + * Copyright (C) 2005 R Sharada (sharada at in.ibm.com), IBM Corporation + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation (version 2 of the License). + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "../../kexec.h" +#include "../../kexec-syscall.h" +#include "kexec-ppc64.h" +#include + +#define MAX_MEMORY_RANGES 64 +#define MAX_LINE 160 +#define MAXBYTES 128 + +static struct memory_range memory_range[MAX_MEMORY_RANGES]; + +/* Return a sorted list of memory ranges. */ +int get_memory_ranges(struct memory_range **range, int *ranges) +{ + int memory_ranges = 0; + char device_tree[256] = "/proc/device-tree/"; + char fname[256]; + char buf[MAXBYTES-1]; + DIR *dir, *dmem; + FILE *file; + struct dirent *dentry, *mentry; + int n; + + if ((dir = opendir(device_tree)) == NULL) { + perror(device_tree); + return -1; + } + while ((dentry = readdir(dir)) != NULL) { + if (strncmp(dentry->d_name, "memory@", 7)) + continue; + strcpy(fname, device_tree); + strcat(fname, dentry->d_name); + if ((dmem = opendir(fname)) == NULL) { + perror(fname); + closedir(dir); + return -1; + } + while ((mentry = readdir(dmem)) != NULL) { + if (strcmp(mentry->d_name, "reg")) + continue; + strcat(fname, "/reg"); + if ((file = fopen(fname, "r")) == NULL) { + perror(fname); + closedir(dmem); + closedir(dir); + return -1; + } + if ((n = fread(buf, 1, MAXBYTES, file)) < 0) { + perror(fname); + fclose(file); + closedir(dmem); + closedir(dir); + return -1; + } + if (memory_ranges >= MAX_MEMORY_RANGES) + break; + memory_range[memory_ranges].start = + ((unsigned long long *)buf)[0]; + memory_range[memory_ranges].end = + memory_range[memory_ranges].start + + ((unsigned long long *)buf)[1]; + memory_range[memory_ranges].type = RANGE_RAM; + printf("%016Lx-%016Lx : %x\n", memory_range[memory_ranges].start, memory_range[memory_ranges].end, memory_range[memory_ranges].type); + memory_ranges++; + fclose(file); + } + closedir(dmem); + } + closedir(dir); + + *range = memory_range; + *ranges = memory_ranges; + return 0; +} + +struct file_type file_type[] = { + { "elf-ppc64", elf_ppc64_probe, elf_ppc64_load, elf_ppc64_usage }, +}; +int file_types = sizeof(file_type) / sizeof(file_type[0]); + +void arch_usage(void) +{ +} + +static struct { +} arch_options = { +}; + +int arch_process_options(int argc, char **argv) +{ + static const struct option options[] = { + KEXEC_ARCH_OPTIONS + { 0, 0, NULL, 0 }, + }; + static const char short_options[] = KEXEC_ARCH_OPT_STR; + int opt; + + opterr = 0; /* Don't complain about unrecognized options here */ + while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) { + switch(opt) { + default: + break; + } + } + /* Reset getopt for the next pass; called in other source modules */ + opterr = 1; + optind = 1; + return 0; +} + +int arch_compat_trampoline(struct kexec_info *info, unsigned long *flags) +{ + int result; + struct utsname utsname; + result = uname(&utsname); + if (result < 0) { + fprintf(stderr, "uname failed: %s\n", + strerror(errno)); + return -1; + } + if (strcmp(utsname.machine, "ppc64") == 0) + { + /* We are running a 32-bit kexec-tools on 64-bit ppc64. + * So pass KEXEC_ARCH_PPC64 here + */ + *flags |= KEXEC_ARCH_PPC64; + } + else { + fprintf(stderr, "Unsupported machine type: %s\n", + utsname.machine); + return -1; + } + return 0; +} + +void arch_update_purgatory(struct kexec_info *info) +{ +} + diff -puN kexec/arch/ppc64/kexec-ppc64.h~kexec-tools-ppc64 kexec/arch/ppc64/kexec-ppc64.h --- kexec-tools-1.101/kexec/arch/ppc64/kexec-ppc64.h~kexec-tools-ppc64 2005-08-08 20:26:13.000000000 +0530 +++ kexec-tools-1.101-sharada/kexec/arch/ppc64/kexec-ppc64.h 2005-08-08 20:30:33.000000000 +0530 @@ -6,4 +6,8 @@ int elf_ppc64_load(int argc, char **argv struct kexec_info *info); void elf_ppc64_usage(void); -#endif /* KEXEC_PPC_H */ +unsigned long initrd_base; +unsigned long initrd_size; +unsigned long v2wrap_base; +unsigned long vmlinux_base; +#endif /* KEXEC_PPC64_H */ diff -puN kexec/arch/ppc64/Makefile~kexec-tools-ppc64 kexec/arch/ppc64/Makefile --- kexec-tools-1.101/kexec/arch/ppc64/Makefile~kexec-tools-ppc64 2005-08-08 20:26:13.000000000 +0530 +++ kexec-tools-1.101-sharada/kexec/arch/ppc64/Makefile 2005-08-08 20:41:34.000000000 +0530 @@ -1,7 +1,8 @@ # # kexec ppc64 (linux booting linux) # +KEXEC_C_SRCS+= kexec/arch/ppc64/kexec-ppc64.c +KEXEC_C_SRCS+= kexec/arch/ppc64/kexec-elf-ppc64.c KEXEC_C_SRCS+= kexec/arch/ppc64/kexec-elf-rel-ppc64.c KEXEC_C_SRCS+= kexec/arch/ppc64/kexec-zImage-ppc64.c - -KEXEC_S_SRCS+= +KEXEC_C_SRCS+= kexec/arch/ppc64/fs2dt.c diff -puN /dev/null kexec/arch/ppc64/v2wrap.S --- /dev/null 2005-08-08 20:42:13.772546000 +0530 +++ kexec-tools-1.101-sharada/kexec/arch/ppc64/v2wrap.S 2005-08-08 20:28:08.000000000 +0530 @@ -0,0 +1,114 @@ +# +# kexec: Linux boots Linux +# +# Copyright (C) 2004 - 2005, Milton D Miller II, IBM Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation (version 2 of the License). +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# + +# v2wrap.S +# a wrapper to place in front of a v2 device tree +# to call a ppc64 kernel with the expected arguments +# of kernel(device-tree, phys-offset, 0) +# +# calling convention: +# r3 = physical number of this cpu (all cpus) +# r4 = address of this chunk (master only) +# master enters at start (aka first byte of this chunk) +# slaves (additional cpus), if any, enter a copy of the +# first 0x100 bytes of this code relocated to 0x0 +# +# in other words, +# a copy of the first 0x100 bytes of this code is copied to 0 +# and the slaves are sent to address 0x60 +# with r3 = their physical cpu number. + + +# look a bit like a Linux kernel here ... + .machine ppc64 + .org 0 +start: b master + tweq 0,0 +secondary_hold: + .llong 0 + + .org 0x20 # need a bit more space than after slave, +master: + std 4,secondary_hold at l(0) # bring slaves up here to this copy + sync # try to get the slaves to see this + or 1,1,1 # low priority to let other thread catchup + isync + mr 5,3 # save cpu id to r5 + addi 3,4,0x100 # r3 = boot param block + lwz 6,20(3) # fetch version number + cmpwi 0,6,2 # v2 ? + blt 80f + stw 5,28(3) # save my cpu number as boot_cpu_phys +80: b 81f + + .org 0x60 # ABI: slaves start at 60 with r3=phys +slave: ld 4,secondary_hold at l(0); + cmpdi 0,4,0 + beq slave + + # ahh, master told us where he is running from + # jump into our copy of the code up there so this code can change + addi 5,4,1f-start + mtctr 5 + bctr + + # ok, now wait for the master to tell is to go back to the new block +1: ld 5,copied at l(4) + cmpdi 0,5,0 + beq 1b + ba 0x60 + + + + .long 0 # just an eye-catcher, delete if space needed + .long 0 # just an eye-catcher, delete if space needed + +81: # master continues here + or 3,3,3 # ok back to high, lets boot + lis 6,0x1 + mtctr 6 # delay a bit for slaves to catch up +83: bdnz 83b # before we overwrite 0-100 again + + ld 4,-8(3) # kernel pointer is at -8(bb) by loader + addi 5,4,-8 # prepare copy with update form instructions + li 6,0x100/8 + mtctr 6 + li 6,-8 +85: ldu 7,8(5) + stdu 7,8(6) + bdnz 85b + + li 5,0 # r5 will be 0 for kernel + dcbst 0,5 # store dcache, flush icache + dcbst 0,6 # 0 and 0xf8 covers us with 128 byte lines + mtctr 4 # prepare branch too + sync + icbi 0,5 + icbi 0,6 + sync + isync + std 6,-16(3) # send slaves back down + bctr # start kernel + + .org 0xf0 +copied: .llong 0 +kernel: .llong 0 + .org 0x100 +__end_stub: + .equ boot_block, . - start diff -puN purgatory/Makefile~kexec-tools-ppc64 purgatory/Makefile --- kexec-tools-1.101/purgatory/Makefile~kexec-tools-ppc64 2005-08-08 20:26:13.000000000 +0530 +++ kexec-tools-1.101-sharada/purgatory/Makefile 2005-08-08 20:31:16.000000000 +0530 @@ -6,6 +6,11 @@ # There is probably a cleaner way to do this but for now this # should keep us from accidentially include unsafe library functions # or headers. + +ifeq ($(ARCH),ppc64) +LDFLAGS = -melf64ppc +endif + PCFLAGS:=-Wall -Os \ -I$(shell $(CC) -print-file-name=include) \ -Ipurgatory/include -Ipurgatory/arch/$(ARCH)/include \ diff -puN /dev/null kexec/arch/ppc64/make_v2wrap --- /dev/null 2005-08-08 20:42:13.772546000 +0530 +++ kexec-tools-1.101-sharada/kexec/arch/ppc64/make_v2wrap 2005-08-08 20:42:12.000000000 +0530 @@ -0,0 +1,13 @@ +# kexec ppc64 (linux booting linux) +# Build v2wrap from here for now + +KEXEC_S_OBJ_PATH:=kexec/arch/ppc64 +KEXEC_S_SRCS:=kexec/arch/ppc64/v2wrap.S +KEXEC_S_OBJS:=kexec/arch/ppc64/v2wrap + +all: $(KEXEC_S_OBJS) +$(KEXEC_S_OBJS): $(KEXEC_S_SRCS) + gcc -c -o $(KEXEC_S_OBJ_PATH)/v2wrap.o $(KEXEC_S_OBJ_PATH)/v2wrap.S + ld -Ttext=0 -e 0 -o $(KEXEC_S_OBJ_PATH)/v2wrap.elf $(KEXEC_S_OBJ_PATH)/v2wrap.o + objcopy -O binary $(KEXEC_S_OBJ_PATH)/v2wrap.elf $(KEXEC_S_OBJ_PATH)/v2wrap + _ From mbellon at mvista.com Tue Aug 9 04:33:17 2005 From: mbellon at mvista.com (Mark Bellon) Date: Mon, 08 Aug 2005 11:33:17 -0700 Subject: [Fwd: [PATCH] PPC64: large INITRD causes kernel not to boot] Message-ID: <42F7A56D.7090809@mvista.com> > Please send patches like these to linuxppc64-dev at ozlabs.org, which is > the architecture list for ppc64. You might want to coordinate your work > with some of the other people working on initrd/yaboot updates at the > moment, Olaf Hering and others. In PPC64 there are number of problems in arch/ppc64/boot/main.c that prevent a kernel from making use of a large (greater than ~16MB) INITRD. This is 64 bit architecture and really large INITRD images should be possible. Simply put the existing code has a fixed reservation (claim) address and once the kernel plus initrd image are large enough to pass this address all sorts of bad things occur. The fix is the dynamically establish the first claim address above the loaded kernel plus initrd (plus some "padding" and rounding) mark Signed-off-by: Mark Bellon -------------- next part -------------- A non-text attachment was scrubbed... Name: common_initrd.patch Type: text/x-patch Size: 2451 bytes Desc: not available Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20050808/6f9796ed/attachment.bin From geoffrey.levand at am.sony.com Tue Aug 9 04:27:36 2005 From: geoffrey.levand at am.sony.com (Geoff Levand) Date: Mon, 08 Aug 2005 11:27:36 -0700 Subject: [RFC] addnote and pmac Message-ID: <42F7A418.2050601@am.sony.com> I found that my Mac G5 wouldn't boot with a zImage modified by addnote. It worked OK when the image wasn't run through addnote though. I took just a brief look at addnote.c, and it seems this step is specific to the OF implementation, or could it be needed by older tool chains? At any rate, by default it is run for all zImage builds, which we'll need to change to support at least some machines. Below is what I got working, but someone more familiar with the boot makefile and the needs of other machines could certainly do better. -Geoff Index: dev-2-6-12/arch/ppc64/boot/Makefile =================================================================== --- dev-2-6-12.orig/arch/ppc64/boot/Makefile 2005-08-08 10:43:43.000000000 -0700 +++ dev-2-6-12/arch/ppc64/boot/Makefile 2005-08-08 10:45:51.000000000 -0700 @@ -75,8 +75,12 @@ --add-section=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $(1)))=$(patsubst %.o,%.gz, $(1)) \ --set-section-flags=.kernel:$(strip $(patsubst $(obj)/kernel-%.o,%, $(1)))=$(OBJCOPYFLAGS) -quiet_cmd_addnote = ADDNOTE $@ - cmd_addnote = $(CROSS32LD) $(BOOTLFLAGS) -o $@ $(obj-boot) && $(obj)/addnote $@ +ifeq ($(CONFIG_PPC_ISERIES),y) + addnote_cmd := $(call if_changed,addnote) +endif + +quiet_cmd_addnote = ADDNOTE $@ + cmd_addnote = $(obj)/addnote $@ quiet_cmd_piggy = PIGGY $@ cmd_piggy = $(obj)/piggyback $(@:.o=) < $< | $(CROSS32AS) -o $@ @@ -96,11 +100,12 @@ $(obj)/zImage: obj-boot += $(call obj-sec, $(required)) $(obj)/zImage: $(call obj-sec, $(required)) $(obj-boot) $(obj)/addnote FORCE - $(call if_changed,addnote) + $(CROSS32LD) $(BOOTLFLAGS) -o $@ $(obj-boot) + $(addnote_cmd) $(obj)/zImage.initrd: obj-boot += $(call obj-sec, $(required) $(initrd)) $(obj)/zImage.initrd: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(obj)/addnote FORCE - $(call if_changed,addnote) + $(addnote_cmd) $(obj)/imagesize.c: vmlinux.strip @echo Generating $@ -EOF From olh at suse.de Tue Aug 9 04:54:35 2005 From: olh at suse.de (Olaf Hering) Date: Mon, 8 Aug 2005 20:54:35 +0200 Subject: [Fwd: [PATCH] PPC64: large INITRD causes kernel not to boot] In-Reply-To: <42F7A56D.7090809@mvista.com> References: <42F7A56D.7090809@mvista.com> Message-ID: <20050808185435.GA13206@suse.de> On Mon, Aug 08, Mark Bellon wrote: > + /* > + * The first available claim_base must be "out of the way" - > + * well above _start + kernel_size + initrd + overhead. > + */ > + > + claim_base = ((unsigned long) _start) + > + ((unsigned long) vmlinux_filesize) + > + (unsigned long)(_initrd_end - _initrd_start) + > + ONE_MB; Why do you have to make the initial claim_base non-zero? Did you try to start from zero? Appears to work ok for me. From olh at suse.de Tue Aug 9 04:56:54 2005 From: olh at suse.de (Olaf Hering) Date: Mon, 8 Aug 2005 20:56:54 +0200 Subject: [RFC] addnote and pmac In-Reply-To: <42F7A418.2050601@am.sony.com> References: <42F7A418.2050601@am.sony.com> Message-ID: <20050808185654.GB13206@suse.de> On Mon, Aug 08, Geoff Levand wrote: > At any rate, by default it is run for all zImage builds, which > we'll need to change to support at least some machines. Below is > what I got working, but someone more familiar with the boot > makefile and the needs of other machines could certainly do > better. Better split the build process to build a vmlinux.elf-pmac and a zImage.rs6k. From mbellon at mvista.com Tue Aug 9 05:02:58 2005 From: mbellon at mvista.com (Mark Bellon) Date: Mon, 08 Aug 2005 12:02:58 -0700 Subject: [Fwd: [PATCH] PPC64: large INITRD causes kernel not to boot] In-Reply-To: <20050808185435.GA13206@suse.de> References: <42F7A56D.7090809@mvista.com> <20050808185435.GA13206@suse.de> Message-ID: <42F7AC62.3070601@mvista.com> Olaf Hering wrote: > On Mon, Aug 08, Mark Bellon wrote: > > > >>+ /* >>+ * The first available claim_base must be "out of the way" - >>+ * well above _start + kernel_size + initrd + overhead. >>+ */ >>+ >>+ claim_base = ((unsigned long) _start) + >>+ ((unsigned long) vmlinux_filesize) + >>+ (unsigned long)(_initrd_end - _initrd_start) + >>+ ONE_MB; >> >> > >Why do you have to make the initial claim_base non-zero? Did you try to >start from zero? Appears to work ok for me. > > The original code started non-zero too [don't know why]. Yes, if everything was correct and the claims where proper one could always start at zero. I've got several platforms where the claim will (incorrectly) succeed below the computed location. This coding insures that no matter what the firmware thinks is right (or wrong) the claiming starts at a safe place. Insurance? On top of that it's just a waste of time. In really huge INITRD handling this adds unnecessary boot latency. mark From olh at suse.de Tue Aug 9 05:11:23 2005 From: olh at suse.de (Olaf Hering) Date: Mon, 8 Aug 2005 21:11:23 +0200 Subject: [Fwd: [PATCH] PPC64: large INITRD causes kernel not to boot] In-Reply-To: <42F7AC62.3070601@mvista.com> References: <42F7A56D.7090809@mvista.com> <20050808185435.GA13206@suse.de> <42F7AC62.3070601@mvista.com> Message-ID: <20050808191123.GA14047@suse.de> On Mon, Aug 08, Mark Bellon wrote: > The original code started non-zero too [don't know why]. Yes, if > everything was correct and the claims where proper one could always > start at zero. make sure to also claim the range from _start to _end. The firmware on my B50 doesnt claim the client memrange. > I've got several platforms where the claim will (incorrectly) succeed > below the computed location. This coding insures that no matter what the > firmware thinks is right (or wrong) the claiming starts at a safe place. > Insurance? What is wrong with allocations on low addresses? > On top of that it's just a waste of time. In really huge INITRD handling > this adds unnecessary boot latency. I could not load a 10Mb file via network on a POWER4 LPAR. Maybe your case is a huge ELF memsize. On what system do you see the failure? From mbellon at mvista.com Tue Aug 9 05:31:13 2005 From: mbellon at mvista.com (Mark Bellon) Date: Mon, 08 Aug 2005 12:31:13 -0700 Subject: [Fwd: [PATCH] PPC64: large INITRD causes kernel not to boot] In-Reply-To: <20050808191123.GA14047@suse.de> References: <42F7A56D.7090809@mvista.com> <20050808185435.GA13206@suse.de> <42F7AC62.3070601@mvista.com> <20050808191123.GA14047@suse.de> Message-ID: <42F7B301.5060008@mvista.com> Olaf Hering wrote: > On Mon, Aug 08, Mark Bellon wrote: > > > >>The original code started non-zero too [don't know why]. Yes, if >>everything was correct and the claims where proper one could always >>start at zero. >> >> > >make sure to also claim the range from _start to _end. The firmware on >my B50 doesnt claim the client memrange. > > Doesn't the "_start + ((unsigned long) vmlinux_filesize)" in the calculation already do that by never allowing an allocation in that address range? Yes, it's unclaimed but it's also not going to be around for very long... [pragmatic approach?] The kernel is copied to a claimed area, as is the initrd and then things are "lit". Whatever seems best we can do and I'll work up the patch. Comments? > > >>I've got several platforms where the claim will (incorrectly) succeed >>below the computed location. This coding insures that no matter what the >>firmware thinks is right (or wrong) the claiming starts at a safe place. >>Insurance? >> >> > >What is wrong with allocations on low addresses? > > The firmware only protects itself - the first MB or, on some firmwares, up to the first 48 MB. Regardless, the wrapper doesn't know how much is enough so the patch starts it in a known safe place - past its end. The old, hard coded 0x1400000 could lead to a claim in the middle of the image once the load image size was larger than 16 MB (4MB standard load point). > > >>On top of that it's just a waste of time. In really huge INITRD handling >>this adds unnecessary boot latency. >> >> > >I could not load a 10Mb file via network on a POWER4 LPAR. Maybe your >case is a huge ELF memsize. On what system do you see the failure? > > Motorola 6101 with 2 GB of RAM amongst others. I've got to support a 260 MB INITRD (and entire environment). I've seen firmware problems on platforms with huge ELF files. Never gets to execute code. I've got a kernel of approximately 2.5 MB plus the initrd. The initrd varies in size. A 50 MB INITRD, even compressed down, took me over the older 16 MB limit and one could see the problem and it works now. mark From olh at suse.de Tue Aug 9 05:42:35 2005 From: olh at suse.de (Olaf Hering) Date: Mon, 8 Aug 2005 21:42:35 +0200 Subject: [Fwd: [PATCH] PPC64: large INITRD causes kernel not to boot] In-Reply-To: <42F7B301.5060008@mvista.com> References: <42F7A56D.7090809@mvista.com> <20050808185435.GA13206@suse.de> <42F7AC62.3070601@mvista.com> <20050808191123.GA14047@suse.de> <42F7B301.5060008@mvista.com> Message-ID: <20050808194235.GA14744@suse.de> On Mon, Aug 08, Mark Bellon wrote: > Olaf Hering wrote: > >make sure to also claim the range from _start to _end. The firmware on > >my B50 doesnt claim the client memrange. > > > > > Doesn't the "_start + ((unsigned long) vmlinux_filesize)" in the > calculation already do that by never allowing an allocation in that > address range? Yes, it's unclaimed but it's also not going to be around > for very long... [pragmatic approach?] If the zimage elf range is claimed, nothing else will get this area, and claim_base could remain zero. something like this after of1275_prominit() is done in my zimage. of1275_claim((unsigned int)_start, (unsigned int)(_end - _start), 0); From mbellon at mvista.com Tue Aug 9 05:55:12 2005 From: mbellon at mvista.com (Mark Bellon) Date: Mon, 08 Aug 2005 12:55:12 -0700 Subject: [Fwd: [PATCH] PPC64: large INITRD causes kernel not to boot] In-Reply-To: <20050808194235.GA14744@suse.de> References: <42F7A56D.7090809@mvista.com> <20050808185435.GA13206@suse.de> <42F7AC62.3070601@mvista.com> <20050808191123.GA14047@suse.de> <42F7B301.5060008@mvista.com> <20050808194235.GA14744@suse.de> Message-ID: <42F7B8A0.3000901@mvista.com> Olaf Hering wrote: > On Mon, Aug 08, Mark Bellon wrote: > > > >>Olaf Hering wrote: >> >> >>>make sure to also claim the range from _start to _end. The firmware on >>>my B50 doesnt claim the client memrange. >>> >>> >>> >>> >>Doesn't the "_start + ((unsigned long) vmlinux_filesize)" in the >>calculation already do that by never allowing an allocation in that >>address range? Yes, it's unclaimed but it's also not going to be around >>for very long... [pragmatic approach?] >> >> > >If the zimage elf range is claimed, nothing else will get this area, and >claim_base could remain zero. > >something like this after of1275_prominit() is done in my zimage. >of1275_claim((unsigned int)_start, (unsigned int)(_end - _start), 0) > > I see your point. but I've got practical issues that I want to avoid: I've got platforms that claim only part of the space south of 4MB and _start is usually 4MB (a hole); starting at zero would not do nice things in some cases. I felt my coding prevents any possibility of problems by simply removing the chance of a collision. That initrd image is not claimed in your approach and it sits immediately about _end. It would need to be claimed as well. How about this? Claim everything in the loaded ELF file from _start explicitly with claim_start initialized at _start? However I still like my approach saving time especially with a huge INITRD. Listening and thinking, mark From mbellon at mvista.com Tue Aug 9 06:05:58 2005 From: mbellon at mvista.com (Mark Bellon) Date: Mon, 08 Aug 2005 13:05:58 -0700 Subject: [Fwd: [PATCH] PPC64: large INITRD causes kernel not to boot] In-Reply-To: <42F7B8A0.3000901@mvista.com> References: <42F7A56D.7090809@mvista.com> <20050808185435.GA13206@suse.de> <42F7AC62.3070601@mvista.com> <20050808191123.GA14047@suse.de> <42F7B301.5060008@mvista.com> <20050808194235.GA14744@suse.de> <42F7B8A0.3000901@mvista.com> Message-ID: <42F7BB26.9090500@mvista.com> Mark Bellon wrote: > Olaf Hering wrote: > >> On Mon, Aug 08, Mark Bellon wrote: >> >> >> >>> Olaf Hering wrote: >>> >>> >>>> make sure to also claim the range from _start to _end. The firmware on >>>> my B50 doesnt claim the client memrange. >>>> >>>> >>>> >>> >>> Doesn't the "_start + ((unsigned long) vmlinux_filesize)" in the >>> calculation already do that by never allowing an allocation in that >>> address range? Yes, it's unclaimed but it's also not going to be >>> around for very long... [pragmatic approach?] >>> >> >> >> If the zimage elf range is claimed, nothing else will get this area, and >> claim_base could remain zero. >> >> something like this after of1275_prominit() is done in my zimage. >> of1275_claim((unsigned int)_start, (unsigned int)(_end - _start), 0) >> >> > I see your point. but I've got practical issues that I want to avoid: > I've got platforms that claim only part of the space south of 4MB and > _start is usually 4MB (a hole); starting at zero would not do nice > things in some cases. I felt my coding prevents any possibility of > problems by simply removing the chance of a collision. > > That initrd image is not claimed in your approach and it sits > immediately about _end. It would need to be claimed as well. > > How about this? Claim everything in the loaded ELF file from _start > explicitly with claim_start initialized at _start? > > However I still like my approach saving time especially with a huge > INITRD. > > Listening and thinking, How about something like this? (haven't tried it yet). mark -------------- next part -------------- A non-text attachment was scrubbed... Name: common_initrd.patch Type: text/x-patch Size: 2992 bytes Desc: not available Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20050808/e09e0fba/attachment.bin From olh at suse.de Tue Aug 9 06:10:01 2005 From: olh at suse.de (Olaf Hering) Date: Mon, 8 Aug 2005 22:10:01 +0200 Subject: [Fwd: [PATCH] PPC64: large INITRD causes kernel not to boot] In-Reply-To: <42F7B8A0.3000901@mvista.com> References: <42F7A56D.7090809@mvista.com> <20050808185435.GA13206@suse.de> <42F7AC62.3070601@mvista.com> <20050808191123.GA14047@suse.de> <42F7B301.5060008@mvista.com> <20050808194235.GA14744@suse.de> <42F7B8A0.3000901@mvista.com> Message-ID: <20050808201001.GA15425@suse.de> On Mon, Aug 08, Mark Bellon wrote: > I see your point. but I've got practical issues that I want to avoid: > I've got platforms that claim only part of the space south of 4MB and > _start is usually 4MB (a hole); starting at zero would not do nice > things in some cases. I felt my coding prevents any possibility of > problems by simply removing the chance of a collision. Yes, try_claim could return an address below _start if size is small enough. > That initrd image is not claimed in your approach and it sits > immediately about _end. It would need to be claimed as well. No, initrd is moved to initrd.addr. > How about this? Claim everything in the loaded ELF file from _start > explicitly with claim_start initialized at _start? This is really only required for brokenfirmware implementations. I have seen it on IBM B50. Maybe older 64bit systems like 170 or 260 are broken as well. So you claim once from _start to _end, and set claim_base to _end. > However I still like my approach saving time especially with a huge INITRD. Does a claim take so much time? Maybe I misunderstood this part. From mbellon at mvista.com Tue Aug 9 06:19:37 2005 From: mbellon at mvista.com (Mark Bellon) Date: Mon, 08 Aug 2005 13:19:37 -0700 Subject: [Fwd: [PATCH] PPC64: large INITRD causes kernel not to boot] In-Reply-To: <20050808201001.GA15425@suse.de> References: <42F7A56D.7090809@mvista.com> <20050808185435.GA13206@suse.de> <42F7AC62.3070601@mvista.com> <20050808191123.GA14047@suse.de> <42F7B301.5060008@mvista.com> <20050808194235.GA14744@suse.de> <42F7B8A0.3000901@mvista.com> <20050808201001.GA15425@suse.de> Message-ID: <42F7BE59.4010700@mvista.com> Olaf Hering wrote: > On Mon, Aug 08, Mark Bellon wrote: > > > >>I see your point. but I've got practical issues that I want to avoid: >>I've got platforms that claim only part of the space south of 4MB and >>_start is usually 4MB (a hole); starting at zero would not do nice >>things in some cases. I felt my coding prevents any possibility of >>problems by simply removing the chance of a collision. >> >> > >Yes, try_claim could return an address below _start if size is small enough. > > > >>That initrd image is not claimed in your approach and it sits >>immediately about _end. It would need to be claimed as well. >> >> > >No, initrd is moved to initrd.addr. > > But the claim could come back right in the middle of the initrd image inside the ELF file (which is what happens in my case). The _end is the end of the (compressed) kernel code, not the end of file contain the vmlinuz with the initrd in it. Claiming part of the ELF image is no insurance that claims will not come back in the middle of the entire image. Only explicit claims covering everything or starting the claim_base about the entire image insure all data. >>How about this? Claim everything in the loaded ELF file from _start >>explicitly with claim_start initialized at _start? >> >> > >This is really only required for brokenfirmware implementations. I have >seen it on IBM B50. Maybe older 64bit systems like 170 or 260 are broken >as well. So you claim once from _start to _end, and set claim_base to >_end. > > As I pointed out this is not enough when the firmware is broken. The claim that succeeds can be in the middle of things. My change works on all platform regardless of the firmware (trust nobody). I've got a firmware that cannot claim below 48 MB. I can't protect the loaded image with a claim. try_claim would land up being very high up and useless. >>However I still like my approach saving time especially with a huge INITRD. >> >> > >Does a claim take so much time? Maybe I misunderstood this part? > > If the code used claim to grab the kernel ELF pieces, leaving claim_base at zero then using try_claim to grab memory will be very inefficient when the ELF imiage is huge - many retries that are wasted to get to the good zone. mark From olh at suse.de Tue Aug 9 08:30:10 2005 From: olh at suse.de (Olaf Hering) Date: Tue, 9 Aug 2005 00:30:10 +0200 Subject: [Fwd: [PATCH] PPC64: large INITRD causes kernel not to boot] In-Reply-To: <42F7B301.5060008@mvista.com> References: <42F7A56D.7090809@mvista.com> <20050808185435.GA13206@suse.de> <42F7AC62.3070601@mvista.com> <20050808191123.GA14047@suse.de> <42F7B301.5060008@mvista.com> Message-ID: <20050808223010.GA18775@suse.de> On Mon, Aug 08, Mark Bellon wrote: > >I could not load a 10Mb file via network on a POWER4 LPAR. Maybe your > >case is a huge ELF memsize. On what system do you see the failure? > > > > > Motorola 6101 with 2 GB of RAM amongst others. I've got to support a 260 > MB INITRD (and entire environment). > > I've seen firmware problems on platforms with huge ELF files. Never gets > to execute code. Where is the firmware located on your board, and where is the stack? stack is at 42MB on pseries, maybe some real huge kernel + initrd can overwrite parts of the stack. That would be 22MB, can probably only happen when loaded from yaboot. From mbellon at mvista.com Tue Aug 9 08:40:18 2005 From: mbellon at mvista.com (Mark Bellon) Date: Mon, 08 Aug 2005 15:40:18 -0700 Subject: [Fwd: [PATCH] PPC64: large INITRD causes kernel not to boot] In-Reply-To: <20050808223010.GA18775@suse.de> References: <42F7A56D.7090809@mvista.com> <20050808185435.GA13206@suse.de> <42F7AC62.3070601@mvista.com> <20050808191123.GA14047@suse.de> <42F7B301.5060008@mvista.com> <20050808223010.GA18775@suse.de> Message-ID: <42F7DF52.4090905@mvista.com> Olaf Hering wrote: > On Mon, Aug 08, Mark Bellon wrote: > > > >>>I could not load a 10Mb file via network on a POWER4 LPAR. Maybe your >>>case is a huge ELF memsize. On what system do you see the failure? >>> >>> >>> >>> >>Motorola 6101 with 2 GB of RAM amongst others. I've got to support a 260 >>MB INITRD (and entire environment). >> >>I've seen firmware problems on platforms with huge ELF files. Never gets >>to execute code. >> >> > >Where is the firmware located on your board, and where is the stack? >stack is at 42MB on pseries, maybe some real huge kernel + initrd can >overwrite parts of the stack. That would be 22MB, can probably only >happen when loaded from yaboot. > > Yes, the stack getting trashed is what is often looks like. The 22 MB seems about right for some of the firmware. Other firmwares seem to work to a much larger size. Regardless of the firmware issues I want to make sure the kernel/wrapper are clean for any size kernel+initrd. I'm testing a simplified patch that makes use of _end as you suggested. All the math is replaced by a "round up" of _end to set the initial claim_base. I hope to post the patch soon. mark From jschopp at austin.ibm.com Tue Aug 9 03:59:37 2005 From: jschopp at austin.ibm.com (Joel Schopp) Date: Mon, 08 Aug 2005 12:59:37 -0500 Subject: Merging ppc32 and ppc64 In-Reply-To: <17136.13558.773102.465379@cargo.ozlabs.ibm.com> References: <17136.13558.773102.465379@cargo.ozlabs.ibm.com> Message-ID: <42F79D89.3040709@austin.ibm.com> > I don't see the merge as changing the actual code that gets executed > on any given platform very much, except in one respect: we are going > to standardize on a flattened device tree as the way that information > about the platform gets passed from the boot loader to the kernel. > > Comments? Flames? :) There are several userspace applications that parse the non-flat device tree in /proc/device-tree on pSeries. While I like the idea of the flattened device tree I think we need to consider how many apps we are going to break with it. From kamitch at cisco.com Tue Aug 9 08:48:09 2005 From: kamitch at cisco.com (Keith Mitchell) Date: Mon, 08 Aug 2005 18:48:09 -0400 Subject: server_mode on Newer Powermac 1.8 (single) Message-ID: <42F7E129.6010105@cisco.com> I have about a dozen of the newer Powermac G5 1.8ghz (single) that has the SMU (not the PMU) and I was wondering if it is currently possible to get these things to automatically turn back on in the powerfail scenario. We also have some Dual 2ghz machines that we can set 'server_mode' to 1 in the /proc/pmu/options file but nothing similar seems to exist for these machines. If I put OSX on this thing and set it via that GUI will the setting stick? I thought I had done that initially but I now have some of the machines that will power back up and some that will not... but I don't remember if I powered down after doing that setting before installing linux or not. The output from /proc/cpuinfo for these machines is: processor : 0 cpu : PPC970FX, altivec supported clock : 1800.000000MHz revision : 3.0 timebase : 33333333 machine : PowerMac9,1 motherboard : PowerMac9,1 MacRISC4 Power Macintosh detected as : 415 (Unknown K2-based) pmac flags : 00000000 pmac-generation : NewWorld Right now I have YDL 4.0.1 (kernel 2.6.10) on the machines. Thanks. -- Keith Mitchell | | | kamitch at cisco.com | :|: :|: 7025 Kit Creek Road, P.O. Box 14987 | :|||||: :|||||: Research Triangle Park, NC 27709 | .:|||||||:.:|||||||:. 919-392-9607 | c i s c o S y s t e m s From paulus at samba.org Tue Aug 9 09:48:52 2005 From: paulus at samba.org (Paul Mackerras) Date: Tue, 9 Aug 2005 09:48:52 +1000 Subject: Merging ppc32 and ppc64 In-Reply-To: <42F79D89.3040709@austin.ibm.com> References: <17136.13558.773102.465379@cargo.ozlabs.ibm.com> <42F79D89.3040709@austin.ibm.com> Message-ID: <17143.61284.499588.465260@cargo.ozlabs.ibm.com> Joel Schopp writes: > There are several userspace applications that parse the non-flat device > tree in /proc/device-tree on pSeries. While I like the idea of the > flattened device tree I think we need to consider how many apps we are > going to break with it. ... and standardizing on the flattened device tree will mean that every ppc and ppc64 platform has stuff in /proc/device-tree, not just those that have OF. :) Paul. From mbellon at mvista.com Tue Aug 9 11:04:54 2005 From: mbellon at mvista.com (Mark Bellon) Date: Mon, 08 Aug 2005 18:04:54 -0700 Subject: [Fwd: [PATCH] PPC64: large INITRD causes kernel not to boot] In-Reply-To: <42F7DF52.4090905@mvista.com> References: <42F7A56D.7090809@mvista.com> <20050808185435.GA13206@suse.de> <42F7AC62.3070601@mvista.com> <20050808191123.GA14047@suse.de> <42F7B301.5060008@mvista.com> <20050808223010.GA18775@suse.de> <42F7DF52.4090905@mvista.com> Message-ID: <42F80136.9050500@mvista.com> Please find attached my revised patch. Olaf's suggestion of using _end removes the calculation making things smaller, neater and less complex. We could add an explicit claim of _start through _end. Given all of the broken firmware I'm seeing the claim_base cannot be set less than _end - and I prefer to round it up to MB boundary. Comments? mark Signed-off-by: Mark Bellon -------------- next part -------------- A non-text attachment was scrubbed... Name: common_initrd.patch Type: text/x-patch Size: 2462 bytes Desc: not available Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20050808/facc27ec/attachment.bin From michael at ellerman.id.au Tue Aug 9 11:13:36 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Tue, 9 Aug 2005 11:13:36 +1000 (EST) Subject: [PATCH] ppc64: Move ppc64_enable_pmcs() logic into a ppc_md function In-Reply-To: <20050808084539.26A1B67F4A@ozlabs.org> Message-ID: <20050809011336.EAF0B67F8D@ozlabs.org> David asked me to put power4_enable_pmcs() in arch/ppc64/kernel/pmc.c, so here's an updated (again) version. I've tested it on P5 LPAR and P4. It does what it used to. Signed-off-by: Michael Ellerman arch/ppc64/kernel/iSeries_setup.c | 2 + arch/ppc64/kernel/pSeries_setup.c | 21 ++++++++++++++ arch/ppc64/kernel/pmac_setup.c | 2 + arch/ppc64/kernel/pmc.c | 21 ++++++++++++++ arch/ppc64/kernel/sysfs.c | 54 ++------------------------------------ include/asm-ppc64/machdep.h | 3 ++ include/asm-ppc64/pmc.h | 2 + 7 files changed, 55 insertions(+), 50 deletions(-) Index: work/arch/ppc64/kernel/iSeries_setup.c =================================================================== --- work.orig/arch/ppc64/kernel/iSeries_setup.c +++ work/arch/ppc64/kernel/iSeries_setup.c @@ -947,6 +947,8 @@ void __init iSeries_early_setup(void) ppc_md.calibrate_decr = iSeries_calibrate_decr; ppc_md.progress = iSeries_progress; + /* XXX Implement enable_pmcs for iSeries */ + if (get_paca()->lppaca.shared_proc) { ppc_md.idle_loop = iseries_shared_idle; printk(KERN_INFO "Using shared processor idle loop\n"); Index: work/arch/ppc64/kernel/pSeries_setup.c =================================================================== --- work.orig/arch/ppc64/kernel/pSeries_setup.c +++ work/arch/ppc64/kernel/pSeries_setup.c @@ -61,6 +61,7 @@ #include #include #include +#include #include "i8259.h" #include "mpic.h" @@ -187,6 +188,21 @@ static void __init pSeries_setup_mpic(vo " MPIC "); } +static void pseries_lpar_enable_pmcs(void) +{ + unsigned long set, reset; + + power4_enable_pmcs(); + + set = 1UL << 63; + reset = 0; + plpar_hcall_norets(H_PERFMON, set, reset); + + /* instruct hypervisor to maintain PMCs */ + if (firmware_has_feature(FW_FEATURE_SPLPAR)) + get_paca()->lppaca.pmcregs_in_use = 1; +} + static void __init pSeries_setup_arch(void) { /* Fixup ppc_md depending on the type of interrupt controller */ @@ -245,6 +261,11 @@ static void __init pSeries_setup_arch(vo printk(KERN_INFO "Using default idle loop\n"); ppc_md.idle_loop = default_idle; } + + if (systemcfg->platform & PLATFORM_LPAR) + ppc_md.enable_pmcs = pseries_lpar_enable_pmcs; + else + ppc_md.enable_pmcs = power4_enable_pmcs; } static int __init pSeries_init_panel(void) Index: work/arch/ppc64/kernel/pmac_setup.c =================================================================== --- work.orig/arch/ppc64/kernel/pmac_setup.c +++ work/arch/ppc64/kernel/pmac_setup.c @@ -71,6 +71,7 @@ #include #include #include +#include #include "pmac.h" #include "mpic.h" @@ -511,4 +512,5 @@ struct machdep_calls __initdata pmac_md .progress = pmac_progress, .check_legacy_ioport = pmac_check_legacy_ioport, .idle_loop = native_idle, + .enable_pmcs = power4_enable_cpus, }; Index: work/arch/ppc64/kernel/sysfs.c =================================================================== --- work.orig/arch/ppc64/kernel/sysfs.c +++ work/arch/ppc64/kernel/sysfs.c @@ -101,6 +101,8 @@ static int __init setup_smt_snooze_delay } __setup("smt-snooze-delay=", setup_smt_snooze_delay); +#endif /* CONFIG_PPC_MULTIPLATFORM */ + /* * Enabling PMCs will slow partition context switch times so we only do * it the first time we write to the PMCs. @@ -110,63 +112,15 @@ static DEFINE_PER_CPU(char, pmcs_enabled void ppc64_enable_pmcs(void) { - unsigned long hid0; -#ifdef CONFIG_PPC_PSERIES - unsigned long set, reset; -#endif /* CONFIG_PPC_PSERIES */ - /* Only need to enable them once */ if (__get_cpu_var(pmcs_enabled)) return; __get_cpu_var(pmcs_enabled) = 1; - switch (systemcfg->platform) { - case PLATFORM_PSERIES: - case PLATFORM_POWERMAC: - hid0 = mfspr(HID0); - hid0 |= 1UL << (63 - 20); - - /* POWER4 requires the following sequence */ - asm volatile( - "sync\n" - "mtspr %1, %0\n" - "mfspr %0, %1\n" - "mfspr %0, %1\n" - "mfspr %0, %1\n" - "mfspr %0, %1\n" - "mfspr %0, %1\n" - "mfspr %0, %1\n" - "isync" : "=&r" (hid0) : "i" (HID0), "0" (hid0): - "memory"); - break; - -#ifdef CONFIG_PPC_PSERIES - case PLATFORM_PSERIES_LPAR: - set = 1UL << 63; - reset = 0; - plpar_hcall_norets(H_PERFMON, set, reset); - break; -#endif /* CONFIG_PPC_PSERIES */ - - default: - break; - } - - /* instruct hypervisor to maintain PMCs */ - if (firmware_has_feature(FW_FEATURE_SPLPAR)) - get_paca()->lppaca.pmcregs_in_use = 1; + if (ppc_md.enable_pmcs) + ppc_md.enable_pmcs(); } - -#else - -/* PMC stuff */ -void ppc64_enable_pmcs(void) -{ - /* XXX Implement for iseries */ -} -#endif /* CONFIG_PPC_MULTIPLATFORM */ - EXPORT_SYMBOL(ppc64_enable_pmcs); /* XXX convert to rusty's on_one_cpu */ Index: work/include/asm-ppc64/machdep.h =================================================================== --- work.orig/include/asm-ppc64/machdep.h +++ work/include/asm-ppc64/machdep.h @@ -140,6 +140,9 @@ struct machdep_calls { /* Idle loop for this platform, leave empty for default idle loop */ int (*idle_loop)(void); + + /* Function to enable pmcs for this platform, called once per cpu. */ + void (*enable_pmcs)(void); }; extern int default_idle(void); Index: work/arch/ppc64/kernel/pmc.c =================================================================== --- work.orig/arch/ppc64/kernel/pmc.c +++ work/arch/ppc64/kernel/pmc.c @@ -65,3 +65,24 @@ void release_pmc_hardware(void) spin_unlock(&pmc_owner_lock); } EXPORT_SYMBOL_GPL(release_pmc_hardware); + +void power4_enable_pmcs(void) +{ + unsigned long hid0; + + hid0 = mfspr(HID0); + hid0 |= 1UL << (63 - 20); + + /* POWER4 requires the following sequence */ + asm volatile( + "sync\n" + "mtspr %1, %0\n" + "mfspr %0, %1\n" + "mfspr %0, %1\n" + "mfspr %0, %1\n" + "mfspr %0, %1\n" + "mfspr %0, %1\n" + "mfspr %0, %1\n" + "isync" : "=&r" (hid0) : "i" (HID0), "0" (hid0): + "memory"); +} Index: work/include/asm-ppc64/pmc.h =================================================================== --- work.orig/include/asm-ppc64/pmc.h +++ work/include/asm-ppc64/pmc.h @@ -26,4 +26,6 @@ typedef void (*perf_irq_t)(struct pt_reg int reserve_pmc_hardware(perf_irq_t new_perf_irq); void release_pmc_hardware(void); +void power4_enable_pmcs(void); + #endif /* _PPC64_PMC_H */ From michael at ellerman.id.au Tue Aug 9 15:20:15 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Tue, 9 Aug 2005 15:20:15 +1000 (EST) Subject: [PATCH 0/3] A few fixes for the new device tree code Message-ID: <1123564809.127864.246065361642.qpatch@concordia> Here are three minor fixes for Benh's new device tree code. From michael at ellerman.id.au Tue Aug 9 15:20:18 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Tue, 9 Aug 2005 15:20:18 +1000 (EST) Subject: [PATCH 1/3] ppc64: Fix a misleading printk in unflatten_dt_node() In-Reply-To: <1123564809.127864.246065361642.qpatch@concordia> Message-ID: <20050809052018.88D9767EEF@ozlabs.org> When unflatten_dt_node() fails to find an OF_DT_END_NODE tag it prints "Weird tag at start of node", this should be "Weird tag at end of node". Signed-off-by: Michael Ellerman arch/ppc64/kernel/prom.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: work/arch/ppc64/kernel/prom.c =================================================================== --- work.orig/arch/ppc64/kernel/prom.c +++ work/arch/ppc64/kernel/prom.c @@ -918,7 +918,7 @@ static unsigned long __init unflatten_dt tag = *((u32 *)(*p)); } if (tag != OF_DT_END_NODE) { - printk("Weird tag at start of node: %x\n", tag); + printk("Weird tag at end of node: %x\n", tag); return mem; } *p += 4; From michael at ellerman.id.au Tue Aug 9 15:20:19 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Tue, 9 Aug 2005 15:20:19 +1000 (EST) Subject: [PATCH 2/3] ppc64: unflatten_device_tree() should check if lmb_alloc() fails In-Reply-To: <1123564809.127864.246065361642.qpatch@concordia> Message-ID: <20050809052019.6A26B67EF3@ozlabs.org> unflatten_device_tree() doesn't check if lmb_alloc() succeeds or not, it should. All it can do is panic, but at least there's an error message (assuming you have some sort of console at that point). Signed-off-by: Michael Ellerman arch/ppc64/kernel/prom.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) Index: work/arch/ppc64/kernel/prom.c =================================================================== --- work.orig/arch/ppc64/kernel/prom.c +++ work/arch/ppc64/kernel/prom.c @@ -950,8 +950,13 @@ void __init unflatten_device_tree(void) DBG(" size is %lx, allocating...\n", size); /* Allocate memory for the expanded device tree */ - mem = (unsigned long)abs_to_virt(lmb_alloc(size + 4, - __alignof__(struct device_node))); + mem = lmb_alloc(size + 4, __alignof__(struct device_node)); + if (!mem) { + DBG("Couldn't allocate memory with lmb_alloc()!\n"); + panic("Couldn't allocate memory with lmb_alloc()!\n"); + } + mem = (unsigned long)abs_to_virt(mem); + ((u32 *)mem)[size / 4] = 0xdeadbeef; DBG(" unflattening...\n", mem); From michael at ellerman.id.au Tue Aug 9 15:20:20 2005 From: michael at ellerman.id.au (Michael Ellerman) Date: Tue, 9 Aug 2005 15:20:20 +1000 (EST) Subject: [PATCH 3/3] ppc64: Check of_chosen in check_for_initrd() In-Reply-To: <1123564809.127864.246065361642.qpatch@concordia> Message-ID: <20050809052020.CF0B967EFC@ozlabs.org> You can't call get_property() on a NULL node, so check if of_chosen is set in check_for_initrd(). Signed-off-by: Michael Ellerman arch/ppc64/kernel/setup.c | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-) Index: work/arch/ppc64/kernel/setup.c =================================================================== --- work.orig/arch/ppc64/kernel/setup.c +++ work/arch/ppc64/kernel/setup.c @@ -536,15 +536,19 @@ static void __init check_for_initrd(void DBG(" -> check_for_initrd()\n"); - prop = (u64 *)get_property(of_chosen, "linux,initrd-start", NULL); - if (prop != NULL) { - initrd_start = (unsigned long)__va(*prop); - prop = (u64 *)get_property(of_chosen, "linux,initrd-end", NULL); + if (of_chosen) { + prop = (u64 *)get_property(of_chosen, + "linux,initrd-start", NULL); if (prop != NULL) { - initrd_end = (unsigned long)__va(*prop); - initrd_below_start_ok = 1; - } else - initrd_start = 0; + initrd_start = (unsigned long)__va(*prop); + prop = (u64 *)get_property(of_chosen, + "linux,initrd-end", NULL); + if (prop != NULL) { + initrd_end = (unsigned long)__va(*prop); + initrd_below_start_ok = 1; + } else + initrd_start = 0; + } } /* If we were passed an initrd, set the ROOT_DEV properly if the values From paulus at samba.org Tue Aug 9 16:48:29 2005 From: paulus at samba.org (Paul Mackerras) Date: Tue, 9 Aug 2005 16:48:29 +1000 Subject: [PATCH] ppc64: Move ppc64_enable_pmcs() logic into a ppc_md function In-Reply-To: <20050809011336.EAF0B67F8D@ozlabs.org> References: <20050808084539.26A1B67F4A@ozlabs.org> <20050809011336.EAF0B67F8D@ozlabs.org> Message-ID: <17144.20925.218140.776125@cargo.ozlabs.ibm.com> Michael Ellerman writes: > David asked me to put power4_enable_pmcs() in arch/ppc64/kernel/pmc.c, so > here's an updated (again) version. > Index: work/arch/ppc64/kernel/pmac_setup.c > =================================================================== > --- work.orig/arch/ppc64/kernel/pmac_setup.c > +++ work/arch/ppc64/kernel/pmac_setup.c > @@ -71,6 +71,7 @@ > #include > #include > #include > +#include > > #include "pmac.h" > #include "mpic.h" > @@ -511,4 +512,5 @@ struct machdep_calls __initdata pmac_md > .progress = pmac_progress, > .check_legacy_ioport = pmac_check_legacy_ioport, > .idle_loop = native_idle, > + .enable_pmcs = power4_enable_cpus, That should be power4_enable_pmcs... Regards, Paul. From benh at kernel.crashing.org Tue Aug 9 18:31:13 2005 From: benh at kernel.crashing.org (Benjamin Herrenschmidt) Date: Tue, 09 Aug 2005 10:31:13 +0200 Subject: [RFC] addnote and pmac In-Reply-To: <42F7A418.2050601@am.sony.com> References: <42F7A418.2050601@am.sony.com> Message-ID: <1123576274.30257.152.camel@gaston> On Mon, 2005-08-08 at 11:27 -0700, Geoff Levand wrote: > I found that my Mac G5 wouldn't boot with a zImage modified by > addnote. It worked OK when the image wasn't run through addnote > though. I took just a brief look at addnote.c, and it seems this > step is specific to the OF implementation, or could it be needed > by older tool chains? > > At any rate, by default it is run for all zImage builds, which > we'll need to change to support at least some machines. Below is > what I got working, but someone more familiar with the boot > makefile and the needs of other machines could certainly do > better. The problem is that your G5 does understand the added Note header but doesn't like it's content. IBM Open Firmware only works properly in real mode, while Apple's only works properly in virtual mode. The Note header is set to real mode, thus causing Apple's OF to do a double-reboot into a mode where it craps itself. There is no way unfortunately to "fix" that other than generating two zImages, or better, having the distro add the Note section for IBM machines at zImage install time. Note that your patch is wrong, as this has nothing to do with iSeries, but it's a pSeries issue. But since you can built kernels images that can be booted on both a G5 and a pSeries, using a CONFIG_ option for that isn't a good solution anyway. Ben. From paulus at samba.org Tue Aug 9 21:48:59 2005 From: paulus at samba.org (Paul Mackerras) Date: Tue, 9 Aug 2005 21:48:59 +1000 Subject: queue of patches to go upstream post 2.6.13 Message-ID: <17144.38955.181595.734665@cargo.ozlabs.ibm.com> I have queued up 35 patches to go to Linus once 2.6.13 is out and checked them into a git repository. If you are interested to see what is pending, you can pull from rsync://ozlabs.org/kernel/ppc64-2.6.git Note that that repository only contains the objects that don't appear in Linus' linux-2.6 tree. If you make a clone of a linux-2.6 git repository and then do a git pull like this: git pull rsync://ozlabs.org/kernel/ppc64-2.6.git you should get everything. If anyone has any other ppc64 patches which they would like to go upstream post 2.6.13, let me know. Paul. From boutcher at us.ibm.com Tue Aug 9 22:04:19 2005 From: boutcher at us.ibm.com (David Boutcher) Date: Tue, 9 Aug 2005 07:04:19 -0500 Subject: [PATCH 1/8] Remove NACA fixed address constraint In-Reply-To: <1123569762.4000.14.camel@localhost.localdomain> Message-ID: Jeff Scheel wrote on 08/09/2005 01:42:42 AM: > On Mon, 2005-08-01 at 05:53, David Gibson wrote: > > Comments in head.S suggest that the iSeries naca has a fixed address, > > because tools expect to find it there. The only tool which appears to > > access the naca is addRamDisk, but both the in-kernel version and the > > version used in RHEL and SuSE in fact locate the NACA the same way as > > the hypervisor does, by following the pointer in the hvReleaseData > > structure. > > > > Since the requirement for a fixed address seems to be obsolete, this > > patch removes the naca from head.S and replaces it with a normal C > > initializer. > There are IBM internal debug tools built into the iSeries which depend > on this address. Removing it will break them. > > You should really get input from Mike Ranweiler as to the impact of this > change. Dave Boutcher might also have insight. > -Jeff I was asked before this patch was sent.. No one that I am aware of has used these tools in a couple of years. Dave Boutcher IBM Linux Technology Center -------------- next part -------------- An HTML attachment was scrubbed... URL: http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20050809/fbcac632/attachment.htm From scheel at vnet.ibm.com Tue Aug 9 16:42:42 2005 From: scheel at vnet.ibm.com (Jeff Scheel) Date: Tue, 09 Aug 2005 06:42:42 +0000 Subject: [PATCH 1/8] Remove NACA fixed address constraint In-Reply-To: <20050801055351.E164D67E06@ozlabs.org> References: <20050801055351.E164D67E06@ozlabs.org> Message-ID: <1123569762.4000.14.camel@localhost.localdomain> On Mon, 2005-08-01 at 05:53, David Gibson wrote: > Comments in head.S suggest that the iSeries naca has a fixed address, > because tools expect to find it there. The only tool which appears to > access the naca is addRamDisk, but both the in-kernel version and the > version used in RHEL and SuSE in fact locate the NACA the same way as > the hypervisor does, by following the pointer in the hvReleaseData > structure. > > Since the requirement for a fixed address seems to be obsolete, this > patch removes the naca from head.S and replaces it with a normal C > initializer. There are IBM internal debug tools built into the iSeries which depend on this address. Removing it will break them. You should really get input from Mike Ranweiler as to the impact of this change. Dave Boutcher might also have insight. -Jeff From hch at lst.de Tue Aug 9 22:33:47 2005 From: hch at lst.de (Christoph Hellwig) Date: Tue, 9 Aug 2005 14:33:47 +0200 Subject: [PATCH 1/8] Remove NACA fixed address constraint In-Reply-To: <1123569762.4000.14.camel@localhost.localdomain> References: <20050801055351.E164D67E06@ozlabs.org> <1123569762.4000.14.camel@localhost.localdomain> Message-ID: <20050809123347.GA20902@lst.de> On Tue, Aug 09, 2005 at 06:42:42AM +0000, Jeff Scheel wrote: > On Mon, 2005-08-01 at 05:53, David Gibson wrote: > > Comments in head.S suggest that the iSeries naca has a fixed address, > > because tools expect to find it there. The only tool which appears to > > access the naca is addRamDisk, but both the in-kernel version and the > > version used in RHEL and SuSE in fact locate the NACA the same way as > > the hypervisor does, by following the pointer in the hvReleaseData > > structure. > > > > Since the requirement for a fixed address seems to be obsolete, this > > patch removes the naca from head.S and replaces it with a normal C > > initializer. > There are IBM internal debug tools built into the iSeries which depend > on this address. Removing it will break them. Bad luch. opensource the tools and they can be fixed. Reliance on binry only internal to some company tools must not hold kernel development back. From segher at kernel.crashing.org Tue Aug 9 23:07:00 2005 From: segher at kernel.crashing.org (Segher Boessenkool) Date: Tue, 9 Aug 2005 15:07:00 +0200 Subject: server_mode on Newer Powermac 1.8 (single) In-Reply-To: <42F7E129.6010105@cisco.com> References: <42F7E129.6010105@cisco.com> Message-ID: > If I put OSX on this thing and set it via that GUI will the setting > stick? Yes. If all is right, of course, like, Linux doesn't turn it off for you or something similar ;-) Segher From segher at kernel.crashing.org Tue Aug 9 23:09:02 2005 From: segher at kernel.crashing.org (Segher Boessenkool) Date: Tue, 9 Aug 2005 15:09:02 +0200 Subject: Merging ppc32 and ppc64 In-Reply-To: <42F79D89.3040709@austin.ibm.com> References: <17136.13558.773102.465379@cargo.ozlabs.ibm.com> <42F79D89.3040709@austin.ibm.com> Message-ID: >> I don't see the merge as changing the actual code that gets executed >> on any given platform very much, except in one respect: we are going >> to standardize on a flattened device tree as the way that information >> about the platform gets passed from the boot loader to the kernel. >> Comments? Flames? :) > > There are several userspace applications that parse the non-flat > device tree in /proc/device-tree on pSeries. While I like the idea of > the flattened device tree I think we need to consider how many apps we > are going to break with it. _Please_ don't throw the real device tree away; I'm happy with the flattened device tree if and only if it is a _minimum_ requirement, and having a _real_ device tree (or even real Open Firmware support) is still an option. Segher From segher at kernel.crashing.org Tue Aug 9 23:30:42 2005 From: segher at kernel.crashing.org (Segher Boessenkool) Date: Tue, 9 Aug 2005 15:30:42 +0200 Subject: Merging ppc32 and ppc64 In-Reply-To: References: <17136.13558.773102.465379@cargo.ozlabs.ibm.com> <42F79D89.3040709@austin.ibm.com> Message-ID: >>>> I don't see the merge as changing the actual code that gets executed >>>> on any given platform very much, except in one respect: we are going >>>> to standardize on a flattened device tree as the way that >>>> information >>>> about the platform gets passed from the boot loader to the kernel. > > ^^^^^^^^^^^^^^^^^^^^^***********^^^^^^^^******^ Yes, and that is exactly what I do not want. We are not going to require OF implementations that do not need yaboot or similar to pass a flattened device tree to the kernel, eh? Also, there is no reason why something like yaboot (with an OF still running underneath) should have to care about anything device-tree related at all; the OS can just as easily ask the OF itself. Segher From geert at linux-m68k.org Tue Aug 9 23:11:09 2005 From: geert at linux-m68k.org (Geert Uytterhoeven) Date: Tue, 9 Aug 2005 15:11:09 +0200 (CEST) Subject: Merging ppc32 and ppc64 In-Reply-To: References: <17136.13558.773102.465379@cargo.ozlabs.ibm.com> <42F79D89.3040709@austin.ibm.com> Message-ID: On Tue, 9 Aug 2005, Segher Boessenkool wrote: > > > I don't see the merge as changing the actual code that gets executed > > > on any given platform very much, except in one respect: we are going > > > to standardize on a flattened device tree as the way that information > > > about the platform gets passed from the boot loader to the kernel. ^^^^^^^^^^^^^^^^^^^^^***********^^^^^^^^******^ > > > Comments? Flames? :) > > > > There are several userspace applications that parse the non-flat device tree > > in /proc/device-tree on pSeries. While I like the idea of the flattened > > device tree I think we need to consider how many apps we are going to break > > with it. > > _Please_ don't throw the real device tree away; I'm happy with > the flattened device tree if and only if it is a _minimum_ > requirement, and having a _real_ device tree (or even real > Open Firmware support) is still an option. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds From kumar.gala at freescale.com Wed Aug 10 00:12:20 2005 From: kumar.gala at freescale.com (Kumar Gala) Date: Tue, 9 Aug 2005 09:12:20 -0500 Subject: Merging ppc32 and ppc64 In-Reply-To: References: Message-ID: <3F1564F6-3732-403B-BA6B-BFAB28568AEE@freescale.com> On Aug 9, 2005, at 8:30 AM, Segher Boessenkool wrote: >>>>> I don't see the merge as changing the actual code that gets >>>>> > executed > >>>>> on any given platform very much, except in one respect: we are >>>>> > going > >>>>> to standardize on a flattened device tree as the way that >>>>> information >>>>> about the platform gets passed from the boot loader to the kernel. >>>>> >> >> ^^^^^^^^^^^^^^^^^^^^^***********^^^^^^^^******^ >> > > Yes, and that is exactly what I do not want. We are not going > to require OF implementations that do not need yaboot or similar > to pass a flattened device tree to the kernel, eh? Also, there > is no reason why something like yaboot (with an OF still running > underneath) should have to care about anything device-tree related > at all; the OS can just as easily ask the OF itself. I was under the impression that ALL platforms regardless if the had a OF firmware or not would be using a flattened device tree. Any conversion between an OF tree to a flatten tree would end up happening in boot wrapper code going forward. - kumar From benh at kernel.crashing.org Wed Aug 10 00:38:42 2005 From: benh at kernel.crashing.org (Benjamin Herrenschmidt) Date: Tue, 09 Aug 2005 16:38:42 +0200 Subject: queue of patches to go upstream post 2.6.13 In-Reply-To: <17144.38955.181595.734665@cargo.ozlabs.ibm.com> References: <17144.38955.181595.734665@cargo.ozlabs.ibm.com> Message-ID: <1123598323.30257.206.camel@gaston> On Tue, 2005-08-09 at 21:48 +1000, Paul Mackerras wrote: > I have queued up 35 patches to go to Linus once 2.6.13 is out and > checked them into a git repository. If you are interested to see what > is pending, you can pull from > > rsync://ozlabs.org/kernel/ppc64-2.6.git Could we setup gitweb there too ? :) Ben. From benh at kernel.crashing.org Wed Aug 10 00:40:16 2005 From: benh at kernel.crashing.org (Benjamin Herrenschmidt) Date: Tue, 09 Aug 2005 16:40:16 +0200 Subject: server_mode on Newer Powermac 1.8 (single) In-Reply-To: <42F7E129.6010105@cisco.com> References: <42F7E129.6010105@cisco.com> Message-ID: <1123598417.30257.208.camel@gaston> On Mon, 2005-08-08 at 18:48 -0400, Keith Mitchell wrote: > I have about a dozen of the newer Powermac G5 1.8ghz (single) that has > the SMU (not the PMU) and I was wondering if it is currently possible to > get these things to automatically turn back on in the powerfail > scenario. We also have some Dual 2ghz machines that we can set > 'server_mode' to 1 in the /proc/pmu/options file but nothing similar > seems to exist for these machines. > > If I put OSX on this thing and set it via that GUI will the setting > stick? I thought I had done that initially but I now have some of the > machines that will power back up and some that will not... but I don't > remember if I powered down after doing that setting before installing > linux or not. I haven't yet done something for that. When I find some time, I'll finish my new SMU driver and see if I can figure out how to control the server mode ... Ben. From olof at lixom.net Wed Aug 10 00:52:59 2005 From: olof at lixom.net (Olof Johansson) Date: Tue, 9 Aug 2005 09:52:59 -0500 Subject: Merging ppc32 and ppc64 In-Reply-To: References: <17136.13558.773102.465379@cargo.ozlabs.ibm.com> <42F79D89.3040709@austin.ibm.com> Message-ID: <20050809145259.GH7163@austin.ibm.com> On Tue, Aug 09, 2005 at 03:09:02PM +0200, Segher Boessenkool wrote: > _Please_ don't throw the real device tree away; I'm happy with > the flattened device tree if and only if it is a _minimum_ > requirement, and having a _real_ device tree (or even real > Open Firmware support) is still an option. We already do that. prom_init.c will walk the OF device tree and build a flattened one before booting the kernel. -Olof From arnd at arndb.de Wed Aug 10 00:47:32 2005 From: arnd at arndb.de (Arnd Bergmann) Date: Tue, 9 Aug 2005 16:47:32 +0200 Subject: Merging ppc32 and ppc64 In-Reply-To: <3F1564F6-3732-403B-BA6B-BFAB28568AEE@freescale.com> References: <3F1564F6-3732-403B-BA6B-BFAB28568AEE@freescale.com> Message-ID: <200508091647.32925.arnd@arndb.de> On Dinsdag 09 August 2005 16:12, Kumar Gala wrote: > > Yes, and that is exactly what I do not want. ?We are not going > > to require OF implementations that do not need yaboot or similar > > to pass a flattened device tree to the kernel, eh? ?Also, there > > is no reason why something like yaboot (with an OF still running > > underneath) should have to care about anything device-tree related > > at all; the OS can just as easily ask the OF itself. > > I was under the impression that ALL platforms regardless if the had a ? > OF firmware or not would be using a flattened device tree. ?Any ? > conversion between an OF tree to a flatten tree would end up ? > happening in boot wrapper code going forward. I think you are both right, just using different terminology. The running