diff --git a/[refs] b/[refs] index 3f9fd799fa3b..54bb7c0823d7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 547598d3a91f11b1f802bf0b122f777c3c22f26d +refs/heads/master: 8d3c202be23c5a915f7053ebd4e96f44700c6a62 diff --git a/trunk/Documentation/debugging-via-ohci1394.txt b/trunk/Documentation/debugging-via-ohci1394.txt index c360d4e91b48..de4804e8b396 100644 --- a/trunk/Documentation/debugging-via-ohci1394.txt +++ b/trunk/Documentation/debugging-via-ohci1394.txt @@ -36,15 +36,14 @@ available (notebooks) or too slow for extensive debug information (like ACPI). Drivers ------- -The ohci1394 driver in drivers/ieee1394 initializes the OHCI-1394 controllers -to a working state and enables physical DMA by default for all remote nodes. -This can be turned off by ohci1394's module parameter phys_dma=0. - -The alternative firewire-ohci driver in drivers/firewire uses filtered physical -DMA, hence is not yet suitable for remote debugging. - -Because ohci1394 depends on the PCI enumeration to be completed, an -initialization routine which runs pretty early (long before console_init() +The OHCI-1394 drivers in drivers/firewire and drivers/ieee1394 initialize +the OHCI-1394 controllers to a working state and can be used to enable +physical DMA. By default you only have to load the driver, and physical +DMA access will be granted to all remote nodes, but it can be turned off +when using the ohci1394 driver. + +Because these drivers depend on the PCI enumeration to be completed, an +initialization routine which can runs pretty early (long before console_init(), which makes the printk buffer appear on the console can be called) was written. To activate it, enable CONFIG_PROVIDE_OHCI1394_DMA_INIT (Kernel hacking menu: diff --git a/trunk/Documentation/feature-removal-schedule.txt b/trunk/Documentation/feature-removal-schedule.txt index ba899ff2a8f9..4d3aa519eadf 100644 --- a/trunk/Documentation/feature-removal-schedule.txt +++ b/trunk/Documentation/feature-removal-schedule.txt @@ -172,16 +172,6 @@ Who: Len Brown --------------------------- -What: ide-tape driver -When: July 2008 -Files: drivers/ide/ide-tape.c -Why: This driver might not have any users anymore and maintaining it for no - reason is an effort no one wants to make. -Who: Bartlomiej Zolnierkiewicz , Borislav Petkov - - ---------------------------- - What: libata spindown skipping and warning When: Dec 2008 Why: Some halt(8) implementations synchronize caches for and spin diff --git a/trunk/Documentation/i2c/busses/i2c-i801 b/trunk/Documentation/i2c/busses/i2c-i801 index c31e0291e167..3bd958360159 100644 --- a/trunk/Documentation/i2c/busses/i2c-i801 +++ b/trunk/Documentation/i2c/busses/i2c-i801 @@ -12,9 +12,8 @@ Supported adapters: * Intel 82801G (ICH7) * Intel 631xESB/632xESB (ESB2) * Intel 82801H (ICH8) - * Intel 82801I (ICH9) + * Intel ICH9 * Intel Tolapai - * Intel ICH10 Datasheets: Publicly available at the Intel website Authors: diff --git a/trunk/Documentation/ide.txt b/trunk/Documentation/ide.txt index bcd7cd1278ef..94e2e3b9e77f 100644 --- a/trunk/Documentation/ide.txt +++ b/trunk/Documentation/ide.txt @@ -258,6 +258,8 @@ Summary of ide driver parameters for kernel command line As for VLB, it is safest to not specify it. Bigger values are safer than smaller ones. + "idex=noprobe" : do not attempt to access/use this interface + "idex=base" : probe for an interface at the addr specified, where "base" is usually 0x1f0 or 0x170 and "ctl" is assumed to be "base"+0x206 @@ -305,6 +307,53 @@ Also for legacy CMD640 host driver (cmd640) you need to use "probe_vlb" kernel paremeter to enable probing for VLB version of the chipset (PCI ones are detected automatically). +================================================================================ + +IDE ATAPI streaming tape driver +------------------------------- + +This driver is a part of the Linux ide driver and works in co-operation +with linux/drivers/block/ide.c. + +The driver, in co-operation with ide.c, basically traverses the +request-list for the block device interface. The character device +interface, on the other hand, creates new requests, adds them +to the request-list of the block device, and waits for their completion. + +Pipelined operation mode is now supported on both reads and writes. + +The block device major and minor numbers are determined from the +tape's relative position in the ide interfaces, as explained in ide.c. + +The character device interface consists of the following devices: + + ht0 major 37, minor 0 first IDE tape, rewind on close. + ht1 major 37, minor 1 second IDE tape, rewind on close. + ... + nht0 major 37, minor 128 first IDE tape, no rewind on close. + nht1 major 37, minor 129 second IDE tape, no rewind on close. + ... + +Run /dev/MAKEDEV to create the above entries. + +The general magnetic tape commands compatible interface, as defined by +include/linux/mtio.h, is accessible through the character device. + +General ide driver configuration options, such as the interrupt-unmask +flag, can be configured by issuing an ioctl to the block device interface, +as any other ide device. + +Our own ide-tape ioctl's can be issued to either the block device or +the character device interface. + +Maximal throughput with minimal bus load will usually be achieved in the +following scenario: + + 1. ide-tape is operating in the pipelined operation mode. + 2. No buffering is performed by the user backup program. + + + ================================================================================ Some Terminology diff --git a/trunk/MAINTAINERS b/trunk/MAINTAINERS index 4fc5f0aee6a6..36c7bc641dba 100644 --- a/trunk/MAINTAINERS +++ b/trunk/MAINTAINERS @@ -2744,8 +2744,6 @@ S: Maintained NETEFFECT IWARP RNIC DRIVER (IW_NES) P: Faisal Latif M: flatif@neteffect.com -P: Nishi Gupta -M: ngupta@neteffect.com P: Glenn Streiff M: gstreiff@neteffect.com L: general@lists.openfabrics.org diff --git a/trunk/Makefile b/trunk/Makefile index a22978413b65..99300dc680e9 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 25 -EXTRAVERSION = -rc3 +EXTRAVERSION = -rc2 NAME = Funky Weasel is Jiggy wit it # *DOCUMENTATION* diff --git a/trunk/arch/arm/mach-omap1/board-sx1.c b/trunk/arch/arm/mach-omap1/board-sx1.c index e473fa6d4a5f..1c7f09aedf07 100644 --- a/trunk/arch/arm/mach-omap1/board-sx1.c +++ b/trunk/arch/arm/mach-omap1/board-sx1.c @@ -61,7 +61,6 @@ int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value) data[0] = regoffset; /* register num */ data[1] = value; /* register data */ err = i2c_transfer(adap, msg, 1); - i2c_put_adapter(adap); if (err >= 0) return 0; return err; @@ -92,7 +91,6 @@ int sx1_i2c_read_byte(u8 devaddr, u8 regoffset, u8 *value) msg->buf = data; err = i2c_transfer(adap, msg, 1); *value = data[0]; - i2c_put_adapter(adap); if (err >= 0) return 0; diff --git a/trunk/arch/sparc/kernel/led.c b/trunk/arch/sparc/kernel/led.c index 59e9344e7a0d..313d1620ae8e 100644 --- a/trunk/arch/sparc/kernel/led.c +++ b/trunk/arch/sparc/kernel/led.c @@ -3,9 +3,6 @@ #include #include #include -#include -#include -#include #include diff --git a/trunk/arch/sparc64/kernel/ds.c b/trunk/arch/sparc64/kernel/ds.c index bd76482077be..eeb5a2fc788d 100644 --- a/trunk/arch/sparc64/kernel/ds.c +++ b/trunk/arch/sparc64/kernel/ds.c @@ -525,10 +525,10 @@ static void dr_cpu_mark(struct ds_data *resp, int cpu, int ncpus, } } -static int __cpuinit dr_cpu_configure(struct ds_info *dp, - struct ds_cap_state *cp, - u64 req_num, - cpumask_t *mask) +static int dr_cpu_configure(struct ds_info *dp, + struct ds_cap_state *cp, + u64 req_num, + cpumask_t *mask) { struct ds_data *resp; int resp_len, ncpus, cpu; @@ -623,9 +623,9 @@ static int dr_cpu_unconfigure(struct ds_info *dp, return 0; } -static void __cpuinit dr_cpu_data(struct ds_info *dp, - struct ds_cap_state *cp, - void *buf, int len) +static void dr_cpu_data(struct ds_info *dp, + struct ds_cap_state *cp, + void *buf, int len) { struct ds_data *data = buf; struct dr_cpu_tag *tag = (struct dr_cpu_tag *) (data + 1); diff --git a/trunk/arch/sparc64/kernel/hvtramp.S b/trunk/arch/sparc64/kernel/hvtramp.S index 0236c43772fa..b692e044a463 100644 --- a/trunk/arch/sparc64/kernel/hvtramp.S +++ b/trunk/arch/sparc64/kernel/hvtramp.S @@ -3,8 +3,6 @@ * Copyright (C) 2007 David S. Miller */ -#include - #include #include #include @@ -15,7 +13,7 @@ #include #include - __CPUINIT + .text .align 8 .globl hv_cpu_startup, hv_cpu_startup_end diff --git a/trunk/arch/sparc64/kernel/iommu.c b/trunk/arch/sparc64/kernel/iommu.c index fbaab3497bfd..0e347ff812a3 100644 --- a/trunk/arch/sparc64/kernel/iommu.c +++ b/trunk/arch/sparc64/kernel/iommu.c @@ -134,8 +134,7 @@ unsigned long iommu_range_alloc(struct device *dev, else boundary_size = ALIGN(1UL << 32, 1 << IO_PAGE_SHIFT); - n = iommu_area_alloc(arena->map, limit, start, npages, - iommu->page_table_map_base >> IO_PAGE_SHIFT, + n = iommu_area_alloc(arena->map, limit, start, npages, 0, boundary_size >> IO_PAGE_SHIFT, 0); if (n == -1) { if (likely(pass < 1)) { diff --git a/trunk/arch/sparc64/kernel/kprobes.c b/trunk/arch/sparc64/kernel/kprobes.c index f43b5d755354..34fc3ddd5002 100644 --- a/trunk/arch/sparc64/kernel/kprobes.c +++ b/trunk/arch/sparc64/kernel/kprobes.c @@ -465,6 +465,8 @@ void __kprobes jprobe_return(void) extern void jprobe_return_trap_instruction(void); +extern void __show_regs(struct pt_regs * regs); + int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) { u32 *addr = (u32 *) regs->tpc; diff --git a/trunk/arch/sparc64/kernel/mdesc.c b/trunk/arch/sparc64/kernel/mdesc.c index 910083589569..856659bb1311 100644 --- a/trunk/arch/sparc64/kernel/mdesc.c +++ b/trunk/arch/sparc64/kernel/mdesc.c @@ -758,7 +758,7 @@ static void __devinit get_mondo_data(struct mdesc_handle *hp, u64 mp, get_one_mondo_bits(val, &tb->nonresum_qmask, 2); } -void __cpuinit mdesc_fill_in_cpu_data(cpumask_t mask) +void __devinit mdesc_fill_in_cpu_data(cpumask_t mask) { struct mdesc_handle *hp = mdesc_grab(); u64 mp; diff --git a/trunk/arch/sparc64/kernel/power.c b/trunk/arch/sparc64/kernel/power.c index eae8ca2a6ba5..850cdffdd69c 100644 --- a/trunk/arch/sparc64/kernel/power.c +++ b/trunk/arch/sparc64/kernel/power.c @@ -20,7 +20,6 @@ #include #include #include -#include #include @@ -40,6 +39,8 @@ static irqreturn_t power_handler(int irq, void *dev_id) return IRQ_HANDLED; } +extern void machine_halt(void); +extern void machine_alt_power_off(void); static void (*poweroff_method)(void) = machine_alt_power_off; void machine_power_off(void) diff --git a/trunk/arch/sparc64/kernel/process.c b/trunk/arch/sparc64/kernel/process.c index 2aafce7dfc0e..6eceac51ae62 100644 --- a/trunk/arch/sparc64/kernel/process.c +++ b/trunk/arch/sparc64/kernel/process.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include @@ -48,8 +47,6 @@ #include #include #include -#include -#include /* #define VERBOSE_SHOWREGS */ @@ -214,6 +211,62 @@ static void show_regwindow(struct pt_regs *regs) print_symbol("I7: <%s>\n", rwk->ins[7]); } +void show_stackframe(struct sparc_stackf *sf) +{ + unsigned long size; + unsigned long *stk; + int i; + + printk("l0: %016lx l1: %016lx l2: %016lx l3: %016lx\n" + "l4: %016lx l5: %016lx l6: %016lx l7: %016lx\n", + sf->locals[0], sf->locals[1], sf->locals[2], sf->locals[3], + sf->locals[4], sf->locals[5], sf->locals[6], sf->locals[7]); + printk("i0: %016lx i1: %016lx i2: %016lx i3: %016lx\n" + "i4: %016lx i5: %016lx fp: %016lx ret_pc: %016lx\n", + sf->ins[0], sf->ins[1], sf->ins[2], sf->ins[3], + sf->ins[4], sf->ins[5], (unsigned long)sf->fp, sf->callers_pc); + printk("sp: %016lx x0: %016lx x1: %016lx x2: %016lx\n" + "x3: %016lx x4: %016lx x5: %016lx xx: %016lx\n", + (unsigned long)sf->structptr, sf->xargs[0], sf->xargs[1], + sf->xargs[2], sf->xargs[3], sf->xargs[4], sf->xargs[5], + sf->xxargs[0]); + size = ((unsigned long)sf->fp) - ((unsigned long)sf); + size -= STACKFRAME_SZ; + stk = (unsigned long *)((unsigned long)sf + STACKFRAME_SZ); + i = 0; + do { + printk("s%d: %016lx\n", i++, *stk++); + } while ((size -= sizeof(unsigned long))); +} + +void show_stackframe32(struct sparc_stackf32 *sf) +{ + unsigned long size; + unsigned *stk; + int i; + + printk("l0: %08x l1: %08x l2: %08x l3: %08x\n", + sf->locals[0], sf->locals[1], sf->locals[2], sf->locals[3]); + printk("l4: %08x l5: %08x l6: %08x l7: %08x\n", + sf->locals[4], sf->locals[5], sf->locals[6], sf->locals[7]); + printk("i0: %08x i1: %08x i2: %08x i3: %08x\n", + sf->ins[0], sf->ins[1], sf->ins[2], sf->ins[3]); + printk("i4: %08x i5: %08x fp: %08x ret_pc: %08x\n", + sf->ins[4], sf->ins[5], sf->fp, sf->callers_pc); + printk("sp: %08x x0: %08x x1: %08x x2: %08x\n" + "x3: %08x x4: %08x x5: %08x xx: %08x\n", + sf->structptr, sf->xargs[0], sf->xargs[1], + sf->xargs[2], sf->xargs[3], sf->xargs[4], sf->xargs[5], + sf->xxargs[0]); + size = ((unsigned long)sf->fp) - ((unsigned long)sf); + size -= STACKFRAME32_SZ; + stk = (unsigned *)((unsigned long)sf + STACKFRAME32_SZ); + i = 0; + do { + printk("s%d: %08x\n", i++, *stk++); + } while ((size -= sizeof(unsigned))); +} + #ifdef CONFIG_SMP static DEFINE_SPINLOCK(regdump_lock); #endif @@ -301,6 +354,24 @@ void show_regs(struct pt_regs *regs) #endif } +void show_regs32(struct pt_regs32 *regs) +{ + printk("PSR: %08x PC: %08x NPC: %08x Y: %08x %s\n", regs->psr, + regs->pc, regs->npc, regs->y, print_tainted()); + printk("g0: %08x g1: %08x g2: %08x g3: %08x ", + regs->u_regs[0], regs->u_regs[1], regs->u_regs[2], + regs->u_regs[3]); + printk("g4: %08x g5: %08x g6: %08x g7: %08x\n", + regs->u_regs[4], regs->u_regs[5], regs->u_regs[6], + regs->u_regs[7]); + printk("o0: %08x o1: %08x o2: %08x o3: %08x ", + regs->u_regs[8], regs->u_regs[9], regs->u_regs[10], + regs->u_regs[11]); + printk("o4: %08x o5: %08x sp: %08x ret_pc: %08x\n", + regs->u_regs[12], regs->u_regs[13], regs->u_regs[14], + regs->u_regs[15]); +} + unsigned long thread_saved_pc(struct task_struct *tsk) { struct thread_info *ti = task_thread_info(tsk); diff --git a/trunk/arch/sparc64/kernel/smp.c b/trunk/arch/sparc64/kernel/smp.c index cc454731d879..a8052b76df41 100644 --- a/trunk/arch/sparc64/kernel/smp.c +++ b/trunk/arch/sparc64/kernel/smp.c @@ -86,7 +86,7 @@ extern void setup_sparc64_timer(void); static volatile unsigned long callin_flag = 0; -void __cpuinit smp_callin(void) +void __devinit smp_callin(void) { int cpuid = hard_smp_processor_id(); diff --git a/trunk/arch/sparc64/kernel/trampoline.S b/trunk/arch/sparc64/kernel/trampoline.S index 4ae2e525d68b..04e81dda13d0 100644 --- a/trunk/arch/sparc64/kernel/trampoline.S +++ b/trunk/arch/sparc64/kernel/trampoline.S @@ -4,8 +4,6 @@ * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) */ -#include - #include #include #include @@ -38,7 +36,7 @@ dtlb_load: tramp_stack: .skip TRAMP_STACK_SIZE - __CPUINIT + .text .align 8 .globl sparc64_cpu_startup, sparc64_cpu_startup_end sparc64_cpu_startup: diff --git a/trunk/arch/sparc64/kernel/traps.c b/trunk/arch/sparc64/kernel/traps.c index 007f5317c0de..2b6abf633343 100644 --- a/trunk/arch/sparc64/kernel/traps.c +++ b/trunk/arch/sparc64/kernel/traps.c @@ -1791,6 +1791,8 @@ static const char *sun4v_err_type_to_str(u32 type) }; } +extern void __show_regs(struct pt_regs * regs); + static void sun4v_log_error(struct pt_regs *regs, struct sun4v_error_entry *ent, int cpu, const char *pfx, atomic_t *ocnt) { int cnt; diff --git a/trunk/arch/sparc64/mm/fault.c b/trunk/arch/sparc64/mm/fault.c index 2650d0d33ac2..e2027f27c0fe 100644 --- a/trunk/arch/sparc64/mm/fault.c +++ b/trunk/arch/sparc64/mm/fault.c @@ -244,8 +244,16 @@ static void do_kernel_fault(struct pt_regs *regs, int si_code, int fault_code, if (regs->tstate & TSTATE_PRIV) { const struct exception_table_entry *entry; - entry = search_exception_tables(regs->tpc); - if (entry) { + if (asi == ASI_P && (insn & 0xc0800000) == 0xc0800000) { + if (insn & 0x2000) + asi = (regs->tstate >> 24); + else + asi = (insn >> 5); + } + + /* Look in asi.h: All _S asis have LS bit set */ + if ((asi & 0x1) && + (entry = search_exception_tables(regs->tpc))) { regs->tpc = entry->fixup; regs->tnpc = regs->tpc + 4; return; @@ -286,7 +294,7 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs) unsigned long tpc = regs->tpc; /* Sanity check the PC. */ - if ((tpc >= KERNBASE && tpc < (unsigned long) __init_end) || + if ((tpc >= KERNBASE && tpc < (unsigned long) _etext) || (tpc >= MODULES_VADDR && tpc < MODULES_END)) { /* Valid, no problems... */ } else { diff --git a/trunk/arch/sparc64/mm/init.c b/trunk/arch/sparc64/mm/init.c index b5c30416fdac..9e6bca266d88 100644 --- a/trunk/arch/sparc64/mm/init.c +++ b/trunk/arch/sparc64/mm/init.c @@ -1010,8 +1010,7 @@ static struct linux_prom64_registers pall[MAX_BANKS] __initdata; static int pall_ents __initdata; #ifdef CONFIG_DEBUG_PAGEALLOC -static unsigned long __ref kernel_map_range(unsigned long pstart, - unsigned long pend, pgprot_t prot) +static unsigned long kernel_map_range(unsigned long pstart, unsigned long pend, pgprot_t prot) { unsigned long vstart = PAGE_OFFSET + pstart; unsigned long vend = PAGE_OFFSET + pend; diff --git a/trunk/arch/um/kernel/process.c b/trunk/arch/um/kernel/process.c index e8cb9ff183e9..fc50d2f959d1 100644 --- a/trunk/arch/um/kernel/process.c +++ b/trunk/arch/um/kernel/process.c @@ -128,6 +128,8 @@ void *get_current(void) return current; } +extern void schedule_tail(struct task_struct *prev); + /* * This is called magically, by its address being stuffed in a jmp_buf * and being longjmp-d to. diff --git a/trunk/arch/x86/Kconfig.cpu b/trunk/arch/x86/Kconfig.cpu index 6d50064db182..e09a6b73a1aa 100644 --- a/trunk/arch/x86/Kconfig.cpu +++ b/trunk/arch/x86/Kconfig.cpu @@ -377,19 +377,6 @@ config X86_OOSTORE def_bool y depends on (MWINCHIP3D || MWINCHIP2 || MWINCHIPC6) && MTRR -# -# P6_NOPs are a relatively minor optimization that require a family >= -# 6 processor, except that it is broken on certain VIA chips. -# Furthermore, AMD chips prefer a totally different sequence of NOPs -# (which work on all CPUs). As a result, disallow these if we're -# compiling X86_GENERIC but not X86_64 (these NOPs do work on all -# x86-64 capable chips); the list of processors in the right-hand clause -# are the cores that benefit from this optimization. -# -config X86_P6_NOP - def_bool y - depends on (X86_64 || !X86_GENERIC) && (M686 || MPENTIUMII || MPENTIUMIII || MPENTIUMM || MCORE2 || PENTIUM4) - config X86_TSC def_bool y depends on ((MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MVIAC7 || MGEODEGX1 || MGEODE_LX || MCORE2) && !X86_NUMAQ) || X86_64 @@ -403,7 +390,6 @@ config X86_CMOV config X86_MINIMUM_CPU_FAMILY int default "64" if X86_64 - default "6" if X86_32 && X86_P6_NOP default "4" if X86_32 && (X86_XADD || X86_CMPXCHG || X86_BSWAP || X86_WP_WORKS_OK) default "3" diff --git a/trunk/arch/x86/boot/memory.c b/trunk/arch/x86/boot/memory.c index e77d89f9e8aa..378353956b5d 100644 --- a/trunk/arch/x86/boot/memory.c +++ b/trunk/arch/x86/boot/memory.c @@ -37,12 +37,6 @@ static int detect_memory_e820(void) "=m" (*desc) : "D" (desc), "d" (SMAP), "a" (0xe820)); - /* BIOSes which terminate the chain with CF = 1 as opposed - to %ebx = 0 don't always report the SMAP signature on - the final, failing, probe. */ - if (err) - break; - /* Some BIOSes stop returning SMAP in the middle of the search loop. We don't know exactly how the BIOS screwed up the map at that point, we might have a @@ -53,6 +47,9 @@ static int detect_memory_e820(void) break; } + if (err) + break; + count++; desc++; } while (next && count < E820MAX); diff --git a/trunk/arch/x86/kernel/asm-offsets_32.c b/trunk/arch/x86/kernel/asm-offsets_32.c index 8ea040124f7d..a33d53017997 100644 --- a/trunk/arch/x86/kernel/asm-offsets_32.c +++ b/trunk/arch/x86/kernel/asm-offsets_32.c @@ -128,11 +128,13 @@ void foo(void) OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending); #endif -#if defined(CONFIG_LGUEST) || defined(CONFIG_LGUEST_GUEST) || defined(CONFIG_LGUEST_MODULE) +#ifdef CONFIG_LGUEST_GUEST BLANK(); OFFSET(LGUEST_DATA_irq_enabled, lguest_data, irq_enabled); OFFSET(LGUEST_DATA_pgdir, lguest_data, pgdir); +#endif +#ifdef CONFIG_LGUEST BLANK(); OFFSET(LGUEST_PAGES_host_gdt_desc, lguest_pages, state.host_gdt_desc); OFFSET(LGUEST_PAGES_host_idt_desc, lguest_pages, state.host_idt_desc); diff --git a/trunk/arch/x86/kernel/cpu/common.c b/trunk/arch/x86/kernel/cpu/common.c index a38aafaefc23..f86a3c4a2669 100644 --- a/trunk/arch/x86/kernel/cpu/common.c +++ b/trunk/arch/x86/kernel/cpu/common.c @@ -504,7 +504,7 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c) /* Clear all flags overriden by options */ for (i = 0; i < NCAPINTS; i++) - c->x86_capability[i] &= ~cleared_cpu_caps[i]; + c->x86_capability[i] ^= cleared_cpu_caps[i]; /* Init Machine Check Exception if available. */ mcheck_init(c); diff --git a/trunk/arch/x86/kernel/cpu/mtrr/main.c b/trunk/arch/x86/kernel/cpu/mtrr/main.c index be83336fddba..b6e136f23d3d 100644 --- a/trunk/arch/x86/kernel/cpu/mtrr/main.c +++ b/trunk/arch/x86/kernel/cpu/mtrr/main.c @@ -43,7 +43,6 @@ #include #include #include -#include #include "mtrr.h" u32 num_var_ranges = 0; @@ -650,7 +649,6 @@ static __init int amd_special_default_mtrr(void) /** * mtrr_trim_uncached_memory - trim RAM not covered by MTRRs - * @end_pfn: ending page frame number * * Some buggy BIOSes don't setup the MTRRs properly for systems with certain * memory configurations. This routine checks that the highest MTRR matches @@ -690,11 +688,8 @@ int __init mtrr_trim_uncached_memory(unsigned long end_pfn) /* kvm/qemu doesn't have mtrr set right, don't trim them all */ if (!highest_pfn) { - if (!kvm_para_available()) { - printk(KERN_WARNING - "WARNING: strange, CPU MTRRs all blank?\n"); - WARN_ON(1); - } + printk(KERN_WARNING "WARNING: strange, CPU MTRRs all blank?\n"); + WARN_ON(1); return 0; } diff --git a/trunk/arch/x86/kernel/cpu/transmeta.c b/trunk/arch/x86/kernel/cpu/transmeta.c index e8b422c1c512..200fb3f9ebfb 100644 --- a/trunk/arch/x86/kernel/cpu/transmeta.c +++ b/trunk/arch/x86/kernel/cpu/transmeta.c @@ -76,6 +76,13 @@ static void __cpuinit init_transmeta(struct cpuinfo_x86 *c) /* All Transmeta CPUs have a constant TSC */ set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability); + /* If we can run i686 user-space code, call us an i686 */ +#define USER686 ((1 << X86_FEATURE_TSC)|\ + (1 << X86_FEATURE_CX8)|\ + (1 << X86_FEATURE_CMOV)) + if (c->x86 == 5 && (c->x86_capability[0] & USER686) == USER686) + c->x86 = 6; + #ifdef CONFIG_SYSCTL /* randomize_va_space slows us down enormously; it probably triggers retranslation of x86->native bytecode */ diff --git a/trunk/arch/x86/kernel/entry_64.S b/trunk/arch/x86/kernel/entry_64.S index c20c9e7e08dd..2ad9a1bc6a73 100644 --- a/trunk/arch/x86/kernel/entry_64.S +++ b/trunk/arch/x86/kernel/entry_64.S @@ -453,7 +453,6 @@ ENTRY(stub_execve) CFI_REGISTER rip, r11 SAVE_REST FIXUP_TOP_OF_STACK %r11 - movq %rsp, %rcx call sys_execve RESTORE_TOP_OF_STACK %r11 movq %rax,RAX(%rsp) @@ -1037,16 +1036,15 @@ ENDPROC(child_rip) * rdi: name, rsi: argv, rdx: envp * * We want to fallback into: - * extern long sys_execve(char *name, char **argv,char **envp, struct pt_regs *regs) + * extern long sys_execve(char *name, char **argv,char **envp, struct pt_regs regs) * * do_sys_execve asm fallback arguments: - * rdi: name, rsi: argv, rdx: envp, rcx: fake frame on the stack + * rdi: name, rsi: argv, rdx: envp, fake frame on the stack */ ENTRY(kernel_execve) CFI_STARTPROC FAKE_STACK_FRAME $0 SAVE_ALL - movq %rsp,%rcx call sys_execve movq %rax, RAX(%rsp) RESTORE_REST diff --git a/trunk/arch/x86/kernel/head_32.S b/trunk/arch/x86/kernel/head_32.S index fd8ca53943a8..25eb98540a41 100644 --- a/trunk/arch/x86/kernel/head_32.S +++ b/trunk/arch/x86/kernel/head_32.S @@ -606,7 +606,7 @@ ENTRY(_stext) .section ".bss.page_aligned","wa" .align PAGE_SIZE_asm #ifdef CONFIG_X86_PAE -swapper_pg_pmd: +ENTRY(swapper_pg_pmd) .fill 1024*KPMDS,4,0 #else ENTRY(swapper_pg_dir) diff --git a/trunk/arch/x86/kernel/head_64.S b/trunk/arch/x86/kernel/head_64.S index a007454133a3..eb415043a929 100644 --- a/trunk/arch/x86/kernel/head_64.S +++ b/trunk/arch/x86/kernel/head_64.S @@ -379,24 +379,18 @@ NEXT_PAGE(level2_ident_pgt) /* Since I easily can, map the first 1G. * Don't set NX because code runs from these pages. */ - PMDS(0, __PAGE_KERNEL_LARGE_EXEC, PTRS_PER_PMD) + PMDS(0x0000000000000000, __PAGE_KERNEL_LARGE_EXEC, PTRS_PER_PMD) NEXT_PAGE(level2_kernel_pgt) - /* - * 128 MB kernel mapping. We spend a full page on this pagetable - * anyway. - * - * The kernel code+data+bss must not be bigger than that. - * - * (NOTE: at +128MB starts the module area, see MODULES_VADDR. - * If you want to increase this then increase MODULES_VADDR - * too.) - */ - PMDS(0, __PAGE_KERNEL_LARGE_EXEC|_PAGE_GLOBAL, - KERNEL_IMAGE_SIZE/PMD_SIZE) + /* 40MB kernel mapping. The kernel code cannot be bigger than that. + When you change this change KERNEL_TEXT_SIZE in page.h too. */ + /* (2^48-(2*1024*1024*1024)-((2^39)*511)-((2^30)*510)) = 0 */ + PMDS(0x0000000000000000, __PAGE_KERNEL_LARGE_EXEC|_PAGE_GLOBAL, KERNEL_TEXT_SIZE/PMD_SIZE) + /* Module mapping starts here */ + .fill (PTRS_PER_PMD - (KERNEL_TEXT_SIZE/PMD_SIZE)),8,0 NEXT_PAGE(level2_spare_pgt) - .fill 512, 8, 0 + .fill 512,8,0 #undef PMDS #undef NEXT_PAGE diff --git a/trunk/arch/x86/kernel/hpet.c b/trunk/arch/x86/kernel/hpet.c index 235fd6c77504..429d084e014d 100644 --- a/trunk/arch/x86/kernel/hpet.c +++ b/trunk/arch/x86/kernel/hpet.c @@ -368,8 +368,8 @@ static int hpet_clocksource_register(void) return 0; } -/** - * hpet_enable - Try to setup the HPET timer. Returns 1 on success. +/* + * Try to setup the HPET timer */ int __init hpet_enable(void) { diff --git a/trunk/arch/x86/kernel/process_64.c b/trunk/arch/x86/kernel/process_64.c index 43f287744f9f..b0cc8f0136d8 100644 --- a/trunk/arch/x86/kernel/process_64.c +++ b/trunk/arch/x86/kernel/process_64.c @@ -730,16 +730,16 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) */ asmlinkage long sys_execve(char __user *name, char __user * __user *argv, - char __user * __user *envp, struct pt_regs *regs) + char __user * __user *envp, struct pt_regs regs) { long error; char * filename; filename = getname(name); error = PTR_ERR(filename); - if (IS_ERR(filename)) + if (IS_ERR(filename)) return error; - error = do_execve(filename, argv, envp, regs); + error = do_execve(filename, argv, envp, ®s); putname(filename); return error; } diff --git a/trunk/arch/x86/kernel/setup_64.c b/trunk/arch/x86/kernel/setup_64.c index 7637dc91c79b..6fd804f07821 100644 --- a/trunk/arch/x86/kernel/setup_64.c +++ b/trunk/arch/x86/kernel/setup_64.c @@ -1021,7 +1021,7 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c) /* Clear all flags overriden by options */ for (i = 0; i < NCAPINTS; i++) - c->x86_capability[i] &= ~cleared_cpu_caps[i]; + c->x86_capability[i] ^= cleared_cpu_caps[i]; #ifdef CONFIG_X86_MCE mcheck_init(c); diff --git a/trunk/arch/x86/kernel/smpboot_64.c b/trunk/arch/x86/kernel/smpboot_64.c index 0880f2c388a9..d53bd6fcb428 100644 --- a/trunk/arch/x86/kernel/smpboot_64.c +++ b/trunk/arch/x86/kernel/smpboot_64.c @@ -554,10 +554,10 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid) int timeout; unsigned long start_rip; struct create_idle c_idle = { + .work = __WORK_INITIALIZER(c_idle.work, do_fork_idle), .cpu = cpu, .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done), }; - INIT_WORK(&c_idle.work, do_fork_idle); /* allocate memory for gdts of secondary cpus. Hotplug is considered */ if (!cpu_gdt_descr[cpu].address && diff --git a/trunk/arch/x86/kernel/stacktrace.c b/trunk/arch/x86/kernel/stacktrace.c index c28c342c162f..02f0f61f5b11 100644 --- a/trunk/arch/x86/kernel/stacktrace.c +++ b/trunk/arch/x86/kernel/stacktrace.c @@ -25,8 +25,6 @@ static int save_stack_stack(void *data, char *name) static void save_stack_address(void *data, unsigned long addr, int reliable) { struct stack_trace *trace = data; - if (!reliable) - return; if (trace->skip > 0) { trace->skip--; return; @@ -39,8 +37,6 @@ static void save_stack_address_nosched(void *data, unsigned long addr, int reliable) { struct stack_trace *trace = (struct stack_trace *)data; - if (!reliable) - return; if (in_sched_functions(addr)) return; if (trace->skip > 0) { diff --git a/trunk/arch/x86/kernel/tsc_32.c b/trunk/arch/x86/kernel/tsc_32.c index f14cfd9d1f94..43517e324be8 100644 --- a/trunk/arch/x86/kernel/tsc_32.c +++ b/trunk/arch/x86/kernel/tsc_32.c @@ -28,8 +28,7 @@ EXPORT_SYMBOL_GPL(tsc_khz); static int __init tsc_setup(char *str) { printk(KERN_WARNING "notsc: Kernel compiled with CONFIG_X86_TSC, " - "cannot disable TSC completely.\n"); - mark_tsc_unstable("user disabled TSC"); + "cannot disable TSC.\n"); return 1; } #else diff --git a/trunk/arch/x86/kernel/vsyscall_64.c b/trunk/arch/x86/kernel/vsyscall_64.c index b6be812fac05..3f8242774580 100644 --- a/trunk/arch/x86/kernel/vsyscall_64.c +++ b/trunk/arch/x86/kernel/vsyscall_64.c @@ -44,6 +44,11 @@ #define __vsyscall(nr) __attribute__ ((unused,__section__(".vsyscall_" #nr))) #define __syscall_clobber "r11","cx","memory" +#define __pa_vsymbol(x) \ + ({unsigned long v; \ + extern char __vsyscall_0; \ + asm("" : "=r" (v) : "0" (x)); \ + ((v - VSYSCALL_START) + __pa_symbol(&__vsyscall_0)); }) /* * vsyscall_gtod_data contains data that is : @@ -97,7 +102,7 @@ static __always_inline void do_get_tz(struct timezone * tz) static __always_inline int gettimeofday(struct timeval *tv, struct timezone *tz) { int ret; - asm volatile("syscall" + asm volatile("vsysc2: syscall" : "=a" (ret) : "0" (__NR_gettimeofday),"D" (tv),"S" (tz) : __syscall_clobber ); @@ -107,7 +112,7 @@ static __always_inline int gettimeofday(struct timeval *tv, struct timezone *tz) static __always_inline long time_syscall(long *t) { long secs; - asm volatile("syscall" + asm volatile("vsysc1: syscall" : "=a" (secs) : "0" (__NR_time),"D" (t) : __syscall_clobber); return secs; @@ -222,10 +227,50 @@ long __vsyscall(3) venosys_1(void) } #ifdef CONFIG_SYSCTL + +#define SYSCALL 0x050f +#define NOP2 0x9090 + +/* + * NOP out syscall in vsyscall page when not needed. + */ +static int vsyscall_sysctl_change(ctl_table *ctl, int write, struct file * filp, + void __user *buffer, size_t *lenp, loff_t *ppos) +{ + extern u16 vsysc1, vsysc2; + u16 __iomem *map1; + u16 __iomem *map2; + int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); + if (!write) + return ret; + /* gcc has some trouble with __va(__pa()), so just do it this + way. */ + map1 = ioremap(__pa_vsymbol(&vsysc1), 2); + if (!map1) + return -ENOMEM; + map2 = ioremap(__pa_vsymbol(&vsysc2), 2); + if (!map2) { + ret = -ENOMEM; + goto out; + } + if (!vsyscall_gtod_data.sysctl_enabled) { + writew(SYSCALL, map1); + writew(SYSCALL, map2); + } else { + writew(NOP2, map1); + writew(NOP2, map2); + } + iounmap(map2); +out: + iounmap(map1); + return ret; +} + static ctl_table kernel_table2[] = { { .procname = "vsyscall64", .data = &vsyscall_gtod_data.sysctl_enabled, .maxlen = sizeof(int), - .mode = 0644 }, + .mode = 0644, + .proc_handler = vsyscall_sysctl_change }, {} }; @@ -234,6 +279,7 @@ static ctl_table kernel_root_table2[] = { .child = kernel_table2 }, {} }; + #endif /* Assume __initcall executes before all user space. Hopefully kmod diff --git a/trunk/arch/x86/lguest/boot.c b/trunk/arch/x86/lguest/boot.c index cccb38a59653..5afdde4895dc 100644 --- a/trunk/arch/x86/lguest/boot.c +++ b/trunk/arch/x86/lguest/boot.c @@ -57,7 +57,6 @@ #include #include #include -#include #include #include #include @@ -76,6 +75,15 @@ * behaving in simplified but equivalent ways. In particular, the Guest is the * same kernel as the Host (or at least, built from the same source code). :*/ +/* Declarations for definitions in lguest_guest.S */ +extern char lguest_noirq_start[], lguest_noirq_end[]; +extern const char lgstart_cli[], lgend_cli[]; +extern const char lgstart_sti[], lgend_sti[]; +extern const char lgstart_popf[], lgend_popf[]; +extern const char lgstart_pushf[], lgend_pushf[]; +extern const char lgstart_iret[], lgend_iret[]; +extern void lguest_iret(void); + struct lguest_data lguest_data = { .hcall_status = { [0 ... LHCALL_RING_SIZE-1] = 0xFF }, .noirq_start = (u32)lguest_noirq_start, @@ -481,7 +489,7 @@ static void lguest_set_pmd(pmd_t *pmdp, pmd_t pmdval) { *pmdp = pmdval; lazy_hcall(LHCALL_SET_PMD, __pa(pmdp)&PAGE_MASK, - (__pa(pmdp)&(PAGE_SIZE-1)), 0); + (__pa(pmdp)&(PAGE_SIZE-1))/4, 0); } /* There are a couple of legacy places where the kernel sets a PTE, but we diff --git a/trunk/arch/x86/mm/init_64.c b/trunk/arch/x86/mm/init_64.c index a02a14f0f324..bb652f5a93fb 100644 --- a/trunk/arch/x86/mm/init_64.c +++ b/trunk/arch/x86/mm/init_64.c @@ -172,9 +172,8 @@ set_pte_phys(unsigned long vaddr, unsigned long phys, pgprot_t prot) } /* - * The head.S code sets up the kernel high mapping: - * - * from __START_KERNEL_map to __START_KERNEL_map + size (== _end-_text) + * The head.S code sets up the kernel high mapping from: + * __START_KERNEL_map to __START_KERNEL_map + KERNEL_TEXT_SIZE * * phys_addr holds the negative offset to the kernel, which is added * to the compile time generated pmds. This results in invalid pmds up @@ -516,6 +515,14 @@ void __init mem_init(void) /* clear_bss() already clear the empty_zero_page */ + /* temporary debugging - double check it's true: */ + { + int i; + + for (i = 0; i < 1024; i++) + WARN_ON_ONCE(empty_zero_page[i]); + } + reservedpages = 0; /* this will put all low memory onto the freelists */ diff --git a/trunk/arch/x86/mm/pageattr.c b/trunk/arch/x86/mm/pageattr.c index 14e48b5a94ba..464d8fc21ce6 100644 --- a/trunk/arch/x86/mm/pageattr.c +++ b/trunk/arch/x86/mm/pageattr.c @@ -44,12 +44,6 @@ static inline unsigned long highmap_end_pfn(void) #endif -#ifdef CONFIG_DEBUG_PAGEALLOC -# define debug_pagealloc 1 -#else -# define debug_pagealloc 0 -#endif - static inline int within(unsigned long addr, unsigned long start, unsigned long end) { @@ -361,48 +355,45 @@ try_preserve_large_page(pte_t *kpte, unsigned long address, static LIST_HEAD(page_pool); static unsigned long pool_size, pool_pages, pool_low; -static unsigned long pool_used, pool_failed; +static unsigned long pool_used, pool_failed, pool_refill; -static void cpa_fill_pool(struct page **ret) +static void cpa_fill_pool(void) { - gfp_t gfp = GFP_KERNEL; - unsigned long flags; struct page *p; + gfp_t gfp = GFP_KERNEL; + /* Do not allocate from interrupt context */ + if (in_irq() || irqs_disabled()) + return; /* - * Avoid recursion (on debug-pagealloc) and also signal - * our priority to get to these pagetables: + * Check unlocked. I does not matter when we have one more + * page in the pool. The bit lock avoids recursive pool + * allocations: */ - if (current->flags & PF_MEMALLOC) + if (pool_pages >= pool_size || test_and_set_bit_lock(0, &pool_refill)) return; - current->flags |= PF_MEMALLOC; +#ifdef CONFIG_DEBUG_PAGEALLOC /* - * Allocate atomically from atomic contexts: + * We could do: + * gfp = in_atomic() ? GFP_ATOMIC : GFP_KERNEL; + * but this fails on !PREEMPT kernels */ - if (in_atomic() || irqs_disabled() || debug_pagealloc) - gfp = GFP_ATOMIC | __GFP_NORETRY | __GFP_NOWARN; + gfp = GFP_ATOMIC | __GFP_NORETRY | __GFP_NOWARN; +#endif - while (pool_pages < pool_size || (ret && !*ret)) { + while (pool_pages < pool_size) { p = alloc_pages(gfp, 0); if (!p) { pool_failed++; break; } - /* - * If the call site needs a page right now, provide it: - */ - if (ret && !*ret) { - *ret = p; - continue; - } - spin_lock_irqsave(&pgd_lock, flags); + spin_lock_irq(&pgd_lock); list_add(&p->lru, &page_pool); pool_pages++; - spin_unlock_irqrestore(&pgd_lock, flags); + spin_unlock_irq(&pgd_lock); } - - current->flags &= ~PF_MEMALLOC; + clear_bit_unlock(0, &pool_refill); } #define SHIFT_MB (20 - PAGE_SHIFT) @@ -423,15 +414,11 @@ void __init cpa_init(void) * GiB. Shift MiB to Gib and multiply the result by * POOL_PAGES_PER_GB: */ - if (debug_pagealloc) { - gb = ((si.totalram >> SHIFT_MB) + ROUND_MB_GB) >> SHIFT_MB_GB; - pool_size = POOL_PAGES_PER_GB * gb; - } else { - pool_size = 1; - } + gb = ((si.totalram >> SHIFT_MB) + ROUND_MB_GB) >> SHIFT_MB_GB; + pool_size = POOL_PAGES_PER_GB * gb; pool_low = pool_size; - cpa_fill_pool(NULL); + cpa_fill_pool(); printk(KERN_DEBUG "CPA: page pool initialized %lu of %lu pages preallocated\n", pool_pages, pool_size); @@ -453,20 +440,16 @@ static int split_large_page(pte_t *kpte, unsigned long address) spin_lock_irqsave(&pgd_lock, flags); if (list_empty(&page_pool)) { spin_unlock_irqrestore(&pgd_lock, flags); - base = NULL; - cpa_fill_pool(&base); - if (!base) - return -ENOMEM; - spin_lock_irqsave(&pgd_lock, flags); - } else { - base = list_first_entry(&page_pool, struct page, lru); - list_del(&base->lru); - pool_pages--; - - if (pool_pages < pool_low) - pool_low = pool_pages; + return -ENOMEM; } + base = list_first_entry(&page_pool, struct page, lru); + list_del(&base->lru); + pool_pages--; + + if (pool_pages < pool_low) + pool_low = pool_pages; + /* * Check for races, another CPU might have split this page * up for us already: @@ -751,8 +734,7 @@ static int change_page_attr_set_clr(unsigned long addr, int numpages, cpa_flush_all(cache); out: - cpa_fill_pool(NULL); - + cpa_fill_pool(); return ret; } @@ -915,7 +897,7 @@ void kernel_map_pages(struct page *page, int numpages, int enable) * Try to refill the page pool here. We can do this only after * the tlb flush. */ - cpa_fill_pool(NULL); + cpa_fill_pool(); } #ifdef CONFIG_HIBERNATION diff --git a/trunk/arch/x86/vdso/Makefile b/trunk/arch/x86/vdso/Makefile index b8bd0c4aa02e..f385a4b4a484 100644 --- a/trunk/arch/x86/vdso/Makefile +++ b/trunk/arch/x86/vdso/Makefile @@ -48,7 +48,7 @@ obj-$(VDSO64-y) += vdso-syms.lds # Match symbols in the DSO that look like VDSO*; produce a file of constants. # sed-vdsosym := -e 's/^00*/0/' \ - -e 's/^\([[:xdigit:]]*\) . \(VDSO[[:alnum:]_]*\)$$/\2 = 0x\1;/p' + -e 's/^\([0-9a-fA-F]*\) . \(VDSO[a-zA-Z0-9_]*\)$$/\2 = 0x\1;/p' quiet_cmd_vdsosym = VDSOSYM $@ cmd_vdsosym = $(NM) $< | sed -n $(sed-vdsosym) | LC_ALL=C sort > $@ diff --git a/trunk/drivers/ata/ahci.c b/trunk/drivers/ata/ahci.c index 1db93b619074..6dd12f7019a0 100644 --- a/trunk/drivers/ata/ahci.c +++ b/trunk/drivers/ata/ahci.c @@ -85,7 +85,6 @@ enum { board_ahci_ign_iferr = 2, board_ahci_sb600 = 3, board_ahci_mv = 4, - board_ahci_sb700 = 5, /* global controller registers */ HOST_CAP = 0x00, /* host capabilities */ @@ -443,16 +442,6 @@ static const struct ata_port_info ahci_port_info[] = { .udma_mask = ATA_UDMA6, .port_ops = &ahci_ops, }, - /* board_ahci_sb700 */ - { - AHCI_HFLAGS (AHCI_HFLAG_IGN_SERR_INTERNAL | - AHCI_HFLAG_NO_PMP), - .flags = AHCI_FLAG_COMMON, - .link_flags = AHCI_LFLAG_COMMON, - .pio_mask = 0x1f, /* pio0-4 */ - .udma_mask = ATA_UDMA6, - .port_ops = &ahci_ops, - }, }; static const struct pci_device_id ahci_pci_tbl[] = { @@ -495,12 +484,12 @@ static const struct pci_device_id ahci_pci_tbl[] = { /* ATI */ { PCI_VDEVICE(ATI, 0x4380), board_ahci_sb600 }, /* ATI SB600 */ - { PCI_VDEVICE(ATI, 0x4390), board_ahci_sb700 }, /* ATI SB700/800 */ - { PCI_VDEVICE(ATI, 0x4391), board_ahci_sb700 }, /* ATI SB700/800 */ - { PCI_VDEVICE(ATI, 0x4392), board_ahci_sb700 }, /* ATI SB700/800 */ - { PCI_VDEVICE(ATI, 0x4393), board_ahci_sb700 }, /* ATI SB700/800 */ - { PCI_VDEVICE(ATI, 0x4394), board_ahci_sb700 }, /* ATI SB700/800 */ - { PCI_VDEVICE(ATI, 0x4395), board_ahci_sb700 }, /* ATI SB700/800 */ + { PCI_VDEVICE(ATI, 0x4390), board_ahci_sb600 }, /* ATI SB700/800 */ + { PCI_VDEVICE(ATI, 0x4391), board_ahci_sb600 }, /* ATI SB700/800 */ + { PCI_VDEVICE(ATI, 0x4392), board_ahci_sb600 }, /* ATI SB700/800 */ + { PCI_VDEVICE(ATI, 0x4393), board_ahci_sb600 }, /* ATI SB700/800 */ + { PCI_VDEVICE(ATI, 0x4394), board_ahci_sb600 }, /* ATI SB700/800 */ + { PCI_VDEVICE(ATI, 0x4395), board_ahci_sb600 }, /* ATI SB700/800 */ /* VIA */ { PCI_VDEVICE(VIA, 0x3349), board_ahci_vt8251 }, /* VIA VT8251 */ diff --git a/trunk/drivers/ata/libata-core.c b/trunk/drivers/ata/libata-core.c index 4fbcce758b04..4cf8662df99e 100644 --- a/trunk/drivers/ata/libata-core.c +++ b/trunk/drivers/ata/libata-core.c @@ -113,7 +113,7 @@ int atapi_enabled = 1; module_param(atapi_enabled, int, 0444); MODULE_PARM_DESC(atapi_enabled, "Enable discovery of ATAPI devices (0=off, 1=on)"); -static int atapi_dmadir = 0; +int atapi_dmadir = 0; module_param(atapi_dmadir, int, 0444); MODULE_PARM_DESC(atapi_dmadir, "Enable ATAPI DMADIR bridge support (0=off, 1=on)"); @@ -153,7 +153,7 @@ MODULE_VERSION(DRV_VERSION); /** * ata_force_cbl - force cable type according to libata.force - * @ap: ATA port of interest + * @link: ATA link of interest * * Force cable type according to libata.force and whine about it. * The last entry which has matching port number is used, so it @@ -2396,7 +2396,6 @@ int ata_dev_configure(struct ata_device *dev) else if (dev->class == ATA_DEV_ATAPI) { const char *cdb_intr_string = ""; const char *atapi_an_string = ""; - const char *dma_dir_string = ""; u32 sntf; rc = atapi_cdb_len(id); @@ -2437,19 +2436,13 @@ int ata_dev_configure(struct ata_device *dev) cdb_intr_string = ", CDB intr"; } - if (atapi_dmadir || atapi_id_dmadir(dev->id)) { - dev->flags |= ATA_DFLAG_DMADIR; - dma_dir_string = ", DMADIR"; - } - /* print device info to dmesg */ if (ata_msg_drv(ap) && print_info) ata_dev_printk(dev, KERN_INFO, - "ATAPI: %s, %s, max %s%s%s%s\n", + "ATAPI: %s, %s, max %s%s%s\n", modelbuf, fwrevbuf, ata_mode_string(xfer_mask), - cdb_intr_string, atapi_an_string, - dma_dir_string); + cdb_intr_string, atapi_an_string); } /* determine max_sectors */ diff --git a/trunk/drivers/ata/libata-pmp.c b/trunk/drivers/ata/libata-pmp.c index d91f5090ba9d..caef2bbd4a8a 100644 --- a/trunk/drivers/ata/libata-pmp.c +++ b/trunk/drivers/ata/libata-pmp.c @@ -35,7 +35,7 @@ static unsigned int sata_pmp_read(struct ata_link *link, int reg, u32 *r_val) ata_tf_init(pmp_dev, &tf); tf.command = ATA_CMD_PMP_READ; tf.protocol = ATA_PROT_NODATA; - tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE | ATA_TFLAG_LBA48; + tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; tf.feature = reg; tf.device = link->pmp; @@ -71,7 +71,7 @@ static unsigned int sata_pmp_write(struct ata_link *link, int reg, u32 val) ata_tf_init(pmp_dev, &tf); tf.command = ATA_CMD_PMP_WRITE; tf.protocol = ATA_PROT_NODATA; - tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE | ATA_TFLAG_LBA48; + tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; tf.feature = reg; tf.device = link->pmp; tf.nsect = val & 0xff; diff --git a/trunk/drivers/ata/libata-scsi.c b/trunk/drivers/ata/libata-scsi.c index 0562b0a49f3b..f888babc8283 100644 --- a/trunk/drivers/ata/libata-scsi.c +++ b/trunk/drivers/ata/libata-scsi.c @@ -2582,8 +2582,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc) qc->tf.protocol = ATAPI_PROT_DMA; qc->tf.feature |= ATAPI_PKT_DMA; - if ((dev->flags & ATA_DFLAG_DMADIR) && - (scmd->sc_data_direction != DMA_TO_DEVICE)) + if (atapi_dmadir && (scmd->sc_data_direction != DMA_TO_DEVICE)) /* some SATA bridges need us to indicate data xfer direction */ qc->tf.feature |= ATAPI_DMADIR; } diff --git a/trunk/drivers/ata/libata.h b/trunk/drivers/ata/libata.h index aa884f71a12a..6036dedfe377 100644 --- a/trunk/drivers/ata/libata.h +++ b/trunk/drivers/ata/libata.h @@ -56,6 +56,7 @@ enum { extern unsigned int ata_print_id; extern struct workqueue_struct *ata_aux_wq; extern int atapi_enabled; +extern int atapi_dmadir; extern int atapi_passthru16; extern int libata_fua; extern int libata_noacpi; diff --git a/trunk/drivers/ata/pata_atiixp.c b/trunk/drivers/ata/pata_atiixp.c index 408bdc1a9776..9623f5295530 100644 --- a/trunk/drivers/ata/pata_atiixp.c +++ b/trunk/drivers/ata/pata_atiixp.c @@ -227,7 +227,7 @@ static struct scsi_host_template atiixp_sht = { .queuecommand = ata_scsi_queuecmd, .can_queue = ATA_DEF_QUEUE, .this_id = ATA_SHT_THIS_ID, - .sg_tablesize = LIBATA_DUMB_MAX_PRD, + .sg_tablesize = LIBATA_MAX_PRD, .cmd_per_lun = ATA_SHT_CMD_PER_LUN, .emulated = ATA_SHT_EMULATED, .use_clustering = ATA_SHT_USE_CLUSTERING, @@ -259,7 +259,7 @@ static struct ata_port_operations atiixp_port_ops = { .bmdma_stop = atiixp_bmdma_stop, .bmdma_status = ata_bmdma_status, - .qc_prep = ata_dumb_qc_prep, + .qc_prep = ata_qc_prep, .qc_issue = ata_qc_issue_prot, .data_xfer = ata_data_xfer, diff --git a/trunk/drivers/ata/sata_fsl.c b/trunk/drivers/ata/sata_fsl.c index 07791a7a48a5..9323dd0c7d8d 100644 --- a/trunk/drivers/ata/sata_fsl.c +++ b/trunk/drivers/ata/sata_fsl.c @@ -335,7 +335,7 @@ static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc, dma_addr_t indirect_ext_segment_paddr; unsigned int si; - VPRINTK("SATA FSL : cd = 0x%p, prd = 0x%p\n", cmd_desc, prd); + VPRINTK("SATA FSL : cd = 0x%x, prd = 0x%x\n", cmd_desc, prd); indirect_ext_segment_paddr = cmd_desc_paddr + SATA_FSL_CMD_DESC_OFFSET_TO_PRDT + SATA_FSL_MAX_PRD_DIRECT * 16; @@ -459,8 +459,7 @@ static unsigned int sata_fsl_qc_issue(struct ata_queued_cmd *qc) VPRINTK("CE=0x%x, DE=0x%x, CC=0x%x, CmdStat = 0x%x\n", ioread32(CE + hcr_base), ioread32(DE + hcr_base), - ioread32(CC + hcr_base), - ioread32(COMMANDSTAT + host_priv->csr_base)); + ioread32(CC + hcr_base), ioread32(COMMANDSTAT + csr_base)); return 0; } @@ -523,8 +522,7 @@ static void sata_fsl_freeze(struct ata_port *ap) ioread32(CQ + hcr_base), ioread32(CA + hcr_base), ioread32(CE + hcr_base), ioread32(DE + hcr_base)); - VPRINTK("CmdStat = 0x%x\n", - ioread32(host_priv->csr_base + COMMANDSTAT)); + VPRINTK("CmdStat = 0x%x\n", ioread32(csr_base + COMMANDSTAT)); /* disable interrupts on the controller/port */ temp = ioread32(hcr_base + HCONTROL); diff --git a/trunk/drivers/char/rtc.c b/trunk/drivers/char/rtc.c index 5c3142b6f1fc..78b151c4d20f 100644 --- a/trunk/drivers/char/rtc.c +++ b/trunk/drivers/char/rtc.c @@ -110,8 +110,8 @@ static int rtc_has_irq = 1; #define hpet_set_rtc_irq_bit(arg) 0 #define hpet_rtc_timer_init() do { } while (0) #define hpet_rtc_dropped_irq() 0 -#define hpet_register_irq_handler(h) ({ 0; }) -#define hpet_unregister_irq_handler(h) ({ 0; }) +#define hpet_register_irq_handler(h) 0 +#define hpet_unregister_irq_handler(h) 0 #ifdef RTC_IRQ static irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id) { diff --git a/trunk/drivers/firewire/fw-cdev.c b/trunk/drivers/firewire/fw-cdev.c index 46bc197a047f..7e73cbaa4121 100644 --- a/trunk/drivers/firewire/fw-cdev.c +++ b/trunk/drivers/firewire/fw-cdev.c @@ -109,17 +109,15 @@ static int fw_device_op_open(struct inode *inode, struct file *file) struct client *client; unsigned long flags; - device = fw_device_get_by_devt(inode->i_rdev); + device = fw_device_from_devt(inode->i_rdev); if (device == NULL) return -ENODEV; client = kzalloc(sizeof(*client), GFP_KERNEL); - if (client == NULL) { - fw_device_put(device); + if (client == NULL) return -ENOMEM; - } - client->device = device; + client->device = fw_device_get(device); INIT_LIST_HEAD(&client->event_list); INIT_LIST_HEAD(&client->resource_list); spin_lock_init(&client->lock); @@ -646,10 +644,6 @@ static int ioctl_create_iso_context(struct client *client, void *buffer) struct fw_cdev_create_iso_context *request = buffer; struct fw_iso_context *context; - /* We only support one context at this time. */ - if (client->iso_context != NULL) - return -EBUSY; - if (request->channel > 63) return -EINVAL; @@ -796,9 +790,8 @@ static int ioctl_start_iso(struct client *client, void *buffer) { struct fw_cdev_start_iso *request = buffer; - if (client->iso_context == NULL || request->handle != 0) + if (request->handle != 0) return -EINVAL; - if (client->iso_context->type == FW_ISO_CONTEXT_RECEIVE) { if (request->tags == 0 || request->tags > 15) return -EINVAL; @@ -815,7 +808,7 @@ static int ioctl_stop_iso(struct client *client, void *buffer) { struct fw_cdev_stop_iso *request = buffer; - if (client->iso_context == NULL || request->handle != 0) + if (request->handle != 0) return -EINVAL; return fw_iso_context_stop(client->iso_context); diff --git a/trunk/drivers/firewire/fw-device.c b/trunk/drivers/firewire/fw-device.c index 2ab13e0f3469..de9066e69adf 100644 --- a/trunk/drivers/firewire/fw-device.c +++ b/trunk/drivers/firewire/fw-device.c @@ -358,9 +358,12 @@ static ssize_t guid_show(struct device *dev, struct device_attribute *attr, char *buf) { struct fw_device *device = fw_device(dev); + u64 guid; - return snprintf(buf, PAGE_SIZE, "0x%08x%08x\n", - device->config_rom[3], device->config_rom[4]); + guid = ((u64)device->config_rom[3] << 32) | device->config_rom[4]; + + return snprintf(buf, PAGE_SIZE, "0x%016llx\n", + (unsigned long long)guid); } static struct device_attribute fw_device_attributes[] = { @@ -607,14 +610,12 @@ static DECLARE_RWSEM(idr_rwsem); static DEFINE_IDR(fw_device_idr); int fw_cdev_major; -struct fw_device *fw_device_get_by_devt(dev_t devt) +struct fw_device *fw_device_from_devt(dev_t devt) { struct fw_device *device; down_read(&idr_rwsem); device = idr_find(&fw_device_idr, MINOR(devt)); - if (device) - fw_device_get(device); up_read(&idr_rwsem); return device; @@ -626,14 +627,13 @@ static void fw_device_shutdown(struct work_struct *work) container_of(work, struct fw_device, work.work); int minor = MINOR(device->device.devt); - fw_device_cdev_remove(device); - device_for_each_child(&device->device, NULL, shutdown_unit); - device_unregister(&device->device); - down_write(&idr_rwsem); idr_remove(&fw_device_idr, minor); up_write(&idr_rwsem); - fw_device_put(device); + + fw_device_cdev_remove(device); + device_for_each_child(&device->device, NULL, shutdown_unit); + device_unregister(&device->device); } static struct device_type fw_device_type = { @@ -682,13 +682,10 @@ static void fw_device_init(struct work_struct *work) } err = -ENOMEM; - - fw_device_get(device); down_write(&idr_rwsem); if (idr_pre_get(&fw_device_idr, GFP_KERNEL)) err = idr_get_new(&fw_device_idr, device, &minor); up_write(&idr_rwsem); - if (err < 0) goto error; @@ -720,22 +717,13 @@ static void fw_device_init(struct work_struct *work) */ if (atomic_cmpxchg(&device->state, FW_DEVICE_INITIALIZING, - FW_DEVICE_RUNNING) == FW_DEVICE_SHUTDOWN) { + FW_DEVICE_RUNNING) == FW_DEVICE_SHUTDOWN) fw_device_shutdown(&device->work.work); - } else { - if (device->config_rom_retries) - fw_notify("created device %s: GUID %08x%08x, S%d00, " - "%d config ROM retries\n", - device->device.bus_id, - device->config_rom[3], device->config_rom[4], - 1 << device->max_speed, - device->config_rom_retries); - else - fw_notify("created device %s: GUID %08x%08x, S%d00\n", - device->device.bus_id, - device->config_rom[3], device->config_rom[4], - 1 << device->max_speed); - } + else + fw_notify("created new fw device %s " + "(%d config rom retries, S%d00)\n", + device->device.bus_id, device->config_rom_retries, + 1 << device->max_speed); /* * Reschedule the IRM work if we just finished reading the @@ -753,9 +741,7 @@ static void fw_device_init(struct work_struct *work) idr_remove(&fw_device_idr, minor); up_write(&idr_rwsem); error: - fw_device_put(device); /* fw_device_idr's reference */ - - put_device(&device->device); /* our reference */ + put_device(&device->device); } static int update_unit(struct device *dev, void *data) diff --git a/trunk/drivers/firewire/fw-device.h b/trunk/drivers/firewire/fw-device.h index 43808c02793e..0854fe2bc110 100644 --- a/trunk/drivers/firewire/fw-device.h +++ b/trunk/drivers/firewire/fw-device.h @@ -77,13 +77,13 @@ fw_device_is_shutdown(struct fw_device *device) } struct fw_device *fw_device_get(struct fw_device *device); -struct fw_device *fw_device_get_by_devt(dev_t devt); void fw_device_put(struct fw_device *device); int fw_device_enable_phys_dma(struct fw_device *device); void fw_device_cdev_update(struct fw_device *device); void fw_device_cdev_remove(struct fw_device *device); +struct fw_device *fw_device_from_devt(dev_t devt); extern int fw_cdev_major; struct fw_unit { diff --git a/trunk/drivers/firewire/fw-sbp2.c b/trunk/drivers/firewire/fw-sbp2.c index 5259491580fc..19ece9b6d742 100644 --- a/trunk/drivers/firewire/fw-sbp2.c +++ b/trunk/drivers/firewire/fw-sbp2.c @@ -28,15 +28,14 @@ * and many others. */ -#include -#include -#include -#include #include -#include #include #include +#include +#include #include +#include +#include #include #include #include @@ -48,9 +47,9 @@ #include #include -#include "fw-device.h" -#include "fw-topology.h" #include "fw-transaction.h" +#include "fw-topology.h" +#include "fw-device.h" /* * So far only bridges from Oxford Semiconductor are known to support @@ -83,9 +82,6 @@ MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device " * Avoids access beyond actual disk limits on devices with an off-by-one bug. * Don't use this with devices which don't have this bug. * - * - delay inquiry - * Wait extra SBP2_INQUIRY_DELAY seconds after login before SCSI inquiry. - * * - override internal blacklist * Instead of adding to the built-in blacklist, use only the workarounds * specified in the module load parameter. @@ -95,8 +91,6 @@ MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device " #define SBP2_WORKAROUND_INQUIRY_36 0x2 #define SBP2_WORKAROUND_MODE_SENSE_8 0x4 #define SBP2_WORKAROUND_FIX_CAPACITY 0x8 -#define SBP2_WORKAROUND_DELAY_INQUIRY 0x10 -#define SBP2_INQUIRY_DELAY 12 #define SBP2_WORKAROUND_OVERRIDE 0x100 static int sbp2_param_workarounds; @@ -106,7 +100,6 @@ MODULE_PARM_DESC(workarounds, "Work around device bugs (default = 0" ", 36 byte inquiry = " __stringify(SBP2_WORKAROUND_INQUIRY_36) ", skip mode page 8 = " __stringify(SBP2_WORKAROUND_MODE_SENSE_8) ", fix capacity = " __stringify(SBP2_WORKAROUND_FIX_CAPACITY) - ", delay inquiry = " __stringify(SBP2_WORKAROUND_DELAY_INQUIRY) ", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE) ", or a combination)"); @@ -139,7 +132,6 @@ struct sbp2_logical_unit { int generation; int retries; struct delayed_work work; - bool blocked; }; /* @@ -149,18 +141,16 @@ struct sbp2_logical_unit { struct sbp2_target { struct kref kref; struct fw_unit *unit; - const char *bus_id; - struct list_head lu_list; u64 management_agent_address; int directory_id; int node_id; int address_high; - unsigned int workarounds; - unsigned int mgt_orb_timeout; - int dont_block; /* counter for each logical unit */ - int blocked; /* ditto */ + unsigned workarounds; + struct list_head lu_list; + + unsigned int mgt_orb_timeout; }; /* @@ -170,7 +160,7 @@ struct sbp2_target { */ #define SBP2_MIN_LOGIN_ORB_TIMEOUT 5000U /* Timeout in ms */ #define SBP2_MAX_LOGIN_ORB_TIMEOUT 40000U /* Timeout in ms */ -#define SBP2_ORB_TIMEOUT 2000U /* Timeout in ms */ +#define SBP2_ORB_TIMEOUT 2000 /* Timeout in ms */ #define SBP2_ORB_NULL 0x80000000 #define SBP2_MAX_SG_ELEMENT_LENGTH 0xf000 @@ -307,7 +297,7 @@ struct sbp2_command_orb { static const struct { u32 firmware_revision; u32 model; - unsigned int workarounds; + unsigned workarounds; } sbp2_workarounds_table[] = { /* DViCO Momobay CX-1 with TSB42AA9 bridge */ { .firmware_revision = 0x002800, @@ -315,11 +305,6 @@ static const struct { .workarounds = SBP2_WORKAROUND_INQUIRY_36 | SBP2_WORKAROUND_MODE_SENSE_8, }, - /* DViCO Momobay FX-3A with TSB42AA9A bridge */ { - .firmware_revision = 0x002800, - .model = 0x000000, - .workarounds = SBP2_WORKAROUND_DELAY_INQUIRY, - }, /* Initio bridges, actually only needed for some older ones */ { .firmware_revision = 0x000200, .model = ~0, @@ -516,9 +501,6 @@ sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id, unsigned int timeout; int retval = -ENOMEM; - if (function == SBP2_LOGOUT_REQUEST && fw_device_is_shutdown(device)) - return 0; - orb = kzalloc(sizeof(*orb), GFP_ATOMIC); if (orb == NULL) return -ENOMEM; @@ -571,20 +553,20 @@ sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id, retval = -EIO; if (sbp2_cancel_orbs(lu) == 0) { - fw_error("%s: orb reply timed out, rcode=0x%02x\n", - lu->tgt->bus_id, orb->base.rcode); + fw_error("orb reply timed out, rcode=0x%02x\n", + orb->base.rcode); goto out; } if (orb->base.rcode != RCODE_COMPLETE) { - fw_error("%s: management write failed, rcode 0x%02x\n", - lu->tgt->bus_id, orb->base.rcode); + fw_error("management write failed, rcode 0x%02x\n", + orb->base.rcode); goto out; } if (STATUS_GET_RESPONSE(orb->status) != 0 || STATUS_GET_SBP_STATUS(orb->status) != 0) { - fw_error("%s: error status: %d:%d\n", lu->tgt->bus_id, + fw_error("error status: %d:%d\n", STATUS_GET_RESPONSE(orb->status), STATUS_GET_SBP_STATUS(orb->status)); goto out; @@ -608,147 +590,29 @@ sbp2_send_management_orb(struct sbp2_logical_unit *lu, int node_id, static void complete_agent_reset_write(struct fw_card *card, int rcode, - void *payload, size_t length, void *done) -{ - complete(done); -} - -static void sbp2_agent_reset(struct sbp2_logical_unit *lu) + void *payload, size_t length, void *data) { - struct fw_device *device = fw_device(lu->tgt->unit->device.parent); - DECLARE_COMPLETION_ONSTACK(done); - struct fw_transaction t; - static u32 z; - - fw_send_request(device->card, &t, TCODE_WRITE_QUADLET_REQUEST, - lu->tgt->node_id, lu->generation, device->max_speed, - lu->command_block_agent_address + SBP2_AGENT_RESET, - &z, sizeof(z), complete_agent_reset_write, &done); - wait_for_completion(&done); -} + struct fw_transaction *t = data; -static void -complete_agent_reset_write_no_wait(struct fw_card *card, int rcode, - void *payload, size_t length, void *data) -{ - kfree(data); + kfree(t); } -static void sbp2_agent_reset_no_wait(struct sbp2_logical_unit *lu) +static int sbp2_agent_reset(struct sbp2_logical_unit *lu) { struct fw_device *device = fw_device(lu->tgt->unit->device.parent); struct fw_transaction *t; - static u32 z; + static u32 zero; - t = kmalloc(sizeof(*t), GFP_ATOMIC); + t = kzalloc(sizeof(*t), GFP_ATOMIC); if (t == NULL) - return; + return -ENOMEM; fw_send_request(device->card, t, TCODE_WRITE_QUADLET_REQUEST, lu->tgt->node_id, lu->generation, device->max_speed, lu->command_block_agent_address + SBP2_AGENT_RESET, - &z, sizeof(z), complete_agent_reset_write_no_wait, t); -} - -static void sbp2_set_generation(struct sbp2_logical_unit *lu, int generation) -{ - struct fw_card *card = fw_device(lu->tgt->unit->device.parent)->card; - unsigned long flags; - - /* serialize with comparisons of lu->generation and card->generation */ - spin_lock_irqsave(&card->lock, flags); - lu->generation = generation; - spin_unlock_irqrestore(&card->lock, flags); -} - -static inline void sbp2_allow_block(struct sbp2_logical_unit *lu) -{ - /* - * We may access dont_block without taking card->lock here: - * All callers of sbp2_allow_block() and all callers of sbp2_unblock() - * are currently serialized against each other. - * And a wrong result in sbp2_conditionally_block()'s access of - * dont_block is rather harmless, it simply misses its first chance. - */ - --lu->tgt->dont_block; -} - -/* - * Blocks lu->tgt if all of the following conditions are met: - * - Login, INQUIRY, and high-level SCSI setup of all of the target's - * logical units have been finished (indicated by dont_block == 0). - * - lu->generation is stale. - * - * Note, scsi_block_requests() must be called while holding card->lock, - * otherwise it might foil sbp2_[conditionally_]unblock()'s attempt to - * unblock the target. - */ -static void sbp2_conditionally_block(struct sbp2_logical_unit *lu) -{ - struct sbp2_target *tgt = lu->tgt; - struct fw_card *card = fw_device(tgt->unit->device.parent)->card; - struct Scsi_Host *shost = - container_of((void *)tgt, struct Scsi_Host, hostdata[0]); - unsigned long flags; - - spin_lock_irqsave(&card->lock, flags); - if (!tgt->dont_block && !lu->blocked && - lu->generation != card->generation) { - lu->blocked = true; - if (++tgt->blocked == 1) { - scsi_block_requests(shost); - fw_notify("blocked %s\n", lu->tgt->bus_id); - } - } - spin_unlock_irqrestore(&card->lock, flags); -} - -/* - * Unblocks lu->tgt as soon as all its logical units can be unblocked. - * Note, it is harmless to run scsi_unblock_requests() outside the - * card->lock protected section. On the other hand, running it inside - * the section might clash with shost->host_lock. - */ -static void sbp2_conditionally_unblock(struct sbp2_logical_unit *lu) -{ - struct sbp2_target *tgt = lu->tgt; - struct fw_card *card = fw_device(tgt->unit->device.parent)->card; - struct Scsi_Host *shost = - container_of((void *)tgt, struct Scsi_Host, hostdata[0]); - unsigned long flags; - bool unblock = false; - - spin_lock_irqsave(&card->lock, flags); - if (lu->blocked && lu->generation == card->generation) { - lu->blocked = false; - unblock = --tgt->blocked == 0; - } - spin_unlock_irqrestore(&card->lock, flags); - - if (unblock) { - scsi_unblock_requests(shost); - fw_notify("unblocked %s\n", lu->tgt->bus_id); - } -} - -/* - * Prevents future blocking of tgt and unblocks it. - * Note, it is harmless to run scsi_unblock_requests() outside the - * card->lock protected section. On the other hand, running it inside - * the section might clash with shost->host_lock. - */ -static void sbp2_unblock(struct sbp2_target *tgt) -{ - struct fw_card *card = fw_device(tgt->unit->device.parent)->card; - struct Scsi_Host *shost = - container_of((void *)tgt, struct Scsi_Host, hostdata[0]); - unsigned long flags; - - spin_lock_irqsave(&card->lock, flags); - ++tgt->dont_block; - spin_unlock_irqrestore(&card->lock, flags); + &zero, sizeof(zero), complete_agent_reset_write, t); - scsi_unblock_requests(shost); + return 0; } static void sbp2_release_target(struct kref *kref) @@ -757,24 +621,23 @@ static void sbp2_release_target(struct kref *kref) struct sbp2_logical_unit *lu, *next; struct Scsi_Host *shost = container_of((void *)tgt, struct Scsi_Host, hostdata[0]); - - /* prevent deadlocks */ - sbp2_unblock(tgt); + struct fw_device *device = fw_device(tgt->unit->device.parent); list_for_each_entry_safe(lu, next, &tgt->lu_list, link) { - if (lu->sdev) { + if (lu->sdev) scsi_remove_device(lu->sdev); - scsi_device_put(lu->sdev); - } - sbp2_send_management_orb(lu, tgt->node_id, lu->generation, - SBP2_LOGOUT_REQUEST, lu->login_id, NULL); + + if (!fw_device_is_shutdown(device)) + sbp2_send_management_orb(lu, tgt->node_id, + lu->generation, SBP2_LOGOUT_REQUEST, + lu->login_id, NULL); fw_core_remove_address_handler(&lu->address_handler); list_del(&lu->link); kfree(lu); } scsi_remove_host(shost); - fw_notify("released %s\n", tgt->bus_id); + fw_notify("released %s\n", tgt->unit->device.bus_id); put_device(&tgt->unit->device); scsi_host_put(shost); @@ -803,43 +666,33 @@ static void sbp2_login(struct work_struct *work) { struct sbp2_logical_unit *lu = container_of(work, struct sbp2_logical_unit, work.work); - struct sbp2_target *tgt = lu->tgt; - struct fw_device *device = fw_device(tgt->unit->device.parent); - struct Scsi_Host *shost; + struct Scsi_Host *shost = + container_of((void *)lu->tgt, struct Scsi_Host, hostdata[0]); struct scsi_device *sdev; struct scsi_lun eight_bytes_lun; + struct fw_unit *unit = lu->tgt->unit; + struct fw_device *device = fw_device(unit->device.parent); struct sbp2_login_response response; int generation, node_id, local_node_id; - if (fw_device_is_shutdown(device)) - goto out; - generation = device->generation; smp_rmb(); /* node_id must not be older than generation */ node_id = device->node_id; local_node_id = device->card->node_id; - /* If this is a re-login attempt, log out, or we might be rejected. */ - if (lu->sdev) - sbp2_send_management_orb(lu, device->node_id, generation, - SBP2_LOGOUT_REQUEST, lu->login_id, NULL); - if (sbp2_send_management_orb(lu, node_id, generation, SBP2_LOGIN_REQUEST, lu->lun, &response) < 0) { - if (lu->retries++ < 5) { + if (lu->retries++ < 5) sbp2_queue_work(lu, DIV_ROUND_UP(HZ, 5)); - } else { - fw_error("%s: failed to login to LUN %04x\n", - tgt->bus_id, lu->lun); - /* Let any waiting I/O fail from now on. */ - sbp2_unblock(lu->tgt); - } + else + fw_error("failed to login to %s LUN %04x\n", + unit->device.bus_id, lu->lun); goto out; } - tgt->node_id = node_id; - tgt->address_high = local_node_id << 16; - sbp2_set_generation(lu, generation); + lu->generation = generation; + lu->tgt->node_id = node_id; + lu->tgt->address_high = local_node_id << 16; /* Get command block agent offset and login id. */ lu->command_block_agent_address = @@ -847,8 +700,8 @@ static void sbp2_login(struct work_struct *work) response.command_block_agent.low; lu->login_id = LOGIN_RESPONSE_GET_LOGIN_ID(response); - fw_notify("%s: logged in to LUN %04x (%d retries)\n", - tgt->bus_id, lu->lun, lu->retries); + fw_notify("logged in to %s LUN %04x (%d retries)\n", + unit->device.bus_id, lu->lun, lu->retries); #if 0 /* FIXME: The linux1394 sbp2 does this last step. */ @@ -858,62 +711,26 @@ static void sbp2_login(struct work_struct *work) PREPARE_DELAYED_WORK(&lu->work, sbp2_reconnect); sbp2_agent_reset(lu); - /* This was a re-login. */ - if (lu->sdev) { - sbp2_cancel_orbs(lu); - sbp2_conditionally_unblock(lu); - goto out; - } - - if (lu->tgt->workarounds & SBP2_WORKAROUND_DELAY_INQUIRY) - ssleep(SBP2_INQUIRY_DELAY); - memset(&eight_bytes_lun, 0, sizeof(eight_bytes_lun)); eight_bytes_lun.scsi_lun[0] = (lu->lun >> 8) & 0xff; eight_bytes_lun.scsi_lun[1] = lu->lun & 0xff; - shost = container_of((void *)tgt, struct Scsi_Host, hostdata[0]); sdev = __scsi_add_device(shost, 0, 0, scsilun_to_int(&eight_bytes_lun), lu); - /* - * FIXME: We are unable to perform reconnects while in sbp2_login(). - * Therefore __scsi_add_device() will get into trouble if a bus reset - * happens in parallel. It will either fail or leave us with an - * unusable sdev. As a workaround we check for this and retry the - * whole login and SCSI probing. - */ - - /* Reported error during __scsi_add_device() */ - if (IS_ERR(sdev)) - goto out_logout_login; - - /* Unreported error during __scsi_add_device() */ - smp_rmb(); /* get current card generation */ - if (generation != device->card->generation) { - scsi_remove_device(sdev); + if (IS_ERR(sdev)) { + sbp2_send_management_orb(lu, node_id, generation, + SBP2_LOGOUT_REQUEST, lu->login_id, NULL); + /* + * Set this back to sbp2_login so we fall back and + * retry login on bus reset. + */ + PREPARE_DELAYED_WORK(&lu->work, sbp2_login); + } else { + lu->sdev = sdev; scsi_device_put(sdev); - goto out_logout_login; } - - /* No error during __scsi_add_device() */ - lu->sdev = sdev; - sbp2_allow_block(lu); - goto out; - - out_logout_login: - smp_rmb(); /* generation may have changed */ - generation = device->generation; - smp_rmb(); /* node_id must not be older than generation */ - - sbp2_send_management_orb(lu, device->node_id, generation, - SBP2_LOGOUT_REQUEST, lu->login_id, NULL); - /* - * If a bus reset happened, sbp2_update will have requeued - * lu->work already. Reset the work from reconnect to login. - */ - PREPARE_DELAYED_WORK(&lu->work, sbp2_login); out: - sbp2_target_put(tgt); + sbp2_target_put(lu->tgt); } static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry) @@ -938,8 +755,6 @@ static int sbp2_add_logical_unit(struct sbp2_target *tgt, int lun_entry) lu->sdev = NULL; lu->lun = lun_entry & 0xffff; lu->retries = 0; - lu->blocked = false; - ++tgt->dont_block; INIT_LIST_HEAD(&lu->orb_list); INIT_DELAYED_WORK(&lu->work, sbp2_login); @@ -998,7 +813,7 @@ static int sbp2_scan_unit_dir(struct sbp2_target *tgt, u32 *directory, if (timeout > tgt->mgt_orb_timeout) fw_notify("%s: config rom contains %ds " "management ORB timeout, limiting " - "to %ds\n", tgt->bus_id, + "to %ds\n", tgt->unit->device.bus_id, timeout / 1000, tgt->mgt_orb_timeout / 1000); break; @@ -1021,12 +836,12 @@ static void sbp2_init_workarounds(struct sbp2_target *tgt, u32 model, u32 firmware_revision) { int i; - unsigned int w = sbp2_param_workarounds; + unsigned w = sbp2_param_workarounds; if (w) fw_notify("Please notify linux1394-devel@lists.sourceforge.net " "if you need the workarounds parameter for %s\n", - tgt->bus_id); + tgt->unit->device.bus_id); if (w & SBP2_WORKAROUND_OVERRIDE) goto out; @@ -1048,7 +863,8 @@ static void sbp2_init_workarounds(struct sbp2_target *tgt, u32 model, if (w) fw_notify("Workarounds for %s: 0x%x " "(firmware_revision 0x%06x, model_id 0x%06x)\n", - tgt->bus_id, w, firmware_revision, model); + tgt->unit->device.bus_id, + w, firmware_revision, model); tgt->workarounds = w; } @@ -1072,7 +888,6 @@ static int sbp2_probe(struct device *dev) tgt->unit = unit; kref_init(&tgt->kref); INIT_LIST_HEAD(&tgt->lu_list); - tgt->bus_id = unit->device.bus_id; if (fw_device_enable_phys_dma(device) < 0) goto fail_shost_put; @@ -1123,13 +938,10 @@ static void sbp2_reconnect(struct work_struct *work) { struct sbp2_logical_unit *lu = container_of(work, struct sbp2_logical_unit, work.work); - struct sbp2_target *tgt = lu->tgt; - struct fw_device *device = fw_device(tgt->unit->device.parent); + struct fw_unit *unit = lu->tgt->unit; + struct fw_device *device = fw_device(unit->device.parent); int generation, node_id, local_node_id; - if (fw_device_is_shutdown(device)) - goto out; - generation = device->generation; smp_rmb(); /* node_id must not be older than generation */ node_id = device->node_id; @@ -1138,17 +950,10 @@ static void sbp2_reconnect(struct work_struct *work) if (sbp2_send_management_orb(lu, node_id, generation, SBP2_RECONNECT_REQUEST, lu->login_id, NULL) < 0) { - /* - * If reconnect was impossible even though we are in the - * current generation, fall back and try to log in again. - * - * We could check for "Function rejected" status, but - * looking at the bus generation as simpler and more general. - */ - smp_rmb(); /* get current card generation */ - if (generation == device->card->generation || - lu->retries++ >= 5) { - fw_error("%s: failed to reconnect\n", tgt->bus_id); + if (lu->retries++ >= 5) { + fw_error("failed to reconnect to %s\n", + unit->device.bus_id); + /* Fall back and try to log in again. */ lu->retries = 0; PREPARE_DELAYED_WORK(&lu->work, sbp2_login); } @@ -1156,18 +961,17 @@ static void sbp2_reconnect(struct work_struct *work) goto out; } - tgt->node_id = node_id; - tgt->address_high = local_node_id << 16; - sbp2_set_generation(lu, generation); + lu->generation = generation; + lu->tgt->node_id = node_id; + lu->tgt->address_high = local_node_id << 16; - fw_notify("%s: reconnected to LUN %04x (%d retries)\n", - tgt->bus_id, lu->lun, lu->retries); + fw_notify("reconnected to %s LUN %04x (%d retries)\n", + unit->device.bus_id, lu->lun, lu->retries); sbp2_agent_reset(lu); sbp2_cancel_orbs(lu); - sbp2_conditionally_unblock(lu); out: - sbp2_target_put(tgt); + sbp2_target_put(lu->tgt); } static void sbp2_update(struct fw_unit *unit) @@ -1182,7 +986,6 @@ static void sbp2_update(struct fw_unit *unit) * Iteration over tgt->lu_list is therefore safe here. */ list_for_each_entry(lu, &tgt->lu_list, link) { - sbp2_conditionally_block(lu); lu->retries = 0; sbp2_queue_work(lu, 0); } @@ -1260,7 +1063,7 @@ complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status) if (status != NULL) { if (STATUS_GET_DEAD(*status)) - sbp2_agent_reset_no_wait(orb->lu); + sbp2_agent_reset(orb->lu); switch (STATUS_GET_RESPONSE(*status)) { case SBP2_STATUS_REQUEST_COMPLETE: @@ -1286,7 +1089,6 @@ complete_command_orb(struct sbp2_orb *base_orb, struct sbp2_status *status) * or when sending the write (less likely). */ result = DID_BUS_BUSY << 16; - sbp2_conditionally_block(orb->lu); } dma_unmap_single(device->card->device, orb->base.request_bus, @@ -1395,7 +1197,7 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done) struct sbp2_logical_unit *lu = cmd->device->hostdata; struct fw_device *device = fw_device(lu->tgt->unit->device.parent); struct sbp2_command_orb *orb; - unsigned int max_payload; + unsigned max_payload; int retval = SCSI_MLQUEUE_HOST_BUSY; /* @@ -1473,10 +1275,6 @@ static int sbp2_scsi_slave_alloc(struct scsi_device *sdev) { struct sbp2_logical_unit *lu = sdev->hostdata; - /* (Re-)Adding logical units via the SCSI stack is not supported. */ - if (!lu) - return -ENOSYS; - sdev->allow_restart = 1; /* @@ -1521,7 +1319,7 @@ static int sbp2_scsi_abort(struct scsi_cmnd *cmd) { struct sbp2_logical_unit *lu = cmd->device->hostdata; - fw_notify("%s: sbp2_scsi_abort\n", lu->tgt->bus_id); + fw_notify("sbp2_scsi_abort\n"); sbp2_agent_reset(lu); sbp2_cancel_orbs(lu); diff --git a/trunk/drivers/i2c/busses/Kconfig b/trunk/drivers/i2c/busses/Kconfig index 476b0bb72d6c..b61f56b6f311 100644 --- a/trunk/drivers/i2c/busses/Kconfig +++ b/trunk/drivers/i2c/busses/Kconfig @@ -177,8 +177,6 @@ config I2C_I801 ESB2 ICH8 ICH9 - Tolapai - ICH10 This driver can also be built as a module. If so, the module will be called i2c-i801. diff --git a/trunk/drivers/i2c/busses/i2c-i801.c b/trunk/drivers/i2c/busses/i2c-i801.c index b0f771fe4326..aa9157913b9a 100644 --- a/trunk/drivers/i2c/busses/i2c-i801.c +++ b/trunk/drivers/i2c/busses/i2c-i801.c @@ -40,9 +40,7 @@ 82801G (ICH7) 0x27da 32 hard yes yes yes 82801H (ICH8) 0x283e 32 hard yes yes yes 82801I (ICH9) 0x2930 32 hard yes yes yes - Tolapai 0x5032 32 hard yes yes yes - ICH10 0x3a30 32 hard yes yes yes - ICH10 0x3a60 32 hard yes yes yes + Tolapai 0x5032 32 hard yes ? ? Features supported by this driver: Software PEC no @@ -590,8 +588,6 @@ static struct pci_device_id i801_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_5) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_6) }, { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_TOLAPAI_1) }, - { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH10_4) }, - { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH10_5) }, { 0, } }; @@ -612,12 +608,10 @@ static int __devinit i801_probe(struct pci_dev *dev, const struct pci_device_id case PCI_DEVICE_ID_INTEL_ESB2_17: case PCI_DEVICE_ID_INTEL_ICH8_5: case PCI_DEVICE_ID_INTEL_ICH9_6: - case PCI_DEVICE_ID_INTEL_TOLAPAI_1: - case PCI_DEVICE_ID_INTEL_ICH10_4: - case PCI_DEVICE_ID_INTEL_ICH10_5: i801_features |= FEATURE_I2C_BLOCK_READ; /* fall through */ case PCI_DEVICE_ID_INTEL_82801DB_3: + case PCI_DEVICE_ID_INTEL_TOLAPAI_1: i801_features |= FEATURE_SMBUS_PEC; i801_features |= FEATURE_BLOCK_BUFFER; break; diff --git a/trunk/drivers/i2c/busses/i2c-pca-isa.c b/trunk/drivers/i2c/busses/i2c-pca-isa.c index 496ee875eb4f..5161aaf9341b 100644 --- a/trunk/drivers/i2c/busses/i2c-pca-isa.c +++ b/trunk/drivers/i2c/busses/i2c-pca-isa.c @@ -125,13 +125,6 @@ static int __devinit pca_isa_probe(struct device *dev, unsigned int id) dev_info(dev, "i/o base %#08lx. irq %d\n", base, irq); -#ifdef CONFIG_PPC_MERGE - if (check_legacy_ioport(base)) { - dev_err(dev, "I/O address %#08lx is not available\n", base); - goto out; - } -#endif - if (!request_region(base, IO_SIZE, "i2c-pca-isa")) { dev_err(dev, "I/O address %#08lx is in use\n", base); goto out; diff --git a/trunk/drivers/i2c/busses/i2c-pmcmsp.c b/trunk/drivers/i2c/busses/i2c-pmcmsp.c index b03af5653c65..be99c02ecac5 100644 --- a/trunk/drivers/i2c/busses/i2c-pmcmsp.c +++ b/trunk/drivers/i2c/busses/i2c-pmcmsp.c @@ -122,7 +122,7 @@ struct pmcmsptwi_data { }; /* The default settings */ -static const struct pmcmsptwi_clockcfg pmcmsptwi_defclockcfg = { +const static struct pmcmsptwi_clockcfg pmcmsptwi_defclockcfg = { .standard = { .filter = 0x3, .clock = 0x1f, @@ -133,7 +133,7 @@ static const struct pmcmsptwi_clockcfg pmcmsptwi_defclockcfg = { }, }; -static const struct pmcmsptwi_cfg pmcmsptwi_defcfg = { +const static struct pmcmsptwi_cfg pmcmsptwi_defcfg = { .arbf = 0x03, .nak = 0x03, .add10 = 0x00, diff --git a/trunk/drivers/i2c/busses/i2c-pxa.c b/trunk/drivers/i2c/busses/i2c-pxa.c index 2d2087ad708f..2b557bfd7f70 100644 --- a/trunk/drivers/i2c/busses/i2c-pxa.c +++ b/trunk/drivers/i2c/busses/i2c-pxa.c @@ -999,14 +999,7 @@ static int i2c_pxa_probe(struct platform_device *dev) spin_lock_init(&i2c->lock); init_waitqueue_head(&i2c->wait); - /* - * If "dev->id" is negative we consider it as zero. - * The reason to do so is to avoid sysfs names that only make - * sense when there are multiple adapters. - */ - i2c->adap.nr = dev->id != -1 ? dev->id : 0; - snprintf(i2c->adap.name, sizeof(i2c->adap.name), "pxa_i2c-i2c.%u", - i2c->adap.nr); + sprintf(i2c->adap.name, "pxa_i2c-i2c.%u", dev->id); i2c->clk = clk_get(&dev->dev, "I2CCLK"); if (IS_ERR(i2c->clk)) { @@ -1057,6 +1050,13 @@ static int i2c_pxa_probe(struct platform_device *dev) i2c->adap.algo_data = i2c; i2c->adap.dev.parent = &dev->dev; + /* + * If "dev->id" is negative we consider it as zero. + * The reason to do so is to avoid sysfs names that only make + * sense when there are multiple adapters. + */ + i2c->adap.nr = dev->id != -1 ? dev->id : 0; + ret = i2c_add_numbered_adapter(&i2c->adap); if (ret < 0) { printk(KERN_INFO "I2C: Failed to add bus\n"); @@ -1080,7 +1080,6 @@ static int i2c_pxa_probe(struct platform_device *dev) ereqirq: clk_disable(i2c->clk); i2c_pxa_disable(dev); - iounmap(i2c->reg_base); eremap: clk_put(i2c->clk); eclk: @@ -1090,7 +1089,7 @@ static int i2c_pxa_probe(struct platform_device *dev) return ret; } -static int __exit i2c_pxa_remove(struct platform_device *dev) +static int i2c_pxa_remove(struct platform_device *dev) { struct pxa_i2c *i2c = platform_get_drvdata(dev); @@ -1104,7 +1103,6 @@ static int __exit i2c_pxa_remove(struct platform_device *dev) clk_put(i2c->clk); i2c_pxa_disable(dev); - iounmap(i2c->reg_base); release_mem_region(i2c->iobase, i2c->iosize); kfree(i2c); @@ -1113,10 +1111,9 @@ static int __exit i2c_pxa_remove(struct platform_device *dev) static struct platform_driver i2c_pxa_driver = { .probe = i2c_pxa_probe, - .remove = __exit_p(i2c_pxa_remove), + .remove = i2c_pxa_remove, .driver = { .name = "pxa2xx-i2c", - .owner = THIS_MODULE, }, }; @@ -1125,7 +1122,7 @@ static int __init i2c_adap_pxa_init(void) return platform_driver_register(&i2c_pxa_driver); } -static void __exit i2c_adap_pxa_exit(void) +static void i2c_adap_pxa_exit(void) { platform_driver_unregister(&i2c_pxa_driver); } diff --git a/trunk/drivers/ide/ide-cd.c b/trunk/drivers/ide/ide-cd.c index c8d0e8715997..310e497b5838 100644 --- a/trunk/drivers/ide/ide-cd.c +++ b/trunk/drivers/ide/ide-cd.c @@ -670,8 +670,8 @@ static void cdrom_buffer_sectors (ide_drive_t *drive, unsigned long sector, * and attempt to recover if there are problems. Returns 0 if everything's * ok; nonzero if the request has been terminated. */ -static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq, - int len, int ireason, int rw) +static +int ide_cd_check_ireason(ide_drive_t *drive, int len, int ireason, int rw) { /* * ireason == 0: the drive wants to receive data from us @@ -701,9 +701,6 @@ static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq, drive->name, __FUNCTION__, ireason); } - if (rq->cmd_type == REQ_TYPE_ATA_PC) - rq->cmd_flags |= REQ_FAILED; - cdrom_end_request(drive, 0); return -1; } @@ -1074,11 +1071,11 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) /* * check which way to transfer data */ - if (ide_cd_check_ireason(drive, rq, len, ireason, write)) - return ide_stopped; + if (blk_fs_request(rq) || blk_pc_request(rq)) { + if (ide_cd_check_ireason(drive, len, ireason, write)) + return ide_stopped; - if (blk_fs_request(rq)) { - if (write == 0) { + if (blk_fs_request(rq) && write == 0) { int nskip; if (ide_cd_check_transfer_size(drive, len)) { @@ -1104,9 +1101,16 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) if (ireason == 0) { write = 1; xferfunc = HWIF(drive)->atapi_output_bytes; - } else { + } else if (ireason == 2 || (ireason == 1 && + (blk_fs_request(rq) || blk_pc_request(rq)))) { write = 0; xferfunc = HWIF(drive)->atapi_input_bytes; + } else { + printk(KERN_ERR "%s: %s: The drive " + "appears confused (ireason = 0x%02x). " + "Trying to recover by ending request.\n", + drive->name, __FUNCTION__, ireason); + goto end_request; } /* @@ -1178,10 +1182,11 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) else rq->data += blen; } - if (!write && blk_sense_request(rq)) - rq->sense_len += blen; } + if (write && blk_sense_request(rq)) + rq->sense_len += thislen; + /* * pad, if necessary */ @@ -1926,7 +1931,6 @@ static const struct cd_list_entry ide_cd_quirks_list[] = { { "MATSHITADVD-ROM SR-8186", NULL, IDE_CD_FLAG_PLAY_AUDIO_OK }, { "MATSHITADVD-ROM SR-8176", NULL, IDE_CD_FLAG_PLAY_AUDIO_OK }, { "MATSHITADVD-ROM SR-8174", NULL, IDE_CD_FLAG_PLAY_AUDIO_OK }, - { "Optiarc DVD RW AD-5200A", NULL, IDE_CD_FLAG_PLAY_AUDIO_OK }, { NULL, NULL, 0 } }; diff --git a/trunk/drivers/ide/ide-disk.c b/trunk/drivers/ide/ide-disk.c index 39501d130256..8f5bed471050 100644 --- a/trunk/drivers/ide/ide-disk.c +++ b/trunk/drivers/ide/ide-disk.c @@ -867,7 +867,7 @@ static void idedisk_setup (ide_drive_t *drive) /* Only print cache size when it was specified */ if (id->buf_size) - printk(KERN_CONT " w/%dKiB Cache", id->buf_size / 2); + printk (" w/%dKiB Cache", id->buf_size/2); printk(KERN_CONT ", CHS=%d/%d/%d\n", drive->bios_cyl, drive->bios_head, drive->bios_sect); @@ -949,8 +949,7 @@ static void ide_device_shutdown(ide_drive_t *drive) return; } - printk(KERN_INFO "Shutdown: %s\n", drive->name); - + printk("Shutdown: %s\n", drive->name); drive->gendev.bus->suspend(&drive->gendev, PMSG_SUSPEND); } diff --git a/trunk/drivers/ide/ide-dma.c b/trunk/drivers/ide/ide-dma.c index 2de99e4be5c9..d0e7b537353e 100644 --- a/trunk/drivers/ide/ide-dma.c +++ b/trunk/drivers/ide/ide-dma.c @@ -1,13 +1,9 @@ /* - * IDE DMA support (including IDE PCI BM-DMA). - * * Copyright (C) 1995-1998 Mark Lord * Copyright (C) 1999-2000 Andre Hedrick * Copyright (C) 2004, 2007 Bartlomiej Zolnierkiewicz * * May be copied or modified under the terms of the GNU General Public License - * - * DMA is supported for all IDE devices (disk drives, cdroms, tapes, floppies). */ /* @@ -15,6 +11,49 @@ */ /* + * This module provides support for the bus-master IDE DMA functions + * of various PCI chipsets, including the Intel PIIX (i82371FB for + * the 430 FX chipset), the PIIX3 (i82371SB for the 430 HX/VX and + * 440 chipsets), and the PIIX4 (i82371AB for the 430 TX chipset) + * ("PIIX" stands for "PCI ISA IDE Xcellerator"). + * + * Pretty much the same code works for other IDE PCI bus-mastering chipsets. + * + * DMA is supported for all IDE devices (disk drives, cdroms, tapes, floppies). + * + * By default, DMA support is prepared for use, but is currently enabled only + * for drives which already have DMA enabled (UltraDMA or mode 2 multi/single), + * or which are recognized as "good" (see table below). Drives with only mode0 + * or mode1 (multi/single) DMA should also work with this chipset/driver + * (eg. MC2112A) but are not enabled by default. + * + * Use "hdparm -i" to view modes supported by a given drive. + * + * The hdparm-3.5 (or later) utility can be used for manually enabling/disabling + * DMA support, but must be (re-)compiled against this kernel version or later. + * + * To enable DMA, use "hdparm -d1 /dev/hd?" on a per-drive basis after booting. + * If problems arise, ide.c will disable DMA operation after a few retries. + * This error recovery mechanism works and has been extremely well exercised. + * + * IDE drives, depending on their vintage, may support several different modes + * of DMA operation. The boot-time modes are indicated with a "*" in + * the "hdparm -i" listing, and can be changed with *knowledgeable* use of + * the "hdparm -X" feature. There is seldom a need to do this, as drives + * normally power-up with their "best" PIO/DMA modes enabled. + * + * Testing has been done with a rather extensive number of drives, + * with Quantum & Western Digital models generally outperforming the pack, + * and Fujitsu & Conner (and some Seagate which are really Conner) drives + * showing more lackluster throughput. + * + * Keep an eye on /var/adm/messages for "DMA disabled" messages. + * + * Some people have reported trouble with Intel Zappa motherboards. + * This can be fixed by upgrading the AMI BIOS to version 1.00.04.BS0, + * available from ftp://ftp.intel.com/pub/bios/10004bs0.exe + * (thanks to Glen Morrell for researching this). + * * Thanks to "Christopher J. Reimer" for * fixing the problem with the BIOS on some Acer motherboards. * @@ -26,6 +65,11 @@ * * Most importantly, thanks to Robert Bringman * for supplying a Promise UDMA board & WD UDMA drive for this work! + * + * And, yes, Intel Zappa boards really *do* use both PIIX IDE ports. + * + * ATA-66/100 and recovery functions, I forgot the rest...... + * */ #include diff --git a/trunk/drivers/ide/ide-probe.c b/trunk/drivers/ide/ide-probe.c index 194ecb0049eb..4a2cb2868226 100644 --- a/trunk/drivers/ide/ide-probe.c +++ b/trunk/drivers/ide/ide-probe.c @@ -756,8 +756,7 @@ static int ide_probe_port(ide_hwif_t *hwif) BUG_ON(hwif->present); - if (hwif->noprobe || - (hwif->drives[0].noprobe && hwif->drives[1].noprobe)) + if (hwif->noprobe) return -EACCES; /* diff --git a/trunk/drivers/ide/ide-tape.c b/trunk/drivers/ide/ide-tape.c index 43e0e0557776..0598ecfd5f37 100644 --- a/trunk/drivers/ide/ide-tape.c +++ b/trunk/drivers/ide/ide-tape.c @@ -3765,11 +3765,6 @@ static int ide_tape_probe(ide_drive_t *drive) g->fops = &idetape_block_ops; ide_register_region(g); - printk(KERN_WARNING "It is possible that this driver does not have any" - " users anymore and, as a result, it will be REMOVED soon." - " Please notify Bart or Boris" - " in case you still need it.\n"); - return 0; out_free_tape: diff --git a/trunk/drivers/ide/ide.c b/trunk/drivers/ide/ide.c index fa16bc30bbc9..477833f0daf5 100644 --- a/trunk/drivers/ide/ide.c +++ b/trunk/drivers/ide/ide.c @@ -590,6 +590,11 @@ void ide_unregister(unsigned int index, int init_default, int restore) hwif->extra_ports = 0; } + /* + * Note that we only release the standard ports, + * and do not even try to handle any extra ports + * allocated for weird IDE interface chipsets. + */ ide_hwif_release_regions(hwif); /* copy original settings */ @@ -1031,9 +1036,10 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device drive->nice1 = (arg >> IDE_NICE_1) & 1; return 0; case HDIO_DRIVE_RESET: - if (!capable(CAP_SYS_ADMIN)) - return -EACCES; - + { + unsigned long flags; + if (!capable(CAP_SYS_ADMIN)) return -EACCES; + /* * Abort the current command on the * group if there is one, taking @@ -1052,15 +1058,17 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device ide_abort(drive, "drive reset"); BUG_ON(HWGROUP(drive)->handler); - + /* Ensure nothing gets queued after we drop the lock. Reset will clear the busy */ - + HWGROUP(drive)->busy = 1; spin_unlock_irqrestore(&ide_lock, flags); (void) ide_do_reset(drive); return 0; + } + case HDIO_GET_BUSSTATE: if (!capable(CAP_SYS_ADMIN)) return -EACCES; @@ -1441,7 +1449,7 @@ static int __init ide_setup(char *s) case -1: /* "noprobe" */ hwif->noprobe = 1; - goto obsolete_option; + goto done; case 1: /* base */ vals[1] = vals[0] + 0x206; /* default ctl */ diff --git a/trunk/drivers/ide/legacy/qd65xx.c b/trunk/drivers/ide/legacy/qd65xx.c index 2f4f47ad602f..bba29df5f21d 100644 --- a/trunk/drivers/ide/legacy/qd65xx.c +++ b/trunk/drivers/ide/legacy/qd65xx.c @@ -334,6 +334,43 @@ static void __init qd6580_port_init_devs(ide_hwif_t *hwif) hwif->drives[1].drive_data = t2; } +/* + * qd_unsetup: + * + * called to unsetup an ata channel : back to default values, unlinks tuning + */ +/* +static void __exit qd_unsetup(ide_hwif_t *hwif) +{ + u8 config = hwif->config_data; + int base = hwif->select_data; + void *set_pio_mode = (void *)hwif->set_pio_mode; + + if (hwif->chipset != ide_qd65xx) + return; + + printk(KERN_NOTICE "%s: back to defaults\n", hwif->name); + + hwif->selectproc = NULL; + hwif->set_pio_mode = NULL; + + if (set_pio_mode == (void *)qd6500_set_pio_mode) { + // will do it for both + outb(QD6500_DEF_DATA, QD_TIMREG(&hwif->drives[0])); + } else if (set_pio_mode == (void *)qd6580_set_pio_mode) { + if (QD_CONTROL(hwif) & QD_CONTR_SEC_DISABLED) { + outb(QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0])); + outb(QD6580_DEF_DATA2, QD_TIMREG(&hwif->drives[1])); + } else { + outb(hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA, QD_TIMREG(&hwif->drives[0])); + } + } else { + printk(KERN_WARNING "Unknown qd65xx tuning fonction !\n"); + printk(KERN_WARNING "keeping settings !\n"); + } +} +*/ + static const struct ide_port_info qd65xx_port_info __initdata = { .chipset = ide_qd65xx, .host_flags = IDE_HFLAG_IO_32BIT | @@ -407,8 +444,6 @@ static int __init qd_probe(int base) printk(KERN_DEBUG "qd6580: config=%#x, control=%#x, ID3=%u\n", config, control, QD_ID3); - outb(QD_DEF_CONTR, QD_CONTROL_PORT); - if (control & QD_CONTR_SEC_DISABLED) { /* secondary disabled */ @@ -425,6 +460,8 @@ static int __init qd_probe(int base) ide_device_add(idx, &qd65xx_port_info); + outb(QD_DEF_CONTR, QD_CONTROL_PORT); + return 1; } else { ide_hwif_t *mate; @@ -450,6 +487,8 @@ static int __init qd_probe(int base) ide_device_add(idx, &qd65xx_port_info); + outb(QD_DEF_CONTR, QD_CONTROL_PORT); + return 0; /* no other qd65xx possible */ } } diff --git a/trunk/drivers/ide/pci/cmd640.c b/trunk/drivers/ide/pci/cmd640.c index ec667982809c..bd24dad3cfc6 100644 --- a/trunk/drivers/ide/pci/cmd640.c +++ b/trunk/drivers/ide/pci/cmd640.c @@ -787,8 +787,7 @@ static int __init cmd640x_init(void) /* * Try to enable the secondary interface, if not already enabled */ - if (cmd_hwif1->noprobe || - (cmd_hwif1->drives[0].noprobe && cmd_hwif1->drives[1].noprobe)) { + if (cmd_hwif1->noprobe) { port2 = "not probed"; } else { b = get_cmd640_reg(CNTRL); diff --git a/trunk/drivers/ide/pci/hpt366.c b/trunk/drivers/ide/pci/hpt366.c index 6357bb6269ab..d0f7bb8b8adf 100644 --- a/trunk/drivers/ide/pci/hpt366.c +++ b/trunk/drivers/ide/pci/hpt366.c @@ -1570,12 +1570,10 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic if (rev < 3) info = &hpt36x; else { - switch (min_t(u8, rev, 6)) { - case 3: info = &hpt370; break; - case 4: info = &hpt370a; break; - case 5: info = &hpt372; break; - case 6: info = &hpt372n; break; - } + static const struct hpt_info *hpt37x_info[] = + { &hpt370, &hpt370a, &hpt372, &hpt372n }; + + info = hpt37x_info[min_t(u8, rev, 6) - 3]; idx++; } break; @@ -1628,7 +1626,7 @@ static int __devinit hpt366_init_one(struct pci_dev *dev, const struct pci_devic return ide_setup_pci_device(dev, &d); } -static const struct pci_device_id hpt366_pci_tbl[] __devinitconst = { +static const struct pci_device_id hpt366_pci_tbl[] = { { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT366), 0 }, { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT372), 1 }, { PCI_VDEVICE(TTI, PCI_DEVICE_ID_TTI_HPT302), 2 }, diff --git a/trunk/drivers/ieee1394/sbp2.c b/trunk/drivers/ieee1394/sbp2.c index 9e2b1964d71a..28e155a9e2a5 100644 --- a/trunk/drivers/ieee1394/sbp2.c +++ b/trunk/drivers/ieee1394/sbp2.c @@ -183,9 +183,6 @@ MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device " * Avoids access beyond actual disk limits on devices with an off-by-one bug. * Don't use this with devices which don't have this bug. * - * - delay inquiry - * Wait extra SBP2_INQUIRY_DELAY seconds after login before SCSI inquiry. - * * - override internal blacklist * Instead of adding to the built-in blacklist, use only the workarounds * specified in the module load parameter. @@ -198,7 +195,6 @@ MODULE_PARM_DESC(workarounds, "Work around device bugs (default = 0" ", 36 byte inquiry = " __stringify(SBP2_WORKAROUND_INQUIRY_36) ", skip mode page 8 = " __stringify(SBP2_WORKAROUND_MODE_SENSE_8) ", fix capacity = " __stringify(SBP2_WORKAROUND_FIX_CAPACITY) - ", delay inquiry = " __stringify(SBP2_WORKAROUND_DELAY_INQUIRY) ", override internal blacklist = " __stringify(SBP2_WORKAROUND_OVERRIDE) ", or a combination)"); @@ -361,11 +357,6 @@ static const struct { .workarounds = SBP2_WORKAROUND_INQUIRY_36 | SBP2_WORKAROUND_MODE_SENSE_8, }, - /* DViCO Momobay FX-3A with TSB42AA9A bridge */ { - .firmware_revision = 0x002800, - .model_id = 0x000000, - .workarounds = SBP2_WORKAROUND_DELAY_INQUIRY, - }, /* Initio bridges, actually only needed for some older ones */ { .firmware_revision = 0x000200, .model_id = SBP2_ROM_VALUE_WILDCARD, @@ -923,9 +914,6 @@ static int sbp2_start_device(struct sbp2_lu *lu) sbp2_agent_reset(lu, 1); sbp2_max_speed_and_size(lu); - if (lu->workarounds & SBP2_WORKAROUND_DELAY_INQUIRY) - ssleep(SBP2_INQUIRY_DELAY); - error = scsi_add_device(lu->shost, 0, lu->ud->id, 0); if (error) { SBP2_ERR("scsi_add_device failed"); @@ -1974,9 +1962,6 @@ static int sbp2scsi_slave_alloc(struct scsi_device *sdev) { struct sbp2_lu *lu = (struct sbp2_lu *)sdev->host->hostdata[0]; - if (sdev->lun != 0 || sdev->id != lu->ud->id || sdev->channel != 0) - return -ENODEV; - lu->sdev = sdev; sdev->allow_restart = 1; diff --git a/trunk/drivers/ieee1394/sbp2.h b/trunk/drivers/ieee1394/sbp2.h index 80d8e097b065..d2ecb0d8a1bb 100644 --- a/trunk/drivers/ieee1394/sbp2.h +++ b/trunk/drivers/ieee1394/sbp2.h @@ -343,8 +343,6 @@ enum sbp2lu_state_types { #define SBP2_WORKAROUND_INQUIRY_36 0x2 #define SBP2_WORKAROUND_MODE_SENSE_8 0x4 #define SBP2_WORKAROUND_FIX_CAPACITY 0x8 -#define SBP2_WORKAROUND_DELAY_INQUIRY 0x10 -#define SBP2_INQUIRY_DELAY 12 #define SBP2_WORKAROUND_OVERRIDE 0x100 #endif /* SBP2_H */ diff --git a/trunk/drivers/infiniband/hw/cxgb3/iwch_mem.c b/trunk/drivers/infiniband/hw/cxgb3/iwch_mem.c index b8797c66676d..73bfd1656f86 100644 --- a/trunk/drivers/infiniband/hw/cxgb3/iwch_mem.c +++ b/trunk/drivers/infiniband/hw/cxgb3/iwch_mem.c @@ -136,8 +136,14 @@ int build_phys_page_list(struct ib_phys_buf *buffer_list, /* Find largest page shift we can use to cover buffers */ for (*shift = PAGE_SHIFT; *shift < 27; ++(*shift)) - if ((1ULL << *shift) & mask) - break; + if (num_phys_buf > 1) { + if ((1ULL << *shift) & mask) + break; + } else + if (1ULL << *shift >= + buffer_list[0].size + + (buffer_list[0].addr & ((1ULL << *shift) - 1))) + break; buffer_list[0].size += buffer_list[0].addr & ((1ULL << *shift) - 1); buffer_list[0].addr &= ~0ull << *shift; diff --git a/trunk/drivers/infiniband/hw/nes/nes.c b/trunk/drivers/infiniband/hw/nes/nes.c index b2112f5a422f..7f8853b44ee1 100644 --- a/trunk/drivers/infiniband/hw/nes/nes.c +++ b/trunk/drivers/infiniband/hw/nes/nes.c @@ -567,12 +567,12 @@ static int __devinit nes_probe(struct pci_dev *pcidev, const struct pci_device_i /* Init the adapter */ nesdev->nesadapter = nes_init_adapter(nesdev, hw_rev); + nesdev->nesadapter->et_rx_coalesce_usecs_irq = interrupt_mod_interval; if (!nesdev->nesadapter) { printk(KERN_ERR PFX "Unable to initialize adapter.\n"); ret = -ENOMEM; goto bail5; } - nesdev->nesadapter->et_rx_coalesce_usecs_irq = interrupt_mod_interval; /* nesdev->base_doorbell_index = nesdev->nesadapter->pd_config_base[PCI_FUNC(nesdev->pcidev->devfn)]; */ diff --git a/trunk/drivers/infiniband/hw/nes/nes.h b/trunk/drivers/infiniband/hw/nes/nes.h index a48b288618ec..fd57e8a1582f 100644 --- a/trunk/drivers/infiniband/hw/nes/nes.h +++ b/trunk/drivers/infiniband/hw/nes/nes.h @@ -285,21 +285,6 @@ struct nes_device { }; -static inline __le32 get_crc_value(struct nes_v4_quad *nes_quad) -{ - u32 crc_value; - crc_value = crc32c(~0, (void *)nes_quad, sizeof (struct nes_v4_quad)); - - /* - * With commit ef19454b ("[LIB] crc32c: Keep intermediate crc - * state in cpu order"), behavior of crc32c changes on - * big-endian platforms. Our algorithm expects the previous - * behavior; otherwise we have RDMA connection establishment - * issue on big-endian. - */ - return cpu_to_le32(crc_value); -} - static inline void set_wqe_64bit_value(__le32 *wqe_words, u32 index, u64 value) { diff --git a/trunk/drivers/infiniband/hw/nes/nes_cm.c b/trunk/drivers/infiniband/hw/nes/nes_cm.c index 39adb267fb15..bd5cfeaac203 100644 --- a/trunk/drivers/infiniband/hw/nes/nes_cm.c +++ b/trunk/drivers/infiniband/hw/nes/nes_cm.c @@ -370,11 +370,11 @@ int schedule_nes_timer(struct nes_cm_node *cm_node, struct sk_buff *skb, int ret = 0; u32 was_timer_set; - if (!cm_node) - return -EINVAL; new_send = kzalloc(sizeof(*new_send), GFP_ATOMIC); if (!new_send) return -1; + if (!cm_node) + return -EINVAL; /* new_send->timetosend = currenttime */ new_send->retrycount = NES_DEFAULT_RETRYS; @@ -947,7 +947,6 @@ static int mini_cm_dec_refcnt_listen(struct nes_cm_core *cm_core, nes_debug(NES_DBG_CM, "destroying listener (%p)\n", listener); kfree(listener); - listener = NULL; ret = 0; cm_listens_destroyed++; } else { @@ -2320,7 +2319,6 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) struct iw_cm_event cm_event; struct nes_hw_qp_wqe *wqe; struct nes_v4_quad nes_quad; - u32 crc_value; int ret; ibqp = nes_get_qp(cm_id->device, conn_param->qpn); @@ -2437,8 +2435,8 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param) nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port; /* Produce hash key */ - crc_value = get_crc_value(&nes_quad); - nesqp->hte_index = cpu_to_be32(crc_value ^ 0xffffffff); + nesqp->hte_index = cpu_to_be32( + crc32c(~0, (void *)&nes_quad, sizeof(nes_quad)) ^ 0xffffffff); nes_debug(NES_DBG_CM, "HTE Index = 0x%08X, CRC = 0x%08X\n", nesqp->hte_index, nesqp->hte_index & adapter->hte_index_mask); @@ -2752,7 +2750,6 @@ void cm_event_connected(struct nes_cm_event *event) struct iw_cm_event cm_event; struct nes_hw_qp_wqe *wqe; struct nes_v4_quad nes_quad; - u32 crc_value; int ret; /* get all our handles */ @@ -2830,8 +2827,8 @@ void cm_event_connected(struct nes_cm_event *event) nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port; /* Produce hash key */ - crc_value = get_crc_value(&nes_quad); - nesqp->hte_index = cpu_to_be32(crc_value ^ 0xffffffff); + nesqp->hte_index = cpu_to_be32( + crc32c(~0, (void *)&nes_quad, sizeof(nes_quad)) ^ 0xffffffff); nes_debug(NES_DBG_CM, "HTE Index = 0x%08X, After CRC = 0x%08X\n", nesqp->hte_index, nesqp->hte_index & nesadapter->hte_index_mask); diff --git a/trunk/drivers/infiniband/hw/nes/nes_hw.c b/trunk/drivers/infiniband/hw/nes/nes_hw.c index 49e53e4c1ebe..7c4c0fbf0abd 100644 --- a/trunk/drivers/infiniband/hw/nes/nes_hw.c +++ b/trunk/drivers/infiniband/hw/nes/nes_hw.c @@ -156,14 +156,15 @@ static void nes_nic_tune_timer(struct nes_device *nesdev) spin_lock_irqsave(&nesadapter->periodic_timer_lock, flags); - if (shared_timer->cq_count_old <= cq_count) - shared_timer->cq_direction_downward = 0; - else + if (shared_timer->cq_count_old < cq_count) { + if (cq_count > shared_timer->threshold_low) + shared_timer->cq_direction_downward=0; + } + if (shared_timer->cq_count_old >= cq_count) shared_timer->cq_direction_downward++; shared_timer->cq_count_old = cq_count; if (shared_timer->cq_direction_downward > NES_NIC_CQ_DOWNWARD_TREND) { - if (cq_count <= shared_timer->threshold_low && - shared_timer->threshold_low > 4) { + if (cq_count <= shared_timer->threshold_low) { shared_timer->threshold_low = shared_timer->threshold_low/2; shared_timer->cq_direction_downward=0; nesdev->currcq_count = 0; @@ -1727,6 +1728,7 @@ int nes_napi_isr(struct nes_device *nesdev) nesdev->int_req &= ~NES_INT_TIMER; nes_write32(nesdev->regs+NES_INTF_INT_MASK, ~(nesdev->intf_int_req)); nes_write32(nesdev->regs+NES_INT_MASK, ~nesdev->int_req); + nesadapter->tune_timer.timer_in_use_old = 0; } nesdev->deepcq_count = 0; return 1; @@ -1865,6 +1867,7 @@ void nes_dpc(unsigned long param) nesdev->int_req &= ~NES_INT_TIMER; nes_write32(nesdev->regs + NES_INTF_INT_MASK, ~(nesdev->intf_int_req)); nes_write32(nesdev->regs+NES_INT_MASK, ~nesdev->int_req); + nesdev->nesadapter->tune_timer.timer_in_use_old = 0; } else { nes_write32(nesdev->regs+NES_INT_MASK, 0x0000ffff|(~nesdev->int_req)); } diff --git a/trunk/drivers/infiniband/hw/nes/nes_hw.h b/trunk/drivers/infiniband/hw/nes/nes_hw.h index b7e2844f096b..1e10df550c9e 100644 --- a/trunk/drivers/infiniband/hw/nes/nes_hw.h +++ b/trunk/drivers/infiniband/hw/nes/nes_hw.h @@ -962,7 +962,7 @@ struct nes_arp_entry { #define DEFAULT_JUMBO_NES_QL_LOW 12 #define DEFAULT_JUMBO_NES_QL_TARGET 40 #define DEFAULT_JUMBO_NES_QL_HIGH 128 -#define NES_NIC_CQ_DOWNWARD_TREND 16 +#define NES_NIC_CQ_DOWNWARD_TREND 8 struct nes_hw_tune_timer { //u16 cq_count; diff --git a/trunk/drivers/infiniband/hw/nes/nes_verbs.c b/trunk/drivers/infiniband/hw/nes/nes_verbs.c index a651e9d9f0ef..4dafbe16e82a 100644 --- a/trunk/drivers/infiniband/hw/nes/nes_verbs.c +++ b/trunk/drivers/infiniband/hw/nes/nes_verbs.c @@ -929,7 +929,7 @@ static struct ib_pd *nes_alloc_pd(struct ib_device *ibdev, NES_MAX_USER_DB_REGIONS, nesucontext->first_free_db); nes_debug(NES_DBG_PD, "find_first_zero_biton doorbells returned %u, mapping pd_id %u.\n", nespd->mmap_db_index, nespd->pd_id); - if (nespd->mmap_db_index >= NES_MAX_USER_DB_REGIONS) { + if (nespd->mmap_db_index > NES_MAX_USER_DB_REGIONS) { nes_debug(NES_DBG_PD, "mmap_db_index > MAX\n"); nes_free_resource(nesadapter, nesadapter->allocated_pds, pd_num); kfree(nespd); @@ -1327,7 +1327,7 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd, (long long unsigned int)req.user_wqe_buffers); nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num); kfree(nesqp->allocated_buffer); - return ERR_PTR(-EFAULT); + return ERR_PTR(-ENOMEM); } } @@ -1674,7 +1674,6 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, } nes_debug(NES_DBG_CQ, "CQ Virtual Address = %08lX, size = %u.\n", (unsigned long)req.user_cq_buffer, entries); - err = 1; list_for_each_entry(nespbl, &nes_ucontext->cq_reg_mem_list, list) { if (nespbl->user_base == (unsigned long )req.user_cq_buffer) { list_del(&nespbl->list); @@ -1687,7 +1686,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, if (err) { nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); kfree(nescq); - return ERR_PTR(-EFAULT); + return ERR_PTR(err); } pbl_entries = nespbl->pbl_size >> 3; @@ -1832,6 +1831,9 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, spin_unlock_irqrestore(&nesdev->cqp.lock, flags); } } + nes_debug(NES_DBG_CQ, "iWARP CQ%u create timeout expired, major code = 0x%04X," + " minor code = 0x%04X\n", + nescq->hw_cq.cq_number, cqp_request->major_code, cqp_request->minor_code); if (!context) pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem, nescq->hw_cq.cq_pbase); diff --git a/trunk/fs/ext4/dir.c b/trunk/fs/ext4/dir.c index 2c23bade9aa6..33888bb58144 100644 --- a/trunk/fs/ext4/dir.c +++ b/trunk/fs/ext4/dir.c @@ -46,7 +46,7 @@ const struct file_operations ext4_dir_operations = { #ifdef CONFIG_COMPAT .compat_ioctl = ext4_compat_ioctl, #endif - .fsync = ext4_sync_file, + .fsync = ext4_sync_file, /* BKL held */ .release = ext4_release_dir, }; diff --git a/trunk/fs/ext4/extents.c b/trunk/fs/ext4/extents.c index 9ae6e67090cd..bc7081f1fbe8 100644 --- a/trunk/fs/ext4/extents.c +++ b/trunk/fs/ext4/extents.c @@ -148,7 +148,6 @@ static ext4_fsblk_t ext4_ext_find_goal(struct inode *inode, { struct ext4_inode_info *ei = EXT4_I(inode); ext4_fsblk_t bg_start; - ext4_fsblk_t last_block; ext4_grpblk_t colour; int depth; @@ -170,13 +169,8 @@ static ext4_fsblk_t ext4_ext_find_goal(struct inode *inode, /* OK. use inode's group */ bg_start = (ei->i_block_group * EXT4_BLOCKS_PER_GROUP(inode->i_sb)) + le32_to_cpu(EXT4_SB(inode->i_sb)->s_es->s_first_data_block); - last_block = ext4_blocks_count(EXT4_SB(inode->i_sb)->s_es) - 1; - - if (bg_start + EXT4_BLOCKS_PER_GROUP(inode->i_sb) <= last_block) - colour = (current->pid % 16) * + colour = (current->pid % 16) * (EXT4_BLOCKS_PER_GROUP(inode->i_sb) / 16); - else - colour = (current->pid % 16) * ((last_block - bg_start) / 16); return bg_start + colour + block; } @@ -355,7 +349,7 @@ static void ext4_ext_show_leaf(struct inode *inode, struct ext4_ext_path *path) #define ext4_ext_show_leaf(inode,path) #endif -void ext4_ext_drop_refs(struct ext4_ext_path *path) +static void ext4_ext_drop_refs(struct ext4_ext_path *path) { int depth = path->p_depth; int i; @@ -2174,10 +2168,6 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, newblock = iblock - ee_block + ext_pblock(ex); ex2 = ex; - err = ext4_ext_get_access(handle, inode, path + depth); - if (err) - goto out; - /* ex1: ee_block to iblock - 1 : uninitialized */ if (iblock > ee_block) { ex1 = ex; @@ -2210,20 +2200,16 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, newdepth = ext_depth(inode); if (newdepth != depth) { depth = newdepth; - ext4_ext_drop_refs(path); - path = ext4_ext_find_extent(inode, iblock, path); + path = ext4_ext_find_extent(inode, iblock, NULL); if (IS_ERR(path)) { err = PTR_ERR(path); + path = NULL; goto out; } eh = path[depth].p_hdr; ex = path[depth].p_ext; if (ex2 != &newex) ex2 = ex; - - err = ext4_ext_get_access(handle, inode, path + depth); - if (err) - goto out; } allocated = max_blocks; } @@ -2244,6 +2230,9 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, ex2->ee_len = cpu_to_le16(allocated); if (ex2 != ex) goto insert; + err = ext4_ext_get_access(handle, inode, path + depth); + if (err) + goto out; /* * New (initialized) extent starts from the first block * in the current extent. i.e., ex2 == ex @@ -2287,22 +2276,9 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, } /* - * Block allocation/map/preallocation routine for extents based files - * - * * Need to be called with * down_read(&EXT4_I(inode)->i_data_sem) if not allocating file system block * (ie, create is zero). Otherwise down_write(&EXT4_I(inode)->i_data_sem) - * - * return > 0, number of of blocks already mapped/allocated - * if create == 0 and these are pre-allocated blocks - * buffer head is unmapped - * otherwise blocks are mapped - * - * return = 0, if plain look up failed (blocks have not been allocated) - * buffer head is unmapped - * - * return < 0, error case. */ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, ext4_lblk_t iblock, @@ -2647,7 +2623,7 @@ long ext4_fallocate(struct inode *inode, int mode, loff_t offset, loff_t len) * modify 1 super block, 1 block bitmap and 1 group descriptor. */ credits = EXT4_DATA_TRANS_BLOCKS(inode->i_sb) + 3; - mutex_lock(&inode->i_mutex); + down_write((&EXT4_I(inode)->i_data_sem)); retry: while (ret >= 0 && ret < max_blocks) { block = block + ret; @@ -2658,17 +2634,16 @@ long ext4_fallocate(struct inode *inode, int mode, loff_t offset, loff_t len) break; } - ret = ext4_get_blocks_wrap(handle, inode, block, + ret = ext4_ext_get_blocks(handle, inode, block, max_blocks, &map_bh, EXT4_CREATE_UNINITIALIZED_EXT, 0); + WARN_ON(ret <= 0); if (ret <= 0) { -#ifdef EXT4FS_DEBUG - WARN_ON(ret <= 0); - printk(KERN_ERR "%s: ext4_ext_get_blocks " - "returned error inode#%lu, block=%u, " - "max_blocks=%lu", __func__, + ext4_error(inode->i_sb, "ext4_fallocate", + "ext4_ext_get_blocks returned error: " + "inode#%lu, block=%u, max_blocks=%lu", inode->i_ino, block, max_blocks); -#endif + ret = -EIO; ext4_mark_inode_dirty(handle, inode); ret2 = ext4_journal_stop(handle); break; @@ -2705,6 +2680,7 @@ long ext4_fallocate(struct inode *inode, int mode, loff_t offset, loff_t len) if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) goto retry; + up_write((&EXT4_I(inode)->i_data_sem)); /* * Time to update the file size. * Update only when preallocation was requested beyond the file size. @@ -2716,18 +2692,21 @@ long ext4_fallocate(struct inode *inode, int mode, loff_t offset, loff_t len) * if no error, we assume preallocation succeeded * completely */ + mutex_lock(&inode->i_mutex); i_size_write(inode, offset + len); EXT4_I(inode)->i_disksize = i_size_read(inode); + mutex_unlock(&inode->i_mutex); } else if (ret < 0 && nblocks) { /* Handle partial allocation scenario */ loff_t newsize; + mutex_lock(&inode->i_mutex); newsize = (nblocks << blkbits) + i_size_read(inode); i_size_write(inode, EXT4_BLOCK_ALIGN(newsize, blkbits)); EXT4_I(inode)->i_disksize = i_size_read(inode); + mutex_unlock(&inode->i_mutex); } } - mutex_unlock(&inode->i_mutex); return ret > 0 ? ret2 : ret; } diff --git a/trunk/fs/ext4/ialloc.c b/trunk/fs/ext4/ialloc.c index 8036b9b5376b..da18a74b966a 100644 --- a/trunk/fs/ext4/ialloc.c +++ b/trunk/fs/ext4/ialloc.c @@ -702,12 +702,7 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode * dir, int mode) ei->i_dir_start_lookup = 0; ei->i_disksize = 0; - /* - * Don't inherit extent flag from directory. We set extent flag on - * newly created directory and file only if -o extent mount option is - * specified - */ - ei->i_flags = EXT4_I(dir)->i_flags & ~(EXT4_INDEX_FL|EXT4_EXTENTS_FL); + ei->i_flags = EXT4_I(dir)->i_flags & ~EXT4_INDEX_FL; if (S_ISLNK(mode)) ei->i_flags &= ~(EXT4_IMMUTABLE_FL|EXT4_APPEND_FL); /* dirsync only applies to directories */ @@ -750,15 +745,12 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode * dir, int mode) goto fail_free_drop; } if (test_opt(sb, EXTENTS)) { - /* set extent flag only for directory and file */ - if (S_ISDIR(mode) || S_ISREG(mode)) { - EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL; - ext4_ext_tree_init(handle, inode); - err = ext4_update_incompat_feature(handle, sb, - EXT4_FEATURE_INCOMPAT_EXTENTS); - if (err) - goto fail; - } + EXT4_I(inode)->i_flags |= EXT4_EXTENTS_FL; + ext4_ext_tree_init(handle, inode); + err = ext4_update_incompat_feature(handle, sb, + EXT4_FEATURE_INCOMPAT_EXTENTS); + if (err) + goto fail; } ext4_debug("allocating inode %lu\n", inode->i_ino); diff --git a/trunk/fs/ext4/inode.c b/trunk/fs/ext4/inode.c index 945cbf6cb1fc..7dd9b50d5ebc 100644 --- a/trunk/fs/ext4/inode.c +++ b/trunk/fs/ext4/inode.c @@ -403,7 +403,6 @@ static ext4_fsblk_t ext4_find_near(struct inode *inode, Indirect *ind) __le32 *start = ind->bh ? (__le32*) ind->bh->b_data : ei->i_data; __le32 *p; ext4_fsblk_t bg_start; - ext4_fsblk_t last_block; ext4_grpblk_t colour; /* Try to find previous block */ @@ -421,13 +420,8 @@ static ext4_fsblk_t ext4_find_near(struct inode *inode, Indirect *ind) * into the same cylinder group then. */ bg_start = ext4_group_first_block_no(inode->i_sb, ei->i_block_group); - last_block = ext4_blocks_count(EXT4_SB(inode->i_sb)->s_es) - 1; - - if (bg_start + EXT4_BLOCKS_PER_GROUP(inode->i_sb) <= last_block) - colour = (current->pid % 16) * + colour = (current->pid % 16) * (EXT4_BLOCKS_PER_GROUP(inode->i_sb) / 16); - else - colour = (current->pid % 16) * ((last_block - bg_start) / 16); return bg_start + colour; } @@ -774,6 +768,7 @@ static int ext4_splice_branch(handle_t *handle, struct inode *inode, * * `handle' can be NULL if create == 0. * + * The BKL may not be held on entry here. Be sure to take it early. * return > 0, # of blocks mapped or allocated. * return = 0, if plain lookup failed. * return < 0, error case. @@ -908,38 +903,11 @@ int ext4_get_blocks_handle(handle_t *handle, struct inode *inode, */ #define DIO_CREDITS 25 - -/* - * - * - * ext4_ext4 get_block() wrapper function - * It will do a look up first, and returns if the blocks already mapped. - * Otherwise it takes the write lock of the i_data_sem and allocate blocks - * and store the allocated blocks in the result buffer head and mark it - * mapped. - * - * If file type is extents based, it will call ext4_ext_get_blocks(), - * Otherwise, call with ext4_get_blocks_handle() to handle indirect mapping - * based files - * - * On success, it returns the number of blocks being mapped or allocate. - * if create==0 and the blocks are pre-allocated and uninitialized block, - * the result buffer head is unmapped. If the create ==1, it will make sure - * the buffer head is mapped. - * - * It returns 0 if plain look up failed (blocks have not been allocated), in - * that casem, buffer head is unmapped - * - * It returns the error in case of allocation failure. - */ int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block, unsigned long max_blocks, struct buffer_head *bh, int create, int extend_disksize) { int retval; - - clear_buffer_mapped(bh); - /* * Try to see if we can get the block without requesting * for new file system block. @@ -953,26 +921,12 @@ int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block, inode, block, max_blocks, bh, 0, 0); } up_read((&EXT4_I(inode)->i_data_sem)); - - /* If it is only a block(s) look up */ - if (!create) - return retval; - - /* - * Returns if the blocks have already allocated - * - * Note that if blocks have been preallocated - * ext4_ext_get_block() returns th create = 0 - * with buffer head unmapped. - */ - if (retval > 0 && buffer_mapped(bh)) + if (!create || (retval > 0)) return retval; /* - * New blocks allocate and/or writing to uninitialized extent - * will possibly result in updating i_data, so we take - * the write lock of i_data_sem, and call get_blocks() - * with create == 1 flag. + * We need to allocate new blocks which will result + * in i_data update */ down_write((&EXT4_I(inode)->i_data_sem)); /* diff --git a/trunk/fs/ext4/mballoc.c b/trunk/fs/ext4/mballoc.c index ef97f19c2f9d..dd0fcfcb35ce 100644 --- a/trunk/fs/ext4/mballoc.c +++ b/trunk/fs/ext4/mballoc.c @@ -627,19 +627,21 @@ static ext4_fsblk_t ext4_grp_offs_to_block(struct super_block *sb, return block; } -static inline void *mb_correct_addr_and_bit(int *bit, void *addr) -{ #if BITS_PER_LONG == 64 - *bit += ((unsigned long) addr & 7UL) << 3; - addr = (void *) ((unsigned long) addr & ~7UL); +#define mb_correct_addr_and_bit(bit, addr) \ +{ \ + bit += ((unsigned long) addr & 7UL) << 3; \ + addr = (void *) ((unsigned long) addr & ~7UL); \ +} #elif BITS_PER_LONG == 32 - *bit += ((unsigned long) addr & 3UL) << 3; - addr = (void *) ((unsigned long) addr & ~3UL); +#define mb_correct_addr_and_bit(bit, addr) \ +{ \ + bit += ((unsigned long) addr & 3UL) << 3; \ + addr = (void *) ((unsigned long) addr & ~3UL); \ +} #else #error "how many bits you are?!" #endif - return addr; -} static inline int mb_test_bit(int bit, void *addr) { @@ -647,54 +649,34 @@ static inline int mb_test_bit(int bit, void *addr) * ext4_test_bit on architecture like powerpc * needs unsigned long aligned address */ - addr = mb_correct_addr_and_bit(&bit, addr); + mb_correct_addr_and_bit(bit, addr); return ext4_test_bit(bit, addr); } static inline void mb_set_bit(int bit, void *addr) { - addr = mb_correct_addr_and_bit(&bit, addr); + mb_correct_addr_and_bit(bit, addr); ext4_set_bit(bit, addr); } static inline void mb_set_bit_atomic(spinlock_t *lock, int bit, void *addr) { - addr = mb_correct_addr_and_bit(&bit, addr); + mb_correct_addr_and_bit(bit, addr); ext4_set_bit_atomic(lock, bit, addr); } static inline void mb_clear_bit(int bit, void *addr) { - addr = mb_correct_addr_and_bit(&bit, addr); + mb_correct_addr_and_bit(bit, addr); ext4_clear_bit(bit, addr); } static inline void mb_clear_bit_atomic(spinlock_t *lock, int bit, void *addr) { - addr = mb_correct_addr_and_bit(&bit, addr); + mb_correct_addr_and_bit(bit, addr); ext4_clear_bit_atomic(lock, bit, addr); } -static inline int mb_find_next_zero_bit(void *addr, int max, int start) -{ - int fix = 0; - addr = mb_correct_addr_and_bit(&fix, addr); - max += fix; - start += fix; - - return ext4_find_next_zero_bit(addr, max, start) - fix; -} - -static inline int mb_find_next_bit(void *addr, int max, int start) -{ - int fix = 0; - addr = mb_correct_addr_and_bit(&fix, addr); - max += fix; - start += fix; - - return ext4_find_next_bit(addr, max, start) - fix; -} - static void *mb_find_buddy(struct ext4_buddy *e4b, int order, int *max) { char *bb; @@ -924,7 +906,7 @@ static void ext4_mb_mark_free_simple(struct super_block *sb, unsigned short chunk; unsigned short border; - BUG_ON(len > EXT4_BLOCKS_PER_GROUP(sb)); + BUG_ON(len >= EXT4_BLOCKS_PER_GROUP(sb)); border = 2 << sb->s_blocksize_bits; @@ -964,12 +946,12 @@ static void ext4_mb_generate_buddy(struct super_block *sb, /* initialize buddy from bitmap which is aggregation * of on-disk bitmap and preallocations */ - i = mb_find_next_zero_bit(bitmap, max, 0); + i = ext4_find_next_zero_bit(bitmap, max, 0); grp->bb_first_free = i; while (i < max) { fragments++; first = i; - i = mb_find_next_bit(bitmap, max, i); + i = ext4_find_next_bit(bitmap, max, i); len = i - first; free += len; if (len > 1) @@ -977,7 +959,7 @@ static void ext4_mb_generate_buddy(struct super_block *sb, else grp->bb_counters[0]++; if (i < max) - i = mb_find_next_zero_bit(bitmap, max, i); + i = ext4_find_next_zero_bit(bitmap, max, i); } grp->bb_fragments = fragments; @@ -985,10 +967,6 @@ static void ext4_mb_generate_buddy(struct super_block *sb, ext4_error(sb, __FUNCTION__, "EXT4-fs: group %lu: %u blocks in bitmap, %u in gd\n", group, free, grp->bb_free); - /* - * If we intent to continue, we consider group descritor - * corrupt and update bb_free using bitmap value - */ grp->bb_free = free; } @@ -1800,7 +1778,7 @@ static void ext4_mb_simple_scan_group(struct ext4_allocation_context *ac, buddy = mb_find_buddy(e4b, i, &max); BUG_ON(buddy == NULL); - k = mb_find_next_zero_bit(buddy, max, 0); + k = ext4_find_next_zero_bit(buddy, max, 0); BUG_ON(k >= max); ac->ac_found++; @@ -1840,11 +1818,11 @@ static void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, i = e4b->bd_info->bb_first_free; while (free && ac->ac_status == AC_STATUS_CONTINUE) { - i = mb_find_next_zero_bit(bitmap, + i = ext4_find_next_zero_bit(bitmap, EXT4_BLOCKS_PER_GROUP(sb), i); if (i >= EXT4_BLOCKS_PER_GROUP(sb)) { /* - * IF we have corrupt bitmap, we won't find any + * IF we corrupt the bitmap we won't find any * free blocks even though group info says we * we have free blocks */ @@ -1860,12 +1838,6 @@ static void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, ext4_error(sb, __FUNCTION__, "%d free blocks as per " "group info. But got %d blocks\n", free, ex.fe_len); - /* - * The number of free blocks differs. This mostly - * indicate that the bitmap is corrupt. So exit - * without claiming the space. - */ - break; } ext4_mb_measure_extent(ac, &ex, e4b); @@ -3768,10 +3740,10 @@ static int ext4_mb_release_inode_pa(struct ext4_buddy *e4b, } while (bit < end) { - bit = mb_find_next_zero_bit(bitmap_bh->b_data, end, bit); + bit = ext4_find_next_zero_bit(bitmap_bh->b_data, end, bit); if (bit >= end) break; - next = mb_find_next_bit(bitmap_bh->b_data, end, bit); + next = ext4_find_next_bit(bitmap_bh->b_data, end, bit); if (next > end) next = end; start = group * EXT4_BLOCKS_PER_GROUP(sb) + bit + @@ -3799,10 +3771,6 @@ static int ext4_mb_release_inode_pa(struct ext4_buddy *e4b, (unsigned long) pa->pa_len); ext4_error(sb, __FUNCTION__, "free %u, pa_free %u\n", free, pa->pa_free); - /* - * pa is already deleted so we use the value obtained - * from the bitmap and continue. - */ } atomic_add(free, &sbi->s_mb_discarded); if (ac) diff --git a/trunk/fs/ext4/migrate.c b/trunk/fs/ext4/migrate.c index 5c1e27de7755..8c6c685b9d22 100644 --- a/trunk/fs/ext4/migrate.c +++ b/trunk/fs/ext4/migrate.c @@ -43,7 +43,6 @@ static int finish_range(handle_t *handle, struct inode *inode, if (IS_ERR(path)) { retval = PTR_ERR(path); - path = NULL; goto err_out; } @@ -75,10 +74,6 @@ static int finish_range(handle_t *handle, struct inode *inode, } retval = ext4_ext_insert_extent(handle, inode, path, &newext); err_out: - if (path) { - ext4_ext_drop_refs(path); - kfree(path); - } lb->first_pblock = 0; return retval; } diff --git a/trunk/fs/ext4/namei.c b/trunk/fs/ext4/namei.c index 28aa2ed4297e..a9347fb43bcc 100644 --- a/trunk/fs/ext4/namei.c +++ b/trunk/fs/ext4/namei.c @@ -1804,8 +1804,12 @@ static int ext4_mkdir(struct inode * dir, struct dentry * dentry, int mode) inode->i_fop = &ext4_dir_operations; inode->i_size = EXT4_I(inode)->i_disksize = inode->i_sb->s_blocksize; dir_block = ext4_bread (handle, inode, 0, 1, &err); - if (!dir_block) - goto out_clear_inode; + if (!dir_block) { + ext4_dec_count(handle, inode); /* is this nlink == 0? */ + ext4_mark_inode_dirty(handle, inode); + iput (inode); + goto out_stop; + } BUFFER_TRACE(dir_block, "get_write_access"); ext4_journal_get_write_access(handle, dir_block); de = (struct ext4_dir_entry_2 *) dir_block->b_data; @@ -1828,8 +1832,7 @@ static int ext4_mkdir(struct inode * dir, struct dentry * dentry, int mode) ext4_mark_inode_dirty(handle, inode); err = ext4_add_entry (handle, dentry, inode); if (err) { -out_clear_inode: - clear_nlink(inode); + inode->i_nlink = 0; ext4_mark_inode_dirty(handle, inode); iput (inode); goto out_stop; @@ -2161,7 +2164,7 @@ static int ext4_unlink(struct inode * dir, struct dentry *dentry) dir->i_ctime = dir->i_mtime = ext4_current_time(dir); ext4_update_dx_flag(dir); ext4_mark_inode_dirty(handle, dir); - drop_nlink(inode); + ext4_dec_count(handle, inode); if (!inode->i_nlink) ext4_orphan_add(handle, inode); inode->i_ctime = ext4_current_time(inode); @@ -2211,7 +2214,7 @@ static int ext4_symlink (struct inode * dir, err = __page_symlink(inode, symname, l, mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS); if (err) { - clear_nlink(inode); + ext4_dec_count(handle, inode); ext4_mark_inode_dirty(handle, inode); iput (inode); goto out_stop; @@ -2220,6 +2223,7 @@ static int ext4_symlink (struct inode * dir, inode->i_op = &ext4_fast_symlink_inode_operations; memcpy((char*)&EXT4_I(inode)->i_data,symname,l); inode->i_size = l-1; + EXT4_I(inode)->i_flags &= ~EXT4_EXTENTS_FL; } EXT4_I(inode)->i_disksize = inode->i_size; err = ext4_add_nondir(handle, dentry, inode); @@ -2403,7 +2407,7 @@ static int ext4_rename (struct inode * old_dir, struct dentry *old_dentry, ext4_dec_count(handle, old_dir); if (new_inode) { /* checked empty_dir above, can't have another parent, - * ext4_dec_count() won't work for many-linked dirs */ + * ext3_dec_count() won't work for many-linked dirs */ new_inode->i_nlink = 0; } else { ext4_inc_count(handle, new_dir); diff --git a/trunk/fs/ext4/resize.c b/trunk/fs/ext4/resize.c index e29efa0f9d62..9477a2bd6ff2 100644 --- a/trunk/fs/ext4/resize.c +++ b/trunk/fs/ext4/resize.c @@ -1037,7 +1037,6 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es, ext4_warning(sb, __FUNCTION__, "multiple resizers run on filesystem!"); unlock_super(sb); - ext4_journal_stop(handle); err = -EBUSY; goto exit_put; } diff --git a/trunk/fs/proc/base.c b/trunk/fs/proc/base.c index 91a1bd67ac1d..96ee899d6502 100644 --- a/trunk/fs/proc/base.c +++ b/trunk/fs/proc/base.c @@ -314,12 +314,9 @@ static int proc_pid_schedstat(struct task_struct *task, char *buffer) static int lstats_show_proc(struct seq_file *m, void *v) { int i; - struct inode *inode = m->private; - struct task_struct *task = get_proc_task(inode); - - if (!task) - return -ESRCH; + struct task_struct *task = m->private; seq_puts(m, "Latency Top version : v0.1\n"); + for (i = 0; i < 32; i++) { if (task->latency_record[i].backtrace[0]) { int q; @@ -344,24 +341,32 @@ static int lstats_show_proc(struct seq_file *m, void *v) } } - put_task_struct(task); return 0; } static int lstats_open(struct inode *inode, struct file *file) { - return single_open(file, lstats_show_proc, inode); + int ret; + struct seq_file *m; + struct task_struct *task = get_proc_task(inode); + + ret = single_open(file, lstats_show_proc, NULL); + if (!ret) { + m = file->private_data; + m->private = task; + } + return ret; } static ssize_t lstats_write(struct file *file, const char __user *buf, size_t count, loff_t *offs) { - struct task_struct *task = get_proc_task(file->f_dentry->d_inode); + struct seq_file *m; + struct task_struct *task; - if (!task) - return -ESRCH; + m = file->private_data; + task = m->private; clear_all_latency_tracing(task); - put_task_struct(task); return count; } diff --git a/trunk/fs/xfs/xfs_bit.c b/trunk/fs/xfs/xfs_bit.c index fab0b6d5a41b..48228848f5ae 100644 --- a/trunk/fs/xfs/xfs_bit.c +++ b/trunk/fs/xfs/xfs_bit.c @@ -25,109 +25,6 @@ * XFS bit manipulation routines, used in non-realtime code. */ -#ifndef HAVE_ARCH_HIGHBIT -/* - * Index of high bit number in byte, -1 for none set, 0..7 otherwise. - */ -static const char xfs_highbit[256] = { - -1, 0, 1, 1, 2, 2, 2, 2, /* 00 .. 07 */ - 3, 3, 3, 3, 3, 3, 3, 3, /* 08 .. 0f */ - 4, 4, 4, 4, 4, 4, 4, 4, /* 10 .. 17 */ - 4, 4, 4, 4, 4, 4, 4, 4, /* 18 .. 1f */ - 5, 5, 5, 5, 5, 5, 5, 5, /* 20 .. 27 */ - 5, 5, 5, 5, 5, 5, 5, 5, /* 28 .. 2f */ - 5, 5, 5, 5, 5, 5, 5, 5, /* 30 .. 37 */ - 5, 5, 5, 5, 5, 5, 5, 5, /* 38 .. 3f */ - 6, 6, 6, 6, 6, 6, 6, 6, /* 40 .. 47 */ - 6, 6, 6, 6, 6, 6, 6, 6, /* 48 .. 4f */ - 6, 6, 6, 6, 6, 6, 6, 6, /* 50 .. 57 */ - 6, 6, 6, 6, 6, 6, 6, 6, /* 58 .. 5f */ - 6, 6, 6, 6, 6, 6, 6, 6, /* 60 .. 67 */ - 6, 6, 6, 6, 6, 6, 6, 6, /* 68 .. 6f */ - 6, 6, 6, 6, 6, 6, 6, 6, /* 70 .. 77 */ - 6, 6, 6, 6, 6, 6, 6, 6, /* 78 .. 7f */ - 7, 7, 7, 7, 7, 7, 7, 7, /* 80 .. 87 */ - 7, 7, 7, 7, 7, 7, 7, 7, /* 88 .. 8f */ - 7, 7, 7, 7, 7, 7, 7, 7, /* 90 .. 97 */ - 7, 7, 7, 7, 7, 7, 7, 7, /* 98 .. 9f */ - 7, 7, 7, 7, 7, 7, 7, 7, /* a0 .. a7 */ - 7, 7, 7, 7, 7, 7, 7, 7, /* a8 .. af */ - 7, 7, 7, 7, 7, 7, 7, 7, /* b0 .. b7 */ - 7, 7, 7, 7, 7, 7, 7, 7, /* b8 .. bf */ - 7, 7, 7, 7, 7, 7, 7, 7, /* c0 .. c7 */ - 7, 7, 7, 7, 7, 7, 7, 7, /* c8 .. cf */ - 7, 7, 7, 7, 7, 7, 7, 7, /* d0 .. d7 */ - 7, 7, 7, 7, 7, 7, 7, 7, /* d8 .. df */ - 7, 7, 7, 7, 7, 7, 7, 7, /* e0 .. e7 */ - 7, 7, 7, 7, 7, 7, 7, 7, /* e8 .. ef */ - 7, 7, 7, 7, 7, 7, 7, 7, /* f0 .. f7 */ - 7, 7, 7, 7, 7, 7, 7, 7, /* f8 .. ff */ -}; -#endif - -/* - * xfs_highbit32: get high bit set out of 32-bit argument, -1 if none set. - */ -inline int -xfs_highbit32( - __uint32_t v) -{ -#ifdef HAVE_ARCH_HIGHBIT - return highbit32(v); -#else - int i; - - if (v & 0xffff0000) - if (v & 0xff000000) - i = 24; - else - i = 16; - else if (v & 0x0000ffff) - if (v & 0x0000ff00) - i = 8; - else - i = 0; - else - return -1; - return i + xfs_highbit[(v >> i) & 0xff]; -#endif -} - -/* - * xfs_lowbit64: get low bit set out of 64-bit argument, -1 if none set. - */ -int -xfs_lowbit64( - __uint64_t v) -{ - __uint32_t w = (__uint32_t)v; - int n = 0; - - if (w) { /* lower bits */ - n = ffs(w); - } else { /* upper bits */ - w = (__uint32_t)(v >> 32); - if (w && (n = ffs(w))) - n += 32; - } - return n - 1; -} - -/* - * xfs_highbit64: get high bit set out of 64-bit argument, -1 if none set. - */ -int -xfs_highbit64( - __uint64_t v) -{ - __uint32_t h = (__uint32_t)(v >> 32); - - if (h) - return xfs_highbit32(h) + 32; - return xfs_highbit32((__uint32_t)v); -} - - /* * Return whether bitmap is empty. * Size is number of words in the bitmap, which is padded to word boundary diff --git a/trunk/fs/xfs/xfs_bit.h b/trunk/fs/xfs/xfs_bit.h index 082641a9782c..325a007dec91 100644 --- a/trunk/fs/xfs/xfs_bit.h +++ b/trunk/fs/xfs/xfs_bit.h @@ -47,13 +47,30 @@ static inline __uint64_t xfs_mask64lo(int n) } /* Get high bit set out of 32-bit argument, -1 if none set */ -extern int xfs_highbit32(__uint32_t v); - -/* Get low bit set out of 64-bit argument, -1 if none set */ -extern int xfs_lowbit64(__uint64_t v); +static inline int xfs_highbit32(__uint32_t v) +{ + return fls(v) - 1; +} /* Get high bit set out of 64-bit argument, -1 if none set */ -extern int xfs_highbit64(__uint64_t); +static inline int xfs_highbit64(__uint64_t v) +{ + return fls64(v) - 1; +} + +/* Get low bit set out of 32-bit argument, -1 if none set */ +static inline int xfs_lowbit32(__uint32_t v) +{ + __uint32_t t = v; + return (t) ? find_first_bit((unsigned long *)&t, 32) : -1; +} + +/* Get low bit set out of 64-bit argument, -1 if none set */ +static inline int xfs_lowbit64(__uint64_t v) +{ + __uint64_t t = v; + return (t) ? find_first_bit((unsigned long *)&t, 64) : -1; +} /* Return whether bitmap is empty (1 == empty) */ extern int xfs_bitmap_empty(uint *map, uint size); diff --git a/trunk/fs/xfs/xfs_rtalloc.c b/trunk/fs/xfs/xfs_rtalloc.c index 47082c01872d..ca83ddf72af4 100644 --- a/trunk/fs/xfs/xfs_rtalloc.c +++ b/trunk/fs/xfs/xfs_rtalloc.c @@ -72,18 +72,6 @@ STATIC int xfs_rtmodify_summary(xfs_mount_t *, xfs_trans_t *, int, * Internal functions. */ -/* - * xfs_lowbit32: get low bit set out of 32-bit argument, -1 if none set. - */ -STATIC int -xfs_lowbit32( - __uint32_t v) -{ - if (v) - return ffs(v) - 1; - return -1; -} - /* * Allocate space to the bitmap or summary file, and zero it, for growfs. */ @@ -444,6 +432,7 @@ xfs_rtallocate_extent_near( } bbno = XFS_BITTOBLOCK(mp, bno); i = 0; + ASSERT(minlen != 0); log2len = xfs_highbit32(minlen); /* * Loop over all bitmap blocks (bbno + i is current block). @@ -612,6 +601,8 @@ xfs_rtallocate_extent_size( xfs_suminfo_t sum; /* summary information for extents */ ASSERT(minlen % prod == 0 && maxlen % prod == 0); + ASSERT(maxlen != 0); + /* * Loop over all the levels starting with maxlen. * At each level, look at all the bitmap blocks, to see if there @@ -669,6 +660,9 @@ xfs_rtallocate_extent_size( *rtblock = NULLRTBLOCK; return 0; } + ASSERT(minlen != 0); + ASSERT(maxlen != 0); + /* * Loop over sizes, from maxlen down to minlen. * This time, when we do the allocations, allow smaller ones @@ -1954,6 +1948,7 @@ xfs_growfs_rt( nsbp->sb_blocksize * nsbp->sb_rextsize); nsbp->sb_rextents = nsbp->sb_rblocks; do_div(nsbp->sb_rextents, nsbp->sb_rextsize); + ASSERT(nsbp->sb_rextents != 0); nsbp->sb_rextslog = xfs_highbit32(nsbp->sb_rextents); nrsumlevels = nmp->m_rsumlevels = nsbp->sb_rextslog + 1; nrsumsize = diff --git a/trunk/include/asm-mips/mach-db1x00/db1200.h b/trunk/include/asm-mips/mach-db1x00/db1200.h index a6bdac61ab49..050eae87ff01 100644 --- a/trunk/include/asm-mips/mach-db1x00/db1200.h +++ b/trunk/include/asm-mips/mach-db1x00/db1200.h @@ -25,7 +25,6 @@ #define __ASM_DB1200_H #include -#include // This is defined in au1000.h with bogus value #undef AU1X00_EXTERNAL_INT diff --git a/trunk/include/asm-mips/mach-db1x00/db1x00.h b/trunk/include/asm-mips/mach-db1x00/db1x00.h index e7a88ba35833..0f5f4c29f4e8 100644 --- a/trunk/include/asm-mips/mach-db1x00/db1x00.h +++ b/trunk/include/asm-mips/mach-db1x00/db1x00.h @@ -28,7 +28,6 @@ #ifndef __ASM_DB1X00_H #define __ASM_DB1X00_H -#include #ifdef CONFIG_MIPS_DB1550 diff --git a/trunk/include/asm-mips/mach-pb1x00/pb1200.h b/trunk/include/asm-mips/mach-pb1x00/pb1200.h index ed5fd7390678..d9f384acfea9 100644 --- a/trunk/include/asm-mips/mach-pb1x00/pb1200.h +++ b/trunk/include/asm-mips/mach-pb1x00/pb1200.h @@ -25,7 +25,6 @@ #define __ASM_PB1200_H #include -#include // This is defined in au1000.h with bogus value #undef AU1X00_EXTERNAL_INT diff --git a/trunk/include/asm-mips/mach-pb1x00/pb1550.h b/trunk/include/asm-mips/mach-pb1x00/pb1550.h index c2ab0e2df4ae..9a4955ce3b4a 100644 --- a/trunk/include/asm-mips/mach-pb1x00/pb1550.h +++ b/trunk/include/asm-mips/mach-pb1x00/pb1550.h @@ -28,7 +28,6 @@ #define __ASM_PB1550_H #include -#include #define DBDMA_AC97_TX_CHAN DSCR_CMD0_PSC1_TX #define DBDMA_AC97_RX_CHAN DSCR_CMD0_PSC1_RX diff --git a/trunk/include/asm-sparc64/ptrace.h b/trunk/include/asm-sparc64/ptrace.h index 6da197803efc..67341cff2e6b 100644 --- a/trunk/include/asm-sparc64/ptrace.h +++ b/trunk/include/asm-sparc64/ptrace.h @@ -109,7 +109,6 @@ extern unsigned long profile_pc(struct pt_regs *); #define profile_pc(regs) instruction_pointer(regs) #endif extern void show_regs(struct pt_regs *); -extern void __show_regs(struct pt_regs *); #endif #else /* __ASSEMBLY__ */ diff --git a/trunk/include/asm-sparc64/reboot.h b/trunk/include/asm-sparc64/reboot.h deleted file mode 100644 index 3f3f43f5be5e..000000000000 --- a/trunk/include/asm-sparc64/reboot.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _SPARC64_REBOOT_H -#define _SPARC64_REBOOT_H - -extern void machine_alt_power_off(void); - -#endif /* _SPARC64_REBOOT_H */ diff --git a/trunk/include/asm-sparc64/syscalls.h b/trunk/include/asm-sparc64/syscalls.h deleted file mode 100644 index 45a43f637a14..000000000000 --- a/trunk/include/asm-sparc64/syscalls.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef _SPARC64_SYSCALLS_H -#define _SPARC64_SYSCALLS_H - -struct pt_regs; - -extern asmlinkage long sparc_do_fork(unsigned long clone_flags, - unsigned long stack_start, - struct pt_regs *regs, - unsigned long stack_size); - -extern asmlinkage int sparc_execve(struct pt_regs *regs); - -#endif /* _SPARC64_SYSCALLS_H */ diff --git a/trunk/include/asm-sparc64/system.h b/trunk/include/asm-sparc64/system.h index ed91a5d8d4f0..1faefa6d3708 100644 --- a/trunk/include/asm-sparc64/system.h +++ b/trunk/include/asm-sparc64/system.h @@ -117,7 +117,6 @@ do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \ extern void sun_do_break(void); extern int stop_a_enabled; -extern void fault_in_user_windows(void); extern void synchronize_user_stack(void); extern void __flushw_user(void); diff --git a/trunk/include/asm-x86/futex.h b/trunk/include/asm-x86/futex.h index c9952ea9f698..cd9f894dd2d7 100644 --- a/trunk/include/asm-x86/futex.h +++ b/trunk/include/asm-x86/futex.h @@ -102,13 +102,6 @@ futex_atomic_op_inuser(int encoded_op, int __user *uaddr) static inline int futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval) { - -#if defined(CONFIG_X86_32) && !defined(CONFIG_X86_BSWAP) - /* Real i386 machines have no cmpxchg instruction */ - if (boot_cpu_data.x86 == 3) - return -ENOSYS; -#endif - if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) return -EFAULT; diff --git a/trunk/include/asm-x86/lguest.h b/trunk/include/asm-x86/lguest.h index 9b17571e9bc3..4d9367b72976 100644 --- a/trunk/include/asm-x86/lguest.h +++ b/trunk/include/asm-x86/lguest.h @@ -23,17 +23,6 @@ /* Found in switcher.S */ extern unsigned long default_idt_entries[]; -/* Declarations for definitions in lguest_guest.S */ -extern char lguest_noirq_start[], lguest_noirq_end[]; -extern const char lgstart_cli[], lgend_cli[]; -extern const char lgstart_sti[], lgend_sti[]; -extern const char lgstart_popf[], lgend_popf[]; -extern const char lgstart_pushf[], lgend_pushf[]; -extern const char lgstart_iret[], lgend_iret[]; - -extern void lguest_iret(void); -extern void lguest_init(void); - struct lguest_regs { /* Manually saved part. */ diff --git a/trunk/include/asm-x86/nops.h b/trunk/include/asm-x86/nops.h index e3b2bce0aff8..fec025c7f58c 100644 --- a/trunk/include/asm-x86/nops.h +++ b/trunk/include/asm-x86/nops.h @@ -3,29 +3,17 @@ /* Define nops for use with alternative() */ -/* generic versions from gas - 1: nop - 2: movl %esi,%esi - 3: leal 0x00(%esi),%esi - 4: leal 0x00(,%esi,1),%esi - 6: leal 0x00000000(%esi),%esi - 7: leal 0x00000000(,%esi,1),%esi -*/ -#define GENERIC_NOP1 ".byte 0x90\n" -#define GENERIC_NOP2 ".byte 0x89,0xf6\n" -#define GENERIC_NOP3 ".byte 0x8d,0x76,0x00\n" -#define GENERIC_NOP4 ".byte 0x8d,0x74,0x26,0x00\n" -#define GENERIC_NOP5 GENERIC_NOP1 GENERIC_NOP4 -#define GENERIC_NOP6 ".byte 0x8d,0xb6,0x00,0x00,0x00,0x00\n" -#define GENERIC_NOP7 ".byte 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00\n" -#define GENERIC_NOP8 GENERIC_NOP1 GENERIC_NOP7 +/* generic versions from gas */ +#define GENERIC_NOP1 ".byte 0x90\n" +#define GENERIC_NOP2 ".byte 0x89,0xf6\n" +#define GENERIC_NOP3 ".byte 0x8d,0x76,0x00\n" +#define GENERIC_NOP4 ".byte 0x8d,0x74,0x26,0x00\n" +#define GENERIC_NOP5 GENERIC_NOP1 GENERIC_NOP4 +#define GENERIC_NOP6 ".byte 0x8d,0xb6,0x00,0x00,0x00,0x00\n" +#define GENERIC_NOP7 ".byte 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00\n" +#define GENERIC_NOP8 GENERIC_NOP1 GENERIC_NOP7 -/* Opteron 64bit nops - 1: nop - 2: osp nop - 3: osp osp nop - 4: osp osp osp nop -*/ +/* Opteron 64bit nops */ #define K8_NOP1 GENERIC_NOP1 #define K8_NOP2 ".byte 0x66,0x90\n" #define K8_NOP3 ".byte 0x66,0x66,0x90\n" @@ -35,35 +23,19 @@ #define K8_NOP7 K8_NOP4 K8_NOP3 #define K8_NOP8 K8_NOP4 K8_NOP4 -/* K7 nops - uses eax dependencies (arbitary choice) - 1: nop - 2: movl %eax,%eax - 3: leal (,%eax,1),%eax - 4: leal 0x00(,%eax,1),%eax - 6: leal 0x00000000(%eax),%eax - 7: leal 0x00000000(,%eax,1),%eax -*/ -#define K7_NOP1 GENERIC_NOP1 +/* K7 nops */ +/* uses eax dependencies (arbitary choice) */ +#define K7_NOP1 GENERIC_NOP1 #define K7_NOP2 ".byte 0x8b,0xc0\n" #define K7_NOP3 ".byte 0x8d,0x04,0x20\n" #define K7_NOP4 ".byte 0x8d,0x44,0x20,0x00\n" #define K7_NOP5 K7_NOP4 ASM_NOP1 #define K7_NOP6 ".byte 0x8d,0x80,0,0,0,0\n" -#define K7_NOP7 ".byte 0x8D,0x04,0x05,0,0,0,0\n" -#define K7_NOP8 K7_NOP7 ASM_NOP1 +#define K7_NOP7 ".byte 0x8D,0x04,0x05,0,0,0,0\n" +#define K7_NOP8 K7_NOP7 ASM_NOP1 -/* P6 nops - uses eax dependencies (Intel-recommended choice) - 1: nop - 2: osp nop - 3: nopl (%eax) - 4: nopl 0x00(%eax) - 5: nopl 0x00(%eax,%eax,1) - 6: osp nopl 0x00(%eax,%eax,1) - 7: nopl 0x00000000(%eax) - 8: nopl 0x00000000(%eax,%eax,1) -*/ +/* P6 nops */ +/* uses eax dependencies (Intel-recommended choice) */ #define P6_NOP1 GENERIC_NOP1 #define P6_NOP2 ".byte 0x66,0x90\n" #define P6_NOP3 ".byte 0x0f,0x1f,0x00\n" @@ -91,7 +63,9 @@ #define ASM_NOP6 K7_NOP6 #define ASM_NOP7 K7_NOP7 #define ASM_NOP8 K7_NOP8 -#elif defined(CONFIG_X86_P6_NOP) +#elif defined(CONFIG_M686) || defined(CONFIG_MPENTIUMII) || \ + defined(CONFIG_MPENTIUMIII) || defined(CONFIG_MPENTIUMM) || \ + defined(CONFIG_MCORE2) || defined(CONFIG_PENTIUM4) #define ASM_NOP1 P6_NOP1 #define ASM_NOP2 P6_NOP2 #define ASM_NOP3 P6_NOP3 diff --git a/trunk/include/asm-x86/page_64.h b/trunk/include/asm-x86/page_64.h index 143546073b95..f7393bc516ef 100644 --- a/trunk/include/asm-x86/page_64.h +++ b/trunk/include/asm-x86/page_64.h @@ -47,12 +47,8 @@ #define __PHYSICAL_MASK_SHIFT 46 #define __VIRTUAL_MASK_SHIFT 48 -/* - * Kernel image size is limited to 128 MB (see level2_kernel_pgt in - * arch/x86/kernel/head_64.S), and it is mapped here: - */ -#define KERNEL_IMAGE_SIZE (128*1024*1024) -#define KERNEL_IMAGE_START _AC(0xffffffff80000000, UL) +#define KERNEL_TEXT_SIZE (40*1024*1024) +#define KERNEL_TEXT_START _AC(0xffffffff80000000, UL) #ifndef __ASSEMBLY__ void clear_page(void *page); diff --git a/trunk/include/linux/ata.h b/trunk/include/linux/ata.h index 1c622e2b0504..78bbacaed8c4 100644 --- a/trunk/include/linux/ata.h +++ b/trunk/include/linux/ata.h @@ -659,11 +659,6 @@ static inline int atapi_command_packet_set(const u16 *dev_id) return (dev_id[0] >> 8) & 0x1f; } -static inline int atapi_id_dmadir(const u16 *dev_id) -{ - return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000); -} - static inline int is_multi_taskfile(struct ata_taskfile *tf) { return (tf->command == ATA_CMD_READ_MULTI) || diff --git a/trunk/include/linux/elfcore-compat.h b/trunk/include/linux/elfcore-compat.h index 0a90e1c3a422..532d13adabc4 100644 --- a/trunk/include/linux/elfcore-compat.h +++ b/trunk/include/linux/elfcore-compat.h @@ -45,8 +45,8 @@ struct compat_elf_prpsinfo char pr_zomb; char pr_nice; compat_ulong_t pr_flag; - __compat_uid_t pr_uid; - __compat_gid_t pr_gid; + compat_uid_t pr_uid; + compat_gid_t pr_gid; compat_pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid; char pr_fname[16]; char pr_psargs[ELF_PRARGSZ]; diff --git a/trunk/include/linux/ext4_fs_extents.h b/trunk/include/linux/ext4_fs_extents.h index 1285c583b2d8..697da4bce6c5 100644 --- a/trunk/include/linux/ext4_fs_extents.h +++ b/trunk/include/linux/ext4_fs_extents.h @@ -227,6 +227,5 @@ extern int ext4_ext_search_left(struct inode *, struct ext4_ext_path *, ext4_lblk_t *, ext4_fsblk_t *); extern int ext4_ext_search_right(struct inode *, struct ext4_ext_path *, ext4_lblk_t *, ext4_fsblk_t *); -extern void ext4_ext_drop_refs(struct ext4_ext_path *); #endif /* _LINUX_EXT4_EXTENTS */ diff --git a/trunk/include/linux/i2c.h b/trunk/include/linux/i2c.h index 365e0df3646b..76014f8f3c60 100644 --- a/trunk/include/linux/i2c.h +++ b/trunk/include/linux/i2c.h @@ -271,16 +271,9 @@ extern void i2c_unregister_device(struct i2c_client *); * This is done at arch_initcall time, before declaring any i2c adapters. * Modules for add-on boards must use other calls. */ -#ifdef CONFIG_I2C_BOARDINFO extern int i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned n); -#else -static inline int -i2c_register_board_info(int busnum, struct i2c_board_info const *info, unsigned n) -{ - return 0; -} -#endif + /* * The following structs are for those who like to implement new bus drivers: @@ -605,7 +598,7 @@ I2C_CLIENT_MODULE_PARM(probe, "List of adapter,address pairs to scan " \ "additionally"); \ I2C_CLIENT_MODULE_PARM(ignore, "List of adapter,address pairs not to " \ "scan"); \ -static const struct i2c_client_address_data addr_data = { \ +const static struct i2c_client_address_data addr_data = { \ .normal_i2c = normal_i2c, \ .probe = probe, \ .ignore = ignore, \ diff --git a/trunk/include/linux/libata.h b/trunk/include/linux/libata.h index a05f60013642..ce7603a73156 100644 --- a/trunk/include/linux/libata.h +++ b/trunk/include/linux/libata.h @@ -138,7 +138,6 @@ enum { ATA_DFLAG_AN = (1 << 7), /* AN configured */ ATA_DFLAG_HIPM = (1 << 8), /* device supports HIPM */ ATA_DFLAG_DIPM = (1 << 9), /* device supports DIPM */ - ATA_DFLAG_DMADIR = (1 << 10), /* device requires DMADIR */ ATA_DFLAG_CFG_MASK = (1 << 12) - 1, ATA_DFLAG_PIO = (1 << 12), /* device limited to PIO mode */ diff --git a/trunk/include/linux/sched.h b/trunk/include/linux/sched.h index 2c9621f8bf87..e217d188a102 100644 --- a/trunk/include/linux/sched.h +++ b/trunk/include/linux/sched.h @@ -242,7 +242,6 @@ struct task_struct; extern void sched_init(void); extern void sched_init_smp(void); -extern asmlinkage void schedule_tail(struct task_struct *prev); extern void init_idle(struct task_struct *idle, int cpu); extern void init_idle_bootup_task(struct task_struct *idle); @@ -1190,7 +1189,7 @@ struct task_struct { int softirq_context; #endif #ifdef CONFIG_LOCKDEP -# define MAX_LOCK_DEPTH 48UL +# define MAX_LOCK_DEPTH 30UL u64 curr_chain_key; int lockdep_depth; struct held_lock held_locks[MAX_LOCK_DEPTH]; diff --git a/trunk/kernel/lockdep.c b/trunk/kernel/lockdep.c index 81a4e4a3f087..3574379f4d62 100644 --- a/trunk/kernel/lockdep.c +++ b/trunk/kernel/lockdep.c @@ -779,10 +779,6 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force) * parallel walking of the hash-list safe: */ list_add_tail_rcu(&class->hash_entry, hash_head); - /* - * Add it to the global list of classes: - */ - list_add_tail_rcu(&class->lock_entry, &all_lock_classes); if (verbose(class)) { graph_unlock(); @@ -2286,6 +2282,10 @@ static int mark_lock(struct task_struct *curr, struct held_lock *this, return 0; break; case LOCK_USED: + /* + * Add it to the global list of classes: + */ + list_add_tail_rcu(&this->class->lock_entry, &all_lock_classes); debug_atomic_dec(&nr_unused_locks); break; default: diff --git a/trunk/kernel/printk.c b/trunk/kernel/printk.c index 9adc2a473e6e..bee36100f110 100644 --- a/trunk/kernel/printk.c +++ b/trunk/kernel/printk.c @@ -666,7 +666,7 @@ asmlinkage int vprintk(const char *fmt, va_list args) } /* Emit the output into the temporary buffer */ printed_len += vscnprintf(printk_buf + printed_len, - sizeof(printk_buf) - printed_len, fmt, args); + sizeof(printk_buf), fmt, args); /* * Copy the output into log_buf. If the caller didn't provide diff --git a/trunk/kernel/sched.c b/trunk/kernel/sched.c index f06950c8a6ce..b387a8de26a5 100644 --- a/trunk/kernel/sched.c +++ b/trunk/kernel/sched.c @@ -668,8 +668,6 @@ const_debug unsigned int sysctl_sched_nr_migrate = 32; */ unsigned int sysctl_sched_rt_period = 1000000; -static __read_mostly int scheduler_running; - /* * part of the period that we allow rt tasks to run in us. * default: 0.95s @@ -691,16 +689,14 @@ unsigned long long cpu_clock(int cpu) unsigned long flags; struct rq *rq; + local_irq_save(flags); + rq = cpu_rq(cpu); /* * Only call sched_clock() if the scheduler has already been * initialized (some code might call cpu_clock() very early): */ - if (unlikely(!scheduler_running)) - return 0; - - local_irq_save(flags); - rq = cpu_rq(cpu); - update_rq_clock(rq); + if (rq->idle) + update_rq_clock(rq); now = rq->clock; local_irq_restore(flags); @@ -3889,7 +3885,7 @@ pick_next_task(struct rq *rq, struct task_struct *prev) asmlinkage void __sched schedule(void) { struct task_struct *prev, *next; - unsigned long *switch_count; + long *switch_count; struct rq *rq; int cpu; @@ -7288,8 +7284,6 @@ void __init sched_init(void) * During early bootup we pretend to be a normal task: */ current->sched_class = &fair_sched_class; - - scheduler_running = 1; } #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP diff --git a/trunk/kernel/sched_fair.c b/trunk/kernel/sched_fair.c index c8e6492c5925..6c091d6e159d 100644 --- a/trunk/kernel/sched_fair.c +++ b/trunk/kernel/sched_fair.c @@ -202,12 +202,17 @@ static struct sched_entity *__pick_next_entity(struct cfs_rq *cfs_rq) static inline struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq) { - struct rb_node *last = rb_last(&cfs_rq->tasks_timeline); + struct rb_node **link = &cfs_rq->tasks_timeline.rb_node; + struct sched_entity *se = NULL; + struct rb_node *parent; - if (!last) - return NULL; + while (*link) { + parent = *link; + se = rb_entry(parent, struct sched_entity, run_node); + link = &parent->rb_right; + } - return rb_entry(last, struct sched_entity, run_node); + return se; } /**************************************************************