From: Anton Blanchard arch/ppc64/Makefile | 4 + arch/ppc64/boot/Makefile | 2 arch/ppc64/kernel/eeh.c | 13 ++- arch/ppc64/kernel/head.S | 61 +++++---------- arch/ppc64/kernel/pSeries_pci.c | 2 arch/ppc64/kernel/xics.c | 9 ++ arch/ppc64/mm/fault.c | 17 +--- arch/ppc64/mm/numa.c | 6 - arch/ppc64/xmon/xmon.c | 153 ---------------------------------------- include/asm-ppc64/mmzone.h | 2 include/asm-ppc64/prom.h | 2 include/asm-ppc64/topology.h | 6 + 12 files changed, 61 insertions(+), 216 deletions(-) diff -puN arch/ppc64/boot/Makefile~ppc64-build-fixes arch/ppc64/boot/Makefile --- 25/arch/ppc64/boot/Makefile~ppc64-build-fixes 2003-08-26 20:34:50.000000000 -0700 +++ 25-akpm/arch/ppc64/boot/Makefile 2003-08-26 20:34:50.000000000 -0700 @@ -122,5 +122,7 @@ $(obj)/imagesize.c: vmlinux awk '{printf "unsigned long vmlinux_memsize = 0x%s;\n", substr($$1,8)}' \ >> $(obj)/imagesize.c +install: $(CONFIGURE) $(BOOTIMAGE) + sh -x $(src)/install.sh "$(KERNELRELEASE)" "$(obj)/zImage" "$(TOPDIR)/System.map" "$(INSTALL_PATH)" clean-files := $(patsubst $(obj)/%,%, $(obj-boot)) diff -puN arch/ppc64/kernel/eeh.c~ppc64-build-fixes arch/ppc64/kernel/eeh.c --- 25/arch/ppc64/kernel/eeh.c~ppc64-build-fixes 2003-08-26 20:34:50.000000000 -0700 +++ 25-akpm/arch/ppc64/kernel/eeh.c 2003-08-26 20:34:50.000000000 -0700 @@ -115,8 +115,17 @@ unsigned long eeh_check_failure(void *to ret = rtas_call(ibm_read_slot_reset_state, 3, 3, rets, dn->eeh_config_addr, BUID_HI(dn->phb->buid), BUID_LO(dn->phb->buid)); if (ret == 0 && rets[1] == 1 && rets[0] >= 2) { - panic("EEH: MMIO failure (%ld) on device:\n %s %s\n", - rets[0], pci_name(dev), dev->dev.name); + /* + * XXX We should create a separate sysctl for this. + * + * Since the panic_on_oops sysctl is used to halt + * the system in light of potential corruption, we + * can use it here. + */ + if (panic_on_oops) + panic("EEH: MMIO failure (%ld) on device:\n%s\n", rets[0], pci_name(dev)); + else + printk("EEH: MMIO failure (%ld) on device:\n%s\n", rets[0], pci_name(dev)); } } eeh_false_positives++; diff -puN arch/ppc64/kernel/head.S~ppc64-build-fixes arch/ppc64/kernel/head.S --- 25/arch/ppc64/kernel/head.S~ppc64-build-fixes 2003-08-26 20:34:50.000000000 -0700 +++ 25-akpm/arch/ppc64/kernel/head.S 2003-08-26 20:34:50.000000000 -0700 @@ -40,6 +40,15 @@ #define DO_SOFT_DISABLE #endif +/* copy saved SOFTE bit or EE bit from saved MSR depending + * if we are doing soft-disable or not + */ +#ifdef DO_SOFT_DISABLE +#define DO_COPY_EE() ld r20,SOFTE(r1) +#else +#define DO_COPY_EE() rldicl r20,r23,49,63 +#endif + /* * hcall interface to pSeries LPAR */ @@ -618,11 +627,7 @@ stab_bolted_user_return: ld r4,_DAR(r1) ld r5,_DSISR(r1) addi r3,r1,STACK_FRAME_OVERHEAD -#ifdef DO_SOFT_DISABLE - ld r20,SOFTE(r1) /* Copy saved SOFTE bit */ -#else - rldicl r20,r23,49,63 /* copy EE bit from saved MSR */ -#endif + DO_COPY_EE() li r6,0x300 bl .save_remaining_regs bl .do_page_fault @@ -644,12 +649,9 @@ DataAccessSLB_common: or. r3,r3,r3 /* Check return code */ beq fast_exception_return /* Return if we succeeded */ addi r3,r1,STACK_FRAME_OVERHEAD -#ifdef DO_SOFT_DISABLE - ld r20,SOFTE(r1) -#else - rldicl r20,r23,49,63 /* copy EE bit from saved MSR */ -#endif + DO_COPY_EE() li r6,0x380 + li r5,0 bl .save_remaining_regs bl .do_page_fault b .ret_from_except @@ -670,13 +672,9 @@ InstructionAccess_common: bl .do_hash_page_ISI /* Try to handle as hpte fault */ 1: mr r4,r22 - mr r5,r23 + rlwinm r5,r23,0,4,4 /* We only care about PR in error_code */ addi r3,r1,STACK_FRAME_OVERHEAD -#ifdef DO_SOFT_DISABLE - ld r20,SOFTE(r1) -#else - rldicl r20,r23,49,63 /* copy EE bit from saved MSR */ -#endif + DO_COPY_EE() li r6,0x400 bl .save_remaining_regs bl .do_page_fault @@ -692,12 +690,9 @@ InstructionAccessSLB_common: beq+ fast_exception_return /* Return if we succeeded */ addi r3,r1,STACK_FRAME_OVERHEAD -#ifdef DO_SOFT_DISABLE - ld r20,SOFTE(r1) -#else - rldicl r20,r23,49,63 /* copy EE bit from saved MSR */ -#endif + DO_COPY_EE() li r6,0x480 + li r5,0 bl .save_remaining_regs bl .do_page_fault b .ret_from_except @@ -769,11 +764,7 @@ HardwareInterrupt_entry: Alignment_common: EXCEPTION_PROLOG_COMMON addi r3,r1,STACK_FRAME_OVERHEAD -#ifdef DO_SOFT_DISABLE - ld r20,SOFTE(r1) -#else - rldicl r20,r23,49,63 /* copy EE bit from saved MSR */ -#endif + DO_COPY_EE() li r6,0x600 bl .save_remaining_regs bl .AlignmentException @@ -783,11 +774,7 @@ Alignment_common: ProgramCheck_common: EXCEPTION_PROLOG_COMMON addi r3,r1,STACK_FRAME_OVERHEAD -#ifdef DO_SOFT_DISABLE - ld r20,SOFTE(r1) -#else - rldicl r20,r23,49,63 /* copy EE bit from saved MSR */ -#endif + DO_COPY_EE() li r6,0x700 bl .save_remaining_regs bl .ProgramCheckException @@ -798,11 +785,7 @@ FPUnavailable_common: EXCEPTION_PROLOG_COMMON bne .load_up_fpu /* if from user, just load it up */ addi r3,r1,STACK_FRAME_OVERHEAD -#ifdef DO_SOFT_DISABLE - ld r20,SOFTE(r1) -#else - rldicl r20,r23,49,63 /* copy EE bit from saved MSR */ -#endif + DO_COPY_EE() li r6,0x800 bl .save_remaining_regs bl .KernelFPUnavailableException @@ -818,11 +801,7 @@ SystemCall_common: beq+ HardwareInterrupt_entry 1: #endif -#ifdef DO_SOFT_DISABLE - ld r20,SOFTE(r1) -#else - rldicl r20,r23,49,63 /* copy EE bit from saved MSR */ -#endif + DO_COPY_EE() li r6,0xC00 bl .save_remaining_regs bl .DoSyscall diff -puN arch/ppc64/kernel/pSeries_pci.c~ppc64-build-fixes arch/ppc64/kernel/pSeries_pci.c --- 25/arch/ppc64/kernel/pSeries_pci.c~ppc64-build-fixes 2003-08-26 20:34:50.000000000 -0700 +++ 25-akpm/arch/ppc64/kernel/pSeries_pci.c 2003-08-26 20:34:50.000000000 -0700 @@ -427,6 +427,7 @@ unsigned long __init find_and_init_phbs( void pcibios_name_device(struct pci_dev *dev) { +#if 0 struct device_node *dn; /* @@ -446,6 +447,7 @@ void pcibios_name_device(struct pci_dev } } } +#endif } void __init pcibios_fixup_device_resources(struct pci_dev *dev, diff -puN arch/ppc64/kernel/xics.c~ppc64-build-fixes arch/ppc64/kernel/xics.c --- 25/arch/ppc64/kernel/xics.c~ppc64-build-fixes 2003-08-26 20:34:50.000000000 -0700 +++ 25-akpm/arch/ppc64/kernel/xics.c 2003-08-26 20:34:50.000000000 -0700 @@ -267,6 +267,15 @@ void xics_disable_irq(u_int virq) irq, call_status); return; } + + /* Have to set XIVE to 0xff to be able to remove a slot */ + call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, default_server, + 0xff); + if (call_status != 0) { + printk("xics_disable_irq: irq=%x: ibm_set_xive(0xff) returned %lx\n", + irq, call_status); + return; + } } void xics_end_irq(u_int irq) diff -puN arch/ppc64/Makefile~ppc64-build-fixes arch/ppc64/Makefile --- 25/arch/ppc64/Makefile~ppc64-build-fixes 2003-08-26 20:34:50.000000000 -0700 +++ 25-akpm/arch/ppc64/Makefile 2003-08-26 20:34:50.000000000 -0700 @@ -39,6 +39,10 @@ $(boottarget-y): vmlinux rm -f .config arch/ppc64/defconfig cp -f arch/ppc64/configs/$(@:config=defconfig) arch/ppc64/defconfig +install: vmlinux + echo doing ppc64 make install + $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@ + archclean: $(Q)$(MAKE) $(clean)=$(boot) diff -puN arch/ppc64/mm/fault.c~ppc64-build-fixes arch/ppc64/mm/fault.c --- 25/arch/ppc64/mm/fault.c~ppc64-build-fixes 2003-08-26 20:34:50.000000000 -0700 +++ 25-akpm/arch/ppc64/mm/fault.c 2003-08-26 20:34:50.000000000 -0700 @@ -46,8 +46,10 @@ int debugger_kernel_faults = 1; void bad_page_fault(struct pt_regs *, unsigned long, int); /* - * For 600- and 800-family processors, the error_code parameter is DSISR - * for a data fault, SRR1 for an instruction fault. + * The error_code parameter is + * - DSISR for a non-SLB data access fault, + * - SRR1 & 0x08000000 for a non-SLB instruction access fault + * - 0 any SLB fault. */ void do_page_fault(struct pt_regs *regs, unsigned long address, unsigned long error_code) @@ -58,17 +60,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long code = SEGV_MAPERR; unsigned long is_write = error_code & 0x02000000; - /* - * Fortunately the bit assignments in SRR1 for an instruction - * fault and DSISR for a data fault are mostly the same for the - * bits we are interested in. But there are some bits which - * indicate errors in DSISR but can validly be set in SRR1. - */ - if (regs->trap == 0x400) - error_code &= 0x48200000; - else if (regs->trap != 0x300) /* ensure error_code is 0 on SLB miss */ - error_code = 0; - #ifdef CONFIG_DEBUG_KERNEL if (debugger_fault_handler && (regs->trap == 0x300 || regs->trap == 0x380)) { diff -puN arch/ppc64/mm/numa.c~ppc64-build-fixes arch/ppc64/mm/numa.c --- 25/arch/ppc64/mm/numa.c~ppc64-build-fixes 2003-08-26 20:34:50.000000000 -0700 +++ 25-akpm/arch/ppc64/mm/numa.c 2003-08-26 20:34:50.000000000 -0700 @@ -24,7 +24,7 @@ int numa_cpu_lookup_table[NR_CPUS] = { [ 0 ... (NR_CPUS - 1)] = -1}; int numa_memory_lookup_table[MAX_MEMORY >> MEMORY_INCREMENT_SHIFT] = { [ 0 ... ((MAX_MEMORY >> MEMORY_INCREMENT_SHIFT) - 1)] = -1}; -unsigned long numa_cpumask_lookup_table[MAX_NUMNODES]; +cpumask_t numa_cpumask_lookup_table[MAX_NUMNODES]; int nr_cpus_in_node[MAX_NUMNODES] = { [0 ... (MAX_NUMNODES -1)] = 0}; struct pglist_data node_data[MAX_NUMNODES]; @@ -34,8 +34,8 @@ static inline void map_cpu_to_node(int c { dbg("cpu %d maps to domain %d\n", cpu, node); numa_cpu_lookup_table[cpu] = node; - if (!(numa_cpumask_lookup_table[node] & 1UL << cpu)) { - numa_cpumask_lookup_table[node] |= 1UL << cpu; + if (!(cpu_isset(cpu, numa_cpumask_lookup_table[node]))) { + cpu_set(cpu, numa_cpumask_lookup_table[node]); nr_cpus_in_node[node]++; } } diff -puN arch/ppc64/xmon/xmon.c~ppc64-build-fixes arch/ppc64/xmon/xmon.c --- 25/arch/ppc64/xmon/xmon.c~ppc64-build-fixes 2003-08-26 20:34:50.000000000 -0700 +++ 25-akpm/arch/ppc64/xmon/xmon.c 2003-08-26 20:34:51.000000000 -0700 @@ -86,7 +86,6 @@ static int nvreadb(unsigned); static int ppc_inst_dump(unsigned long, long); void print_address(unsigned long); static int getsp(void); -static void dump_hash_table(void); static void backtrace(struct pt_regs *); static void excprint(struct pt_regs *); static void prregs(struct pt_regs *); @@ -158,7 +157,6 @@ Commands:\n\ dd dump double values\n\ e print exception information\n\ f flush cache\n\ - h dump hash table\n\ m examine/change memory\n\ mm move a block of memory\n\ ms set a block of memory\n\ @@ -590,9 +588,6 @@ cmds(struct pt_regs *excp) case 'f': cacheflush(); break; - case 'h': - dump_hash_table(); - break; case 's': case 'x': case EOF: @@ -981,7 +976,7 @@ backtrace(struct pt_regs *excp) } printf("\n"); if (regs.gpr[1] < sp) { - printf("\n", regs.gpr[1]); + printf("\n", regs.gpr[1]); break; } @@ -1228,152 +1223,6 @@ super_regs() scannl(); } -#ifndef CONFIG_PPC64BRIDGE -static void -dump_hash_table_seg(unsigned seg, unsigned start, unsigned end) -{ - extern void *Hash; - extern unsigned long Hash_size; - unsigned *htab = Hash; - unsigned hsize = Hash_size; - unsigned v, hmask, va, last_va; - int found, last_found, i; - unsigned *hg, w1, last_w2, last_va0; - - last_found = 0; - hmask = hsize / 64 - 1; - va = start; - start = (start >> 12) & 0xffff; - end = (end >> 12) & 0xffff; - for (v = start; v < end; ++v) { - found = 0; - hg = htab + (((v ^ seg) & hmask) * 16); - w1 = 0x80000000 | (seg << 7) | (v >> 10); - for (i = 0; i < 8; ++i, hg += 2) { - if (*hg == w1) { - found = 1; - break; - } - } - if (!found) { - w1 ^= 0x40; - hg = htab + ((~(v ^ seg) & hmask) * 16); - for (i = 0; i < 8; ++i, hg += 2) { - if (*hg == w1) { - found = 1; - break; - } - } - } - if (!(last_found && found && (hg[1] & ~0x180) == last_w2 + 4096)) { - if (last_found) { - if (last_va != last_va0) - printf(" ... %x", last_va); - printf("\n"); - } - if (found) { - printf("%x to %x", va, hg[1]); - last_va0 = va; - } - last_found = found; - } - if (found) { - last_w2 = hg[1] & ~0x180; - last_va = va; - } - va += 4096; - } - if (last_found) - printf(" ... %x\n", last_va); -} - -#else /* CONFIG_PPC64BRIDGE */ -static void -dump_hash_table_seg(unsigned seg, unsigned start, unsigned end) -{ - extern void *Hash; - extern unsigned long Hash_size; - unsigned *htab = Hash; - unsigned hsize = Hash_size; - unsigned v, hmask, va, last_va; - int found, last_found, i; - unsigned *hg, w1, last_w2, last_va0; - - last_found = 0; - hmask = hsize / 128 - 1; - va = start; - start = (start >> 12) & 0xffff; - end = (end >> 12) & 0xffff; - for (v = start; v < end; ++v) { - found = 0; - hg = htab + (((v ^ seg) & hmask) * 32); - w1 = 1 | (seg << 12) | ((v & 0xf800) >> 4); - for (i = 0; i < 8; ++i, hg += 4) { - if (hg[1] == w1) { - found = 1; - break; - } - } - if (!found) { - w1 ^= 2; - hg = htab + ((~(v ^ seg) & hmask) * 32); - for (i = 0; i < 8; ++i, hg += 4) { - if (hg[1] == w1) { - found = 1; - break; - } - } - } - if (!(last_found && found && (hg[3] & ~0x180) == last_w2 + 4096)) { - if (last_found) { - if (last_va != last_va0) - printf(" ... %x", last_va); - printf("\n"); - } - if (found) { - printf("%x to %x", va, hg[3]); - last_va0 = va; - } - last_found = found; - } - if (found) { - last_w2 = hg[3] & ~0x180; - last_va = va; - } - va += 4096; - } - if (last_found) - printf(" ... %x\n", last_va); -} -#endif /* CONFIG_PPC64BRIDGE */ - -static unsigned long hash_ctx; -static unsigned long hash_start; -static unsigned long hash_end; - -static void -dump_hash_table() -{ - int seg; - unsigned seg_start, seg_end; - - hash_ctx = 0; - hash_start = 0; - hash_end = 0xfffff000; - scanhex(&hash_ctx); - scanhex(&hash_start); - scanhex(&hash_end); - printf("Mappings for context %x\n", hash_ctx); - seg_start = hash_start; - for (seg = hash_start >> 28; seg <= hash_end >> 28; ++seg) { - seg_end = (seg << 28) | 0x0ffff000; - if (seg_end > hash_end) - seg_end = hash_end; - dump_hash_table_seg((hash_ctx << 4) + seg, seg_start, seg_end); - seg_start = seg_end + 0x1000; - } -} - int mread(unsigned long adrs, void *buf, int size) { diff -puN include/asm-ppc64/mmzone.h~ppc64-build-fixes include/asm-ppc64/mmzone.h --- 25/include/asm-ppc64/mmzone.h~ppc64-build-fixes 2003-08-26 20:34:50.000000000 -0700 +++ 25-akpm/include/asm-ppc64/mmzone.h 2003-08-26 20:34:51.000000000 -0700 @@ -20,7 +20,7 @@ extern struct pglist_data node_data[]; extern int numa_cpu_lookup_table[]; extern int numa_memory_lookup_table[]; -extern unsigned long numa_cpumask_lookup_table[]; +extern cpumask_t numa_cpumask_lookup_table[]; extern int nr_cpus_in_node[]; #define MAX_MEMORY (1UL << 41) diff -puN include/asm-ppc64/prom.h~ppc64-build-fixes include/asm-ppc64/prom.h --- 25/include/asm-ppc64/prom.h~ppc64-build-fixes 2003-08-26 20:34:50.000000000 -0700 +++ 25-akpm/include/asm-ppc64/prom.h 2003-08-26 20:34:51.000000000 -0700 @@ -183,8 +183,6 @@ extern struct device_node *find_type_dev extern struct device_node *find_path_device(const char *path); extern struct device_node *find_compatible_devices(const char *type, const char *compat); -extern struct device_node *find_pci_device_OFnode(unsigned char bus, - unsigned char dev_fn); extern struct device_node *find_all_nodes(void); extern int device_is_compatible(struct device_node *device, const char *); extern int machine_is_compatible(const char *compat); diff -puN include/asm-ppc64/topology.h~ppc64-build-fixes include/asm-ppc64/topology.h --- 25/include/asm-ppc64/topology.h~ppc64-build-fixes 2003-08-26 20:34:50.000000000 -0700 +++ 25-akpm/include/asm-ppc64/topology.h 2003-08-26 20:34:51.000000000 -0700 @@ -24,14 +24,16 @@ static inline int cpu_to_node(int cpu) #define parent_node(node) (node) -static inline unsigned long node_to_cpumask(int node) +static inline cpumask_t node_to_cpumask(int node) { return numa_cpumask_lookup_table[node]; } static inline int node_to_first_cpu(int node) { - return __ffs(node_to_cpumask(node)); + cpumask_t tmp; + tmp = node_to_cpumask(node); + return first_cpu(tmp); } #define node_to_memblk(node) (node) _