From hollisb at us.ibm.com Sat May 1 04:11:21 2004 From: hollisb at us.ibm.com (Hollis Blanchard) Date: Fri, 30 Apr 2004 13:11:21 -0500 Subject: hvconsole.c : possible problem In-Reply-To: <1083191052.20092.79.camel@gaston> References: <1083128727.20089.57.camel@gaston> <8457B337-9921-11D8-AFB9-000A95A0560C@us.ibm.com> <1083191052.20092.79.camel@gaston> Message-ID: On Apr 28, 2004, at 5:24 PM, Benjamin Herrenschmidt wrote: > > Ah, we always ask for 16 bytes... that I didn't get. Ok, then yes, use > a static 16 bytes buffer, and then move data from there to packets and > leave data in there if you have no packet available. The overflow logic > is dodgy, you should be able to do a single nice loop. One more problem: let's say we have three of the four ring descriptors filled already. Then we do a read, and get three packets in 16 bytes. Then we have nowhere to put the remaining two. This could happen regardless of the size of the ring... I see only two solutions: - only do the read if three descriptors are available. Actually technically four, since we can fit the first byte of the fourth packet in a single read. I think we'd need to at least double the size of the ring in this case (adding another 1KB to BSS). Seems like a waste. - kmalloc ring descriptors as needed (264 bytes each). At least adding some complexity. Sigh. -- Hollis Blanchard IBM Linux Technology Center ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From hollisb at us.ibm.com Sat May 1 04:15:13 2004 From: hollisb at us.ibm.com (Hollis Blanchard) Date: Fri, 30 Apr 2004 13:15:13 -0500 Subject: hvconsole.c : possible problem In-Reply-To: References: <1083128727.20089.57.camel@gaston> <8457B337-9921-11D8-AFB9-000A95A0560C@us.ibm.com> <1083191052.20092.79.camel@gaston> Message-ID: <5352C596-9AD2-11D8-A88A-000A95A0560C@us.ibm.com> On Apr 30, 2004, at 1:11 PM, Hollis Blanchard wrote: > > One more problem: let's say we have three of the four ring descriptors > filled already. Then we do a read, and get three packets in 16 bytes. > Then we have nowhere to put the remaining two. > > This could happen regardless of the size of the ring... I see only two > solutions: > - only do the read if three descriptors are available. Actually > technically four, since we can fit the first byte of the fourth packet > in a single read. I think we'd need to at least double the size of the > ring in this case (adding another 1KB to BSS). Seems like a waste. > - kmalloc ring descriptors as needed (264 bytes each). At least adding > some complexity. Sigh. ... except I can't kmalloc() at initialization time because it's before mem_init(). -- Hollis Blanchard IBM Linux Technology Center ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From greg at kroah.com Sun May 2 16:51:18 2004 From: greg at kroah.com (Greg KH) Date: Sat, 1 May 2004 23:51:18 -0700 Subject: [Pcihpd-discuss] [PATH] rpaphp doesn't initialize slot's name In-Reply-To: <40906502.4070009@us.ibm.com> References: <40906502.4070009@us.ibm.com> Message-ID: <20040502065118.GG3766@kroah.com> On Wed, Apr 28, 2004 at 09:14:26PM -0500, Linda Xie wrote: > Hi Greg, > > This patch includes some changes that I missed when I cut > php_phy_location.patch. It fixes the kernel crash when rpaphp is > loaded because slot->name is not initialized. > > Please apply it to your tree. Ick, it doesn't apply due to the other changes to the driver. Can you rediff this against the latest -mm tree and resend it? thanks, greg k-h ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From torvalds at osdl.org Mon May 3 12:11:49 2004 From: torvalds at osdl.org (Linus Torvalds) Date: Sun, 2 May 2004 19:11:49 -0700 (PDT) Subject: "sparse" warnings.. In-Reply-To: <20040422105836.0ac99736.sfr@canb.auug.org.au> References: <20040422105836.0ac99736.sfr@canb.auug.org.au> Message-ID: Ok, having made "sparse" be somewhat more amenable to cross-compiling (ie understanding that the target might be 64-bit, even though it itself is running in 32-bit mode), I'm starting to find things in the ppc64 tree that sparse really doesn't like. Much of it is just sparse being anal about implicit type conversions, notably constants that convert to a bigger size. But some of it seems to be due to real bugs in the ppc64 tree: warning: include/asm/thread_info.h:72:5: undefined preprocessor identifier 'PAGE_SIZE' warning: include/asm/thread_info.h:72:23: undefined preprocessor identifier 'PAGE_SIZE' Lookie there - it's comparing something that isn't defined. It so happens that it works (when PAGE_SIZE isn't defined, the preprocessor arithmetic rules means that it gets evaluated as zero), but it works for all the wrong reasons. Most of the warnings are of the type warning: include/linux/mm.h:365:9: value is so big it is unsigned long warning: include/linux/mm.h:527:9: value is so big it is unsigned long because the "__va()" macro on ppc64 uses KERNELBASE, which in turn is defined to PAGE_OFFSET, which in turn is #define PAGE_OFFSET 0xC000000000000000 which silently makes the constant be of type "unsigned long" through the C type expansion rules. Sparse doesn't like that, because most people don't actually understand the C type expansion rules. Quiz: what's the difference between #define MIN_INT 0x80000000 #define MIN_INT 2147483648 in C for a 64-bit compiler? Hint: one is "unsigned int", the other is "long". Linus ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From benh at kernel.crashing.org Mon May 3 13:05:39 2004 From: benh at kernel.crashing.org (Benjamin Herrenschmidt) Date: Mon, 03 May 2004 13:05:39 +1000 Subject: "sparse" warnings.. In-Reply-To: References: <20040422105836.0ac99736.sfr@canb.auug.org.au> Message-ID: <1083553538.20473.240.camel@gaston> On Mon, 2004-05-03 at 12:11, Linus Torvalds wrote: > Ok, having made "sparse" be somewhat more amenable to cross-compiling (ie > understanding that the target might be 64-bit, even though it itself is > running in 32-bit mode), I'm starting to find things in the ppc64 tree > that sparse really doesn't like. Heh, cool. I should try it. > Much of it is just sparse being anal about implicit type conversions, > notably constants that convert to a bigger size. But some of it seems to > be due to real bugs in the ppc64 tree: > > warning: include/asm/thread_info.h:72:5: undefined preprocessor identifier 'PAGE_SIZE' > warning: include/asm/thread_info.h:72:23: undefined preprocessor identifier 'PAGE_SIZE' Interesting. We should probably include page.h in there. > Lookie there - it's comparing something that isn't defined. It so happens > that it works (when PAGE_SIZE isn't defined, the preprocessor arithmetic > rules means that it gets evaluated as zero), but it works for all the > wrong reasons. Indeed. > Most of the warnings are of the type > > warning: include/linux/mm.h:365:9: value is so big it is unsigned long > warning: include/linux/mm.h:527:9: value is so big it is unsigned long > > because the "__va()" macro on ppc64 uses KERNELBASE, which in turn is > defined to PAGE_OFFSET, which in turn is > > #define PAGE_OFFSET 0xC000000000000000 > > which silently makes the constant be of type "unsigned long" through the C > type expansion rules. Sparse doesn't like that, because most people don't > actually understand the C type expansion rules. Well, do you want to explicitely write it with ULL suffix ? > Quiz: what's the difference between > > #define MIN_INT 0x80000000 > #define MIN_INT 2147483648 > > in C for a 64-bit compiler? Hint: one is "unsigned int", the other is > "long". First one gets zero extended, second one gets sign extended I suppose, this first on is bogus. Where do I get sparse ? There's a bk ? FAQ ? Ben. ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From benh at kernel.crashing.org Mon May 3 13:21:21 2004 From: benh at kernel.crashing.org (Benjamin Herrenschmidt) Date: Mon, 03 May 2004 13:21:21 +1000 Subject: "sparse" warnings.. In-Reply-To: <1083553538.20473.240.camel@gaston> References: <20040422105836.0ac99736.sfr@canb.auug.org.au> <1083553538.20473.240.camel@gaston> Message-ID: <1083554480.20474.244.camel@gaston> On Mon, 2004-05-03 at 13:05, Benjamin Herrenschmidt wrote: > > Quiz: what's the difference between > > > > #define MIN_INT 0x80000000 > > #define MIN_INT 2147483648 > > > > in C for a 64-bit compiler? Hint: one is "unsigned int", the other is > > "long". > > First one gets zero extended, second one gets sign extended I suppose, > this first on is bogus. Hrm... I'm now not even sure I'm not full of shit on that one ;) I admit I'm not sure how the compiler will deal with the constant. The first one beeing unsigned int, it may actually be sign extended properly when casted to int, though the second oen I don't know. I don't know what will happen when comparing with an int. I would have written the constant with a sign in the first place ;) ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From anton at samba.org Mon May 3 13:36:04 2004 From: anton at samba.org (Anton Blanchard) Date: Mon, 3 May 2004 13:36:04 +1000 Subject: "sparse" warnings.. In-Reply-To: References: <20040422105836.0ac99736.sfr@canb.auug.org.au> Message-ID: <20040503033604.GB11130@krispykreme> > Ok, having made "sparse" be somewhat more amenable to cross-compiling (ie > understanding that the target might be 64-bit, even though it itself is > running in 32-bit mode), I'm starting to find things in the ppc64 tree > that sparse really doesn't like. Cool. I had a play with sparse on ppc64 when I got bored on a plane once. Ive attached what I had back then but it will probably be a big mess of rejects these days. The local_paca hack is pretty ugly too. > warning: include/asm/thread_info.h:72:5: undefined preprocessor identifier 'PAGE_SIZE' > warning: include/asm/thread_info.h:72:23: undefined preprocessor identifier 'PAGE_SIZE' > > Lookie there - it's comparing something that isn't defined. It so happens > that it works (when PAGE_SIZE isn't defined, the preprocessor arithmetic > rules means that it gets evaluated as zero), but it works for all the > wrong reasons. Oh yeah I ended up killing that check completely in the patch below since it was just informational and could just as easily be served by a comment right above the THREAD_SIZE definition. Anton ===== arch/ppc64/kernel/align.c 1.10 vs edited ===== --- 1.10/arch/ppc64/kernel/align.c Sat Jun 7 11:19:26 2003 +++ edited/arch/ppc64/kernel/align.c Sat Jun 21 00:24:19 2003 @@ -215,7 +215,7 @@ unsigned long i; int ret; unsigned dsisr; - unsigned char *addr, *p; + unsigned char __user *addr, *p; unsigned long *lp; union { long ll; @@ -257,7 +257,7 @@ flags = aligninfo[instr].flags; /* DAR has the operand effective address */ - addr = (unsigned char *)regs->dar; + addr = (unsigned char __user *)regs->dar; /* A size of 0 indicates an instruction we don't support */ /* we also don't support the multiples (lmw, stmw, lmd, stmd) */ @@ -270,7 +270,7 @@ * storage */ if (instr == DCBZ) - addr = (unsigned char *) ((unsigned long)addr & -L1_CACHE_BYTES); + addr = (unsigned char __user *)((unsigned long)addr & -L1_CACHE_BYTES); /* Verify the address of the operand */ if (user_mode(regs)) { ===== arch/ppc64/kernel/irq.c 1.29 vs edited ===== --- 1.29/arch/ppc64/kernel/irq.c Sat Jun 7 11:59:39 2003 +++ edited/arch/ppc64/kernel/irq.c Fri Jun 20 17:23:12 2003 @@ -618,7 +618,7 @@ return sprintf(page, "%16lx\n", irq_affinity[(long)data]); } -static unsigned int parse_hex_value (const char *buffer, +static unsigned int parse_hex_value (const char __user *buffer, unsigned long count, unsigned long *ret) { unsigned char hexnum [HEX_DIGITS]; @@ -655,7 +655,7 @@ return 0; } -static int irq_affinity_write_proc (struct file *file, const char *buffer, +static int irq_affinity_write_proc (struct file *file, const char __user *buffer, unsigned long count, void *data) { int irq = (long)data, full_count = count, err; @@ -689,7 +689,7 @@ return sprintf (page, "%08lx\n", *mask); } -static int prof_cpu_mask_write_proc (struct file *file, const char *buffer, +static int prof_cpu_mask_write_proc (struct file *file, const char __user *buffer, unsigned long count, void *data) { unsigned long *mask = (unsigned long *) data, full_count = count, err; ===== arch/ppc64/kernel/pacaData.c 1.7 vs edited ===== --- 1.7/arch/ppc64/kernel/pacaData.c Wed May 21 06:11:13 2003 +++ edited/arch/ppc64/kernel/pacaData.c Fri Jun 20 17:04:52 2003 @@ -54,7 +54,7 @@ .xFPRegsInUse = 1, \ .xDynProcStatus = 2, \ .xDecrVal = 0x00ff0000, \ - .xEndOfQuantum = 0xffffffffffffffff \ + .xEndOfQuantum = 0xffffffffffffffffUL \ }, \ .xRegSav = { \ .xDesc = 0xd397d9e2, /* "LpRS" */ \ ===== arch/ppc64/kernel/process.c 1.35 vs edited ===== --- 1.35/arch/ppc64/kernel/process.c Sat Jun 7 11:19:27 2003 +++ edited/arch/ppc64/kernel/process.c Fri Jun 20 18:22:58 2003 @@ -337,7 +337,7 @@ giveup_fpu(current); return do_fork(clone_flags & ~CLONE_IDLETASK, p2, regs, 0, - (int *)parent_tidptr, (int *)child_tidptr); + (int __user *)parent_tidptr, (int __user *)child_tidptr); } int sys_fork(unsigned long p1, unsigned long p2, unsigned long p3, @@ -368,14 +368,15 @@ int error; char * filename; - filename = getname((char *) a0); + filename = getname((char __user *) a0); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; if (regs->msr & MSR_FP) giveup_fpu(current); - error = do_execve(filename, (char **) a1, (char **) a2, regs); + error = do_execve(filename, (char __user * __user *)a1, + (char __user * __user *)a2, regs); if (error == 0) current->ptrace &= ~PT_DTRACE; ===== arch/ppc64/kernel/prom.c 1.28 vs edited ===== --- 1.28/arch/ppc64/kernel/prom.c Wed May 28 08:36:24 2003 +++ edited/arch/ppc64/kernel/prom.c Fri Jun 20 00:03:06 2003 @@ -224,7 +224,7 @@ static void __init -prom_exit() +prom_exit(void) { unsigned long offset = reloc_offset(); @@ -2036,7 +2036,7 @@ void __init -abort() +abort(void) { #ifdef CONFIG_XMON xmon(NULL); ===== arch/ppc64/kernel/rtasd.c 1.10 vs edited ===== --- 1.10/arch/ppc64/kernel/rtasd.c Wed Feb 12 15:28:08 2003 +++ edited/arch/ppc64/kernel/rtasd.c Fri Jun 20 18:27:32 2003 @@ -69,7 +69,7 @@ return 0; } -static ssize_t rtas_log_read(struct file * file, char * buf, +static ssize_t rtas_log_read(struct file * file, char __user *buf, size_t count, loff_t *ppos) { int error; ===== arch/ppc64/kernel/signal.c 1.28 vs edited ===== --- 1.28/arch/ppc64/kernel/signal.c Tue May 20 01:18:53 2003 +++ edited/arch/ppc64/kernel/signal.c Sat Jun 21 01:14:52 2003 @@ -72,7 +72,7 @@ /* * Atomically swap in the new signal mask, and wait for a signal. */ -long sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, int p3, int p4, +long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, int p3, int p4, int p6, int p7, struct pt_regs *regs) { sigset_t saveset, newset; @@ -102,9 +102,9 @@ } } -long sys_sigaltstack(const stack_t *uss, stack_t *uoss, unsigned long r5, - unsigned long r6, unsigned long r7, unsigned long r8, - struct pt_regs *regs) +long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, + unsigned long r5, unsigned long r6, unsigned long r7, + unsigned long r8, struct pt_regs *regs) { return do_sigaltstack(uss, uoss, regs->gpr[1]); } @@ -115,7 +115,7 @@ */ static int -setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs, +setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, int signr, sigset_t *set, unsigned long handler) { int err = 0; @@ -146,7 +146,8 @@ */ static int -restore_sigcontext(struct pt_regs *regs, sigset_t *set, struct sigcontext *sc) +restore_sigcontext(struct pt_regs *regs, sigset_t *set, + struct sigcontext __user *sc) { unsigned int err = 0; @@ -186,7 +187,7 @@ } static int -setup_trampoline(unsigned int syscall, unsigned int *tramp) +setup_trampoline(unsigned int syscall, unsigned int __user *tramp) { int i, err = 0; @@ -216,7 +217,7 @@ unsigned long r6, unsigned long r7, unsigned long r8, struct pt_regs *regs) { - struct ucontext *uc = (struct ucontext *)regs->gpr[1]; + struct ucontext __user *uc = (struct ucontext __user *)regs->gpr[1]; sigset_t set; stack_t st; @@ -260,11 +261,11 @@ * entry is the TOC value we need to use. */ func_descr_t *funct_desc_ptr; - struct rt_sigframe *frame; + struct rt_sigframe __user *frame; unsigned long newsp = 0; int err = 0; - frame = get_sigframe(ka, regs, sizeof(*frame)); + frame = (struct rt_sigframe __user *)get_sigframe(ka, regs, sizeof(*frame)); if (verify_area(VERIFY_WRITE, frame, sizeof(*frame))) goto badframe; ===== arch/ppc64/kernel/signal32.c 1.40 vs edited ===== --- 1.40/arch/ppc64/kernel/signal32.c Tue May 20 01:18:53 2003 +++ edited/arch/ppc64/kernel/signal32.c Fri Jun 20 17:54:44 2003 @@ -200,14 +200,15 @@ unsigned long r6, unsigned long r7, unsigned long r8, struct pt_regs *regs) { - struct sigcontext32 *sc, sigctx; - struct sigregs32 *sr; + struct sigcontext32 __user *sc; + struct sigcontext32 sigctx; + struct sigregs32 __user *sr; int ret; elf_gregset_t32 saved_regs; /* an array of ELF_NGREG unsigned ints (32 bits) */ sigset_t set; int i; - sc = (struct sigcontext32 *)(regs->gpr[1] + __SIGNAL_FRAMESIZE32); + sc = (struct sigcontext32 __user *)(regs->gpr[1] + __SIGNAL_FRAMESIZE32); if (copy_from_user(&sigctx, sc, sizeof(sigctx))) goto badframe; @@ -224,7 +225,7 @@ if (regs->msr & MSR_FP ) giveup_fpu(current); /* Last stacked signal - restore registers */ - sr = (struct sigregs32*)(u64)sigctx.regs; + sr = (struct sigregs32 __user *)(u64)sigctx.regs; /* * copy the 32 bit register values off the user stack * into the 32 bit register area @@ -294,7 +295,7 @@ /* * Set up a signal frame. */ -static void setup_frame32(struct pt_regs *regs, struct sigregs32 *frame, +static void setup_frame32(struct pt_regs *regs, struct sigregs32 __user *frame, unsigned int newsp) { struct sigcontext32 *sc = (struct sigcontext32 *)(u64)newsp; @@ -410,9 +411,9 @@ unsigned long r6, unsigned long r7, unsigned long r8, struct pt_regs * regs) { - struct rt_sigframe_32 *rt_sf; + struct rt_sigframe_32 __user *rt_sf; struct sigcontext32 sigctx; - struct sigregs32 *sr; + struct sigregs32 __user *sr; int ret; elf_gregset_t32 saved_regs; /* an array of 32 bit register values */ sigset_t set; @@ -421,11 +422,12 @@ mm_segment_t old_fs; /* Adjust the inputted reg1 to point to the first rt signal frame */ - rt_sf = (struct rt_sigframe_32 *)(regs->gpr[1] + __SIGNAL_FRAMESIZE32); + rt_sf = (struct rt_sigframe_32 __user *)(regs->gpr[1] + + __SIGNAL_FRAMESIZE32); /* Copy the information from the user stack */ if (copy_from_user(&sigctx, &rt_sf->uc.uc_mcontext, sizeof(sigctx)) || copy_from_user(&set, &rt_sf->uc.uc_sigmask, sizeof(set)) - || copy_from_user(&st,&rt_sf->uc.uc_stack, sizeof(st))) + || copy_from_user(&st, &rt_sf->uc.uc_stack, sizeof(st))) goto badframe; /* @@ -448,7 +450,7 @@ * Set to point to the next rt_sigframe - this is used to * determine whether this is the last signal to process */ - sr = (struct sigregs32 *)(u64)sigctx.regs; + sr = (struct sigregs32 __user *)(u64)sigctx.regs; if (copy_from_user(saved_regs, &sr->gp_regs, sizeof(sr->gp_regs))) goto badframe; /* @@ -509,8 +511,8 @@ -long sys32_rt_sigaction(int sig, const struct sigaction32 *act, - struct sigaction32 *oact, size_t sigsetsize) +long sys32_rt_sigaction(int sig, const struct sigaction32 __user *act, + struct sigaction32 __user *oact, size_t sigsetsize) { struct k_sigaction new_ka, old_ka; int ret; @@ -570,23 +572,23 @@ * of a signed int (msr in 32-bit mode) and the register representation * of a signed int (msr in 64-bit mode) is performed. */ -long sys32_rt_sigprocmask(u32 how, compat_sigset_t *set, - compat_sigset_t *oset, size_t sigsetsize) +long sys32_rt_sigprocmask(u32 how, compat_sigset_t __user *set, + compat_sigset_t __user *oset, size_t sigsetsize) { sigset_t s; - compat_sigset_t s32; + compat_sigset_t _s32; int ret; mm_segment_t old_fs = get_fs(); if (set) { - if (copy_from_user (&s32, set, sizeof(compat_sigset_t))) + if (copy_from_user (&_s32, set, sizeof(compat_sigset_t))) return -EFAULT; switch (_NSIG_WORDS) { - case 4: s.sig[3] = s32.sig[6] | (((long)s32.sig[7]) << 32); - case 3: s.sig[2] = s32.sig[4] | (((long)s32.sig[5]) << 32); - case 2: s.sig[1] = s32.sig[2] | (((long)s32.sig[3]) << 32); - case 1: s.sig[0] = s32.sig[0] | (((long)s32.sig[1]) << 32); + case 4: s.sig[3] = _s32.sig[6] | (((long)_s32.sig[7]) << 32); + case 3: s.sig[2] = _s32.sig[4] | (((long)_s32.sig[5]) << 32); + case 2: s.sig[1] = _s32.sig[2] | (((long)_s32.sig[3]) << 32); + case 1: s.sig[0] = _s32.sig[0] | (((long)_s32.sig[1]) << 32); } } @@ -598,21 +600,21 @@ return ret; if (oset) { switch (_NSIG_WORDS) { - case 4: s32.sig[7] = (s.sig[3] >> 32); s32.sig[6] = s.sig[3]; - case 3: s32.sig[5] = (s.sig[2] >> 32); s32.sig[4] = s.sig[2]; - case 2: s32.sig[3] = (s.sig[1] >> 32); s32.sig[2] = s.sig[1]; - case 1: s32.sig[1] = (s.sig[0] >> 32); s32.sig[0] = s.sig[0]; + case 4: _s32.sig[7] = (s.sig[3] >> 32); _s32.sig[6] = s.sig[3]; + case 3: _s32.sig[5] = (s.sig[2] >> 32); _s32.sig[4] = s.sig[2]; + case 2: _s32.sig[3] = (s.sig[1] >> 32); _s32.sig[2] = s.sig[1]; + case 1: _s32.sig[1] = (s.sig[0] >> 32); _s32.sig[0] = s.sig[0]; } - if (copy_to_user (oset, &s32, sizeof(compat_sigset_t))) + if (copy_to_user (oset, &_s32, sizeof(compat_sigset_t))) return -EFAULT; } return 0; } -long sys32_rt_sigpending(compat_sigset_t *set, compat_size_t sigsetsize) +long sys32_rt_sigpending(compat_sigset_t __user *set, compat_size_t sigsetsize) { sigset_t s; - compat_sigset_t s32; + compat_sigset_t _s32; int ret; mm_segment_t old_fs = get_fs(); @@ -621,19 +623,19 @@ set_fs(old_fs); if (!ret) { switch (_NSIG_WORDS) { - case 4: s32.sig[7] = (s.sig[3] >> 32); s32.sig[6] = s.sig[3]; - case 3: s32.sig[5] = (s.sig[2] >> 32); s32.sig[4] = s.sig[2]; - case 2: s32.sig[3] = (s.sig[1] >> 32); s32.sig[2] = s.sig[1]; - case 1: s32.sig[1] = (s.sig[0] >> 32); s32.sig[0] = s.sig[0]; + case 4: _s32.sig[7] = (s.sig[3] >> 32); _s32.sig[6] = s.sig[3]; + case 3: _s32.sig[5] = (s.sig[2] >> 32); _s32.sig[4] = s.sig[2]; + case 2: _s32.sig[3] = (s.sig[1] >> 32); _s32.sig[2] = s.sig[1]; + case 1: _s32.sig[1] = (s.sig[0] >> 32); _s32.sig[0] = s.sig[0]; } - if (copy_to_user (set, &s32, sizeof(compat_sigset_t))) + if (copy_to_user (set, &_s32, sizeof(compat_sigset_t))) return -EFAULT; } return ret; } -static int copy_siginfo_to_user32(siginfo_t32 *d, siginfo_t *s) +static int copy_siginfo_to_user32(siginfo_t32 __user *d, siginfo_t *s) { int err; @@ -675,23 +677,25 @@ return err; } -long sys32_rt_sigtimedwait(compat_sigset_t *uthese, siginfo_t32 *uinfo, - struct compat_timespec *uts, compat_size_t sigsetsize) +long sys32_rt_sigtimedwait(compat_sigset_t __user *uthese, + siginfo_t32 __user *uinfo, + struct compat_timespec __user *uts, + compat_size_t sigsetsize) { sigset_t s; - compat_sigset_t s32; + compat_sigset_t _s32; struct timespec t; int ret; mm_segment_t old_fs = get_fs(); siginfo_t info; - if (copy_from_user(&s32, uthese, sizeof(compat_sigset_t))) + if (copy_from_user(&_s32, uthese, sizeof(compat_sigset_t))) return -EFAULT; switch (_NSIG_WORDS) { - case 4: s.sig[3] = s32.sig[6] | (((long)s32.sig[7]) << 32); - case 3: s.sig[2] = s32.sig[4] | (((long)s32.sig[5]) << 32); - case 2: s.sig[1] = s32.sig[2] | (((long)s32.sig[3]) << 32); - case 1: s.sig[0] = s32.sig[0] | (((long)s32.sig[1]) << 32); + case 4: s.sig[3] = _s32.sig[6] | (((long)_s32.sig[7]) << 32); + case 3: s.sig[2] = _s32.sig[4] | (((long)_s32.sig[5]) << 32); + case 2: s.sig[1] = _s32.sig[2] | (((long)_s32.sig[3]) << 32); + case 1: s.sig[0] = _s32.sig[0] | (((long)_s32.sig[1]) << 32); } if (uts && get_compat_timespec(&t, uts)) return -EFAULT; @@ -752,7 +756,7 @@ * (msr in 32-bit mode) and the register representation of a signed int * (msr in 64-bit mode) is performed. */ -long sys32_rt_sigqueueinfo(u32 pid, u32 sig, siginfo_t32 *uinfo) +long sys32_rt_sigqueueinfo(u32 pid, u32 sig, siginfo_t32 __user *uinfo) { siginfo_t info; siginfo_t32 info32; @@ -770,17 +774,17 @@ return ret; } -int sys32_rt_sigsuspend(compat_sigset_t* unewset, size_t sigsetsize, int p3, - int p4, int p6, int p7, struct pt_regs *regs) +int sys32_rt_sigsuspend(compat_sigset_t __user *unewset, size_t sigsetsize, + int p3, int p4, int p6, int p7, struct pt_regs *regs) { sigset_t saveset, newset; - compat_sigset_t s32; + compat_sigset_t _s32; /* XXX: Don't preclude handling different sized sigset_t's. */ if (sigsetsize != sizeof(sigset_t)) return -EINVAL; - if (copy_from_user(&s32, unewset, sizeof(s32))) + if (copy_from_user(&_s32, unewset, sizeof(_s32))) return -EFAULT; /* @@ -788,10 +792,10 @@ * in the "wrong" endian in 32-bit user storage). */ switch (_NSIG_WORDS) { - case 4: newset.sig[3] = s32.sig[6] | (((long)s32.sig[7]) << 32); - case 3: newset.sig[2] = s32.sig[4] | (((long)s32.sig[5]) << 32); - case 2: newset.sig[1] = s32.sig[2] | (((long)s32.sig[3]) << 32); - case 1: newset.sig[0] = s32.sig[0] | (((long)s32.sig[1]) << 32); + case 4: newset.sig[3] = _s32.sig[6] | (((long)_s32.sig[7]) << 32); + case 3: newset.sig[2] = _s32.sig[4] | (((long)_s32.sig[5]) << 32); + case 2: newset.sig[1] = _s32.sig[2] | (((long)_s32.sig[3]) << 32); + case 1: newset.sig[0] = _s32.sig[0] | (((long)_s32.sig[1]) << 32); } sigdelsetmask(&newset, ~_BLOCKABLE); @@ -825,11 +829,12 @@ /* * Set up a rt signal frame. */ -static void setup_rt_frame32(struct pt_regs *regs, struct sigregs32 *frame, - unsigned int newsp) +static void setup_rt_frame32(struct pt_regs *regs, + struct sigregs32 __user *frame, unsigned int newsp) { unsigned int copyreg4, copyreg5; - struct rt_sigframe_32 * rt_sf = (struct rt_sigframe_32 *) (u64)newsp; + struct rt_sigframe_32 __user *rt_sf = + (struct rt_sigframe_32 __user *) (u64)newsp; int i; if (verify_area(VERIFY_WRITE, frame, sizeof(*frame))) @@ -891,7 +896,7 @@ newsp -= __SIGNAL_FRAMESIZE32; - if (put_user((u32)(regs->gpr[1]), (unsigned int *)(u64)newsp) + if (put_user((u32)(regs->gpr[1]), (unsigned int __user *)(u64)newsp) || get_user(regs->nip, &rt_sf->uc.uc_mcontext.handler) || get_user(regs->gpr[3], &rt_sf->uc.uc_mcontext.signal) || get_user(copyreg4, &rt_sf->pinfo) @@ -922,8 +927,8 @@ sigset_t *oldset, struct pt_regs * regs, unsigned int *newspp, unsigned int frame) { - struct sigcontext32 *sc; - struct rt_sigframe_32 *rt_sf; + struct sigcontext32 __user *sc; + struct rt_sigframe_32 __user *rt_sf; struct k_sigaction *ka = ¤t->sighand->action[sig-1]; if (regs->trap == 0x0C00 /* System Call! */ @@ -943,7 +948,7 @@ */ if (ka->sa.sa_flags & SA_SIGINFO) { *newspp -= sizeof(*rt_sf); - rt_sf = (struct rt_sigframe_32 *)(u64)(*newspp); + rt_sf = (struct rt_sigframe_32 __user *)(u64)(*newspp); if (verify_area(VERIFY_WRITE, rt_sf, sizeof(*rt_sf))) goto badframe; if (__put_user((u32)(u64)ka->sa.sa_handler, @@ -969,7 +974,7 @@ } else { /* Put a sigcontext on the stack */ *newspp -= sizeof(*sc); - sc = (struct sigcontext32 *)(u64)*newspp; + sc = (struct sigcontext32 __user *)(u64)*newspp; if (verify_area(VERIFY_WRITE, sc, sizeof(*sc))) goto badframe; /* @@ -1016,7 +1021,7 @@ int sys32_sigaltstack(u32 newstack, u32 oldstack, int p3, int p4, int p6, int p7, struct pt_regs *regs) { - stack_t uss, uoss; + stack_t __user uss, uoss; int ret; mm_segment_t old_fs; unsigned long sp; @@ -1030,7 +1035,7 @@ /* Put new stack info in local 64 bit stack struct */ if (newstack && (get_user((long)uss.ss_sp, - &((stack_32_t *)(long)newstack)->ss_sp) || + &((stack_32_t __user *)(long)newstack)->ss_sp) || __get_user(uss.ss_flags, &((stack_32_t *)(long)newstack)->ss_flags) || __get_user(uss.ss_size, @@ -1045,7 +1050,7 @@ /* Copy the stack information to the user output buffer */ if (!ret && oldstack && (put_user((long)uoss.ss_sp, - &((stack_32_t *)(long)oldstack)->ss_sp) || + &((stack_32_t __user *)(long)oldstack)->ss_sp) || __put_user(uoss.ss_flags, &((stack_32_t *)(long)oldstack)->ss_flags) || __put_user(uoss.ss_size, @@ -1116,8 +1121,10 @@ /* Invoke correct stack setup routine */ if (ka->sa.sa_flags & SA_SIGINFO) - setup_rt_frame32(regs, (struct sigregs32*)(u64)frame, newsp); + setup_rt_frame32(regs, (struct sigregs32 __user *)(u64)frame, + newsp); else - setup_frame32(regs, (struct sigregs32*)(u64)frame, newsp); + setup_frame32(regs, (struct sigregs32 __user *)(u64)frame, + newsp); return 1; } ===== fs/compat.c 1.10 vs edited ===== --- 1.10/fs/compat.c Mon May 26 16:19:40 2003 +++ edited/fs/compat.c Sat Jun 21 00:29:18 2003 @@ -39,7 +39,8 @@ * Not all architectures have sys_utime, so implement this in terms * of sys_utimes. */ -asmlinkage long compat_sys_utime(char *filename, struct compat_utimbuf *t) +asmlinkage long compat_sys_utime(char __user *filename, + struct compat_utimbuf __user *t) { struct timeval tv[2]; @@ -54,8 +55,8 @@ } -asmlinkage long compat_sys_newstat(char * filename, - struct compat_stat *statbuf) +asmlinkage long compat_sys_newstat(char __user *filename, + struct compat_stat __user *statbuf) { struct kstat stat; int error = vfs_stat(filename, &stat); @@ -65,8 +66,8 @@ return error; } -asmlinkage long compat_sys_newlstat(char * filename, - struct compat_stat *statbuf) +asmlinkage long compat_sys_newlstat(char __user *filename, + struct compat_stat __user *statbuf) { struct kstat stat; int error = vfs_lstat(filename, &stat); @@ -77,7 +78,7 @@ } asmlinkage long compat_sys_newfstat(unsigned int fd, - struct compat_stat * statbuf) + struct compat_stat __user *statbuf) { struct kstat stat; int error = vfs_fstat(fd, &stat); @@ -87,7 +88,8 @@ return error; } -static int put_compat_statfs(struct compat_statfs *ubuf, struct statfs *kbuf) +static int put_compat_statfs(struct compat_statfs __user *ubuf, + struct statfs *kbuf) { if (verify_area(VERIFY_WRITE, ubuf, sizeof(*ubuf)) || __put_user(kbuf->f_type, &ubuf->f_type) || @@ -108,7 +110,8 @@ * The following statfs calls are copies of code from fs/open.c and * should be checked against those from time to time */ -asmlinkage long compat_sys_statfs(const char *path, struct compat_statfs *buf) +asmlinkage long compat_sys_statfs(const char __user *path, + struct compat_statfs __user *buf) { struct nameidata nd; int error; @@ -124,7 +127,8 @@ return error; } -asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs *buf) +asmlinkage long compat_sys_fstatfs(unsigned int fd, + struct compat_statfs __user *buf) { struct file * file; struct statfs tmp; ===== include/asm-ppc64/cputable.h 1.1 vs edited ===== --- 1.1/include/asm-ppc64/cputable.h Sat Jun 7 18:20:51 2003 +++ edited/include/asm-ppc64/cputable.h Fri Jun 20 17:56:50 2003 @@ -108,11 +108,11 @@ #define CPU_FTR_DUAL_PLL_750FX 0x0000000000004000 /* Add the 64b processor unique features in the top half of the word */ -#define CPU_FTR_SLB 0x0000000100000000 -#define CPU_FTR_16M_PAGE 0x0000000200000000 -#define CPU_FTR_TLBIEL 0x0000000400000000 -#define CPU_FTR_NOEXECUTE 0x0000000800000000 -#define CPU_FTR_NODSISRALIGN 0x0000001000000000 +#define CPU_FTR_SLB 0x0000000100000000UL +#define CPU_FTR_16M_PAGE 0x0000000200000000UL +#define CPU_FTR_TLBIEL 0x0000000400000000UL +#define CPU_FTR_NOEXECUTE 0x0000000800000000UL +#define CPU_FTR_NODSISRALIGN 0x0000001000000000UL /* Platform firmware features */ #define FW_FTR_ 0x0000000000000001 ===== include/asm-ppc64/eeh.h 1.4 vs edited ===== --- 1.4/include/asm-ppc64/eeh.h Sat Dec 7 18:04:33 2002 +++ edited/include/asm-ppc64/eeh.h Mon Jun 23 15:58:34 2003 @@ -65,9 +65,6 @@ */ unsigned long eeh_token_to_phys(unsigned long token); -extern void *memcpy(void *, const void *, unsigned long); -extern void *memset(void *,int, unsigned long); - /* EEH_POSSIBLE_ERROR() -- test for possible MMIO failure. * * Order this macro for performance. @@ -166,7 +163,7 @@ static inline void eeh_outb(u8 val, unsigned long port) { if (!_IO_IS_ISA(port) || _IO_HAS_ISA_BUS) - return out_8((u8 *)(port+pci_io_base), val); + out_8((u8 *)(port+pci_io_base), val); } static inline u16 eeh_inw(unsigned long port) { @@ -181,7 +178,7 @@ static inline void eeh_outw(u16 val, unsigned long port) { if (!_IO_IS_ISA(port) || _IO_HAS_ISA_BUS) - return out_le16((u16 *)(port+pci_io_base), val); + out_le16((u16 *)(port+pci_io_base), val); } static inline u32 eeh_inl(unsigned long port) { @@ -196,7 +193,7 @@ static inline void eeh_outl(u32 val, unsigned long port) { if (!_IO_IS_ISA(port) || _IO_HAS_ISA_BUS) - return out_le32((u32 *)(port+pci_io_base), val); + out_le32((u32 *)(port+pci_io_base), val); } #endif /* _EEH_H */ ===== include/asm-ppc64/mmu.h 1.7 vs edited ===== --- 1.7/include/asm-ppc64/mmu.h Wed Mar 26 15:30:59 2003 +++ edited/include/asm-ppc64/mmu.h Sat Jun 21 19:06:11 2003 @@ -193,7 +193,7 @@ page = vpn & 0xffff; } - return (vsid & 0x7fffffffff) ^ page; + return (vsid & 0x7fffffffffUL) ^ page; } static inline void _tlbie(unsigned long va, int large) ===== include/asm-ppc64/mmu_context.h 1.4 vs edited ===== --- 1.4/include/asm-ppc64/mmu_context.h Fri Jan 10 18:21:00 2003 +++ edited/include/asm-ppc64/mmu_context.h Fri Jun 20 17:16:52 2003 @@ -155,8 +155,8 @@ #define activate_mm(active_mm, mm) \ switch_mm(active_mm, mm, current, smp_processor_id()); -#define VSID_RANDOMIZER 42470972311 -#define VSID_MASK 0xfffffffff +#define VSID_RANDOMIZER 42470972311UL +#define VSID_MASK 0xfffffffffUL /* This is only valid for kernel (including vmalloc, imalloc and bolted) EA's ===== include/asm-ppc64/paca.h 1.8 vs edited ===== --- 1.8/include/asm-ppc64/paca.h Wed May 21 06:11:13 2003 +++ edited/include/asm-ppc64/paca.h Sat Jun 21 18:32:17 2003 @@ -34,7 +34,11 @@ #include extern struct paca_struct paca[]; +#ifdef __CHECKER__ +#define local_paca ((struct paca_struct *)NULL) +#else register struct paca_struct *local_paca asm("r13"); +#endif #define get_paca() local_paca /*============================================================================ ===== include/asm-ppc64/page.h 1.19 vs edited ===== --- 1.19/include/asm-ppc64/page.h Wed Mar 26 15:30:59 2003 +++ edited/include/asm-ppc64/page.h Sat Jun 21 19:08:17 2003 @@ -23,7 +23,7 @@ #define PAGE_OFFSET_MASK (PAGE_SIZE-1) #define SID_SHIFT 28 -#define SID_MASK 0xfffffffff +#define SID_MASK 0xfffffffffUL #define GET_ESID(x) (((x) >> SID_SHIFT) & SID_MASK) /* align addr on a size boundary - adjust address up/down if needed */ @@ -145,11 +145,15 @@ /* KERNELBASE is defined for performance reasons. */ /* When KERNELBASE moves, those macros may have */ /* to change! */ +#ifdef __ASSEMBLY__ #define PAGE_OFFSET 0xC000000000000000 +#else +#define PAGE_OFFSET 0xC000000000000000UL +#endif #define KERNELBASE PAGE_OFFSET -#define VMALLOCBASE 0xD000000000000000 -#define IOREGIONBASE 0xE000000000000000 -#define EEHREGIONBASE 0xA000000000000000 +#define VMALLOCBASE 0xD000000000000000UL +#define IOREGIONBASE 0xE000000000000000UL +#define EEHREGIONBASE 0xA000000000000000UL #define IO_REGION_ID (IOREGIONBASE>>REGION_SHIFT) #define EEH_REGION_ID (EEHREGIONBASE>>REGION_SHIFT) ===== include/asm-ppc64/pgtable.h 1.23 vs edited ===== --- 1.23/include/asm-ppc64/pgtable.h Wed Jun 11 16:33:17 2003 +++ edited/include/asm-ppc64/pgtable.h Fri Jun 20 18:31:32 2003 @@ -44,7 +44,7 @@ /* * Define the address range of the vmalloc VM area. */ -#define VMALLOC_START (0xD000000000000000) +#define VMALLOC_START (0xD000000000000000UL) #define VMALLOC_VMADDR(x) ((unsigned long)(x)) #define VMALLOC_END (VMALLOC_START + VALID_EA_BITS) @@ -54,7 +54,7 @@ */ #define IMALLOC_START (ioremap_bot) #define IMALLOC_VMADDR(x) ((unsigned long)(x)) -#define IMALLOC_BASE (0xE000000000000000) +#define IMALLOC_BASE (0xE000000000000000UL) #define IMALLOC_END (IMALLOC_BASE + VALID_EA_BITS) /* ===== include/asm-ppc64/processor.h 1.30 vs edited ===== --- 1.30/include/asm-ppc64/processor.h Sat Jun 7 11:19:27 2003 +++ edited/include/asm-ppc64/processor.h Fri Jun 20 18:15:26 2003 @@ -502,21 +502,21 @@ /* * Begining of traceback info work for asm functions. */ -#define TB_ASM 0x000C000000000000 -#define TB_GLOBALLINK 0x0000800000000000 -#define TB_IS_EPROL 0x0000400000000000 -#define TB_HAS_TBOFF 0x0000200000000000 -#define TB_INT_PROC 0x0000100000000000 -#define TB_HAS_CTL 0x0000080000000000 -#define TB_TOCLESS 0x0000040000000000 -#define TB_FP_PRESENT 0x0000020000000000 -#define TB_LOG_ABORT 0x0000010000000000 -#define TB_INT_HNDL 0x0000008000000000 -#define TB_NAME_PRESENT 0x0000004000000000 -#define TB_SAVES_CR 0x0000000200000000 -#define TB_SAVES_LR 0x0000000100000000 -#define TB_STORES_BC 0x0000000080000000 -#define TB_PARMINFO 0x000000000000FFFF +#define TB_ASM 0x000C000000000000UL +#define TB_GLOBALLINK 0x0000800000000000UL +#define TB_IS_EPROL 0x0000400000000000UL +#define TB_HAS_TBOFF 0x0000200000000000UL +#define TB_INT_PROC 0x0000100000000000UL +#define TB_HAS_CTL 0x0000080000000000UL +#define TB_TOCLESS 0x0000040000000000UL +#define TB_FP_PRESENT 0x0000020000000000UL +#define TB_LOG_ABORT 0x0000010000000000UL +#define TB_INT_HNDL 0x0000008000000000UL +#define TB_NAME_PRESENT 0x0000004000000000UL +#define TB_SAVES_CR 0x0000000200000000UL +#define TB_SAVES_LR 0x0000000100000000UL +#define TB_STORES_BC 0x0000000080000000UL +#define TB_PARMINFO 0x000000000000FFFFUL #define TB_DEFAULT TB_ASM | TB_HAS_TBOFF | TB_NAME_PRESENT #ifdef __ASSEMBLY__ ===== include/asm-ppc64/signal.h 1.6 vs edited ===== --- 1.6/include/asm-ppc64/signal.h Wed May 28 08:36:24 2003 +++ edited/include/asm-ppc64/signal.h Sat Jun 21 00:22:19 2003 @@ -148,12 +148,14 @@ struct timespec; extern int do_signal(sigset_t *oldset, struct pt_regs *regs); extern int do_signal32(sigset_t *oldset, struct pt_regs *regs); -extern long sys_rt_sigprocmask(int how, sigset_t *set, sigset_t *oset, - size_t sigsetsize); -extern long sys_rt_sigpending(sigset_t *set, size_t sigsetsize); -extern long sys_rt_sigtimedwait(const sigset_t *uthese, siginfo_t *uinfo, - const struct timespec *uts, size_t sigsetsize); -extern long sys_rt_sigqueueinfo(int pid, int sig, siginfo_t *uinfo); +extern long sys_rt_sigprocmask(int how, sigset_t __user *set, + sigset_t __user *oset, size_t sigsetsize); +extern long sys_rt_sigpending(sigset_t __user *set, size_t sigsetsize); +extern long sys_rt_sigtimedwait(const sigset_t __user *uthese, + siginfo_t __user *uinfo, + const struct timespec __user *uts, + size_t sigsetsize); +extern long sys_rt_sigqueueinfo(int pid, int sig, siginfo_t __user *uinfo); #define ptrace_signal_deliver(regs, cookie) do { } while (0) struct pt_regs; ===== include/asm-ppc64/thread_info.h 1.8 vs edited ===== --- 1.8/include/asm-ppc64/thread_info.h Wed Jun 4 23:42:25 2003 +++ edited/include/asm-ppc64/thread_info.h Fri Jun 20 16:46:36 2003 @@ -58,10 +58,6 @@ #define get_thread_info(ti) get_task_struct((ti)->task) #define put_thread_info(ti) put_task_struct((ti)->task) -#if THREAD_SIZE != (4*PAGE_SIZE) -#error update vmlinux.lds and current_thread_info to match -#endif - /* how to get the thread information struct from C */ static inline struct thread_info *current_thread_info(void) { ===== include/asm-ppc64/uaccess.h 1.10 vs edited ===== --- 1.10/include/asm-ppc64/uaccess.h Sat Jun 21 18:09:48 2003 +++ edited/include/asm-ppc64/uaccess.h Sat Jun 21 18:11:47 2003 @@ -56,7 +56,7 @@ #define access_ok(type,addr,size) \ __access_ok(((unsigned long)(addr)),(size),get_fs()) -static inline int verify_area(int type, const void *addr, unsigned long size) +static inline int verify_area(int type, const void __user *addr, unsigned long size) { return access_ok(type,addr,size) ? 0 : -EFAULT; } @@ -213,7 +213,8 @@ /* more complex routines */ -extern unsigned long __copy_tofrom_user(void *to, const void *from, +extern unsigned long __copy_tofrom_user(void __user *to, + const void __user *from, unsigned long size); /* XXX should zero destination if fault happened */ @@ -238,7 +239,7 @@ return ret; } } - return __copy_tofrom_user(to, from, n); + return __copy_tofrom_user((void __user *)to, from, n); } static inline unsigned long @@ -262,14 +263,14 @@ return ret; } } - return __copy_tofrom_user(to, from, n); + return __copy_tofrom_user(to, (void __user *)from, n); } #define __copy_in_user(to, from, size) \ __copy_tofrom_user((to), (from), (size)) static inline unsigned long -copy_from_user(void *to, const void *from, unsigned long n) +copy_from_user(void *to, const void __user *from, unsigned long n) { if (likely(access_ok(VERIFY_READ, from, n))) n = __copy_from_user(to, from, n); @@ -277,7 +278,7 @@ } static inline unsigned long -copy_to_user(void *to, const void *from, unsigned long n) +copy_to_user(void __user *to, const void *from, unsigned long n) { if (likely(access_ok(VERIFY_WRITE, to, n))) n = __copy_to_user(to, from, n); @@ -285,7 +286,7 @@ } static inline unsigned long -copy_in_user(void *to, const void *from, unsigned long n) +copy_in_user(void __user *to, const void __user *from, unsigned long n) { if (likely(access_ok(VERIFY_READ, from, n) && access_ok(VERIFY_WRITE, to, n))) @@ -293,20 +294,20 @@ return n; } -extern unsigned long __clear_user(void *addr, unsigned long size); +extern unsigned long __clear_user(void __user *addr, unsigned long size); static inline unsigned long -clear_user(void *addr, unsigned long size) +clear_user(void __user *addr, unsigned long size) { if (likely(access_ok(VERIFY_WRITE, addr, size))) size = __clear_user(addr, size); return size; } -extern int __strncpy_from_user(char *dst, const char *src, long count); +extern int __strncpy_from_user(char *dst, const char __user *src, long count); static inline long -strncpy_from_user(char *dst, const char *src, long count) +strncpy_from_user(char *dst, const char __user *src, long count) { if (likely(access_ok(VERIFY_READ, src, 1))) return __strncpy_from_user(dst, src, count); @@ -318,14 +319,14 @@ * * Return 0 for error */ -extern int __strnlen_user(const char *str, long len); +extern int __strnlen_user(const char __user *str, long len); /* * Returns the length of the string at str (including the null byte), * or 0 if we hit a page we can't access, * or something > len if we didn't find a null byte. */ -static inline int strnlen_user(const char *str, long len) +static inline int strnlen_user(const char __user *str, long len) { if (likely(access_ok(VERIFY_READ, str, 1))) return __strnlen_user(str, len); ===== include/asm-ppc64/iSeries/HvCallSc.h 1.2 vs edited ===== --- 1.2/include/asm-ppc64/iSeries/HvCallSc.h Sun Jun 9 19:59:38 2002 +++ edited/include/asm-ppc64/iSeries/HvCallSc.h Fri Jun 20 16:09:15 2003 @@ -24,14 +24,14 @@ #ifndef _HVCALLSC_H #define _HVCALLSC_H -#define HvCallBase 0x8000000000000000 -#define HvCallCc 0x8001000000000000 -#define HvCallCfg 0x8002000000000000 -#define HvCallEvent 0x8003000000000000 -#define HvCallHpt 0x8004000000000000 -#define HvCallPci 0x8005000000000000 -#define HvCallSm 0x8007000000000000 -#define HvCallXm 0x8009000000000000 +#define HvCallBase 0x8000000000000000UL +#define HvCallCc 0x8001000000000000UL +#define HvCallCfg 0x8002000000000000UL +#define HvCallEvent 0x8003000000000000UL +#define HvCallHpt 0x8004000000000000UL +#define HvCallPci 0x8005000000000000UL +#define HvCallSm 0x8007000000000000UL +#define HvCallXm 0x8009000000000000UL u64 HvCall0( u64 ); u64 HvCall1( u64, u64 ); ===== include/linux/bitops.h 1.4 vs edited ===== --- 1.4/include/linux/bitops.h Fri Jun 6 16:37:30 2003 +++ edited/include/linux/bitops.h Wed Jun 18 21:03:23 2003 @@ -115,12 +115,12 @@ generic_hweight32((unsigned int)w); #else u64 res; - res = (w & 0x5555555555555555) + ((w >> 1) & 0x5555555555555555); - res = (res & 0x3333333333333333) + ((res >> 2) & 0x3333333333333333); - res = (res & 0x0F0F0F0F0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F0F0F0F0F); - res = (res & 0x00FF00FF00FF00FF) + ((res >> 8) & 0x00FF00FF00FF00FF); - res = (res & 0x0000FFFF0000FFFF) + ((res >> 16) & 0x0000FFFF0000FFFF); - return (res & 0x00000000FFFFFFFF) + ((res >> 32) & 0x00000000FFFFFFFF); + res = (w & 0x5555555555555555UL) + ((w >> 1) & 0x5555555555555555UL); + res = (res & 0x3333333333333333UL) + ((res >> 2) & 0x3333333333333333UL); + res = (res & 0x0F0F0F0F0F0F0F0FUL) + ((res >> 4) & 0x0F0F0F0F0F0F0F0FUL); + res = (res & 0x00FF00FF00FF00FFUL) + ((res >> 8) & 0x00FF00FF00FF00FFUL); + res = (res & 0x0000FFFF0000FFFFUL) + ((res >> 16) & 0x0000FFFF0000FFFFUL); + return (res & 0x00000000FFFFFFFFUL) + ((res >> 32) & 0x00000000FFFFFFFFUL); #endif } ===== include/linux/compat.h 1.11 vs edited ===== --- 1.11/include/linux/compat.h Wed Apr 16 15:48:21 2003 +++ edited/include/linux/compat.h Sat Jun 21 00:41:39 2003 @@ -38,9 +38,11 @@ compat_sigset_word sig[_COMPAT_NSIG_WORDS]; } compat_sigset_t; -extern int cp_compat_stat(struct kstat *, struct compat_stat *); -extern int get_compat_timespec(struct timespec *, struct compat_timespec *); -extern int put_compat_timespec(struct timespec *, struct compat_timespec *); +extern int cp_compat_stat(struct kstat *, struct compat_stat __user *); +extern int get_compat_timespec(struct timespec *, + struct compat_timespec __user *); +extern int put_compat_timespec(struct timespec *, + struct compat_timespec __user *); struct compat_iovec { compat_uptr_t iov_base; ===== kernel/compat.c 1.17 vs edited ===== --- 1.17/kernel/compat.c Tue Jun 17 22:37:03 2003 +++ edited/kernel/compat.c Sat Jun 21 00:33:04 2003 @@ -22,14 +22,14 @@ #include -int get_compat_timespec(struct timespec *ts, struct compat_timespec *cts) +int get_compat_timespec(struct timespec *ts, struct compat_timespec __user *cts) { return (verify_area(VERIFY_READ, cts, sizeof(*cts)) || __get_user(ts->tv_sec, &cts->tv_sec) || __get_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0; } -int put_compat_timespec(struct timespec *ts, struct compat_timespec *cts) +int put_compat_timespec(struct timespec *ts, struct compat_timespec __user *cts) { return (verify_area(VERIFY_WRITE, cts, sizeof(*cts)) || __put_user(ts->tv_sec, &cts->tv_sec) || @@ -39,7 +39,7 @@ static long compat_nanosleep_restart(struct restart_block *restart) { unsigned long expire = restart->arg0, now = jiffies; - struct compat_timespec *rmtp; + struct compat_timespec __user *rmtp; /* Did it expire while we handled signals? */ if (!time_after(expire, now)) @@ -50,7 +50,7 @@ if (expire == 0) return 0; - rmtp = (struct compat_timespec *)restart->arg1; + rmtp = (struct compat_timespec __user *)restart->arg1; if (rmtp) { struct compat_timespec ct; struct timespec t; @@ -65,8 +65,8 @@ return -ERESTART_RESTARTBLOCK; } -asmlinkage long compat_sys_nanosleep(struct compat_timespec *rqtp, - struct compat_timespec *rmtp) +asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp, + struct compat_timespec __user *rmtp) { struct timespec t; struct restart_block *restart; @@ -151,7 +151,7 @@ return 0; } -asmlinkage long compat_sys_times(struct compat_tms *tbuf) +asmlinkage long compat_sys_times(struct compat_tms __user *tbuf) { /* * In the SMP world we might just be unlucky and have one of @@ -214,7 +214,7 @@ #ifdef CONFIG_FUTEX asmlinkage long compat_sys_futex(u32 *uaddr, int op, int val, - struct compat_timespec *utime, u32 *uaddr2) + struct compat_timespec __user *utime, u32 *uaddr2) { struct timespec t; unsigned long timeout = MAX_SCHEDULE_TIMEOUT; ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From benh at kernel.crashing.org Mon May 3 13:43:59 2004 From: benh at kernel.crashing.org (Benjamin Herrenschmidt) Date: Mon, 03 May 2004 13:43:59 +1000 Subject: "sparse" warnings.. In-Reply-To: <1083553538.20473.240.camel@gaston> References: <20040422105836.0ac99736.sfr@canb.auug.org.au> <1083553538.20473.240.camel@gaston> Message-ID: <1083555838.20473.246.camel@gaston> > Well, do you want to explicitely write it with ULL suffix ? Of course I meant UL, this one was a real typo ;) Ben ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From torvalds at osdl.org Mon May 3 14:24:58 2004 From: torvalds at osdl.org (Linus Torvalds) Date: Sun, 2 May 2004 21:24:58 -0700 (PDT) Subject: "sparse" warnings.. In-Reply-To: <1083553538.20473.240.camel@gaston> References: <20040422105836.0ac99736.sfr@canb.auug.org.au> <1083553538.20473.240.camel@gaston> Message-ID: On Mon, 3 May 2004, Benjamin Herrenschmidt wrote: > > > > #define PAGE_OFFSET 0xC000000000000000 > > > > which silently makes the constant be of type "unsigned long" through the C > > type expansion rules. Sparse doesn't like that, because most people don't > > actually understand the C type expansion rules. > > Well, do you want to explicitely write it with ULL suffix ? Preferably yes ("ul", though). It doesn't always work, because some of the constants are shared with assembly language, and the assembler doesn't understand C constants and refuses to touch them.. And the regular Linux sources aren't sparse-clean anyway. A lot of the networking in particular uses the same structures to keep either user pointers or kernel pointers, and so the static type-checking of sparse really can't handle them. So don't expect the kernel to come out without warnings. But right now the ppc64 build gets a _lot_ more warnings than x86 does. > > Quiz: what's the difference between > > > > #define MIN_INT 0x80000000 > > #define MIN_INT 2147483648 > > > > in C for a 64-bit compiler? Hint: one is "unsigned int", the other is > > "long". > > First one gets zero extended, second one gets sign extended I suppose, > this first on is bogus. Literally, try "sizeof()". The first one will be 4 bytes, the second one is 8 bytes. It results in some "interesting" results: if you compare against "-1", then the first one will compare _smaller_ than -1, while the second one will compare bigger. Really. Try it on a 64-bit compiler with a 32-bit "int". (in the first case, the -1 will be converted to "unsigned int", and it will compare as 0x80000000u < 0xffffffffu). You'll get other differences too. Try shifting them left by one. One becomes zero, the other becomes 1L << 32. Even though they are the _exact_ same constant, just written differently. The C language is strange sometimes. Of course, in 99.9% of all cases, you'll never see anything strange, so I'm not sure that the warning is worth it. I got rid of it on x86, though, and in general it's a fairly easy warning to take care of (and once gone, it's easy to avoid). On the whole I think it's a good thing to warn about when the type of a constant is silently converted in C, but I have to admit that it's a fairly anal warning. Others will think it's a stupid warning. > Where do I get sparse ? There's a bk ? FAQ ? There's a BK repo at sparse.bkbits.net (and one on kernel.org in /pub/software/devel). The current one assumes that you pass in "-m64" to it if you want to check 64-bit sources. Linus ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From torvalds at osdl.org Mon May 3 14:30:29 2004 From: torvalds at osdl.org (Linus Torvalds) Date: Sun, 2 May 2004 21:30:29 -0700 (PDT) Subject: "sparse" warnings.. In-Reply-To: <20040503033604.GB11130@krispykreme> References: <20040422105836.0ac99736.sfr@canb.auug.org.au> <20040503033604.GB11130@krispykreme> Message-ID: On Mon, 3 May 2004, Anton Blanchard wrote: > > Cool. I had a play with sparse on ppc64 when I got bored on a plane > once. Ive attached what I had back then but it will probably be a big > mess of rejects these days. Well, also I've fixed up sparse a lot since you apparently ran it, and I see that some of your fixes are actually fixing sparse problems, not problems in the source. At least the ones I reacted to should be fixed now (ie sparse didn't use to like having variable names that aliased typedef names, so you renamed things like "s32" to "_s32". That shouldn't be necessary, and in general I hate to "fix" kernel stuff that is due to sparse bugs. I'd rather fix sparse instead). I haven't been developing sparse seriously for the last few months, but if you find a case where it complains about valid C code where the complaint is just nonsensical, feel free to just send a bug-report on it. I do end up keeping it up-to-date. Linus ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From linas at austin.ibm.com Tue May 4 03:34:27 2004 From: linas at austin.ibm.com (linas at austin.ibm.com) Date: Mon, 3 May 2004 12:34:27 -0500 Subject: "sparse" warnings.. In-Reply-To: ; from torvalds@osdl.org on Sun, May 02, 2004 at 09:24:58PM -0700 References: <20040422105836.0ac99736.sfr@canb.auug.org.au> <1083553538.20473.240.camel@gaston> Message-ID: <20040503123427.A30266@forte.austin.ibm.com> On Sun, May 02, 2004 at 09:24:58PM -0700, Linus Torvalds wrote: > > Of course, in 99.9% of all cases, you'll never see anything strange, so About a year ago, we fixed some real-live bugs due to comparisons to "-1" done on unsigned quantities. The original, buggy code looked like this: inline u16 thingy (void) { ... if() return ~0; ... } if (thingy() == ~0) { ...} The compare would fail ... the fix was to cast the const: if (thingy() == (u16) ~0) { ...} I don't know if 'sparse' checks for this, but if it doesn't, it would be nice if it did. (Personally, I dislike ~0, but that's a different matter). --linas ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From torvalds at osdl.org Tue May 4 04:04:35 2004 From: torvalds at osdl.org (Linus Torvalds) Date: Mon, 3 May 2004 11:04:35 -0700 (PDT) Subject: "sparse" warnings.. In-Reply-To: <20040503123427.A30266@forte.austin.ibm.com> References: <20040422105836.0ac99736.sfr@canb.auug.org.au> <1083553538.20473.240.camel@gaston> <20040503123427.A30266@forte.austin.ibm.com> Message-ID: On Mon, 3 May 2004 linas at austin.ibm.com wrote: > > About a year ago, we fixed some real-live bugs due to comparisons to > "-1" done on unsigned quantities. That's a separate issue, since there the issue is not the implicit conversion of the constant itself, but the implicit integer conversion that happens in any integer expressions. The particular example you cite can be (fairly trivially) caught by a warning that checks whether a particular constant comparison can ever be true or not, and in fact gcc will warn about this in at least some incarnations ("comparison can never be true due to limited type" or similar). So while I might add that warning to sparse, I don't have any huge incentives simply because it already exists as a "regular C" warning. (It might happen, just because I do actually want the sparse front-end to be usable for a real back-end too, if only for testing coverage reasons). > if (thingy() == (u16) ~0) { ...} > > I don't know if 'sparse' checks for this, but if it doesn't, it would > be nice if it did. (Personally, I dislike ~0, but that's a different > matter). One thing I've been considering adding is a "no-implicit-cast" attribute, which would make it a warning if such a type is ever implicitly cast to another type. That _would_ warn about things like the above, ie it would have warned about "thingy()" being implicitly promoted to an "int" for the comparison. But I'm not sure how useful such an attribute would be. Linus ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From johnrose at austin.ibm.com Tue May 4 06:11:01 2004 From: johnrose at austin.ibm.com (John Rose) Date: Mon, 03 May 2004 15:11:01 -0500 Subject: [PATCH] 2.6 rtas_flash_init() typo Message-ID: <1083615061.27080.20.camel@verve.austin.ibm.com> Hi Anton- Please apply the following, which fixes a typo that prevents the creation of the manage_flash /proc file. Thanks- John diff -urpN sles9-vanilla/arch/ppc64/kernel/rtas_flash.c sles9-new/arch/ppc64/kernel/rtas_flash.c --- sles9-vanilla/arch/ppc64/kernel/rtas_flash.c 2021-04-27 18:56:14.000000000 -0500 +++ sles9-new/arch/ppc64/kernel/rtas_flash.c 2021-04-27 18:53:54.000000000 -0500 @@ -692,7 +692,7 @@ int __init rtas_flash_init(void) if (rc != 0) goto cleanup; - manage_pde = create_flash_pde("ppc64/rtas" MANAGE_FLASH_NAME, + manage_pde = create_flash_pde("ppc64/rtas/" MANAGE_FLASH_NAME, &manage_flash_operations); if (manage_pde == NULL) { rc = -ENOMEM; ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From linas at austin.ibm.com Tue May 4 09:14:39 2004 From: linas at austin.ibm.com (linas at austin.ibm.com) Date: Mon, 3 May 2004 18:14:39 -0500 Subject: "sparse" warnings.. In-Reply-To: ; from torvalds@osdl.org on Mon, May 03, 2004 at 11:04:35AM -0700 References: <20040422105836.0ac99736.sfr@canb.auug.org.au> <1083553538.20473.240.camel@gaston> <20040503123427.A30266@forte.austin.ibm.com> Message-ID: <20040503181439.B30266@forte.austin.ibm.com> On Mon, May 03, 2004 at 11:04:35AM -0700, Linus Torvalds wrote: > > > About a year ago, we fixed some real-live bugs due to comparisons to > > "-1" done on unsigned quantities. > > in fact gcc will warn about this in at least some > incarnations ("comparison can never be true due to limited type" or Indeed, the current gcc's do catch this; too bad that wasn't the case a year ago ... > similar). So while I might add that warning to sparse, I don't have any > huge incentives simply because it already exists as a "regular C" > warning. Hmm, well, then, ideally, then, it would be best if gcc could find all of the 'regular' C (and cpp) syntax confusions on its own; while something like 'sparse' concentrated on kernel-only issues (whatever those may be?) > One thing I've been considering adding is a "no-implicit-cast" attribute, > which would make it a warning if such a type is ever implicitly cast to > another type. That _would_ warn about things like the above, ie it would > have warned about "thingy()" being implicitly promoted to an "int" for the > comparison. > > But I'm not sure how useful such an attribute would be. The only thing I can think of that's even vaguely like this is taking a bitflag, say a short, having one of the bit-fields map to the sign-bit, and then accidentally (implicitly) sign-extending it and getting unexpected results. e.g. #define ENABLE_X 1<<15 short mybits = 0; mybits |= ENABLE_X; long device_word; device_word = 0x300000 | mybits; You can call this 'bad programming style', but the none-the-less, the result is surprising, because the error doesn't occur if ENABLE_X was any other bit. ... and yes, once upon a time, something somewhere in the kernel once did this, I forget what or where. The only other thing of note is that many application programs do really scary things with the casting of function pointers (usually to do OO style programming in C, w/ upcasts/downcasts to change the type of the arguments passed to a routine, or add additional arguments.) I don't know that the kernel does this anywhere, though. Maybe in that kobject code :) --linas p.s. now that I have your attention, you once had some EEH questions/comments? ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From torvalds at osdl.org Tue May 4 11:23:25 2004 From: torvalds at osdl.org (Linus Torvalds) Date: Mon, 3 May 2004 18:23:25 -0700 (PDT) Subject: "sparse" warnings.. In-Reply-To: <20040503181439.B30266@forte.austin.ibm.com> References: <20040422105836.0ac99736.sfr@canb.auug.org.au> <1083553538.20473.240.camel@gaston> <20040503123427.A30266@forte.austin.ibm.com> <20040503181439.B30266@forte.austin.ibm.com> Message-ID: On Mon, 3 May 2004 linas at austin.ibm.com wrote: > > > One thing I've been considering adding is a "no-implicit-cast" attribute, > > which would make it a warning if such a type is ever implicitly cast to > > another type. That _would_ warn about things like the above, ie it would > > have warned about "thingy()" being implicitly promoted to an "int" for the > > comparison. > > > > But I'm not sure how useful such an attribute would be. > > The only thing I can think of that's even vaguely like this is taking > a bitflag, say a short, having one of the bit-fields map to the > sign-bit, and then accidentally (implicitly) sign-extending it and > getting unexpected results. e.g. It's really hard to get mistakes like that on anything but "int" boundary. You'd never see it on a short, since constants are always at least "int" in size. So in order to get strange behaviour, you'd have to first explicitly cast it to a short and then (possibly impicitly) cast it to something else. No, the thing I was thinking of is for things like "pte_t" and for enums. Ie things like enum colors { black, red, blue, green, }; where it never basically makes any sense to treat the enum as an integer. So make the type be "__attribute__((nocast))". (And if the above sounds like an unlikely thing to do, think of the GFP_KERNEL flags, and the fact that a lot of people put them in the wrong order for things like "kmalloc()". Making the GFP_KERNEL flag be an enum type that must not be implicitly cast to anything else would automatically warn if somebody used it in any other context). > p.s. now that I have your attention, you once had some EEH questions/comments? eeh? Maybe, but that must have been long enough ago that I don't even remember what EEH stands for.. Linus ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From sfr at canb.auug.org.au Tue May 4 14:04:36 2004 From: sfr at canb.auug.org.au (Stephen Rothwell) Date: Tue, 4 May 2004 14:04:36 +1000 Subject: vio cleanups Message-ID: <20040504140436.4fa1ab0d.sfr@canb.auug.org.au> Hi Dave, First round of vio cleanups in preparation of using it for iSeries. This removes archdata and driver_data from struct vio_dev and uses platform_data and driver_data in the embedded struct device instead. Also, it adds type and name fields to struct viodev which on pSeries just point to the type and name fields of the platform_data (i.e. the open firmware struct device_node fields). This will allow them to be used differently by the iSeries implementation. If you think this is OK (I have compiled it, but not booted it), please either commit it to Ameslab or let me know and I will get that done and then I will submit it upstream. -- Cheers, Stephen Rothwell sfr at canb.auug.org.au http://www.canb.auug.org.au/~sfr/ -------------- next part -------------- diff -ruN ppc64-linux-2.5/arch/ppc64/kernel/vio.c ppc64-linux-2.5.for-ames/arch/ppc64/kernel/vio.c --- ppc64-linux-2.5/arch/ppc64/kernel/vio.c 2004-04-13 18:06:15.000000000 +1000 +++ ppc64-linux-2.5.for-ames/arch/ppc64/kernel/vio.c 2004-05-04 13:03:52.000000000 +1000 @@ -143,8 +143,8 @@ #ifdef CONFIG_PPC_PSERIES while (ids->type) { - if ((strncmp(dev->archdata->type, ids->type, strlen(ids->type)) == 0) && - device_is_compatible((struct device_node*)dev->archdata, ids->compat)) + if ((strncmp(dev->type, ids->type, strlen(ids->type)) == 0) && + device_is_compatible(dev->dev.platform_data, ids->compat)) return ids; ids++; } @@ -263,16 +263,15 @@ DBGENTER(); /* XXX free TCE table */ - of_node_put(viodev->archdata); + of_node_put(viodev->dev.platform_data); kfree(viodev); } static ssize_t viodev_show_name(struct device *dev, char *buf) { struct vio_dev *viodev = to_vio_dev(dev); - struct device_node *of_node = viodev->archdata; - return sprintf(buf, "%s\n", of_node->name); + return sprintf(buf, "%s\n", viodev->name); } DEVICE_ATTR(name, S_IRUSR | S_IRGRP | S_IROTH, viodev_show_name, NULL); @@ -281,7 +280,7 @@ * @of_node: The OF node for this device. * * Creates and initializes a vio_dev structure from the data in - * of_node (archdata) and adds it to the list of virtual devices. + * of_node (dev.platform_data) and adds it to the list of virtual devices. * Returns a pointer to the created vio_dev or NULL if node has * NULL device_type or compatible fields. */ @@ -315,7 +314,9 @@ } memset(viodev, 0, sizeof(struct vio_dev)); - viodev->archdata = (void *)of_node_get(of_node); + viodev->dev.platform_data = of_node_get(of_node); + viodev->type = of_node->type; + viodev->name = of_node->name; viodev->unit_address = *unit_address; viodev->iommu_table = vio_build_iommu_table(viodev); @@ -368,7 +369,7 @@ */ const void * vio_get_attribute(struct vio_dev *vdev, void* which, int* length) { - return get_property((struct device_node *)vdev->archdata, (char*)which, length); + return get_property(vdev->dev.platform_data, (char*)which, length); } EXPORT_SYMBOL(vio_get_attribute); @@ -423,7 +424,7 @@ unsigned long size; int dma_window_property_size; - dma_window = (unsigned int *) get_property((struct device_node *)dev->archdata, "ibm,my-dma-window", &dma_window_property_size); + dma_window = (unsigned int *) get_property(dev->dev.platform_data, "ibm,my-dma-window", &dma_window_property_size); if(!dma_window) { return NULL; } diff -ruN ppc64-linux-2.5/drivers/char/hvcs.c ppc64-linux-2.5.for-ames/drivers/char/hvcs.c --- ppc64-linux-2.5/drivers/char/hvcs.c 2004-04-10 09:04:31.000000000 +1000 +++ ppc64-linux-2.5.for-ames/drivers/char/hvcs.c 2004-05-04 13:14:27.000000000 +1000 @@ -314,7 +314,7 @@ hvcsd->kobj.ktype = &hvcs_kobj_type; hvcsd->vdev = dev; - dev->driver_data = hvcsd; + dev->dev.driver_data = hvcsd; sprintf(hvcsd->name,"%X",dev->unit_address); hvcsd->index = ++hvcs_struct_count; @@ -347,7 +347,7 @@ static void __devexit hvcs_remove(struct vio_dev *dev) { - struct hvcs_struct *hvcsd = (struct hvcs_struct *)dev->driver_data; + struct hvcs_struct *hvcsd = (struct hvcs_struct *)dev->dev.driver_data; if (!hvcsd) return; @@ -889,7 +889,7 @@ static inline struct hvcs_struct *from_vio_dev(struct vio_dev *viod) { - return (struct hvcs_struct *)viod->driver_data; + return (struct hvcs_struct *)viod->dev.driver_data; } /* The sysfs interface for the driver and devices */ diff -ruN ppc64-linux-2.5/drivers/net/ibmveth.c ppc64-linux-2.5.for-ames/drivers/net/ibmveth.c --- ppc64-linux-2.5/drivers/net/ibmveth.c 2004-04-29 08:04:40.000000000 +1000 +++ ppc64-linux-2.5.for-ames/drivers/net/ibmveth.c 2004-05-04 13:15:23.000000000 +1000 @@ -902,7 +902,7 @@ adapter = netdev->priv; memset(adapter, 0, sizeof(adapter)); - dev->driver_data = netdev; + dev->dev.driver_data = netdev; adapter->vdev = dev; adapter->netdev = netdev; @@ -972,7 +972,7 @@ static int __devexit ibmveth_remove(struct vio_dev *dev) { - struct net_device *netdev = dev->driver_data; + struct net_device *netdev = dev->dev.driver_data; struct ibmveth_adapter *adapter = netdev->priv; unregister_netdev(netdev); diff -ruN ppc64-linux-2.5/drivers/scsi/ibmvscsi/ibmvscsis.c ppc64-linux-2.5.for-ames/drivers/scsi/ibmvscsi/ibmvscsis.c --- ppc64-linux-2.5/drivers/scsi/ibmvscsi/ibmvscsis.c 2004-04-28 17:04:34.000000000 +1000 +++ ppc64-linux-2.5.for-ames/drivers/scsi/ibmvscsi/ibmvscsis.c 2004-05-04 13:16:52.000000000 +1000 @@ -2496,7 +2496,7 @@ memset(adapter, 0x00, sizeof(*adapter)); adapter->dma_dev = dev; adapter->dev = &dev->dev; - dev->driver_data = adapter; + dev->dev.driver_data = adapter; sprintf(adapter->name, "%x", dev->unit_address); adapter->lock = SPIN_LOCK_UNLOCKED; @@ -2560,7 +2560,7 @@ int target; struct server_adapter *adapter = - (struct server_adapter *)dev->driver_data; + (struct server_adapter *)dev->dev.driver_data; info("entering remove for UA 0x%x\n", dev->unit_address); diff -ruN ppc64-linux-2.5/drivers/scsi/ibmvscsi/iseries_vscsi.c ppc64-linux-2.5.for-ames/drivers/scsi/ibmvscsi/iseries_vscsi.c --- ppc64-linux-2.5/drivers/scsi/ibmvscsi/iseries_vscsi.c 2004-04-28 17:04:34.000000000 +1000 +++ ppc64-linux-2.5.for-ames/drivers/scsi/ibmvscsi/iseries_vscsi.c 2004-05-03 17:20:16.000000000 +1000 @@ -153,7 +153,6 @@ int __init ibmvscsi_module_init(void) { - iseries_vscsi_dev.archdata = to_vio_dev(iSeries_vio_dev)->archdata; if (device_register(&iseries_vscsi_dev.dev)) { printk(KERN_ERR "ibmvscsi: failed to register device\n"); return 1; diff -ruN ppc64-linux-2.5/drivers/scsi/ibmvscsi/rpa_vscsi.c ppc64-linux-2.5.for-ames/drivers/scsi/ibmvscsi/rpa_vscsi.c --- ppc64-linux-2.5/drivers/scsi/ibmvscsi/rpa_vscsi.c 2004-04-28 17:04:34.000000000 +1000 +++ ppc64-linux-2.5.for-ames/drivers/scsi/ibmvscsi/rpa_vscsi.c 2004-05-04 13:16:22.000000000 +1000 @@ -282,7 +282,7 @@ { struct ibmvscsi_host_data *hostdata = ibmvscsi_probe(&vdev->dev); if (hostdata) { - vdev->driver_data = hostdata; + vdev->dev.driver_data = hostdata; return 0; } else { return -1; @@ -296,7 +296,7 @@ static int rpa_remove(struct vio_dev *vdev) { struct ibmvscsi_host_data *hostdata = - (struct ibmvscsi_host_data *)vdev->driver_data; + (struct ibmvscsi_host_data *)vdev->dev.driver_data; ibmvscsi_remove(hostdata); return 0; } diff -ruN ppc64-linux-2.5/include/asm-ppc64/vio.h ppc64-linux-2.5.for-ames/include/asm-ppc64/vio.h --- ppc64-linux-2.5/include/asm-ppc64/vio.h 2004-04-13 18:06:17.000000000 +1000 +++ ppc64-linux-2.5.for-ames/include/asm-ppc64/vio.h 2004-05-04 13:17:35.000000000 +1000 @@ -110,8 +110,8 @@ * The vio_dev structure is used to describe virtual I/O devices. */ struct vio_dev { - struct device_node *archdata; /* Open Firmware node */ - void *driver_data; /* data private to the driver */ + char *name; + char *type; struct iommu_table *iommu_table; /* vio_map_* uses this */ uint32_t unit_address; unsigned int irq; From sfr at canb.auug.org.au Tue May 4 17:28:36 2004 From: sfr at canb.auug.org.au (Stephen Rothwell) Date: Tue, 4 May 2004 17:28:36 +1000 Subject: [PATCH] Allow PPC64 to build without virtual IO Message-ID: <20040504172836.3b3838ba.sfr@canb.auug.org.au> Hi all, This patch allows PPC64 to build without any virtual IO support at all. Especially useful for PMAC. If there are no objections, could someone please add this to Ameslab? -- Cheers, Stephen Rothwell sfr at canb.auug.org.au http://www.canb.auug.org.au/~sfr/ -------------- next part -------------- diff -ruN ppc64-linux-2.5.for-ames.1/arch/ppc64/Kconfig ppc64-linux-2.5.for-ames.2/arch/ppc64/Kconfig --- ppc64-linux-2.5.for-ames.1/arch/ppc64/Kconfig 2004-05-01 06:04:31.000000000 +1000 +++ ppc64-linux-2.5.for-ames.2/arch/ppc64/Kconfig 2004-05-04 16:51:39.000000000 +1000 @@ -90,6 +90,14 @@ bool "Apple PowerMac G5 support" select ADB_PMU +config PPC_VIO + bool "Support for virtual I/O devices" + default y if !PPC_PMAC + help + Some platforms support virtual devices implemented by the + HyperVisor. This should usually be selected for pSeries or + iSeries machines. + config PPC_SPLPAR depends on PPC_PSERIES bool "Support for shared-processor logical partitions" @@ -311,7 +319,7 @@ source "fs/Kconfig" menu "iSeries device drivers" - depends on PPC_ISERIES + depends on PPC_ISERIES && PPC_VIO config VIOCONS tristate "iSeries Virtual Console Support" diff -ruN ppc64-linux-2.5.for-ames.1/arch/ppc64/configs/g5_defconfig ppc64-linux-2.5.for-ames.2/arch/ppc64/configs/g5_defconfig --- ppc64-linux-2.5.for-ames.1/arch/ppc64/configs/g5_defconfig 2004-04-19 22:05:21.000000000 +1000 +++ ppc64-linux-2.5.for-ames.2/arch/ppc64/configs/g5_defconfig 2004-05-04 16:53:00.000000000 +1000 @@ -61,6 +61,7 @@ CONFIG_PPC_OF=y CONFIG_ALTIVEC=y CONFIG_PPC_PMAC=y +# CONFIG_PPC_VIO is not set CONFIG_PMAC_DART=y CONFIG_PPC_PMAC64=y CONFIG_BOOTX_TEXT=y diff -ruN ppc64-linux-2.5.for-ames.1/arch/ppc64/configs/iSeries_defconfig ppc64-linux-2.5.for-ames.2/arch/ppc64/configs/iSeries_defconfig --- ppc64-linux-2.5.for-ames.1/arch/ppc64/configs/iSeries_defconfig 2004-03-19 13:04:41.000000000 +1100 +++ ppc64-linux-2.5.for-ames.2/arch/ppc64/configs/iSeries_defconfig 2004-05-04 16:57:36.000000000 +1000 @@ -56,6 +56,7 @@ # CONFIG_PPC_PSERIES is not set CONFIG_PPC=y CONFIG_PPC64=y +CONFIG_PPC_VIO=y # CONFIG_POWER4_ONLY is not set # CONFIG_IOMMU_VMERGE is not set CONFIG_SMP=y diff -ruN ppc64-linux-2.5.for-ames.1/arch/ppc64/configs/pSeries_defconfig ppc64-linux-2.5.for-ames.2/arch/ppc64/configs/pSeries_defconfig --- ppc64-linux-2.5.for-ames.1/arch/ppc64/configs/pSeries_defconfig 2004-04-16 01:05:00.000000000 +1000 +++ ppc64-linux-2.5.for-ames.2/arch/ppc64/configs/pSeries_defconfig 2004-05-04 16:54:15.000000000 +1000 @@ -59,6 +59,7 @@ CONFIG_PPC_OF=y CONFIG_ALTIVEC=y # CONFIG_PPC_PMAC is not set +CONFIG_PPC_VIO=y # CONFIG_BOOTX_TEXT is not set # CONFIG_POWER4_ONLY is not set # CONFIG_IOMMU_VMERGE is not set diff -ruN ppc64-linux-2.5.for-ames.1/arch/ppc64/defconfig ppc64-linux-2.5.for-ames.2/arch/ppc64/defconfig --- ppc64-linux-2.5.for-ames.1/arch/ppc64/defconfig 2004-04-16 01:05:00.000000000 +1000 +++ ppc64-linux-2.5.for-ames.2/arch/ppc64/defconfig 2004-05-04 16:52:24.000000000 +1000 @@ -59,6 +59,7 @@ CONFIG_PPC_OF=y CONFIG_ALTIVEC=y # CONFIG_PPC_PMAC is not set +CONFIG_PPC_VIO=y # CONFIG_BOOTX_TEXT is not set # CONFIG_POWER4_ONLY is not set # CONFIG_IOMMU_VMERGE is not set diff -ruN ppc64-linux-2.5.for-ames.1/arch/ppc64/kernel/Makefile ppc64-linux-2.5.for-ames.2/arch/ppc64/kernel/Makefile --- ppc64-linux-2.5.for-ames.1/arch/ppc64/kernel/Makefile 2004-04-14 05:04:38.000000000 +1000 +++ ppc64-linux-2.5.for-ames.2/arch/ppc64/kernel/Makefile 2004-05-04 16:17:57.000000000 +1000 @@ -11,7 +11,7 @@ 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 vio.o + iommu.o sysfs.o obj-$(CONFIG_PPC_OF) += of_device.o @@ -42,6 +42,7 @@ obj-$(CONFIG_MODULES) += module.o ppc_ksyms.o obj-$(CONFIG_PPC_RTAS) += rtas-proc.o obj-$(CONFIG_SCANLOG) += scanlog.o +obj-$(CONFIG_PPC_VIO) += vio.o obj-$(CONFIG_VIOPATH) += viopath.o obj-$(CONFIG_LPARCFG) += lparcfg.o obj-$(CONFIG_PPC_VPURR) += vpurr.o diff -ruN ppc64-linux-2.5.for-ames.1/arch/ppc64/kernel/dma.c ppc64-linux-2.5.for-ames.2/arch/ppc64/kernel/dma.c --- ppc64-linux-2.5.for-ames.1/arch/ppc64/kernel/dma.c 2004-04-13 18:06:15.000000000 +1000 +++ ppc64-linux-2.5.for-ames.2/arch/ppc64/kernel/dma.c 2004-05-04 17:26:54.000000000 +1000 @@ -5,6 +5,7 @@ * the pci and vio busses */ +#include #include #include /* Include the busses we support */ @@ -13,11 +14,22 @@ #include #include +#ifdef CONFIG_PCI +#define IS_PCI_DEV(dev) ((dev)->bus == &pci_bus_type) +#else +#define IS_PCI_DEV(dev) 0 +#endif +#ifdef CONFIG_PPC_VIO +#define IS_VIO_DEV(dev) ((dev)->bus == &vio_bus_type) +#else +#define IS_VIO_DEV(dev) 0 +#endif + int dma_supported(struct device *dev, u64 mask) { - if (dev->bus == &pci_bus_type) + if (IS_PCI_DEV(dev)) return pci_dma_supported(to_pci_dev(dev), mask); - if (dev->bus == &vio_bus_type) + if (IS_VIO_DEV(dev)) return vio_dma_supported(to_vio_dev(dev), mask); BUG(); return 0; @@ -26,9 +38,9 @@ int dma_set_mask(struct device *dev, u64 dma_mask) { - if (dev->bus == &pci_bus_type) + if (IS_PCI_DEV(dev)) return pci_set_dma_mask(to_pci_dev(dev), dma_mask); - if (dev->bus == &vio_bus_type) + if (IS_VIO_DEV(dev)) return vio_set_dma_mask(to_vio_dev(dev), dma_mask); BUG(); return 0; @@ -38,9 +50,9 @@ void *dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, int flag) { - if (dev->bus == &pci_bus_type) + if (IS_PCI_DEV(dev)) return pci_alloc_consistent(to_pci_dev(dev), size, dma_handle); - if (dev->bus == &vio_bus_type) + if (IS_VIO_DEV(dev)) return vio_alloc_consistent(to_vio_dev(dev), size, dma_handle); BUG(); return 0; @@ -50,9 +62,9 @@ void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr_t dma_handle) { - if (dev->bus == &pci_bus_type) + if (IS_PCI_DEV(dev)) pci_free_consistent(to_pci_dev(dev), size, cpu_addr, dma_handle); - else if (dev->bus == &vio_bus_type) + else if (IS_VIO_DEV(dev)) vio_free_consistent(to_vio_dev(dev), size, cpu_addr, dma_handle); else BUG(); @@ -62,9 +74,9 @@ dma_addr_t dma_map_single(struct device *dev, void *cpu_addr, size_t size, enum dma_data_direction direction) { - if (dev->bus == &pci_bus_type) + if (IS_PCI_DEV(dev)) return pci_map_single(to_pci_dev(dev), cpu_addr, size, (int)direction); - if (dev->bus == &vio_bus_type) + if (IS_VIO_DEV(dev)) return vio_map_single(to_vio_dev(dev), cpu_addr, size, direction); BUG(); return (dma_addr_t)0; @@ -74,9 +86,9 @@ void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, enum dma_data_direction direction) { - if (dev->bus == &pci_bus_type) + if (IS_PCI_DEV(dev)) pci_unmap_single(to_pci_dev(dev), dma_addr, size, (int)direction); - else if (dev->bus == &vio_bus_type) + else if (IS_VIO_DEV(dev)) vio_unmap_single(to_vio_dev(dev), dma_addr, size, direction); else BUG(); @@ -87,9 +99,9 @@ unsigned long offset, size_t size, enum dma_data_direction direction) { - if (dev->bus == &pci_bus_type) + if (IS_PCI_DEV(dev)) return pci_map_page(to_pci_dev(dev), page, offset, size, (int)direction); - if (dev->bus == &vio_bus_type) + if (IS_VIO_DEV(dev)) return vio_map_page(to_vio_dev(dev), page, offset, size, direction); BUG(); return (dma_addr_t)0; @@ -99,9 +111,9 @@ void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, enum dma_data_direction direction) { - if (dev->bus == &pci_bus_type) + if (IS_PCI_DEV(dev)) pci_unmap_page(to_pci_dev(dev), dma_address, size, (int)direction); - else if (dev->bus == &vio_bus_type) + else if (IS_VIO_DEV(dev)) vio_unmap_page(to_vio_dev(dev), dma_address, size, direction); else BUG(); @@ -111,9 +123,9 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction direction) { - if (dev->bus == &pci_bus_type) + if (IS_PCI_DEV(dev)) return pci_map_sg(to_pci_dev(dev), sg, nents, (int)direction); - if (dev->bus == &vio_bus_type) + if (IS_VIO_DEV(dev)) return vio_map_sg(to_vio_dev(dev), sg, nents, direction); BUG(); return 0; @@ -123,9 +135,9 @@ void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, enum dma_data_direction direction) { - if (dev->bus == &pci_bus_type) + if (IS_PCI_DEV(dev)) pci_unmap_sg(to_pci_dev(dev), sg, nhwentries, (int)direction); - else if (dev->bus == &vio_bus_type) + else if (IS_VIO_DEV(dev)) vio_unmap_sg(to_vio_dev(dev), sg, nhwentries, direction); else BUG(); diff -ruN ppc64-linux-2.5.for-ames.1/drivers/scsi/Kconfig ppc64-linux-2.5.for-ames.2/drivers/scsi/Kconfig --- ppc64-linux-2.5.for-ames.1/drivers/scsi/Kconfig 2004-04-13 18:06:16.000000000 +1000 +++ ppc64-linux-2.5.for-ames.2/drivers/scsi/Kconfig 2004-05-04 16:45:08.000000000 +1000 @@ -762,7 +762,7 @@ config SCSI_IBMVSCSI tristate "IBM Virtual SCSI support" - depends on PPC_PSERIES || PPC_ISERIES + depends on (PPC_PSERIES || PPC_ISERIES) && PPC_VIO help This is the IBM Virtual SCSI Client @@ -771,7 +771,7 @@ config SCSI_IBMVSCSIS tristate "IBM Virtual SCSI Server support" - depends on PPC_PSERIES + depends on PPC_PSERIES && PPC_VIO help This is the IBM Virtual SCSI Server To compile this driver as a module, choose M here: the From anton at samba.org Tue May 4 18:04:23 2004 From: anton at samba.org (Anton Blanchard) Date: Tue, 4 May 2004 18:04:23 +1000 Subject: [PATCH] 2.6 rtas_flash_init() typo In-Reply-To: <1083615061.27080.20.camel@verve.austin.ibm.com> References: <1083615061.27080.20.camel@verve.austin.ibm.com> Message-ID: <20040504080423.GD1808@krispykreme> Hi John, > Please apply the following, which fixes a typo that prevents the > creation of the manage_flash /proc file. Thanks, applied. Anton ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From anton at samba.org Tue May 4 18:09:12 2004 From: anton at samba.org (Anton Blanchard) Date: Tue, 4 May 2004 18:09:12 +1000 Subject: [PATCH] Compile kdb modules without error In-Reply-To: <20040429130412.GA2054@in.ibm.com> References: <20040429130412.GA2054@in.ibm.com> Message-ID: <20040504080912.GF1808@krispykreme> > Sometime during the linux-2.6.6-rc* series, both struct file and > struct inode were changed. Some routines in kdb modules files depend > on the structure elements that no longer exist. Inlined is a patch > that circumvents this issue by disabling the routines that use the > removed elements. Thanks Ananth, applied. Anton ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From sfr at canb.auug.org.au Tue May 4 18:39:54 2004 From: sfr at canb.auug.org.au (Stephen Rothwell) Date: Tue, 4 May 2004 18:39:54 +1000 Subject: [PATCH] PPC64 Allow PPC64 to build without EEH Message-ID: <20040504183954.4e85481a.sfr@canb.auug.org.au> Hi all, This patch attempts to make EEH configurable so that especially PMAC can be built without it. Not having a good understanding of what it does means that I may have missed something, so please have a look. This has been compile tested with a PMAC config. Constructive criticism welcome :-) This patch is relative to my previous (no virtual IO) patch. -- Cheers, Stephen Rothwell sfr at canb.auug.org.au http://www.canb.auug.org.au/~sfr/ -------------- next part -------------- diff -ruN ppc64-linux-2.5.for-ames.2/arch/ppc64/Kconfig ppc64-linux-2.5.for-ames.3/arch/ppc64/Kconfig --- ppc64-linux-2.5.for-ames.2/arch/ppc64/Kconfig 2004-05-04 16:51:39.000000000 +1000 +++ ppc64-linux-2.5.for-ames.3/arch/ppc64/Kconfig 2004-05-04 17:44:38.000000000 +1000 @@ -98,6 +98,14 @@ HyperVisor. This should usually be selected for pSeries or iSeries machines. +config PPC_EEH + depends on PPC_PSERIES + bool "Support for Enhanced I/O Error Handling" + default y if !PPC_PMAC + help + Support for Enhanced I/O Error Handling. For pSeries machines, + say Y. + config PPC_SPLPAR depends on PPC_PSERIES bool "Support for shared-processor logical partitions" diff -ruN ppc64-linux-2.5.for-ames.2/arch/ppc64/configs/g5_defconfig ppc64-linux-2.5.for-ames.3/arch/ppc64/configs/g5_defconfig --- ppc64-linux-2.5.for-ames.2/arch/ppc64/configs/g5_defconfig 2004-05-04 16:53:00.000000000 +1000 +++ ppc64-linux-2.5.for-ames.3/arch/ppc64/configs/g5_defconfig 2004-05-04 17:47:08.000000000 +1000 @@ -62,6 +62,7 @@ CONFIG_ALTIVEC=y CONFIG_PPC_PMAC=y # CONFIG_PPC_VIO is not set +# CONFIG_PPC_EEH is not set CONFIG_PMAC_DART=y CONFIG_PPC_PMAC64=y CONFIG_BOOTX_TEXT=y diff -ruN ppc64-linux-2.5.for-ames.2/arch/ppc64/configs/pSeries_defconfig ppc64-linux-2.5.for-ames.3/arch/ppc64/configs/pSeries_defconfig --- ppc64-linux-2.5.for-ames.2/arch/ppc64/configs/pSeries_defconfig 2004-05-04 16:54:15.000000000 +1000 +++ ppc64-linux-2.5.for-ames.3/arch/ppc64/configs/pSeries_defconfig 2004-05-04 17:47:34.000000000 +1000 @@ -60,6 +60,7 @@ CONFIG_ALTIVEC=y # CONFIG_PPC_PMAC is not set CONFIG_PPC_VIO=y +CONFIG_PPC_EEH=y # CONFIG_BOOTX_TEXT is not set # CONFIG_POWER4_ONLY is not set # CONFIG_IOMMU_VMERGE is not set diff -ruN ppc64-linux-2.5.for-ames.2/arch/ppc64/defconfig ppc64-linux-2.5.for-ames.3/arch/ppc64/defconfig --- ppc64-linux-2.5.for-ames.2/arch/ppc64/defconfig 2004-05-04 16:52:24.000000000 +1000 +++ ppc64-linux-2.5.for-ames.3/arch/ppc64/defconfig 2004-05-04 17:46:33.000000000 +1000 @@ -60,6 +60,7 @@ CONFIG_ALTIVEC=y # CONFIG_PPC_PMAC is not set CONFIG_PPC_VIO=y +CONFIG_PPC_EEH=y # CONFIG_BOOTX_TEXT is not set # CONFIG_POWER4_ONLY is not set # CONFIG_IOMMU_VMERGE is not set diff -ruN ppc64-linux-2.5.for-ames.2/arch/ppc64/kernel/Makefile ppc64-linux-2.5.for-ames.3/arch/ppc64/kernel/Makefile --- ppc64-linux-2.5.for-ames.2/arch/ppc64/kernel/Makefile 2004-05-04 16:17:57.000000000 +1000 +++ ppc64-linux-2.5.for-ames.3/arch/ppc64/kernel/Makefile 2004-05-04 17:45:20.000000000 +1000 @@ -32,7 +32,7 @@ iSeries_iommu.o obj-$(CONFIG_PPC_PSERIES) += pSeries_pci.o pSeries_lpar.o pSeries_hvCall.o \ - eeh.o nvram.o pSeries_nvram.o rtasd.o ras.o \ + nvram.o pSeries_nvram.o rtasd.o ras.o \ open_pic.o xics.o pSeries_htab.o rtas.o \ chrp_setup.o i8259.o prom.o pSeries_iommu.o @@ -42,6 +42,7 @@ obj-$(CONFIG_MODULES) += module.o ppc_ksyms.o obj-$(CONFIG_PPC_RTAS) += rtas-proc.o obj-$(CONFIG_SCANLOG) += scanlog.o +obj-$(CONFIG_PPC_EEH) += eeh.o obj-$(CONFIG_PPC_VIO) += vio.o obj-$(CONFIG_VIOPATH) += viopath.o obj-$(CONFIG_LPARCFG) += lparcfg.o diff -ruN ppc64-linux-2.5.for-ames.2/include/asm-ppc64/eeh.h ppc64-linux-2.5.for-ames.3/include/asm-ppc64/eeh.h --- ppc64-linux-2.5.for-ames.2/include/asm-ppc64/eeh.h 2004-04-13 18:06:17.000000000 +1000 +++ ppc64-linux-2.5.for-ames.3/include/asm-ppc64/eeh.h 2004-05-04 18:19:07.000000000 +1000 @@ -20,6 +20,7 @@ #ifndef _PPC64_EEH_H #define _PPC64_EEH_H +#include #include #include @@ -41,11 +42,31 @@ #define EEH_MODE_SUPPORTED (1<<0) #define EEH_MODE_NOCHECK (1<<1) +#ifdef CONFIG_PPC_EEH + extern void __init eeh_init(void); unsigned long eeh_check_failure(void *token, unsigned long val); void *eeh_ioremap(unsigned long addr, void *vaddr); void __init pci_addr_cache_build(void); +#else /* CONFIG_PPC_EEH */ + +static inline void __init eeh_init(void) { } + +static inline unsigned long eeh_check_failure(void *token, unsigned long val) +{ + return val; +} + +static inline void *eeh_ioremap(unsigned long addr, void *vaddr) +{ + return vaddr; +} + +static inline void __init pci_addr_cache_build(void) { } + +#endif /* CONFIG_PPC_EEH */ + /** * eeh_add_device - perform EEH initialization for the indicated pci device * @dev: pci device for which to set up EEH @@ -73,6 +94,7 @@ #define EEH_RELEASE_DMA 3 int eeh_set_option(struct pci_dev *dev, int options); +#ifdef CONFIG_PPC_EEH /* * EEH_POSSIBLE_ERROR() -- test for possible MMIO failure. * @@ -94,6 +116,13 @@ #define EEH_POSSIBLE_ERROR(addr, vaddr, val, type) \ ((vaddr) != (addr) && EEH_POSSIBLE_IO_ERROR(val, type)) +#else /* CONFIG_PPC_EEH */ + +#define EEH_POSSIBLE_IO_ERROR(val, type) 0 +#define EEH_POSSIBLE_ERROR(addr, vaddr, val, type) 0 + +#endif /* CONFIG_PPC_EEH */ + /* * MMIO read/write operations with EEH support. */ From eike-hotplug at sf-tec.de Wed May 5 01:03:27 2004 From: eike-hotplug at sf-tec.de (Rolf Eike Beer) Date: Tue, 4 May 2004 17:03:27 +0200 Subject: [Pcihpd-discuss][PATCH] rpaphp doesn't initialize slot's name In-Reply-To: <4097B40E.3070705@us.ibm.com> References: <40906502.4070009@us.ibm.com> <20040502065118.GG3766@kroah.com> <4097B40E.3070705@us.ibm.com> Message-ID: <200405041703.27131@bilbo.math.uni-mannheim.de> Am Dienstag, 4. Mai 2004 17:17 schrieb Linda Xie: > Hi Greg, > > Attached patch was made against the lastest > kernel.bkbits.net/gregkh/linux/pci-2.6. > It contains the following fixes: > - Remove an unused label(error_slot defined, but not used) > - Correct a typo(replace hoslot with hpslot) Oops, this looks like I broke it. Your fix is not correct. Please apply this patch and rediff. Greg, you need it first, too. Eike --- rpaphp_slot.c.orig 2004-05-04 16:59:10.000000000 +0200 +++ rpaphp_slot.c 2004-05-04 16:59:45.000000000 +0200 @@ -89,12 +89,12 @@ struct slot *alloc_slot_struct(struct de memset(slot, 0, sizeof (struct slot)); slot->hotplug_slot = kmalloc(sizeof (struct hotplug_slot), GFP_KERNEL); if (!slot->hotplug_slot) - goto error_hpslot; + goto error_slot; memset(slot->hotplug_slot, 0, sizeof (struct hotplug_slot)); slot->hotplug_slot->info = kmalloc(sizeof (struct hotplug_slot_info), GFP_KERNEL); if (!slot->hotplug_slot->info) - goto error_hoslot; + goto error_hpslot; memset(slot->hotplug_slot->info, 0, sizeof (struct hotplug_slot_info)); slot->hotplug_slot->name = kmalloc(BUS_ID_SIZE + 1, GFP_KERNEL); if (!slot->hotplug_slot->name) ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From eike-hotplug at sf-tec.de Wed May 5 01:07:06 2004 From: eike-hotplug at sf-tec.de (Rolf Eike Beer) Date: Tue, 4 May 2004 17:07:06 +0200 Subject: [PATCH] rpaphp doesn't initialize slot's name In-Reply-To: <200405041703.27131@bilbo.math.uni-mannheim.de> References: <40906502.4070009@us.ibm.com> <4097B40E.3070705@us.ibm.com> <200405041703.27131@bilbo.math.uni-mannheim.de> Message-ID: <200405041707.06360@bilbo.math.uni-mannheim.de> Am Dienstag, 4. Mai 2004 17:03 schrieb Rolf Eike Beer: > Am Dienstag, 4. Mai 2004 17:17 schrieb Linda Xie: > > Hi Greg, > > > > Attached patch was made against the lastest > > kernel.bkbits.net/gregkh/linux/pci-2.6. > > It contains the following fixes: > > > > - Remove an unused label(error_slot defined, but not used) > > - Correct a typo(replace hoslot with hpslot) > > Oops, this looks like I broke it. Your fix is not correct. > > Please apply this patch and rediff. Greg, you need it first, too. Ok, I broke it again. I diffed it from wrong place, this one should apply. Eike --- linux-2.6.6-rc3/drivers/pci/hotplug/rpaphp_slot.c.orig 2004-05-04 16:59:10.000000000 +0200 +++ linux-2.6.6-rc3/drivers/pci/hotplug/rpaphp_slot.c 2004-05-04 16:59:45.000000000 +0200 @@ -89,12 +89,12 @@ struct slot *alloc_slot_struct(struct de memset(slot, 0, sizeof (struct slot)); slot->hotplug_slot = kmalloc(sizeof (struct hotplug_slot), GFP_KERNEL); if (!slot->hotplug_slot) - goto error_hpslot; + goto error_slot; memset(slot->hotplug_slot, 0, sizeof (struct hotplug_slot)); slot->hotplug_slot->info = kmalloc(sizeof (struct hotplug_slot_info), GFP_KERNEL); if (!slot->hotplug_slot->info) - goto error_hoslot; + goto error_hpslot; memset(slot->hotplug_slot->info, 0, sizeof (struct hotplug_slot_info)); slot->hotplug_slot->name = kmalloc(BUS_ID_SIZE + 1, GFP_KERNEL); if (!slot->hotplug_slot->name) ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From lxiep at us.ibm.com Wed May 5 01:17:34 2004 From: lxiep at us.ibm.com (Linda Xie) Date: Tue, 04 May 2004 10:17:34 -0500 Subject: [Pcihpd-discuss] [PATH] rpaphp doesn't initialize slot's name In-Reply-To: <20040502065118.GG3766@kroah.com> References: <40906502.4070009@us.ibm.com> <20040502065118.GG3766@kroah.com> Message-ID: <4097B40E.3070705@us.ibm.com> Hi Greg, Attached patch was made against the lastest kernel.bkbits.net/gregkh/linux/pci-2.6. It contains the following fixes: - Set up slot->name - Remove an unused label(error_slot defined, but not used) - Correct a typo(replace hoslot with hpslot) - Kill a couple of debug statments Thanks, Linda >On Wed, Apr 28, 2004 at 09:14:26PM -0500, Linda Xie wrote: > > >>Hi Greg, >> >>This patch includes some changes that I missed when I cut >>php_phy_location.patch. It fixes the kernel crash when rpaphp is >>loaded because slot->name is not initialized. >> >>Please apply it to your tree. >> >> > >Ick, it doesn't apply due to the other changes to the driver. Can you >rediff this against the latest -mm tree and resend it? > >thanks, > >greg k-h > > > > -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rpaphp.patch Url: http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20040504/aa641a3e/attachment.txt From hollisb at us.ibm.com Wed May 5 01:20:51 2004 From: hollisb at us.ibm.com (Hollis Blanchard) Date: Tue, 4 May 2004 10:20:51 -0500 Subject: [PATCH] Allow PPC64 to build without virtual IO In-Reply-To: <20040504172836.3b3838ba.sfr@canb.auug.org.au> References: <20040504172836.3b3838ba.sfr@canb.auug.org.au> Message-ID: On May 4, 2004, at 2:28 AM, Stephen Rothwell wrote: > > This patch allows PPC64 to build without any virtual IO support > at all. Especially useful for PMAC. Looks fine to me. I still wish we didn't have that "if PCI else if VIO" logic in every dma.c function, but I don't suppose that will be fixed any time in the next couple years[1], so in the meantime this is what we're stuck with. [1] http://lkml.org/lkml/2004/2/20/222 -- Hollis Blanchard IBM Linux Technology Center ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From hollisb at us.ibm.com Wed May 5 01:37:15 2004 From: hollisb at us.ibm.com (Hollis Blanchard) Date: Tue, 4 May 2004 10:37:15 -0500 Subject: vio cleanups In-Reply-To: <20040504140436.4fa1ab0d.sfr@canb.auug.org.au> References: <20040504140436.4fa1ab0d.sfr@canb.auug.org.au> Message-ID: On May 3, 2004, at 11:04 PM, Stephen Rothwell wrote: > > First round of vio cleanups in preparation of using it for iSeries. > This removes archdata and driver_data from struct vio_dev and uses > platform_data and driver_data in the embedded struct device instead. > > Also, it adds type and name fields to struct viodev which on pSeries > just point to the type and name fields of the platform_data (i.e. the > open firmware struct device_node fields). This will allow them to be > used differently by the iSeries implementation. Looks ok (though I haven't actually tried it yet either :) . Shouldn't vio_get_property be protected from use on iSeries somehow? Hmm, reminds me the "free TCE" patch was never committed. Linda did you ever get a chance to try that (DLPAR remove of a virtual device would leak its IOMMU table). It was Olof's patch, attached below. -- Hollis Blanchard IBM Linux Technology Center -------------- next part -------------- A non-text attachment was scrubbed... Name: iommu_free.diff Type: application/octet-stream Size: 1153 bytes Desc: not available Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20040504/d9f59495/attachment.obj From linas at austin.ibm.com Wed May 5 03:17:08 2004 From: linas at austin.ibm.com (linas at austin.ibm.com) Date: Tue, 4 May 2004 12:17:08 -0500 Subject: "sparse" warnings.. In-Reply-To: ; from torvalds@osdl.org on Mon, May 03, 2004 at 06:23:25PM -0700 References: <20040422105836.0ac99736.sfr@canb.auug.org.au> <1083553538.20473.240.camel@gaston> <20040503123427.A30266@forte.austin.ibm.com> <20040503181439.B30266@forte.austin.ibm.com> Message-ID: <20040504121707.C30266@forte.austin.ibm.com> On Mon, May 03, 2004 at 06:23:25PM -0700, Linus Torvalds wrote: > > It's really hard to get mistakes like that on anything but "int" boundary. > You'd never see it on a short, since constants are always at least "int" I think you misread the example :) The problem was not with the constant, it was with the variable: using a signed short for a bitflag. Or, more precisely, using a signed short for a bitflag, setting the 15th bit, and then using it somewhere where it can get sign-extended. (e.g. bad 32-bit i/o code). The sign extension clobbers the high bits. The general rule is then "if its used as a bitflag, it should be unsigned." grep short include/linux/* |grep flag | grep -v unsigned shows a dozen potentially dangerous usages. > enum colors { > black, > red, > blue, > green, > }; > where it never basically makes any sense to treat the enum as an integer. > So make the type be "__attribute__((nocast))". That would work. A stop-gap to help catch uninitalized usage is setting up a non-zero start value: enum colors { black=1, red, blue, green, }; > eeh? Maybe, but that must have been long enough ago that I don't even > remember what EEH stands for.. extended error handling, a way of reporting PCI bus errors that would otherwise cause machine-checks. --linas ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From torvalds at osdl.org Wed May 5 04:15:01 2004 From: torvalds at osdl.org (Linus Torvalds) Date: Tue, 4 May 2004 11:15:01 -0700 (PDT) Subject: "sparse" warnings.. In-Reply-To: <20040504121707.C30266@forte.austin.ibm.com> References: <20040422105836.0ac99736.sfr@canb.auug.org.au> <1083553538.20473.240.camel@gaston> <20040503123427.A30266@forte.austin.ibm.com> <20040503181439.B30266@forte.austin.ibm.com> <20040504121707.C30266@forte.austin.ibm.com> Message-ID: On Tue, 4 May 2004 linas at austin.ibm.com wrote: > > > eeh? Maybe, but that must have been long enough ago that I don't even > > remember what EEH stands for.. > > extended error handling, a way of reporting PCI bus errors that would > otherwise cause machine-checks. So what was wrong with the suggested interface, ie having something like pci_clear_error(pdev); x = pci_inw_check(pdev, port); pci_outw_check(pdev, x | BIT, port); error = pci_check_error(pdev); (or whatever.. I don't care about the names, but what I do _not_ want to have is something that checks synchronously with the IO. To me, the important part is that there is a separate "check errors" phase _after_ the IO has been completed, which is the one that ends up possibly waiting for the posted writes to have actually gone to the device etc). Linus ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From lxiep at us.ibm.com Wed May 5 04:30:46 2004 From: lxiep at us.ibm.com (Linda Xie) Date: Tue, 04 May 2004 13:30:46 -0500 Subject: [PATCH - revised] rpaphp doesn't initialize slot's name In-Reply-To: <200405041707.06360@bilbo.math.uni-mannheim.de> References: <40906502.4070009@us.ibm.com> <4097B40E.3070705@us.ibm.com> <200405041703.27131@bilbo.math.uni-mannheim.de> <200405041707.06360@bilbo.math.uni-mannheim.de> Message-ID: <4097E156.5040100@us.ibm.com> Hi Eike & Greg, Attached is a revised version of rpaphp.patch. It has the following fixes: - Set up slot->name - Kill some dbgs - Eike's fixes - New fixes for incorrect "goto" in rpaphp_slot.c. Thanks, Linda Rolf Eike Beer wrote: >Am Dienstag, 4. Mai 2004 17:03 schrieb Rolf Eike Beer: > > >>Am Dienstag, 4. Mai 2004 17:17 schrieb Linda Xie: >> >> >>>Hi Greg, >>> >>>Attached patch was made against the lastest >>>kernel.bkbits.net/gregkh/linux/pci-2.6. >>>It contains the following fixes: >>> >>>- Remove an unused label(error_slot defined, but not used) >>>- Correct a typo(replace hoslot with hpslot) >>> >>> >>Oops, this looks like I broke it. Your fix is not correct. >> >>Please apply this patch and rediff. Greg, you need it first, too. >> >> > >Ok, I broke it again. I diffed it from wrong place, this one should apply. > >Eike > >--- linux-2.6.6-rc3/drivers/pci/hotplug/rpaphp_slot.c.orig 2004-05-04 16:59:10.000000000 +0200 >+++ linux-2.6.6-rc3/drivers/pci/hotplug/rpaphp_slot.c 2004-05-04 16:59:45.000000000 +0200 >@@ -89,12 +89,12 @@ struct slot *alloc_slot_struct(struct de > memset(slot, 0, sizeof (struct slot)); > slot->hotplug_slot = kmalloc(sizeof (struct hotplug_slot), GFP_KERNEL); > if (!slot->hotplug_slot) >- goto error_hpslot; >+ goto error_slot; > memset(slot->hotplug_slot, 0, sizeof (struct hotplug_slot)); > slot->hotplug_slot->info = kmalloc(sizeof (struct hotplug_slot_info), > GFP_KERNEL); > if (!slot->hotplug_slot->info) >- goto error_hoslot; >+ goto error_hpslot; > memset(slot->hotplug_slot->info, 0, sizeof (struct hotplug_slot_info)); > slot->hotplug_slot->name = kmalloc(BUS_ID_SIZE + 1, GFP_KERNEL); > if (!slot->hotplug_slot->name) > > > > > -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rpaphp_new.patch Url: http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20040504/dba83eb4/attachment.txt From hollisb at us.ibm.com Wed May 5 05:08:25 2004 From: hollisb at us.ibm.com (Hollis Blanchard) Date: Tue, 4 May 2004 14:08:25 -0500 Subject: vio cleanups In-Reply-To: References: Message-ID: <6B54FDDF-9DFE-11D8-9ABE-000A95A0560C@us.ibm.com> On May 4, 2004, at 1:57 PM, Linda Xie wrote: > > Linda did you ever get a chance to try that (DLPAR remove of a > virtual device would > > leak its IOMMU table). > > No. I didn't. How can you tell if DLPAR remove a vio leaks IOMMU table? You could do it in a loop and watch your free memory shrink and your kernel memory grow. -- Hollis Blanchard IBM Linux Technology Center ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From linas at austin.ibm.com Wed May 5 05:25:59 2004 From: linas at austin.ibm.com (linas at austin.ibm.com) Date: Tue, 4 May 2004 14:25:59 -0500 Subject: PCI errors [was Re: "sparse" warnings..] In-Reply-To: ; from torvalds@osdl.org on Tue, May 04, 2004 at 11:15:01AM -0700 References: <20040422105836.0ac99736.sfr@canb.auug.org.au> <1083553538.20473.240.camel@gaston> <20040503123427.A30266@forte.austin.ibm.com> <20040503181439.B30266@forte.austin.ibm.com> <20040504121707.C30266@forte.austin.ibm.com> Message-ID: <20040504142559.D30266@forte.austin.ibm.com> On Tue, May 04, 2004 at 11:15:01AM -0700, Linus Torvalds wrote: > > > On Tue, 4 May 2004 linas at austin.ibm.com wrote: > > extended error handling, a way of reporting PCI bus errors that would > > otherwise cause machine-checks. > > So what was wrong with the suggested interface, ie having something like I missed out on the chain of emails where this was suggested. > pci_clear_error(pdev); > x = pci_inw_check(pdev, port); > pci_outw_check(pdev, x | BIT, port); > error = pci_check_error(pdev); > > (or whatever.. I don't care about the names, but what I do _not_ want to > have is something that checks synchronously with the IO. To me, the > important part is that there is a separate "check errors" phase _after_ > the IO has been completed, which is the one that ends up possibly waiting > for the posted writes to have actually gone to the device etc). The above is fine for any 'fully EEH aware device driver', and should be the interface used. However, it requires modifications to the device driver. There's two problems with that. First is the cultural problem: If this is percieved to be a ppc64 stunt, no one will be interested. If this technology shows up on non-ppc64 platforms, and there is a pronouncment e.g. from you, that 'yay verily device drivers must be written in this way', then maybe the idea will get some traction and some device drivers will get converted. I've been told conflicting things about non-ppc64 hardware; I picked through the next generation PCI-X spec, but couldn't find anything comparable. I'm not a PCI expert, its not clear to me what's going there. The second problem is a more nebulous policy question. If an error is detected, and the device driver doesn't know how to deal with it, should one ignore it, and risk potential data corruption, or should one panic the machine? The high-availablity guys fear pernicious data corruption so much that they would rather panic the machine than ignore the error. So the current policy is to call "panic" (althought I hope to change that soon). If you buy into the 'panic-on-error' philosophy, then the problem becomes one of how to detect the error when your device driver is not EEH-aware. Unfortunately, a fault doesn't cause an exception, so the only way to detect the error is to do it in-line, which results in the current design. --linas ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From greg at kroah.com Wed May 5 05:51:17 2004 From: greg at kroah.com (Greg KH) Date: Tue, 4 May 2004 12:51:17 -0700 Subject: PCI errors [was Re: "sparse" warnings..] In-Reply-To: <20040504142559.D30266@forte.austin.ibm.com> References: <1083553538.20473.240.camel@gaston> <20040503123427.A30266@forte.austin.ibm.com> <20040503181439.B30266@forte.austin.ibm.com> <20040504121707.C30266@forte.austin.ibm.com> <20040504142559.D30266@forte.austin.ibm.com> Message-ID: <20040504195116.GA1194@kroah.com> On Tue, May 04, 2004 at 02:25:59PM -0500, linas at austin.ibm.com wrote: > On Tue, May 04, 2004 at 11:15:01AM -0700, Linus Torvalds wrote: > > On Tue, 4 May 2004 linas at austin.ibm.com wrote: > > > extended error handling, a way of reporting PCI bus errors that would > > > otherwise cause machine-checks. > > > > So what was wrong with the suggested interface, ie having something like > > I missed out on the chain of emails where this was suggested. What about the long chain of emails between me and Paul about what to do with this? I thought we had come to an agreement as to what is needed to do. And it was not arch dependant the last I remember... > First is the cultural problem: If this is percieved to be a ppc64 > stunt, no one will be interested. If this technology shows up on > non-ppc64 platforms It's going to show up on non-ppc64 platforms, as PCI Express supports this kind of error reporting. Or so Intel has told me. > I've been told conflicting things about non-ppc64 hardware; I picked > through the next generation PCI-X spec, but couldn't find anything > comparable. I'm not a PCI expert, its not clear to me what's going > there. Not PCI-X, PCI Express. Two totally different things. Yeah, it's a pain to try to keep them apart when talking to people, I know. thanks, greg k-h ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From torvalds at osdl.org Wed May 5 06:22:12 2004 From: torvalds at osdl.org (Linus Torvalds) Date: Tue, 4 May 2004 13:22:12 -0700 (PDT) Subject: PCI errors [was Re: "sparse" warnings..] In-Reply-To: <20040504142559.D30266@forte.austin.ibm.com> References: <20040422105836.0ac99736.sfr@canb.auug.org.au> <1083553538.20473.240.camel@gaston> <20040503123427.A30266@forte.austin.ibm.com> <20040503181439.B30266@forte.austin.ibm.com> <20040504121707.C30266@forte.austin.ibm.com> <20040504142559.D30266@forte.austin.ibm.com> Message-ID: On Tue, 4 May 2004 linas at austin.ibm.com wrote: > > The above is fine for any 'fully EEH aware device driver', and should > be the interface used. However, it requires modifications to the device > driver. There's two problems with that. No, there's one major reason for it: the device driver requires changes anyway. Device drivers that don't know about error handling can't do anything sane about it anyway, so for them the errors should just be ignored. Maybe logged, but as far as the driver is concerned, it never happened. That's why I'd want the error checking to have to be explicit - we should never do anything if the driver doesn't explicitly agree with it. Linus ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From rsa at us.ibm.com Wed May 5 06:32:28 2004 From: rsa at us.ibm.com (Ryan Arnold) Date: 04 May 2004 15:32:28 -0500 Subject: [PATCH] hvcs build warning fixes Message-ID: <1083702758.27507.1945.camel@SigurRos.rchland.ibm.com> This is the second of three patches broken out of an originally proposed single hvcs.diff patch as suggested when I posted it last. The first patch was the hvconsole.c arch specific changes and which were checked into the Ameslab tree early last week by paulus. This patch adds fixes to appease the build warnings related to hvcs.c. Please review this patch. Olaf, this is basically the same patch you added to your CVS tree. I can either check this into Ameslab tree myself or someone else can do it when its quality is acceptable. The third (forthcoming) patch will fix some documentation, printk's, and minor execution issues proposed in my original patch. Hopefully I'll get that out tomorrow (Wednesday). Ryan S. Arnold IBM Linux Technology Center -------------- next part -------------- --- linux-2.5/drivers/char/hvcs.c 2004-05-03 14:18:31.000000000 -0500 +++ hvcs_warn_linux-2.5/drivers/char/hvcs.c 2004-05-03 15:23:23.000000000 -0500 @@ -110,9 +110,9 @@ static int hvcs_parm_num_devs = -1; module_param(hvcs_parm_num_devs, int, 0); -static const char hvcs_driver_name[] = "hvcs"; -static const char hvcs_device_node[] = "hvcs"; -static const char hvcs_driver_string[] +char hvcs_driver_name[] = "hvcs"; +char hvcs_device_node[] = "hvcs"; +char hvcs_driver_string[] = "IBM hvcs (Hypervisor Virtual Console Server) Driver"; /* Status of partner info rescan triggered via sysfs. */ @@ -154,7 +154,7 @@ static struct list_head hvcs_structs = LIST_HEAD_INIT(hvcs_structs); -static void hvcs_read_task(unsigned long data); +static void hvcs_read_task(void * data); static void hvcs_unthrottle(struct tty_struct *tty); static void hvcs_throttle(struct tty_struct *tty); static irqreturn_t hvcs_handle_interrupt(int irq, void *dev_instance, struct pt_regs *regs); @@ -185,7 +185,7 @@ static void hvcs_remove_driver_attrs(void); static int __devinit hvcs_probe(struct vio_dev *dev, const struct vio_device_id *id); -static void __devexit hvcs_remove(struct vio_dev *dev); +static int __devexit hvcs_remove(struct vio_dev *dev); static int __init hvcs_module_init(void); static void __exit hvcs_module_exit(void); @@ -195,7 +195,7 @@ * throttle and we want to be able to reschedule ourselves to run AFTER a * push is scheduled so that we know when the tty is properly throttled. */ -static void hvcs_read_task(unsigned long data) +static void hvcs_read_task(void * data) { struct hvcs_struct *hvcsd = (struct hvcs_struct *)data; unsigned int unit_address = hvcsd->vdev->unit_address; @@ -295,7 +295,7 @@ if (!dev || !id) { printk(KERN_ERR "HVCS: driver probed with invalid parm.\n"); - return; + return -EPERM; } printk(KERN_INFO "HVCS: Added vty-server@%X.\n", dev->unit_address); @@ -319,7 +319,7 @@ hvcsd->index = ++hvcs_struct_count; - INIT_WORK(&hvcsd->read_work, hvcs_read_task, (unsigned long)hvcsd); + INIT_WORK(&hvcsd->read_work, hvcs_read_task, hvcsd); hvcsd->enabled = 0; @@ -345,12 +345,12 @@ return 0; } -static void __devexit hvcs_remove(struct vio_dev *dev) +static int __devexit hvcs_remove(struct vio_dev *dev) { struct hvcs_struct *hvcsd = (struct hvcs_struct *)dev->driver_data; if (!hvcsd) - return; + return -ENODEV; printk(KERN_INFO "HVCS: Removing vty-server@%X.\n", dev->unit_address); @@ -379,13 +379,14 @@ * which would probably be tty_hangup. */ kobject_put (&hvcsd->kobj); + return 0; }; static struct vio_driver hvcs_vio_driver = { - .name = &hvcs_driver_name, + .name = hvcs_driver_name, .id_table = hvcs_driver_table, .probe = hvcs_probe, - .remove = __devexit_p(hvcs_remove), + .remove = hvcs_remove, }; /* Only called from hvcs_get_pi please */ From paulus at samba.org Wed May 5 08:39:39 2004 From: paulus at samba.org (Paul Mackerras) Date: Wed, 5 May 2004 08:39:39 +1000 Subject: PCI errors [was Re: "sparse" warnings..] In-Reply-To: References: <20040422105836.0ac99736.sfr@canb.auug.org.au> <1083553538.20473.240.camel@gaston> <20040503123427.A30266@forte.austin.ibm.com> <20040503181439.B30266@forte.austin.ibm.com> <20040504121707.C30266@forte.austin.ibm.com> <20040504142559.D30266@forte.austin.ibm.com> Message-ID: <16536.7083.228872.983823@cargo.ozlabs.ibm.com> Linus Torvalds writes: > No, there's one major reason for it: the device driver requires changes > anyway. > > Device drivers that don't know about error handling can't do anything sane > about it anyway, so for them the errors should just be ignored. Maybe > logged, but as far as the driver is concerned, it never happened. That's > why I'd want the error checking to have to be explicit - we should never > do anything if the driver doesn't explicitly agree with it. We can also do something sensible for device drivers that are hot-plug capable but not EEH-aware. The EEH event looks an awful lot like an asynchronous unplug event. For drivers that know about hotplug, we can just tell them that the device has gone away, then reset the slot and the card, then tell the driver that a new card has just been plugged in. This requires just that the driver can cope with getting all 1s back on every read without getting itself into a knot, and that it does something reasonable if its hotplug remove function gets called when the device is already gone. Which you would want for cardbus anyway. So my suggestion was to spend the effort on a few drivers to make them do the full error-handling thing, but then have the larger class of drivers that are hotplug-capable be able to do something halfway sensible on an EEH event too. (The discussion that Greg KH mentioned was about how to get the unplug notification to the driver; Greg advocates that the kernel tells userspace about the EEH event, and userspace then drives the recovery process: tell the driver the card is gone, reset the slot and card, tell the driver there is a new card in there.) Thoughts? Paul. ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From linas at austin.ibm.com Wed May 5 10:12:54 2004 From: linas at austin.ibm.com (linas at austin.ibm.com) Date: Tue, 4 May 2004 19:12:54 -0500 Subject: [SCRIPT] device name to location code converter Message-ID: <20040504191253.E30266@forte.austin.ibm.com> I got tired of looking up/guesing location codes based on device names. Appended is a trivial perl script to do the work for me. Here's the obligatory screenshot: # ./get-loc-code.pl net/eth0 U0.1-P2-I1/E1 --linas #! /usr/bin/env perl # # Given a device class and name, such as "net/eth0", find # the corresponding ibm location code. Do this by looking # up the device spec in the /sys tree followed by a lookup # in the device-tree. if ($#ARGV != 0) { print "Usage: $0 deviceclass/devicename\n"; print "\tFor example: $0 net/eth0\n"; exit 1; } $syspath = "/sys/class/" . $ARGV[0] . "/device/devspec"; open (SPEC, $syspath) or die "Can't open $syspath: $!"; $specpath = ; $specpath = "/proc/device-tree/" . $specpath . "/ibm,loc-code"; open (LOC, $specpath) or die "Can't open $specpath: $!"; $loc_code = ; print "$loc_code\n"; ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From linas at austin.ibm.com Wed May 5 10:33:30 2004 From: linas at austin.ibm.com (linas at austin.ibm.com) Date: Tue, 4 May 2004 19:33:30 -0500 Subject: PCI errors [was Re: "sparse" warnings..] In-Reply-To: ; from torvalds@osdl.org on Tue, May 04, 2004 at 01:22:12PM -0700 References: <1083553538.20473.240.camel@gaston> <20040503123427.A30266@forte.austin.ibm.com> <20040503181439.B30266@forte.austin.ibm.com> <20040504121707.C30266@forte.austin.ibm.com> <20040504142559.D30266@forte.austin.ibm.com> Message-ID: <20040504193329.F30266@forte.austin.ibm.com> Hi, On Tue, May 04, 2004 at 01:22:12PM -0700, Linus Torvalds wrote: > > > Device drivers that don't know about error handling can't do anything sane > about it anyway, so for them the errors should just be ignored. Maybe > logged, but as far as the driver is concerned, it never happened. That's > why I'd want the error checking to have to be explicit - we should never > do anything if the driver doesn't explicitly agree with it. Except that is not how the hardware works. Once you get the error, that's it, the device is blown up out of the water, its history. Its impossible to ignore this error. Think about it: there was a PCI Address parity error. What should one do? Pretend the read/write to some bogus address succeeded? Who knows what might happen next? In fact, the actual hardware reacts in a fashion very similar to having a user yank out a PCMCIA card out of a slot, and conceptually this is probably the easiest way to think about it. It stops all further I/O between the device and the system, and that's the end of the story until that hardware slot is reset. All further reads by the device driver return 0xffffff, all further writes are dropped on the floor. DMA in the opposite direction is cut off. Basically, the device driver is toast at this point, and one has to do something. Note: on the newest hardware, there is no way to turn this error detection off. If the error is detected, the slot will freeze. I've been playing with the idea of treating these as if they were hotplug events. This is ugly but maybe acceptable for ethernet outages, but is, well, unworkable if the error happened to affect the root file system. --linas ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From linas at austin.ibm.com Wed May 5 10:47:39 2004 From: linas at austin.ibm.com (linas at austin.ibm.com) Date: Tue, 4 May 2004 19:47:39 -0500 Subject: PCI errors [was Re: "sparse" warnings..] In-Reply-To: <16536.7083.228872.983823@cargo.ozlabs.ibm.com>; from paulus@samba.org on Wed, May 05, 2004 at 08:39:39AM +1000 References: <20040503123427.A30266@forte.austin.ibm.com> <20040503181439.B30266@forte.austin.ibm.com> <20040504121707.C30266@forte.austin.ibm.com> <20040504142559.D30266@forte.austin.ibm.com> <16536.7083.228872.983823@cargo.ozlabs.ibm.com> Message-ID: <20040504194739.G30266@forte.austin.ibm.com> On Wed, May 05, 2004 at 08:39:39AM +1000, Paul Mackerras wrote: > > (The discussion that Greg KH mentioned was about how to get the unplug > notification to the driver; Greg advocates that the kernel tells > userspace about the EEH event, and userspace then drives the recovery > process: tell the driver the card is gone, reset the slot and card, > tell the driver there is a new card in there.) Yes, that's the best we'll be able to do in the short term. I've got a little test harness that does this, it crashes the kernel with a null pointer deref about the 5th time around. Its some hopefully minor bug in the rpaphp hotplug code. The Greg KH conversation ended with the factoid that if the PCI event whacks the disk on which the root filesystem sits, all is lost. We conclude that the scsi drivers must recover in the kernel. I don't think its hard (fingers crossed) I think its a lot like an HBA reset, and a lot of the support is already in the scsi_generic layer. The point being that SCSI already has a cascading chain of resets that it tries out when things don't work: first it tries a (disk) device reset, then a scsi bus reset, then the scsi controller reset. Recovering from an EEH error should be identical to a controller reset, except that we need to unfreeze the slot before doing that reset. --linas ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From linas at austin.ibm.com Wed May 5 10:58:24 2004 From: linas at austin.ibm.com (linas at austin.ibm.com) Date: Tue, 4 May 2004 19:58:24 -0500 Subject: PCI errors [was Re: "sparse" warnings..] In-Reply-To: <20040504195116.GA1194@kroah.com>; from greg@kroah.com on Tue, May 04, 2004 at 12:51:17PM -0700 References: <1083553538.20473.240.camel@gaston> <20040503123427.A30266@forte.austin.ibm.com> <20040503181439.B30266@forte.austin.ibm.com> <20040504121707.C30266@forte.austin.ibm.com> <20040504142559.D30266@forte.austin.ibm.com> <20040504195116.GA1194@kroah.com> Message-ID: <20040504195824.H30266@forte.austin.ibm.com> On Tue, May 04, 2004 at 12:51:17PM -0700, Greg KH wrote: > > > First is the cultural problem: If this is percieved to be a ppc64 > > stunt, no one will be interested. If this technology shows up on > > non-ppc64 platforms > > It's going to show up on non-ppc64 platforms, as PCI Express supports > this kind of error reporting. Or so Intel has told me. Yes, well, I tried to investigate this a bit after your last note. I went through the PCI Express spec, couldn't find it. Found something suggestive in one of the chapters (chapter 6.2) but it seemed unrelated. A post to LKML was lost at sea, and the Intel contact never answered back. I got nervous about the Intel contact: the goal was not to give other industry competitors a heads-up about some neat hardware idea that we have and they don't. A TBD for me is to track down some PCI Express experts and talk to them & I haven't done that yet. Any additonal pointers appreciated. > Not PCI-X, PCI Express. My bad. --linas ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From torvalds at osdl.org Wed May 5 11:08:39 2004 From: torvalds at osdl.org (Linus Torvalds) Date: Tue, 4 May 2004 18:08:39 -0700 (PDT) Subject: PCI errors [was Re: "sparse" warnings..] In-Reply-To: <20040504193329.F30266@forte.austin.ibm.com> References: <1083553538.20473.240.camel@gaston> <20040503123427.A30266@forte.austin.ibm.com> <20040503181439.B30266@forte.austin.ibm.com> <20040504121707.C30266@forte.austin.ibm.com> <20040504142559.D30266@forte.austin.ibm.com> <20040504193329.F30266@forte.austin.ibm.com> Message-ID: On Tue, 4 May 2004 linas at austin.ibm.com wrote: > > Except that is not how the hardware works. Once you get the error, > that's it, the device is blown up out of the water, its history. > Its impossible to ignore this error. So? Return garbage, and continue. There's nothing else you _can_ do. Go on with life. If the driver doesn't have error recovery, what else woul you suggest? I'm saying that you don't have any choice. Just go on. That's what you'd do _with_ error recovery too, btw. It's just that there the driver eventually asks "did we have errors", and if so, it tries to recover gracefully. But there is _zero_ you can do on an individual IO level anyway, except to basically set a flag and step over the IO instruction (although the instruction is usually long gone already, at least for writes). Linus ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From torvalds at osdl.org Wed May 5 11:29:59 2004 From: torvalds at osdl.org (Linus Torvalds) Date: Tue, 4 May 2004 18:29:59 -0700 (PDT) Subject: PCI errors [was Re: "sparse" warnings..] In-Reply-To: <16536.7083.228872.983823@cargo.ozlabs.ibm.com> References: <20040422105836.0ac99736.sfr@canb.auug.org.au> <1083553538.20473.240.camel@gaston> <20040503123427.A30266@forte.austin.ibm.com> <20040503181439.B30266@forte.austin.ibm.com> <20040504121707.C30266@forte.austin.ibm.com> <20040504142559.D30266@forte.austin.ibm.com> <16536.7083.228872.983823@cargo.ozlabs.ibm.com> Message-ID: On Wed, 5 May 2004, Paul Mackerras wrote: > > We can also do something sensible for device drivers that are hot-plug > capable but not EEH-aware. The EEH event looks an awful lot like an > asynchronous unplug event. For drivers that know about hotplug, we > can just tell them that the device has gone away, then reset the slot > and the card, then tell the driver that a new card has just been > plugged in. Yes and no. Hotplug events aren't NMI's, and that means that if the driver is handling it's interrupt handler (or has an irq spinlock or anything else), then that IO _still_ needs to be faked out and "completed" in a sw sense. So if it happens on a read, the EEH handler needs to return garbage (preferably 0xffffffff, since that's generally what existing hotplug drivers kind of expect from hardware that isn't there), and needs to continue onward with life. > This requires just that the driver can cope with getting all 1s back > on every read without getting itself into a knot, and that it does > something reasonable if its hotplug remove function gets called when > the device is already gone. Which you would want for cardbus anyway. Absolutely. So basically, what you should aim for is that unmodified drivers will start getting all-ones on reads, and writes will basially be thrown away. Because that will have to be the case for hotplug drivers too, _and_ it will have to be the case even for error-aware ones (ie they won't necessarily _check_ for the error synchronously, since performance issues means that a high-performance driver probably won't be reasonably able to check until after it has finished a burst write etc). (There's also DMA errors to look out for, that's another "fun" case.) > So my suggestion was to spend the effort on a few drivers to make them > do the full error-handling thing, but then have the larger class of > drivers that are hotplug-capable be able to do something halfway > sensible on an EEH event too. A number of non-hotplug drivers will actually also do the right thing wrt all-ones returns (ie a lot of network drivers will have logic that says "too much work in interrupt", and shut themselves down). So even totally unmodified drivers may actually end up doing something almost reasonable. Linus ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From benh at kernel.crashing.org Wed May 5 11:40:16 2004 From: benh at kernel.crashing.org (Benjamin Herrenschmidt) Date: Wed, 05 May 2004 11:40:16 +1000 Subject: PCI errors [was Re: "sparse" warnings..] In-Reply-To: References: <20040422105836.0ac99736.sfr@canb.auug.org.au> <1083553538.20473.240.camel@gaston> <20040503123427.A30266@forte.austin.ibm.com> <20040503181439.B30266@forte.austin.ibm.com> <20040504121707.C30266@forte.austin.ibm.com> <20040504142559.D30266@forte.austin.ibm.com> <16536.7083.228872.983823@cargo.ozlabs.ibm.com> Message-ID: <1083721215.29595.319.camel@gaston> > Yes and no. > > Hotplug events aren't NMI's, and that means that if the driver is handling > it's interrupt handler (or has an irq spinlock or anything else), then > that IO _still_ needs to be faked out and "completed" in a sw sense. > > So if it happens on a read, the EEH handler needs to return garbage > (preferably 0xffffffff, since that's generally what existing hotplug > drivers kind of expect from hardware that isn't there), and needs to > continue onward with life. That's what the HW does in fact. What happens when an error occurs on those machines, if I understand things correctly is that when the error happens, the bridge that controls that slot immediately off-hook the slot and starts returning ffffffff's. The EEH code hooks on the normal IO read routine and calls the firmware to check for errors when a read returns all f's. > So basically, what you should aim for is that unmodified drivers will > start getting all-ones on reads, and writes will basially be thrown away. Yes. > Because that will have to be the case for hotplug drivers too, _and_ it > will have to be the case even for error-aware ones (ie they won't > necessarily _check_ for the error synchronously, since performance issues > means that a high-performance driver probably won't be reasonably able to > check until after it has finished a burst write etc). > > (There's also DMA errors to look out for, that's another "fun" case.) > > > So my suggestion was to spend the effort on a few drivers to make them > > do the full error-handling thing, but then have the larger class of > > drivers that are hotplug-capable be able to do something halfway > > sensible on an EEH event too. > > A number of non-hotplug drivers will actually also do the right thing wrt > all-ones returns (ie a lot of network drivers will have logic that says > "too much work in interrupt", and shut themselves down). So even totally > unmodified drivers may actually end up doing something almost reasonable. > > Linus -- Benjamin Herrenschmidt ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From eike-hotplug at sf-tec.de Wed May 5 21:43:03 2004 From: eike-hotplug at sf-tec.de (Rolf Eike Beer) Date: Wed, 5 May 2004 13:43:03 +0200 Subject: [Pcihpd-discuss] Re: [PATCH - revised] rpaphp doesn't initialize slot's name In-Reply-To: <4097E156.5040100@us.ibm.com> References: <40906502.4070009@us.ibm.com> <200405041707.06360@bilbo.math.uni-mannheim.de> <4097E156.5040100@us.ibm.com> Message-ID: <200405051343.03337@bilbo.math.uni-mannheim.de> Am Dienstag, 4. Mai 2004 20:30 schrieb Linda Xie: > Hi Eike & Greg, > > Attached is a revised version of rpaphp.patch. It has the following fixes: > - Set up slot->name > - Kill some dbgs > - Eike's fixes > - New fixes for incorrect "goto" in rpaphp_slot.c. Yes, correct. My fault. Eike ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From ananth at in.ibm.com Thu May 6 00:16:47 2004 From: ananth at in.ibm.com (Ananth N Mavinakayanahalli) Date: Wed, 5 May 2004 19:16:47 +0500 Subject: [PATCH] fix KDB backtrace for ppc64 Message-ID: <20040505141647.GA4678@in.ibm.com> Hi Anton, Here is a patch that fixes backtracing in KDB for ppc64. We were not handling the link register and were missing an intermediate call during bt. The patch also contains updates to bring KDB in Ameslab to the latest SGI released level. Please apply! Thanks, Ananth -- Ananth Narayan Linux Technology Center, IBM Software Lab, INDIA diff -Naurp temp/ameslab/arch/ppc64/kdb/kdba_bt.c ameslab/arch/ppc64/kdb/kdba_bt.c --- temp/ameslab/arch/ppc64/kdb/kdba_bt.c 2004-04-22 21:52:09.000000000 -0700 +++ ameslab/arch/ppc64/kdb/kdba_bt.c 2004-05-05 02:51:12.321319240 -0700 @@ -101,17 +101,15 @@ kdba_bt_stack_ppc(struct pt_regs *regs, struct task_struct *p, int regs_esp) { - kdb_machreg_t esp,eip,ebp,old_esp; -/* kdb_symtab_t symtab, *sym; */ - kdbtbtable_t tbtab; + kdb_machreg_t esp, eip, ebp, old_esp; /* declare these as raw ptrs so we don't get func descriptors */ extern void *ret_from_except, *ret_from_syscall_1; -/* int do_bottom_half_ret=0; */ const char *name; - char namebuf[128]; - unsigned long symsize,symoffset; + unsigned long symsize, symoffset; char *symmodname; + int flag = 0; + char namebuf[128]; /* * The caller may have supplied an address at which the @@ -155,7 +153,8 @@ kdba_bt_stack_ppc(struct pt_regs *regs, kdb_printf(" SP(esp) PC(eip) Function(args)\n"); - /* (Ref: 64-bit PowerPC ELF ABI Spplement; Ian Lance Taylor, Zembu Labs). + /* (Ref: 64-bit PowerPC ELF ABI Supplement: + Ian Lance Taylor, Zembu Labs). A PPC stack frame looks like this: High Address @@ -180,18 +179,15 @@ kdba_bt_stack_ppc(struct pt_regs *regs, */ while (1) { kdb_printf("0x%016lx 0x%016lx ", esp, eip); - /* kdbnearsym(eip, &symtab); */ - kdba_find_tb_table(eip, &tbtab); - - /* sym = symtab.sym_name ? &symtab : &tbtab.symtab; */ - /* use fake symtab if necessary */ name = NULL; if (esp >= PAGE_OFFSET) { - /*if ((sym) )*/ - /* if this fails, eip is outside of kernel space, dont trust it. */ + /* + * if this fails, eip is outside of kernel space, + * dont trust it. + */ if (eip > PAGE_OFFSET) { - name = kallsyms_lookup(eip, &symsize, &symoffset, &symmodname, - namebuf); + name = kallsyms_lookup(eip, &symsize, + &symoffset, &symmodname, namebuf); } if (name) { kdb_printf("%s", name); @@ -200,25 +196,49 @@ kdba_bt_stack_ppc(struct pt_regs *regs, } } - /* if this fails, eip is outside of kernel space, dont trust data. */ + /* + * if this fails, eip is outside of kernel space, + * dont trust data. + */ if (eip > PAGE_OFFSET) { if (eip - symoffset > 0) { kdb_printf(" +0x%lx", /*eip -*/ symoffset); } } kdb_printf("\n"); + if (!flag && (task_curr(p))) { + kdb_machreg_t lr; + unsigned long start = 0, end = 0; + + flag++; + lr = regs->link; + if ((lr < PAGE_OFFSET) || (lr == eip)) + goto next_frame; + + start = eip - symoffset; + end = eip - symoffset + symsize; + if (lr >= start && lr < end) + goto next_frame; + + name = NULL; + name = kallsyms_lookup(lr, &symsize, + &symoffset, &symmodname, namebuf); + if (name) + kdb_printf("0x%016lx 0x%016lx (lr) %s +0x%lx\n", + esp, lr, name, symoffset); + } - /* ret_from_except=0xa5e0 ret_from_syscall_1=a378 do_bottom_half_ret=a5e0 */ +next_frame: if (esp < PAGE_OFFSET) { /* below kernelspace.. */ kdb_printf("\n", esp ); break; } else { if (eip == (kdb_machreg_t)ret_from_except || - eip == (kdb_machreg_t)ret_from_syscall_1 /* || - eip == (kdb_machreg_t)do_bottom_half_ret */) { + eip == (kdb_machreg_t)ret_from_syscall_1) { /* pull exception regs from the stack */ struct pt_regs eregs; - kdba_getmem(esp+STACK_FRAME_OVERHEAD, &eregs, sizeof(eregs)); + kdba_getmem(esp+STACK_FRAME_OVERHEAD, + &eregs, sizeof(eregs)); kdb_printf(" [exception: %lx:%s regs 0x%lx] " "nip:[0x%lx] gpr[1]:[0x%lx]\n", eregs.trap,getvecname(eregs.trap), @@ -236,7 +256,10 @@ kdba_bt_stack_ppc(struct pt_regs *regs, break; } } - /* we want to follow exception registers, not into user stack. ... */ + /* + * we want to follow exception registers, + * not into user stack. ... + */ esp = eregs.gpr[1]; eip = eregs.nip; } else { diff -Naurp temp/ameslab/kdb/ChangeLog ameslab/kdb/ChangeLog --- temp/ameslab/kdb/ChangeLog 2004-05-04 02:07:51.000000000 -0700 +++ ameslab/kdb/ChangeLog 2004-05-05 02:51:18.168228408 -0700 @@ -1,3 +1,8 @@ +2004-04-30 Keith Owens + + * Rewrite inode_pages command for new radix code in struct page. + * kdb v4.3-2.6.6-rc1-common-1. + 2004-04-11 Keith Owens * Unlock sn_sal_lock before entering kdb from sn_serial. diff -Naurp temp/ameslab/kdb/gen-kdb_cmds.c ameslab/kdb/gen-kdb_cmds.c --- temp/ameslab/kdb/gen-kdb_cmds.c 2004-04-22 21:54:41.000000000 -0700 +++ ameslab/kdb/gen-kdb_cmds.c 1969-12-31 16:00:00.000000000 -0800 @@ -1,4 +0,0 @@ -#include -char __initdata *kdb_cmds[] = { - 0 -}; diff -Naurp temp/ameslab/kdb/modules/kdbm_pg.c ameslab/kdb/modules/kdbm_pg.c --- temp/ameslab/kdb/modules/kdbm_pg.c 2004-05-04 02:07:51.000000000 -0700 +++ ameslab/kdb/modules/kdbm_pg.c 2004-05-05 03:07:16.033237072 -0700 @@ -151,42 +151,25 @@ kdbm_page(int argc, const char **argv, c long offset=0; int nextarg; int diag; - int lookup_page = 0; - if (argc == 2) { - if (strcmp(argv[1], "-s") != 0) { - return KDB_ARGCOUNT; - } - lookup_page = 1; - } else if (argc != 1) { + if (argc != 1) return KDB_ARGCOUNT; - } - nextarg = argc; + nextarg = 1; diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs); if (diag) return diag; - /* Assume argument is a page number, not address */ if (addr < PAGE_OFFSET) addr = (unsigned long) &mem_map[addr]; - /* Get the struct page * that corresponds to this addr */ - if (lookup_page) - { - addr = (unsigned long) virt_to_page(addr); - } - if ((diag = kdb_getarea(page, addr))) return(diag); kdb_printf("struct page at 0x%lx\n", addr); -/* kdb_printf(" next 0x%p prev 0x%p addr space 0x%p index %lu (offset 0x%x)\n", - page.list.next, page.list.prev, page.mapping, page.index, - (int)(page.index << PAGE_CACHE_SHIFT)); */ - kdb_printf(" addr space 0x%p index %lu (offset 0x%x)\n", + kdb_printf(" addr space 0x%p index %lu (offset 0x%llx)\n", page.mapping, page.index, - (int)(page.index << PAGE_CACHE_SHIFT)); + (unsigned long long)page.index << PAGE_CACHE_SHIFT); kdb_printf(" count %d flags %s\n", page.count.counter, page_flags(page.flags)); kdb_printf(" virtual 0x%p\n", page_address((struct page *)addr)); @@ -276,7 +259,7 @@ kdbm_rqueue(int argc, const char **argv, return 0; } -/* routine not used currently.. sync with upstream later + static void do_buffer(unsigned long addr) { @@ -285,13 +268,54 @@ do_buffer(unsigned long addr) if (kdb_getarea(bh, addr)) return; - kdb_printf("bh 0x%lx bno %8llu [%s]\n", addr, + kdb_printf(" bh 0x%lx bno %8llu [%s]", addr, (unsigned long long)bh.b_blocknr, map_flags(bh.b_state, bh_state_vals)); } -*/ -/* inode_struct changed in 2.6.6-rc series.. sync with upstream later +static void +kdbm_show_page(struct page *page, int first) +{ + if (first) + kdb_printf("page_struct index cnt zone nid flags\n"); + kdb_printf("%p%s %6lu %5d %3ld %3ld 0x%lx", + page_address(page), sizeof(void *) == 4 ? " " : "", + page->index, atomic_read(&(page->count)), + page_zonenum(page), page_to_nid(page), + page->flags & (~0UL >> ZONES_SHIFT)); +#define kdb_page_flags(page, type) if (Page ## type(page)) kdb_printf(" " #type); + kdb_page_flags(page, Locked); + kdb_page_flags(page, Error); + kdb_page_flags(page, Referenced); + kdb_page_flags(page, Uptodate); + kdb_page_flags(page, Dirty); + kdb_page_flags(page, LRU); + kdb_page_flags(page, Active); + kdb_page_flags(page, Slab); + kdb_page_flags(page, HighMem); + kdb_page_flags(page, Checked); + if (page->flags & (1UL << PG_arch_1)) + kdb_printf(" arch_1"); + kdb_page_flags(page, Reserved); + kdb_page_flags(page, Private); + kdb_page_flags(page, Writeback); + kdb_page_flags(page, Nosave); + if (page->flags & (1UL << PG_maplock)) + kdb_printf(" maplock"); + kdb_page_flags(page, Direct); + kdb_page_flags(page, MappedToDisk); + kdb_page_flags(page, Reclaim); + kdb_page_flags(page, Compound); + kdb_page_flags(page, Anon); + kdb_page_flags(page, SwapCache); + if (page_has_buffers(page)) + do_buffer((unsigned long) page_buffers(page)); + else if (page->private) + kdb_printf(" private=0x%lx", page->private); + kdb_printf("\n"); +#undef kdb_page_flags +} + static int kdbm_inode_pages(int argc, const char **argv, const char **envp, struct pt_regs *regs) @@ -302,12 +326,9 @@ kdbm_inode_pages(int argc, const char ** long offset=0; int nextarg; int diag; - int which=0; - - struct list_head *head, *curr; - - if (argc < 1) - return KDB_ARGCOUNT; + pgoff_t next = 0; + struct page *page; + int first; nextarg = 1; diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs); @@ -321,6 +342,7 @@ kdbm_inode_pages(int argc, const char ** if (diag) goto out; kdb_printf("Looking for page index 0x%lx ... \n", addr1); + next = addr1; } if (!(inode = kmalloc(sizeof(*inode), GFP_ATOMIC))) { @@ -340,58 +362,23 @@ kdbm_inode_pages(int argc, const char ** if ((diag = kdb_getarea(*ap, (unsigned long) inode->i_mapping))) goto out; - again: - if (which == 0){ - which=1; - head = &inode->i_mapping->clean_pages; - kdb_printf("CLEAN page_struct index cnt flags\n"); - } else if (which == 1) { - which=2; - head = &inode->i_mapping->dirty_pages; - kdb_printf("DIRTY page_struct index cnt flags\n"); - } else if (which == 2) { - which=3; - head = &inode->i_mapping->locked_pages; - kdb_printf("LOCKED page_struct index cnt flags\n"); - } else { - goto out; + /* Run the pages in the radix tree, printing the state of each page */ + first = 1; + while (radix_tree_gang_lookup(&ap->page_tree, (void **)&page, next, 1)) { + kdbm_show_page(page, first); + if (addr1) + break; + first = 0; + next = page->index + 1; } - - curr = head->next; - while (curr != head) { - struct page page; - struct list_head curr_struct; - - addr = (unsigned long) list_entry(curr, struct page, list); - if ((diag = kdb_getarea(page, addr))) - goto out; - - if (!addr1 || page.index == addr1 || - (addr1 == -1 && (page.flags & ( 1 << PG_locked)))) - { - kdb_printf(" 0x%lx %6lu %5d 0x%lx ", - addr, page.index, page.count.counter, - page.flags); - if (page_has_buffers(&page)) - do_buffer((unsigned long) page_buffers(&page)); - else - kdb_printf("bh [NULL]\n"); - } - - if ((diag = kdb_getarea(curr_struct, (unsigned long) curr))) - goto out; - - curr = curr_struct.next; - } - goto again; - out: + +out: if (inode) kfree(inode); if (ap) kfree(ap); return diag; } -*/ static int kdbm_inode(int argc, const char **argv, const char **envp, @@ -567,13 +554,12 @@ kdbm_memmap(int argc, const char **argv, static int __init kdbm_pg_init(void) { #ifndef CONFIG_DISCONTIGMEM - kdb_register("page", kdbm_page, "[-s] ", "Display page [or page of addr]", 0); + kdb_register("page", kdbm_page, "", "Display page", 0); #endif kdb_register("inode", kdbm_inode, "", "Display inode", 0); kdb_register("sb", kdbm_sb, "", "Display super_block", 0); kdb_register("bh", kdbm_buffers, "", "Display buffer", 0); -/* inode struct changed in 2.6.6-rc series.. sync with upstream later - kdb_register("inode_pages", kdbm_inode_pages, "", "Display pages in an inode", 0); */ + kdb_register("inode_pages", kdbm_inode_pages, "", "Display pages in an inode", 0); kdb_register("req", kdbm_request, "", "dump request struct", 0); kdb_register("rqueue", kdbm_rqueue, "", "dump request queue", 0); #if defined(CONFIG_X86) | defined(CONFIG_PPC64) ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From linas at austin.ibm.com Thu May 6 04:06:13 2004 From: linas at austin.ibm.com (linas at austin.ibm.com) Date: Wed, 5 May 2004 13:06:13 -0500 Subject: PCI errors [was Re: "sparse" warnings..] In-Reply-To: ; from torvalds@osdl.org on Tue, May 04, 2004 at 06:08:39PM -0700 References: <20040503123427.A30266@forte.austin.ibm.com> <20040503181439.B30266@forte.austin.ibm.com> <20040504121707.C30266@forte.austin.ibm.com> <20040504142559.D30266@forte.austin.ibm.com> <20040504193329.F30266@forte.austin.ibm.com> Message-ID: <20040505130613.I30266@forte.austin.ibm.com> On Tue, May 04, 2004 at 06:08:39PM -0700, Linus Torvalds wrote: > > On Tue, 4 May 2004 linas at austin.ibm.com wrote: > > > > Except that is not how the hardware works. Once you get the error, > > that's it, the device is blown up out of the water, its history. > > Its impossible to ignore this error. > > So? > Return garbage, and continue. > > There's nothing else you _can_ do. Go on with life. If the driver doesn't > have error recovery, what else woul you suggest? Well, I guess there are two discussion threads here, short answer is 'yes, that's right'. -- At the low level, 'what should the pio/mmio inb macros do' discussion, the answer is that the checks are there because the pSeries system architects have declared that the kernel should panic as soon as possible if the device driver doesn't know what to do with the EEH error. I'll see what I can do to review this decision, but it may take months. Some words of wisdom with your name attached to them may sway the outcome. (paulus & benh, if this comes up in whatever system-level architecture discussions you are privy to, let me know & sway the authorites as needed). The current philosophy is that it it better to panic than to risk unknown data corruption. Of course, why one would even have a non-EEH aware adapter in a system that is so dad-burned critical is a bit of a mystery to me. -- At the high level, as you point out, many device drivers already know how to deal with the all-ff's return value. I'm now mostly trying to understand the paths that a hotplug even may take, and make sure that things like resetting the slot state happen in all the right places. I'm mostly looking for the minimal soultion: to install any needed hooks in existing frameworks. For network type things, I'm looking at the hotplug framework. For scsi, I'm looking at the scsi reset sequence. Time will tell if this was the right thing to do. ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From linas at austin.ibm.com Thu May 6 04:20:42 2004 From: linas at austin.ibm.com (linas at austin.ibm.com) Date: Wed, 5 May 2004 13:20:42 -0500 Subject: [PATCH] fix KDB backtrace for ppc64 In-Reply-To: <20040505141647.GA4678@in.ibm.com>; from ananth@in.ibm.com on Wed, May 05, 2004 at 07:16:47PM +0500 References: <20040505141647.GA4678@in.ibm.com> Message-ID: <20040505132042.J30266@forte.austin.ibm.com> On Wed, May 05, 2004 at 07:16:47PM +0500, Ananth N Mavinakayanahalli wrote: > @@ -200,25 +196,49 @@ kdba_bt_stack_ppc(struct pt_regs *regs, > + if (!flag && (task_curr(p))) { > + > + lr = regs->link; Its not obvious that regs might not be a null pointer. Code higher up tries to make sure that regs is set to something, but its not clear that every branch is correctly handled. Other than that, the patch looks reasonable. --linas ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From greg at kroah.com Thu May 6 07:11:34 2004 From: greg at kroah.com (Greg KH) Date: Wed, 5 May 2004 14:11:34 -0700 Subject: [PATCH - revised] rpaphp doesn't initialize slot's name In-Reply-To: <4097E156.5040100@us.ibm.com> References: <40906502.4070009@us.ibm.com> <4097B40E.3070705@us.ibm.com> <200405041703.27131@bilbo.math.uni-mannheim.de> <200405041707.06360@bilbo.math.uni-mannheim.de> <4097E156.5040100@us.ibm.com> Message-ID: <20040505211134.GA28944@kroah.com> On Tue, May 04, 2004 at 01:30:46PM -0500, Linda Xie wrote: > Hi Eike & Greg, > > Attached is a revised version of rpaphp.patch. It has the following fixes: > - Set up slot->name > - Kill some dbgs > - Eike's fixes > - New fixes for incorrect "goto" in rpaphp_slot.c. Applied, thanks. greg k-h ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From jschopp at austin.ibm.com Thu May 6 08:10:58 2004 From: jschopp at austin.ibm.com (jschopp at austin.ibm.com) Date: Wed, 5 May 2004 17:10:58 -0500 (CDT) Subject: [PATCH] ppc64 cpu hotplug and SMT Message-ID: With SMT we need to reserve possible cpu slots for each SMT thread and not just for each cpu. The patch below fixes that. If there are no objections please put into ameslab and send upstream. --- ameslab-current/arch/ppc64/kernel/smp.c 2004-05-05 15:37:08.000000000 -0500 +++ new/arch/ppc64/kernel/smp.c 2004-05-05 15:37:49.000000000 -0500 @@ -463,6 +463,9 @@ static inline void look_for_more_cpus(vo maxcpus); /* Make those cpus (which might appear later) possible too. */ + if ((naca->smt_state == SMT_ON) || (naca->smt_state == SMT_DYNAMIC)) { + maxcpus *= 2; + } for (i = 0; i < maxcpus; i++) cpu_set(i, cpu_possible_map); } ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From kaos at sgi.com Thu May 6 08:50:46 2004 From: kaos at sgi.com (Keith Owens) Date: Thu, 06 May 2004 08:50:46 +1000 Subject: [PATCH] fix KDB backtrace for ppc64 In-Reply-To: Your message of "Wed, 05 May 2004 12:54:59 MST." Message-ID: <18056.1083797446@ocs3.ocs.com.au> On Wed, 5 May 2004 12:54:59 -0700, Haren Myneni wrote: >regs will be NULL if we use sysrq-trigger to invoke SysRq key. Noticed on >LKCD, but not sure whether it could apply on KDB. >Example: echo 'd' > /proc/sysrq-trigger. IA64 SN2 console had the same problem, not running in the interrupt handler so no registers. drivers/char/sn_serial.c uses KDB_ENTER() to get registers. #ifdef CONFIG_KDB if (kdb_on) { if (ch == *kdb_serial_ptr) { if (!(*++kdb_serial_ptr)) { spin_unlock_irqrestore(&sn_sal_lock, *flags); if (!regs) KDB_ENTER(); /* to get some registers */ else kdb(KDB_REASON_KEYBOARD, 0, regs); kdb_serial_ptr = (char *)kdb_serial_str; spin_lock_irqsave(&sn_sal_lock, *flags); break; } } else kdb_serial_ptr = (char *)kdb_serial_str; } #endif /* CONFIG_KDB */ ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From linas at austin.ibm.com Thu May 6 09:30:10 2004 From: linas at austin.ibm.com (linas at austin.ibm.com) Date: Wed, 5 May 2004 18:30:10 -0500 Subject: [PATCH] eeh crash on NULL dn-type Message-ID: <20040505183010.L30266@forte.austin.ibm.com> Hi Anton, Tripped over a "fixed bug". I'm crashing in eeh.c in if (!strcmp(dn->type, "isa")) because the device node dn->type is NULL. This kernel has your earlier patch in it to always set dn->type to something, for example, to the string "". Unfortunately, it did this only during boot, and not during hotplug. I get this during testing of PCI hotplug with traffic on the net. I think what is happening is that as the card is still being hotplug-enabled, the network traffic causes ethernet interrupts to start flowing, one of which provokes an eeh_check_failure() which does the bad strcmp. As far as I can tell, this is a race condition; there's no crash if the network is quiet during the hotplug add. I'm not planning on exploring the source of the race condition unless someone kicks me; I'm happy to patch the symptom, mostly cause I don't think anyone else is affected. :) kick me if you disagree. Attached is an old patch that was never applied. Please apply. --linas p.s. do the distros require a bugzilla to pick this up? should I open a bugzilla? -------------- next part -------------- --- arch/ppc64/kernel/eeh.c.orig 2004-04-12 12:02:49.000000000 -0500 +++ arch/ppc64/kernel/eeh.c 2004-04-12 12:04:11.000000000 -0500 @@ -487,9 +487,9 @@ unsigned long eeh_check_failure(void *to dn->eeh_mode & EEH_MODE_NOCHECK) goto ok_return; - /* Make sure we aren't ISA */ - if (!strcmp(dn->type, "isa")) - goto ok_return; + /* Make sure we aren't ISA */ + if (dn->type && !strcmp(dn->type, "isa")) + goto ok_return; if (!dn->eeh_config_addr) goto ok_return; From ananth at in.ibm.com Thu May 6 16:34:09 2004 From: ananth at in.ibm.com (Ananth N Mavinakayanahalli) Date: Thu, 6 May 2004 11:34:09 +0500 Subject: [PATCH] fix KDB backtrace for ppc64 (reworked) In-Reply-To: <20040505132042.J30266@forte.austin.ibm.com> References: <20040505141647.GA4678@in.ibm.com> <20040505132042.J30266@forte.austin.ibm.com> Message-ID: <20040506063409.GA6068@in.ibm.com> On Wed, May 05, 2004 at 01:20:42PM -0500, linas at austin.ibm.com wrote: > > On Wed, May 05, 2004 at 07:16:47PM +0500, Ananth N Mavinakayanahalli wrote: > > @@ -200,25 +196,49 @@ kdba_bt_stack_ppc(struct pt_regs *regs, > > + if (!flag && (task_curr(p))) { > > + > > + lr = regs->link; > > Its not obvious that regs might not be a null pointer. Code > higher up tries to make sure that regs is set to something, > but its not clear that every branch is correctly handled. > Right.. Here is a reworked patch that handles NULL regs. Anton, Please consider this patch for inclusion to Ameslab. Thanks, Ananth -- Ananth Narayan Linux Technology Center, IBM Software Lab, INDIA diff -Naurp temp/ameslab/arch/ppc64/kdb/kdba_bt.c ameslab/arch/ppc64/kdb/kdba_bt.c --- temp/ameslab/arch/ppc64/kdb/kdba_bt.c 2004-04-22 21:52:09.000000000 -0700 +++ ameslab/arch/ppc64/kdb/kdba_bt.c 2004-05-05 22:06:39.401239784 -0700 @@ -101,17 +101,15 @@ kdba_bt_stack_ppc(struct pt_regs *regs, struct task_struct *p, int regs_esp) { - kdb_machreg_t esp,eip,ebp,old_esp; -/* kdb_symtab_t symtab, *sym; */ - kdbtbtable_t tbtab; + kdb_machreg_t esp, eip, ebp, old_esp; /* declare these as raw ptrs so we don't get func descriptors */ extern void *ret_from_except, *ret_from_syscall_1; -/* int do_bottom_half_ret=0; */ const char *name; - char namebuf[128]; - unsigned long symsize,symoffset; + unsigned long symsize, symoffset; char *symmodname; + int flag = 0; + char namebuf[128]; /* * The caller may have supplied an address at which the @@ -155,7 +153,8 @@ kdba_bt_stack_ppc(struct pt_regs *regs, kdb_printf(" SP(esp) PC(eip) Function(args)\n"); - /* (Ref: 64-bit PowerPC ELF ABI Spplement; Ian Lance Taylor, Zembu Labs). + /* (Ref: 64-bit PowerPC ELF ABI Supplement: + Ian Lance Taylor, Zembu Labs). A PPC stack frame looks like this: High Address @@ -180,18 +179,15 @@ kdba_bt_stack_ppc(struct pt_regs *regs, */ while (1) { kdb_printf("0x%016lx 0x%016lx ", esp, eip); - /* kdbnearsym(eip, &symtab); */ - kdba_find_tb_table(eip, &tbtab); - - /* sym = symtab.sym_name ? &symtab : &tbtab.symtab; */ - /* use fake symtab if necessary */ name = NULL; if (esp >= PAGE_OFFSET) { - /*if ((sym) )*/ - /* if this fails, eip is outside of kernel space, dont trust it. */ + /* + * if this fails, eip is outside of kernel space, + * dont trust it. + */ if (eip > PAGE_OFFSET) { - name = kallsyms_lookup(eip, &symsize, &symoffset, &symmodname, - namebuf); + name = kallsyms_lookup(eip, &symsize, + &symoffset, &symmodname, namebuf); } if (name) { kdb_printf("%s", name); @@ -200,25 +196,50 @@ kdba_bt_stack_ppc(struct pt_regs *regs, } } - /* if this fails, eip is outside of kernel space, dont trust data. */ + /* + * if this fails, eip is outside of kernel space, + * dont trust data. + */ if (eip > PAGE_OFFSET) { if (eip - symoffset > 0) { kdb_printf(" +0x%lx", /*eip -*/ symoffset); } } kdb_printf("\n"); + if (!flag && (task_curr(p))) { + kdb_machreg_t lr; + unsigned long start = 0, end = 0; + + flag++; + if ((!regs) || (regs->link < PAGE_OFFSET) || + (regs->link == eip)) + goto next_frame; + + lr = regs->link; + start = eip - symoffset; + end = eip - symoffset + symsize; + if (lr >= start && lr < end) + goto next_frame; + + name = NULL; + name = kallsyms_lookup(lr, &symsize, + &symoffset, &symmodname, namebuf); + if (name) + kdb_printf("0x%016lx 0x%016lx (lr) %s +0x%lx\n", + esp, lr, name, symoffset); + } - /* ret_from_except=0xa5e0 ret_from_syscall_1=a378 do_bottom_half_ret=a5e0 */ +next_frame: if (esp < PAGE_OFFSET) { /* below kernelspace.. */ kdb_printf("\n", esp ); break; } else { if (eip == (kdb_machreg_t)ret_from_except || - eip == (kdb_machreg_t)ret_from_syscall_1 /* || - eip == (kdb_machreg_t)do_bottom_half_ret */) { + eip == (kdb_machreg_t)ret_from_syscall_1) { /* pull exception regs from the stack */ struct pt_regs eregs; - kdba_getmem(esp+STACK_FRAME_OVERHEAD, &eregs, sizeof(eregs)); + kdba_getmem(esp+STACK_FRAME_OVERHEAD, + &eregs, sizeof(eregs)); kdb_printf(" [exception: %lx:%s regs 0x%lx] " "nip:[0x%lx] gpr[1]:[0x%lx]\n", eregs.trap,getvecname(eregs.trap), @@ -236,7 +257,10 @@ kdba_bt_stack_ppc(struct pt_regs *regs, break; } } - /* we want to follow exception registers, not into user stack. ... */ + /* + * we want to follow exception registers, + * not into user stack. ... + */ esp = eregs.gpr[1]; eip = eregs.nip; } else { diff -Naurp temp/ameslab/kdb/ChangeLog ameslab/kdb/ChangeLog --- temp/ameslab/kdb/ChangeLog 2004-05-04 02:07:51.000000000 -0700 +++ ameslab/kdb/ChangeLog 2004-05-05 02:51:18.168228408 -0700 @@ -1,3 +1,8 @@ +2004-04-30 Keith Owens + + * Rewrite inode_pages command for new radix code in struct page. + * kdb v4.3-2.6.6-rc1-common-1. + 2004-04-11 Keith Owens * Unlock sn_sal_lock before entering kdb from sn_serial. diff -Naurp temp/ameslab/kdb/gen-kdb_cmds.c ameslab/kdb/gen-kdb_cmds.c --- temp/ameslab/kdb/gen-kdb_cmds.c 2004-04-22 21:54:41.000000000 -0700 +++ ameslab/kdb/gen-kdb_cmds.c 1969-12-31 16:00:00.000000000 -0800 @@ -1,4 +0,0 @@ -#include -char __initdata *kdb_cmds[] = { - 0 -}; diff -Naurp temp/ameslab/kdb/modules/kdbm_pg.c ameslab/kdb/modules/kdbm_pg.c --- temp/ameslab/kdb/modules/kdbm_pg.c 2004-05-04 02:07:51.000000000 -0700 +++ ameslab/kdb/modules/kdbm_pg.c 2004-05-05 03:07:16.033237072 -0700 @@ -151,42 +151,25 @@ kdbm_page(int argc, const char **argv, c long offset=0; int nextarg; int diag; - int lookup_page = 0; - if (argc == 2) { - if (strcmp(argv[1], "-s") != 0) { - return KDB_ARGCOUNT; - } - lookup_page = 1; - } else if (argc != 1) { + if (argc != 1) return KDB_ARGCOUNT; - } - nextarg = argc; + nextarg = 1; diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs); if (diag) return diag; - /* Assume argument is a page number, not address */ if (addr < PAGE_OFFSET) addr = (unsigned long) &mem_map[addr]; - /* Get the struct page * that corresponds to this addr */ - if (lookup_page) - { - addr = (unsigned long) virt_to_page(addr); - } - if ((diag = kdb_getarea(page, addr))) return(diag); kdb_printf("struct page at 0x%lx\n", addr); -/* kdb_printf(" next 0x%p prev 0x%p addr space 0x%p index %lu (offset 0x%x)\n", - page.list.next, page.list.prev, page.mapping, page.index, - (int)(page.index << PAGE_CACHE_SHIFT)); */ - kdb_printf(" addr space 0x%p index %lu (offset 0x%x)\n", + kdb_printf(" addr space 0x%p index %lu (offset 0x%llx)\n", page.mapping, page.index, - (int)(page.index << PAGE_CACHE_SHIFT)); + (unsigned long long)page.index << PAGE_CACHE_SHIFT); kdb_printf(" count %d flags %s\n", page.count.counter, page_flags(page.flags)); kdb_printf(" virtual 0x%p\n", page_address((struct page *)addr)); @@ -276,7 +259,7 @@ kdbm_rqueue(int argc, const char **argv, return 0; } -/* routine not used currently.. sync with upstream later + static void do_buffer(unsigned long addr) { @@ -285,13 +268,54 @@ do_buffer(unsigned long addr) if (kdb_getarea(bh, addr)) return; - kdb_printf("bh 0x%lx bno %8llu [%s]\n", addr, + kdb_printf(" bh 0x%lx bno %8llu [%s]", addr, (unsigned long long)bh.b_blocknr, map_flags(bh.b_state, bh_state_vals)); } -*/ -/* inode_struct changed in 2.6.6-rc series.. sync with upstream later +static void +kdbm_show_page(struct page *page, int first) +{ + if (first) + kdb_printf("page_struct index cnt zone nid flags\n"); + kdb_printf("%p%s %6lu %5d %3ld %3ld 0x%lx", + page_address(page), sizeof(void *) == 4 ? " " : "", + page->index, atomic_read(&(page->count)), + page_zonenum(page), page_to_nid(page), + page->flags & (~0UL >> ZONES_SHIFT)); +#define kdb_page_flags(page, type) if (Page ## type(page)) kdb_printf(" " #type); + kdb_page_flags(page, Locked); + kdb_page_flags(page, Error); + kdb_page_flags(page, Referenced); + kdb_page_flags(page, Uptodate); + kdb_page_flags(page, Dirty); + kdb_page_flags(page, LRU); + kdb_page_flags(page, Active); + kdb_page_flags(page, Slab); + kdb_page_flags(page, HighMem); + kdb_page_flags(page, Checked); + if (page->flags & (1UL << PG_arch_1)) + kdb_printf(" arch_1"); + kdb_page_flags(page, Reserved); + kdb_page_flags(page, Private); + kdb_page_flags(page, Writeback); + kdb_page_flags(page, Nosave); + if (page->flags & (1UL << PG_maplock)) + kdb_printf(" maplock"); + kdb_page_flags(page, Direct); + kdb_page_flags(page, MappedToDisk); + kdb_page_flags(page, Reclaim); + kdb_page_flags(page, Compound); + kdb_page_flags(page, Anon); + kdb_page_flags(page, SwapCache); + if (page_has_buffers(page)) + do_buffer((unsigned long) page_buffers(page)); + else if (page->private) + kdb_printf(" private=0x%lx", page->private); + kdb_printf("\n"); +#undef kdb_page_flags +} + static int kdbm_inode_pages(int argc, const char **argv, const char **envp, struct pt_regs *regs) @@ -302,12 +326,9 @@ kdbm_inode_pages(int argc, const char ** long offset=0; int nextarg; int diag; - int which=0; - - struct list_head *head, *curr; - - if (argc < 1) - return KDB_ARGCOUNT; + pgoff_t next = 0; + struct page *page; + int first; nextarg = 1; diag = kdbgetaddrarg(argc, argv, &nextarg, &addr, &offset, NULL, regs); @@ -321,6 +342,7 @@ kdbm_inode_pages(int argc, const char ** if (diag) goto out; kdb_printf("Looking for page index 0x%lx ... \n", addr1); + next = addr1; } if (!(inode = kmalloc(sizeof(*inode), GFP_ATOMIC))) { @@ -340,58 +362,23 @@ kdbm_inode_pages(int argc, const char ** if ((diag = kdb_getarea(*ap, (unsigned long) inode->i_mapping))) goto out; - again: - if (which == 0){ - which=1; - head = &inode->i_mapping->clean_pages; - kdb_printf("CLEAN page_struct index cnt flags\n"); - } else if (which == 1) { - which=2; - head = &inode->i_mapping->dirty_pages; - kdb_printf("DIRTY page_struct index cnt flags\n"); - } else if (which == 2) { - which=3; - head = &inode->i_mapping->locked_pages; - kdb_printf("LOCKED page_struct index cnt flags\n"); - } else { - goto out; + /* Run the pages in the radix tree, printing the state of each page */ + first = 1; + while (radix_tree_gang_lookup(&ap->page_tree, (void **)&page, next, 1)) { + kdbm_show_page(page, first); + if (addr1) + break; + first = 0; + next = page->index + 1; } - - curr = head->next; - while (curr != head) { - struct page page; - struct list_head curr_struct; - - addr = (unsigned long) list_entry(curr, struct page, list); - if ((diag = kdb_getarea(page, addr))) - goto out; - - if (!addr1 || page.index == addr1 || - (addr1 == -1 && (page.flags & ( 1 << PG_locked)))) - { - kdb_printf(" 0x%lx %6lu %5d 0x%lx ", - addr, page.index, page.count.counter, - page.flags); - if (page_has_buffers(&page)) - do_buffer((unsigned long) page_buffers(&page)); - else - kdb_printf("bh [NULL]\n"); - } - - if ((diag = kdb_getarea(curr_struct, (unsigned long) curr))) - goto out; - - curr = curr_struct.next; - } - goto again; - out: + +out: if (inode) kfree(inode); if (ap) kfree(ap); return diag; } -*/ static int kdbm_inode(int argc, const char **argv, const char **envp, @@ -567,13 +554,12 @@ kdbm_memmap(int argc, const char **argv, static int __init kdbm_pg_init(void) { #ifndef CONFIG_DISCONTIGMEM - kdb_register("page", kdbm_page, "[-s] ", "Display page [or page of addr]", 0); + kdb_register("page", kdbm_page, "", "Display page", 0); #endif kdb_register("inode", kdbm_inode, "", "Display inode", 0); kdb_register("sb", kdbm_sb, "", "Display super_block", 0); kdb_register("bh", kdbm_buffers, "", "Display buffer", 0); -/* inode struct changed in 2.6.6-rc series.. sync with upstream later - kdb_register("inode_pages", kdbm_inode_pages, "", "Display pages in an inode", 0); */ + kdb_register("inode_pages", kdbm_inode_pages, "", "Display pages in an inode", 0); kdb_register("req", kdbm_request, "", "dump request struct", 0); kdb_register("rqueue", kdbm_rqueue, "", "dump request queue", 0); #if defined(CONFIG_X86) | defined(CONFIG_PPC64) ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From sfr at canb.auug.org.au Thu May 6 18:01:48 2004 From: sfr at canb.auug.org.au (Stephen Rothwell) Date: Thu, 6 May 2004 18:01:48 +1000 Subject: [PATCH] PPC64 iSeries: replace semaphores with completions Message-ID: <20040506180148.45f3063e.sfr@canb.auug.org.au> Hi Linus, This patch replaces some usages of sempahores on the stack with completions. We think we have had at least one bug report that could be caused by the inherent race in the semaphore usage. Please apply. -- Cheers, Stephen Rothwell sfr at canb.auug.org.au http://www.canb.auug.org.au/~sfr/ -------------- next part -------------- diff -ruN ppc64-linux-2.5/arch/ppc64/kernel/mf.c ppc64-linux-2.5.mf.1/arch/ppc64/kernel/mf.c --- ppc64-linux-2.5/arch/ppc64/kernel/mf.c 2004-04-02 13:29:11.000000000 +1000 +++ ppc64-linux-2.5.mf.1/arch/ppc64/kernel/mf.c 2004-05-06 16:52:22.000000000 +1000 @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -81,7 +82,7 @@ }; struct VspRspData { - struct semaphore *sem; + struct completion com; struct VspCmdData *response; }; @@ -276,12 +277,11 @@ struct pending_event *ev = new_pending_event(); int rc; struct VspRspData response; - DECLARE_MUTEX_LOCKED(Semaphore); if (ev == NULL) return -ENOMEM; - response.sem = &Semaphore; + init_completion(&response.com); response.response = vspCmd; ev->event.hp_lp_event.xSubtype = 6; ev->event.hp_lp_event.x.xSubtypeData = @@ -297,7 +297,7 @@ rc = signal_event(ev); if (rc == 0) - down(&Semaphore); + wait_for_completion(&response.com); return rc; } @@ -477,8 +477,7 @@ if (rsp != NULL) { if (rsp->response != NULL) memcpy(rsp->response, &(event->data.vsp_cmd), sizeof(event->data.vsp_cmd)); - if (rsp->sem != NULL) - up(rsp->sem); + complete(&rsp->com); } else printk(KERN_ERR "mf.c: no rsp\n"); freeIt = 1; @@ -919,7 +918,7 @@ } struct RtcTimeData { - struct semaphore *sem; + struct completion com; struct CeMsgData xCeMsg; int xRc; }; @@ -930,7 +929,7 @@ memcpy(&(rtc->xCeMsg), ceMsg, sizeof(rtc->xCeMsg)); rtc->xRc = 0; - up(rtc->sem); + complete(&rtc->com); } static unsigned long lastsec = 1; @@ -978,17 +977,16 @@ struct CeMsgCompleteData ceComplete; struct RtcTimeData rtcData; int rc; - DECLARE_MUTEX_LOCKED(Semaphore); memset(&ceComplete, 0, sizeof(ceComplete)); memset(&rtcData, 0, sizeof(rtcData)); - rtcData.sem = &Semaphore; + init_completion(&rtcData.com); ceComplete.handler = &getRtcTimeComplete; ceComplete.token = (void *)&rtcData; rc = signal_ce_msg("\x00\x00\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00", &ceComplete); if (rc == 0) { - down(&Semaphore); + wait_for_completion(&rtcData.com); if (rtcData.xRc == 0) { if ((rtcData.xCeMsg.ce_msg[2] == 0xa9) || From nfont at austin.ibm.com Fri May 7 02:18:44 2004 From: nfont at austin.ibm.com (Nathan Fontenot) Date: Thu, 06 May 2004 11:18:44 -0500 Subject: [PATCH] fix ras irq handlers Message-ID: <1083860324.3702.8.camel@mudbug.austin.ibm.com> Anton, A recent Bugzilla revealed that we were not checking all the appropriate properties when initializing the ras irq handlers which led to epow events being missed completely. The attached patch corrects this by looking for the "interrupts" property in addition to the "open-pic-interrupt" property. This also updates chrp_setup to initialize ppc_md.log_error to pSeries_log_error. It appears that this used to be in the code, but was removed at some point. Without it calls to log_error go nowhere. This patch is already in the SuSE sles 9 beta. If no one has any problems, could you please apply to Ameslab. Thanks. -- Nathan Fontenot Power Linux Platform Serviceability Home: IBM Austin 905/4C-018 Phone: 512.838.3377 (T/L 678.3377) Email: nfont at austin.ibm.com -------------- next part -------------- A non-text attachment was scrubbed... Name: ras_irq.patch Type: text/x-patch Size: 7561 bytes Desc: not available Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20040506/5625ac74/attachment.bin From hollisb at us.ibm.com Fri May 7 05:28:55 2004 From: hollisb at us.ibm.com (Hollis Blanchard) Date: Thu, 6 May 2004 14:28:55 -0500 Subject: hvconsole.c : possible problem In-Reply-To: <1083128727.20089.57.camel@gaston> References: <1083128727.20089.57.camel@gaston> Message-ID: <9D18B6BC-9F93-11D8-9FCB-000A95A0560C@us.ibm.com> On Apr 28, 2004, at 12:05 AM, Benjamin Herrenschmidt wrote: > - The whole wait_for_packet() is completely synchronous (doesn't > schedule), that doesn't sound very good. Can't do schedule(). wait_for_packet() is called at init time, as a console_initcall, to handshake with the service processor. console_init() is called under lock_kernel()... bad: scheduling while atomic! I'm sure other code is in this same position. Is it a good idea to do something like if (in_atomic()) usleep() else schedule() ? -- Hollis Blanchard IBM Linux Technology Center ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From rsa at us.ibm.com Fri May 7 06:55:21 2004 From: rsa at us.ibm.com (Ryan Arnold) Date: 06 May 2004 15:55:21 -0500 Subject: [PATCH] hvcs build warning fixes In-Reply-To: <1083702758.27507.1945.camel@SigurRos.rchland.ibm.com> References: <1083702758.27507.1945.camel@SigurRos.rchland.ibm.com> Message-ID: <1083876921.16102.1961.camel@SigurRos.rchland.ibm.com> Since this patch hasn't garnered any interest I'm going to submit it to the list for review again. As stated before, this patch contains compile warning fixes for hvcs.c and has been tested. I'd like to check it into Ameslab tomorrow (Friday May 07) or someone else can check it in if that is the preferred method. Ryan S. Arnold -------------- next part -------------- --- linux-2.5/drivers/char/hvcs.c 2004-05-03 14:18:31.000000000 -0500 +++ hvcs_warn_linux-2.5/drivers/char/hvcs.c 2004-05-03 15:23:23.000000000 -0500 @@ -110,9 +110,9 @@ static int hvcs_parm_num_devs = -1; module_param(hvcs_parm_num_devs, int, 0); -static const char hvcs_driver_name[] = "hvcs"; -static const char hvcs_device_node[] = "hvcs"; -static const char hvcs_driver_string[] +char hvcs_driver_name[] = "hvcs"; +char hvcs_device_node[] = "hvcs"; +char hvcs_driver_string[] = "IBM hvcs (Hypervisor Virtual Console Server) Driver"; /* Status of partner info rescan triggered via sysfs. */ @@ -154,7 +154,7 @@ static struct list_head hvcs_structs = LIST_HEAD_INIT(hvcs_structs); -static void hvcs_read_task(unsigned long data); +static void hvcs_read_task(void * data); static void hvcs_unthrottle(struct tty_struct *tty); static void hvcs_throttle(struct tty_struct *tty); static irqreturn_t hvcs_handle_interrupt(int irq, void *dev_instance, struct pt_regs *regs); @@ -185,7 +185,7 @@ static void hvcs_remove_driver_attrs(void); static int __devinit hvcs_probe(struct vio_dev *dev, const struct vio_device_id *id); -static void __devexit hvcs_remove(struct vio_dev *dev); +static int __devexit hvcs_remove(struct vio_dev *dev); static int __init hvcs_module_init(void); static void __exit hvcs_module_exit(void); @@ -195,7 +195,7 @@ * throttle and we want to be able to reschedule ourselves to run AFTER a * push is scheduled so that we know when the tty is properly throttled. */ -static void hvcs_read_task(unsigned long data) +static void hvcs_read_task(void * data) { struct hvcs_struct *hvcsd = (struct hvcs_struct *)data; unsigned int unit_address = hvcsd->vdev->unit_address; @@ -295,7 +295,7 @@ if (!dev || !id) { printk(KERN_ERR "HVCS: driver probed with invalid parm.\n"); - return; + return -EPERM; } printk(KERN_INFO "HVCS: Added vty-server@%X.\n", dev->unit_address); @@ -319,7 +319,7 @@ hvcsd->index = ++hvcs_struct_count; - INIT_WORK(&hvcsd->read_work, hvcs_read_task, (unsigned long)hvcsd); + INIT_WORK(&hvcsd->read_work, hvcs_read_task, hvcsd); hvcsd->enabled = 0; @@ -345,12 +345,12 @@ return 0; } -static void __devexit hvcs_remove(struct vio_dev *dev) +static int __devexit hvcs_remove(struct vio_dev *dev) { struct hvcs_struct *hvcsd = (struct hvcs_struct *)dev->driver_data; if (!hvcsd) - return; + return -ENODEV; printk(KERN_INFO "HVCS: Removing vty-server@%X.\n", dev->unit_address); @@ -379,13 +379,14 @@ * which would probably be tty_hangup. */ kobject_put (&hvcsd->kobj); + return 0; }; static struct vio_driver hvcs_vio_driver = { - .name = &hvcs_driver_name, + .name = hvcs_driver_name, .id_table = hvcs_driver_table, .probe = hvcs_probe, - .remove = __devexit_p(hvcs_remove), + .remove = hvcs_remove, }; /* Only called from hvcs_get_pi please */ From benh at kernel.crashing.org Fri May 7 08:12:40 2004 From: benh at kernel.crashing.org (Benjamin Herrenschmidt) Date: Fri, 07 May 2004 08:12:40 +1000 Subject: hvconsole.c : possible problem In-Reply-To: <9D18B6BC-9F93-11D8-9FCB-000A95A0560C@us.ibm.com> References: <1083128727.20089.57.camel@gaston> <9D18B6BC-9F93-11D8-9FCB-000A95A0560C@us.ibm.com> Message-ID: <1083881560.19140.99.camel@gaston> On Fri, 2004-05-07 at 05:28, Hollis Blanchard wrote: > On Apr 28, 2004, at 12:05 AM, Benjamin Herrenschmidt wrote: > > - The whole wait_for_packet() is completely synchronous (doesn't > > schedule), that doesn't sound very good. > > Can't do schedule(). wait_for_packet() is called at init time, as a > console_initcall, to handshake with the service processor. > console_init() is called under lock_kernel()... > bad: scheduling while atomic! Ugh ? You can schedule in lock_kernel iirc ... Maybe not any more... Well, you can probably just test for system_state before scheduling. > I'm sure other code is in this same position. Is it a good idea to do > something like > if (in_atomic()) > usleep() > else > schedule() No. If the problem is only about console_init(), system state should be enough. Ben. ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From haveblue at us.ibm.com Fri May 7 10:18:08 2004 From: haveblue at us.ibm.com (Dave Hansen) Date: Thu, 06 May 2004 17:18:08 -0700 Subject: [PATCH] fix NUMA topology parsing Message-ID: <1083889087.2811.1340.camel@nighthawk> The OpenFirmware tables that specify CPU and memory topology end up looking something like this: CPU 0: 0 0 0 1: 0 0 0 2: 0 1 1 3: 0 1 1 Memory: 0: 0 0 0 0 1: 0 0 0 1 2: 0 0 0 2 3: 0 0 f 3 4: 0 1 1 4 5: 0 1 1 5 6: 0 1 1 6 7: 0 1 1 7 What we do right now is use the lowest topology level that both memory and CPUs have. So, in this case, the 3rd column. The problem is that the 3rd column has some gunk in it for some reason. The hardware docs suggests using the first level where 2 resources differ to determine how far apart they are. This patch does that, and ends up picking the 2nd level instead. Patch is against 2.6.5. Tested on 64GB 8-way POWER4. -- Dave ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From anton at samba.org Fri May 7 17:15:32 2004 From: anton at samba.org (Anton Blanchard) Date: Fri, 7 May 2004 17:15:32 +1000 Subject: [PATCH] fix KDB backtrace for ppc64 In-Reply-To: <20040505141647.GA4678@in.ibm.com> References: <20040505141647.GA4678@in.ibm.com> Message-ID: <20040507071532.GJ10918@krispykreme> Hi Ananth, > Here is a patch that fixes backtracing in KDB for ppc64. We were not > handling the link register and were missing an intermediate call > during bt. Have you seen Pauls changes to arch/ppc64/kernel/process.c:show_stack in ameslab-2.5? It uses a trick to find exception frames and dump them correctly. I think it would be good to get the same magic into kdb. Anton ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From kaos at sgi.com Fri May 7 17:50:36 2004 From: kaos at sgi.com (Keith Owens) Date: Fri, 07 May 2004 17:50:36 +1000 Subject: [PATCH] fix KDB backtrace for ppc64 In-Reply-To: Your message of "Fri, 07 May 2004 17:15:32 +1000." <20040507071532.GJ10918@krispykreme> Message-ID: <11328.1083916236@kao2.melbourne.sgi.com> On Fri, 7 May 2004 17:15:32 +1000, Anton Blanchard wrote: > >Hi Ananth, > >> Here is a patch that fixes backtracing in KDB for ppc64. We were not >> handling the link register and were missing an intermediate call >> during bt. > >Have you seen Pauls changes to arch/ppc64/kernel/process.c:show_stack in >ameslab-2.5? It uses a trick to find exception frames and dump them >correctly. I think it would be good to get the same magic into kdb. No, but even without seeing the code, I can state that it will be arch specific. There is no way to find the exception frame in ia64 when starting without registers, the unwind code requires the exception frame just to get started. It is better for the common code to detect the condition of no registers and use KDB_ENTER() instead of a direct call to kdb(). ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From rsa at us.ibm.com Sat May 8 04:05:24 2004 From: rsa at us.ibm.com (Ryan Arnold) Date: 07 May 2004 13:05:24 -0500 Subject: [PATCH] hvcs - comment, printk, and functionality cleanup Message-ID: <1083953125.27507.1983.camel@SigurRos.rchland.ibm.com> Greetings, This patch is part 3 of my originally proposed hvcs.diff patch. It returns some of the driver architectural overview to the driver source file (since there wasn't enough to warrant a full document and it doesn't belong in the installation guide). This patch also cleans up printk's and formatting issues in the driver. Additionally some functional changes were made in relation to vio interrupt disabling. We don't need to be controlling ints at the granularity that we were since firmware handles term data ints in an interesting way (ask and I'll tell), so I removed the disables/enables from the int handler and read task and allow firmware to handle the enables/disables itself. Finally, it adds a Q&A block to the Documentation/powerpc/hvcs.txt file for describing how to get line wrapping to work in minicom. This is mainly to document that line wrap problems are not natively an hvcs problem with CR & LF. Please review if interested. I'd like to check this into Ameslab early next week. The resultant code is the basis for the code I'm going to be submitting to the LKML next week for inclusion into the mainline tree. I checked in part 2 this morning. This diff is against the latest drivers/char/hvcs.c in the Ameslab tree (including this morning's patch). Ryan S. Arnold IBM Linux Technology Center -------------- next part -------------- --- linux-2.5/drivers/char/hvcs.c 2004-05-07 09:25:58.000000000 -0500 +++ hvcs_cleanup_linux-2.5/drivers/char/hvcs.c 2004-05-07 08:42:02.000000000 -0500 @@ -27,11 +27,44 @@ * practical on this hardware so system consoles are accessed by this driver * using inter-partition firmware interfaces to virtual terminal devices. * + * A vty is known to the HMC as a "virtual serial server adapter". It is a + * virtual terminal device that is created by firmware upon partition creation + * to act as a partitioned OS's console device. + * + * Firmware dynamically (via hotplug) exposes vty-servers to a running ppc64 + * Linux system upon their creation by the HMC or their exposure during boot. + * The non-user interactive backend of this driver is implemented as a vio + * device driver so that it can receive notification of vty-server lifetimes + * after it registers with the vio bus to handle vty-server probe and remove + * callbacks. + * + * Many vty-servers can be configured to connect to one vty, but a vty can + * only be actively connected to by a single vty-server, in any manner, at one + * time. If the HMC is currently hosting the console for a target Linux + * partition; attempts to open the tty device to the partition's console using + * the hvcs on any partition will return -EBUSY with every open attempt until + * the HMC frees the connection between its vty-server and the desired + * partition's vty device. Conversely, a vty-server may only be connected to + * a single vty at one time even though it may have several configured vty + * partner possibilities. + * + * Firmware does not provide notification of vty partner changes to this + * driver. This means that an HMC Super Admin may add or remove partner vtys + * from a vty-server's partner list but the changes will not be signaled to + * the vty-server. Firmware only notifies the driver when a vty-server is + * added or removed from the system. To compensate for this deficiency, this + * driver implements a sysfs update attribute which provides a method for + * rescanning partner information upon a user's request. + * + * Each vty-server, prior to being exposed to this driver is reference counted + * using the 2.6 Linux kernel kobject construct. This kobject is also used by + * the vio bus to provide a vio device sysfs entry that this driver attaches + * device specific attributes to, including partner information. The vio bus + * framework also provides a sysfs entry for each vio driver. The hvcs driver + * provides driver attributes in this entry. + * * For direction on installation and usage of this driver please reference * Documentation/powerpc/hvcs.txt. - * - * For an architectural overview of this driver please reference - * Documentation/powerpc/hvcs_arch.txt */ #include @@ -125,8 +158,8 @@ * and hvcs index numbers are not re-used after device removal * otherwise removing and adding a new one would link a /dev/hvcs* * entry to a different vty-server than it did before the removal. - * This means that a newly exposed vty-server will always map to - * an incrementally higher /dev/hvcs* entry than last exposed + * Incidentally, a newly exposed vty-server will always map to + * an incrementally higher /dev/hvcs* entry than the last exposed * vty-server. */ static int hvcs_struct_count = -1; @@ -190,10 +223,10 @@ static void __exit hvcs_module_exit(void); /* This task is scheduled to execute out of the read data interrupt - * handler, the hvcs_unthrottle, and it can be rescheduled out of itself. - * This task reschedules itself because every flip_buffer_push may cause a - * throttle and we want to be able to reschedule ourselves to run AFTER a - * push is scheduled so that we know when the tty is properly throttled. + * handler, hvcs_unthrottle(), and it may reschedule itself because + * every flip_buffer_push may cause a throttle and we want to be + * able to reschedule ourselves to run AFTER a push is scheduled + * so that we know when the tty is properly throttled. */ static void hvcs_read_task(void * data) { @@ -203,32 +236,32 @@ char buf[HVCS_BUFF_LEN] __ALIGNED__; int got; int i; + int resched = 1; - /* Check the tty since it may go away on us at any time. */ + /* Check the tty since it may go away on us at any time since this + * function is invoked from the bottom end of the driver. */ if (hvcsd->enabled && tty && !test_bit(TTY_THROTTLED, &tty->flags)) { if ((tty->flip.count + HVCS_BUFF_LEN) < TTY_FLIPBUF_SIZE) { got = hvterm_get_chars(unit_address, &buf[0], HVCS_BUFF_LEN); - if (!got) { - if (tty->flip.count) - tty_flip_buffer_push(tty); - vio_enable_interrupts(hvcsd->vdev); - return; - } - for (i=0;iflip.count) tty_flip_buffer_push(tty); - /* We reschedule this task after every hvterm_get_chars - * because we don't want the TTY to throttle on us between - * flip_buffer_push calls. */ - schedule_delayed_work(&hvcsd->read_work, 1); + /* We reschedule this task after every hvterm_get_chars() + * because if the TTY throttles on us between flip_buffer_push + * calls we want to be able to know before executing another + * hvterm_get_chars or another flip_buffer_push, else we'll + * lose data in the push. */ + if (resched) + schedule_delayed_work(&hvcsd->read_work, 1); } /* If control drops straight here then it means that we are throttled * and this task will be rescheduled when the TTY is unthrottled. */ - return; } /* This is the callback from the tty layer that tells us that the flip @@ -239,30 +272,27 @@ struct hvcs_struct *hvcsd = (struct hvcs_struct *)tty->driver_data; schedule_delayed_work(&hvcsd->read_work, 1); - - /* Don't enable interrupts here, that will be done in the read task */ } static void hvcs_throttle(struct tty_struct *tty) { struct hvcs_struct *hvcsd = (struct hvcs_struct *)tty->driver_data; - vio_disable_interrupts(hvcsd->vdev); - cancel_delayed_work(&hvcsd->read_work); } /* If the device is being removed we don't have to worry about this * interrupt handler taking any further interrupts because they are * disabled which means the hvcs_struct will always be valid in this - * handler. + * handler. If an int is dispatched another one won't be dispatched + * until firmware has decided that we've pulled enough of the data so + * we probably don't need to turn ints from the device off. */ static irqreturn_t hvcs_handle_interrupt(int irq, void *dev_instance, struct pt_regs *regs) { struct hvcs_struct *hvcsd = (struct hvcs_struct *)dev_instance; - vio_disable_interrupts(hvcsd->vdev); - schedule_work(&hvcsd->read_work); + schedule_delayed_work(&hvcsd->read_work,1); return IRQ_HANDLED; } @@ -298,8 +328,6 @@ return -EPERM; } - printk(KERN_INFO "HVCS: Added vty-server@%X.\n", dev->unit_address); - hvcsd = kmalloc(sizeof(*hvcsd), GFP_KERNEL); if (!hvcsd) { return -ENODEV; @@ -340,6 +368,8 @@ hvcs_create_device_attrs(hvcsd); + printk(KERN_INFO "HVCS: Added vty-server@%X.\n", dev->unit_address); + /* DON'T enable interrupts here because there is no user to receive * the data. */ return 0; @@ -352,8 +382,6 @@ if (!hvcsd) return -ENODEV; - printk(KERN_INFO "HVCS: Removing vty-server@%X.\n", dev->unit_address); - /* By this time the vty-server won't be getting any * more interrups but we might get a callback from the tty. */ cancel_delayed_work(&hvcsd->read_work); @@ -363,15 +391,13 @@ * (indicating that there are no connections) or before a user * has attempted to open the device then the device will not be * enabled and thus we don't need to do any cleanup. */ - if (hvcsd->enabled) { + if (hvcsd->enabled) hvcs_disable_device(hvcsd); - } - if (hvcsd->tty) { - /* This is a scheduled function which will - * auto chain call hvcs_hangup. */ + /* The hangup is a scheduled function which will auto chain call + * hvcs_hangup. */ + if (hvcsd->tty) tty_hangup(hvcsd->tty); - } hvcs_remove_device_attrs(hvcsd); @@ -379,6 +405,8 @@ * which would probably be tty_hangup. */ kobject_put (&hvcsd->kobj); + + printk(KERN_INFO "HVCS: Removed vty-server@%X.\n", dev->unit_address); return 0; }; @@ -397,9 +425,9 @@ hvcsd->p_unit_address = pi->unit_address; hvcsd->p_partition_ID = pi->partition_ID; clclength = strlen(&pi->location_code[0]); - if(clclength > CLC_LENGTH - 1) { + if(clclength > CLC_LENGTH - 1) clclength = CLC_LENGTH - 1; - } + /* copy the null-term char too */ strncpy(&hvcsd->p_location_code[0], &pi->location_code[0], clclength + 1); @@ -414,7 +442,7 @@ * partner info then hvcsd->p_* will hold the last partner info * data from the firmware query. A good way to update this code would * be to replace the three partner info fields in hvcs_struct with a - * list of hvcs_partner_infos. + * list of hvcs_partner_info instances. */ static int hvcs_get_pi(struct hvcs_struct *hvcsd) { @@ -435,9 +463,8 @@ hvcsd->p_unit_address = 0; hvcsd->p_partition_ID = 0; - list_for_each_entry(pi, &head, node) { + list_for_each_entry(pi, &head, node) hvcs_set_pi(pi,hvcsd); - } hvcs_free_partner_info(&head); return 0; @@ -449,9 +476,8 @@ struct hvcs_struct *hvcsd = NULL; /* Locking issues? */ - list_for_each_entry(hvcsd, &hvcs_structs, next) { + list_for_each_entry(hvcsd, &hvcs_structs, next) hvcs_get_pi(hvcsd); - } return 0; } @@ -514,9 +540,6 @@ { int retval; do { - /* it will return -EBUSY if the operation would take too - * long to complete synchronously. - */ retval = hvcs_free_connection(hvcsd->vdev->unit_address); } while (retval == -EBUSY); } @@ -652,17 +675,15 @@ * this device after we have hung up? If so * tty->driver_data wouldn't be valid. */ - if (tty_hung_up_p(filp)) { + if (tty_hung_up_p(filp)) return; - } /* No driver_data means that this close was probably * issued after a failed hvcs_open by the tty layer's * release_dev() api and we can just exit cleanly. */ - if (!tty->driver_data) { + if (!tty->driver_data) return; - } hvcsd = (struct hvcs_struct *)tty->driver_data; @@ -732,9 +753,8 @@ /* If they don't check the return code off of their open they * may attempt this even if there is no connected device. */ - if (!hvcsd) { + if (!hvcsd) return -ENODEV; - } /* Reasonable size to prevent user level flooding */ if (count > HVCS_MAX_FROM_USER) @@ -749,9 +769,9 @@ if (!hvcsd->enabled) return -ENODEV; - if (!from_user) { + if (!from_user) charbuf = (unsigned char *)buf; - } else { + else { /* This isn't so important to do if we don't spinlock * around the copy_from_user but we'll leave it here * anyway because there may be locking issues in the @@ -768,9 +788,12 @@ /* won't return partial writes */ sent = hvterm_put_chars(unit_address, &charbuf[total_sent], tosend); - if (sent <= 0) { + /* if sent == 0 the tty->write_wait will go asleep until told + * to wake up (when the firmware is ready for more chars). + * There is a possible data loss hole right here. + */ + if (sent <= 0) break; - } total_sent+=sent; count-=sent; @@ -822,9 +845,8 @@ if( hvcs_parm_num_devs <= 0 || (hvcs_parm_num_devs > HVCS_MAX_SERVER_ADAPTERS)) { num_ttys_to_alloc = HVCS_DEFAULT_SERVER_ADAPTERS; - } else { + } else num_ttys_to_alloc = hvcs_parm_num_devs; - } hvcs_tty_driver = alloc_tty_driver(num_ttys_to_alloc); if (!hvcs_tty_driver) @@ -912,7 +934,8 @@ static ssize_t hvcs_current_vty_store(struct device *dev, const char * buf, size_t count) { - /* Don't need this feature at the present time. */ + /* Don't need this feature at the present time because firmware + * doesn't yet support multiple partners. */ printk(KERN_INFO "HVCS: Denied current_vty change: -EPERM.\n"); return -EPERM; } --- linux-2.5/Documentation/powerpc/hvcs.txt 2004-05-07 09:25:40.000000000 -0500 +++ hvcs_cleanup_linux-2.5/Documentation/powerpc/hvcs.txt 2004-05-07 10:12:14.000000000 -0500 @@ -341,6 +341,11 @@ permissions to use the /dev/hvcs* device. --------------------------------------------------------------------------- +Q: When I use minicom and input data reaches the end of the line it carriage +returns without a linewrap. What is happening? + +A: Invoke minicom with the "-w" command and it will auto linewrap. +--------------------------------------------------------------------------- Q: No matter what, I keep getting a rejection from minicom that the console is busy. What is happening? From tytso at mit.edu Sat May 8 06:33:32 2004 From: tytso at mit.edu (Theodore Ts'o) Date: Fri, 07 May 2004 16:33:32 -0400 Subject: Question about LD_PRELOAD and /etc/ld.preload Message-ID: I have an LD_PRELOAD shared library that accellerates programs that do readdir/stat scans by intercepting the opendir() and readdir() calls, reading all directory entries, sorting them in inode number, and then returning the directory entries in sorted order. The pathname to this shared library can be placed in /etc/ld.preload, or by setting the LD_PRELOAD environment variable. There's only one problem. On 32/64-bit platforms, you need to have a different preload library depending on whether the executable is 32-bit or 64-bit. So depending on whether I use LD_PRELOAD=/usr/local/lib/spd_readdir.so or LD_PRELOAD=/usr/local/lib/spd_readdir.so.64, either /bin/ls (which is a 32-bit executable) or /bin/ps (which is a 64-bit executable) will work correctly. This seems to be a real misfeature. Is there a 32/64-bit sensitive environment variable I can use? What about for /etc/ld.preload? Many thanks!! - Ted ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From meissner at suse.de Sun May 9 21:52:05 2004 From: meissner at suse.de (Marcus Meissner) Date: Sun, 9 May 2004 13:52:05 +0200 Subject: PATCH: sched_{s,g}etaffinity compat Message-ID: <20040509115205.GA28943@suse.de> Hi, On "real" hardware with NR_CPUS > sizeof(long)*8, the sys_sched_setaffinity and getaffinity compatibility functions break, because they just convert long masks instead of the full CPU masks. This patches fixes this problem. Spotted by a ppc32 glibc make check, on a ppc64 Kernel. Ciao, Marcus -------------- next part -------------- Changelog: Map the whole cpumask_t in the compat get and setaffinity calls. --- linux-2.6.5/kernel/compat.c.orig 2004-04-04 05:37:07.000000000 +0200 +++ linux-2.6.5/kernel/compat.c 2004-05-09 09:39:52.000000000 +0200 @@ -376,18 +377,19 @@ unsigned int len, compat_ulong_t *user_mask_ptr) { - unsigned long kernel_mask; + cpumask_t kernel_mask; mm_segment_t old_fs; int ret; - if (get_user(kernel_mask, user_mask_ptr)) + memset(&kernel_mask,0,sizeof(kernel_mask)); + if (copy_from_user(&kernel_mask, user_mask_ptr, min((unsigned int)sizeof( kernel_mask),len))) return -EFAULT; old_fs = get_fs(); set_fs(KERNEL_DS); ret = sys_sched_setaffinity(pid, sizeof(kernel_mask), - &kernel_mask); + (unsigned long*)&kernel_mask); set_fs(old_fs); return ret; @@ -396,7 +397,7 @@ asmlinkage int compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len, compat_ulong_t *user_mask_ptr) { - unsigned long kernel_mask; + cpumask_t kernel_mask; mm_segment_t old_fs; int ret; @@ -404,12 +405,12 @@ set_fs(KERNEL_DS); ret = sys_sched_getaffinity(pid, sizeof(kernel_mask), - &kernel_mask); + (unsigned long*)&kernel_mask); set_fs(old_fs); if (ret > 0) { - ret = sizeof(compat_ulong_t); - if (put_user(kernel_mask, user_mask_ptr)) + ret = min(len,(unsigned int)sizeof(kernel_mask)); + if (copy_to_user(user_mask_ptr, &kernel_mask, ret)) return -EFAULT; } From olh at suse.de Mon May 10 05:42:08 2004 From: olh at suse.de (Olaf Hering) Date: Sun, 9 May 2004 21:42:08 +0200 Subject: modversions on ppc64 will taint kernel Message-ID: <20040509194208.GA26606@suse.de> Rusty, the function check_version() looks for '__down', but there is '.__down' in the module. This happens with every recent 2.6 kernel. How can this be fixed? (none):/# /sbin/modprobe scsi_mod load_module: umod=0000000040028000, len=244003, uargs=0000000010016248 check_version(856) crc c0000000002faaa0 symname struct_module versindex 15 check_version(865) num_versions 124 check_version(867) i 0 name cleanup_module check_version(867) i 1 name init_module check_version(867) i 2 name struct_module Core section allocation order: .text .exit.text .fixup _init.text .stubs .rodata __ksymtab_strings .rodata.str1.8 __bug_table __ex_table __versions .symtab .strtab .data __param _init.data __ksymtab __kcrctab .data.rel.ro.local .data.rel.local .data.rel .gnu.linkonce.this_module .toc1 .opd .toc .bss Init section allocation order: final section addresses: 0xd0000000001af000 .text 0xd0000000001bd458 .exit.text 0xd0000000001bd4bc .fixup 0xd0000000001bfed0 .rodata 0xd0000000001c01d8 __ksymtab_strings 0xd0000000001c0728 .rodata.str1.8 0xd0000000001c86d0 __bug_table 0xd0000000001c87b0 __ex_table 0xd0000000001c8820 __versions 0xd0000000001d44e8 .data 0xd0000000001bd508 _init.text 0xd0000000001d4508 __param 0xd0000000001d45f8 _init.data 0xd0000000001d5498 __ksymtab 0xd0000000001d5888 __kcrctab 0xd0000000001d5a80 .data.rel.ro.local 0xd0000000001d5af0 .data.rel.local 0xd0000000001d8870 .data.rel 0xd0000000001d8d00 .gnu.linkonce.this_module 0xd0000000001d8f80 .toc1 0xd0000000001d9ad0 .opd 0xd0000000001dabc8 .toc 0xd0000000001dac28 .bss 0xd0000000001bd980 .stubs 0xd0000000001ca720 .symtab 0xd0000000001cfe98 .strtab Absolute symbol: 0x00000000 Absolute symbol: 0x00000000 Absolute symbol: 0x00000000 Absolute symbol: 0x00000000 Absolute symbol: 0x00000000 Absolute symbol: 0x00000000 Absolute symbol: 0x00000000 Absolute symbol: 0x00000000 Absolute symbol: 0x00000000 Absolute symbol: 0x00000000 Absolute symbol: 0x00000000 Absolute symbol: 0x00000000 Absolute symbol: 0x00000000 Absolute symbol: 0x00000000 check_version(856) crc c0000000002fa3e8 symname __down versindex 15 check_version(865) num_versions 124 check_version(867) i 0 name cleanup_module check_version(867) i 1 name init_module check_version(867) i 2 name struct_module check_version(867) i 3 name .panic check_version(867) i 4 name .free_pages check_version(867) i 5 name .mempool_free check_version(867) i 6 name .device_add check_version(867) i 7 name param_get_int check_version(867) i 8 name .complete_and_exit check_version(867) i 9 name .snprintf check_version(867) i 10 name .generic_unplug_device check_version(867) i 11 name .add_disk_randomness check_version(867) i 12 name .strlen check_version(867) i 13 name .blk_queue_end_tag check_version(867) i 14 name single_release check_version(867) i 15 name .mempool_create check_version(867) i 16 name malloc_sizes check_version(867) i 17 name proc_dointvec check_version(867) i 18 name blk_max_pfn check_version(867) i 19 name .__get_free_pages check_version(867) i 20 name .__up check_version(867) i 21 name .unregister_cpu_notifier check_version(867) i 22 name .daemonize check_version(867) i 23 name .sscanf check_version(867) i 24 name scsi_command_size check_version(867) i 25 name .kernel_thread check_version(867) i 26 name .rwsem_wake check_version(867) i 27 name .blk_queue_issue_flush_fn check_version(867) i 28 name .schedule_timeout check_version(867) i 29 name .put_device check_version(867) i 30 name .end_that_request_chunk check_version(867) i 31 name .remove_proc_entry check_version(867) i 32 name .memcmp check_version(867) i 33 name param_set_int check_version(867) i 34 name .kmem_cache_free check_version(867) i 35 name .create_proc_entry check_version(867) i 36 name .class_device_del check_version(867) i 37 name seq_read check_version(867) i 38 name .kfree check_version(867) i 39 name jiffies check_version(867) i 40 name .device_create_file check_version(867) i 41 name .wait_for_completion check_version(867) i 42 name .blk_dump_rq_flags check_version(867) i 43 name .strncmp check_version(867) i 44 name default_wake_function check_version(867) i 45 name param_get_charp check_version(867) i 46 name mempool_alloc_slab check_version(867) i 47 name .blk_run_queue check_version(867) i 48 name .single_open check_version(867) i 49 name .__mod_timer check_version(867) i 50 name .blk_queue_start_tag check_version(867) i 51 name .sprintf check_version(867) i 52 name .class_unregister check_version(867) i 53 name tb_ticks_per_usec check_version(867) i 54 name .driver_register check_version(867) i 55 name .__kmalloc check_version(867) i 56 name .blk_rq_map_sg check_version(867) i 57 name .rwsem_down_read_failed check_version(867) i 58 name .__bread check_version(867) i 59 name .class_device_create_file check_version(867) i 60 name .__down_interruptible check_version(867) i 61 name .class_device_unregister check_version(867) i 62 name mempool_free_slab check_version(867) i 63 name .get_device check_version(867) i 64 name .strncpy check_version(867) i 65 name .kmem_cache_create check_version(867) i 66 name .blk_requeue_request check_version(867) i 67 name .device_initialize check_version(867) i 68 name .register_sysctl_table check_version(867) i 69 name zone_table check_version(867) i 70 name .__copy_tofrom_user check_version(867) i 71 name .schedule check_version(867) i 72 name .device_for_each_child check_version(867) i 73 name .elv_remove_request check_version(867) i 74 name .blk_queue_max_phys_segments check_version(867) i 75 name .register_cpu_notifier check_version(867) i 76 name .device_del check_version(867) i 77 name .blk_queue_max_sectors check_version(867) i 78 name .class_register check_version(867) i 79 name .mempool_alloc check_version(867) i 80 name .blk_queue_segment_boundary check_version(867) i 81 name .strsep check_version(867) i 82 name .seq_printf check_version(867) i 83 name .elv_next_request check_version(867) i 84 name .proc_mkdir check_version(867) i 85 name .memcpy check_version(867) i 86 name .wake_up_process check_version(867) i 87 name platform_bus check_version(867) i 88 name param_set_copystring check_version(867) i 89 name .add_wait_queue check_version(867) i 90 name .__wake_up check_version(867) i 91 name .mempool_destroy check_version(867) i 92 name __per_cpu_offset check_version(867) i 93 name .memset check_version(867) i 94 name .blk_queue_prep_rq check_version(867) i 95 name .blk_init_queue check_version(867) i 96 name .class_device_add check_version(867) i 97 name .kmem_cache_alloc check_version(867) i 98 name seq_lseek check_version(867) i 99 name .end_that_request_last check_version(867) i 100 name .del_timer check_version(867) i 101 name .bus_unregister check_version(867) i 102 name .printk check_version(867) i 103 name .open_softirq check_version(867) i 104 name .blk_queue_max_hw_segments check_version(867) i 105 name .class_device_initialize check_version(867) i 106 name .remove_wait_queue check_version(867) i 107 name .bus_for_each_dev check_version(867) i 108 name .complete check_version(867) i 109 name .strcmp check_version(867) i 110 name .class_interface_register check_version(867) i 111 name .raise_softirq_irqoff check_version(867) i 112 name .dump_stack check_version(867) i 113 name .bus_register check_version(867) i 114 name .__brelse check_version(867) i 115 name .blk_plug_device check_version(867) i 116 name kernel_flag check_version(867) i 117 name .simple_strtoul check_version(867) i 118 name .kmem_cache_destroy check_version(867) i 119 name .blk_insert_request check_version(867) i 120 name .unregister_sysctl_table check_version(867) i 121 name .blk_queue_bounce_limit check_version(867) i 122 name .blk_cleanup_queue check_version(867) i 123 name .__down scsi_mod: no version for "__down" found: kernel tainted. check_version(856) crc c0000000002fc400 symname blk_cleanup_queue versindex 15 check_version(865) num_versions 124 check_version(867) i 0 name cleanup_module check_version(867) i 1 name init_module check_version(867) i 2 name struct_module check_version(867) i 3 name .panic check_version(867) i 4 name .free_pages check_version(867) i 5 name .mempool_free check_version(867) i 6 name .device_add check_version(867) i 7 name param_get_int check_version(867) i 8 name .complete_and_exit check_version(867) i 9 name .snprintf check_version(867) i 10 name .generic_unplug_device check_version(867) i 11 name .add_disk_randomness check_version(867) i 12 name .strlen check_version(867) i 13 name .blk_queue_end_tag check_version(867) i 14 name single_release check_version(867) i 15 name .mempool_create check_version(867) i 16 name malloc_sizes check_version(867) i 17 name proc_dointvec check_version(867) i 18 name blk_max_pfn check_version(867) i 19 name .__get_free_pages check_version(867) i 20 name .__up check_version(867) i 21 name .unregister_cpu_notifier check_version(867) i 22 name .daemonize check_version(867) i 23 name .sscanf check_version(867) i 24 name scsi_command_size check_version(867) i 25 name .kernel_thread check_version(867) i 26 name .rwsem_wake check_version(867) i 27 name .blk_queue_issue_flush_fn check_version(867) i 28 name .schedule_timeout check_version(867) i 29 name .put_device check_version(867) i 30 name .end_that_request_chunk check_version(867) i 31 name .remove_proc_entry check_version(867) i 32 name .memcmp check_version(867) i 33 name param_set_int check_version(867) i 34 name .kmem_cache_free check_version(867) i 35 name .create_proc_entry check_version(867) i 36 name .class_device_del check_version(867) i 37 name seq_read check_version(867) i 38 name .kfree check_version(867) i 39 name jiffies check_version(867) i 40 name .device_create_file check_version(867) i 41 name .wait_for_completion check_version(867) i 42 name .blk_dump_rq_flags check_version(867) i 43 name .strncmp check_version(867) i 44 name default_wake_function check_version(867) i 45 name param_get_charp check_version(867) i 46 name mempool_alloc_slab check_version(867) i 47 name .blk_run_queue check_version(867) i 48 name .single_open check_version(867) i 49 name .__mod_timer check_version(867) i 50 name .blk_queue_start_tag check_version(867) i 51 name .sprintf check_version(867) i 52 name .class_unregister check_version(867) i 53 name tb_ticks_per_usec check_version(867) i 54 name .driver_register check_version(867) i 55 name .__kmalloc check_version(867) i 56 name .blk_rq_map_sg check_version(867) i 57 name .rwsem_down_read_failed check_version(867) i 58 name .__bread check_version(867) i 59 name .class_device_create_file check_version(867) i 60 name .__down_interruptible check_version(867) i 61 name .class_device_unregister check_version(867) i 62 name mempool_free_slab check_version(867) i 63 name .get_device check_version(867) i 64 name .strncpy check_version(867) i 65 name .kmem_cache_create check_version(867) i 66 name .blk_requeue_request check_version(867) i 67 name .device_initialize check_version(867) i 68 name .register_sysctl_table check_version(867) i 69 name zone_table check_version(867) i 70 name .__copy_tofrom_user check_version(867) i 71 name .schedule check_version(867) i 72 name .device_for_each_child check_version(867) i 73 name .elv_remove_request check_version(867) i 74 name .blk_queue_max_phys_segments check_version(867) i 75 name .register_cpu_notifier check_version(867) i 76 name .device_del check_version(867) i 77 name .blk_queue_max_sectors check_version(867) i 78 name .class_register check_version(867) i 79 name .mempool_alloc check_version(867) i 80 name .blk_queue_segment_boundary check_version(867) i 81 name .strsep check_version(867) i 82 name .seq_printf check_version(867) i 83 name .elv_next_request check_version(867) i 84 name .proc_mkdir check_version(867) i 85 name .memcpy check_version(867) i 86 name .wake_up_process check_version(867) i 87 name platform_bus check_version(867) i 88 name param_set_copystring check_version(867) i 89 name .add_wait_queue check_version(867) i 90 name .__wake_up check_version(867) i 91 name .mempool_destroy check_version(867) i 92 name __per_cpu_offset check_version(867) i 93 name .memset check_version(867) i 94 name .blk_queue_prep_rq check_version(867) i 95 name .blk_init_queue check_version(867) i 96 name .class_device_add check_version(867) i 97 name .kmem_cache_alloc check_version(867) i 98 name seq_lseek check_version(867) i 99 name .end_that_request_last check_version(867) i 100 name .del_timer check_version(867) i 101 name .bus_unregister check_version(867) i 102 name .printk check_version(867) i 103 name .open_softirq check_version(867) i 104 name .blk_queue_max_hw_segments check_version(867) i 105 name .class_device_initialize check_version(867) i 106 name .remove_wait_queue check_version(867) i 107 name .bus_for_each_dev check_version(867) i 108 name .complete check_version(867) i 109 name .strcmp check_version(867) i 110 name .class_interface_register check_version(867) i 111 name .raise_softirq_irqoff check_version(867) i 112 name .dump_stack check_version(867) i 113 name .bus_register check_version(867) i 114 name .__brelse check_version(867) i 115 name .blk_plug_device check_version(867) i 116 name kernel_flag check_version(867) i 117 name .simple_strtoul check_version(867) i 118 name .kmem_cache_destroy check_version(867) i 119 name .blk_insert_request check_version(867) i 120 name .unregister_sysctl_table check_version(867) i 121 name .blk_queue_bounce_limit check_version(867) i 122 name .blk_cleanup_queue check_version(867) i 123 name .__down -- USB is for mice, FireWire is for men! sUse lINUX ag, n?RNBERG ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From rusty at rustcorp.com.au Mon May 10 10:07:28 2004 From: rusty at rustcorp.com.au (Rusty Russell) Date: Mon, 10 May 2004 10:07:28 +1000 Subject: modversions on ppc64 will taint kernel In-Reply-To: <20040509194208.GA26606@suse.de> References: <20040509194208.GA26606@suse.de> Message-ID: <1084147647.28220.16.camel@bach> On Mon, 2004-05-10 at 05:42, Olaf Hering wrote: > Rusty, > > the function check_version() looks for '__down', but there is '.__down' > in the module. > This happens with every recent 2.6 kernel. How can this be fixed? Sorry for the delay, finally got around to looking at this. Name: Fix __down Tainting Kernel with CONFIG_MODVERSIONS=y Status: Tested on ppc tree 10-May-2004 Version: ppc64 PowerPC64 ABI has ".funcname" (the actual function) and "funcname" (the function descriptor) and we strip off the dots in "dedotify" called from module_frob_arch_sections(). We need to also de-dotify the corresponding names in the __version section. Actually has nothing to do with __down, it's just that we only print the first symbol whose version is missing. diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .28471-linux-ppc64-2.5/arch/ppc64/kernel/module.c .28471-linux-ppc64-2.5.updated/arch/ppc64/kernel/module.c --- .28471-linux-ppc64-2.5/arch/ppc64/kernel/module.c 2004-01-22 16:05:41.000000000 +1100 +++ .28471-linux-ppc64-2.5.updated/arch/ppc64/kernel/module.c 2004-05-10 08:59:42.000000000 +1000 @@ -138,6 +138,16 @@ static unsigned long get_stubs_size(cons return relocs * sizeof(struct ppc64_stub_entry); } +static void dedotify_versions(struct modversion_info *vers, + unsigned long size) +{ + struct modversion_info *end; + + for (end = (void *)vers + size; vers < end; vers++) + if (vers->name[0] == '.') + memmove(vers->name, vers->name+1, strlen(vers->name)); +} + /* Undefined symbols which refer to .funcname, hack to funcname */ static void dedotify(Elf64_Sym *syms, unsigned int numsyms, char *strtab) { @@ -166,6 +176,9 @@ int module_frob_arch_sections(Elf64_Ehdr me->arch.stubs_section = i; else if (strcmp(secstrings + sechdrs[i].sh_name, ".toc") == 0) me->arch.toc_section = i; + else if (strcmp(secstrings+sechdrs[i].sh_name,"__versions")==0) + dedotify_versions((void *)hdr + sechdrs[i].sh_offset, + sechdrs[i].sh_size); /* We don't handle .init for the moment: rename to _init */ while ((p = strstr(secstrings + sechdrs[i].sh_name, ".init"))) -- Anyone who quotes me in their signature is an idiot -- Rusty Russell ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From anton at samba.org Mon May 10 13:01:53 2004 From: anton at samba.org (Anton Blanchard) Date: Mon, 10 May 2004 13:01:53 +1000 Subject: PATCH: sched_{s,g}etaffinity compat In-Reply-To: <20040509115205.GA28943@suse.de> References: <20040509115205.GA28943@suse.de> Message-ID: <20040510030153.GB27713@krispykreme> Hi, > On "real" hardware with NR_CPUS > sizeof(long)*8, the > sys_sched_setaffinity and getaffinity compatibility functions break, > because they just convert long masks instead of the full CPU masks. > > This patches fixes this problem. > > Spotted by a ppc32 glibc make check, on a ppc64 Kernel. Unfortunately thats not enough :) We need to change between 32bit and 64bit bitfields (just like we do on the 32bit compat select call). Here is a patch from Milton from a while ago that should do it. Anton -- Patch from Milton Miller that adds the sched_affinity syscalls into the compat layer. gr16b-anton/kernel/compat.c | 88 +++++++++++++++++++++++++++++++++++++++----- 1 files changed, 79 insertions(+), 9 deletions(-) diff -puN kernel/compat.c~compat_sys_sched_affinity kernel/compat.c --- gr16b/kernel/compat.c~compat_sys_sched_affinity 2004-01-21 23:48:39.853282726 +1100 +++ gr16b-anton/kernel/compat.c 2004-01-21 23:48:39.861282640 +1100 @@ -381,6 +381,12 @@ compat_sys_wait4(compat_pid_t pid, compa } } +/* for maximum compatability, we allow programs to use a single (compat) + * unsigned long bitmask if all cpus will fit. If not, you have to have + * at least the kernel size available. + */ +#define USE_COMPAT_ULONG_CPUMASK (NR_CPUS <= 8*sizeof(compat_ulong_t)) + extern asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len, unsigned long *user_mask_ptr); @@ -388,18 +394,54 @@ asmlinkage long compat_sys_sched_setaffi unsigned int len, compat_ulong_t *user_mask_ptr) { - unsigned long kernel_mask; + cpumask_t kernel_mask; mm_segment_t old_fs; int ret; - if (get_user(kernel_mask, user_mask_ptr)) - return -EFAULT; + if (USE_COMPAT_ULONG_CPUMASK) { + compat_ulong_t user_mask; + + if (len < sizeof(user_mask)) + return -EINVAL; + + if (get_user(user_mask, user_mask_ptr)) + return -EFAULT; + + kernel_mask = cpus_promote(user_mask); + } else { + if (len < sizeof(kernel_mask)) + return -EINVAL; + + if (!access_ok(VERIFY_READ, user_mask_ptr, sizeof(kernel_mask))) + return -EFAULT; + else { + int i, j; + unsigned long *k, m; + compat_ulong_t um; + + k = &cpus_coerce(kernel_mask); + + for (i=0; i < sizeof(kernel_mask)/sizeof(m); i++) { + m = 0; + + for (j = 0; j < sizeof(m)/sizeof(um); j++ ) { + if (__get_user(um, user_mask_ptr)) + return -EFAULT; + user_mask_ptr++; + m <<= 4*sizeof(um); + m <<= 4*sizeof(um); + m |= um; + } + *k++ = m; + } + } + } old_fs = get_fs(); set_fs(KERNEL_DS); ret = sys_sched_setaffinity(pid, sizeof(kernel_mask), - &kernel_mask); + (unsigned long *)&kernel_mask); set_fs(old_fs); return ret; @@ -411,21 +453,49 @@ extern asmlinkage long sys_sched_getaffi asmlinkage int compat_sys_sched_getaffinity(compat_pid_t pid, unsigned int len, compat_ulong_t *user_mask_ptr) { - unsigned long kernel_mask; + cpumask_t kernel_mask; mm_segment_t old_fs; int ret; + if (len < (USE_COMPAT_ULONG_CPUMASK ? sizeof(compat_ulong_t) + : sizeof(kernel_mask))) + return -EINVAL; + old_fs = get_fs(); set_fs(KERNEL_DS); ret = sys_sched_getaffinity(pid, sizeof(kernel_mask), - &kernel_mask); + (unsigned long *)&kernel_mask); set_fs(old_fs); if (ret > 0) { - ret = sizeof(compat_ulong_t); - if (put_user(kernel_mask, user_mask_ptr)) - return -EFAULT; + if (USE_COMPAT_ULONG_CPUMASK) { + ret = sizeof(compat_ulong_t); + if (put_user(cpus_coerce(kernel_mask), user_mask_ptr)) + return -EFAULT; + } else { + int i, j, err; + unsigned long *k, m; + compat_ulong_t um; + + err = access_ok(VERIFY_WRITE, user_mask_ptr, ret); + + k = &cpus_coerce(kernel_mask); + + for (i=0; i < sizeof(kernel_mask)/sizeof(m) && !err; i++) { + m = *k++; + + for (j = 0; j < sizeof(m)/sizeof(compat_ulong_t) && !err; j++ ) { + um = m; + err |= __put_user(um, user_mask_ptr); + user_mask_ptr++; + m >>= 4*sizeof(compat_ulong_t); + m >>= 4*sizeof(compat_ulong_t); + } + } + if (err) + ret = -EFAULT; + } } return ret; ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From olh at suse.de Mon May 10 21:55:51 2004 From: olh at suse.de (Olaf Hering) Date: Mon, 10 May 2004 13:55:51 +0200 Subject: modversions on ppc64 will taint kernel In-Reply-To: <1084147647.28220.16.camel@bach> References: <20040509194208.GA26606@suse.de> <1084147647.28220.16.camel@bach> Message-ID: <20040510115551.GA31045@suse.de> On Mon, May 10, Rusty Russell wrote: > On Mon, 2004-05-10 at 05:42, Olaf Hering wrote: > > Rusty, > > > > the function check_version() looks for '__down', but there is '.__down' > > in the module. > > This happens with every recent 2.6 kernel. How can this be fixed? > > Sorry for the delay, finally got around to looking at this. > > Name: Fix __down Tainting Kernel with CONFIG_MODVERSIONS=y > Status: Tested on ppc tree 10-May-2004 > Version: ppc64 > > PowerPC64 ABI has ".funcname" (the actual function) and "funcname" > (the function descriptor) and we strip off the dots in "dedotify" > called from module_frob_arch_sections(). We need to also de-dotify > the corresponding names in the __version section. > > Actually has nothing to do with __down, it's just that we only print > the first symbol whose version is missing. This works for me. thanks. -- USB is for mice, FireWire is for men! sUse lINUX ag, n?RNBERG ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From meissner at suse.de Tue May 11 00:57:29 2004 From: meissner at suse.de (Marcus Meissner) Date: Mon, 10 May 2004 16:57:29 +0200 Subject: PATCH: sched_{s,g}etaffinity compat In-Reply-To: <20040510030153.GB27713@krispykreme> References: <20040509115205.GA28943@suse.de> <20040510030153.GB27713@krispykreme> Message-ID: <20040510145729.GA1246@suse.de> Hi Anton, folks, My testcase returns EFAULT for getaffinity, I suspect this is the problem: + err = access_ok(VERIFY_WRITE, user_mask_ptr, ret); This should be a !access_ok( if you ask me. + + k = &cpus_coerce(kernel_mask); + + for (i=0; i < sizeof(kernel_mask)/sizeof(m) && !err; i++) { + m = *k++; + + for (j = 0; j < sizeof(m)/sizeof(compat_ulong_t) && !err; j++ ) { + um = m; + err |= __put_user(um, user_mask_ptr); + user_mask_ptr++; + m >>= 4*sizeof(compat_ulong_t); + m >>= 4*sizeof(compat_ulong_t); + } + } + if (err) + ret = -EFAULT; + } Ciao, Marcus ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From rsa at us.ibm.com Tue May 11 07:32:06 2004 From: rsa at us.ibm.com (Ryan Arnold) Date: 10 May 2004 16:32:06 -0500 Subject: [PATCH] hvcs - comment, printk, and functionality cleanup In-Reply-To: <1083953125.27507.1983.camel@SigurRos.rchland.ibm.com> References: <1083953125.27507.1983.camel@SigurRos.rchland.ibm.com> Message-ID: <1084224728.16102.2000.camel@SigurRos.rchland.ibm.com> I'm sending this patch out again to see if anyone is interested in reviewing it (I sent it originally last friday). I'll check it into the ameslab tree tomorrow morning if I receive no replies this evening. Ryan S. Arnold IBM Linux Technology Center -------------- next part -------------- --- linux-2.5/drivers/char/hvcs.c 2004-05-07 09:25:58.000000000 -0500 +++ hvcs_cleanup_linux-2.5/drivers/char/hvcs.c 2004-05-07 08:42:02.000000000 -0500 @@ -27,11 +27,44 @@ * practical on this hardware so system consoles are accessed by this driver * using inter-partition firmware interfaces to virtual terminal devices. * + * A vty is known to the HMC as a "virtual serial server adapter". It is a + * virtual terminal device that is created by firmware upon partition creation + * to act as a partitioned OS's console device. + * + * Firmware dynamically (via hotplug) exposes vty-servers to a running ppc64 + * Linux system upon their creation by the HMC or their exposure during boot. + * The non-user interactive backend of this driver is implemented as a vio + * device driver so that it can receive notification of vty-server lifetimes + * after it registers with the vio bus to handle vty-server probe and remove + * callbacks. + * + * Many vty-servers can be configured to connect to one vty, but a vty can + * only be actively connected to by a single vty-server, in any manner, at one + * time. If the HMC is currently hosting the console for a target Linux + * partition; attempts to open the tty device to the partition's console using + * the hvcs on any partition will return -EBUSY with every open attempt until + * the HMC frees the connection between its vty-server and the desired + * partition's vty device. Conversely, a vty-server may only be connected to + * a single vty at one time even though it may have several configured vty + * partner possibilities. + * + * Firmware does not provide notification of vty partner changes to this + * driver. This means that an HMC Super Admin may add or remove partner vtys + * from a vty-server's partner list but the changes will not be signaled to + * the vty-server. Firmware only notifies the driver when a vty-server is + * added or removed from the system. To compensate for this deficiency, this + * driver implements a sysfs update attribute which provides a method for + * rescanning partner information upon a user's request. + * + * Each vty-server, prior to being exposed to this driver is reference counted + * using the 2.6 Linux kernel kobject construct. This kobject is also used by + * the vio bus to provide a vio device sysfs entry that this driver attaches + * device specific attributes to, including partner information. The vio bus + * framework also provides a sysfs entry for each vio driver. The hvcs driver + * provides driver attributes in this entry. + * * For direction on installation and usage of this driver please reference * Documentation/powerpc/hvcs.txt. - * - * For an architectural overview of this driver please reference - * Documentation/powerpc/hvcs_arch.txt */ #include @@ -125,8 +158,8 @@ * and hvcs index numbers are not re-used after device removal * otherwise removing and adding a new one would link a /dev/hvcs* * entry to a different vty-server than it did before the removal. - * This means that a newly exposed vty-server will always map to - * an incrementally higher /dev/hvcs* entry than last exposed + * Incidentally, a newly exposed vty-server will always map to + * an incrementally higher /dev/hvcs* entry than the last exposed * vty-server. */ static int hvcs_struct_count = -1; @@ -190,10 +223,10 @@ static void __exit hvcs_module_exit(void); /* This task is scheduled to execute out of the read data interrupt - * handler, the hvcs_unthrottle, and it can be rescheduled out of itself. - * This task reschedules itself because every flip_buffer_push may cause a - * throttle and we want to be able to reschedule ourselves to run AFTER a - * push is scheduled so that we know when the tty is properly throttled. + * handler, hvcs_unthrottle(), and it may reschedule itself because + * every flip_buffer_push may cause a throttle and we want to be + * able to reschedule ourselves to run AFTER a push is scheduled + * so that we know when the tty is properly throttled. */ static void hvcs_read_task(void * data) { @@ -203,32 +236,32 @@ char buf[HVCS_BUFF_LEN] __ALIGNED__; int got; int i; + int resched = 1; - /* Check the tty since it may go away on us at any time. */ + /* Check the tty since it may go away on us at any time since this + * function is invoked from the bottom end of the driver. */ if (hvcsd->enabled && tty && !test_bit(TTY_THROTTLED, &tty->flags)) { if ((tty->flip.count + HVCS_BUFF_LEN) < TTY_FLIPBUF_SIZE) { got = hvterm_get_chars(unit_address, &buf[0], HVCS_BUFF_LEN); - if (!got) { - if (tty->flip.count) - tty_flip_buffer_push(tty); - vio_enable_interrupts(hvcsd->vdev); - return; - } - for (i=0;iflip.count) tty_flip_buffer_push(tty); - /* We reschedule this task after every hvterm_get_chars - * because we don't want the TTY to throttle on us between - * flip_buffer_push calls. */ - schedule_delayed_work(&hvcsd->read_work, 1); + /* We reschedule this task after every hvterm_get_chars() + * because if the TTY throttles on us between flip_buffer_push + * calls we want to be able to know before executing another + * hvterm_get_chars or another flip_buffer_push, else we'll + * lose data in the push. */ + if (resched) + schedule_delayed_work(&hvcsd->read_work, 1); } /* If control drops straight here then it means that we are throttled * and this task will be rescheduled when the TTY is unthrottled. */ - return; } /* This is the callback from the tty layer that tells us that the flip @@ -239,30 +272,27 @@ struct hvcs_struct *hvcsd = (struct hvcs_struct *)tty->driver_data; schedule_delayed_work(&hvcsd->read_work, 1); - - /* Don't enable interrupts here, that will be done in the read task */ } static void hvcs_throttle(struct tty_struct *tty) { struct hvcs_struct *hvcsd = (struct hvcs_struct *)tty->driver_data; - vio_disable_interrupts(hvcsd->vdev); - cancel_delayed_work(&hvcsd->read_work); } /* If the device is being removed we don't have to worry about this * interrupt handler taking any further interrupts because they are * disabled which means the hvcs_struct will always be valid in this - * handler. + * handler. If an int is dispatched another one won't be dispatched + * until firmware has decided that we've pulled enough of the data so + * we probably don't need to turn ints from the device off. */ static irqreturn_t hvcs_handle_interrupt(int irq, void *dev_instance, struct pt_regs *regs) { struct hvcs_struct *hvcsd = (struct hvcs_struct *)dev_instance; - vio_disable_interrupts(hvcsd->vdev); - schedule_work(&hvcsd->read_work); + schedule_delayed_work(&hvcsd->read_work,1); return IRQ_HANDLED; } @@ -298,8 +328,6 @@ return -EPERM; } - printk(KERN_INFO "HVCS: Added vty-server@%X.\n", dev->unit_address); - hvcsd = kmalloc(sizeof(*hvcsd), GFP_KERNEL); if (!hvcsd) { return -ENODEV; @@ -340,6 +368,8 @@ hvcs_create_device_attrs(hvcsd); + printk(KERN_INFO "HVCS: Added vty-server@%X.\n", dev->unit_address); + /* DON'T enable interrupts here because there is no user to receive * the data. */ return 0; @@ -352,8 +382,6 @@ if (!hvcsd) return -ENODEV; - printk(KERN_INFO "HVCS: Removing vty-server@%X.\n", dev->unit_address); - /* By this time the vty-server won't be getting any * more interrups but we might get a callback from the tty. */ cancel_delayed_work(&hvcsd->read_work); @@ -363,15 +391,13 @@ * (indicating that there are no connections) or before a user * has attempted to open the device then the device will not be * enabled and thus we don't need to do any cleanup. */ - if (hvcsd->enabled) { + if (hvcsd->enabled) hvcs_disable_device(hvcsd); - } - if (hvcsd->tty) { - /* This is a scheduled function which will - * auto chain call hvcs_hangup. */ + /* The hangup is a scheduled function which will auto chain call + * hvcs_hangup. */ + if (hvcsd->tty) tty_hangup(hvcsd->tty); - } hvcs_remove_device_attrs(hvcsd); @@ -379,6 +405,8 @@ * which would probably be tty_hangup. */ kobject_put (&hvcsd->kobj); + + printk(KERN_INFO "HVCS: Removed vty-server@%X.\n", dev->unit_address); return 0; }; @@ -397,9 +425,9 @@ hvcsd->p_unit_address = pi->unit_address; hvcsd->p_partition_ID = pi->partition_ID; clclength = strlen(&pi->location_code[0]); - if(clclength > CLC_LENGTH - 1) { + if(clclength > CLC_LENGTH - 1) clclength = CLC_LENGTH - 1; - } + /* copy the null-term char too */ strncpy(&hvcsd->p_location_code[0], &pi->location_code[0], clclength + 1); @@ -414,7 +442,7 @@ * partner info then hvcsd->p_* will hold the last partner info * data from the firmware query. A good way to update this code would * be to replace the three partner info fields in hvcs_struct with a - * list of hvcs_partner_infos. + * list of hvcs_partner_info instances. */ static int hvcs_get_pi(struct hvcs_struct *hvcsd) { @@ -435,9 +463,8 @@ hvcsd->p_unit_address = 0; hvcsd->p_partition_ID = 0; - list_for_each_entry(pi, &head, node) { + list_for_each_entry(pi, &head, node) hvcs_set_pi(pi,hvcsd); - } hvcs_free_partner_info(&head); return 0; @@ -449,9 +476,8 @@ struct hvcs_struct *hvcsd = NULL; /* Locking issues? */ - list_for_each_entry(hvcsd, &hvcs_structs, next) { + list_for_each_entry(hvcsd, &hvcs_structs, next) hvcs_get_pi(hvcsd); - } return 0; } @@ -514,9 +540,6 @@ { int retval; do { - /* it will return -EBUSY if the operation would take too - * long to complete synchronously. - */ retval = hvcs_free_connection(hvcsd->vdev->unit_address); } while (retval == -EBUSY); } @@ -652,17 +675,15 @@ * this device after we have hung up? If so * tty->driver_data wouldn't be valid. */ - if (tty_hung_up_p(filp)) { + if (tty_hung_up_p(filp)) return; - } /* No driver_data means that this close was probably * issued after a failed hvcs_open by the tty layer's * release_dev() api and we can just exit cleanly. */ - if (!tty->driver_data) { + if (!tty->driver_data) return; - } hvcsd = (struct hvcs_struct *)tty->driver_data; @@ -732,9 +753,8 @@ /* If they don't check the return code off of their open they * may attempt this even if there is no connected device. */ - if (!hvcsd) { + if (!hvcsd) return -ENODEV; - } /* Reasonable size to prevent user level flooding */ if (count > HVCS_MAX_FROM_USER) @@ -749,9 +769,9 @@ if (!hvcsd->enabled) return -ENODEV; - if (!from_user) { + if (!from_user) charbuf = (unsigned char *)buf; - } else { + else { /* This isn't so important to do if we don't spinlock * around the copy_from_user but we'll leave it here * anyway because there may be locking issues in the @@ -768,9 +788,12 @@ /* won't return partial writes */ sent = hvterm_put_chars(unit_address, &charbuf[total_sent], tosend); - if (sent <= 0) { + /* if sent == 0 the tty->write_wait will go asleep until told + * to wake up (when the firmware is ready for more chars). + * There is a possible data loss hole right here. + */ + if (sent <= 0) break; - } total_sent+=sent; count-=sent; @@ -822,9 +845,8 @@ if( hvcs_parm_num_devs <= 0 || (hvcs_parm_num_devs > HVCS_MAX_SERVER_ADAPTERS)) { num_ttys_to_alloc = HVCS_DEFAULT_SERVER_ADAPTERS; - } else { + } else num_ttys_to_alloc = hvcs_parm_num_devs; - } hvcs_tty_driver = alloc_tty_driver(num_ttys_to_alloc); if (!hvcs_tty_driver) @@ -912,7 +934,8 @@ static ssize_t hvcs_current_vty_store(struct device *dev, const char * buf, size_t count) { - /* Don't need this feature at the present time. */ + /* Don't need this feature at the present time because firmware + * doesn't yet support multiple partners. */ printk(KERN_INFO "HVCS: Denied current_vty change: -EPERM.\n"); return -EPERM; } --- linux-2.5/Documentation/powerpc/hvcs.txt 2004-05-07 09:25:40.000000000 -0500 +++ hvcs_cleanup_linux-2.5/Documentation/powerpc/hvcs.txt 2004-05-07 10:12:14.000000000 -0500 @@ -341,6 +341,11 @@ permissions to use the /dev/hvcs* device. --------------------------------------------------------------------------- +Q: When I use minicom and input data reaches the end of the line it carriage +returns without a linewrap. What is happening? + +A: Invoke minicom with the "-w" command and it will auto linewrap. +--------------------------------------------------------------------------- Q: No matter what, I keep getting a rejection from minicom that the console is busy. What is happening? From benh at kernel.crashing.org Tue May 11 10:17:43 2004 From: benh at kernel.crashing.org (Benjamin Herrenschmidt) Date: Tue, 11 May 2004 10:17:43 +1000 Subject: [PATCH] hvcs - comment, printk, and functionality cleanup In-Reply-To: <1084224728.16102.2000.camel@SigurRos.rchland.ibm.com> References: <1083953125.27507.1983.camel@SigurRos.rchland.ibm.com> <1084224728.16102.2000.camel@SigurRos.rchland.ibm.com> Message-ID: <1084234662.2905.78.camel@gaston> On Tue, 2004-05-11 at 07:32, Ryan Arnold wrote: > I'm sending this patch out again to see if anyone is interested in > reviewing it (I sent it originally last friday). I'll check it into the > ameslab tree tomorrow morning if I receive no replies this evening. You are still using workqueues, I think that's wrong ... Note also that cancel_delayed_work() will only cancel the timer, the task may still pop up if the timer expired. Ben. ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From amodra at bigpond.net.au Tue May 11 14:32:13 2004 From: amodra at bigpond.net.au (Alan Modra) Date: Tue, 11 May 2004 14:02:13 +0930 Subject: Question about LD_PRELOAD and /etc/ld.preload In-Reply-To: References: Message-ID: <20040511043213.GA17189@bubble.modra.org> On Fri, May 07, 2004 at 04:33:32PM -0400, Theodore Y. Ts'o wrote: > > I have an LD_PRELOAD shared library that accellerates programs that do > readdir/stat scans by intercepting the opendir() and readdir() calls, > reading all directory entries, sorting them in inode number, and then > returning the directory entries in sorted order. > > The pathname to this shared library can be placed in /etc/ld.preload, or > by setting the LD_PRELOAD environment variable. There's only one > problem. On 32/64-bit platforms, you need to have a different preload > library depending on whether the executable is 32-bit or 64-bit. > > So depending on whether I use LD_PRELOAD=/usr/local/lib/spd_readdir.so > or LD_PRELOAD=/usr/local/lib/spd_readdir.so.64, either /bin/ls (which is > a 32-bit executable) or /bin/ps (which is a 64-bit executable) will work > correctly. > > This seems to be a real misfeature. Is there a 32/64-bit sensitive > environment variable I can use? What about for /etc/ld.preload? Not that I know of. Try specifying the preload .so without an absolute path, and arrange for it to be found in a path specified in ld.so.conf. Since you can have a different ld.so.conf for the 64-bit ld.so, that should allow the right lib to be preloaded. -- Alan Modra IBM OzLabs - Linux Technology Centre ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From ananth at in.ibm.com Tue May 11 21:13:23 2004 From: ananth at in.ibm.com (Ananth N Mavinakayanahalli) Date: Tue, 11 May 2004 16:13:23 +0500 Subject: [PATCH] fix KDB backtrace for ppc64 In-Reply-To: <20040507071532.GJ10918@krispykreme> References: <20040505141647.GA4678@in.ibm.com> <20040507071532.GJ10918@krispykreme> Message-ID: <20040511111323.GA24854@in.ibm.com> On Fri, May 07, 2004 at 05:15:32PM +1000, Anton Blanchard wrote: Hi Anton, > > > Here is a patch that fixes backtracing in KDB for ppc64. We were not > > handling the link register and were missing an intermediate call > > during bt. > > Have you seen Pauls changes to arch/ppc64/kernel/process.c:show_stack in > ameslab-2.5? It uses a trick to find exception frames and dump them > correctly. I think it would be good to get the same magic into kdb. Here is Paul's show_stack() retrofitted to be used with kdb's arch specific backtrace. This patch applies on my earlier reworked backtrace patch. Here is a sample trace: kdb> g Instruction(i) breakpoint #0 at 0xc00000000004cc9c (adjusted) 0xc00000000004cc9c .__do_softirq trap Entering kdb (current=0xc00000003d323690, pid 652) due to Breakpoint @ 0xc00000c kdb> bt Stack traceback for pid 652 0xc00000003d323690 652 1 1 0 R 0xc00000003d323af8 *master SP(esp) PC(eip) Function(args) 0xc00000003d31f3e0 0xc00000000004cc9c .__do_softirq +0x0 0xc00000003d31f3e0 0xc00000000004ce44 (lr) .do_softirq +0x6c 0xc00000003d31f460 0xc000000000013fac .timer_interrupt +0x2a0 0xc00000003d31f540 0xc00000000000a2c0 Decrementer_common +0xe8 --- Exception: 900: (Decrementer) at .__d_lookup +0x8c 0xc00000003d31f830 0xc0000000000a22cc .__d_lookup +0x8c 0xc00000003d31f830 0xc00000000009643c (lr) .do_lookup +0x48 0xc00000003d31f900 0xc00000000009643c .do_lookup +0x48 0xc00000003d31f9b0 0xc0000000000986a4 .link_path_walk +0x654 0xc00000003d31fa70 0xc0000000000991f4 .path_lookup +0xc0 0xc00000003d31faf0 0xc0000000000993bc .open_namei +0xc0 0xc00000003d31fbc0 0xc000000000083324 .filp_open +0x38 0xc00000003d31fc70 0xc00000000001d670 .sys32_open +0x90 0xc00000003d31fd10 0xc00000000000fe8c .ret_from_syscall_1 +0x0 --- Exception: c00: (System Call) NO_SYMBOL or Userspace 0x00000000ffffe8c0 0x000000000fbf8208 kdb> Thanks, Ananth -- Ananth Narayan Linux Technology Center, IBM Software Lab, INDIA diff -Naur --exclude=BitKeeper --exclude=SCCS temp/ameslab/arch/ppc64/kdb/kdba_bt.c ameslab/arch/ppc64/kdb/kdba_bt.c --- temp/ameslab/arch/ppc64/kdb/kdba_bt.c 2004-05-11 02:19:27.576319008 -0700 +++ ameslab/arch/ppc64/kdb/kdba_bt.c 2004-05-11 02:04:51.837327584 -0700 @@ -68,22 +68,8 @@ return ret; } - extern unsigned long kdba_getword(unsigned long addr, size_t width); -/* Copy a block of memory using kdba_getword(). - * This is not efficient. - */ -static void kdba_getmem(unsigned long addr, void *p, int size) -{ - unsigned char *dst = (unsigned char *)p; - while (size > 0) { - *dst++ = kdba_getword(addr++, 1); - size--; - } -} - - /* * kdba_bt_stack_ppc * @@ -102,13 +88,12 @@ { kdb_machreg_t esp, eip, ebp, old_esp; - /* declare these as raw ptrs so we don't get func descriptors */ - extern void *ret_from_except, *ret_from_syscall_1; const char *name; unsigned long symsize, symoffset; char *symmodname; int flag = 0; + kdb_machreg_t lr; char namebuf[128]; /* @@ -207,7 +192,6 @@ } kdb_printf("\n"); if (!flag && (task_curr(p))) { - kdb_machreg_t lr; unsigned long start = 0, end = 0; flag++; @@ -234,35 +218,36 @@ kdb_printf("\n", esp ); break; } else { - if (eip == (kdb_machreg_t)ret_from_except || - eip == (kdb_machreg_t)ret_from_syscall_1) { - /* pull exception regs from the stack */ - struct pt_regs eregs; - kdba_getmem(esp+STACK_FRAME_OVERHEAD, - &eregs, sizeof(eregs)); - kdb_printf(" [exception: %lx:%s regs 0x%lx] " - "nip:[0x%lx] gpr[1]:[0x%lx]\n", - eregs.trap,getvecname(eregs.trap), - esp+STACK_FRAME_OVERHEAD, - (unsigned long int)eregs.nip, - (unsigned long int)eregs.gpr[1]); - old_esp = esp; - esp = kdba_getword(esp, 8); - if (!esp) - break; - eip = kdba_getword(esp+16, 8); /* saved lr */ - if (esp < PAGE_OFFSET) { /* userspace... */ - if (old_esp > PAGE_OFFSET) { - kdb_printf("\n",esp); - break; - } - } - /* - * we want to follow exception registers, - * not into user stack. ... - */ - esp = eregs.gpr[1]; - eip = eregs.nip; + unsigned long *sp = (unsigned long *)esp; + if (esp <= (unsigned long) p->thread_info + THREAD_SIZE + + sizeof(struct pt_regs) + 400 + && sp[12] == 0x7265677368657265) { + struct pt_regs *eregs = (struct pt_regs *) + (esp + STACK_FRAME_OVERHEAD); + kdb_printf("--- Exception: %lx: %s ", + eregs->trap, getvecname(eregs->trap)); + name = kallsyms_lookup(eregs->nip, &symsize, + &symoffset, &symmodname, namebuf); + if (name) { + kdb_printf("at %s +0x%lx\n", + name, symoffset); + } else { + kdb_printf("NO_SYMBOL or Userspace\n"); + } + flag = 0; + if (esp < PAGE_OFFSET) { /* userspace... */ + if (old_esp > PAGE_OFFSET) { + kdb_printf("\n",esp); + break; + } + } + /* + * we want to follow exception registers, + * not into user stack. ... + */ + esp = eregs->gpr[1]; + eip = eregs->nip; + regs = eregs; } else { esp = kdba_getword(esp, 8); if (!esp) ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From nitin at in.ibm.com Tue May 11 22:09:33 2004 From: nitin at in.ibm.com (Nitin Vashisth) Date: 11 May 2004 17:39:33 +0530 Subject: [PATCH] FIx for mtmsrd instruction decode in KDB. Message-ID: <1084277372.4481.16.camel@kumbhkaran.in.ibm.com> Hi, This patch fixes the mtmsrd instruction decode in kdb using logic similar to that in xmon to decode the instruction. Best Regards, Nitin. -- Nitin Vashisth Linux Technology Center IBM Software Lab Bangalore, INDIA Direct 91-80-2504 4611 Board 91-80-2526 2355 / 7117 Extension 3611. -- org/ameslab/arch/ppc64/kdb/ppc-opc.c 2004-04-22 21:52:09.000000000 -0700 +++ ameslab/arch/ppc64/kdb/ppc-opc.c 2004-05-11 11:30:36.000000000 -0700 @@ -82,6 +82,12 @@ static long extract_spr PARAMS ((unsigned long, int *)); static unsigned long insert_tbr PARAMS ((unsigned long, long, const char **)); static long extract_tbr PARAMS ((unsigned long, int *)); +static unsigned long insert_ev2 (unsigned long, long, const char **); +static long extract_ev2 (unsigned long, int *); +static unsigned long insert_ev4 (unsigned long, long, const char **); +static long extract_ev4 (unsigned long, int *); +static unsigned long insert_ev8 (unsigned long, long, const char **); +static long extract_ev8 (unsigned long, int *); /* The operands table. @@ -436,6 +442,32 @@ /* The SHB field in a VA form instruction. */ #define SHB UIMM + 1 { 4, 6, 0, 0, 0 }, + + /* The other UIMM field in a EVX form instruction. */ +#define EVUIMM SHB + 1 + { 5, 11, 0, 0, 0 }, + + /* The other UIMM field in a half word EVX form instruction. */ +#define EVUIMM_2 EVUIMM + 1 + { 32, 11, insert_ev2, extract_ev2, PPC_OPERAND_PARENS }, + + /* The other UIMM field in a word EVX form instruction. */ +#define EVUIMM_4 EVUIMM_2 + 1 + { 32, 11, insert_ev4, extract_ev4, PPC_OPERAND_PARENS }, + + /* The other UIMM field in a double EVX form instruction. */ +#define EVUIMM_8 EVUIMM_4 + 1 + { 32, 11, insert_ev8, extract_ev8, PPC_OPERAND_PARENS }, + + /* The WS field. */ +#define WS EVUIMM_8 + 1 +#define WS_MASK (0x7 << 11) + { 3, 11, 0, 0, 0 }, + + /* The L field in an mtmsrd instruction */ +#define MTMSRD_L WS + 1 + { 1, 16, 0, 0, PPC_OPERAND_OPTIONAL }, + }; /* The functions used to insert and extract complicated operands. */ @@ -675,6 +707,63 @@ return value & 0x1e; } +static unsigned long +insert_ev2 (unsigned long insn, + long value, + const char **errmsg) +{ + if ((value & 1) != 0) + *errmsg = _("offset not a multiple of 2"); + if ((value > 62) != 0) + *errmsg = _("offset greater than 62"); + return insn | ((value & 0x3e) << 10); +} + +static long +extract_ev2 (unsigned long insn, + int *invalid ATTRIBUTE_UNUSED) +{ + return (insn >> 10) & 0x3e; +} + +static unsigned long +insert_ev4 (unsigned long insn, + long value, + const char **errmsg) +{ + if ((value & 3) != 0) + *errmsg = _("offset not a multiple of 4"); + if ((value > 124) != 0) + *errmsg = _("offset greater than 124"); + return insn | ((value & 0x7c) << 9); +} + +static long +extract_ev4 (unsigned long insn, + int *invalid ATTRIBUTE_UNUSED) +{ + return (insn >> 9) & 0x7c; +} + +static unsigned long +insert_ev8 (unsigned long insn, + long value, + const char **errmsg) +{ + if ((value & 7) != 0) + *errmsg = _("offset not a multiple of 8"); + if ((value > 248) != 0) + *errmsg = _("offset greater than 248"); + return insn | ((value & 0xf8) << 8); +} + +static long +extract_ev8 (unsigned long insn, + int *invalid ATTRIBUTE_UNUSED) +{ + return (insn >> 8) & 0xf8; +} + /* The DS field in a DS form instruction. This is like D, but the lower two bits are forced to zero. */ @@ -1184,6 +1273,9 @@ /* An X_MASK with the RA and RB fields fixed. */ #define XRARB_MASK (X_MASK | RA_MASK | RB_MASK) +/* An XRARB_MASK, but with the L bit clear. */ +#define XRLARB_MASK (XRARB_MASK & ~((unsigned long) 1 << 16)) + /* An X_MASK with the RT and RA fields fixed. */ #define XRTRA_MASK (X_MASK | RT_MASK | RA_MASK) @@ -2536,7 +2628,7 @@ { "wrteei", X(31,163), XE_MASK, PPC403, { E } }, -{ "mtmsrd", X(31,178), XRARB_MASK, PPC64, { RS } }, +{ "mtmsrd", X(31,178), XRLARB_MASK, PPC64, { RS, MTMSRD_L } }, { "stdux", X(31,181), X_MASK, PPC64, { RS, RAS, RB } }, ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From johnrose at austin.ibm.com Wed May 12 02:29:17 2004 From: johnrose at austin.ibm.com (John Rose) Date: Tue, 11 May 2004 11:29:17 -0500 Subject: linux,pci-domain - why? Message-ID: <1084292956.25287.14.camel@verve.austin.ibm.com> Can anybody explain the purpose of creating the "linux,pci-domain" property for each PHB at boot? The property never gets exported in /proc, and isn't referenced in the kernel, from what I can see. Thanks- John -- John Rose ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From haveblue at us.ibm.com Wed May 12 02:36:29 2004 From: haveblue at us.ibm.com (Dave Hansen) Date: Tue, 11 May 2004 09:36:29 -0700 Subject: linux,pci-domain - why? In-Reply-To: <1084292956.25287.14.camel@verve.austin.ibm.com> References: <1084292956.25287.14.camel@verve.austin.ibm.com> Message-ID: <1084293389.1091.66.camel@nighthawk> On Tue, 2004-05-11 at 09:29, John Rose wrote: > Can anybody explain the purpose of creating the "linux,pci-domain" > property for each PHB at boot? The property never gets exported in > /proc, and isn't referenced in the kernel, from what I can see. Isn't that functionality duplicated in sysfs as well? -- Dave ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From greg at kroah.com Wed May 12 03:10:39 2004 From: greg at kroah.com (Greg KH) Date: Tue, 11 May 2004 10:10:39 -0700 Subject: linux,pci-domain - why? In-Reply-To: <1084292956.25287.14.camel@verve.austin.ibm.com> References: <1084292956.25287.14.camel@verve.austin.ibm.com> Message-ID: <20040511171039.GA13778@kroah.com> On Tue, May 11, 2004 at 11:29:17AM -0500, John Rose wrote: > > Can anybody explain the purpose of creating the "linux,pci-domain" > property for each PHB at boot? The property never gets exported in > /proc, and isn't referenced in the kernel, from what I can see. It isn't? What does your /sys/bus/pci/devices look like? It should have the domain number in the device id. thanks, greg k-h ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From johnrose at austin.ibm.com Wed May 12 04:27:42 2004 From: johnrose at austin.ibm.com (John Rose) Date: Tue, 11 May 2004 13:27:42 -0500 Subject: linux,pci-domain - why? In-Reply-To: <20040511171039.GA13778@kroah.com> References: <1084292956.25287.14.camel@verve.austin.ibm.com> <20040511171039.GA13778@kroah.com> Message-ID: <1084300061.25288.18.camel@verve.austin.ibm.com> > It isn't? What does your /sys/bus/pci/devices look like? It should > have the domain number in the device id. True, but this isn't taken from the Open Firmware property that I'm asking about. The property is explicitly created in the kernel and added to the device tree, and then never referenced. John ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From rsa at us.ibm.com Wed May 12 05:29:15 2004 From: rsa at us.ibm.com (Ryan Arnold) Date: 11 May 2004 14:29:15 -0500 Subject: [PATCH] hvcs - comment, printk, and functionality cleanup In-Reply-To: <1084234662.2905.78.camel@gaston> References: <1083953125.27507.1983.camel@SigurRos.rchland.ibm.com> <1084224728.16102.2000.camel@SigurRos.rchland.ibm.com> <1084234662.2905.78.camel@gaston> Message-ID: <1084303756.16102.2005.camel@SigurRos.rchland.ibm.com> On Mon, 2004-05-10 at 19:17, Benjamin Herrenschmidt wrote: > You are still using workqueues, I think that's wrong ... > > Note also that cancel_delayed_work() will only cancel the timer, the > task may still pop up if the timer expired. Thanks for the reply Ben. I'm going to check this patch into the Ameslab tree to provide the current version of hvcs with the latest fixes I have. I'm taking your advice. I had prepared an hvcs patch for the LKML (formal drivers submission) that I'll wait on delivering until I rewrite the driver with kernel threads rather than workqueues. Ryan S. Arnold ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From gjohnson at lanl.gov Fri May 14 02:23:30 2004 From: gjohnson at lanl.gov (Greg Johnson) Date: Thu, 13 May 2004 10:23:30 -0600 Subject: Linux on G5 Xserve? Message-ID: <20040513162330.GF1256@durango.c3.lanl.gov> Has anybody been able to boot Linux on the G5 Xserve? I have been trying to get it to work for about a week. I've tried all the available distribution kernels (mostly 32bit + Gentoo ppc64). I've also built some 32bit kernels myself. In all cases, I get no output after prom_init finishes. Here is the output from my latest attempt: Transfer FILE: vmlinux \ TFTP-actual=415572 TFTP-adler32=1d304c5e Elf32 kernel loaded... copying OF device tree...done Calling quiesce ... DO-QUIESCE finishedreturning 0x0160000 from prom_init Then nothing. This is all over the serial port as these machines don't have video cards. Is it possible that the kernel is booting, but not initializing the serial console? All the output I'm getting from the kernel comes through the prom. Any help or pointers would be most appreciated. Thanks, Greg ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From benh at kernel.crashing.org Fri May 14 10:12:48 2004 From: benh at kernel.crashing.org (Benjamin Herrenschmidt) Date: Fri, 14 May 2004 10:12:48 +1000 Subject: Linux on G5 Xserve? In-Reply-To: <20040513162330.GF1256@durango.c3.lanl.gov> References: <20040513162330.GF1256@durango.c3.lanl.gov> Message-ID: <1084493567.13730.125.camel@gaston> On Fri, 2004-05-14 at 02:23, Greg Johnson wrote: > Has anybody been able to boot Linux on the G5 Xserve? I have been > trying to get it to work for about a week. I've tried all the available > distribution kernels (mostly 32bit + Gentoo ppc64). I've also built > some 32bit kernels myself. In all cases, I get no output after > prom_init finishes. Here is the output from my latest attempt: > > > Transfer FILE: vmlinux \ > TFTP-actual=415572 TFTP-adler32=1d304c5e Elf32 kernel loaded... > copying OF device tree...done > Calling quiesce ... > > DO-QUIESCE finishedreturning 0x0160000 from prom_init It's known not to boot yet, yes. I haven't had time & access to the HW to make it work yet. Ben. ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From gjohnson at lanl.gov Fri May 14 10:43:48 2004 From: gjohnson at lanl.gov (Greg Johnson) Date: Thu, 13 May 2004 18:43:48 -0600 Subject: Linux on G5 Xserve? In-Reply-To: <1084493567.13730.125.camel@gaston> References: <20040513162330.GF1256@durango.c3.lanl.gov> <1084493567.13730.125.camel@gaston> Message-ID: <20040514004348.GG1256@durango.c3.lanl.gov> On Fri, May 14, 2004 at 10:12:48AM +1000, Benjamin Herrenschmidt wrote: > On Fri, 2004-05-14 at 02:23, Greg Johnson wrote: > > Has anybody been able to boot Linux on the G5 Xserve? I have been > > trying to get it to work for about a week. I've tried all the available > > distribution kernels (mostly 32bit + Gentoo ppc64). I've also built > > some 32bit kernels myself. In all cases, I get no output after > > prom_init finishes. Here is the output from my latest attempt: > > > > > > Transfer FILE: vmlinux \ > > TFTP-actual=415572 TFTP-adler32=1d304c5e Elf32 kernel loaded... > > copying OF device tree...done > > Calling quiesce ... > > > > DO-QUIESCE finishedreturning 0x0160000 from prom_init > > It's known not to boot yet, yes. I haven't had time & access to the HW > to make it work yet. > > Ben. Actually, I managed to get it working. I never got anywhere with the 32 bit kernel, bit I did get the 64bit kernel to work. linux-2.6.6 from kernel.org boots on my machine with the attached patch and config. I'm still haveing trouble with SMP, though. I can boot an SMP kernel with the 'nosmp' command line option. Without nosmp, it either says processor 1 is stuck or hangs when synchronizing the timebase. I've had enough for today. More fun tomorrow. :) Greg -------------- next part -------------- diff -ur linux-2.6.6-working/arch/ppc64/kernel/pmac_feature.c linux-2.6.6/arch/ppc64/kernel/pmac_feature.c --- linux-2.6.6-working/arch/ppc64/kernel/pmac_feature.c 2004-05-13 17:00:12.000000000 -0600 +++ linux-2.6.6/arch/ppc64/kernel/pmac_feature.c 2004-05-09 20:32:54.000000000 -0600 @@ -343,10 +343,6 @@ PMAC_TYPE_POWERMAC_G5, g5_features, 0, }, - { "RackMac3,1", "XServe G5", - PMAC_TYPE_POWERMAC_G5, g5_features, - 0, - }, }; /* diff -ur linux-2.6.6-working/arch/ppc64/kernel/setup.c linux-2.6.6/arch/ppc64/kernel/setup.c --- linux-2.6.6-working/arch/ppc64/kernel/setup.c 2004-05-13 16:06:33.000000000 -0600 +++ linux-2.6.6/arch/ppc64/kernel/setup.c 2004-05-09 20:32:29.000000000 -0600 @@ -547,7 +547,7 @@ int __init ppc_init(void) { /* clear the progress line */ - if(ppc_md.progress) ppc_md.progress(" ", 0xffff); + ppc_md.progress(" ", 0xffff); if (ppc_md.init != NULL) { ppc_md.init(); -------------- next part -------------- # # Automatically generated make config: don't edit # CONFIG_64BIT=y CONFIG_MMU=y CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_GENERIC_ISA_DMA=y CONFIG_HAVE_DEC_LOCK=y CONFIG_EARLY_PRINTK=y CONFIG_COMPAT=y CONFIG_FRAME_POINTER=y CONFIG_FORCE_MAX_ZONEORDER=13 # # Code maturity level options # CONFIG_EXPERIMENTAL=y CONFIG_CLEAN_COMPILE=y # CONFIG_STANDALONE is not set # # General setup # CONFIG_SWAP=y CONFIG_SYSVIPC=y # CONFIG_POSIX_MQUEUE is not set # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=y # CONFIG_AUDIT is not set CONFIG_LOG_BUF_SHIFT=15 CONFIG_HOTPLUG=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_IOSCHED_NOOP=y CONFIG_IOSCHED_AS=y CONFIG_IOSCHED_DEADLINE=y CONFIG_IOSCHED_CFQ=y # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set # # Loadable module support # CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_OBSOLETE_MODPARM=y # CONFIG_MODVERSIONS is not set CONFIG_KMOD=y CONFIG_STOP_MACHINE=y # # Platform support # # CONFIG_PPC_ISERIES is not set CONFIG_PPC_PSERIES=y CONFIG_PPC=y CONFIG_PPC64=y CONFIG_PPC_OF=y CONFIG_ALTIVEC=y CONFIG_PPC_PMAC=y # CONFIG_PMAC_DART is not set CONFIG_PPC_PMAC64=y # CONFIG_BOOTX_TEXT is not set CONFIG_POWER4_ONLY=y # CONFIG_IOMMU_VMERGE is not set CONFIG_SMP=y # CONFIG_IRQ_ALL_CPUS is not set CONFIG_NR_CPUS=2 # CONFIG_HMT is not set # CONFIG_DISCONTIGMEM is not set # CONFIG_PPC_RTAS is not set # CONFIG_LPARCFG is not set # # General setup # CONFIG_PCI=y CONFIG_PCI_DOMAINS=y CONFIG_BINFMT_ELF=y CONFIG_BINFMT_MISC=m # CONFIG_PCI_LEGACY_PROC is not set CONFIG_PCI_NAMES=y # CONFIG_HOTPLUG_CPU is not set # # PCMCIA/CardBus support # # CONFIG_PCMCIA is not set # # PCI Hotplug Support # # CONFIG_HOTPLUG_PCI is not set CONFIG_PROC_DEVICETREE=y # CONFIG_CMDLINE_BOOL is not set # # Device Drivers # # # Generic Driver Options # # CONFIG_FW_LOADER is not set # CONFIG_DEBUG_DRIVER is not set # # Memory Technology Devices (MTD) # # CONFIG_MTD is not set # # Parallel port support # # CONFIG_PARPORT is not set # # Plug and Play support # # # Block devices # # CONFIG_BLK_DEV_FD is not set # CONFIG_BLK_CPQ_DA is not set # CONFIG_BLK_CPQ_CISS_DA is not set # CONFIG_BLK_DEV_DAC960 is not set # CONFIG_BLK_DEV_UMEM is not set CONFIG_BLK_DEV_LOOP=y # CONFIG_BLK_DEV_CRYPTOLOOP is not set # CONFIG_BLK_DEV_NBD is not set # CONFIG_BLK_DEV_CARMEL is not set CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_SIZE=8192 CONFIG_BLK_DEV_INITRD=y # # ATA/ATAPI/MFM/RLL support # CONFIG_IDE=y CONFIG_BLK_DEV_IDE=y # # Please see Documentation/ide.txt for help/info on IDE drives # CONFIG_BLK_DEV_IDEDISK=y # CONFIG_IDEDISK_MULTI_MODE is not set # CONFIG_IDEDISK_STROKE is not set CONFIG_BLK_DEV_IDECD=y # CONFIG_BLK_DEV_IDETAPE is not set # CONFIG_BLK_DEV_IDEFLOPPY is not set # CONFIG_BLK_DEV_IDESCSI is not set # CONFIG_IDE_TASK_IOCTL is not set # CONFIG_IDE_TASKFILE_IO is not set # # IDE chipset support/bugfixes # CONFIG_IDE_GENERIC=y CONFIG_BLK_DEV_IDEPCI=y CONFIG_IDEPCI_SHARE_IRQ=y # CONFIG_BLK_DEV_OFFBOARD is not set CONFIG_BLK_DEV_GENERIC=y # CONFIG_BLK_DEV_OPTI621 is not set CONFIG_BLK_DEV_SL82C105=y CONFIG_BLK_DEV_IDEDMA_PCI=y # CONFIG_BLK_DEV_IDEDMA_FORCED is not set CONFIG_IDEDMA_PCI_AUTO=y # CONFIG_IDEDMA_ONLYDISK is not set CONFIG_BLK_DEV_ADMA=y # CONFIG_BLK_DEV_AEC62XX is not set # CONFIG_BLK_DEV_ALI15X3 is not set # CONFIG_BLK_DEV_AMD74XX is not set CONFIG_BLK_DEV_CMD64X=y # CONFIG_BLK_DEV_TRIFLEX is not set # CONFIG_BLK_DEV_CY82C693 is not set # CONFIG_BLK_DEV_CS5520 is not set # CONFIG_BLK_DEV_CS5530 is not set # CONFIG_BLK_DEV_HPT34X is not set # CONFIG_BLK_DEV_HPT366 is not set # CONFIG_BLK_DEV_SC1200 is not set # CONFIG_BLK_DEV_PIIX is not set # CONFIG_BLK_DEV_NS87415 is not set # CONFIG_BLK_DEV_PDC202XX_OLD is not set # CONFIG_BLK_DEV_PDC202XX_NEW is not set # CONFIG_BLK_DEV_SVWKS is not set # CONFIG_BLK_DEV_SIIMAGE is not set # CONFIG_BLK_DEV_SLC90E66 is not set # CONFIG_BLK_DEV_TRM290 is not set # CONFIG_BLK_DEV_VIA82CXXX is not set CONFIG_BLK_DEV_IDE_PMAC=y CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y CONFIG_BLK_DEV_IDEDMA_PMAC=y CONFIG_BLK_DEV_IDE_PMAC_BLINK=y CONFIG_BLK_DEV_IDEDMA_PMAC_AUTO=y CONFIG_BLK_DEV_IDEDMA=y # CONFIG_IDEDMA_IVB is not set CONFIG_IDEDMA_AUTO=y # CONFIG_BLK_DEV_HD is not set # # SCSI device support # CONFIG_SCSI=y CONFIG_SCSI_PROC_FS=y # # SCSI support type (disk, tape, CD-ROM) # CONFIG_BLK_DEV_SD=y CONFIG_CHR_DEV_ST=y # CONFIG_CHR_DEV_OSST is not set CONFIG_BLK_DEV_SR=y CONFIG_BLK_DEV_SR_VENDOR=y CONFIG_CHR_DEV_SG=y # # Some SCSI devices (e.g. CD jukebox) support multiple LUNs # # CONFIG_SCSI_MULTI_LUN is not set CONFIG_SCSI_REPORT_LUNS=y CONFIG_SCSI_CONSTANTS=y # CONFIG_SCSI_LOGGING is not set # # SCSI Transport Attributes # CONFIG_SCSI_SPI_ATTRS=y # CONFIG_SCSI_FC_ATTRS is not set # # SCSI low-level drivers # # CONFIG_BLK_DEV_3W_XXXX_RAID is not set # CONFIG_SCSI_ACARD is not set # CONFIG_SCSI_AACRAID is not set # CONFIG_SCSI_AIC7XXX is not set # CONFIG_SCSI_AIC7XXX_OLD is not set # CONFIG_SCSI_AIC79XX is not set # CONFIG_SCSI_ADVANSYS is not set # CONFIG_SCSI_MEGARAID is not set CONFIG_SCSI_SATA=y CONFIG_SCSI_SATA_SVW=y # CONFIG_SCSI_ATA_PIIX is not set # CONFIG_SCSI_SATA_PROMISE is not set # CONFIG_SCSI_SATA_SIL is not set # CONFIG_SCSI_SATA_SIS is not set # CONFIG_SCSI_SATA_VIA is not set # CONFIG_SCSI_SATA_VITESSE is not set # CONFIG_SCSI_BUSLOGIC is not set # CONFIG_SCSI_CPQFCTS is not set # CONFIG_SCSI_DMX3191D is not set # CONFIG_SCSI_EATA is not set # CONFIG_SCSI_EATA_PIO is not set # CONFIG_SCSI_FUTURE_DOMAIN is not set # CONFIG_SCSI_GDTH is not set # CONFIG_SCSI_IPS is not set # CONFIG_SCSI_INIA100 is not set # CONFIG_SCSI_SYM53C8XX_2 is not set # CONFIG_SCSI_QLOGIC_ISP is not set # CONFIG_SCSI_QLOGIC_FC is not set # CONFIG_SCSI_QLOGIC_1280 is not set CONFIG_SCSI_QLA2XXX=y # CONFIG_SCSI_QLA21XX is not set # CONFIG_SCSI_QLA22XX is not set # CONFIG_SCSI_QLA2300 is not set # CONFIG_SCSI_QLA2322 is not set # CONFIG_SCSI_QLA6312 is not set # CONFIG_SCSI_QLA6322 is not set # CONFIG_SCSI_DC395x is not set # CONFIG_SCSI_DC390T is not set # CONFIG_SCSI_DEBUG is not set # CONFIG_SCSI_MESH is not set # CONFIG_SCSI_MAC53C94 is not set # # Multi-device support (RAID and LVM) # # CONFIG_MD is not set # # Fusion MPT device support # # CONFIG_FUSION is not set # # IEEE 1394 (FireWire) support # # CONFIG_IEEE1394 is not set # # I2O device support # # # Macintosh device drivers # # CONFIG_ADB is not set CONFIG_ADB_PMU=y # CONFIG_PMAC_PBOOK is not set # CONFIG_PMAC_BACKLIGHT is not set # CONFIG_MAC_SERIAL is not set # CONFIG_THERM_PM72 is not set # # Networking support # CONFIG_NET=y # # Networking options # CONFIG_PACKET=y # CONFIG_PACKET_MMAP is not set # CONFIG_NETLINK_DEV is not set CONFIG_UNIX=y # CONFIG_NET_KEY is not set CONFIG_INET=y CONFIG_IP_MULTICAST=y # CONFIG_IP_ADVANCED_ROUTER is not set # CONFIG_IP_PNP is not set # CONFIG_NET_IPIP is not set # CONFIG_NET_IPGRE is not set # CONFIG_IP_MROUTE is not set # CONFIG_ARPD is not set CONFIG_SYN_COOKIES=y # CONFIG_INET_AH is not set # CONFIG_INET_ESP is not set # CONFIG_INET_IPCOMP is not set # # IP: Virtual Server Configuration # # CONFIG_IP_VS is not set # CONFIG_IPV6 is not set CONFIG_NETFILTER=y # CONFIG_NETFILTER_DEBUG is not set # # IP: Netfilter Configuration # CONFIG_IP_NF_CONNTRACK=m CONFIG_IP_NF_FTP=m CONFIG_IP_NF_IRC=m CONFIG_IP_NF_TFTP=m CONFIG_IP_NF_AMANDA=m # CONFIG_IP_NF_QUEUE is not set CONFIG_IP_NF_IPTABLES=m CONFIG_IP_NF_MATCH_LIMIT=m CONFIG_IP_NF_MATCH_IPRANGE=m CONFIG_IP_NF_MATCH_MAC=m CONFIG_IP_NF_MATCH_PKTTYPE=m CONFIG_IP_NF_MATCH_MARK=m CONFIG_IP_NF_MATCH_MULTIPORT=m CONFIG_IP_NF_MATCH_TOS=m CONFIG_IP_NF_MATCH_RECENT=m CONFIG_IP_NF_MATCH_ECN=m CONFIG_IP_NF_MATCH_DSCP=m CONFIG_IP_NF_MATCH_AH_ESP=m CONFIG_IP_NF_MATCH_LENGTH=m CONFIG_IP_NF_MATCH_TTL=m CONFIG_IP_NF_MATCH_TCPMSS=m CONFIG_IP_NF_MATCH_HELPER=m CONFIG_IP_NF_MATCH_STATE=m CONFIG_IP_NF_MATCH_CONNTRACK=m CONFIG_IP_NF_MATCH_OWNER=m CONFIG_IP_NF_FILTER=m CONFIG_IP_NF_TARGET_REJECT=m CONFIG_IP_NF_NAT=m CONFIG_IP_NF_NAT_NEEDED=y CONFIG_IP_NF_TARGET_MASQUERADE=m CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_TARGET_NETMAP=m CONFIG_IP_NF_TARGET_SAME=m # CONFIG_IP_NF_NAT_LOCAL is not set CONFIG_IP_NF_NAT_SNMP_BASIC=m CONFIG_IP_NF_NAT_IRC=m CONFIG_IP_NF_NAT_FTP=m CONFIG_IP_NF_NAT_TFTP=m CONFIG_IP_NF_NAT_AMANDA=m # CONFIG_IP_NF_MANGLE is not set # CONFIG_IP_NF_TARGET_LOG is not set # CONFIG_IP_NF_TARGET_ULOG is not set CONFIG_IP_NF_TARGET_TCPMSS=m CONFIG_IP_NF_ARPTABLES=m CONFIG_IP_NF_ARPFILTER=m CONFIG_IP_NF_ARP_MANGLE=m CONFIG_IP_NF_COMPAT_IPCHAINS=m # CONFIG_IP_NF_COMPAT_IPFWADM is not set # CONFIG_IP_NF_RAW is not set # # SCTP Configuration (EXPERIMENTAL) # # CONFIG_IP_SCTP is not set # CONFIG_ATM is not set # CONFIG_BRIDGE is not set # CONFIG_VLAN_8021Q is not set # CONFIG_DECNET is not set # CONFIG_LLC2 is not set # CONFIG_IPX is not set # CONFIG_ATALK is not set # CONFIG_X25 is not set # CONFIG_LAPB is not set # CONFIG_NET_DIVERT is not set # CONFIG_ECONET is not set # CONFIG_WAN_ROUTER is not set # CONFIG_NET_FASTROUTE is not set # CONFIG_NET_HW_FLOWCONTROL is not set # # QoS and/or fair queueing # # CONFIG_NET_SCHED is not set # # Network testing # # CONFIG_NET_PKTGEN is not set # CONFIG_NETPOLL is not set # CONFIG_NET_POLL_CONTROLLER is not set # CONFIG_HAMRADIO is not set # CONFIG_IRDA is not set # CONFIG_BT is not set CONFIG_NETDEVICES=y # CONFIG_DUMMY is not set # CONFIG_BONDING is not set # CONFIG_EQUALIZER is not set # CONFIG_TUN is not set # # ARCnet devices # # CONFIG_ARCNET is not set # # Ethernet (10 or 100Mbit) # CONFIG_NET_ETHERNET=y CONFIG_MII=y # CONFIG_MACE is not set # CONFIG_BMAC is not set # CONFIG_OAKNET is not set # CONFIG_HAPPYMEAL is not set # CONFIG_SUNGEM is not set # CONFIG_NET_VENDOR_3COM is not set # # Tulip family network device support # # CONFIG_NET_TULIP is not set # CONFIG_HP100 is not set # CONFIG_IBMVETH is not set # CONFIG_NET_PCI is not set # # Ethernet (1000 Mbit) # # CONFIG_ACENIC is not set # CONFIG_DL2K is not set # CONFIG_E1000 is not set # CONFIG_NS83820 is not set # CONFIG_HAMACHI is not set # CONFIG_YELLOWFIN is not set # CONFIG_R8169 is not set # CONFIG_SK98LIN is not set CONFIG_TIGON3=y # # Ethernet (10000 Mbit) # # CONFIG_IXGB is not set # CONFIG_S2IO is not set # # Token Ring devices # # CONFIG_TR is not set # # Wireless LAN (non-hamradio) # CONFIG_NET_RADIO=y # # Obsolete Wireless cards support (pre-802.11) # # CONFIG_STRIP is not set # # Wireless 802.11b ISA/PCI cards support # # CONFIG_AIRO is not set CONFIG_HERMES=m CONFIG_APPLE_AIRPORT=m # CONFIG_PLX_HERMES is not set # CONFIG_TMD_HERMES is not set # CONFIG_PCI_HERMES is not set # CONFIG_ATMEL is not set # # Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support # # CONFIG_PRISM54 is not set CONFIG_NET_WIRELESS=y # # Wan interfaces # # CONFIG_WAN is not set # CONFIG_FDDI is not set # CONFIG_HIPPI is not set # CONFIG_PPP is not set # CONFIG_SLIP is not set # CONFIG_NET_FC is not set # CONFIG_SHAPER is not set # CONFIG_NETCONSOLE is not set # # ISDN subsystem # # CONFIG_ISDN is not set # # Telephony Support # # CONFIG_PHONE is not set # # Input device support # CONFIG_INPUT=y # # Userland interfaces # CONFIG_INPUT_MOUSEDEV=y CONFIG_INPUT_MOUSEDEV_PSAUX=y CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 # CONFIG_INPUT_JOYDEV is not set # CONFIG_INPUT_TSDEV is not set CONFIG_INPUT_EVDEV=y CONFIG_INPUT_EVBUG=y # # Input I/O drivers # # CONFIG_GAMEPORT is not set CONFIG_SOUND_GAMEPORT=y CONFIG_SERIO=y CONFIG_SERIO_I8042=y CONFIG_SERIO_SERPORT=y # CONFIG_SERIO_CT82C710 is not set # CONFIG_SERIO_PCIPS2 is not set # # Input Device Drivers # CONFIG_INPUT_KEYBOARD=y CONFIG_KEYBOARD_ATKBD=y # CONFIG_KEYBOARD_SUNKBD is not set # CONFIG_KEYBOARD_LKKBD is not set # CONFIG_KEYBOARD_XTKBD is not set # CONFIG_KEYBOARD_NEWTON is not set CONFIG_INPUT_MOUSE=y CONFIG_MOUSE_PS2=y # CONFIG_MOUSE_SERIAL is not set # CONFIG_MOUSE_VSXXXAA is not set # CONFIG_INPUT_JOYSTICK is not set # CONFIG_INPUT_TOUCHSCREEN is not set # CONFIG_INPUT_MISC is not set # # Character devices # CONFIG_VT=y CONFIG_VT_CONSOLE=y CONFIG_HW_CONSOLE=y # CONFIG_SERIAL_NONSTANDARD is not set # # Serial drivers # # CONFIG_SERIAL_8250 is not set # # Non-8250 serial port support # CONFIG_SERIAL_CORE=y CONFIG_SERIAL_CORE_CONSOLE=y CONFIG_SERIAL_PMACZILOG=y CONFIG_SERIAL_PMACZILOG_CONSOLE=y CONFIG_UNIX98_PTYS=y CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 # CONFIG_HVC_CONSOLE is not set # CONFIG_QIC02_TAPE is not set # # IPMI # # CONFIG_IPMI_HANDLER is not set # # Watchdog Cards # # CONFIG_WATCHDOG is not set # CONFIG_RTC is not set # CONFIG_GEN_RTC is not set # CONFIG_DTLK is not set # CONFIG_R3964 is not set # CONFIG_APPLICOM is not set # # Ftape, the floppy tape device driver # # CONFIG_AGP is not set # CONFIG_DRM is not set # CONFIG_RAW_DRIVER is not set # # I2C support # CONFIG_I2C=y # CONFIG_I2C_CHARDEV is not set # # I2C Algorithms # CONFIG_I2C_ALGOBIT=y # CONFIG_I2C_ALGOPCF is not set # # I2C Hardware Bus support # # CONFIG_I2C_ALI1535 is not set # CONFIG_I2C_ALI1563 is not set # CONFIG_I2C_ALI15X3 is not set # CONFIG_I2C_AMD756 is not set # CONFIG_I2C_AMD8111 is not set # CONFIG_I2C_I801 is not set # CONFIG_I2C_I810 is not set # CONFIG_I2C_ISA is not set CONFIG_I2C_KEYWEST=m # CONFIG_I2C_NFORCE2 is not set # CONFIG_I2C_PARPORT_LIGHT is not set # CONFIG_I2C_PROSAVAGE is not set # CONFIG_I2C_SAVAGE4 is not set # CONFIG_SCx200_ACB is not set # CONFIG_I2C_SIS5595 is not set # CONFIG_I2C_SIS630 is not set # CONFIG_I2C_SIS96X is not set # CONFIG_I2C_VIA is not set # CONFIG_I2C_VIAPRO is not set # CONFIG_I2C_VOODOO3 is not set # # Hardware Sensors Chip support # # CONFIG_I2C_SENSOR is not set # CONFIG_SENSORS_ADM1021 is not set # CONFIG_SENSORS_ASB100 is not set # CONFIG_SENSORS_DS1621 is not set # CONFIG_SENSORS_FSCHER is not set # CONFIG_SENSORS_GL518SM is not set # CONFIG_SENSORS_IT87 is not set # CONFIG_SENSORS_LM75 is not set # CONFIG_SENSORS_LM78 is not set # CONFIG_SENSORS_LM80 is not set # CONFIG_SENSORS_LM83 is not set # CONFIG_SENSORS_LM85 is not set # CONFIG_SENSORS_LM90 is not set # CONFIG_SENSORS_VIA686A is not set # CONFIG_SENSORS_W83781D is not set # CONFIG_SENSORS_W83L785TS is not set # CONFIG_SENSORS_W83627HF is not set # # Other I2C Chip support # # CONFIG_SENSORS_EEPROM is not set # CONFIG_SENSORS_PCF8574 is not set # CONFIG_SENSORS_PCF8591 is not set # CONFIG_I2C_DEBUG_CORE is not set # CONFIG_I2C_DEBUG_ALGO is not set # CONFIG_I2C_DEBUG_BUS is not set # CONFIG_I2C_DEBUG_CHIP is not set # # Misc devices # # # Multimedia devices # # CONFIG_VIDEO_DEV is not set # # Digital Video Broadcasting Devices # # CONFIG_DVB is not set # # Graphics support # # CONFIG_FB is not set # # Console display driver support # # CONFIG_VGA_CONSOLE is not set # CONFIG_MDA_CONSOLE is not set CONFIG_DUMMY_CONSOLE=y # # Sound # # CONFIG_SOUND is not set # # USB support # CONFIG_USB=y # CONFIG_USB_DEBUG is not set # # Miscellaneous USB options # CONFIG_USB_DEVICEFS=y # CONFIG_USB_BANDWIDTH is not set # CONFIG_USB_DYNAMIC_MINORS is not set # # USB Host Controller Drivers # # CONFIG_USB_EHCI_HCD is not set CONFIG_USB_OHCI_HCD=y # CONFIG_USB_UHCI_HCD is not set # # USB Device Class drivers # # CONFIG_USB_BLUETOOTH_TTY is not set CONFIG_USB_ACM=m CONFIG_USB_PRINTER=m CONFIG_USB_STORAGE=m # CONFIG_USB_STORAGE_DEBUG is not set # CONFIG_USB_STORAGE_DATAFAB is not set CONFIG_USB_STORAGE_FREECOM=y # CONFIG_USB_STORAGE_ISD200 is not set CONFIG_USB_STORAGE_DPCM=y # CONFIG_USB_STORAGE_HP8200e is not set # CONFIG_USB_STORAGE_SDDR09 is not set # CONFIG_USB_STORAGE_SDDR55 is not set # CONFIG_USB_STORAGE_JUMPSHOT is not set # # USB Human Interface Devices (HID) # CONFIG_USB_HID=y CONFIG_USB_HIDINPUT=y # CONFIG_HID_FF is not set # CONFIG_USB_HIDDEV is not set # CONFIG_USB_AIPTEK is not set # CONFIG_USB_WACOM is not set # CONFIG_USB_KBTAB is not set # CONFIG_USB_POWERMATE is not set # CONFIG_USB_MTOUCH is not set # CONFIG_USB_XPAD is not set # CONFIG_USB_ATI_REMOTE is not set # # USB Imaging devices # # CONFIG_USB_MDC800 is not set # CONFIG_USB_MICROTEK is not set # CONFIG_USB_HPUSBSCSI is not set # # USB Multimedia devices # # CONFIG_USB_DABUSB is not set # # Video4Linux support is needed for USB Multimedia device support # # # USB Network adaptors # # CONFIG_USB_CATC is not set # CONFIG_USB_KAWETH is not set # CONFIG_USB_PEGASUS is not set # CONFIG_USB_RTL8150 is not set # CONFIG_USB_USBNET is not set # # USB port drivers # # # USB Serial Converter support # CONFIG_USB_SERIAL=m # CONFIG_USB_SERIAL_GENERIC is not set # CONFIG_USB_SERIAL_BELKIN is not set # CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set # CONFIG_USB_SERIAL_EMPEG is not set # CONFIG_USB_SERIAL_FTDI_SIO is not set CONFIG_USB_SERIAL_VISOR=m # CONFIG_USB_SERIAL_IPAQ is not set # CONFIG_USB_SERIAL_IR is not set # CONFIG_USB_SERIAL_EDGEPORT is not set # CONFIG_USB_SERIAL_EDGEPORT_TI is not set # CONFIG_USB_SERIAL_KEYSPAN_PDA is not set CONFIG_USB_SERIAL_KEYSPAN=m # CONFIG_USB_SERIAL_KEYSPAN_MPR is not set CONFIG_USB_SERIAL_KEYSPAN_USA28=y CONFIG_USB_SERIAL_KEYSPAN_USA28X=y # CONFIG_USB_SERIAL_KEYSPAN_USA28XA is not set # CONFIG_USB_SERIAL_KEYSPAN_USA28XB is not set CONFIG_USB_SERIAL_KEYSPAN_USA19=y CONFIG_USB_SERIAL_KEYSPAN_USA18X=y CONFIG_USB_SERIAL_KEYSPAN_USA19W=y # CONFIG_USB_SERIAL_KEYSPAN_USA19QW is not set # CONFIG_USB_SERIAL_KEYSPAN_USA19QI is not set CONFIG_USB_SERIAL_KEYSPAN_USA49W=y # CONFIG_USB_SERIAL_KEYSPAN_USA49WLC is not set # CONFIG_USB_SERIAL_KLSI is not set # CONFIG_USB_SERIAL_KOBIL_SCT is not set # CONFIG_USB_SERIAL_MCT_U232 is not set # CONFIG_USB_SERIAL_PL2303 is not set # CONFIG_USB_SERIAL_SAFE is not set # CONFIG_USB_SERIAL_CYBERJACK is not set # CONFIG_USB_SERIAL_XIRCOM is not set # CONFIG_USB_SERIAL_OMNINET is not set CONFIG_USB_EZUSB=y # # USB Miscellaneous drivers # # CONFIG_USB_EMI62 is not set # CONFIG_USB_EMI26 is not set # CONFIG_USB_TIGL is not set # CONFIG_USB_AUERSWALD is not set # CONFIG_USB_RIO500 is not set # CONFIG_USB_LEGOTOWER is not set # CONFIG_USB_LCD is not set # CONFIG_USB_LED is not set # CONFIG_USB_CYTHERM is not set # CONFIG_USB_TEST is not set # # USB Gadget Support # # CONFIG_USB_GADGET is not set # # File systems # CONFIG_EXT2_FS=y # CONFIG_EXT2_FS_XATTR is not set CONFIG_EXT3_FS=y # CONFIG_EXT3_FS_XATTR is not set CONFIG_JBD=y # CONFIG_JBD_DEBUG is not set # CONFIG_REISERFS_FS is not set # CONFIG_JFS_FS is not set # CONFIG_XFS_FS is not set # CONFIG_MINIX_FS is not set # CONFIG_ROMFS_FS is not set # CONFIG_QUOTA is not set # CONFIG_AUTOFS_FS is not set # CONFIG_AUTOFS4_FS is not set # # CD-ROM/DVD Filesystems # CONFIG_ISO9660_FS=y CONFIG_JOLIET=y # CONFIG_ZISOFS is not set # CONFIG_UDF_FS is not set # # DOS/FAT/NT Filesystems # CONFIG_FAT_FS=m CONFIG_MSDOS_FS=m CONFIG_VFAT_FS=m # CONFIG_NTFS_FS is not set # # Pseudo filesystems # CONFIG_PROC_FS=y CONFIG_PROC_KCORE=y CONFIG_SYSFS=y CONFIG_DEVFS_FS=y # CONFIG_DEVFS_MOUNT is not set # CONFIG_DEVFS_DEBUG is not set # CONFIG_DEVPTS_FS_XATTR is not set CONFIG_TMPFS=y # CONFIG_HUGETLBFS is not set # CONFIG_HUGETLB_PAGE is not set CONFIG_RAMFS=y # # Miscellaneous filesystems # # CONFIG_ADFS_FS is not set # CONFIG_AFFS_FS is not set CONFIG_HFS_FS=m CONFIG_HFSPLUS_FS=m # CONFIG_BEFS_FS is not set # CONFIG_BFS_FS is not set # CONFIG_EFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_VXFS_FS is not set # CONFIG_HPFS_FS is not set # CONFIG_QNX4FS_FS is not set # CONFIG_SYSV_FS is not set # CONFIG_UFS_FS is not set # # Network File Systems # CONFIG_NFS_FS=m CONFIG_NFS_V3=y # CONFIG_NFS_V4 is not set # CONFIG_NFS_DIRECTIO is not set CONFIG_NFSD=m CONFIG_NFSD_V3=y # CONFIG_NFSD_V4 is not set # CONFIG_NFSD_TCP is not set CONFIG_LOCKD=m CONFIG_LOCKD_V4=y CONFIG_EXPORTFS=m CONFIG_SUNRPC=m # CONFIG_RPCSEC_GSS_KRB5 is not set # CONFIG_SMB_FS is not set # CONFIG_CIFS is not set # CONFIG_NCP_FS is not set # CONFIG_CODA_FS is not set # CONFIG_INTERMEZZO_FS is not set # CONFIG_AFS_FS is not set # # Partition Types # CONFIG_PARTITION_ADVANCED=y # CONFIG_ACORN_PARTITION is not set # CONFIG_OSF_PARTITION is not set # CONFIG_AMIGA_PARTITION is not set # CONFIG_ATARI_PARTITION is not set CONFIG_MAC_PARTITION=y CONFIG_MSDOS_PARTITION=y # CONFIG_BSD_DISKLABEL is not set # CONFIG_MINIX_SUBPARTITION is not set # CONFIG_SOLARIS_X86_PARTITION is not set # CONFIG_UNIXWARE_DISKLABEL is not set # CONFIG_LDM_PARTITION is not set # CONFIG_NEC98_PARTITION is not set # CONFIG_SGI_PARTITION is not set # CONFIG_ULTRIX_PARTITION is not set # CONFIG_SUN_PARTITION is not set # CONFIG_EFI_PARTITION is not set # # Native Language Support # CONFIG_NLS=y CONFIG_NLS_DEFAULT="iso8859-1" # CONFIG_NLS_CODEPAGE_437 is not set # CONFIG_NLS_CODEPAGE_737 is not set # CONFIG_NLS_CODEPAGE_775 is not set # CONFIG_NLS_CODEPAGE_850 is not set # CONFIG_NLS_CODEPAGE_852 is not set # CONFIG_NLS_CODEPAGE_855 is not set # CONFIG_NLS_CODEPAGE_857 is not set # CONFIG_NLS_CODEPAGE_860 is not set # CONFIG_NLS_CODEPAGE_861 is not set # CONFIG_NLS_CODEPAGE_862 is not set # CONFIG_NLS_CODEPAGE_863 is not set # CONFIG_NLS_CODEPAGE_864 is not set # CONFIG_NLS_CODEPAGE_865 is not set # CONFIG_NLS_CODEPAGE_866 is not set # CONFIG_NLS_CODEPAGE_869 is not set # CONFIG_NLS_CODEPAGE_936 is not set # CONFIG_NLS_CODEPAGE_950 is not set # CONFIG_NLS_CODEPAGE_932 is not set # CONFIG_NLS_CODEPAGE_949 is not set # CONFIG_NLS_CODEPAGE_874 is not set # CONFIG_NLS_ISO8859_8 is not set # CONFIG_NLS_CODEPAGE_1250 is not set # CONFIG_NLS_CODEPAGE_1251 is not set CONFIG_NLS_ISO8859_1=m # CONFIG_NLS_ISO8859_2 is not set # CONFIG_NLS_ISO8859_3 is not set # CONFIG_NLS_ISO8859_4 is not set # CONFIG_NLS_ISO8859_5 is not set # CONFIG_NLS_ISO8859_6 is not set # CONFIG_NLS_ISO8859_7 is not set # CONFIG_NLS_ISO8859_9 is not set # CONFIG_NLS_ISO8859_13 is not set # CONFIG_NLS_ISO8859_14 is not set # CONFIG_NLS_ISO8859_15 is not set # CONFIG_NLS_KOI8_R is not set # CONFIG_NLS_KOI8_U is not set # CONFIG_NLS_UTF8 is not set # # Profiling support # # CONFIG_PROFILING is not set # # Kernel hacking # CONFIG_DEBUG_KERNEL=y # CONFIG_DEBUG_STACKOVERFLOW is not set # CONFIG_DEBUG_STACK_USAGE is not set # CONFIG_DEBUG_SLAB is not set CONFIG_MAGIC_SYSRQ=y # CONFIG_DEBUGGER is not set # CONFIG_PPCDBG is not set # CONFIG_DEBUG_INFO is not set # # Security options # # CONFIG_SECURITY is not set # # Cryptographic options # # CONFIG_CRYPTO is not set # # Library routines # CONFIG_CRC32=y # CONFIG_LIBCRC32C is not set From sfr at canb.auug.org.au Fri May 14 15:53:28 2004 From: sfr at canb.auug.org.au (Stephen Rothwell) Date: Fri, 14 May 2004 15:53:28 +1000 Subject: [PATCH] PPC64 iSeries: allow read only virtual disks Message-ID: <20040514155328.26b9a82d.sfr@canb.auug.org.au> Hi Andrew, Linus, It is possible to attach a virtual disk to a logical partition on an iSeries machine so that it is read only to the partition. This patch allows Linux to use such virtual disks. -- Cheers, Stephen Rothwell sfr at canb.auug.org.au http://www.canb.auug.org.au/~sfr/ -------------- next part -------------- diff -ruN 2.6.6-bk1/drivers/block/viodasd.c 2.6.6-bk1.dasd.1/drivers/block/viodasd.c --- 2.6.6-bk1/drivers/block/viodasd.c 2004-03-11 15:39:15.000000000 +1100 +++ 2.6.6-bk1.dasd.1/drivers/block/viodasd.c 2004-05-14 13:42:24.000000000 +1000 @@ -175,6 +175,13 @@ struct viodasd_device *d = ino->i_bdev->bd_disk->private_data; HvLpEvent_Rc hvrc; struct viodasd_waitevent we; + u16 flags = 0; + + if (d->read_only) { + if ((fil != NULL) && (fil->f_mode & FMODE_WRITE)) + return -EROFS; + flags = vioblockflags_ro; + } init_completion(&we.com); @@ -186,7 +193,7 @@ viopath_sourceinst(viopath_hostLp), viopath_targetinst(viopath_hostLp), (u64)(unsigned long)&we, VIOVERSION << 16, - ((u64)DEVICE_NO(d) << 48) /* | ((u64)flags << 32) */, + ((u64)DEVICE_NO(d) << 48) | ((u64)flags << 32), 0, 0, 0); if (hvrc != 0) { printk(VIOD_KERN_WARNING "HV open failed %d\n", (int)hvrc); @@ -456,7 +463,9 @@ int dev_no = DEVICE_NO(d); struct gendisk *g; struct request_queue *q; + u16 flags = 0; +retry: init_completion(&we.com); /* Send the open event to OS/400 */ @@ -467,7 +476,7 @@ viopath_sourceinst(viopath_hostLp), viopath_targetinst(viopath_hostLp), (u64)(unsigned long)&we, VIOVERSION << 16, - ((u64)dev_no << 48) | ((u64)vioblockflags_ro << 32), + ((u64)dev_no << 48) | ((u64)flags<< 32), 0, 0, 0); if (hvrc != 0) { printk(VIOD_KERN_WARNING "bad rc on HV open %d\n", (int)hvrc); @@ -476,8 +485,13 @@ wait_for_completion(&we.com); - if (we.rc != 0) - return; + if (we.rc != 0) { + if (flags != 0) + return; + /* try again with read only flag set */ + flags = vioblockflags_ro; + goto retry; + } if (we.max_disk > (MAX_DISKNO - 1)) { static int warned; @@ -498,7 +512,7 @@ viopath_sourceinst(viopath_hostLp), viopath_targetinst(viopath_hostLp), 0, VIOVERSION << 16, - ((u64)dev_no << 48) | ((u64)vioblockflags_ro << 32), + ((u64)dev_no << 48) | ((u64)flags << 32), 0, 0, 0); if (hvrc != 0) { printk(VIOD_KERN_WARNING @@ -506,11 +520,12 @@ return; } printk(VIOD_KERN_INFO "disk %d: %lu sectors (%lu MB) " - "CHS=%d/%d/%d sector size %d\n", + "CHS=%d/%d/%d sector size %d%s\n", dev_no, (unsigned long)(d->size >> 9), (unsigned long)(d->size >> 20), (int)d->cylinders, (int)d->tracks, - (int)d->sectors, (int)d->bytes_per_sector); + (int)d->sectors, (int)d->bytes_per_sector, + d->read_only ? " (RO)" : ""); /* create the request queue for the disk */ spin_lock_init(&d->q_lock); q = blk_init_queue(do_viodasd_request, &d->q_lock); From Derek.Fults at gd-ais.com Sat May 15 01:38:28 2004 From: Derek.Fults at gd-ais.com (Derek.Fults at gd-ais.com) Date: Fri, 14 May 2004 10:38:28 -0500 Subject: Linux on G5 Xserve? In-Reply-To: <20040514004348.GG1256@durango.c3.lanl.gov> References: <20040513162330.GF1256@durango.c3.lanl.gov> <1084493567.13730.125.camel@gaston> <20040514004348.GG1256@durango.c3.lanl.gov> Message-ID: <1084549108.1706.35.camel@kato.gd-ais.com> Greg, I've tried your patch and config file on the 2.6.6 kernel sources, but still no joy. I still don't see anything after 'returning from prom_init" I was hoping I could gather some information about you environment if you don't mind. I'm using yaboot 1.3.11, I'm able to load a kernel using the command, enet:,vmlinux, but it fails when trying to load a yaboot.conf file. I was curious if you're seeing this as well. Can you tell me what version of binutils and compiler you're using? Have you changed any environment variables in OF to scca? Is there anything else that could be different that I'm forgetting? Thanks Derek On Thu, 2004-05-13 at 19:43, Greg Johnson wrote: > On Fri, May 14, 2004 at 10:12:48AM +1000, Benjamin Herrenschmidt wrote: > > On Fri, 2004-05-14 at 02:23, Greg Johnson wrote: > > > Has anybody been able to boot Linux on the G5 Xserve? I have been > > > trying to get it to work for about a week. I've tried all the available > > > distribution kernels (mostly 32bit + Gentoo ppc64). I've also built > > > some 32bit kernels myself. In all cases, I get no output after > > > prom_init finishes. Here is the output from my latest attempt: > > > > > > > > > Transfer FILE: vmlinux \ > > > TFTP-actual=415572 TFTP-adler32=1d304c5e Elf32 kernel loaded... > > > copying OF device tree...done > > > Calling quiesce ... > > > > > > DO-QUIESCE finishedreturning 0x0160000 from prom_init > > > > It's known not to boot yet, yes. I haven't had time & access to the HW > > to make it work yet. > > > > Ben. > > Actually, I managed to get it working. I never got anywhere with the 32 > bit kernel, bit I did get the 64bit kernel to work. > > linux-2.6.6 from kernel.org boots on my machine with the attached patch > and config. > > I'm still haveing trouble with SMP, though. I can boot an SMP kernel > with the 'nosmp' command line option. Without nosmp, it either says > processor 1 is stuck or hangs when synchronizing the timebase. > > I've had enough for today. More fun tomorrow. :) > > Greg > ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From gjohnson at lanl.gov Sat May 15 01:56:07 2004 From: gjohnson at lanl.gov (Greg Johnson) Date: Fri, 14 May 2004 09:56:07 -0600 Subject: Linux on G5 Xserve? In-Reply-To: <1084549108.1706.35.camel@kato.gd-ais.com> References: <20040513162330.GF1256@durango.c3.lanl.gov> <1084493567.13730.125.camel@gaston> <20040514004348.GG1256@durango.c3.lanl.gov> <1084549108.1706.35.camel@kato.gd-ais.com> Message-ID: <20040514155607.GH1256@durango.c3.lanl.gov> On Fri, May 14, 2004 at 10:38:28AM -0500, Derek.Fults at gd-ais.com wrote: > Greg, > I've tried your patch and config file on the 2.6.6 kernel sources, but > still no joy. I still don't see anything after 'returning from > prom_init" > > I was hoping I could gather some information about you environment if > you don't mind. Sure, no problem. > I'm using yaboot 1.3.11, I'm able to load a kernel using the command, > enet:,vmlinux, but it fails when trying to load a yaboot.conf file. I > was curious if you're seeing this as well. I'm using yaboot 1.3.12 which I hacked a bit. Out of the box it won't load the config file. I changed line 1505 in second/yaboot.c from useconf = load_config_file(boot.dev, boot.file, boot.part); to useconf = load_config_file("enet:10.0.5.1", "", 0); to get it to load the config file. Yaboot is incorectly parsing the device path/partition which can be seen by turning on debugging. > Can you tell me what version of binutils and compiler you're using? I am cross compiling a 64 bit kernel on a 32 bit ppc machine. I built a cross-toolchain from the debian toolchain-source package. I'm not sure what patches debian includes. The versions are: powerpc64-linux-gcc (GCC) 3.3.3 (Debian 20040321) GNU ld version 2.14.90.0.7 20031029 Debian GNU/Linux > Have you changed any environment variables in OF to scca? Yeah, I changed all the input and output's to scca. I'm not sure if this mattered. > Is there anything else that could be different that I'm forgetting? I don't know. Sounds like our setups are pretty similar. I'm netbooting like you. Make sure you pass "console=ttyS0" on the command line. SMP is broken at the moment, so also use "nosmp" if you build an SMP kernel. I'll send you my kernel off-list. Yaboot shouldn't make too much difference, except for the config file loading. Greg ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From santil at us.ibm.com Sat May 15 03:39:43 2004 From: santil at us.ibm.com (Santiago Leon) Date: Fri, 14 May 2004 12:39:43 -0500 Subject: [PATCH] PowerPC Virtual Ethernet duplicate MAC addresses Message-ID: <40A5045F.7010108@us.ibm.com> Linus, Please apply this patch, it fixes a bug where different partitions were assigned the same MAC address. Also, according to Anton, gcc 3.5 didn't like our mac_addr_p gymnastics, so this ends up fixing that as well. Thank you, -- Santiago A. Leon Power Linux Development IBM Linux Technology Center -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ibmveth_dup_macs.patch Url: http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20040514/2c1f617c/attachment.txt From santil at us.ibm.com Sat May 15 03:39:47 2004 From: santil at us.ibm.com (Santiago Leon) Date: Fri, 14 May 2004 12:39:47 -0500 Subject: [PATCH] PowerPC Virtual Ethernet links to /sys/class/net/ethX Message-ID: <40A50463.1030607@us.ibm.com> Linus, Please apply this patch, it adds links to the driver and device inside /sys/class/net/ethX for PowerPC Virtual Ethernet devices. Thank you, -- Santiago A. Leon Power Linux Development IBM Linux Technology Center -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ibmveth_sysfs_class.patch Url: http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20040514/6927914e/attachment.txt From gjohnson at lanl.gov Sat May 15 06:28:29 2004 From: gjohnson at lanl.gov (Greg Johnson) Date: Fri, 14 May 2004 14:28:29 -0600 Subject: Linux on G5 Xserve? In-Reply-To: <1084493567.13730.125.camel@gaston> References: <20040513162330.GF1256@durango.c3.lanl.gov> <1084493567.13730.125.camel@gaston> Message-ID: <20040514202829.GM1256@durango.c3.lanl.gov> > It's known not to boot yet, yes. I haven't had time & access to the HW > to make it work yet. > > Ben. Power management seems to work with this patch. I still haven't figured out the issue with SMP, but I did install Debian! Greg -------------- next part -------------- diff -ur linux-2.6.6.orig/arch/ppc64/kernel/pmac_feature.c linux-2.6.6/arch/ppc64/kernel/pmac_feature.c --- linux-2.6.6.orig/arch/ppc64/kernel/pmac_feature.c 2004-05-10 02:32:54.000000000 +0000 +++ linux-2.6.6/arch/ppc64/kernel/pmac_feature.c 2004-05-14 19:30:54.000000000 +0000 @@ -343,6 +343,10 @@ PMAC_TYPE_POWERMAC_G5, g5_features, 0, }, + { "RackMac3,1", "XServe G5", + PMAC_TYPE_POWERMAC_G5, g5_features, + 0, + }, }; /* diff -ur linux-2.6.6.orig/arch/ppc64/kernel/setup.c linux-2.6.6/arch/ppc64/kernel/setup.c --- linux-2.6.6.orig/arch/ppc64/kernel/setup.c 2004-05-10 02:32:29.000000000 +0000 +++ linux-2.6.6/arch/ppc64/kernel/setup.c 2004-05-14 19:30:59.000000000 +0000 @@ -547,7 +547,7 @@ int __init ppc_init(void) { /* clear the progress line */ - ppc_md.progress(" ", 0xffff); + if(ppc_md.progress) ppc_md.progress(" ", 0xffff); if (ppc_md.init != NULL) { ppc_md.init(); diff -ur linux-2.6.6.orig/drivers/macintosh/therm_pm72.c linux-2.6.6/drivers/macintosh/therm_pm72.c --- linux-2.6.6.orig/drivers/macintosh/therm_pm72.c 2004-05-10 02:33:09.000000000 +0000 +++ linux-2.6.6/drivers/macintosh/therm_pm72.c 2004-05-14 20:03:37.000000000 +0000 @@ -1287,7 +1287,7 @@ { struct device_node *np; - if (!machine_is_compatible("PowerMac7,2")) + if (!machine_is_compatible("PowerMac7,2") && !machine_is_compatible("RackMac3,1")) return -ENODEV; printk(KERN_INFO "PowerMac G5 Thermal control driver %s\n", VERSION); From benh at kernel.crashing.org Sat May 15 07:18:20 2004 From: benh at kernel.crashing.org (Benjamin Herrenschmidt) Date: Sat, 15 May 2004 07:18:20 +1000 Subject: Linux on G5 Xserve? In-Reply-To: <20040514202829.GM1256@durango.c3.lanl.gov> References: <20040513162330.GF1256@durango.c3.lanl.gov> <1084493567.13730.125.camel@gaston> <20040514202829.GM1256@durango.c3.lanl.gov> Message-ID: <1084569500.31383.15.camel@gaston> On Sat, 2004-05-15 at 06:28, Greg Johnson wrote: > > It's known not to boot yet, yes. I haven't had time & access to the HW > > to make it work yet. > > > > Ben. > > Power management seems to work with this patch. I still haven't figured > out the issue with SMP, but I did install Debian! Hrm, no, please, do _NOT_ use the existing PM driver, it will not drive the fans properly on this machine. There are some differences in the way the stuffs are setup, some fans will not be driven at all I'm afraid and we may mix incorrect temperature inputs with fan outputs. I or somebody else from YDL produce something based on the Darwin source soon enough. Ben. ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From gjohnson at lanl.gov Sat May 15 07:28:02 2004 From: gjohnson at lanl.gov (Greg Johnson) Date: Fri, 14 May 2004 15:28:02 -0600 Subject: Linux on G5 Xserve? In-Reply-To: <1084569500.31383.15.camel@gaston> References: <20040513162330.GF1256@durango.c3.lanl.gov> <1084493567.13730.125.camel@gaston> <20040514202829.GM1256@durango.c3.lanl.gov> <1084569500.31383.15.camel@gaston> Message-ID: <20040514212802.GO1256@durango.c3.lanl.gov> On Sat, May 15, 2004 at 07:18:20AM +1000, Benjamin Herrenschmidt wrote: > > Hrm, no, please, do _NOT_ use the existing PM driver, it will not drive > the fans properly on this machine. There are some differences in the > way the stuffs are setup, some fans will not be driven at all I'm afraid > and we may mix incorrect temperature inputs with fan outputs. Ok. Good to know. > > I or somebody else from YDL produce something based on the Darwin source > soon enough. Where is the power management in the Darwin source? Anythoughts about SMP? Thanks, Greg ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From benh at kernel.crashing.org Sat May 15 07:31:44 2004 From: benh at kernel.crashing.org (Benjamin Herrenschmidt) Date: Sat, 15 May 2004 07:31:44 +1000 Subject: Linux on G5 Xserve? In-Reply-To: <20040514212802.GO1256@durango.c3.lanl.gov> References: <20040513162330.GF1256@durango.c3.lanl.gov> <1084493567.13730.125.camel@gaston> <20040514202829.GM1256@durango.c3.lanl.gov> <1084569500.31383.15.camel@gaston> <20040514212802.GO1256@durango.c3.lanl.gov> Message-ID: <1084570304.31383.17.camel@gaston> On Sat, 2004-05-15 at 07:28, Greg Johnson wrote: > On Sat, May 15, 2004 at 07:18:20AM +1000, Benjamin Herrenschmidt wrote: > > > > Hrm, no, please, do _NOT_ use the existing PM driver, it will not drive > > the fans properly on this machine. There are some differences in the > > way the stuffs are setup, some fans will not be driven at all I'm afraid > > and we may mix incorrect temperature inputs with fan outputs. > > Ok. Good to know. > > > > > I or somebody else from YDL produce something based on the Darwin source > > soon enough. > > Where is the power management in the Darwin source? Anythoughts about > SMP? PM is in AppleMacRISC4PE, nnot sure about SMP at this point Ben. ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From benh at kernel.crashing.org Sat May 15 07:34:57 2004 From: benh at kernel.crashing.org (Benjamin Herrenschmidt) Date: Sat, 15 May 2004 07:34:57 +1000 Subject: Linux on G5 Xserve? In-Reply-To: <20040514212802.GO1256@durango.c3.lanl.gov> References: <20040513162330.GF1256@durango.c3.lanl.gov> <1084493567.13730.125.camel@gaston> <20040514202829.GM1256@durango.c3.lanl.gov> <1084569500.31383.15.camel@gaston> <20040514212802.GO1256@durango.c3.lanl.gov> Message-ID: <1084570497.31383.20.camel@gaston> On Sat, 2004-05-15 at 07:28, Greg Johnson wrote: > Where is the power management in the Darwin source? Anythoughts about > SMP? This patch may fix SMP for the Xserve g5, at least it should help ===== arch/ppc64/kernel/cpu_setup_power4.S 1.2 vs edited ===== --- 1.2/arch/ppc64/kernel/cpu_setup_power4.S Wed May 5 14:54:35 2004 +++ edited/arch/ppc64/kernel/cpu_setup_power4.S Sat May 15 07:33:10 2004 @@ -119,7 +119,9 @@ /* We only deal with 970 for now */ mfspr r0,SPRN_PVR srwi r0,r0,16 - cmpwi r0,0x39 + cmpwi cr0,r0,0x39 + cmpwi cr1,r0,0x3c + cror 4*cr0+eq,4*cr0+eq,4*cr1+eq bne 1f /* Save HID0,1,4 and 5 */ @@ -149,7 +151,9 @@ /* We only deal with 970 for now */ mfspr r0,SPRN_PVR srwi r0,r0,16 - cmpwi r0,0x39 + cmpwi cr0,r0,0x39 + cmpwi cr1,r0,0x3c + cror 4*cr0+eq,4*cr0+eq,4*cr1+eq bne 1f /* Clear interrupt prefix */ ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From sleddog at us.ibm.com Sat May 15 07:39:31 2004 From: sleddog at us.ibm.com (Dave Boutcher) Date: Fri, 14 May 2004 16:39:31 -0500 Subject: [PATCH] Fix to viopath.c Message-ID: Cooperative patch developed by olh and ntl that fixes a couple of nasty lurking bugs in viopath.c and adds information required to know if the iseries_veth module should be loaded on legacy iSeries systems. Paul, can you please apply to ames and include the next time you push things upstream? Dave B -------------- next part -------------- A non-text attachment was scrubbed... Name: olaf3.patch Type: application/octet-stream Size: 1169 bytes Desc: not available Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20040514/c9cc51bd/attachment.obj From gjohnson at lanl.gov Sat May 15 07:59:31 2004 From: gjohnson at lanl.gov (Greg Johnson) Date: Fri, 14 May 2004 15:59:31 -0600 Subject: Linux on G5 Xserve? In-Reply-To: <1084570497.31383.20.camel@gaston> References: <20040513162330.GF1256@durango.c3.lanl.gov> <1084493567.13730.125.camel@gaston> <20040514202829.GM1256@durango.c3.lanl.gov> <1084569500.31383.15.camel@gaston> <20040514212802.GO1256@durango.c3.lanl.gov> <1084570497.31383.20.camel@gaston> Message-ID: <20040514215931.GP1256@durango.c3.lanl.gov> On Sat, May 15, 2004 at 07:34:57AM +1000, Benjamin Herrenschmidt wrote: > On Sat, 2004-05-15 at 07:28, Greg Johnson wrote: > > This patch may fix SMP for the Xserve g5, at least it should help Yep, that did it. Thanks! Greg ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From anton at samba.org Tue May 18 00:46:08 2004 From: anton at samba.org (Anton Blanchard) Date: Tue, 18 May 2004 00:46:08 +1000 Subject: readq/writeq bust? Message-ID: <20040517144608.GA2037@krispykreme> Hi, I had to back the fix out of the s2io driver so it wouldnt use our readq/writeq macros. Are they bust? Anton diff -puN drivers/net/s2io.h~s2iofix1 drivers/net/s2io.h --- gr_work/drivers/net/s2io.h~s2iofix1 2004-05-12 23:26:16.773818328 -0500 +++ gr_work-anton/drivers/net/s2io.h 2004-05-12 23:26:16.789815798 -0500 @@ -749,8 +749,9 @@ typedef struct s2io_nic { #define LARGE_RXD_CNT 100 * (MAX_RXDS_PER_BLOCK+1) /* OS related system calls */ -#ifndef readq -static inline u64 readq(void *addr) +#define readq readq__ +#ifndef readq__ +static inline u64 readq__(void *addr) { u64 ret = 0; ret = readl(addr + 4); @@ -761,8 +762,9 @@ static inline u64 readq(void *addr) } #endif -#ifndef writeq -static inline void writeq(u64 val, void *addr) +#define writeq writeq__ +#ifndef writeq__ +static inline void writeq__(u64 val, void *addr) { writel((u32) (val), addr); writel((u32) (val >> 32), (addr + 4)); _ ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From ananth at in.ibm.com Wed May 19 00:07:54 2004 From: ananth at in.ibm.com (Ananth N Mavinakayanahalli) Date: Tue, 18 May 2004 19:07:54 +0500 Subject: [PATCH] KDB for ppc64 - write to OF stdout instead of console Message-ID: <20040518140754.GA19828@in.ibm.com> Hi Anton, KDB on ppc64 currently reads input from the OF-stdout (udbg_getc_poll) while the output (kdb_printf) is through the registered consoles. This leads to problems when working on LPAR mode, where, input is accepted through the hmc vterm while output is displayed on the serial console. Patch inlined removes KDB's dependency on consoles completely for I/O. With this patch, we use the OF stdout for both input and output. This should fix the KDB configuration/usage confusions on ppc64 for both LPAR and non-LPAR modes. Please apply! Thanks, Ananth -- Ananth Narayan Linux Technology Center, IBM Software Lab, INDIA diff -Naurp temp/ameslab/kdb/kdb_io.c ameslab/kdb/kdb_io.c --- temp/ameslab/kdb/kdb_io.c 2004-05-04 02:07:51.000000000 -0700 +++ ameslab/kdb/kdb_io.c 2004-05-17 23:37:11.373470688 -0700 @@ -55,6 +55,9 @@ static struct console *kdbcons; #endif +#ifdef CONFIG_PPC64 +#include +#endif #define CMD_BUFLEN 256 char kdb_prompt_str[CMD_BUFLEN]; @@ -521,6 +524,13 @@ kdb_printf(const char *fmt, ...) prom_printf("%s", kdb_buffer); else #endif + +#ifdef CONFIG_PPC64 + if (udbg_write) + udbg_write(kdb_buffer, strlen(kdb_buffer)); + else +#endif + while (c) { c->write(c, kdb_buffer, strlen(kdb_buffer)); c = c->next; @@ -569,6 +579,13 @@ kdb_printf(const char *fmt, ...) prom_printf("%s", moreprompt); else #endif + +#ifdef CONFIG_PPC64 + if (udbg_write) + udbg_write(moreprompt, strlen(moreprompt)); + else +#endif + while (c) { c->write(c, moreprompt, strlen(moreprompt)); c = c->next; ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From kaos at sgi.com Wed May 19 12:11:04 2004 From: kaos at sgi.com (Keith Owens) Date: Wed, 19 May 2004 12:11:04 +1000 Subject: [PATCH] KDB for ppc64 - write to OF stdout instead of console In-Reply-To: Your message of "Tue, 18 May 2004 19:07:54 +0500." <20040518140754.GA19828@in.ibm.com> Message-ID: <4871.1084932664@kao2.melbourne.sgi.com> On Tue, 18 May 2004 19:07:54 +0500, Ananth N Mavinakayanahalli wrote: >Hi Anton, > >KDB on ppc64 currently reads input from the OF-stdout (udbg_getc_poll) >while the output (kdb_printf) is through the registered consoles. This >leads to problems when working on LPAR mode, where, input is accepted >through the hmc vterm while output is displayed on the serial console. > >Patch inlined removes KDB's dependency on consoles completely for I/O. >With this patch, we use the OF stdout for both input and output. > >This should fix the KDB configuration/usage confusions on ppc64 for >both LPAR and non-LPAR modes. > >Please apply! Added to my kdb v4.4 tree. ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From benh at kernel.crashing.org Wed May 19 15:55:46 2004 From: benh at kernel.crashing.org (Benjamin Herrenschmidt) Date: Wed, 19 May 2004 15:55:46 +1000 Subject: readq/writeq bust? In-Reply-To: <20040517144608.GA2037@krispykreme> References: <20040517144608.GA2037@krispykreme> Message-ID: <1084946146.17981.56.camel@gaston> On Tue, 2004-05-18 at 00:46, Anton Blanchard wrote: > Hi, > > I had to back the fix out of the s2io driver so it wouldnt use our > readq/writeq macros. Are they bust? Yes, they are bust. Here's a patch: ===== include/asm-ppc64/io.h 1.17 vs edited ===== --- 1.17/include/asm-ppc64/io.h Sat May 15 12:00:27 2004 +++ edited/include/asm-ppc64/io.h Wed May 19 15:54:42 2004 @@ -326,7 +326,7 @@ "rldicl %1,%1,32,0\n" "rlwimi %0,%1,8,8,31\n" "rlwimi %0,%1,24,16,23\n" - : "=r" (ret), "=r" (tmp) : "b" (addr) , "m" (*addr)); + : "=&r" (ret) , "=r" (tmp) : "b" (addr) , "m" (*addr)); return ret; } @@ -339,7 +339,7 @@ return ret; } -static inline void out_le64(volatile unsigned long *addr, int val) +static inline void out_le64(volatile unsigned long *addr, unsigned long val) { unsigned long tmp; @@ -351,9 +351,9 @@ "rldicl %1,%1,32,0\n" "rlwimi %0,%1,8,8,31\n" "rlwimi %0,%1,24,16,23\n" - "std %0,0(%2)\n" + "std %0,0(%3)\n" "sync" - : "=r" (tmp) : "r" (val), "b" (addr) , "m" (*addr)); + : "=&r" (tmp) , "=r" (val) : "1" (val) , "b" (addr) , "m" (*addr)); } static inline void out_be64(volatile unsigned long *addr, int val) ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From benh at kernel.crashing.org Wed May 19 16:28:16 2004 From: benh at kernel.crashing.org (Benjamin Herrenschmidt) Date: Wed, 19 May 2004 16:28:16 +1000 Subject: readq/writeq bust? In-Reply-To: <1084946146.17981.56.camel@gaston> References: <20040517144608.GA2037@krispykreme> <1084946146.17981.56.camel@gaston> Message-ID: <1084948096.17979.58.camel@gaston> Or a better one: ===== include/asm-ppc64/io.h 1.17 vs edited ===== --- 1.17/include/asm-ppc64/io.h Sat May 15 12:00:27 2004 +++ edited/include/asm-ppc64/io.h Wed May 19 16:27:43 2004 @@ -326,7 +326,7 @@ "rldicl %1,%1,32,0\n" "rlwimi %0,%1,8,8,31\n" "rlwimi %0,%1,24,16,23\n" - : "=r" (ret), "=r" (tmp) : "b" (addr) , "m" (*addr)); + : "=r" (ret) , "=r" (tmp) : "b" (addr) , "m" (*addr)); return ret; } @@ -339,7 +339,7 @@ return ret; } -static inline void out_le64(volatile unsigned long *addr, int val) +static inline void out_le64(volatile unsigned long *addr, unsigned long val) { unsigned long tmp; @@ -351,9 +351,9 @@ "rldicl %1,%1,32,0\n" "rlwimi %0,%1,8,8,31\n" "rlwimi %0,%1,24,16,23\n" - "std %0,0(%2)\n" + "std %0,0(%3)\n" "sync" - : "=r" (tmp) : "r" (val), "b" (addr) , "m" (*addr)); + : "=&r" (tmp) , "=&r" (val) : "1" (val) , "b" (addr) , "m" (*addr)); } static inline void out_be64(volatile unsigned long *addr, int val) ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From sfr at au1.ibm.com Wed May 19 18:05:16 2004 From: sfr at au1.ibm.com (Stephen Rothwell) Date: Wed, 19 May 2004 18:05:16 +1000 Subject: [PATCH] PPC64 iSeries virtual ethernet transmit errors Message-ID: <20040519180516.2c621221.sfr@au.ibm.com> Hi Olaf, This patch stops the iseries_veth driver trying to send every packet to too many logical partitions. Consequently, the number of transmit errors falls to (about) zero from a very large number. This should also improve performance a bit as the driver is no longer doing 31 extra skb_clone()s and skb_free()s for each packet ... Linus, Andrew, I would be grateful if this could go into your trees as well. -- Cheers, Stephen Rothwell sfr at au.ibm.com IBM OzLabs Linux Technology Centre diff -ruN 2.6.6-bk3/drivers/net/iseries_veth.c 2.6.6-bk3.txerr/drivers/net/iseries_veth.c --- 2.6.6-bk3/drivers/net/iseries_veth.c 2004-05-10 15:31:17.000000000 +1000 +++ 2.6.6-bk3.txerr/drivers/net/iseries_veth.c 2004-05-19 17:38:18.000000000 +1000 @@ -940,7 +940,7 @@ for (i = 0; i < HVMAXARCHITECTEDLPS; i++) { struct sk_buff *clone; - if (! lpmask & (1< References: <20040519180516.2c621221.sfr@au.ibm.com> Message-ID: <20040519124211.GG1927@suse.de> On Wed, May 19, Stephen Rothwell wrote: > > Hi Olaf, > > This patch stops the iseries_veth driver trying to send every packet to > too many logical partitions. Consequently, the number of transmit > errors falls to (about) zero from a very large number. This should > also improve performance a bit as the driver is no longer doing 31 extra > skb_clone()s and skb_free()s for each packet ... > > Linus, Andrew, I would be grateful if this could go into your trees as well. Here is another one, no spin_unlock in the error path: --- linux-2.6.5/drivers/net/iseries_veth.c 2004-05-19 14:24:21.000000000 +0200 +++ linux-2.6.5/drivers/net/iseries_veth.c 2004-05-19 14:32:39.000000000 +0200 @@ -994,6 +994,7 @@ static int veth_start_xmit(struct sk_buf veth_error("%s: Tx while skb was pending!\n", dev->name); dev_kfree_skb(skb); + spin_unlock_irqrestore(&port->pending_gate, flags); return 1; } -- USB is for mice, FireWire is for men! sUse lINUX ag, n?RNBERG ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From segher at kernel.crashing.org Wed May 19 22:49:10 2004 From: segher at kernel.crashing.org (Segher Boessenkool) Date: Wed, 19 May 2004 14:49:10 +0200 Subject: [PATCH] KDB for ppc64 - write to OF stdout instead of console In-Reply-To: <20040518140754.GA19828@in.ibm.com> References: <20040518140754.GA19828@in.ibm.com> Message-ID: > Patch inlined removes KDB's dependency on consoles completely for I/O. > With this patch, we use the OF stdout for both input and output. OF stdout is not necessarily the same thing as OF stdin (and, in fact, very often isn't) -- please use stdin for input? Segher ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From ananth at in.ibm.com Wed May 19 23:57:00 2004 From: ananth at in.ibm.com (Ananth N Mavinakayanahalli) Date: Wed, 19 May 2004 18:57:00 +0500 Subject: [PATCH] KDB for ppc64 - write to OF stdout instead of console In-Reply-To: References: <20040518140754.GA19828@in.ibm.com> Message-ID: <20040519135700.GA22401@in.ibm.com> On Wed, May 19, 2004 at 02:49:10PM +0200, Segher Boessenkool wrote: Hi Segher, > >Patch inlined removes KDB's dependency on consoles completely for I/O. > >With this patch, we use the OF stdout for both input and output. > > OF stdout is not necessarily the same thing as OF stdin > (and, in fact, very often isn't) -- please use stdin for > input? Well, my mistake in stating OF stdout. Rather - - KDB used console->write() rather than udbg_write() to print data. The patch changes _just_ that (makes it similar to xmon). - Reading in data has always been through ppc_md.udbg_getc_poll() which should take care of the stdin problem. (Pls correct me if I am wrong! :)) Thanks, Ananth -- Ananth Narayan Linux Technology Center, IBM Software Lab, INDIA ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From meissner at suse.de Thu May 20 01:44:26 2004 From: meissner at suse.de (Marcus Meissner) Date: Wed, 19 May 2004 17:44:26 +0200 Subject: asm-ppc64/ptrace.h / fscpr Message-ID: <20040519154426.GA2816@suse.de> Hi, The fpscr offset is wrong, it is at position 32 in the FPR array on ppc64. Found by IBM gdb testing. I have the vague suspicion the ptrace32 compat handling might be broken too, but I have to check. Ciao, Marcus -------------- next part -------------- --- include/asm-ppc64/ptrace.h 2004-05-18 16:04:44.352972880 -0700 +++ include/asm-ppc64/ptrace.h 2004-05-18 17:05:58.773957528 -0700 @@ -123,8 +123,10 @@ /* Kernel and userspace will both use this PT_FPSCR value. 32-bit apps will have * visibility to the asm-ppc/ptrace.h header instead of this one. + * + * There are 32 FP regs, and 1 control register */ -#define PT_FPSCR (PT_FPR0 + 32 + 1) /* each FP reg occupies 1 slot in 64-bit space */ +#define PT_FPSCR (PT_FPR0 + 32) /* each FP reg occupies 1 slot in 64-bit space */ #ifdef __KERNEL__ #define PT_FPSCR32 (PT_FPR0 + 2*32 + 1) /* each FP reg occupies 2 32-bit userspace slots */ From linas at austin.ibm.com Thu May 20 03:02:19 2004 From: linas at austin.ibm.com (linas at austin.ibm.com) Date: Wed, 19 May 2004 12:02:19 -0500 Subject: [PATCH] KDB for ppc64 - write to OF stdout instead of console In-Reply-To: ; from segher@kernel.crashing.org on Wed, May 19, 2004 at 02:49:10PM +0200 References: <20040518140754.GA19828@in.ibm.com> Message-ID: <20040519120219.B39874@forte.austin.ibm.com> On Wed, May 19, 2004 at 02:49:10PM +0200, Segher Boessenkool wrote: > > Patch inlined removes KDB's dependency on consoles completely for I/O. > > With this patch, we use the OF stdout for both input and output. > > OF stdout is not necessarily the same thing as OF stdin > (and, in fact, very often isn't) -- please use stdin for > input? The problem was actually with output, not input. People were seeing the KDB prompt on the serial console, and so they would assume they had input, when in fact they didn't. And so this insane dance would start, "KDB is hung, @#$%^& KDB". --linas ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From sjmunroe at us.ibm.com Thu May 20 06:17:30 2004 From: sjmunroe at us.ibm.com (Steve Munroe) Date: Wed, 19 May 2004 15:17:30 -0500 Subject: asm-ppc64/ptrace.h / fscpr In-Reply-To: <20040519154426.GA2816@suse.de> Message-ID: Marcus Meissner wrote on 05/19/2004 10:44:26 AM: > > The fpscr offset is wrong, it is at position 32 in the FPR array on ppc64. > > Found by IBM gdb testing. > > I have the vague suspicion the ptrace32 compat handling might be broken too, > but I have to check. > #define PT_FPR0 48 #define PT_FPSCR (PT_FPR0 + 32 + 1) So how is this wrong? Is the kernel storing the FPSCR in the wrong slot? Steven J. Munroe Linux on Power Toolchain Architect IBM Corporation, Linux Technology Center ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From meissner at suse.de Thu May 20 06:49:56 2004 From: meissner at suse.de (Marcus Meissner) Date: Wed, 19 May 2004 22:49:56 +0200 Subject: asm-ppc64/ptrace.h / fscpr In-Reply-To: References: <20040519154426.GA2816@suse.de> Message-ID: <20040519204956.GA5499@suse.de> On Wed, May 19, 2004 at 03:17:30PM -0500, Steve Munroe wrote: > Marcus Meissner wrote on 05/19/2004 10:44:26 AM: > > > The fpscr offset is wrong, it is at position 32 in the FPR array on > > ppc64. > > > > Found by IBM gdb testing. > > > > I have the vague suspicion the ptrace32 compat handling might be > > broken too, but I have to check. > > #define PT_FPR0 48 > #define PT_FPSCR (PT_FPR0 + 32 + 1) > > So how is this wrong? Is the kernel storing the FPSCR in the wrong > slot? The thread array has it at fpr[32], so it should be there too in that define: double fpr[32]; /* Complete floating point set */ unsigned long fpscr; /* Floating point status (plus pad) */ since ptrace just copies it out of that struct directly. ciao, Marcus ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From haveblue at us.ibm.com Thu May 20 07:23:52 2004 From: haveblue at us.ibm.com (Dave Hansen) Date: Wed, 19 May 2004 14:23:52 -0700 Subject: asm-ppc64/ptrace.h / fscpr In-Reply-To: References: Message-ID: <1085001832.2131.2.camel@nighthawk> On Wed, 2004-05-19 at 13:17, Steve Munroe wrote: > Marcus Meissner wrote on 05/19/2004 10:44:26 AM: > > > > > The fpscr offset is wrong, it is at position 32 in the FPR array on > ppc64. > > > > Found by IBM gdb testing. > > > > I have the vague suspicion the ptrace32 compat handling might be broken > too, > > but I have to check. > > > > #define PT_FPR0 48 > #define PT_FPSCR (PT_FPR0 + 32 + 1) > > So how is this wrong? Is the kernel storing the FPSCR in the wrong slot? It only uses those values to bounds-check ptrace poke and peek register accesses. There are 33 registers to poke, which are register array indexes 0->32. The bounds check is against (index > PT_FPSCR), which allows for an access of index 33, which is out-of-bounds. -- Dave ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From olh at suse.de Thu May 20 07:39:34 2004 From: olh at suse.de (Olaf Hering) Date: Wed, 19 May 2004 23:39:34 +0200 Subject: Linux on G5 Xserve? In-Reply-To: <20040513162330.GF1256@durango.c3.lanl.gov> References: <20040513162330.GF1256@durango.c3.lanl.gov> Message-ID: <20040519213934.GA1728@suse.de> On Thu, May 13, Greg Johnson wrote: > DO-QUIESCE finishedreturning 0x0160000 from prom_init > > > Then nothing. This is all over the serial port as these machines don't > have video cards. Is it possible that the kernel is booting, but not > initializing the serial console? All the output I'm getting from the > kernel comes through the prom. look at arch/ppc64/kernel/setup.c:set_preferred_console() you must add the needed stuff for the pmac zilog console. Do you have a device-tree somewhere, of can you figure it out? -- USB is for mice, FireWire is for men! sUse lINUX ag, n?RNBERG ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From paulus at samba.org Thu May 20 08:11:24 2004 From: paulus at samba.org (Paul Mackerras) Date: Thu, 20 May 2004 08:11:24 +1000 Subject: asm-ppc64/ptrace.h / fscpr In-Reply-To: References: <20040519154426.GA2816@suse.de> Message-ID: <16555.56204.545271.991429@cargo.ozlabs.ibm.com> Steve Munroe writes: > #define PT_FPR0 48 > #define PT_FPSCR (PT_FPR0 + 32 + 1) > > So how is this wrong? Is the kernel storing the FPSCR in the wrong slot? No. Each index references 64 bits. The 32 FPRs are at PT_FPR0 + 0 ... PT_FPR0 + 31. The *next* index, that is PT_FPR0 + 32, contains the FPSCR in the low 32 bits and junk in the high 32 bits. The reason for the +1 in the 32-bit case is that the useful bits of the FPSCR are in the low 32 bits of the 64-bit slot. Paul. ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From dwm at austin.ibm.com Thu May 20 08:11:58 2004 From: dwm at austin.ibm.com (dwm at austin.ibm.com) Date: Wed, 19 May 2004 17:11:58 -0500 Subject: building 2.6.5 zImage outside of /usr/src Message-ID: <200405192211.i4JMBw1M013580@falcon10.austin.ibm.com> Howdy, Has anyone successfully built a zImage on 2.6.5 outside the default location? It does build ok in the /usr/src dir. It seems that I keep getting the /usr/include stuff, and that is not well liked. Any hints would be muchly appreciated. ++doug -------------- next part -------------- COMMAND=={make} ARGS={O=/home/dwm/sb/linux/FOO.edit/build zImage} STARTED Wed May 19 14:49:37 2004 ON prion Using /home/dwm/sb/linux/FOO.edit as source for kernel make[2]: `arch/ppc64/kernel/asm-offsets.s' is up to date. CHK include/linux/compile.h UPD include/linux/compile.h CC init/version.o LD init/built-in.o CC init/kerntypes.o CC drivers/ide/ide.o LD drivers/ide/ide-core.o LD drivers/ide/built-in.o LD drivers/built-in.o GEN .version CHK include/linux/compile.h UPD include/linux/compile.h CC init/version.o LD init/built-in.o CC init/kerntypes.o LD .tmp_vmlinux1 KSYM .tmp_kallsyms1.S AS .tmp_kallsyms1.o LD .tmp_vmlinux2 KSYM .tmp_kallsyms2.S AS .tmp_kallsyms2.o LD vmlinux GZIP arch/ppc64/boot/kernel-vmlinux.gz touch arch/ppc64/boot/kernel-vmlinux.c BOOTCC arch/ppc64/boot/kernel-vmlinux.o objcopy arch/ppc64/boot/kernel-vmlinux.o --add-section=.kernel:vmlinux=arch/ppc64/boot/kernel-vmlinux.gz --set-section-flags=.kernel:vmlinux=contents,alloc,load,readonly,data GZIP arch/ppc64/boot/kernel-.config.gz touch arch/ppc64/boot/kernel-.config.c BOOTCC arch/ppc64/boot/kernel-.config.o objcopy arch/ppc64/boot/kernel-.config.o --add-section=.kernel:.config=arch/ppc64/boot/kernel-.config.gz --set-section-flags=.kernel:.config=contents,alloc,load,readonly,data GZIP arch/ppc64/boot/kernel-System.map.gz touch arch/ppc64/boot/kernel-System.map.c BOOTCC arch/ppc64/boot/kernel-System.map.o objcopy arch/ppc64/boot/kernel-System.map.o --add-section=.kernel:System.map=arch/ppc64/boot/kernel-System.map.gz --set-section-flags=.kernel:System.map=contents,alloc,load,readonly,data BOOTAS arch/ppc64/boot/crt0.o BOOTAS arch/ppc64/boot/string.o BOOTCC arch/ppc64/boot/prom.o BOOTCC arch/ppc64/boot/main.o In file included from /usr/include/asm/types.h:6, from /usr/include/linux/types.h:16, from /usr/include/linux/elf.h:4, from /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:13: /usr/include/asm-ppc/types.h:22: error: conflicting types for `__vector128' /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/ppc32-types.h:30: error: previous declaration of `__vector128' /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c: In function `start': /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:131: warning: implicit declaration of function `PAGE_ALIGN' /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c: In function `make_bi_recs': /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:222: warning: implicit declaration of function `bi_rec_init' /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:222: warning: assignment makes pointer from integer without a cast /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:224: warning: implicit declaration of function `bi_rec_alloc' /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:224: warning: assignment makes pointer from integer without a cast /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:225: error: dereferencing pointer to incomplete type /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:225: error: `BI_FIRST' undeclared (first use in this function) /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:225: error: (Each undeclared identifier is reported only once /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:225: error: for each function it appears in.) /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:229: warning: implicit declaration of function `bi_rec_alloc_bytes' /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:229: warning: assignment makes pointer from integer without a cast /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:230: error: dereferencing pointer to incomplete type /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:230: error: `BI_BOOTLOADER_ID' undeclared (first use in this function) /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:231: error: dereferencing pointer to incomplete type /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:233: warning: assignment makes pointer from integer without a cast /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:234: error: dereferencing pointer to incomplete type /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:234: error: `BI_MACHTYPE' undeclared (first use in this function) /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:235: error: dereferencing pointer to incomplete type /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:235: error: `PLATFORM_PSERIES' undeclared (first use in this function) /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:236: error: dereferencing pointer to incomplete type /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:239: warning: assignment makes pointer from integer without a cast /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:240: error: dereferencing pointer to incomplete type /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:240: error: `BI_INITRD' undeclared (first use in this function) /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:241: error: dereferencing pointer to incomplete type /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:242: error: dereferencing pointer to incomplete type /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:246: warning: assignment makes pointer from integer without a cast /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:247: error: dereferencing pointer to incomplete type /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:247: error: `BI_SYSMAP' undeclared (first use in this function) /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:248: error: dereferencing pointer to incomplete type /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:249: error: dereferencing pointer to incomplete type /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:252: warning: assignment makes pointer from integer without a cast /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:253: error: dereferencing pointer to incomplete type /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:253: error: `BI_LAST' undeclared (first use in this function) /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:254: error: dereferencing pointer to incomplete type /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:254: error: `bi_rec_field' undeclared (first use in this function) /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:254: error: parse error before "bi_recs" /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:259: error: dereferencing pointer to incomplete type /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:259: error: parse error before "rec" /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:260: error: dereferencing pointer to incomplete type /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:260: error: parse error before "rec" /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c: In function `zalloc': /home/dwm/sb/linux/FOO.edit/arch/ppc64/boot/main.c:279: warning: implicit declaration of function `_ALIGN' make[2]: *** [arch/ppc64/boot/main.o] Error 1 make[1]: *** [zImage] Error 2 make: *** [zImage] Error 2 UID=uid=1000(dwm) gid=100(users) groups=10(wheel),14(uucp),16(dialout),17(audio),33(video),100(users) COMPLETE at Wed May 19 14:50:09 2004 RETURN from {make O=/home/dwm/sb/linux/FOO.edit/build zImage} is 2 ELAPSED time 0:00:32 From gjohnson at lanl.gov Thu May 20 10:22:07 2004 From: gjohnson at lanl.gov (Greg Johnson) Date: Wed, 19 May 2004 18:22:07 -0600 Subject: Linux on G5 Xserve? In-Reply-To: <20040519213934.GA1728@suse.de> References: <20040513162330.GF1256@durango.c3.lanl.gov> <20040519213934.GA1728@suse.de> Message-ID: <20040520002207.GD1256@durango.c3.lanl.gov> On Wed, May 19, 2004 at 11:39:34PM +0200, Olaf Hering wrote: > On Thu, May 13, Greg Johnson wrote: > > > DO-QUIESCE finishedreturning 0x0160000 from prom_init > > > > > > Then nothing. This is all over the serial port as these machines don't > > have video cards. Is it possible that the kernel is booting, but not > > initializing the serial console? All the output I'm getting from the > > kernel comes through the prom. > > look at arch/ppc64/kernel/setup.c:set_preferred_console() > you must add the needed stuff for the pmac zilog console. Do you have a > device-tree somewhere, of can you figure it out? Hmm... I hadn't looked there. Passing console=ttyS0 seems to work, but I guess it should default to that anyway. I think the following patch should work, but it's not tested yet. I'm a little confused that set_preferred_console() is #ifdef CONFIG_PSERIES. If it is being used also for powermac, shouldn't it have '|| CONFIG_PMAC' or something? I realize that the config options are set together, but still? Greg --- setup.c.orig 2004-05-09 20:32:29.000000000 -0600 +++ setup.c 2004-05-19 17:48:27.681889736 -0600 @@ -476,6 +476,7 @@ { struct device_node *prom_stdout; char *name; + char *type; /* The user has requested a console so this is already set up. */ if (strstr(saved_command_line, "console=")) @@ -519,6 +520,13 @@ return add_preferred_console("hvc", 0, NULL); } + type = (char *)get_property(prom_stdout, "device_type", NULL); + if (strcmp(type, "serial") == 0) { + /* XServe G5 escc serial */ + if(strcmp(name, "ch-a") == 0) return add_preferred_console("ttyS", 0, NULL); + if(strcmp(name, "ch-b") == 0) return add_preferred_console("ttyS", 1, NULL); + } + return -ENODEV; } console_initcall(set_preferred_console); @@ -547,7 +555,7 @@ int __init ppc_init(void) { /* clear the progress line */ - ppc_md.progress(" ", 0xffff); + if(ppc_md.progress) ppc_md.progress(" ", 0xffff); if (ppc_md.init != NULL) { ppc_md.init(); ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From sfr at au1.ibm.com Thu May 20 11:14:38 2004 From: sfr at au1.ibm.com (Stephen Rothwell) Date: Thu, 20 May 2004 11:14:38 +1000 Subject: [PATCH] PPC64 iSeries virtual ethernet transmit errors In-Reply-To: <20040519124211.GG1927@suse.de> References: <20040519180516.2c621221.sfr@au.ibm.com> <20040519124211.GG1927@suse.de> Message-ID: <20040520111438.22734c09.sfr@au.ibm.com> Hi Olaf, On Wed, 19 May 2004 14:42:11 +0200 Olaf Hering wrote: > > Here is another one, no spin_unlock in the error path: > > > --- linux-2.6.5/drivers/net/iseries_veth.c 2004-05-19 14:24:21.000000000 +0200 > +++ linux-2.6.5/drivers/net/iseries_veth.c 2004-05-19 14:32:39.000000000 +0200 > @@ -994,6 +994,7 @@ static int veth_start_xmit(struct sk_buf > veth_error("%s: Tx while skb was pending!\n", > dev->name); > dev_kfree_skb(skb); > + spin_unlock_irqrestore(&port->pending_gate, flags); > return 1; > } Good catch - this has an impact on a bug we have flagged internally. Linus, Andrew, this should also go into your trees. -- Cheers, Stephen Rothwell sfr at au.ibm.com IBM OzLabs Linux Technology Centre ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From lxiep at us.ibm.com Thu May 20 11:57:45 2004 From: lxiep at us.ibm.com (Linda Xie) Date: Wed, 19 May 2004 20:57:45 -0500 Subject: [PATCH] rpaphp.patch -- multi-function devices not handled correctly Message-ID: <40AC1099.9060007@us.ibm.com> Hi Greg, I made changes to rpaphp code, so it can handle multi-fuction devices correctly. The problem is that the pci_dev field of slot struct can only record one pci_dev of the devices of a multi-fuction card. I changed pci_dev (a single pci_dev type pointer) to pci_funcs( a list of pci_dev type pointers). I rewrote some of the config/unconfig code to support the slot struct change. Along with above changes, I added LDRSLOT(logical I/O slot) support. We need LDRSLOT support for DLPAR I/O. A card in a LDRSLOT can't be physically removed, but can be logically removed from one partiton and reassinged to another partition. I also merged rpaphp changes from ames tree. Can pci_scan_child_bus be exported? I pasted it in rpaphp_pci.c for temparary use. Please review the attached patch. Thanks, Linda BTW, here is the changset: ChangeSet at 1.1749, 2004-05-19 18:57:22-05:00, lxie at threadlp13.austin.ibm.com drivers/pci/hotplug/rpadlpar_core.c Moved is_hotplug_capable to rpaphp.h bcause rpaphp also needs it. drivers/pci/hotplug/rpaphp.h Changed pci_dev of slot struct to pci_funcs to record a list of functions in the slot drivers/pci/hotplug/rpaphp_core.c - Merged changes from ames tree. - Added LDRSLOT support. - Rewrote a couple of routines. drivers/pci/hotplug/rpaphp_pci.c - Rewrote cofig code to handle multi-function devices correctly. - Merged changes from ames tree. drivers/pci/hotplug/rpaphp_slot.c Added free pci_fucs of a slot in dealloc_slot_struct -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rpaphp.patch Url: http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20040519/f78082ee/attachment.txt From olh at suse.de Thu May 20 20:01:26 2004 From: olh at suse.de (Olaf Hering) Date: Thu, 20 May 2004 12:01:26 +0200 Subject: Linux on G5 Xserve? In-Reply-To: <20040520002207.GD1256@durango.c3.lanl.gov> References: <20040513162330.GF1256@durango.c3.lanl.gov> <20040519213934.GA1728@suse.de> <20040520002207.GD1256@durango.c3.lanl.gov> Message-ID: <20040520100126.GB1347@suse.de> On Wed, May 19, Greg Johnson wrote: > On Wed, May 19, 2004 at 11:39:34PM +0200, Olaf Hering wrote: > > On Thu, May 13, Greg Johnson wrote: > > > > > DO-QUIESCE finishedreturning 0x0160000 from prom_init > > > > > > > > > Then nothing. This is all over the serial port as these machines don't > > > have video cards. Is it possible that the kernel is booting, but not > > > initializing the serial console? All the output I'm getting from the > > > kernel comes through the prom. > > > > look at arch/ppc64/kernel/setup.c:set_preferred_console() > > you must add the needed stuff for the pmac zilog console. Do you have a > > device-tree somewhere, of can you figure it out? > > Hmm... I hadn't looked there. Passing console=ttyS0 seems to work, but > I guess it should default to that anyway. I think the following patch > should work, but it's not tested yet. I'm a little confused that > set_preferred_console() is #ifdef CONFIG_PSERIES. If it is being used > also for powermac, shouldn't it have '|| CONFIG_PMAC' or something? I > realize that the config options are set together, but still? CONFIG_PPC_PSERIES is also set for pmac. you cant disable it. would that one work as well? diff -p -purN linux-2.6.6/arch/ppc64/kernel/setup.c linux-2.6.6.autocons/arch/ppc64/kernel/setup.c --- linux-2.6.6/arch/ppc64/kernel/setup.c 2004-05-10 04:32:29.000000000 +0200 +++ linux-2.6.6.autocons/arch/ppc64/kernel/setup.c 2004-05-20 11:58:14.000000000 +0200 @@ -476,6 +476,7 @@ static int __init set_preferred_console( { struct device_node *prom_stdout; char *name; + int offset; /* The user has requested a console so this is already set up. */ if (strstr(saved_command_line, "console=")) @@ -493,7 +494,6 @@ static int __init set_preferred_console( int i; u32 *reg = (u32 *)get_property(prom_stdout, "reg", &i); if (i > 8) { - int offset; switch (reg[1]) { case 0x3f8: offset = 0; @@ -511,15 +511,19 @@ static int __init set_preferred_console( /* We dont recognise the serial port */ return -ENODEV; } - - return add_preferred_console("ttyS", offset, NULL); } - } else if (strcmp(name, "vty") == 0) { + } else if (strcmp(name, "vty") == 0) /* pSeries LPAR virtual console */ return add_preferred_console("hvc", 0, NULL); - } + else if (strcmp(name, "ch-a") == 0) + offset = 0; + else if (strcmp(name, "ch-b") == 0) + offset = 1; + else + return -ENODEV; + + return add_preferred_console("ttyS", offset, NULL); - return -ENODEV; } console_initcall(set_preferred_console); -- USB is for mice, FireWire is for men! sUse lINUX ag, n?RNBERG ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From johnrose at austin.ibm.com Fri May 21 01:56:20 2004 From: johnrose at austin.ibm.com (John Rose) Date: Thu, 20 May 2004 10:56:20 -0500 Subject: [PATCH] rpaphp.patch -- multi-function devices not handled correctly In-Reply-To: <40AC1099.9060007@us.ibm.com> References: <40AC1099.9060007@us.ibm.com> Message-ID: <1085068579.29604.55.camel@verve.austin.ibm.com> Hi Linda- Nice work. I have a couple of comments. > Along with above changes, I added LDRSLOT(logical I/O slot) support. > We need LDRSLOT support for DLPAR I/O. A card in a LDRSLOT can't > be physically removed, but can be logically removed from one partiton and > reassinged to another partition. > This handles the case of internal or "embedded" slots, right? It might be more clear, both in your code and comments, to use "embedded" rather than "logical DR". I also think it's necessary to add a new attribute "embedded" or "phys_removable" or whatever, that tells userspace whether physical removal is possible. This allows the userspace tool to say "The slot exists, but is not hotplug capable", rather than "bad slot name". > @@ -155,7 +158,10 @@ > /* have to go through this */ > switch (slot->dev_type) { > case PCI_DEV: > - retval = rpaphp_get_pci_adapter_status(slot, 0, value); > + if (slot->type != LDRSLOT) > + retval = rpaphp_get_pci_adapter_status(slot, 0, value); > + else > + retval = -EINVAL; /* n/a for LDRSLOT */ > break; > case VIO_DEV: > retval = rpaphp_get_vio_adapter_status(slot, 0, value); I don't agree with this. The user should still be able to check the adapter status of an embedded slot. You could change rpaphp_get_pci_adapter_status() to always assume PRESENT for the get-sensor-state call. Then check the pci_funcs list just like in the normal case. Another thing I noticed is that the Logical DR/embedded case is ignored for the rpaphp_get_power_level() call. When a user cats the power file, it should give a valid answer for an embedded slot. Since these slots don't have power-domain values, and you can't turn them off, this function should always return "POWER_ON" for these cases. > + > +static int is_dr_dn(struct device_node *dn, int **indexes, int **names, int **types, > + int **power_domains, int **my_drc_index) > +{ > + if (!is_hotplug_capable(dn)) > + return (0); > + > + *my_drc_index = (int *) get_property(dn, "ibm,my-drc-index", NULL); > + if(!*my_drc_index) > + return (0); > + > + if (!dn->parent) > + return (0); > + > + return get_dn_properties(dn->parent, indexes, names, types, power_domains); > } This will fail for embedded slots, right? Embedded slots won't have drc-indexes, types, or domains. > - int err = -EINVAL; > + int err = -EINVAL;; Is this a typo? > + /* remove the devices from the pci core */ > + list_for_each (ln, &slot->dev.pci_funcs) { > + struct rpaphp_pci_func *func; > + > + func = list_entry(ln, struct rpaphp_pci_func, sibling); > + if (func->pci_dev) { > + rpaphp_eeh_remove_bus_device(func->pci_dev); > + pci_remove_bus_device(func->pci_dev); > + } list_for_each() isn't safe to use when removing members of the list in question. There are functions list_for_each_safe() and/or list_for_each_entry_safe() that address this problem. > - > + /* should not try to register the same slot twice */ > + if (is_registered(slot)) { /* should't be here */ > + err("register_slot: slot[%s] is already registered\n", slot->name); > + rpaphp_release_slot(slot->hotplug_slot); > + return (1); > + } Good idea, this will save us alot of headaches :) ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From johnrose at austin.ibm.com Fri May 21 06:37:54 2004 From: johnrose at austin.ibm.com (John Rose) Date: Thu, 20 May 2004 15:37:54 -0500 Subject: [PATCH] rpaphp.patch -- multi-function devices not handled correctly In-Reply-To: <40AD1E53.6090003@us.ibm.com> References: <40AC1099.9060007@us.ibm.com> <1085068579.29604.55.camel@verve.austin.ibm.com> <40AD1E53.6090003@us.ibm.com> Message-ID: <1085085474.29603.105.camel@verve.austin.ibm.com> Hey Linda- Just one more question... > >>+static int is_dr_dn(struct device_node *dn, int **indexes, int **names, int **types, > >>+ int **power_domains, int **my_drc_index) > >>+{ > >>+ if (!is_hotplug_capable(dn)) > >>+ return (0); > >>+ > >>+ *my_drc_index = (int *) get_property(dn, "ibm,my-drc-index", NULL); > >>+ if(!*my_drc_index) > >>+ return (0); > >>+ > >>+ if (!dn->parent) > >>+ return (0); > >>+ > >>+ return get_dn_properties(dn->parent, indexes, names, types, power_domains); > >> } > >This will fail for embedded slots, right? Embedded slots won't have > >drc-indexes, types, or domains. > > > is_dr_dn() doesn't check for drc-indexes, only my-drc-index. Yes, but won't get_dn_properties() fail if it can't find drc-indexes, names, etc? Thanks- John ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From lxiep at us.ibm.com Fri May 21 07:08:35 2004 From: lxiep at us.ibm.com (Linda Xie) Date: Thu, 20 May 2004 16:08:35 -0500 Subject: [PATCH] rpaphp.patch -- multi-function devices not handled correctly In-Reply-To: <1085068579.29604.55.camel@verve.austin.ibm.com> References: <40AC1099.9060007@us.ibm.com> <1085068579.29604.55.camel@verve.austin.ibm.com> Message-ID: <40AD1E53.6090003@us.ibm.com> Hi John, Thank you for your comments. They are very good suggestions. Linda John Rose wrote: >Hi Linda- > >Nice work. I have a couple of comments. > > > >>Along with above changes, I added LDRSLOT(logical I/O slot) support. >>We need LDRSLOT support for DLPAR I/O. A card in a LDRSLOT can't >>be physically removed, but can be logically removed from one partiton and >>reassinged to another partition. >> >> >> > >This handles the case of internal or "embedded" slots, right? It might >be more clear, both in your code and comments, to use "embedded" rather >than "logical DR". > >I also think it's necessary to add a new attribute "embedded" or >"phys_removable" or whatever, that tells userspace whether physical >removal is possible. This allows the userspace tool to say "The slot >exists, but is not hotplug capable", rather than "bad slot name". > > I will pick "phys_removable" for a new attribute name. > > >>@@ -155,7 +158,10 @@ >> /* have to go through this */ >> switch (slot->dev_type) { >> case PCI_DEV: >>- retval = rpaphp_get_pci_adapter_status(slot, 0, value); >>+ if (slot->type != LDRSLOT) >>+ retval = rpaphp_get_pci_adapter_status(slot, 0, value); >>+ else >>+ retval = -EINVAL; /* n/a for LDRSLOT */ >> break; >> case VIO_DEV: >> retval = rpaphp_get_vio_adapter_status(slot, 0, value); >> >> > >I don't agree with this. The user should still be able to check the >adapter status of an embedded slot. You could change >rpaphp_get_pci_adapter_status() to always assume PRESENT for the >get-sensor-state call. Then check the pci_funcs list just like in the >normal case. > > Actually, get_sensor_state always returns "present" for "embedded" slot. >Another thing I noticed is that the Logical DR/embedded case is ignored >for the rpaphp_get_power_level() call. When a user cats the power file, >it should give a valid answer for an embedded slot. Since these slots >don't have power-domain values, and you can't turn them off, this >function should always return "POWER_ON" for these cases. > Will be changed to "POWER_ON". > > > >>+ >>+static int is_dr_dn(struct device_node *dn, int **indexes, int **names, int **types, >>+ int **power_domains, int **my_drc_index) >>+{ >>+ if (!is_hotplug_capable(dn)) >>+ return (0); >>+ >>+ *my_drc_index = (int *) get_property(dn, "ibm,my-drc-index", NULL); >>+ if(!*my_drc_index) >>+ return (0); >>+ >>+ if (!dn->parent) >>+ return (0); >>+ >>+ return get_dn_properties(dn->parent, indexes, names, types, power_domains); >> } >> >> > >This will fail for embedded slots, right? Embedded slots won't have >drc-indexes, types, or domains. > is_dr_dn() doesn't check for drc-indexes, only my-drc-index. > > > >>- int err = -EINVAL; >>+ int err = -EINVAL;; >> >> > >Is this a typo? > It's a typo. > > > >>+ /* remove the devices from the pci core */ >>+ list_for_each (ln, &slot->dev.pci_funcs) { >>+ struct rpaphp_pci_func *func; >>+ >>+ func = list_entry(ln, struct rpaphp_pci_func, sibling); >>+ if (func->pci_dev) { >>+ rpaphp_eeh_remove_bus_device(func->pci_dev); >>+ pci_remove_bus_device(func->pci_dev); >>+ } >> >> > >list_for_each() isn't safe to use when removing members of the list in >question. There are functions list_for_each_safe() and/or >list_for_each_entry_safe() that address this problem. > Will be changed. > > > >>- >>+ /* should not try to register the same slot twice */ >>+ if (is_registered(slot)) { /* should't be here */ >>+ err("register_slot: slot[%s] is already registered\n", slot->name); >>+ rpaphp_release_slot(slot->hotplug_slot); >>+ return (1); >>+ } >> >> > >Good idea, this will save us alot of headaches :) > > > > > > ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From greg at kroah.com Fri May 21 07:16:13 2004 From: greg at kroah.com (Greg KH) Date: Thu, 20 May 2004 14:16:13 -0700 Subject: [PATCH] rpaphp.patch -- multi-function devices not handled correctly In-Reply-To: <40AC1099.9060007@us.ibm.com> References: <40AC1099.9060007@us.ibm.com> Message-ID: <20040520211613.GA27095@kroah.com> On Wed, May 19, 2004 at 08:57:45PM -0500, Linda Xie wrote: > > Can pci_scan_child_bus be exported? I pasted it in rpaphp_pci.c for > temparary use. Yes, I'll be glad to export it if you need it. Just send me a separate patch with your next, updated version. Should probably make it EXPORT_SYMBOL_GPL() just to be safe... thanks, greg k-h ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From olh at suse.de Fri May 21 16:23:18 2004 From: olh at suse.de (Olaf Hering) Date: Fri, 21 May 2004 08:23:18 +0200 Subject: [PATCH] console autodetection for pmac Message-ID: <20040521062318.GA3887@suse.de> This one allows console autodetection for powermacs. diff -p -purN linux-2.6.6/arch/ppc64/kernel/setup.c linux-2.6.6.autocons/arch/ppc64/kernel/setup.c --- linux-2.6.6/arch/ppc64/kernel/setup.c 2004-05-10 04:32:29.000000000 +0200 +++ linux-2.6.6.autocons/arch/ppc64/kernel/setup.c 2004-05-20 11:58:14.000000000 +0200 @@ -476,6 +476,7 @@ static int __init set_preferred_console( { struct device_node *prom_stdout; char *name; + int offset; /* The user has requested a console so this is already set up. */ if (strstr(saved_command_line, "console=")) @@ -493,7 +494,6 @@ static int __init set_preferred_console( int i; u32 *reg = (u32 *)get_property(prom_stdout, "reg", &i); if (i > 8) { - int offset; switch (reg[1]) { case 0x3f8: offset = 0; @@ -511,15 +511,19 @@ static int __init set_preferred_console( /* We dont recognise the serial port */ return -ENODEV; } - - return add_preferred_console("ttyS", offset, NULL); } - } else if (strcmp(name, "vty") == 0) { + } else if (strcmp(name, "vty") == 0) /* pSeries LPAR virtual console */ return add_preferred_console("hvc", 0, NULL); - } + else if (strcmp(name, "ch-a") == 0) + offset = 0; + else if (strcmp(name, "ch-b") == 0) + offset = 1; + else + return -ENODEV; + + return add_preferred_console("ttyS", offset, NULL); - return -ENODEV; } console_initcall(set_preferred_console); -- USB is for mice, FireWire is for men! sUse lINUX ag, n?RNBERG ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From segher at kernel.crashing.org Fri May 21 22:52:01 2004 From: segher at kernel.crashing.org (Segher Boessenkool) Date: Fri, 21 May 2004 14:52:01 +0200 Subject: [PATCH] KDB for ppc64 - write to OF stdout instead of console In-Reply-To: <20040519120219.B39874@forte.austin.ibm.com> References: <20040518140754.GA19828@in.ibm.com> <20040519120219.B39874@forte.austin.ibm.com> Message-ID: On 19-mei-04, at 19:02, linas at austin.ibm.com wrote: > On Wed, May 19, 2004 at 02:49:10PM +0200, Segher Boessenkool wrote: >>> Patch inlined removes KDB's dependency on consoles completely for >>> I/O. >>> With this patch, we use the OF stdout for both input and output. >> >> OF stdout is not necessarily the same thing as OF stdin >> (and, in fact, very often isn't) -- please use stdin for >> input? > > The problem was actually with output, not input. People were seeing > the KDB prompt on the serial console, and so they would assume they > had input, when in fact they didn't. And so this insane dance would > start, "KDB is hung, @#$%^& KDB". I didn't read the actual patch, just the description. And that set off some alarms here ;-) I guess what the patch actually does is "use OF stdout for output, and OF stdin for input", which is fine fine fine. Segher ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From johnrose at austin.ibm.com Sat May 22 08:00:30 2004 From: johnrose at austin.ibm.com (John Rose) Date: Fri, 21 May 2004 17:00:30 -0500 Subject: [PATCH] rpaphp.patch -- multi-function devices not handled correctly In-Reply-To: <40AE855D.1060902@us.ibm.com> References: <40AC1099.9060007@us.ibm.com> <1085068579.29604.55.camel@verve.austin.ibm.com> <40AD1E53.6090003@us.ibm.com> <1085085474.29603.105.camel@verve.austin.ibm.com> <40AE855D.1060902@us.ibm.com> Message-ID: <1085176829.1845.0.camel@verve.austin.ibm.com> > Please note that is_dr_dn calls get_dn_properties with dn->parent (not > dn). EMBEDDED slot's drc-name, drc-type ... can be obtained from dn's > parent. Good point! My mistake :) Thanks- John ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From lxiep at us.ibm.com Sat May 22 08:40:29 2004 From: lxiep at us.ibm.com (Linda Xie) Date: Fri, 21 May 2004 17:40:29 -0500 Subject: [PATCH] rpaphp.patch -- multi-function devices not handled correctly In-Reply-To: <1085085474.29603.105.camel@verve.austin.ibm.com> References: <40AC1099.9060007@us.ibm.com> <1085068579.29604.55.camel@verve.austin.ibm.com> <40AD1E53.6090003@us.ibm.com> <1085085474.29603.105.camel@verve.austin.ibm.com> Message-ID: <40AE855D.1060902@us.ibm.com> John Rose wrote: >Hey Linda- > >Just one more question... > > > >>>>+static int is_dr_dn(struct device_node *dn, int **indexes, int **names, int **types, >>>>+ int **power_domains, int **my_drc_index) >>>>+{ >>>>+ if (!is_hotplug_capable(dn)) >>>>+ return (0); >>>>+ >>>>+ *my_drc_index = (int *) get_property(dn, "ibm,my-drc-index", NULL); >>>>+ if(!*my_drc_index) >>>>+ return (0); >>>>+ >>>>+ if (!dn->parent) >>>>+ return (0); >>>>+ >>>>+ return get_dn_properties(dn->parent, indexes, names, types, power_domains); >>>>} >>>> >>>> >>>This will fail for embedded slots, right? Embedded slots won't have >>>drc-indexes, types, or domains. >>> >>> >>> >>is_dr_dn() doesn't check for drc-indexes, only my-drc-index. >> >> > >Yes, but won't get_dn_properties() fail if it can't find drc-indexes, >names, etc? > > Please note that is_dr_dn calls get_dn_properties with dn->parent (not dn). EMBEDDED slot's drc-name, drc-type ... can be obtained from dn's parent. >Thanks- >John > > > > > > ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From lxiep at us.ibm.com Sat May 22 10:33:38 2004 From: lxiep at us.ibm.com (Linda Xie) Date: Fri, 21 May 2004 19:33:38 -0500 Subject: [PATCH] probe.patch -- export pci_scan_child_bus In-Reply-To: <20040520211613.GA27095@kroah.com> References: <40AC1099.9060007@us.ibm.com> <20040520211613.GA27095@kroah.com> Message-ID: <40AE9FE2.7090808@us.ibm.com> Hi Greg, Please apply the attached patch to your tree. I will send an updated version of rpaphp soon. Thank you very much. Linda Greg KH wrote: >On Wed, May 19, 2004 at 08:57:45PM -0500, Linda Xie wrote: > > >>Can pci_scan_child_bus be exported? I pasted it in rpaphp_pci.c for >>temparary use. >> >> > >Yes, I'll be glad to export it if you need it. Just send me a separate >patch with your next, updated version. Should probably make it >EXPORT_SYMBOL_GPL() just to be safe... > >thanks, > >greg k-h > > > > > -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: probe.patch Url: http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20040521/43e46c39/attachment.txt From lxiep at us.ibm.com Sat May 22 12:31:52 2004 From: lxiep at us.ibm.com (Linda Xie) Date: Fri, 21 May 2004 21:31:52 -0500 Subject: [PATCH] rpaphp.patch -- multi-function devices not handled correctly In-Reply-To: <20040520211613.GA27095@kroah.com> References: <40AC1099.9060007@us.ibm.com> <20040520211613.GA27095@kroah.com> Message-ID: <40AEBB98.5080903@us.ibm.com> Here is an updated rpaphp patch. Thanks, Linda Greg KH wrote: >On Wed, May 19, 2004 at 08:57:45PM -0500, Linda Xie wrote: > > >>Can pci_scan_child_bus be exported? I pasted it in rpaphp_pci.c for >>temparary use. >> >> > >Yes, I'll be glad to export it if you need it. Just send me a separate >patch with your next, updated version. Should probably make it >EXPORT_SYMBOL_GPL() just to be safe... > >thanks, > >greg k-h > > > > > -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rpaphp_updated.patch Url: http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20040521/b0c8e0f0/attachment.txt From sfr at canb.auug.org.au Mon May 24 16:20:39 2004 From: sfr at canb.auug.org.au (Stephen Rothwell) Date: Mon, 24 May 2004 16:20:39 +1000 Subject: [PATCH] dynamic addition of virtual disks on PPC64 iSeries Message-ID: <20040524162039.5f6ca3e0.sfr@canb.auug.org.au> Hi Andrew, Linus, This patch allows us to dynamically add virtual disks to an iSeries partition. It works like this: after you have created the virtual disk file on OS/400 and attached it to the Linux partition, you need to read /sys/bus/vio/drivers/viodasd/probe. This will do the probe and list any new disks discovered. This was the nicest way I could think of doing this as the interface to the hypervisor is polled ... Please apply. -- Cheers, Stephen Rothwell sfr at canb.auug.org.au http://www.canb.auug.org.au/~sfr/ -------------- next part -------------- diff -ruN 2.6.6-bk7/drivers/block/viodasd.c 2.6.6-bk7.dyndasd/drivers/block/viodasd.c --- 2.6.6-bk7/drivers/block/viodasd.c 2004-05-21 16:24:00.000000000 +1000 +++ 2.6.6-bk7.dyndasd/drivers/block/viodasd.c 2004-05-20 20:36:43.000000000 +1000 @@ -40,8 +40,12 @@ #include #include #include +#include +#include #include +#include +#include /* for PAGE_SIZE */ #include #include #include @@ -456,7 +460,7 @@ * Probe a single disk and fill in the viodasd_device structure * for it. */ -static void probe_disk(struct viodasd_device *d) +static int probe_disk(struct viodasd_device *d) { HvLpEvent_Rc hvrc; struct viodasd_waitevent we; @@ -480,14 +484,14 @@ 0, 0, 0); if (hvrc != 0) { printk(VIOD_KERN_WARNING "bad rc on HV open %d\n", (int)hvrc); - return; + return 0; } wait_for_completion(&we.com); if (we.rc != 0) { if (flags != 0) - return; + return 0; /* try again with read only flag set */ flags = vioblockflags_ro; goto retry; @@ -517,22 +521,15 @@ if (hvrc != 0) { printk(VIOD_KERN_WARNING "bad rc sending event to OS/400 %d\n", (int)hvrc); - return; + return 0; } - printk(VIOD_KERN_INFO "disk %d: %lu sectors (%lu MB) " - "CHS=%d/%d/%d sector size %d%s\n", - dev_no, (unsigned long)(d->size >> 9), - (unsigned long)(d->size >> 20), - (int)d->cylinders, (int)d->tracks, - (int)d->sectors, (int)d->bytes_per_sector, - d->read_only ? " (RO)" : ""); /* create the request queue for the disk */ spin_lock_init(&d->q_lock); q = blk_init_queue(do_viodasd_request, &d->q_lock); if (q == NULL) { printk(VIOD_KERN_WARNING "cannot allocate queue for disk %d\n", dev_no); - return; + return 0; } g = alloc_disk(1 << PARTITION_SHIFT); if (g == NULL) { @@ -540,7 +537,7 @@ "cannot allocate disk structure for disk %d\n", dev_no); blk_cleanup_queue(q); - return; + return 0; } d->disk = g; @@ -563,8 +560,17 @@ g->private_data = d; set_capacity(g, d->size >> 9); + printk(VIOD_KERN_INFO "disk %d: %lu sectors (%lu MB) " + "CHS=%d/%d/%d sector size %d%s\n", + dev_no, (unsigned long)(d->size >> 9), + (unsigned long)(d->size >> 20), + (int)d->cylinders, (int)d->tracks, + (int)d->sectors, (int)d->bytes_per_sector, + d->read_only ? " (RO)" : ""); + /* register us in the global list */ add_disk(g); + return 1; } /* returns the total number of scatterlist elements converted */ @@ -725,6 +731,29 @@ } /* + * Get the driver to reprobe for more disks. + */ +static ssize_t probe_disks(struct device_driver *drv, char *buf) +{ + ssize_t count = 0; + struct viodasd_device *d; + + for (d = viodasd_devices; d < &viodasd_devices[MAX_DISKNO]; d++) { + if ((d->disk == NULL) && probe_disk(d)) { + count += scnprintf(&buf[count], PAGE_SIZE - count, + "%s\n", d->disk->disk_name); + } + } + return count; +} + +static DRIVER_ATTR(probe, S_IRUSR, probe_disks, NULL) + +static struct vio_driver viodasd_driver = { + .name = "viodasd" +}; + +/* * Initialize the whole device driver. Handle module and non-module * versions */ @@ -767,6 +796,9 @@ for (i = 0; i < MAX_DISKNO; i++) probe_disk(&viodasd_devices[i]); + vio_register_driver(&viodasd_driver); /* FIX ME - error checking */ + driver_create_file(&viodasd_driver.driver, &driver_attr_probe); + return 0; } module_init(viodasd_init); @@ -776,6 +808,9 @@ int i; struct viodasd_device *d; + vio_unregister_driver(&viodasd_driver); + driver_remove_file(&viodasd_driver.driver, &driver_attr_probe); + for (i = 0; i < MAX_DISKNO; i++) { d = &viodasd_devices[i]; if (d->disk) { From akpm at osdl.org Mon May 24 16:29:20 2004 From: akpm at osdl.org (Andrew Morton) Date: Sun, 23 May 2004 23:29:20 -0700 Subject: [PATCH] dynamic addition of virtual disks on PPC64 iSeries In-Reply-To: <20040524162039.5f6ca3e0.sfr@canb.auug.org.au> References: <20040524162039.5f6ca3e0.sfr@canb.auug.org.au> Message-ID: <20040523232920.2fb0640a.akpm@osdl.org> Stephen Rothwell wrote: > > This patch allows us to dynamically add virtual disks to an iSeries > partition. It works like this: after you have created the virtual disk > file on OS/400 and attached it to the Linux partition, you need to read > /sys/bus/vio/drivers/viodasd/probe. This will do the probe and list any > new disks discovered. > > This was the nicest way I could think of doing this as the interface to > the hypervisor is polled ... Is it possible to present all the virtual disks as partitions of a single disk, use the "partition table" to query what is present? Or to generate a hotplug event when a disk is added? Even if there's no notification to the kernel, it should be possible to generate the hotplug events in response to a /proc-based trigger. It's a shame you didn't cc linux-kernel on this - the blockdev police would have better ideas than I. ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From hch at infradead.org Mon May 24 17:09:22 2004 From: hch at infradead.org (hch at infradead.org) Date: Mon, 24 May 2004 03:09:22 -0400 Subject: [PATCH] dynamic addition of virtual disks on PPC64 iSeries In-Reply-To: <20040524162039.5f6ca3e0.sfr@canb.auug.org.au> References: <20040524162039.5f6ca3e0.sfr@canb.auug.org.au> Message-ID: <20040524070922.GA16860@infradead.org> On Mon, May 24, 2004 at 04:20:39PM +1000, Stephen Rothwell wrote: > Hi Andrew, Linus, > > This patch allows us to dynamically add virtual disks to an iSeries > partition. It works like this: after you have created the virtual disk > file on OS/400 and attached it to the Linux partition, you need to read > /sys/bus/vio/drivers/viodasd/probe. This will do the probe and list any > new disks discovered. Reading a file to cause a probe looks like an incredibly broken interface to me. I'd suggest writing '1' (or for that matters accepting any input would do it either) to the file instead. ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From sfr at canb.auug.org.au Mon May 24 17:18:29 2004 From: sfr at canb.auug.org.au (Stephen Rothwell) Date: Mon, 24 May 2004 17:18:29 +1000 Subject: [PATCH] dynamic addition of virtual disks on PPC64 iSeries In-Reply-To: <20040524070922.GA16860@infradead.org> References: <20040524162039.5f6ca3e0.sfr@canb.auug.org.au> <20040524070922.GA16860@infradead.org> Message-ID: <20040524171829.2cc0dbb5.sfr@canb.auug.org.au> On Mon, 24 May 2004 03:09:22 -0400 hch at infradead.org wrote: > > Reading a file to cause a probe looks like an incredibly broken > interface to me. I'd suggest writing '1' (or for that matters > accepting any input would do it either) to the file instead. Reading it had the advantage that I could return the names of the disks I found. Though, I guess, if it generated hotplug events, that would not matter so much. -- Cheers, Stephen Rothwell sfr at canb.auug.org.au http://www.canb.auug.org.au/~sfr/ ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From haveblue at us.ibm.com Tue May 25 07:59:04 2004 From: haveblue at us.ibm.com (Dave Hansen) Date: Mon, 24 May 2004 14:59:04 -0700 Subject: [PATCH] ppc64 kernel hackers can't spell Message-ID: <1085435944.3480.6.camel@nighthawk> This patch is obviously of the utmost importance. It probably doesn't matter as much for kernel error messages, but one of these mistakes is in a user-readable /proc file. -- Dave -------------- next part -------------- A non-text attachment was scrubbed... Name: ppc64-existant-0.patch Type: text/x-patch Size: 1178 bytes Desc: not available Url : http://ozlabs.org/pipermail/linuxppc64-dev/attachments/20040524/9e04b0be/attachment.bin From anton at samba.org Tue May 25 08:09:21 2004 From: anton at samba.org (Anton Blanchard) Date: Tue, 25 May 2004 08:09:21 +1000 Subject: [PATCH] ppc64 kernel hackers can't spell In-Reply-To: <1085435944.3480.6.camel@nighthawk> References: <1085435944.3480.6.camel@nighthawk> Message-ID: <20040524220921.GD3893@krispykreme> > This patch is obviously of the utmost importance. It probably doesn't > matter as much for kernel error messages, but one of these mistakes is > in a user-readable /proc file. It gets worse. Anton ===== rtas-proc.c 1.13 vs edited ===== --- 1.13/arch/ppc64/kernel/rtas-proc.c Tue Mar 16 22:30:38 2004 +++ edited/rtas-proc.c Tue May 25 08:08:25 2004 @@ -698,7 +698,7 @@ } break; default: - n += sprintf(buf+n, "Unkown sensor (type %d), ignoring it\n", + n += sprintf(buf+n, "Unknown sensor (type %d), ignoring it\n", s.token); unknown = 1; have_strings = 1; ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From meissner at suse.de Tue May 25 19:58:37 2004 From: meissner at suse.de (Marcus Meissner) Date: Tue, 25 May 2004 11:58:37 +0200 Subject: [patch] missing map for DM_REMOVE_ALL Message-ID: <20040525095837.GA21241@suse.de> Hi, Added missing DM_REMOVE_ALL call. Signed-off-by: Marcus Meissner Ciao, Marcus --- linux-2.6.5/include/linux/compat_ioctl.h.xx 2004-05-24 18:14:39.000000000 +0200 +++ linux-2.6.5/include/linux/compat_ioctl.h 2004-05-24 18:10:23.000000000 +0200 @@ -129,6 +129,7 @@ COMPATIBLE_IOCTL(RESTART_ARRAY_RW) /* DM */ COMPATIBLE_IOCTL(DM_VERSION) +COMPATIBLE_IOCTL(DM_REMOVE_ALL) COMPATIBLE_IOCTL(DM_LIST_DEVICES) COMPATIBLE_IOCTL(DM_DEV_CREATE) COMPATIBLE_IOCTL(DM_DEV_REMOVE) ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From johnrose at austin.ibm.com Thu May 27 01:38:10 2004 From: johnrose at austin.ibm.com (John Rose) Date: Wed, 26 May 2004 10:38:10 -0500 Subject: [PATCH] rpaphp.patch -- multi-function devices not handled correctly In-Reply-To: <40AEBB98.5080903@us.ibm.com> References: <40AC1099.9060007@us.ibm.com> <20040520211613.GA27095@kroah.com> <40AEBB98.5080903@us.ibm.com> Message-ID: <1085585889.1809.34.camel@verve.austin.ibm.com> Hi Linda- Looks good. I only have one comment on this. I think the "removable" member of the slot structure, and the contents of the "phy_removable" attr file, should be a char or integer rather than a string. A 0 or 1 would just as easily communicate whether the slot is removable as a "EMBEDDED/HOTPLUG" slot. For example, to cat an attribute file "phy_removable" and see the string HOTPLUG would probably be less clear than just a 0. IMHO... Thanks- John On Fri, 2004-05-21 at 21:31, Linda Xie wrote: > Here is an updated rpaphp patch. > > Thanks, > > Linda > > Greg KH wrote: > > >On Wed, May 19, 2004 at 08:57:45PM -0500, Linda Xie wrote: > > > > > >>Can pci_scan_child_bus be exported? I pasted it in rpaphp_pci.c for > >>temparary use. > >> > >> > > > >Yes, I'll be glad to export it if you need it. Just send me a separate > >patch with your next, updated version. Should probably make it > >EXPORT_SYMBOL_GPL() just to be safe... > > > >thanks, > > > >greg k-h > > > > > > > > > > > > > ______________________________________________________________________ > diff -Nru a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c > --- a/drivers/pci/hotplug/rpadlpar_core.c Fri May 21 20:44:27 2004 > +++ b/drivers/pci/hotplug/rpadlpar_core.c Fri May 21 20:44:27 2004 > @@ -24,13 +24,6 @@ > > static DECLARE_MUTEX(rpadlpar_sem); > > -static inline int is_hotplug_capable(struct device_node *dn) > -{ > - unsigned char *ptr = get_property(dn, "ibm,fw-pci-hot-plug-ctrl", NULL); > - > - return (int) (ptr != NULL); > -} > - > static char *get_node_drc_name(struct device_node *dn) > { > char *ptr = NULL; > @@ -52,7 +45,7 @@ > if (!parent) > return NULL; > > - for (child = of_get_next_child(parent, NULL); > + for (child = of_get_next_child(parent, NULL); > child; child = of_get_next_child(parent, child)) { > loc_code = get_property(child, "ibm,loc-code", NULL); > if (loc_code && !strcmp(loc_code, drc_name)) > @@ -262,6 +255,7 @@ > } > > /* Add hotplug slot for new VIOA or PCI */ > + > if (!rc && rpaphp_add_slot(dn)) { > printk(KERN_ERR "%s: unable to add hotplug slot %s\n", > __FUNCTION__, drc_name); > @@ -324,6 +318,7 @@ > } > > /* Remove pci bus */ > + > if (dlpar_pci_remove_bus(bridge_dev)) { > printk(KERN_ERR "%s: unable to remove pci bus %s\n", > __FUNCTION__, drc_name); > @@ -352,7 +347,7 @@ > > if (down_interruptible(&rpadlpar_sem)) > return -ERESTARTSYS; > - > + > if (!find_php_slot_vio_node(drc_name) && > !find_php_slot_pci_node(drc_name)) { > rc = -ENODEV; > @@ -364,7 +359,7 @@ > rc = -EINVAL; > goto exit; > } > - > + > switch (slot->dev_type) { > case PCI_DEV: > rc = dlpar_remove_pci_slot(slot, drc_name); > diff -Nru a/drivers/pci/hotplug/rpaphp.h b/drivers/pci/hotplug/rpaphp.h > --- a/drivers/pci/hotplug/rpaphp.h Fri May 21 20:44:27 2004 > +++ b/drivers/pci/hotplug/rpaphp.h Fri May 21 20:44:27 2004 > @@ -30,6 +30,9 @@ > #include > #include "pci_hotplug.h" > > +#define HOTPLUG 0 > +#define EMBEDDED 1 > + > #define DR_INDICATOR 9002 > #define DR_ENTITY_SENSE 9003 > > @@ -73,6 +76,11 @@ > #define CONFIGURED 1 > #define EMPTY 0 > > +struct rpaphp_pci_func { > + struct pci_dev *pci_dev; > + struct list_head sibling; > +}; > + > /* > * struct slot - slot information for each *physical* slot > */ > @@ -83,14 +91,13 @@ > u32 power_domain; > char *name; > char *location; > + char removable[20]; > struct device_node *dn; /* slot's device_node in OFDT */ > - /* dn has phb info */ > + /* dn has phb info */ > struct pci_dev *bridge; /* slot's pci_dev in pci_devices */ > union { > - struct pci_dev *pci_dev; /* pci_dev of device in this slot */ > - /* it will be used for unconfig */ > - /* NULL if slot is empty */ > - struct vio_dev *vio_dev; /* vio_dev of the device in this slot */ > + struct list_head pci_funcs; /* pci_devs in PCI slot */ > + struct vio_dev *vio_dev; /* vio_dev in VIO slot */ > } dev; > u8 dev_type; /* VIO or PCI */ > struct hotplug_slot *hotplug_slot; > @@ -101,6 +108,13 @@ > extern struct list_head rpaphp_slot_head; > extern int num_slots; > > +static inline int is_hotplug_capable(struct device_node *dn) > +{ > + unsigned char *ptr = get_property(dn, "ibm,fw-pci-hot-plug-ctrl", NULL); > + > + return (int) (ptr != NULL); > +} > + > /* function prototypes */ > > /* rpaphp_pci.c */ > @@ -110,6 +124,7 @@ > extern int register_pci_slot(struct slot *slot); > extern int rpaphp_unconfig_pci_adapter(struct slot *slot); > extern int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value); > +extern struct hotplug_slot *rpaphp_find_hotplug_slot(struct pci_dev *dev); > > /* rpaphp_core.c */ > extern int rpaphp_add_slot(struct device_node *dn); > @@ -128,5 +143,6 @@ > extern int rpaphp_get_power_status(struct slot *slot, u8 * value); > extern int rpaphp_set_attention_status(struct slot *slot, u8 status); > extern void rpaphp_sysfs_remove_attr_location(struct hotplug_slot *slot); > +extern void rpaphp_sysfs_remove_attr_removable(struct hotplug_slot *slot); > > #endif /* _PPC64PHP_H */ > diff -Nru a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c > --- a/drivers/pci/hotplug/rpaphp_core.c Fri May 21 20:44:27 2004 > +++ b/drivers/pci/hotplug/rpaphp_core.c Fri May 21 20:44:27 2004 > @@ -54,6 +54,8 @@ > MODULE_DESCRIPTION(DRIVER_DESC); > MODULE_LICENSE("GPL"); > > +void eeh_register_disable_func(int (*)(struct pci_dev *)); > + > module_param(debug, bool, 0644); > > static int enable_slot(struct hotplug_slot *slot); > @@ -63,6 +65,7 @@ > static int get_attention_status(struct hotplug_slot *slot, u8 * value); > static int get_adapter_status(struct hotplug_slot *slot, u8 * value); > static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value); > +static int rpaphp_disable_slot(struct pci_dev *dev); > > struct hotplug_slot_ops rpaphp_hotplug_slot_ops = { > .owner = THIS_MODULE, > @@ -89,7 +92,7 @@ > */ > static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value) > { > - int retval; > + int retval = 0; > struct slot *slot = (struct slot *)hotplug_slot->private; > > down(&rpaphp_sem); > @@ -213,9 +216,12 @@ > > list_del(&slot->rpaphp_slot_list); > > - /* remove "php_location" file */ > + /* remove "phy_location" file */ > rpaphp_sysfs_remove_attr_location(php_slot); > > + /* remove "phy_removable" file */ > + rpaphp_sysfs_remove_attr_removable(php_slot); > + > retval = pci_hp_deregister(php_slot); > if (retval) > err("Problem unregistering a slot %s\n", slot->name); > @@ -226,29 +232,50 @@ > return retval; > } > > -static int is_php_dn(struct device_node *dn, int **indexes, int **names, int **types, > - int **power_domains) > +static int get_dn_properties(struct device_node *dn, int **indexes, int **names, > + int **types, int **power_domains) > { > *indexes = (int *) get_property(dn, "ibm,drc-indexes", NULL); > - if (!*indexes) > - return 0; > + > /* &names[1] contains NULL terminated slot names */ > *names = (int *) get_property(dn, "ibm,drc-names", NULL); > - if (!*names) > - return 0; > + > /* &types[1] contains NULL terminated slot types */ > *types = (int *) get_property(dn, "ibm,drc-types", NULL); > - if (!*types) > - return 0; > + > /* power_domains[1...n] are the slot power domains */ > - *power_domains = (int *) get_property(dn, > - "ibm,drc-power-domains", NULL); > - if (!*power_domains) > - return 0; > - if (strcmp(dn->name, "pci") == 0 && > - !get_property(dn, "ibm,fw-pci-hot-plug-ctrl", NULL)) > - return 0; > - return 1; > + *power_domains = (int *) get_property(dn, "ibm,drc-power-domains", NULL); > + > + if (*indexes && *names && *types && *power_domains) > + return (1); > + > + return (0); > +} > + > +static int is_php_dn(struct device_node *dn, int **indexes, int **names, int **types, > + int **power_domains) > +{ > + if (!is_hotplug_capable(dn)) > + return (0); > + if (!get_dn_properties(dn, indexes, names, types, power_domains)) > + return (0); > + return (1); > +} > + > +static int is_dr_dn(struct device_node *dn, int **indexes, int **names, int **types, > + int **power_domains, int **my_drc_index) > +{ > + if (!is_hotplug_capable(dn)) > + return (0); > + > + *my_drc_index = (int *) get_property(dn, "ibm,my-drc-index", NULL); > + if(!*my_drc_index) > + return (0); > + > + if (!dn->parent) > + return (0); > + > + return get_dn_properties(dn->parent, indexes, names, types, power_domains); > } > > static inline int is_vdevice_root(struct device_node *dn) > @@ -256,15 +283,18 @@ > return !strcmp(dn->name, "vdevice"); > } > > -/** > - * rpaphp_add_slot: Add Hot Plug slot(s) to sysfs > - * > - */ > +/**************************************************************** > + * rpaphp not only registers PCI hotplug slots(HOTPLUG), > + * but also logical DR slots(EMBEDDED). > + * HOTPLUG slot: An adapter can be physically added/removed. > + * EMBEDDED slot: An adapter can be logically removed/added > + * from/to a partition with the slot. > + ***************************************************************/ > int rpaphp_add_slot(struct device_node *dn) > { > struct slot *slot; > int retval = 0; > - int i; > + int i, *my_drc_index, slot_type; > int *indexes, *names, *types, *power_domains; > char *name, *type; > > @@ -277,42 +307,65 @@ > } > > /* register PCI devices */ > - if (dn->name != 0 && strcmp(dn->name, "pci") == 0 && > - is_php_dn(dn, &indexes, &names, &types, &power_domains)) { > + if (dn->name != 0 && strcmp(dn->name, "pci") == 0) { > + if (is_php_dn(dn, &indexes, &names, &types, &power_domains)) > + slot_type = HOTPLUG; > + else if (is_dr_dn(dn, &indexes, &names, &types, &power_domains, &my_drc_index)) > + slot_type = EMBEDDED; > + else goto exit; > > name = (char *) &names[1]; > type = (char *) &types[1]; > - for (i = 0; i < indexes[0]; > - i++, > - name += (strlen(name) + 1), > - type += (strlen(type) + 1)) { > - if (!(slot = alloc_slot_struct(dn, indexes[i + 1], name, > - power_domains[i + 1]))) { > - retval = -ENOMEM; > - goto exit; > - } > - slot->type = simple_strtoul(type, NULL, 10); > - if (slot->type < 1 || slot->type > 16) > - slot->type = 0; > - retval = register_pci_slot(slot); > + for (i = 0; i < indexes[0]; i++, > + name += (strlen(name) + 1), type += (strlen(type) + 1)) { > > - } /* for indexes */ > - } /* end of PCI device_node */ > + if ( slot_type == HOTPLUG || > + (slot_type == EMBEDDED && indexes[i + 1] == my_drc_index[0])) { > + > + if (!(slot = alloc_slot_struct(dn, indexes[i + 1], name, > + power_domains[i + 1]))) { > + retval = -ENOMEM; > + goto exit; > + } > + if (slot_type == EMBEDDED) > + slot->type = EMBEDDED; > + else > + slot->type = simple_strtoul(type, NULL, 10); > + > + dbg(" Found drc-index:0x%x drc-name:%s drc-type:%s\n", > + indexes[i + 1], name, type); > + > + retval = register_pci_slot(slot); > + if (slot_type == EMBEDDED) > + goto exit; > + } > + } > + } > exit: > dbg("%s - Exit: num_slots=%d rc[%d]\n", > __FUNCTION__, num_slots, retval); > return retval; > } > > -static int __init init_rpa(void) > +/* > + * init_slots - initialize 'struct slot' structures for each slot > + * > + */ > +static void init_slots(void) > { > struct device_node *dn; > > + for (dn = find_all_nodes(); dn; dn = dn->next) > + rpaphp_add_slot(dn); > +} > + > +static int __init init_rpa(void) > +{ > + > init_MUTEX(&rpaphp_sem); > > /* initialize internal data structure etc. */ > - for (dn = find_all_nodes(); dn; dn = dn->next) > - rpaphp_add_slot(dn); > + init_slots(); > if (!num_slots) > return -ENODEV; > > @@ -342,12 +395,18 @@ > { > info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); > > + /* let EEH know they can use hotplug */ > + eeh_register_disable_func(&rpaphp_disable_slot); > + > /* read all the PRA info from the system */ > return init_rpa(); > } > > static void __exit rpaphp_exit(void) > { > + /* let EEH know we are going away */ > + eeh_register_disable_func(NULL); > + > cleanup_slots(); > } > > @@ -374,11 +433,16 @@ > retval = -EINVAL; > } > up(&rpaphp_sem); > - exit: > +exit: > dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval); > return retval; > } > > +static int rpaphp_disable_slot(struct pci_dev *dev) > +{ > + return disable_slot(rpaphp_find_hotplug_slot(dev)); > +} > + > static int disable_slot(struct hotplug_slot *hotplug_slot) > { > int retval; > @@ -395,9 +459,7 @@ > down(&rpaphp_sem); > switch (slot->dev_type) { > case PCI_DEV: > - rpaphp_set_attention_status(slot, LED_ID); > retval = rpaphp_unconfig_pci_adapter(slot); > - rpaphp_set_attention_status(slot, LED_OFF); > break; > case VIO_DEV: > retval = rpaphp_unconfig_vio_adapter(slot); > @@ -406,7 +468,7 @@ > retval = -ENODEV; > } > up(&rpaphp_sem); > - exit: > +exit: > dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval); > return retval; > } > diff -Nru a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c > --- a/drivers/pci/hotplug/rpaphp_pci.c Fri May 21 20:44:27 2004 > +++ b/drivers/pci/hotplug/rpaphp_pci.c Fri May 21 20:44:27 2004 > @@ -30,24 +30,25 @@ > > struct pci_dev *rpaphp_find_pci_dev(struct device_node *dn) > { > - struct pci_dev *retval_dev = NULL, *dev; > + struct pci_dev *retval_dev = NULL, *dev = NULL; > char bus_id[BUS_ID_SIZE]; > + int *vendor_id, *device_id, vid = PCI_ANY_ID, did = PCI_ANY_ID; > > sprintf(bus_id, "%04x:%02x:%02x.%d",dn->phb->global_number, > dn->busno, PCI_SLOT(dn->devfn), PCI_FUNC(dn->devfn)); > - > - dbg("Enter rpaphp_find_pci_dev() full_name=%s bus_id=%s\n", > - dn->full_name, bus_id); > - > - while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { > - if (!strcmp(pci_name(dev), bus_id)) { > + vendor_id = (int *) get_property(dn, "vendor-id", NULL); > + device_id = (int *) get_property(dn, "device-id", NULL); > + if (vendor_id) > + vid = *vendor_id; > + if (device_id) > + did = *device_id; > + while ((dev = pci_find_device(vid, did, dev)) != NULL) { > + if (!strcmp(pci_name(dev), bus_id)) { > retval_dev = dev; > - dbg("rpaphp_find_pci_dev(): found dev=%p\n\n", dev); > break; > } > } > return retval_dev; > - > } > > EXPORT_SYMBOL_GPL(rpaphp_find_pci_dev); > @@ -79,11 +80,6 @@ > return rpaphp_find_pci_dev(slot->dn); > } > > -static struct pci_dev *rpaphp_find_adapter_pdev(struct slot *slot) > -{ > - return rpaphp_find_pci_dev(slot->dn->child); > -} > - > static int rpaphp_get_sensor_state(struct slot *slot, int *state) > { > int rc; > @@ -144,7 +140,7 @@ > else if (rpaphp_find_pci_dev(slot->dn->child)) > *value = CONFIGURED; > else { > - dbg("%s: can't find pdev of adapter in slot[%s]\n", __FUNCTION__, slot->name); > + err("%s: can't find pdev of adapter in slot[%s]\n", __FUNCTION__, slot->name); > *value = NOT_CONFIGURED; > } > } > @@ -158,7 +154,8 @@ > } > > /* Must be called before pci_bus_add_devices */ > -static void rpaphp_fixup_new_pci_devices(struct pci_bus *bus) > +static void > +rpaphp_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus) > { > struct pci_dev *dev; > > @@ -169,8 +166,9 @@ > */ > if (list_empty(&dev->global_list)) { > int i; > - > - pcibios_fixup_device_resources(dev, bus); > + > + if(fix_bus) > + pcibios_fixup_device_resources(dev, bus); > pci_read_irq_line(dev); > for (i = 0; i < PCI_NUM_RESOURCES; i++) { > struct resource *r = &dev->resource[i]; > @@ -183,69 +181,173 @@ > } > } > > -static void > -rpaphp_pci_config_device(struct pci_bus *pci_bus, struct device_node *dn) > +static unsigned int rpaphp_pci_scan_child_bus(struct pci_bus *bus) > { > - int num; > + unsigned int devfn, pass, max = bus->secondary; > + struct pci_dev *dev; > > - num = pci_scan_slot(pci_bus, PCI_DEVFN(PCI_SLOT(dn->devfn), 0)); > - if (num) { > - rpaphp_fixup_new_pci_devices(pci_bus); > - pci_bus_add_devices(pci_bus); > - } > + dbg("%s: Scanning bus %02x\n", __FUNCTION__, bus->number); > + > + /* Go find them, Rover! */ > + for (devfn = 0; devfn < 0x100; devfn += 8) > + pci_scan_slot(bus, devfn); > + > + /* > + * After performing arch-dependent fixup of the bus, look behind > + * all PCI-to-PCI bridges on this bus. > + */ > + dbg("%s: Fixups for bus %02x\n", __FUNCTION__, bus->number); > + > + pcibios_fixup_bus(bus); > + > + for (pass=0; pass < 2; pass++) > + list_for_each_entry(dev, &bus->devices, bus_list) { > + if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) > + max = pci_scan_bridge(bus, dev, max, pass); > + } > + > + /* > + * We've scanned the bus and so we know all about what's on > + * the other side of any bridges that may be on this bus plus > + * any devices. > + * > + * Return how far we've got finding sub-buses. > + */ > + dbg("%s: Bus scan for %02x returning with max=%02x\n", > + __FUNCTION__, bus->number, max); > + return max; > } > > -static int rpaphp_pci_config_bridge(struct pci_dev *dev, struct device_node *dn); > +static int rpaphp_pci_config_bridge(struct pci_dev *dev); > > /***************************************************************************** > - rpaphp_pci_config_dn() will recursively configure all devices under the > - given slot->dn and return the dn's pci_dev. > + rpaphp_pci_config_slot() will configure all devices under the > + given slot->dn and return the the first pci_dev. > *****************************************************************************/ > static struct pci_dev * > -rpaphp_pci_config_dn(struct device_node *dn, struct pci_bus *bus) > +rpaphp_pci_config_slot(struct device_node *dn, struct pci_bus *bus) > { > - struct device_node *local; > + struct device_node *eads_first_child = dn->child; > struct pci_dev *dev; > + int num; > + > + dbg("Enter %s: dn=%s bus=%s\n", __FUNCTION__, dn->full_name, bus->name); > > - for (local = dn->child; local; local = local->sibling) { > - rpaphp_pci_config_device(bus, local); > - dev = rpaphp_find_pci_dev(local); > - if (!rpaphp_pci_config_bridge(dev, local)) > + if (eads_first_child) { > + /* pci_scan_slot should find all children of EADs */ > + num = pci_scan_slot(bus, PCI_DEVFN(PCI_SLOT(eads_first_child->devfn), 0)); > + if (num) { > + rpaphp_fixup_new_pci_devices(bus, 1); > + pci_bus_add_devices(bus); > + } > + dev = rpaphp_find_pci_dev(eads_first_child); > + if (!dev) { > + err("No new device found\n"); > return NULL; > + } > + if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) > + rpaphp_pci_config_bridge(dev); > } > - > return dev; > } > > -static int rpaphp_pci_config_bridge(struct pci_dev *dev, struct device_node *dn) > +static int rpaphp_pci_config_bridge(struct pci_dev *dev) > +{ > + u8 sec_busno; > + struct pci_bus *child_bus; > + struct pci_dev *child_dev; > + > + dbg("Enter %s: BRIDGE dev=%s\n", __FUNCTION__, pci_name(dev)); > + > + /* get busno of downstream bus */ > + pci_read_config_byte(dev, PCI_SECONDARY_BUS, &sec_busno); > + > + /* add to children of PCI bridge dev->bus */ > + child_bus = pci_add_new_bus(dev->bus, dev, sec_busno); > + if (!child_bus) { > + err("%s: could not add second bus\n", __FUNCTION__); > + return -EIO; > + } > + sprintf(child_bus->name, "PCI Bus #%02x", child_bus->number); > + /* do pci_scan_child_bus */ > + rpaphp_pci_scan_child_bus(child_bus); > + > + > + list_for_each_entry(child_dev, &child_bus->devices, bus_list) { > + eeh_add_device_late(child_dev); > + } > + > + /* fixup new pci devices without touching bus struct */ > + rpaphp_fixup_new_pci_devices(child_bus, 0); > + > + /* Make the discovered devices available */ > + pci_bus_add_devices(child_bus); > + return 0; > +} > + > +static void enable_eeh(struct device_node *dn) > { > - if (dev && dn->child) { /* dn is a PCI bridge node */ > - struct pci_bus *child; > - u8 sec_busno; > + struct device_node *sib; > > - /* get busno of downstream bus */ > - pci_read_config_byte(dev, PCI_SECONDARY_BUS, &sec_busno); > + for (sib = dn->child; sib; sib = sib->sibling) > + enable_eeh(sib); > + eeh_add_device_early(dn); > + return; > + > +} > + > +#ifdef DEBUG > +static void print_slot_pci_funcs(struct slot *slot) > +{ > + struct list_head *l; > > - /* add to children of PCI bridge dev->bus */ > - child = pci_add_new_bus(dev->bus, dev, sec_busno); > - if (!child) { > - err("%s: could not add second bus\n", __FUNCTION__); > - return 0; > + if (slot->dev_type == PCI_DEV) { > + printk("pci_funcs of slot[%s]\n", slot->name); > + if (list_empty(&slot->dev.pci_funcs)) > + printk(" pci_funcs is EMPTY\n"); > + > + list_for_each (l, &slot->dev.pci_funcs) { > + struct rpaphp_pci_func *func = > + list_entry(l, struct rpaphp_pci_func, sibling); > + printk(" FOUND dev=%s\n", pci_name(func->pci_dev)); > } > - sprintf(child->name, "PCI Bus #%02x", child->number); > - /* Fixup subordinate bridge bases and resureces */ > - pcibios_fixup_bus(child); > + } > +} > +#endif > + > +static int init_slot_pci_funcs(struct slot *slot) > +{ > + struct device_node *child; > + > + for (child = slot->dn->child; child != NULL; child = child->sibling) { > + struct pci_dev *pdev = rpaphp_find_pci_dev(child); > > - /* may need do more stuff here */ > - rpaphp_pci_config_dn(dn, dev->subordinate); > + if (pdev) { > + struct rpaphp_pci_func *func; > + func = kmalloc(sizeof(struct rpaphp_pci_func), GFP_KERNEL); > + if (!func) > + return -ENOMEM; > + memset(func, 0, sizeof(struct rpaphp_pci_func)); > + INIT_LIST_HEAD(&func->sibling); > + func->pci_dev = pdev; > + list_add_tail(&func->sibling, &slot->dev.pci_funcs); > +#ifdef DEBUG > + print_slot_pci_funcs(slot); > +#endif > + } else { > + err("%s: dn=%s has no pci_dev\n", > + __FUNCTION__, child->full_name); > + return -EIO; > + } > } > - return 1; > + return 0; > } > > -static struct pci_dev *rpaphp_config_pci_adapter(struct slot *slot) > +static int rpaphp_config_pci_adapter(struct slot *slot) > { > struct pci_bus *pci_bus; > - struct pci_dev *dev = NULL; > + struct pci_dev *dev; > + int rc = -ENODEV; > > dbg("Entry %s: slot[%s]\n", __FUNCTION__, slot->name); > > @@ -256,38 +358,76 @@ > err("%s: can't find bus structure\n", __FUNCTION__); > goto exit; > } > - > - eeh_add_device_early(slot->dn->child); > - dev = rpaphp_pci_config_dn(slot->dn, pci_bus); > - eeh_add_device_late(dev); > + enable_eeh(slot->dn); > + dev = rpaphp_pci_config_slot(slot->dn, pci_bus); > + if (!dev) { > + err("%s: can't find any devices.\n", __FUNCTION__); > + goto exit; > + } > + /* associate corresponding pci_dev */ > + rc = init_slot_pci_funcs(slot); > + if (rc) > + goto exit; > +#ifdef DEBUG > + print_slot_pci_funcs(slot); > +#endif > + if (!list_empty(&slot->dev.pci_funcs)) > + rc = 0; > } else { > /* slot is not enabled */ > err("slot doesn't have pci_dev structure\n"); > - dev = NULL; > } > - > exit: > - dbg("Exit %s: pci_dev %s\n", __FUNCTION__, dev ? "found" : "not found"); > - return dev; > + dbg("Exit %s: rc=%d\n", __FUNCTION__, rc); > + return rc; > +} > + > + > +static void rpaphp_eeh_remove_bus_device(struct pci_dev *dev) > +{ > + eeh_remove_device(dev); > + if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { > + struct pci_bus *bus = dev->subordinate; > + struct list_head *ln; > + if (!bus) > + return; > + for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) { > + struct pci_dev *pdev = pci_dev_b(ln); > + if (pdev) > + rpaphp_eeh_remove_bus_device(pdev); > + } > + > + } > + return; > } > > int rpaphp_unconfig_pci_adapter(struct slot *slot) > { > int retval = 0; > + struct list_head *ln; > > dbg("Entry %s: slot[%s]\n", __FUNCTION__, slot->name); > - if (!slot->dev.pci_dev) { > - info("%s: no card in slot[%s]\n", __FUNCTION__, slot->name); > + if (list_empty(&slot->dev.pci_funcs)) { > + err("%s: slot[%s] doesn't have any devices.\n", __FUNCTION__, > + slot->name); > > retval = -EINVAL; > goto exit; > } > - /* remove the device from the pci core */ > - eeh_remove_device(slot->dev.pci_dev); > - pci_remove_bus_device(slot->dev.pci_dev); > - > + /* remove the devices from the pci core */ > + list_for_each (ln, &slot->dev.pci_funcs) { > + struct rpaphp_pci_func *func; > + > + func = list_entry(ln, struct rpaphp_pci_func, sibling); > + if (func->pci_dev) { > + rpaphp_eeh_remove_bus_device(func->pci_dev); > + pci_remove_bus_device(func->pci_dev); > + } > + kfree(func); > + } > + INIT_LIST_HEAD(&slot->dev.pci_funcs); > slot->state = NOT_CONFIGURED; > - info("%s: adapter in slot[%s] unconfigured.\n", __FUNCTION__, > + info("%s: devices in slot[%s] unconfigured.\n", __FUNCTION__, > slot->name); > exit: > dbg("Exit %s, rc=0x%x\n", __FUNCTION__, retval); > @@ -314,31 +454,39 @@ > { > slot->bridge = rpaphp_find_bridge_pdev(slot); > if (!slot->bridge) { /* slot being added doesn't have pci_dev yet */ > - dbg("%s: no pci_dev for bridge dn %s\n", __FUNCTION__, slot->name); > + err("%s: no pci_dev for bridge dn %s\n", __FUNCTION__, slot->name); > dealloc_slot_struct(slot); > return 1; > } > - > + > strcpy(slot->name, pci_name(slot->bridge)); > + > /* find slot's pci_dev if it's not empty */ > if (slot->hotplug_slot->info->adapter_status == EMPTY) { > slot->state = EMPTY; /* slot is empty */ > - slot->dev.pci_dev = NULL; > } else { > /* slot is occupied */ > if (!(slot->dn->child)) { > /* non-empty slot has to have child */ > - err("%s: slot[%s]'s device_node doesn't have child for adapter\n", __FUNCTION__, slot->name); > + err("%s: slot[%s]'s device_node doesn't have child for adapter\n", > + __FUNCTION__, slot->name); > dealloc_slot_struct(slot); > return 1; > } > - slot->dev.pci_dev = rpaphp_find_adapter_pdev(slot); > - if (slot->dev.pci_dev) { > + if (init_slot_pci_funcs(slot)) { > + err("%s: init_slot_pci_funcs failed\n", __FUNCTION__); > + dealloc_slot_struct(slot); > + return 1; > + } > +#ifdef DEBUG > + print_slot_pci_funcs(slot); > +#endif > + if (!list_empty(&slot->dev.pci_funcs)) { > slot->state = CONFIGURED; > - > + > } else { > /* DLPAR add as opposed to > - * boot time */ > + * boot time */ > slot->state = NOT_CONFIGURED; > } > } > @@ -350,6 +498,14 @@ > int rc = 1; > > slot->dev_type = PCI_DEV; > + if (slot->type == EMBEDDED) > + strcpy(slot->removable, "EMBEDDED"); > + else > + strcpy(slot->removable, "HOTPLUG"); > + INIT_LIST_HEAD(&slot->dev.pci_funcs); > +#if 0 > + if (slot->type != EMEBEDDED && setup_pci_hotplug_slot_info(slot)) > +#endif > if (setup_pci_hotplug_slot_info(slot)) > goto exit_rc; > if (setup_pci_slot(slot)) > @@ -371,12 +527,12 @@ > dbg("%s: sensor state[%d]\n", __FUNCTION__, state); > /* if slot is not empty, enable the adapter */ > if (state == PRESENT) { > - dbg("%s : slot[%s] is occupid.\n", __FUNCTION__, slot->name); > - if ((slot->dev.pci_dev = > - rpaphp_config_pci_adapter(slot)) != NULL) { > + dbg("%s : slot[%s] is occupied.\n", __FUNCTION__, slot->name); > + retval = rpaphp_config_pci_adapter(slot); > + if (!retval) { > slot->state = CONFIGURED; > - dbg("%s: PCI adapter %s in slot[%s] has been configured\n", > - __FUNCTION__, pci_name(slot->dev.pci_dev), slot->name); > + dbg("%s: PCI devices in slot[%s] has been configured\n", > + __FUNCTION__, slot->name); > } else { > slot->state = NOT_CONFIGURED; > dbg("%s: no pci_dev struct for adapter in slot[%s]\n", > @@ -392,10 +548,31 @@ > retval = -EINVAL; > } > exit: > - if (slot->state != NOT_VALID) > - rpaphp_set_attention_status(slot, LED_ON); > - else > - rpaphp_set_attention_status(slot, LED_ID); > dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval); > return retval; > } > + > +struct hotplug_slot *rpaphp_find_hotplug_slot(struct pci_dev *dev) > +{ > + struct list_head *tmp, *n; > + struct slot *slot; > + > + list_for_each_safe(tmp, n, &rpaphp_slot_head) { > + struct pci_bus *bus; > + struct list_head *ln; > + > + slot = list_entry(tmp, struct slot, rpaphp_slot_list); > + bus = slot->bridge->subordinate; > + if (!bus) > + return NULL; /* shouldn't be here */ > + for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) { > + struct pci_dev *pdev = pci_dev_b(ln); > + if (pdev == dev) > + return slot->hotplug_slot; > + } > + } > + > + return NULL; > +} > + > +EXPORT_SYMBOL_GPL(rpaphp_find_hotplug_slot); > diff -Nru a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c > --- a/drivers/pci/hotplug/rpaphp_slot.c Fri May 21 20:44:27 2004 > +++ b/drivers/pci/hotplug/rpaphp_slot.c Fri May 21 20:44:27 2004 > @@ -29,6 +29,35 @@ > #include > #include "rpaphp.h" > > +static ssize_t removable_read_file (struct hotplug_slot *php_slot, char *buf) > +{ > + char *value; > + int retval = -ENOENT; > + struct slot *slot = (struct slot *)php_slot->private; > + > + if (!slot) > + return retval; > + > + value = slot->removable; > + retval = sprintf (buf, "%s\n", value); > + return retval; > +} > + > +static struct hotplug_slot_attribute hotplug_slot_attr_removable = { > + .attr = {.name = "phy_removable", .mode = S_IFREG | S_IRUGO}, > + .show = removable_read_file, > +}; > + > +static void rpaphp_sysfs_add_attr_removable (struct hotplug_slot *slot) > +{ > + sysfs_create_file(&slot->kobj, &hotplug_slot_attr_removable.attr); > +} > + > +void rpaphp_sysfs_remove_attr_removable (struct hotplug_slot *slot) > +{ > + sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_removable.attr); > +} > + > static ssize_t location_read_file (struct hotplug_slot *php_slot, char *buf) > { > char *value; > @@ -68,6 +97,16 @@ > > void dealloc_slot_struct(struct slot *slot) > { > + struct list_head *ln, *n; > + > + if (slot->dev_type == PCI_DEV) { > + list_for_each_safe (ln, n, &slot->dev.pci_funcs) { > + struct rpaphp_pci_func *func; > + > + func = list_entry(ln, struct rpaphp_pci_func, sibling); > + kfree(func); > + } > + } > kfree(slot->hotplug_slot->info); > kfree(slot->hotplug_slot->name); > kfree(slot->hotplug_slot); > @@ -86,7 +125,7 @@ > memset(slot, 0, sizeof (struct slot)); > slot->hotplug_slot = kmalloc(sizeof (struct hotplug_slot), GFP_KERNEL); > if (!slot->hotplug_slot) > - goto error_slot; > + goto error_slot; > memset(slot->hotplug_slot, 0, sizeof (struct hotplug_slot)); > slot->hotplug_slot->info = kmalloc(sizeof (struct hotplug_slot_info), > GFP_KERNEL); > @@ -95,7 +134,7 @@ > memset(slot->hotplug_slot->info, 0, sizeof (struct hotplug_slot_info)); > slot->hotplug_slot->name = kmalloc(BUS_ID_SIZE + 1, GFP_KERNEL); > if (!slot->hotplug_slot->name) > - goto error_info; > + goto error_info; > slot->location = kmalloc(strlen(drc_name) + 1, GFP_KERNEL); > if (!slot->location) > goto error_name; > @@ -107,9 +146,8 @@ > slot->hotplug_slot->private = slot; > slot->hotplug_slot->ops = &rpaphp_hotplug_slot_ops; > slot->hotplug_slot->release = &rpaphp_release_slot; > - slot->hotplug_slot->info->cur_bus_speed = PCI_SPEED_UNKNOWN; > - > - return slot; > + > + return (slot); > > error_name: > kfree(slot->hotplug_slot->name); > @@ -123,15 +161,32 @@ > return NULL; > } > > +static int is_registered(struct slot *slot) > +{ > + struct list_head *tmp, *n; > + struct slot *tmp_slot; > + > + list_for_each_safe(tmp, n, &rpaphp_slot_head) { > + tmp_slot = list_entry(tmp, struct slot, rpaphp_slot_list); > + if (!strcmp(tmp_slot->name, slot->name)) > + return 1; > + } > + return 0; > +} > + > int register_slot(struct slot *slot) > { > int retval; > - char *vio_uni_addr = NULL; > > - dbg("%s registering slot:path[%s] index[%x], name[%s] pdomain[%x] type[%d]\n", > - __FUNCTION__, slot->dn->full_name, slot->index, slot->name, > + dbg("%s registering slot:path[%s] index[%x], name[%s] pdomain[%x] type[%d]\n", > + __FUNCTION__, slot->dn->full_name, slot->index, slot->name, > slot->power_domain, slot->type); > - > + /* should not try to register the same slot twice */ > + if (is_registered(slot)) { /* should't be here */ > + err("register_slot: slot[%s] is already registered\n", slot->name); > + rpaphp_release_slot(slot->hotplug_slot); > + return (1); > + } > retval = pci_hp_register(slot->hotplug_slot); > if (retval) { > err("pci_hp_register failed with error %d\n", retval); > @@ -142,30 +197,40 @@ > /* create "phy_locatoin" file */ > rpaphp_sysfs_add_attr_location(slot->hotplug_slot); > > + /* create "phy_removable" file */ > + rpaphp_sysfs_add_attr_removable(slot->hotplug_slot); > + > /* add slot to our internal list */ > dbg("%s adding slot[%s] to rpaphp_slot_list\n", > __FUNCTION__, slot->name); > > list_add(&slot->rpaphp_slot_list, &rpaphp_slot_head); > > - if (vio_uni_addr) > - info("Slot [%s](vio_uni_addr=%s) registered\n", > - slot->name, vio_uni_addr); > + if (slot->dev_type == VIO_DEV) > + info("Slot [%s](VIO location=%s) registered\n", > + slot->name, slot->location); > else > - info("Slot [%s](bus_id=%s) registered\n", > - slot->name, pci_name(slot->bridge)); > + info("Slot [%s](PCI location=%s) registered\n", > + slot->name, slot->location); > num_slots++; > return 0; > } > > int rpaphp_get_power_status(struct slot *slot, u8 * value) > { > - int rc; > - > - rc = rtas_get_power_level(slot->power_domain, (int *) value); > - if (rc) > - err("failed to get power-level for slot(%s), rc=0x%x\n", > - slot->name, rc); > + int rc = 0; > + > + if (slot->type == EMBEDDED) { > + printk("%s set to POWER_ON for EMBEDDED slot %s\n", > + __FUNCTION__, slot->location); > + *value = POWER_ON; > + } > + else { > + rc = rtas_get_power_level(slot->power_domain, (int *) value); > + if (rc) > + err("failed to get power-level for slot(%s), rc=0x%x\n", > + slot->name, rc); > + } > > return rc; > } > @@ -177,8 +242,8 @@ > /* status: LED_OFF or LED_ON */ > rc = rtas_set_indicator(DR_INDICATOR, slot->index, status); > if (rc) > - err("slot(%s) set attention-status(%d) failed! rc=0x%x\n", > - slot->name, status, rc); > + err("slot(name=%s location=%s index=0x%x) set attention-status(%d) failed! rc=0x%x\n", > + slot->name, slot->location, slot->index, status, rc); > > return rc; > } ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From lxiep at us.ibm.com Thu May 27 02:31:51 2004 From: lxiep at us.ibm.com (Linda Xie) Date: Wed, 26 May 2004 11:31:51 -0500 Subject: [PATCH] rpaphp.patch -- multi-function devices not handled correctly In-Reply-To: <1085585889.1809.34.camel@verve.austin.ibm.com> References: <40AC1099.9060007@us.ibm.com> <20040520211613.GA27095@kroah.com> <40AEBB98.5080903@us.ibm.com> <1085585889.1809.34.camel@verve.austin.ibm.com> Message-ID: <40B4C677.9010906@us.ibm.com> Hi John, Thanks for the comments. Linda John Rose wrote: >Hi Linda- > >Looks good. I only have one comment on this. I think the "removable" >member of the slot structure, and the contents of the "phy_removable" >attr file, should be a char or integer rather than a string. A 0 or 1 >would just as easily communicate whether the slot is removable as a >"EMBEDDED/HOTPLUG" slot. For example, to cat an attribute file >"phy_removable" and see the string HOTPLUG would probably be less clear >than just a 0. IMHO... > > I will change it to "integer" type and set it to 1 for HOTPLUG and 0 for EMBEDDED slot. >Thanks- >John > >On Fri, 2004-05-21 at 21:31, Linda Xie wrote: > > >>Here is an updated rpaphp patch. >> >>Thanks, >> >>Linda >> >>Greg KH wrote: >> >> >> >>>On Wed, May 19, 2004 at 08:57:45PM -0500, Linda Xie wrote: >>> >>> >>> >>> >>>>Can pci_scan_child_bus be exported? I pasted it in rpaphp_pci.c for >>>>temparary use. >>>> >>>> >>>> >>>> >>>Yes, I'll be glad to export it if you need it. Just send me a separate >>>patch with your next, updated version. Should probably make it >>>EXPORT_SYMBOL_GPL() just to be safe... >>> >>>thanks, >>> >>>greg k-h >>> >>> >>> >>> >>> >>> >>> >>______________________________________________________________________ >>diff -Nru a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c >>--- a/drivers/pci/hotplug/rpadlpar_core.c Fri May 21 20:44:27 2004 >>+++ b/drivers/pci/hotplug/rpadlpar_core.c Fri May 21 20:44:27 2004 >>@@ -24,13 +24,6 @@ >> >> static DECLARE_MUTEX(rpadlpar_sem); >> >>-static inline int is_hotplug_capable(struct device_node *dn) >>-{ >>- unsigned char *ptr = get_property(dn, "ibm,fw-pci-hot-plug-ctrl", NULL); >>- >>- return (int) (ptr != NULL); >>-} >>- >> static char *get_node_drc_name(struct device_node *dn) >> { >> char *ptr = NULL; >>@@ -52,7 +45,7 @@ >> if (!parent) >> return NULL; >> >>- for (child = of_get_next_child(parent, NULL); >>+ for (child = of_get_next_child(parent, NULL); >> child; child = of_get_next_child(parent, child)) { >> loc_code = get_property(child, "ibm,loc-code", NULL); >> if (loc_code && !strcmp(loc_code, drc_name)) >>@@ -262,6 +255,7 @@ >> } >> >> /* Add hotplug slot for new VIOA or PCI */ >>+ >> if (!rc && rpaphp_add_slot(dn)) { >> printk(KERN_ERR "%s: unable to add hotplug slot %s\n", >> __FUNCTION__, drc_name); >>@@ -324,6 +318,7 @@ >> } >> >> /* Remove pci bus */ >>+ >> if (dlpar_pci_remove_bus(bridge_dev)) { >> printk(KERN_ERR "%s: unable to remove pci bus %s\n", >> __FUNCTION__, drc_name); >>@@ -352,7 +347,7 @@ >> >> if (down_interruptible(&rpadlpar_sem)) >> return -ERESTARTSYS; >>- >>+ >> if (!find_php_slot_vio_node(drc_name) && >> !find_php_slot_pci_node(drc_name)) { >> rc = -ENODEV; >>@@ -364,7 +359,7 @@ >> rc = -EINVAL; >> goto exit; >> } >>- >>+ >> switch (slot->dev_type) { >> case PCI_DEV: >> rc = dlpar_remove_pci_slot(slot, drc_name); >>diff -Nru a/drivers/pci/hotplug/rpaphp.h b/drivers/pci/hotplug/rpaphp.h >>--- a/drivers/pci/hotplug/rpaphp.h Fri May 21 20:44:27 2004 >>+++ b/drivers/pci/hotplug/rpaphp.h Fri May 21 20:44:27 2004 >>@@ -30,6 +30,9 @@ >> #include >> #include "pci_hotplug.h" >> >>+#define HOTPLUG 0 >>+#define EMBEDDED 1 >>+ >> #define DR_INDICATOR 9002 >> #define DR_ENTITY_SENSE 9003 >> >>@@ -73,6 +76,11 @@ >> #define CONFIGURED 1 >> #define EMPTY 0 >> >>+struct rpaphp_pci_func { >>+ struct pci_dev *pci_dev; >>+ struct list_head sibling; >>+}; >>+ >> /* >> * struct slot - slot information for each *physical* slot >> */ >>@@ -83,14 +91,13 @@ >> u32 power_domain; >> char *name; >> char *location; >>+ char removable[20]; >> struct device_node *dn; /* slot's device_node in OFDT */ >>- /* dn has phb info */ >>+ /* dn has phb info */ >> struct pci_dev *bridge; /* slot's pci_dev in pci_devices */ >> union { >>- struct pci_dev *pci_dev; /* pci_dev of device in this slot */ >>- /* it will be used for unconfig */ >>- /* NULL if slot is empty */ >>- struct vio_dev *vio_dev; /* vio_dev of the device in this slot */ >>+ struct list_head pci_funcs; /* pci_devs in PCI slot */ >>+ struct vio_dev *vio_dev; /* vio_dev in VIO slot */ >> } dev; >> u8 dev_type; /* VIO or PCI */ >> struct hotplug_slot *hotplug_slot; >>@@ -101,6 +108,13 @@ >> extern struct list_head rpaphp_slot_head; >> extern int num_slots; >> >>+static inline int is_hotplug_capable(struct device_node *dn) >>+{ >>+ unsigned char *ptr = get_property(dn, "ibm,fw-pci-hot-plug-ctrl", NULL); >>+ >>+ return (int) (ptr != NULL); >>+} >>+ >> /* function prototypes */ >> >> /* rpaphp_pci.c */ >>@@ -110,6 +124,7 @@ >> extern int register_pci_slot(struct slot *slot); >> extern int rpaphp_unconfig_pci_adapter(struct slot *slot); >> extern int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value); >>+extern struct hotplug_slot *rpaphp_find_hotplug_slot(struct pci_dev *dev); >> >> /* rpaphp_core.c */ >> extern int rpaphp_add_slot(struct device_node *dn); >>@@ -128,5 +143,6 @@ >> extern int rpaphp_get_power_status(struct slot *slot, u8 * value); >> extern int rpaphp_set_attention_status(struct slot *slot, u8 status); >> extern void rpaphp_sysfs_remove_attr_location(struct hotplug_slot *slot); >>+extern void rpaphp_sysfs_remove_attr_removable(struct hotplug_slot *slot); >> >> #endif /* _PPC64PHP_H */ >>diff -Nru a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c >>--- a/drivers/pci/hotplug/rpaphp_core.c Fri May 21 20:44:27 2004 >>+++ b/drivers/pci/hotplug/rpaphp_core.c Fri May 21 20:44:27 2004 >>@@ -54,6 +54,8 @@ >> MODULE_DESCRIPTION(DRIVER_DESC); >> MODULE_LICENSE("GPL"); >> >>+void eeh_register_disable_func(int (*)(struct pci_dev *)); >>+ >> module_param(debug, bool, 0644); >> >> static int enable_slot(struct hotplug_slot *slot); >>@@ -63,6 +65,7 @@ >> static int get_attention_status(struct hotplug_slot *slot, u8 * value); >> static int get_adapter_status(struct hotplug_slot *slot, u8 * value); >> static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value); >>+static int rpaphp_disable_slot(struct pci_dev *dev); >> >> struct hotplug_slot_ops rpaphp_hotplug_slot_ops = { >> .owner = THIS_MODULE, >>@@ -89,7 +92,7 @@ >> */ >> static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value) >> { >>- int retval; >>+ int retval = 0; >> struct slot *slot = (struct slot *)hotplug_slot->private; >> >> down(&rpaphp_sem); >>@@ -213,9 +216,12 @@ >> >> list_del(&slot->rpaphp_slot_list); >> >>- /* remove "php_location" file */ >>+ /* remove "phy_location" file */ >> rpaphp_sysfs_remove_attr_location(php_slot); >> >>+ /* remove "phy_removable" file */ >>+ rpaphp_sysfs_remove_attr_removable(php_slot); >>+ >> retval = pci_hp_deregister(php_slot); >> if (retval) >> err("Problem unregistering a slot %s\n", slot->name); >>@@ -226,29 +232,50 @@ >> return retval; >> } >> >>-static int is_php_dn(struct device_node *dn, int **indexes, int **names, int **types, >>- int **power_domains) >>+static int get_dn_properties(struct device_node *dn, int **indexes, int **names, >>+ int **types, int **power_domains) >> { >> *indexes = (int *) get_property(dn, "ibm,drc-indexes", NULL); >>- if (!*indexes) >>- return 0; >>+ >> /* &names[1] contains NULL terminated slot names */ >> *names = (int *) get_property(dn, "ibm,drc-names", NULL); >>- if (!*names) >>- return 0; >>+ >> /* &types[1] contains NULL terminated slot types */ >> *types = (int *) get_property(dn, "ibm,drc-types", NULL); >>- if (!*types) >>- return 0; >>+ >> /* power_domains[1...n] are the slot power domains */ >>- *power_domains = (int *) get_property(dn, >>- "ibm,drc-power-domains", NULL); >>- if (!*power_domains) >>- return 0; >>- if (strcmp(dn->name, "pci") == 0 && >>- !get_property(dn, "ibm,fw-pci-hot-plug-ctrl", NULL)) >>- return 0; >>- return 1; >>+ *power_domains = (int *) get_property(dn, "ibm,drc-power-domains", NULL); >>+ >>+ if (*indexes && *names && *types && *power_domains) >>+ return (1); >>+ >>+ return (0); >>+} >>+ >>+static int is_php_dn(struct device_node *dn, int **indexes, int **names, int **types, >>+ int **power_domains) >>+{ >>+ if (!is_hotplug_capable(dn)) >>+ return (0); >>+ if (!get_dn_properties(dn, indexes, names, types, power_domains)) >>+ return (0); >>+ return (1); >>+} >>+ >>+static int is_dr_dn(struct device_node *dn, int **indexes, int **names, int **types, >>+ int **power_domains, int **my_drc_index) >>+{ >>+ if (!is_hotplug_capable(dn)) >>+ return (0); >>+ >>+ *my_drc_index = (int *) get_property(dn, "ibm,my-drc-index", NULL); >>+ if(!*my_drc_index) >>+ return (0); >>+ >>+ if (!dn->parent) >>+ return (0); >>+ >>+ return get_dn_properties(dn->parent, indexes, names, types, power_domains); >> } >> >> static inline int is_vdevice_root(struct device_node *dn) >>@@ -256,15 +283,18 @@ >> return !strcmp(dn->name, "vdevice"); >> } >> >>-/** >>- * rpaphp_add_slot: Add Hot Plug slot(s) to sysfs >>- * >>- */ >>+/**************************************************************** >>+ * rpaphp not only registers PCI hotplug slots(HOTPLUG), >>+ * but also logical DR slots(EMBEDDED). >>+ * HOTPLUG slot: An adapter can be physically added/removed. >>+ * EMBEDDED slot: An adapter can be logically removed/added >>+ * from/to a partition with the slot. >>+ ***************************************************************/ >> int rpaphp_add_slot(struct device_node *dn) >> { >> struct slot *slot; >> int retval = 0; >>- int i; >>+ int i, *my_drc_index, slot_type; >> int *indexes, *names, *types, *power_domains; >> char *name, *type; >> >>@@ -277,42 +307,65 @@ >> } >> >> /* register PCI devices */ >>- if (dn->name != 0 && strcmp(dn->name, "pci") == 0 && >>- is_php_dn(dn, &indexes, &names, &types, &power_domains)) { >>+ if (dn->name != 0 && strcmp(dn->name, "pci") == 0) { >>+ if (is_php_dn(dn, &indexes, &names, &types, &power_domains)) >>+ slot_type = HOTPLUG; >>+ else if (is_dr_dn(dn, &indexes, &names, &types, &power_domains, &my_drc_index)) >>+ slot_type = EMBEDDED; >>+ else goto exit; >> >> name = (char *) &names[1]; >> type = (char *) &types[1]; >>- for (i = 0; i < indexes[0]; >>- i++, >>- name += (strlen(name) + 1), >>- type += (strlen(type) + 1)) { >>- if (!(slot = alloc_slot_struct(dn, indexes[i + 1], name, >>- power_domains[i + 1]))) { >>- retval = -ENOMEM; >>- goto exit; >>- } >>- slot->type = simple_strtoul(type, NULL, 10); >>- if (slot->type < 1 || slot->type > 16) >>- slot->type = 0; >>- retval = register_pci_slot(slot); >>+ for (i = 0; i < indexes[0]; i++, >>+ name += (strlen(name) + 1), type += (strlen(type) + 1)) { >> >>- } /* for indexes */ >>- } /* end of PCI device_node */ >>+ if ( slot_type == HOTPLUG || >>+ (slot_type == EMBEDDED && indexes[i + 1] == my_drc_index[0])) { >>+ >>+ if (!(slot = alloc_slot_struct(dn, indexes[i + 1], name, >>+ power_domains[i + 1]))) { >>+ retval = -ENOMEM; >>+ goto exit; >>+ } >>+ if (slot_type == EMBEDDED) >>+ slot->type = EMBEDDED; >>+ else >>+ slot->type = simple_strtoul(type, NULL, 10); >>+ >>+ dbg(" Found drc-index:0x%x drc-name:%s drc-type:%s\n", >>+ indexes[i + 1], name, type); >>+ >>+ retval = register_pci_slot(slot); >>+ if (slot_type == EMBEDDED) >>+ goto exit; >>+ } >>+ } >>+ } >> exit: >> dbg("%s - Exit: num_slots=%d rc[%d]\n", >> __FUNCTION__, num_slots, retval); >> return retval; >> } >> >>-static int __init init_rpa(void) >>+/* >>+ * init_slots - initialize 'struct slot' structures for each slot >>+ * >>+ */ >>+static void init_slots(void) >> { >> struct device_node *dn; >> >>+ for (dn = find_all_nodes(); dn; dn = dn->next) >>+ rpaphp_add_slot(dn); >>+} >>+ >>+static int __init init_rpa(void) >>+{ >>+ >> init_MUTEX(&rpaphp_sem); >> >> /* initialize internal data structure etc. */ >>- for (dn = find_all_nodes(); dn; dn = dn->next) >>- rpaphp_add_slot(dn); >>+ init_slots(); >> if (!num_slots) >> return -ENODEV; >> >>@@ -342,12 +395,18 @@ >> { >> info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); >> >>+ /* let EEH know they can use hotplug */ >>+ eeh_register_disable_func(&rpaphp_disable_slot); >>+ >> /* read all the PRA info from the system */ >> return init_rpa(); >> } >> >> static void __exit rpaphp_exit(void) >> { >>+ /* let EEH know we are going away */ >>+ eeh_register_disable_func(NULL); >>+ >> cleanup_slots(); >> } >> >>@@ -374,11 +433,16 @@ >> retval = -EINVAL; >> } >> up(&rpaphp_sem); >>- exit: >>+exit: >> dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval); >> return retval; >> } >> >>+static int rpaphp_disable_slot(struct pci_dev *dev) >>+{ >>+ return disable_slot(rpaphp_find_hotplug_slot(dev)); >>+} >>+ >> static int disable_slot(struct hotplug_slot *hotplug_slot) >> { >> int retval; >>@@ -395,9 +459,7 @@ >> down(&rpaphp_sem); >> switch (slot->dev_type) { >> case PCI_DEV: >>- rpaphp_set_attention_status(slot, LED_ID); >> retval = rpaphp_unconfig_pci_adapter(slot); >>- rpaphp_set_attention_status(slot, LED_OFF); >> break; >> case VIO_DEV: >> retval = rpaphp_unconfig_vio_adapter(slot); >>@@ -406,7 +468,7 @@ >> retval = -ENODEV; >> } >> up(&rpaphp_sem); >>- exit: >>+exit: >> dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval); >> return retval; >> } >>diff -Nru a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c >>--- a/drivers/pci/hotplug/rpaphp_pci.c Fri May 21 20:44:27 2004 >>+++ b/drivers/pci/hotplug/rpaphp_pci.c Fri May 21 20:44:27 2004 >>@@ -30,24 +30,25 @@ >> >> struct pci_dev *rpaphp_find_pci_dev(struct device_node *dn) >> { >>- struct pci_dev *retval_dev = NULL, *dev; >>+ struct pci_dev *retval_dev = NULL, *dev = NULL; >> char bus_id[BUS_ID_SIZE]; >>+ int *vendor_id, *device_id, vid = PCI_ANY_ID, did = PCI_ANY_ID; >> >> sprintf(bus_id, "%04x:%02x:%02x.%d",dn->phb->global_number, >> dn->busno, PCI_SLOT(dn->devfn), PCI_FUNC(dn->devfn)); >>- >>- dbg("Enter rpaphp_find_pci_dev() full_name=%s bus_id=%s\n", >>- dn->full_name, bus_id); >>- >>- while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { >>- if (!strcmp(pci_name(dev), bus_id)) { >>+ vendor_id = (int *) get_property(dn, "vendor-id", NULL); >>+ device_id = (int *) get_property(dn, "device-id", NULL); >>+ if (vendor_id) >>+ vid = *vendor_id; >>+ if (device_id) >>+ did = *device_id; >>+ while ((dev = pci_find_device(vid, did, dev)) != NULL) { >>+ if (!strcmp(pci_name(dev), bus_id)) { >> retval_dev = dev; >>- dbg("rpaphp_find_pci_dev(): found dev=%p\n\n", dev); >> break; >> } >> } >> return retval_dev; >>- >> } >> >> EXPORT_SYMBOL_GPL(rpaphp_find_pci_dev); >>@@ -79,11 +80,6 @@ >> return rpaphp_find_pci_dev(slot->dn); >> } >> >>-static struct pci_dev *rpaphp_find_adapter_pdev(struct slot *slot) >>-{ >>- return rpaphp_find_pci_dev(slot->dn->child); >>-} >>- >> static int rpaphp_get_sensor_state(struct slot *slot, int *state) >> { >> int rc; >>@@ -144,7 +140,7 @@ >> else if (rpaphp_find_pci_dev(slot->dn->child)) >> *value = CONFIGURED; >> else { >>- dbg("%s: can't find pdev of adapter in slot[%s]\n", __FUNCTION__, slot->name); >>+ err("%s: can't find pdev of adapter in slot[%s]\n", __FUNCTION__, slot->name); >> *value = NOT_CONFIGURED; >> } >> } >>@@ -158,7 +154,8 @@ >> } >> >> /* Must be called before pci_bus_add_devices */ >>-static void rpaphp_fixup_new_pci_devices(struct pci_bus *bus) >>+static void >>+rpaphp_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus) >> { >> struct pci_dev *dev; >> >>@@ -169,8 +166,9 @@ >> */ >> if (list_empty(&dev->global_list)) { >> int i; >>- >>- pcibios_fixup_device_resources(dev, bus); >>+ >>+ if(fix_bus) >>+ pcibios_fixup_device_resources(dev, bus); >> pci_read_irq_line(dev); >> for (i = 0; i < PCI_NUM_RESOURCES; i++) { >> struct resource *r = &dev->resource[i]; >>@@ -183,69 +181,173 @@ >> } >> } >> >>-static void >>-rpaphp_pci_config_device(struct pci_bus *pci_bus, struct device_node *dn) >>+static unsigned int rpaphp_pci_scan_child_bus(struct pci_bus *bus) >> { >>- int num; >>+ unsigned int devfn, pass, max = bus->secondary; >>+ struct pci_dev *dev; >> >>- num = pci_scan_slot(pci_bus, PCI_DEVFN(PCI_SLOT(dn->devfn), 0)); >>- if (num) { >>- rpaphp_fixup_new_pci_devices(pci_bus); >>- pci_bus_add_devices(pci_bus); >>- } >>+ dbg("%s: Scanning bus %02x\n", __FUNCTION__, bus->number); >>+ >>+ /* Go find them, Rover! */ >>+ for (devfn = 0; devfn < 0x100; devfn += 8) >>+ pci_scan_slot(bus, devfn); >>+ >>+ /* >>+ * After performing arch-dependent fixup of the bus, look behind >>+ * all PCI-to-PCI bridges on this bus. >>+ */ >>+ dbg("%s: Fixups for bus %02x\n", __FUNCTION__, bus->number); >>+ >>+ pcibios_fixup_bus(bus); >>+ >>+ for (pass=0; pass < 2; pass++) >>+ list_for_each_entry(dev, &bus->devices, bus_list) { >>+ if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) >>+ max = pci_scan_bridge(bus, dev, max, pass); >>+ } >>+ >>+ /* >>+ * We've scanned the bus and so we know all about what's on >>+ * the other side of any bridges that may be on this bus plus >>+ * any devices. >>+ * >>+ * Return how far we've got finding sub-buses. >>+ */ >>+ dbg("%s: Bus scan for %02x returning with max=%02x\n", >>+ __FUNCTION__, bus->number, max); >>+ return max; >> } >> >>-static int rpaphp_pci_config_bridge(struct pci_dev *dev, struct device_node *dn); >>+static int rpaphp_pci_config_bridge(struct pci_dev *dev); >> >> /***************************************************************************** >>- rpaphp_pci_config_dn() will recursively configure all devices under the >>- given slot->dn and return the dn's pci_dev. >>+ rpaphp_pci_config_slot() will configure all devices under the >>+ given slot->dn and return the the first pci_dev. >> *****************************************************************************/ >> static struct pci_dev * >>-rpaphp_pci_config_dn(struct device_node *dn, struct pci_bus *bus) >>+rpaphp_pci_config_slot(struct device_node *dn, struct pci_bus *bus) >> { >>- struct device_node *local; >>+ struct device_node *eads_first_child = dn->child; >> struct pci_dev *dev; >>+ int num; >>+ >>+ dbg("Enter %s: dn=%s bus=%s\n", __FUNCTION__, dn->full_name, bus->name); >> >>- for (local = dn->child; local; local = local->sibling) { >>- rpaphp_pci_config_device(bus, local); >>- dev = rpaphp_find_pci_dev(local); >>- if (!rpaphp_pci_config_bridge(dev, local)) >>+ if (eads_first_child) { >>+ /* pci_scan_slot should find all children of EADs */ >>+ num = pci_scan_slot(bus, PCI_DEVFN(PCI_SLOT(eads_first_child->devfn), 0)); >>+ if (num) { >>+ rpaphp_fixup_new_pci_devices(bus, 1); >>+ pci_bus_add_devices(bus); >>+ } >>+ dev = rpaphp_find_pci_dev(eads_first_child); >>+ if (!dev) { >>+ err("No new device found\n"); >> return NULL; >>+ } >>+ if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) >>+ rpaphp_pci_config_bridge(dev); >> } >>- >> return dev; >> } >> >>-static int rpaphp_pci_config_bridge(struct pci_dev *dev, struct device_node *dn) >>+static int rpaphp_pci_config_bridge(struct pci_dev *dev) >>+{ >>+ u8 sec_busno; >>+ struct pci_bus *child_bus; >>+ struct pci_dev *child_dev; >>+ >>+ dbg("Enter %s: BRIDGE dev=%s\n", __FUNCTION__, pci_name(dev)); >>+ >>+ /* get busno of downstream bus */ >>+ pci_read_config_byte(dev, PCI_SECONDARY_BUS, &sec_busno); >>+ >>+ /* add to children of PCI bridge dev->bus */ >>+ child_bus = pci_add_new_bus(dev->bus, dev, sec_busno); >>+ if (!child_bus) { >>+ err("%s: could not add second bus\n", __FUNCTION__); >>+ return -EIO; >>+ } >>+ sprintf(child_bus->name, "PCI Bus #%02x", child_bus->number); >>+ /* do pci_scan_child_bus */ >>+ rpaphp_pci_scan_child_bus(child_bus); >>+ >>+ >>+ list_for_each_entry(child_dev, &child_bus->devices, bus_list) { >>+ eeh_add_device_late(child_dev); >>+ } >>+ >>+ /* fixup new pci devices without touching bus struct */ >>+ rpaphp_fixup_new_pci_devices(child_bus, 0); >>+ >>+ /* Make the discovered devices available */ >>+ pci_bus_add_devices(child_bus); >>+ return 0; >>+} >>+ >>+static void enable_eeh(struct device_node *dn) >> { >>- if (dev && dn->child) { /* dn is a PCI bridge node */ >>- struct pci_bus *child; >>- u8 sec_busno; >>+ struct device_node *sib; >> >>- /* get busno of downstream bus */ >>- pci_read_config_byte(dev, PCI_SECONDARY_BUS, &sec_busno); >>+ for (sib = dn->child; sib; sib = sib->sibling) >>+ enable_eeh(sib); >>+ eeh_add_device_early(dn); >>+ return; >>+ >>+} >>+ >>+#ifdef DEBUG >>+static void print_slot_pci_funcs(struct slot *slot) >>+{ >>+ struct list_head *l; >> >>- /* add to children of PCI bridge dev->bus */ >>- child = pci_add_new_bus(dev->bus, dev, sec_busno); >>- if (!child) { >>- err("%s: could not add second bus\n", __FUNCTION__); >>- return 0; >>+ if (slot->dev_type == PCI_DEV) { >>+ printk("pci_funcs of slot[%s]\n", slot->name); >>+ if (list_empty(&slot->dev.pci_funcs)) >>+ printk(" pci_funcs is EMPTY\n"); >>+ >>+ list_for_each (l, &slot->dev.pci_funcs) { >>+ struct rpaphp_pci_func *func = >>+ list_entry(l, struct rpaphp_pci_func, sibling); >>+ printk(" FOUND dev=%s\n", pci_name(func->pci_dev)); >> } >>- sprintf(child->name, "PCI Bus #%02x", child->number); >>- /* Fixup subordinate bridge bases and resureces */ >>- pcibios_fixup_bus(child); >>+ } >>+} >>+#endif >>+ >>+static int init_slot_pci_funcs(struct slot *slot) >>+{ >>+ struct device_node *child; >>+ >>+ for (child = slot->dn->child; child != NULL; child = child->sibling) { >>+ struct pci_dev *pdev = rpaphp_find_pci_dev(child); >> >>- /* may need do more stuff here */ >>- rpaphp_pci_config_dn(dn, dev->subordinate); >>+ if (pdev) { >>+ struct rpaphp_pci_func *func; >>+ func = kmalloc(sizeof(struct rpaphp_pci_func), GFP_KERNEL); >>+ if (!func) >>+ return -ENOMEM; >>+ memset(func, 0, sizeof(struct rpaphp_pci_func)); >>+ INIT_LIST_HEAD(&func->sibling); >>+ func->pci_dev = pdev; >>+ list_add_tail(&func->sibling, &slot->dev.pci_funcs); >>+#ifdef DEBUG >>+ print_slot_pci_funcs(slot); >>+#endif >>+ } else { >>+ err("%s: dn=%s has no pci_dev\n", >>+ __FUNCTION__, child->full_name); >>+ return -EIO; >>+ } >> } >>- return 1; >>+ return 0; >> } >> >>-static struct pci_dev *rpaphp_config_pci_adapter(struct slot *slot) >>+static int rpaphp_config_pci_adapter(struct slot *slot) >> { >> struct pci_bus *pci_bus; >>- struct pci_dev *dev = NULL; >>+ struct pci_dev *dev; >>+ int rc = -ENODEV; >> >> dbg("Entry %s: slot[%s]\n", __FUNCTION__, slot->name); >> >>@@ -256,38 +358,76 @@ >> err("%s: can't find bus structure\n", __FUNCTION__); >> goto exit; >> } >>- >>- eeh_add_device_early(slot->dn->child); >>- dev = rpaphp_pci_config_dn(slot->dn, pci_bus); >>- eeh_add_device_late(dev); >>+ enable_eeh(slot->dn); >>+ dev = rpaphp_pci_config_slot(slot->dn, pci_bus); >>+ if (!dev) { >>+ err("%s: can't find any devices.\n", __FUNCTION__); >>+ goto exit; >>+ } >>+ /* associate corresponding pci_dev */ >>+ rc = init_slot_pci_funcs(slot); >>+ if (rc) >>+ goto exit; >>+#ifdef DEBUG >>+ print_slot_pci_funcs(slot); >>+#endif >>+ if (!list_empty(&slot->dev.pci_funcs)) >>+ rc = 0; >> } else { >> /* slot is not enabled */ >> err("slot doesn't have pci_dev structure\n"); >>- dev = NULL; >> } >>- >> exit: >>- dbg("Exit %s: pci_dev %s\n", __FUNCTION__, dev ? "found" : "not found"); >>- return dev; >>+ dbg("Exit %s: rc=%d\n", __FUNCTION__, rc); >>+ return rc; >>+} >>+ >>+ >>+static void rpaphp_eeh_remove_bus_device(struct pci_dev *dev) >>+{ >>+ eeh_remove_device(dev); >>+ if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { >>+ struct pci_bus *bus = dev->subordinate; >>+ struct list_head *ln; >>+ if (!bus) >>+ return; >>+ for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) { >>+ struct pci_dev *pdev = pci_dev_b(ln); >>+ if (pdev) >>+ rpaphp_eeh_remove_bus_device(pdev); >>+ } >>+ >>+ } >>+ return; >> } >> >> int rpaphp_unconfig_pci_adapter(struct slot *slot) >> { >> int retval = 0; >>+ struct list_head *ln; >> >> dbg("Entry %s: slot[%s]\n", __FUNCTION__, slot->name); >>- if (!slot->dev.pci_dev) { >>- info("%s: no card in slot[%s]\n", __FUNCTION__, slot->name); >>+ if (list_empty(&slot->dev.pci_funcs)) { >>+ err("%s: slot[%s] doesn't have any devices.\n", __FUNCTION__, >>+ slot->name); >> >> retval = -EINVAL; >> goto exit; >> } >>- /* remove the device from the pci core */ >>- eeh_remove_device(slot->dev.pci_dev); >>- pci_remove_bus_device(slot->dev.pci_dev); >>- >>+ /* remove the devices from the pci core */ >>+ list_for_each (ln, &slot->dev.pci_funcs) { >>+ struct rpaphp_pci_func *func; >>+ >>+ func = list_entry(ln, struct rpaphp_pci_func, sibling); >>+ if (func->pci_dev) { >>+ rpaphp_eeh_remove_bus_device(func->pci_dev); >>+ pci_remove_bus_device(func->pci_dev); >>+ } >>+ kfree(func); >>+ } >>+ INIT_LIST_HEAD(&slot->dev.pci_funcs); >> slot->state = NOT_CONFIGURED; >>- info("%s: adapter in slot[%s] unconfigured.\n", __FUNCTION__, >>+ info("%s: devices in slot[%s] unconfigured.\n", __FUNCTION__, >> slot->name); >> exit: >> dbg("Exit %s, rc=0x%x\n", __FUNCTION__, retval); >>@@ -314,31 +454,39 @@ >> { >> slot->bridge = rpaphp_find_bridge_pdev(slot); >> if (!slot->bridge) { /* slot being added doesn't have pci_dev yet */ >>- dbg("%s: no pci_dev for bridge dn %s\n", __FUNCTION__, slot->name); >>+ err("%s: no pci_dev for bridge dn %s\n", __FUNCTION__, slot->name); >> dealloc_slot_struct(slot); >> return 1; >> } >>- >>+ >> strcpy(slot->name, pci_name(slot->bridge)); >>+ >> /* find slot's pci_dev if it's not empty */ >> if (slot->hotplug_slot->info->adapter_status == EMPTY) { >> slot->state = EMPTY; /* slot is empty */ >>- slot->dev.pci_dev = NULL; >> } else { >> /* slot is occupied */ >> if (!(slot->dn->child)) { >> /* non-empty slot has to have child */ >>- err("%s: slot[%s]'s device_node doesn't have child for adapter\n", __FUNCTION__, slot->name); >>+ err("%s: slot[%s]'s device_node doesn't have child for adapter\n", >>+ __FUNCTION__, slot->name); >> dealloc_slot_struct(slot); >> return 1; >> } >>- slot->dev.pci_dev = rpaphp_find_adapter_pdev(slot); >>- if (slot->dev.pci_dev) { >>+ if (init_slot_pci_funcs(slot)) { >>+ err("%s: init_slot_pci_funcs failed\n", __FUNCTION__); >>+ dealloc_slot_struct(slot); >>+ return 1; >>+ } >>+#ifdef DEBUG >>+ print_slot_pci_funcs(slot); >>+#endif >>+ if (!list_empty(&slot->dev.pci_funcs)) { >> slot->state = CONFIGURED; >>- >>+ >> } else { >> /* DLPAR add as opposed to >>- * boot time */ >>+ * boot time */ >> slot->state = NOT_CONFIGURED; >> } >> } >>@@ -350,6 +498,14 @@ >> int rc = 1; >> >> slot->dev_type = PCI_DEV; >>+ if (slot->type == EMBEDDED) >>+ strcpy(slot->removable, "EMBEDDED"); >>+ else >>+ strcpy(slot->removable, "HOTPLUG"); >>+ INIT_LIST_HEAD(&slot->dev.pci_funcs); >>+#if 0 >>+ if (slot->type != EMEBEDDED && setup_pci_hotplug_slot_info(slot)) >>+#endif >> if (setup_pci_hotplug_slot_info(slot)) >> goto exit_rc; >> if (setup_pci_slot(slot)) >>@@ -371,12 +527,12 @@ >> dbg("%s: sensor state[%d]\n", __FUNCTION__, state); >> /* if slot is not empty, enable the adapter */ >> if (state == PRESENT) { >>- dbg("%s : slot[%s] is occupid.\n", __FUNCTION__, slot->name); >>- if ((slot->dev.pci_dev = >>- rpaphp_config_pci_adapter(slot)) != NULL) { >>+ dbg("%s : slot[%s] is occupied.\n", __FUNCTION__, slot->name); >>+ retval = rpaphp_config_pci_adapter(slot); >>+ if (!retval) { >> slot->state = CONFIGURED; >>- dbg("%s: PCI adapter %s in slot[%s] has been configured\n", >>- __FUNCTION__, pci_name(slot->dev.pci_dev), slot->name); >>+ dbg("%s: PCI devices in slot[%s] has been configured\n", >>+ __FUNCTION__, slot->name); >> } else { >> slot->state = NOT_CONFIGURED; >> dbg("%s: no pci_dev struct for adapter in slot[%s]\n", >>@@ -392,10 +548,31 @@ >> retval = -EINVAL; >> } >> exit: >>- if (slot->state != NOT_VALID) >>- rpaphp_set_attention_status(slot, LED_ON); >>- else >>- rpaphp_set_attention_status(slot, LED_ID); >> dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval); >> return retval; >> } >>+ >>+struct hotplug_slot *rpaphp_find_hotplug_slot(struct pci_dev *dev) >>+{ >>+ struct list_head *tmp, *n; >>+ struct slot *slot; >>+ >>+ list_for_each_safe(tmp, n, &rpaphp_slot_head) { >>+ struct pci_bus *bus; >>+ struct list_head *ln; >>+ >>+ slot = list_entry(tmp, struct slot, rpaphp_slot_list); >>+ bus = slot->bridge->subordinate; >>+ if (!bus) >>+ return NULL; /* shouldn't be here */ >>+ for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) { >>+ struct pci_dev *pdev = pci_dev_b(ln); >>+ if (pdev == dev) >>+ return slot->hotplug_slot; >>+ } >>+ } >>+ >>+ return NULL; >>+} >>+ >>+EXPORT_SYMBOL_GPL(rpaphp_find_hotplug_slot); >>diff -Nru a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c >>--- a/drivers/pci/hotplug/rpaphp_slot.c Fri May 21 20:44:27 2004 >>+++ b/drivers/pci/hotplug/rpaphp_slot.c Fri May 21 20:44:27 2004 >>@@ -29,6 +29,35 @@ >> #include >> #include "rpaphp.h" >> >>+static ssize_t removable_read_file (struct hotplug_slot *php_slot, char *buf) >>+{ >>+ char *value; >>+ int retval = -ENOENT; >>+ struct slot *slot = (struct slot *)php_slot->private; >>+ >>+ if (!slot) >>+ return retval; >>+ >>+ value = slot->removable; >>+ retval = sprintf (buf, "%s\n", value); >>+ return retval; >>+} >>+ >>+static struct hotplug_slot_attribute hotplug_slot_attr_removable = { >>+ .attr = {.name = "phy_removable", .mode = S_IFREG | S_IRUGO}, >>+ .show = removable_read_file, >>+}; >>+ >>+static void rpaphp_sysfs_add_attr_removable (struct hotplug_slot *slot) >>+{ >>+ sysfs_create_file(&slot->kobj, &hotplug_slot_attr_removable.attr); >>+} >>+ >>+void rpaphp_sysfs_remove_attr_removable (struct hotplug_slot *slot) >>+{ >>+ sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_removable.attr); >>+} >>+ >> static ssize_t location_read_file (struct hotplug_slot *php_slot, char *buf) >> { >> char *value; >>@@ -68,6 +97,16 @@ >> >> void dealloc_slot_struct(struct slot *slot) >> { >>+ struct list_head *ln, *n; >>+ >>+ if (slot->dev_type == PCI_DEV) { >>+ list_for_each_safe (ln, n, &slot->dev.pci_funcs) { >>+ struct rpaphp_pci_func *func; >>+ >>+ func = list_entry(ln, struct rpaphp_pci_func, sibling); >>+ kfree(func); >>+ } >>+ } >> kfree(slot->hotplug_slot->info); >> kfree(slot->hotplug_slot->name); >> kfree(slot->hotplug_slot); >>@@ -86,7 +125,7 @@ >> memset(slot, 0, sizeof (struct slot)); >> slot->hotplug_slot = kmalloc(sizeof (struct hotplug_slot), GFP_KERNEL); >> if (!slot->hotplug_slot) >>- goto error_slot; >>+ goto error_slot; >> memset(slot->hotplug_slot, 0, sizeof (struct hotplug_slot)); >> slot->hotplug_slot->info = kmalloc(sizeof (struct hotplug_slot_info), >> GFP_KERNEL); >>@@ -95,7 +134,7 @@ >> memset(slot->hotplug_slot->info, 0, sizeof (struct hotplug_slot_info)); >> slot->hotplug_slot->name = kmalloc(BUS_ID_SIZE + 1, GFP_KERNEL); >> if (!slot->hotplug_slot->name) >>- goto error_info; >>+ goto error_info; >> slot->location = kmalloc(strlen(drc_name) + 1, GFP_KERNEL); >> if (!slot->location) >> goto error_name; >>@@ -107,9 +146,8 @@ >> slot->hotplug_slot->private = slot; >> slot->hotplug_slot->ops = &rpaphp_hotplug_slot_ops; >> slot->hotplug_slot->release = &rpaphp_release_slot; >>- slot->hotplug_slot->info->cur_bus_speed = PCI_SPEED_UNKNOWN; >>- >>- return slot; >>+ >>+ return (slot); >> >> error_name: >> kfree(slot->hotplug_slot->name); >>@@ -123,15 +161,32 @@ >> return NULL; >> } >> >>+static int is_registered(struct slot *slot) >>+{ >>+ struct list_head *tmp, *n; >>+ struct slot *tmp_slot; >>+ >>+ list_for_each_safe(tmp, n, &rpaphp_slot_head) { >>+ tmp_slot = list_entry(tmp, struct slot, rpaphp_slot_list); >>+ if (!strcmp(tmp_slot->name, slot->name)) >>+ return 1; >>+ } >>+ return 0; >>+} >>+ >> int register_slot(struct slot *slot) >> { >> int retval; >>- char *vio_uni_addr = NULL; >> >>- dbg("%s registering slot:path[%s] index[%x], name[%s] pdomain[%x] type[%d]\n", >>- __FUNCTION__, slot->dn->full_name, slot->index, slot->name, >>+ dbg("%s registering slot:path[%s] index[%x], name[%s] pdomain[%x] type[%d]\n", >>+ __FUNCTION__, slot->dn->full_name, slot->index, slot->name, >> slot->power_domain, slot->type); >>- >>+ /* should not try to register the same slot twice */ >>+ if (is_registered(slot)) { /* should't be here */ >>+ err("register_slot: slot[%s] is already registered\n", slot->name); >>+ rpaphp_release_slot(slot->hotplug_slot); >>+ return (1); >>+ } >> retval = pci_hp_register(slot->hotplug_slot); >> if (retval) { >> err("pci_hp_register failed with error %d\n", retval); >>@@ -142,30 +197,40 @@ >> /* create "phy_locatoin" file */ >> rpaphp_sysfs_add_attr_location(slot->hotplug_slot); >> >>+ /* create "phy_removable" file */ >>+ rpaphp_sysfs_add_attr_removable(slot->hotplug_slot); >>+ >> /* add slot to our internal list */ >> dbg("%s adding slot[%s] to rpaphp_slot_list\n", >> __FUNCTION__, slot->name); >> >> list_add(&slot->rpaphp_slot_list, &rpaphp_slot_head); >> >>- if (vio_uni_addr) >>- info("Slot [%s](vio_uni_addr=%s) registered\n", >>- slot->name, vio_uni_addr); >>+ if (slot->dev_type == VIO_DEV) >>+ info("Slot [%s](VIO location=%s) registered\n", >>+ slot->name, slot->location); >> else >>- info("Slot [%s](bus_id=%s) registered\n", >>- slot->name, pci_name(slot->bridge)); >>+ info("Slot [%s](PCI location=%s) registered\n", >>+ slot->name, slot->location); >> num_slots++; >> return 0; >> } >> >> int rpaphp_get_power_status(struct slot *slot, u8 * value) >> { >>- int rc; >>- >>- rc = rtas_get_power_level(slot->power_domain, (int *) value); >>- if (rc) >>- err("failed to get power-level for slot(%s), rc=0x%x\n", >>- slot->name, rc); >>+ int rc = 0; >>+ >>+ if (slot->type == EMBEDDED) { >>+ printk("%s set to POWER_ON for EMBEDDED slot %s\n", >>+ __FUNCTION__, slot->location); >>+ *value = POWER_ON; >>+ } >>+ else { >>+ rc = rtas_get_power_level(slot->power_domain, (int *) value); >>+ if (rc) >>+ err("failed to get power-level for slot(%s), rc=0x%x\n", >>+ slot->name, rc); >>+ } >> >> return rc; >> } >>@@ -177,8 +242,8 @@ >> /* status: LED_OFF or LED_ON */ >> rc = rtas_set_indicator(DR_INDICATOR, slot->index, status); >> if (rc) >>- err("slot(%s) set attention-status(%d) failed! rc=0x%x\n", >>- slot->name, status, rc); >>+ err("slot(name=%s location=%s index=0x%x) set attention-status(%d) failed! rc=0x%x\n", >>+ slot->name, slot->location, slot->index, status, rc); >> >> return rc; >> } >> >> > > > > ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From olh at suse.de Thu May 27 08:56:58 2004 From: olh at suse.de (Olaf Hering) Date: Thu, 27 May 2004 00:56:58 +0200 Subject: kernel Makefile options for $(AS) Message-ID: <20040526225658.GA5409@suse.de> Is -64 still a valid option for as? Should it be -mppc64? --- linux.old/arch/ppc64/Makefile~ 2004-05-26 22:12:42.000000000 +0000 +++ linux/arch/ppc64/Makefile 2004-05-26 22:01:09.000000000 +0000 @@ -17,7 +17,7 @@ HAS_BIARCH := $(shell if $(CC) -m64 -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo y; else echo n; fi;) ifeq ($(HAS_BIARCH),y) -AS := $(AS) -64 +AS := $(AS) -mppc64 LD := $(LD) -m elf64ppc CC := $(CC) -m64 endif -- USB is for mice, FireWire is for men! sUse lINUX ag, n?RNBERG ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From amodra at bigpond.net.au Thu May 27 09:56:02 2004 From: amodra at bigpond.net.au (Alan Modra) Date: Thu, 27 May 2004 09:26:02 +0930 Subject: kernel Makefile options for $(AS) In-Reply-To: <20040526225658.GA5409@suse.de> References: <20040526225658.GA5409@suse.de> Message-ID: <20040526235602.GT2564@bubble.modra.org> On Thu, May 27, 2004 at 12:56:58AM +0200, Olaf Hering wrote: > Is -64 still a valid option for as? Should it be -mppc64? No, it should be -a64. -- Alan Modra IBM OzLabs - Linux Technology Centre ** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/ From sfr at canb.auug.org.au Mon May 31 18:29:13 2004 From: sfr at canb.auug.org.au (Stephen Rothwell) Date: Mon, 31 May 2004 18:29:13 +1000 Subject: [PATCH] PPC64 iSeries default config update Message-ID: <20040531182913.28cf81ef.sfr@canb.auug.org.au> Hi Linus, Andrew, This patch brings the iSeries default config up to date and changes some of the options to what I use. These are more sensible options (at least in my opinion :-)). Please apply. Signed-off-by: Stephen Rothwell -- Cheers, Stephen Rothwell sfr at canb.auug.org.au http://www.canb.auug.org.au/~sfr/ -------------- next part -------------- diff -ruN 2.6.7-rc2/arch/ppc64/configs/iSeries_defconfig 2.6.7-rc2.idef/arch/ppc64/configs/iSeries_defconfig --- 2.6.7-rc2/arch/ppc64/configs/iSeries_defconfig 2004-05-31 18:01:24.000000000 +1000 +++ 2.6.7-rc2.idef/arch/ppc64/configs/iSeries_defconfig 2004-05-31 18:03:05.000000000 +1000 @@ -23,19 +23,23 @@ # CONFIG_SWAP=y CONFIG_SYSVIPC=y +# CONFIG_POSIX_MQUEUE is not set # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=y +# CONFIG_AUDIT is not set CONFIG_LOG_BUF_SHIFT=17 CONFIG_HOTPLUG=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y -CONFIG_EMBEDDED=y +# CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y +# CONFIG_KALLSYMS_ALL is not set CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_IOSCHED_NOOP=y CONFIG_IOSCHED_AS=y CONFIG_IOSCHED_DEADLINE=y +CONFIG_IOSCHED_CFQ=y # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set # @@ -48,6 +52,7 @@ # CONFIG_MODVERSIONS is not set # CONFIG_KMOD is not set CONFIG_STOP_MACHINE=y +CONFIG_SYSVIPC_COMPAT=y # # Platform support @@ -60,6 +65,7 @@ # CONFIG_IOMMU_VMERGE is not set CONFIG_SMP=y CONFIG_NR_CPUS=32 +# CONFIG_SCHED_SMT is not set CONFIG_MSCHUNKS=y CONFIG_LPARCFG=y @@ -72,6 +78,7 @@ # CONFIG_BINFMT_MISC is not set CONFIG_PCI_LEGACY_PROC=y CONFIG_PCI_NAMES=y +# CONFIG_HOTPLUG_CPU is not set # # PCMCIA/CardBus support @@ -148,7 +155,6 @@ # Some SCSI devices (e.g. CD jukebox) support multiple LUNs # CONFIG_SCSI_MULTI_LUN=y -CONFIG_SCSI_REPORT_LUNS=y CONFIG_SCSI_CONSTANTS=y # CONFIG_SCSI_LOGGING is not set @@ -180,6 +186,7 @@ # CONFIG_SCSI_IPS is not set # CONFIG_SCSI_INIA100 is not set # CONFIG_SCSI_SYM53C8XX_2 is not set +# CONFIG_SCSI_IPR is not set # CONFIG_SCSI_QLOGIC_ISP is not set # CONFIG_SCSI_QLOGIC_FC is not set # CONFIG_SCSI_QLOGIC_1280 is not set @@ -221,6 +228,7 @@ # # I2O device support # +# CONFIG_I2O is not set # # Macintosh device drivers @@ -247,7 +255,6 @@ # CONFIG_NET_IPGRE is not set # CONFIG_IP_MROUTE is not set # CONFIG_ARPD is not set -CONFIG_INET_ECN=y CONFIG_SYN_COOKIES=y CONFIG_INET_AH=m CONFIG_INET_ESP=m @@ -258,8 +265,6 @@ # # CONFIG_IP_VS is not set # CONFIG_IPV6 is not set -# CONFIG_DECNET is not set -# CONFIG_BRIDGE is not set CONFIG_NETFILTER=y # CONFIG_NETFILTER_DEBUG is not set @@ -319,16 +324,18 @@ CONFIG_IP_NF_ARP_MANGLE=m CONFIG_IP_NF_COMPAT_IPCHAINS=m CONFIG_IP_NF_COMPAT_IPFWADM=m +# CONFIG_IP_NF_RAW is not set CONFIG_XFRM=y CONFIG_XFRM_USER=m # # SCTP Configuration (EXPERIMENTAL) # -CONFIG_IPV6_SCTP__=y # CONFIG_IP_SCTP is not set # CONFIG_ATM is not set +# CONFIG_BRIDGE is not set # CONFIG_VLAN_8021Q is not set +# CONFIG_DECNET is not set CONFIG_LLC=y # CONFIG_LLC2 is not set # CONFIG_IPX is not set @@ -350,16 +357,23 @@ # Network testing # # CONFIG_NET_PKTGEN is not set +CONFIG_NETPOLL=y +CONFIG_NETPOLL_RX=y +CONFIG_NETPOLL_TRAP=y +CONFIG_NET_POLL_CONTROLLER=y +# CONFIG_HAMRADIO is not set +# CONFIG_IRDA is not set +# CONFIG_BT is not set CONFIG_NETDEVICES=y +CONFIG_DUMMY=m +CONFIG_BONDING=m +# CONFIG_EQUALIZER is not set +CONFIG_TUN=m # # ARCnet devices # # CONFIG_ARCNET is not set -CONFIG_DUMMY=m -CONFIG_BONDING=m -# CONFIG_EQUALIZER is not set -CONFIG_TUN=m # # Ethernet (10 or 100Mbit) @@ -397,43 +411,9 @@ # CONFIG_VIA_RHINE is not set # -# Ethernet (1000 Mbit) +# Gigabit Ethernet (1000/10000 Mbit) # -CONFIG_ACENIC=y -CONFIG_ACENIC_OMIT_TIGON_I=y -# CONFIG_DL2K is not set -CONFIG_E1000=y -# CONFIG_E1000_NAPI is not set -# CONFIG_NS83820 is not set -# CONFIG_HAMACHI is not set -# CONFIG_YELLOWFIN is not set -# CONFIG_R8169 is not set -# CONFIG_SIS190 is not set -# CONFIG_SK98LIN is not set -# CONFIG_TIGON3 is not set - -# -# Ethernet (10000 Mbit) -# -CONFIG_IXGB=m -# CONFIG_IXGB_NAPI is not set -# CONFIG_VETH is not set -# CONFIG_FDDI is not set -# CONFIG_HIPPI is not set -CONFIG_PPP=m -# CONFIG_PPP_MULTILINK is not set -# CONFIG_PPP_FILTER is not set -CONFIG_PPP_ASYNC=m -CONFIG_PPP_SYNC_TTY=m -CONFIG_PPP_DEFLATE=m -CONFIG_PPP_BSDCOMP=m -CONFIG_PPPOE=m -# CONFIG_SLIP is not set - -# -# Wireless LAN (non-hamradio) -# -# CONFIG_NET_RADIO is not set +# CONFIG_NET_GIGE is not set # # Token Ring devices @@ -443,33 +423,31 @@ # CONFIG_IBMLS is not set # CONFIG_3C359 is not set # CONFIG_TMS380TR is not set -# CONFIG_NET_FC is not set -# CONFIG_SHAPER is not set -CONFIG_NETCONSOLE=y - -# -# Wan interfaces -# -# CONFIG_WAN is not set - -# -# Amateur Radio support -# -# CONFIG_HAMRADIO is not set # -# IrDA (infrared) support +# Wireless LAN (non-hamradio) # -# CONFIG_IRDA is not set +# CONFIG_NET_RADIO is not set # -# Bluetooth support +# Wan interfaces # -# CONFIG_BT is not set -CONFIG_NETPOLL=y -CONFIG_NETPOLL_RX=y -CONFIG_NETPOLL_TRAP=y -CONFIG_NET_POLL_CONTROLLER=y +# CONFIG_WAN is not set +CONFIG_ISERIES_VETH=y +# CONFIG_FDDI is not set +# CONFIG_HIPPI is not set +CONFIG_PPP=m +# CONFIG_PPP_MULTILINK is not set +# CONFIG_PPP_FILTER is not set +CONFIG_PPP_ASYNC=m +CONFIG_PPP_SYNC_TTY=m +CONFIG_PPP_DEFLATE=m +CONFIG_PPP_BSDCOMP=m +CONFIG_PPPOE=m +# CONFIG_SLIP is not set +# CONFIG_NET_FC is not set +# CONFIG_SHAPER is not set +CONFIG_NETCONSOLE=y # # ISDN subsystem @@ -489,7 +467,10 @@ # # Userland interfaces # -# CONFIG_INPUT_MOUSEDEV is not set +CONFIG_INPUT_MOUSEDEV=y +CONFIG_INPUT_MOUSEDEV_PSAUX=y +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 # CONFIG_INPUT_JOYDEV is not set # CONFIG_INPUT_TSDEV is not set # CONFIG_INPUT_EVDEV is not set @@ -518,7 +499,6 @@ # # Character devices # -# CONFIG_VT is not set # CONFIG_SERIAL_NONSTANDARD is not set # @@ -532,11 +512,6 @@ CONFIG_UNIX98_PTYS=y CONFIG_LEGACY_PTYS=y CONFIG_LEGACY_PTY_COUNT=256 - -# -# Mice -# -# CONFIG_BUSMOUSE is not set # CONFIG_QIC02_TAPE is not set # @@ -618,6 +593,7 @@ CONFIG_REISERFS_FS=y # CONFIG_REISERFS_CHECK is not set # CONFIG_REISERFS_PROC_INFO is not set +# CONFIG_REISERFS_FS_XATTR is not set CONFIG_JFS_FS=y CONFIG_JFS_POSIX_ACL=y # CONFIG_JFS_DEBUG is not set @@ -655,6 +631,7 @@ # CONFIG_PROC_FS=y CONFIG_PROC_KCORE=y +CONFIG_SYSFS=y # CONFIG_DEVFS_FS is not set CONFIG_DEVPTS_FS_XATTR=y # CONFIG_DEVPTS_FS_SECURITY is not set @@ -695,10 +672,11 @@ CONFIG_LOCKD_V4=y CONFIG_EXPORTFS=y CONFIG_SUNRPC=y -CONFIG_SUNRPC_GSS=m -CONFIG_RPCSEC_GSS_KRB5=m +CONFIG_SUNRPC_GSS=y +CONFIG_RPCSEC_GSS_KRB5=y # CONFIG_SMB_FS is not set CONFIG_CIFS=m +# CONFIG_CIFS_STATS is not set # CONFIG_NCP_FS is not set # CONFIG_CODA_FS is not set # CONFIG_AFS_FS is not set @@ -757,8 +735,8 @@ # CONFIG_VIOCONS=y CONFIG_VIODASD=y -CONFIG_VIOCD=y -# CONFIG_VIOTAPE is not set +CONFIG_VIOCD=m +CONFIG_VIOTAPE=m CONFIG_VIOPATH=y # @@ -778,6 +756,7 @@ # CONFIG_DEBUGGER is not set # CONFIG_PPCDBG is not set # CONFIG_DEBUG_INFO is not set +# CONFIG_IRQSTACKS is not set # # Security options @@ -791,11 +770,11 @@ CONFIG_CRYPTO_HMAC=y CONFIG_CRYPTO_NULL=m CONFIG_CRYPTO_MD4=m -CONFIG_CRYPTO_MD5=m +CONFIG_CRYPTO_MD5=y CONFIG_CRYPTO_SHA1=m CONFIG_CRYPTO_SHA256=m CONFIG_CRYPTO_SHA512=m -CONFIG_CRYPTO_DES=m +CONFIG_CRYPTO_DES=y CONFIG_CRYPTO_BLOWFISH=m CONFIG_CRYPTO_TWOFISH=m CONFIG_CRYPTO_SERPENT=m @@ -804,11 +783,14 @@ CONFIG_CRYPTO_CAST6=m CONFIG_CRYPTO_ARC4=m CONFIG_CRYPTO_DEFLATE=m +# CONFIG_CRYPTO_MICHAEL_MIC is not set +# CONFIG_CRYPTO_CRC32C is not set CONFIG_CRYPTO_TEST=m # # Library routines # CONFIG_CRC32=y +# CONFIG_LIBCRC32C is not set CONFIG_ZLIB_INFLATE=y CONFIG_ZLIB_DEFLATE=m From sfr at canb.auug.org.au Mon May 31 18:34:16 2004 From: sfr at canb.auug.org.au (Stephen Rothwell) Date: Mon, 31 May 2004 18:34:16 +1000 Subject: [PATCH] PPC64 iSeries virtual ethernet minor optimisation Message-ID: <20040531183416.75d91e7a.sfr@canb.auug.org.au> Hi Linus, Andrew, This has only been adjusted by me to apply after David Gibson's patch to add a watchdog timer. Please apply. Name: Minor Optimization for iseries_veth Driver Status: Untested Version: ppc64 Signed-off-by: Rusty Russell (a) The iseries_veth driver does skb_clone, it should only need to skb_get, which is cheaper. Should help performance a little. Signed-off-by: Stephen Rothwell -- Cheers, Stephen Rothwell sfr at canb.auug.org.au http://www.canb.auug.org.au/~sfr/ -------------- next part -------------- diff -ruN 2.6.7-rc2.wd/drivers/net/iseries_veth.c 2.6.7-rc2.wd.rusty/drivers/net/iseries_veth.c --- 2.6.7-rc2.wd/drivers/net/iseries_veth.c 2004-05-31 17:49:10.000000000 +1000 +++ 2.6.7-rc2.wd.rusty/drivers/net/iseries_veth.c 2004-05-31 18:10:30.000000000 +1000 @@ -983,19 +983,10 @@ int rc; for (i = 0; i < HVMAXARCHITECTEDLPS; i++) { - struct sk_buff *clone; - if ((lpmask & (1 << i)) == 0) continue; - clone = skb_clone(skb, GFP_ATOMIC); - if (! clone) { - veth_error("%s: skb_clone failed %p\n", - dev->name, skb); - continue; - } - - rc = veth_transmit_to_one(clone, i, dev); + rc = veth_transmit_to_one(skb_get(skb), i, dev); if (! rc) lpmask &= ~(1< Hi Linus, Andrew, This patch fixes the virtual ethernet driver so that it will not block the transmit queue indefinitely. This patch appplies on top of the previous patch from Rusty that removed skb_clone. There is one white space fix in hte middle of this - I hope that doesn't offend :-). Please apply. Signed-off-by: Stephen Rothwell -- Cheers, Stephen Rothwell sfr at canb.auug.org.au http://www.canb.auug.org.au/~sfr/ -------------- next part -------------- diff -ruN 2.6.7-rc2.wd.rusty/drivers/net/iseries_veth.c 2.6.7-rc2.wd.rusty.block/drivers/net/iseries_veth.c --- 2.6.7-rc2.wd.rusty/drivers/net/iseries_veth.c 2004-05-31 18:10:30.000000000 +1000 +++ 2.6.7-rc2.wd.rusty.block/drivers/net/iseries_veth.c 2004-05-31 18:15:25.000000000 +1000 @@ -461,6 +461,11 @@ if (cnx->msgs) for (i = 0; i < VETH_NUMBUFFERS; ++i) veth_recycle_msg(cnx, cnx->msgs + i); + spin_unlock_irq(&cnx->lock); + veth_flush_pending(cnx); + spin_lock_irq(&cnx->lock); + if (cnx->state & VETH_STATE_RESET) + goto restart; } if (cnx->state & VETH_STATE_SHUTDOWN) @@ -1020,27 +1025,28 @@ lpmask = port->lpar_map; } + spin_lock_irqsave(&port->pending_gate, flags); + lpmask = veth_transmit_to_many(skb, lpmask, dev); if (! lpmask) { dev_kfree_skb(skb); } else { - spin_lock_irqsave(&port->pending_gate, flags); if (port->pending_skb) { veth_error("%s: Tx while skb was pending!\n", dev->name); dev_kfree_skb(skb); - spin_unlock_irqrestore(&port->pending_gate, flags); + spin_unlock_irqrestore(&port->pending_gate, flags); return 1; } port->pending_skb = skb; port->pending_lpmask = lpmask; netif_stop_queue(dev); - - spin_unlock_irqrestore(&port->pending_gate, flags); } + spin_unlock_irqrestore(&port->pending_gate, flags); + return 0; } @@ -1094,7 +1100,7 @@ if (! port->pending_lpmask) { dev_kfree_skb_any(port->pending_skb); port->pending_skb = NULL; - netif_start_queue(dev); + netif_wake_queue(dev); } } spin_unlock_irqrestore(&port->pending_gate, flags);