aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.mailmap2
-rw-r--r--Documentation/00-INDEX2
-rw-r--r--Documentation/ABI/testing/sysfs-gpio26
-rw-r--r--Documentation/DMA-mapping.txt2
-rw-r--r--Documentation/HOWTO3
-rw-r--r--Documentation/SubmitChecklist2
-rw-r--r--Documentation/cpu-freq/index.txt10
-rw-r--r--Documentation/cpusets.txt18
-rw-r--r--Documentation/feature-removal-schedule.txt8
-rw-r--r--Documentation/filesystems/proc.txt2
-rw-r--r--Documentation/hwmon/adt747318
-rw-r--r--Documentation/hwmon/sysfs-interface12
-rw-r--r--Documentation/ioctl/cdrom.txt4
-rw-r--r--Documentation/kernel-parameters.txt11
-rw-r--r--Documentation/sysctl/kernel.txt7
-rw-r--r--Documentation/usb/anchors.txt12
-rw-r--r--Documentation/video4linux/CARDLIST.em28xx2
-rw-r--r--Documentation/video4linux/gspca.txt1
-rw-r--r--Documentation/x86/00-INDEX4
-rw-r--r--Documentation/x86/boot.txt (renamed from Documentation/x86/i386/boot.txt)2
-rw-r--r--Documentation/x86/mtrr.txt (renamed from Documentation/mtrr.txt)4
-rw-r--r--Documentation/x86/pat.txt54
-rw-r--r--Documentation/x86/usb-legacy-support.txt (renamed from Documentation/x86/i386/usb-legacy-support.txt)0
-rw-r--r--Documentation/x86/x86_64/boot-options.txt4
-rw-r--r--Documentation/x86/zero-page.txt (renamed from Documentation/x86/i386/zero-page.txt)0
-rw-r--r--MAINTAINERS189
-rw-r--r--Makefile2
-rw-r--r--arch/arm/include/asm/pci.h2
-rw-r--r--arch/arm/kernel/kgdb.c2
-rw-r--r--arch/arm/mach-davinci/psc.c3
-rw-r--r--arch/arm/mach-mx3/pcm037.c2
-rw-r--r--arch/arm/mach-pxa/time.c2
-rw-r--r--arch/arm/mach-pxa/tosa.c11
-rw-r--r--arch/arm/mach-sa1100/generic.c2
-rw-r--r--arch/arm/mach-sa1100/include/mach/jornada720.h11
-rw-r--r--arch/arm/mach-sa1100/jornada720_ssp.c10
-rw-r--r--arch/arm/mach-versatile/core.c2
-rw-r--r--arch/arm/plat-omap/devices.c110
-rw-r--r--arch/avr32/boards/atstk1000/atstk1002.c2
-rw-r--r--arch/avr32/boot/images/.gitignore4
-rw-r--r--arch/avr32/kernel/.gitignore1
-rw-r--r--arch/avr32/kernel/avr32_ksyms.c1
-rw-r--r--arch/avr32/kernel/syscall-stubs.S9
-rw-r--r--arch/avr32/kernel/syscall_table.S2
-rw-r--r--arch/avr32/kernel/traps.c8
-rw-r--r--arch/avr32/lib/findbit.S30
-rw-r--r--arch/ia64/include/asm/dma-mapping.h4
-rw-r--r--arch/ia64/include/asm/elf.h15
-rw-r--r--arch/ia64/include/asm/sections.h16
-rw-r--r--arch/ia64/include/asm/sn/bte.h9
-rw-r--r--arch/ia64/kernel/efi.c5
-rw-r--r--arch/ia64/kernel/head.S9
-rw-r--r--arch/ia64/kernel/module.c21
-rw-r--r--arch/ia64/kernel/setup.c2
-rw-r--r--arch/ia64/kernel/smpboot.c4
-rw-r--r--arch/ia64/kernel/vmlinux.lds.S8
-rw-r--r--arch/ia64/kvm/kvm-ia64.c7
-rw-r--r--arch/ia64/mm/contig.c2
-rw-r--r--arch/ia64/mm/discontig.c2
-rw-r--r--arch/ia64/sn/pci/tioca_provider.c4
-rw-r--r--arch/m32r/Kconfig10
-rw-r--r--arch/m32r/kernel/entry.S2
-rw-r--r--arch/m32r/kernel/head.S1
-rw-r--r--arch/m32r/kernel/irq.c6
-rw-r--r--arch/m32r/kernel/m32r_ksyms.c2
-rw-r--r--arch/m32r/kernel/process.c30
-rw-r--r--arch/m32r/kernel/smp.c4
-rw-r--r--arch/m32r/kernel/time.c5
-rw-r--r--arch/m32r/kernel/traps.c8
-rw-r--r--arch/m32r/lib/delay.c2
-rw-r--r--arch/m68k/configs/amiga_defconfig53
-rw-r--r--arch/m68k/configs/apollo_defconfig53
-rw-r--r--arch/m68k/configs/atari_defconfig60
-rw-r--r--arch/m68k/configs/bvme6000_defconfig52
-rw-r--r--arch/m68k/configs/hp300_defconfig52
-rw-r--r--arch/m68k/configs/mac_defconfig53
-rw-r--r--arch/m68k/configs/multi_defconfig62
-rw-r--r--arch/m68k/configs/mvme147_defconfig52
-rw-r--r--arch/m68k/configs/mvme16x_defconfig52
-rw-r--r--arch/m68k/configs/q40_defconfig53
-rw-r--r--arch/m68k/configs/sun3_defconfig54
-rw-r--r--arch/m68k/configs/sun3x_defconfig52
-rw-r--r--arch/mips/Kconfig53
-rw-r--r--arch/mips/au1000/common/gpio.c6
-rw-r--r--arch/mips/kernel/Makefile1
-rw-r--r--arch/mips/kernel/cevt-r4k.c173
-rw-r--r--arch/mips/kernel/cevt-smtc.c321
-rw-r--r--arch/mips/kernel/cpu-probe.c26
-rw-r--r--arch/mips/kernel/entry.S10
-rw-r--r--arch/mips/kernel/genex.S41
-rw-r--r--arch/mips/kernel/head.S1
-rw-r--r--arch/mips/kernel/kgdb.c3
-rw-r--r--arch/mips/kernel/mips-mt-fpaff.c2
-rw-r--r--arch/mips/kernel/process.c19
-rw-r--r--arch/mips/kernel/ptrace.c2
-rw-r--r--arch/mips/kernel/smtc.c260
-rw-r--r--arch/mips/kernel/traps.c28
-rw-r--r--arch/mips/kernel/vmlinux.lds.S1
-rw-r--r--arch/mips/lib/csum_partial.S21
-rw-r--r--arch/mips/mti-malta/Makefile2
-rw-r--r--arch/mips/mti-malta/malta-smtc.c9
-rw-r--r--arch/mips/pci/Makefile1
-rw-r--r--arch/mips/pci/pci-bcm47xx.c60
-rw-r--r--arch/mips/pci/pci-ip27.c40
-rw-r--r--arch/mips/sibyte/swarm/Makefile3
-rw-r--r--arch/mips/sibyte/swarm/platform.c85
-rw-r--r--arch/mips/vr41xx/common/irq.c6
-rw-r--r--arch/mn10300/kernel/irq.c71
-rw-r--r--arch/mn10300/kernel/time.c52
-rw-r--r--arch/mn10300/mm/fault.c2
-rw-r--r--arch/mn10300/unit-asb2303/unit-init.c2
-rw-r--r--arch/mn10300/unit-asb2305/unit-init.c2
-rw-r--r--arch/powerpc/boot/Makefile2
-rw-r--r--arch/powerpc/boot/dts/holly.dts106
-rw-r--r--arch/powerpc/boot/dts/mpc8610_hpcd.dts8
-rw-r--r--arch/powerpc/include/asm/elf.h7
-rw-r--r--arch/powerpc/include/asm/sections.h12
-rw-r--r--arch/powerpc/kernel/idle.c6
-rw-r--r--arch/powerpc/kernel/kgdb.c5
-rw-r--r--arch/powerpc/kernel/module_64.c19
-rw-r--r--arch/powerpc/platforms/fsl_uli1575.c12
-rw-r--r--arch/s390/kernel/time.c2
-rw-r--r--arch/s390/lib/delay.c88
-rw-r--r--arch/sparc/kernel/of_device.c2
-rw-r--r--arch/sparc/kernel/ptrace.c4
-rw-r--r--arch/sparc64/kernel/irq.c5
-rw-r--r--arch/sparc64/kernel/of_device.c9
-rw-r--r--arch/sparc64/kernel/pci.c2
-rw-r--r--arch/sparc64/kernel/pci_psycho.c14
-rw-r--r--arch/sparc64/kernel/prom.c104
-rw-r--r--arch/sparc64/kernel/ptrace.c8
-rw-r--r--arch/sparc64/kernel/traps.c3
-rw-r--r--arch/x86/Kconfig76
-rw-r--r--arch/x86/boot/compressed/head_32.S5
-rw-r--r--arch/x86/boot/compressed/misc.c10
-rw-r--r--arch/x86/boot/compressed/relocs.c2
-rw-r--r--arch/x86/boot/header.S1
-rw-r--r--arch/x86/configs/i386_defconfig19
-rw-r--r--arch/x86/configs/x86_64_defconfig29
-rw-r--r--arch/x86/ia32/ia32_aout.c11
-rw-r--r--arch/x86/ia32/ia32_signal.c21
-rw-r--r--arch/x86/ia32/sys_ia32.c9
-rw-r--r--arch/x86/kernel/acpi/boot.c25
-rw-r--r--arch/x86/kernel/alternative.c8
-rw-r--r--arch/x86/kernel/amd_iommu.c350
-rw-r--r--arch/x86/kernel/amd_iommu_init.c194
-rw-r--r--arch/x86/kernel/aperture_64.c6
-rw-r--r--arch/x86/kernel/apic_32.c332
-rw-r--r--arch/x86/kernel/apic_64.c389
-rw-r--r--arch/x86/kernel/apm_32.c4
-rw-r--r--arch/x86/kernel/bios_uv.c10
-rw-r--r--arch/x86/kernel/cpu/common.c28
-rw-r--r--arch/x86/kernel/cpu/cpufreq/p4-clockmod.c2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c2
-rw-r--r--arch/x86/kernel/cpu/mtrr/generic.c7
-rw-r--r--arch/x86/kernel/cpu/mtrr/if.c4
-rw-r--r--arch/x86/kernel/cpu/mtrr/main.c274
-rw-r--r--arch/x86/kernel/cpu/perfctr-watchdog.c86
-rw-r--r--arch/x86/kernel/cpuid.c1
-rw-r--r--arch/x86/kernel/crash_dump_64.c13
-rw-r--r--arch/x86/kernel/ds.c4
-rw-r--r--arch/x86/kernel/early-quirks.c18
-rw-r--r--arch/x86/kernel/efi.c6
-rw-r--r--arch/x86/kernel/head64.c5
-rw-r--r--arch/x86/kernel/head_32.S34
-rw-r--r--arch/x86/kernel/head_64.S4
-rw-r--r--arch/x86/kernel/irq_32.c2
-rw-r--r--arch/x86/kernel/irq_64.c2
-rw-r--r--arch/x86/kernel/k8.c5
-rw-r--r--arch/x86/kernel/kdebugfs.c1
-rw-r--r--arch/x86/kernel/kgdb.c50
-rw-r--r--arch/x86/kernel/kvm.c2
-rw-r--r--arch/x86/kernel/nmi.c11
-rw-r--r--arch/x86/kernel/olpc.c6
-rw-r--r--arch/x86/kernel/paravirt_patch_32.c2
-rw-r--r--arch/x86/kernel/pci-calgary_64.c18
-rw-r--r--arch/x86/kernel/pci-dma.c179
-rw-r--r--arch/x86/kernel/pci-gart_64.c162
-rw-r--r--arch/x86/kernel/pci-nommu.c10
-rw-r--r--arch/x86/kernel/pcspeaker.c13
-rw-r--r--arch/x86/kernel/process.c20
-rw-r--r--arch/x86/kernel/process_32.c12
-rw-r--r--arch/x86/kernel/process_64.c133
-rw-r--r--arch/x86/kernel/ptrace.c40
-rw-r--r--arch/x86/kernel/reboot.c6
-rw-r--r--arch/x86/kernel/setup.c21
-rw-r--r--arch/x86/kernel/sigframe.h5
-rw-r--r--arch/x86/kernel/signal_32.c11
-rw-r--r--arch/x86/kernel/signal_64.c105
-rw-r--r--arch/x86/kernel/smpboot.c5
-rw-r--r--arch/x86/kernel/sys_x86_64.c43
-rw-r--r--arch/x86/kernel/traps_64.c61
-rw-r--r--arch/x86/kernel/tsc.c290
-rw-r--r--arch/x86/kernel/visws_quirks.c16
-rw-r--r--arch/x86/kernel/vmi_32.c12
-rw-r--r--arch/x86/kernel/vsmp_64.c2
-rw-r--r--arch/x86/kvm/mmu.c4
-rw-r--r--arch/x86/kvm/svm.c12
-rw-r--r--arch/x86/kvm/vmx.c3
-rw-r--r--arch/x86/kvm/vmx.h2
-rw-r--r--arch/x86/lib/msr-on-cpu.c78
-rw-r--r--arch/x86/lib/string_32.c42
-rw-r--r--arch/x86/lib/strstr_32.c6
-rw-r--r--arch/x86/mm/discontig_32.c2
-rw-r--r--arch/x86/mm/dump_pagetables.c4
-rw-r--r--arch/x86/mm/init_32.c88
-rw-r--r--arch/x86/mm/init_64.c118
-rw-r--r--arch/x86/mm/ioremap.c19
-rw-r--r--arch/x86/mm/numa_64.c10
-rw-r--r--arch/x86/mm/pageattr-test.c9
-rw-r--r--arch/x86/mm/pageattr.c463
-rw-r--r--arch/x86/mm/pat.c132
-rw-r--r--arch/x86/mm/pgtable.c6
-rw-r--r--arch/x86/mm/pgtable_32.c3
-rw-r--r--arch/x86/oprofile/nmi_int.c4
-rw-r--r--arch/x86/oprofile/op_model_p4.c175
-rw-r--r--arch/x86/pci/amd_bus.c2
-rw-r--r--arch/x86/pci/irq.c67
-rw-r--r--arch/x86/power/hibernate_asm_32.S14
-rw-r--r--arch/x86/xen/enlighten.c20
-rw-r--r--arch/x86/xen/setup.c2
-rw-r--r--block/cmd-filter.c2
-rw-r--r--drivers/accessibility/braille/braille_console.c13
-rw-r--r--drivers/acpi/glue.c5
-rw-r--r--drivers/acpi/sleep/proc.c10
-rw-r--r--drivers/ata/Kconfig2
-rw-r--r--drivers/ata/ahci.c25
-rw-r--r--drivers/ata/ata_piix.c186
-rw-r--r--drivers/ata/libata-core.c252
-rw-r--r--drivers/ata/libata-eh.c362
-rw-r--r--drivers/ata/libata-scsi.c108
-rw-r--r--drivers/ata/libata.h3
-rw-r--r--drivers/ata/pata_bf54x.c34
-rw-r--r--drivers/ata/pata_sil680.c2
-rw-r--r--drivers/ata/sata_fsl.c26
-rw-r--r--drivers/ata/sata_inic162x.c11
-rw-r--r--drivers/ata/sata_mv.c28
-rw-r--r--drivers/ata/sata_nv.c62
-rw-r--r--drivers/ata/sata_promise.c16
-rw-r--r--drivers/ata/sata_qstor.c12
-rw-r--r--drivers/ata/sata_sil.c16
-rw-r--r--drivers/ata/sata_sil24.c12
-rw-r--r--drivers/ata/sata_sis.c28
-rw-r--r--drivers/ata/sata_svw.c10
-rw-r--r--drivers/ata/sata_uli.c24
-rw-r--r--drivers/ata/sata_via.c24
-rw-r--r--drivers/ata/sata_vsc.c10
-rw-r--r--drivers/bluetooth/bpa10x.c2
-rw-r--r--drivers/bluetooth/btusb.c36
-rw-r--r--drivers/char/agp/agp.h5
-rw-r--r--drivers/char/agp/alpha-agp.c2
-rw-r--r--drivers/char/agp/amd-k7-agp.c2
-rw-r--r--drivers/char/agp/amd64-agp.c2
-rw-r--r--drivers/char/agp/ati-agp.c2
-rw-r--r--drivers/char/agp/efficeon-agp.c2
-rw-r--r--drivers/char/agp/generic.c97
-rw-r--r--drivers/char/agp/hp-agp.c2
-rw-r--r--drivers/char/agp/i460-agp.c2
-rw-r--r--drivers/char/agp/intel-agp.c28
-rw-r--r--drivers/char/agp/nvidia-agp.c2
-rw-r--r--drivers/char/agp/parisc-agp.c2
-rw-r--r--drivers/char/agp/sis-agp.c2
-rw-r--r--drivers/char/agp/sworks-agp.c2
-rw-r--r--drivers/char/agp/uninorth-agp.c4
-rw-r--r--drivers/char/agp/via-agp.c4
-rw-r--r--drivers/char/tty_io.c14
-rw-r--r--drivers/clocksource/acpi_pm.c21
-rw-r--r--drivers/crypto/talitos.c6
-rw-r--r--drivers/dma/dw_dmac.c2
-rw-r--r--drivers/hwmon/abituguru3.c3
-rw-r--r--drivers/hwmon/ad7414.c2
-rw-r--r--drivers/hwmon/atxp1.c18
-rw-r--r--drivers/hwmon/it87.c74
-rw-r--r--drivers/i2c/busses/i2c-powermac.c4
-rw-r--r--drivers/i2c/i2c-dev.c4
-rw-r--r--drivers/ide/Kconfig18
-rw-r--r--drivers/ide/ide-cd.c8
-rw-r--r--drivers/ide/ide-dma.c2
-rw-r--r--drivers/ide/ide-probe.c2
-rw-r--r--drivers/ide/ide-tape.c10
-rw-r--r--drivers/ide/mips/Makefile1
-rw-r--r--drivers/ide/mips/swarm.c196
-rw-r--r--drivers/ide/pci/hpt366.c31
-rw-r--r--drivers/infiniband/hw/mlx4/qp.c6
-rw-r--r--drivers/infiniband/hw/nes/nes_cm.c11
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib.h2
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c9
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_multicast.c31
-rw-r--r--drivers/input/mouse/bcm5974.c13
-rw-r--r--drivers/input/touchscreen/jornada720_ts.c4
-rw-r--r--drivers/leds/leds-fsg.c28
-rw-r--r--drivers/leds/leds-pca955x.c70
-rw-r--r--drivers/md/dm-mpath.c16
-rw-r--r--drivers/md/dm.c12
-rw-r--r--drivers/md/md.c8
-rw-r--r--drivers/media/common/tuners/tuner-xc2028.h1
-rw-r--r--drivers/media/dvb/b2c2/flexcop-fe-tuner.c1
-rw-r--r--drivers/media/dvb/dvb-core/dmxdev.c16
-rw-r--r--drivers/media/dvb/dvb-core/dvb_demux.c16
-rw-r--r--drivers/media/dvb/frontends/s5h1420.c11
-rw-r--r--drivers/media/dvb/frontends/s5h1420.h8
-rw-r--r--drivers/media/dvb/siano/sms-cards.c4
-rw-r--r--drivers/media/video/Kconfig2
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c2
-rw-r--r--drivers/media/video/cafe_ccic.c1
-rw-r--r--drivers/media/video/cpia2/cpia2_usb.c5
-rw-r--r--drivers/media/video/cx18/cx18-cards.c2
-rw-r--r--drivers/media/video/em28xx/em28xx-audio.c12
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c55
-rw-r--r--drivers/media/video/em28xx/em28xx-dvb.c9
-rw-r--r--drivers/media/video/gspca/gspca.c3
-rw-r--r--drivers/media/video/gspca/pac7311.c1
-rw-r--r--drivers/media/video/gspca/sonixb.c4
-rw-r--r--drivers/media/video/gspca/sonixj.c19
-rw-r--r--drivers/media/video/gspca/spca561.c2
-rw-r--r--drivers/media/video/gspca/zc3xx.c4
-rw-r--r--drivers/media/video/ov511.c6
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-devattr.c2
-rw-r--r--drivers/media/video/s2255drv.c3
-rw-r--r--drivers/media/video/uvc/uvc_ctrl.c2
-rw-r--r--drivers/media/video/w9968cf.c2
-rw-r--r--drivers/media/video/wm8739.c4
-rw-r--r--drivers/media/video/zoran_card.c2
-rw-r--r--drivers/media/video/zoran_driver.c15
-rw-r--r--drivers/memstick/core/memstick.c10
-rw-r--r--drivers/memstick/core/mspro_block.c33
-rw-r--r--drivers/memstick/host/jmb38x_ms.c39
-rw-r--r--drivers/mfd/Kconfig4
-rw-r--r--drivers/mfd/asic3.c2
-rw-r--r--drivers/misc/eeepc-laptop.c16
-rw-r--r--drivers/misc/sgi-gru/grufile.c3
-rw-r--r--drivers/mmc/card/block.c9
-rw-r--r--drivers/mmc/card/mmc_test.c4
-rw-r--r--drivers/mmc/host/atmel-mci.c18
-rw-r--r--drivers/mmc/host/tmio_mmc.h4
-rw-r--r--drivers/net/bnx2.h2
-rw-r--r--drivers/net/e100.c4
-rw-r--r--drivers/net/e1000/e1000_hw.c23
-rw-r--r--drivers/net/e1000e/e1000.h5
-rw-r--r--drivers/net/e1000e/ethtool.c9
-rw-r--r--drivers/net/e1000e/ich8lan.c78
-rw-r--r--drivers/net/e1000e/netdev.c72
-rw-r--r--drivers/net/e1000e/param.c30
-rw-r--r--drivers/net/forcedeth.c16
-rw-r--r--drivers/net/hp-plus.c8
-rw-r--r--drivers/net/mlx4/mr.c10
-rw-r--r--drivers/net/niu.c56
-rw-r--r--drivers/net/wireless/ath9k/beacon.c13
-rw-r--r--drivers/net/wireless/ath9k/core.c11
-rw-r--r--drivers/net/wireless/ath9k/core.h2
-rw-r--r--drivers/net/wireless/ath9k/main.c26
-rw-r--r--drivers/net/wireless/ath9k/xmit.c6
-rw-r--r--drivers/net/wireless/b43/rfkill.c18
-rw-r--r--drivers/net/wireless/b43legacy/rfkill.c18
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.c1
-rw-r--r--drivers/pci/hotplug/fakephp.c6
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c2
-rw-r--r--drivers/pci/pci-sysfs.c19
-rw-r--r--drivers/pci/pcie/aspm.c2
-rw-r--r--drivers/pci/probe.c18
-rw-r--r--drivers/pci/search.c6
-rw-r--r--drivers/pci/setup-bus.c6
-rw-r--r--drivers/pcmcia/ds.c23
-rw-r--r--drivers/pcmcia/soc_common.c6
-rw-r--r--drivers/pnp/Makefile5
-rw-r--r--drivers/pnp/pnpacpi/core.c2
-rw-r--r--drivers/pnp/pnpbios/core.c2
-rw-r--r--drivers/rtc/rtc-dev.c15
-rw-r--r--drivers/s390/cio/ccwgroup.c4
-rw-r--r--drivers/s390/cio/cio.c1
-rw-r--r--drivers/s390/cio/qdio_setup.c55
-rw-r--r--drivers/s390/scsi/zfcp_ccw.c6
-rw-r--r--drivers/s390/scsi/zfcp_fc.c33
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c88
-rw-r--r--drivers/s390/scsi/zfcp_qdio.c4
-rw-r--r--drivers/scsi/Kconfig2
-rw-r--r--drivers/scsi/device_handler/scsi_dh_alua.c12
-rw-r--r--drivers/scsi/device_handler/scsi_dh_emc.c4
-rw-r--r--drivers/scsi/device_handler/scsi_dh_rdac.c4
-rw-r--r--drivers/scsi/libsas/sas_ata.c8
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c1
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c2
-rw-r--r--drivers/scsi/qlogicpti.c1
-rw-r--r--drivers/scsi/scsi_error.c2
-rw-r--r--drivers/scsi/scsi_lib.c3
-rw-r--r--drivers/scsi/scsi_scan.c3
-rw-r--r--drivers/scsi/sd.c2
-rw-r--r--drivers/scsi/sr.c2
-rw-r--r--drivers/serial/atmel_serial.c32
-rw-r--r--drivers/serial/imx.c27
-rw-r--r--drivers/spi/orion_spi.c2
-rw-r--r--drivers/spi/pxa2xx_spi.c116
-rw-r--r--drivers/spi/spi_mpc83xx.c26
-rw-r--r--drivers/spi/spi_s3c24xx.c6
-rw-r--r--drivers/ssb/main.c1
-rw-r--r--drivers/usb/core/hcd.c3
-rw-r--r--drivers/usb/core/hub.c39
-rw-r--r--drivers/usb/gadget/fsl_usb2_udc.c2
-rw-r--r--drivers/usb/gadget/omap_udc.c4
-rw-r--r--drivers/usb/host/ehci-hcd.c26
-rw-r--r--drivers/usb/host/ehci-sched.c32
-rw-r--r--drivers/usb/musb/Kconfig1
-rw-r--r--drivers/usb/musb/musb_core.c4
-rw-r--r--drivers/usb/musb/omap2430.c4
-rw-r--r--drivers/usb/musb/omap2430.h4
-rw-r--r--drivers/usb/serial/cp2101.c3
-rw-r--r--drivers/usb/serial/ftdi_sio.c3
-rw-r--r--drivers/usb/serial/ftdi_sio.h5
-rw-r--r--drivers/usb/serial/option.c2
-rw-r--r--drivers/usb/serial/sierra.c12
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c2
-rw-r--r--drivers/usb/serial/usb-serial.c4
-rw-r--r--drivers/usb/storage/Kconfig12
-rw-r--r--drivers/usb/storage/Makefile3
-rw-r--r--drivers/usb/storage/unusual_devs.h30
-rw-r--r--drivers/usb/storage/usb.c2
-rw-r--r--drivers/video/atmel_lcdfb.c84
-rw-r--r--drivers/video/console/fbcon.c6
-rw-r--r--drivers/video/console/fbcon.h2
-rw-r--r--drivers/watchdog/geodewdt.c6
-rw-r--r--drivers/watchdog/ibmasr.c1
-rw-r--r--drivers/watchdog/pnx4008_wdt.c4
-rw-r--r--drivers/watchdog/rc32434_wdt.c6
-rw-r--r--drivers/watchdog/rdc321x_wdt.c6
-rw-r--r--drivers/watchdog/wdt285.c15
-rw-r--r--fs/9p/vfs_inode.c3
-rw-r--r--fs/bfs/dir.c2
-rw-r--r--fs/dcache.c10
-rw-r--r--fs/exec.c2
-rw-r--r--fs/inotify_user.c27
-rw-r--r--fs/ocfs2/aops.c2
-rw-r--r--fs/partitions/check.c4
-rw-r--r--fs/proc/generic.c4
-rw-r--r--fs/proc/proc_misc.c12
-rw-r--r--fs/ramfs/file-nommu.c2
-rw-r--r--fs/splice.c3
-rw-r--r--fs/ubifs/debug.c2
-rw-r--r--fs/ubifs/dir.c2
-rw-r--r--fs/ubifs/find.c1
-rw-r--r--fs/ubifs/gc.c14
-rw-r--r--fs/ubifs/super.c3
-rw-r--r--fs/ubifs/tnc.c2
-rw-r--r--fs/udf/file.c1
-rw-r--r--fs/udf/ialloc.c44
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c4
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c20
-rw-r--r--fs/xfs/xfs_buf_item.c44
-rw-r--r--fs/xfs/xfs_dfrag.c9
-rw-r--r--fs/xfs/xfs_inode.c94
-rw-r--r--fs/xfs/xfs_log.c62
-rw-r--r--fs/xfs/xfs_log_priv.h1
-rw-r--r--fs/xfs/xfs_vnodeops.c26
-rw-r--r--include/asm-generic/bug.h10
-rw-r--r--include/asm-mips/cevt-r4k.h46
-rw-r--r--include/asm-mips/irqflags.h26
-rw-r--r--include/asm-mips/mipsregs.h6
-rw-r--r--include/asm-mips/pgtable-32.h2
-rw-r--r--include/asm-mips/smtc.h8
-rw-r--r--include/asm-mips/sn/mapped_kernel.h8
-rw-r--r--include/asm-mips/stackframe.h72
-rw-r--r--include/asm-x86/acpi.h2
-rw-r--r--include/asm-x86/amd_iommu.h3
-rw-r--r--include/asm-x86/amd_iommu_types.h64
-rw-r--r--include/asm-x86/apic.h4
-rw-r--r--include/asm-x86/asm.h7
-rw-r--r--include/asm-x86/bitops.h10
-rw-r--r--include/asm-x86/cacheflush.h7
-rw-r--r--include/asm-x86/cpufeature.h2
-rw-r--r--include/asm-x86/dma-mapping.h87
-rw-r--r--include/asm-x86/elf.h5
-rw-r--r--include/asm-x86/futex.h6
-rw-r--r--include/asm-x86/gart.h8
-rw-r--r--include/asm-x86/idle.h2
-rw-r--r--include/asm-x86/iommu.h1
-rw-r--r--include/asm-x86/kgdb.h24
-rw-r--r--include/asm-x86/mach-rdc321x/gpio.h3
-rw-r--r--include/asm-x86/mmu.h5
-rw-r--r--include/asm-x86/mpspec.h3
-rw-r--r--include/asm-x86/nmi.h1
-rw-r--r--include/asm-x86/page.h1
-rw-r--r--include/asm-x86/page_32.h3
-rw-r--r--include/asm-x86/paravirt.h30
-rw-r--r--include/asm-x86/pgtable-2level.h2
-rw-r--r--include/asm-x86/pgtable-3level.h7
-rw-r--r--include/asm-x86/pgtable.h20
-rw-r--r--include/asm-x86/pgtable_32.h5
-rw-r--r--include/asm-x86/pgtable_64.h2
-rw-r--r--include/asm-x86/ptrace.h5
-rw-r--r--include/asm-x86/resume-trace.h2
-rw-r--r--include/asm-x86/spinlock.h6
-rw-r--r--include/asm-x86/syscall.h211
-rw-r--r--include/asm-x86/thread_info.h4
-rw-r--r--include/asm-x86/uaccess_64.h1
-rw-r--r--include/linux/ata.h11
-rw-r--r--include/linux/blkdev.h2
-rw-r--r--include/linux/cnt32_to_63.h (renamed from arch/arm/include/asm/cnt32_to_63.h)46
-rw-r--r--include/linux/dma-mapping.h12
-rw-r--r--include/linux/hrtimer.h18
-rw-r--r--include/linux/ide.h4
-rw-r--r--include/linux/iommu-helper.h16
-rw-r--r--include/linux/ioport.h4
-rw-r--r--include/linux/libata.h66
-rw-r--r--include/linux/memstick.h97
-rw-r--r--include/linux/mlx4/device.h4
-rw-r--r--include/linux/mmzone.h12
-rw-r--r--include/linux/pci.h8
-rw-r--r--include/linux/pci_ids.h10
-rw-r--r--include/linux/pnp.h7
-rw-r--r--include/linux/ramfs.h1
-rw-r--r--include/linux/smb.h2
-rw-r--r--include/linux/stacktrace.h2
-rw-r--r--include/net/9p/9p.h1
-rw-r--r--include/net/9p/transport.h9
-rw-r--r--include/net/netlink.h2
-rw-r--r--include/net/sctp/sm.h3
-rw-r--r--include/scsi/scsi.h14
-rw-r--r--init/main.c9
-rw-r--r--kernel/cgroup.c5
-rw-r--r--kernel/cpuset.c37
-rw-r--r--kernel/dma-coherent.c2
-rw-r--r--kernel/exit.c12
-rw-r--r--kernel/hrtimer.c95
-rw-r--r--kernel/kexec.c8
-rw-r--r--kernel/kgdb.c13
-rw-r--r--kernel/posix-timers.c2
-rw-r--r--kernel/sched.c12
-rw-r--r--kernel/sched_rt.c1
-rw-r--r--kernel/time/clockevents.c12
-rw-r--r--kernel/time/tick-broadcast.c23
-rw-r--r--kernel/time/tick-common.c14
-rw-r--r--kernel/time/tick-internal.h9
-rw-r--r--kernel/time/tick-sched.c13
-rw-r--r--kernel/trace/trace_sysprof.c2
-rw-r--r--lib/iommu-helper.c5
-rw-r--r--lib/scatterlist.c4
-rw-r--r--lib/swiotlb.c49
-rw-r--r--mm/highmem.c5
-rw-r--r--mm/memcontrol.c18
-rw-r--r--mm/mmzone.c2
-rw-r--r--mm/page_alloc.c13
-rw-r--r--mm/page_isolation.c12
-rw-r--r--mm/slob.c8
-rw-r--r--mm/slub.c1
-rw-r--r--mm/tiny-shmem.c26
-rw-r--r--net/9p/client.c10
-rw-r--r--net/9p/conv.c6
-rw-r--r--net/9p/mod.c92
-rw-r--r--net/9p/trans_fd.c104
-rw-r--r--net/9p/trans_virtio.c2
-rw-r--r--net/ax25/af_ax25.c3
-rw-r--r--net/ax25/ax25_std_timer.c8
-rw-r--r--net/bluetooth/hci_core.c3
-rw-r--r--net/core/dev.c49
-rw-r--r--net/core/rtnetlink.c2
-rw-r--r--net/ipv4/tcp_hybla.c6
-rw-r--r--net/ipv4/tcp_input.c3
-rw-r--r--net/ipv4/tcp_ipv4.c2
-rw-r--r--net/ipv4/udp.c62
-rw-r--r--net/ipv6/netfilter/ip6t_hbh.c8
-rw-r--r--net/ipv6/route.c2
-rw-r--r--net/ipv6/tcp_ipv6.c2
-rw-r--r--net/iucv/iucv.c3
-rw-r--r--net/key/af_key.c30
-rw-r--r--net/netrom/af_netrom.c2
-rw-r--r--net/sched/sch_generic.c3
-rw-r--r--net/sctp/associola.c9
-rw-r--r--net/sctp/output.c3
-rw-r--r--net/sctp/sm_make_chunk.c52
-rw-r--r--net/sctp/sm_statefuns.c48
-rw-r--r--net/socket.c2
-rw-r--r--net/xfrm/xfrm_output.c12
-rw-r--r--scripts/kconfig/conf.c123
-rw-r--r--scripts/kconfig/confdata.c8
-rwxr-xr-xscripts/kernel-doc4
-rw-r--r--scripts/mod/modpost.c6
-rw-r--r--security/selinux/ss/services.c11
-rw-r--r--sound/core/pcm.c4
-rw-r--r--sound/core/pcm_native.c13
-rw-r--r--sound/core/rawmidi.c4
-rw-r--r--sound/pci/hda/patch_sigmatel.c2
-rw-r--r--sound/ppc/awacs.c50
-rw-r--r--sound/soc/at32/at32-pcm.c5
-rw-r--r--sound/soc/codecs/cs4270.c103
-rw-r--r--sound/soc/codecs/wm8753.c4
584 files changed, 9094 insertions, 5093 deletions
diff --git a/.mailmap b/.mailmap
index 726084286d33..dfab12f809ed 100644
--- a/.mailmap
+++ b/.mailmap
@@ -96,4 +96,6 @@ Tejun Heo <htejun@gmail.com>
96Thomas Graf <tgraf@suug.ch> 96Thomas Graf <tgraf@suug.ch>
97Tony Luck <tony.luck@intel.com> 97Tony Luck <tony.luck@intel.com>
98Tsuneo Yoshioka <Tsuneo.Yoshioka@f-secure.com> 98Tsuneo Yoshioka <Tsuneo.Yoshioka@f-secure.com>
99Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
100Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
99Valdis Kletnieks <Valdis.Kletnieks@vt.edu> 101Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX
index 5b5aba404aac..73060819ed99 100644
--- a/Documentation/00-INDEX
+++ b/Documentation/00-INDEX
@@ -251,8 +251,6 @@ mono.txt
251 - how to execute Mono-based .NET binaries with the help of BINFMT_MISC. 251 - how to execute Mono-based .NET binaries with the help of BINFMT_MISC.
252moxa-smartio 252moxa-smartio
253 - file with info on installing/using Moxa multiport serial driver. 253 - file with info on installing/using Moxa multiport serial driver.
254mtrr.txt
255 - how to use PPro Memory Type Range Registers to increase performance.
256mutex-design.txt 254mutex-design.txt
257 - info on the generic mutex subsystem. 255 - info on the generic mutex subsystem.
258namespaces/ 256namespaces/
diff --git a/Documentation/ABI/testing/sysfs-gpio b/Documentation/ABI/testing/sysfs-gpio
new file mode 100644
index 000000000000..8aab8092ad35
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-gpio
@@ -0,0 +1,26 @@
1What: /sys/class/gpio/
2Date: July 2008
3KernelVersion: 2.6.27
4Contact: David Brownell <dbrownell@users.sourceforge.net>
5Description:
6
7 As a Kconfig option, individual GPIO signals may be accessed from
8 userspace. GPIOs are only made available to userspace by an explicit
9 "export" operation. If a given GPIO is not claimed for use by
10 kernel code, it may be exported by userspace (and unexported later).
11 Kernel code may export it for complete or partial access.
12
13 GPIOs are identified as they are inside the kernel, using integers in
14 the range 0..INT_MAX. See Documentation/gpio.txt for more information.
15
16 /sys/class/gpio
17 /export ... asks the kernel to export a GPIO to userspace
18 /unexport ... to return a GPIO to the kernel
19 /gpioN ... for each exported GPIO #N
20 /value ... always readable, writes fail for input GPIOs
21 /direction ... r/w as: in, out (default low); write: high, low
22 /gpiochipN ... for each gpiochip; #N is its first GPIO
23 /base ... (r/o) same as N
24 /label ... (r/o) descriptive, not necessarily unique
25 /ngpio ... (r/o) number of GPIOs; numbered N to N + (ngpio - 1)
26
diff --git a/Documentation/DMA-mapping.txt b/Documentation/DMA-mapping.txt
index b463ecd0c7ce..c74fec8c2351 100644
--- a/Documentation/DMA-mapping.txt
+++ b/Documentation/DMA-mapping.txt
@@ -740,7 +740,7 @@ failure can be determined by:
740 dma_addr_t dma_handle; 740 dma_addr_t dma_handle;
741 741
742 dma_handle = pci_map_single(pdev, addr, size, direction); 742 dma_handle = pci_map_single(pdev, addr, size, direction);
743 if (pci_dma_mapping_error(dma_handle)) { 743 if (pci_dma_mapping_error(pdev, dma_handle)) {
744 /* 744 /*
745 * reduce current DMA mapping usage, 745 * reduce current DMA mapping usage,
746 * delay and try again later or 746 * delay and try again later or
diff --git a/Documentation/HOWTO b/Documentation/HOWTO
index c2371c5a98f9..48a3955f05fc 100644
--- a/Documentation/HOWTO
+++ b/Documentation/HOWTO
@@ -77,7 +77,8 @@ documentation files are also added which explain how to use the feature.
77When a kernel change causes the interface that the kernel exposes to 77When a kernel change causes the interface that the kernel exposes to
78userspace to change, it is recommended that you send the information or 78userspace to change, it is recommended that you send the information or
79a patch to the manual pages explaining the change to the manual pages 79a patch to the manual pages explaining the change to the manual pages
80maintainer at mtk.manpages@gmail.com. 80maintainer at mtk.manpages@gmail.com, and CC the list
81linux-api@vger.kernel.org.
81 82
82Here is a list of files that are in the kernel source tree that are 83Here is a list of files that are in the kernel source tree that are
83required reading: 84required reading:
diff --git a/Documentation/SubmitChecklist b/Documentation/SubmitChecklist
index da10e0714241..21f0795af20f 100644
--- a/Documentation/SubmitChecklist
+++ b/Documentation/SubmitChecklist
@@ -67,6 +67,8 @@ kernel patches.
67 67
6819: All new userspace interfaces are documented in Documentation/ABI/. 6819: All new userspace interfaces are documented in Documentation/ABI/.
69 See Documentation/ABI/README for more information. 69 See Documentation/ABI/README for more information.
70 Patches that change userspace interfaces should be CCed to
71 linux-api@vger.kernel.org.
70 72
7120: Check that it all passes `make headers_check'. 7320: Check that it all passes `make headers_check'.
72 74
diff --git a/Documentation/cpu-freq/index.txt b/Documentation/cpu-freq/index.txt
index ffdb5323df37..3d0b915035b9 100644
--- a/Documentation/cpu-freq/index.txt
+++ b/Documentation/cpu-freq/index.txt
@@ -35,11 +35,9 @@ Mailing List
35------------ 35------------
36There is a CPU frequency changing CVS commit and general list where 36There is a CPU frequency changing CVS commit and general list where
37you can report bugs, problems or submit patches. To post a message, 37you can report bugs, problems or submit patches. To post a message,
38send an email to cpufreq@lists.linux.org.uk, to subscribe go to 38send an email to cpufreq@vger.kernel.org, to subscribe go to
39http://lists.linux.org.uk/mailman/listinfo/cpufreq. Previous post to the 39http://vger.kernel.org/vger-lists.html#cpufreq and follow the
40mailing list are available to subscribers at 40instructions there.
41http://lists.linux.org.uk/mailman/private/cpufreq/.
42
43 41
44Links 42Links
45----- 43-----
@@ -50,7 +48,7 @@ how to access the CVS repository:
50* http://cvs.arm.linux.org.uk/ 48* http://cvs.arm.linux.org.uk/
51 49
52the CPUFreq Mailing list: 50the CPUFreq Mailing list:
53* http://lists.linux.org.uk/mailman/listinfo/cpufreq 51* http://vger.kernel.org/vger-lists.html#cpufreq
54 52
55Clock and voltage scaling for the SA-1100: 53Clock and voltage scaling for the SA-1100:
56* http://www.lartmaker.nl/projects/scaling 54* http://www.lartmaker.nl/projects/scaling
diff --git a/Documentation/cpusets.txt b/Documentation/cpusets.txt
index 1f5a924d1e56..47e568a9370a 100644
--- a/Documentation/cpusets.txt
+++ b/Documentation/cpusets.txt
@@ -635,14 +635,16 @@ prior 'mems' setting, will not be moved.
635 635
636There is an exception to the above. If hotplug functionality is used 636There is an exception to the above. If hotplug functionality is used
637to remove all the CPUs that are currently assigned to a cpuset, 637to remove all the CPUs that are currently assigned to a cpuset,
638then the kernel will automatically update the cpus_allowed of all 638then all the tasks in that cpuset will be moved to the nearest ancestor
639tasks attached to CPUs in that cpuset to allow all CPUs. When memory 639with non-empty cpus. But the moving of some (or all) tasks might fail if
640hotplug functionality for removing Memory Nodes is available, a 640cpuset is bound with another cgroup subsystem which has some restrictions
641similar exception is expected to apply there as well. In general, 641on task attaching. In this failing case, those tasks will stay
642the kernel prefers to violate cpuset placement, over starving a task 642in the original cpuset, and the kernel will automatically update
643that has had all its allowed CPUs or Memory Nodes taken offline. User 643their cpus_allowed to allow all online CPUs. When memory hotplug
644code should reconfigure cpusets to only refer to online CPUs and Memory 644functionality for removing Memory Nodes is available, a similar exception
645Nodes when using hotplug to add or remove such resources. 645is expected to apply there as well. In general, the kernel prefers to
646violate cpuset placement, over starving a task that has had all
647its allowed CPUs or Memory Nodes taken offline.
646 648
647There is a second exception to the above. GFP_ATOMIC requests are 649There is a second exception to the above. GFP_ATOMIC requests are
648kernel internal allocations that must be satisfied, immediately. 650kernel internal allocations that must be satisfied, immediately.
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index eb1a47b97427..83c88cae1eda 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -322,3 +322,11 @@ Why: Accounting can now be enabled/disabled without kernel recompilation.
322 controlled by a kernel/module/sysfs/sysctl parameter. 322 controlled by a kernel/module/sysfs/sysctl parameter.
323Who: Krzysztof Piotr Oledzki <ole@ans.pl> 323Who: Krzysztof Piotr Oledzki <ole@ans.pl>
324 324
325---------------------------
326
327What: ide-scsi (BLK_DEV_IDESCSI)
328When: 2.6.29
329Why: The 2.6 kernel supports direct writing to ide CD drives, which
330 eliminates the need for ide-scsi. The new method is more
331 efficient in every way.
332Who: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
index 394eb2cc1c39..f566ad9bcb7b 100644
--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -2413,6 +2413,8 @@ The following 4 memory types are supported:
2413 - (bit 1) anonymous shared memory 2413 - (bit 1) anonymous shared memory
2414 - (bit 2) file-backed private memory 2414 - (bit 2) file-backed private memory
2415 - (bit 3) file-backed shared memory 2415 - (bit 3) file-backed shared memory
2416 - (bit 4) ELF header pages in file-backed private memory areas (it is
2417 effective only if the bit 2 is cleared)
2416 2418
2417 Note that MMIO pages such as frame buffer are never dumped and vDSO pages 2419 Note that MMIO pages such as frame buffer are never dumped and vDSO pages
2418 are always dumped regardless of the bitmask status. 2420 are always dumped regardless of the bitmask status.
diff --git a/Documentation/hwmon/adt7473 b/Documentation/hwmon/adt7473
index 2126de34c711..1cbf671822e2 100644
--- a/Documentation/hwmon/adt7473
+++ b/Documentation/hwmon/adt7473
@@ -14,14 +14,14 @@ Description
14 14
15This driver implements support for the Analog Devices ADT7473 chip family. 15This driver implements support for the Analog Devices ADT7473 chip family.
16 16
17The LM85 uses the 2-wire interface compatible with the SMBUS 2.0 17The ADT7473 uses the 2-wire interface compatible with the SMBUS 2.0
18specification. Using an analog to digital converter it measures three (3) 18specification. Using an analog to digital converter it measures three (3)
19temperatures and two (2) voltages. It has three (3) 16-bit counters for 19temperatures and two (2) voltages. It has four (4) 16-bit counters for
20measuring fan speed. There are three (3) PWM outputs that can be used 20measuring fan speed. There are three (3) PWM outputs that can be used
21to control fan speed. 21to control fan speed.
22 22
23A sophisticated control system for the PWM outputs is designed into the 23A sophisticated control system for the PWM outputs is designed into the
24LM85 that allows fan speed to be adjusted automatically based on any of the 24ADT7473 that allows fan speed to be adjusted automatically based on any of the
25three temperature sensors. Each PWM output is individually adjustable and 25three temperature sensors. Each PWM output is individually adjustable and
26programmable. Once configured, the ADT7473 will adjust the PWM outputs in 26programmable. Once configured, the ADT7473 will adjust the PWM outputs in
27response to the measured temperatures without further host intervention. 27response to the measured temperatures without further host intervention.
@@ -46,14 +46,6 @@ from the raw value to get the temperature value.
46The Analog Devices datasheet is very detailed and describes a procedure for 46The Analog Devices datasheet is very detailed and describes a procedure for
47determining an optimal configuration for the automatic PWM control. 47determining an optimal configuration for the automatic PWM control.
48 48
49Hardware Configurations
50-----------------------
51
52The ADT7473 chips have an optional SMBALERT output that can be used to
53signal the chipset in case a limit is exceeded or the temperature sensors
54fail. Individual sensor interrupts can be masked so they won't trigger
55SMBALERT. The SMBALERT output if configured replaces the PWM2 function.
56
57Configuration Notes 49Configuration Notes
58------------------- 50-------------------
59 51
@@ -61,8 +53,8 @@ Besides standard interfaces driver adds the following:
61 53
62* PWM Control 54* PWM Control
63 55
64* pwm#_auto_point1_pwm and pwm#_auto_point1_temp and 56* pwm#_auto_point1_pwm and temp#_auto_point1_temp and
65* pwm#_auto_point2_pwm and pwm#_auto_point2_temp - 57* pwm#_auto_point2_pwm and temp#_auto_point2_temp -
66 58
67point1: Set the pwm speed at a lower temperature bound. 59point1: Set the pwm speed at a lower temperature bound.
68point2: Set the pwm speed at a higher temperature bound. 60point2: Set the pwm speed at a higher temperature bound.
diff --git a/Documentation/hwmon/sysfs-interface b/Documentation/hwmon/sysfs-interface
index 2d845730d4e0..6dbfd5efd991 100644
--- a/Documentation/hwmon/sysfs-interface
+++ b/Documentation/hwmon/sysfs-interface
@@ -329,6 +329,10 @@ power[1-*]_average Average power use
329 Unit: microWatt 329 Unit: microWatt
330 RO 330 RO
331 331
332power[1-*]_average_interval Power use averaging interval
333 Unit: milliseconds
334 RW
335
332power[1-*]_average_highest Historical average maximum power use 336power[1-*]_average_highest Historical average maximum power use
333 Unit: microWatt 337 Unit: microWatt
334 RO 338 RO
@@ -354,6 +358,14 @@ power[1-*]_reset_history Reset input_highest, input_lowest,
354 WO 358 WO
355 359
356********** 360**********
361* Energy *
362**********
363
364energy[1-*]_input Cumulative energy use
365 Unit: microJoule
366 RO
367
368**********
357* Alarms * 369* Alarms *
358********** 370**********
359 371
diff --git a/Documentation/ioctl/cdrom.txt b/Documentation/ioctl/cdrom.txt
index 62d4af44ec4a..59df81c8da2b 100644
--- a/Documentation/ioctl/cdrom.txt
+++ b/Documentation/ioctl/cdrom.txt
@@ -271,14 +271,14 @@ CDROMCLOSETRAY pendant of CDROMEJECT
271 271
272 usage: 272 usage:
273 273
274 ioctl(fd, CDROMEJECT, 0); 274 ioctl(fd, CDROMCLOSETRAY, 0);
275 275
276 inputs: none 276 inputs: none
277 277
278 outputs: none 278 outputs: none
279 279
280 error returns: 280 error returns:
281 ENOSYS cd drive not capable of ejecting 281 ENOSYS cd drive not capable of closing the tray
282 EBUSY other processes are accessing drive, or door is locked 282 EBUSY other processes are accessing drive, or door is locked
283 283
284 notes: 284 notes:
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 1de51110e622..c5d891fd75e3 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -284,6 +284,11 @@ and is between 256 and 4096 characters. It is defined in the file
284 isolate - enable device isolation (each device, as far 284 isolate - enable device isolation (each device, as far
285 as possible, will get its own protection 285 as possible, will get its own protection
286 domain) 286 domain)
287 fullflush - enable flushing of IO/TLB entries when
288 they are unmapped. Otherwise they are
289 flushed before they will be reused, which
290 is a lot of faster
291
287 amd_iommu_size= [HW,X86-64] 292 amd_iommu_size= [HW,X86-64]
288 Define the size of the aperture for the AMD IOMMU 293 Define the size of the aperture for the AMD IOMMU
289 driver. Possible values are: 294 driver. Possible values are:
@@ -463,12 +468,6 @@ and is between 256 and 4096 characters. It is defined in the file
463 Range: 0 - 8192 468 Range: 0 - 8192
464 Default: 64 469 Default: 64
465 470
466 disable_8254_timer
467 enable_8254_timer
468 [IA32/X86_64] Disable/Enable interrupt 0 timer routing
469 over the 8254 in addition to over the IO-APIC. The
470 kernel tries to set a sensible default.
471
472 hpet= [X86-32,HPET] option to control HPET usage 471 hpet= [X86-32,HPET] option to control HPET usage
473 Format: { enable (default) | disable | force } 472 Format: { enable (default) | disable | force }
474 disable: disable HPET and use PIT instead 473 disable: disable HPET and use PIT instead
diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt
index 276a7e637822..e1ff0d920a5c 100644
--- a/Documentation/sysctl/kernel.txt
+++ b/Documentation/sysctl/kernel.txt
@@ -351,9 +351,10 @@ kernel. This value defaults to SHMMAX.
351 351
352softlockup_thresh: 352softlockup_thresh:
353 353
354This value can be used to lower the softlockup tolerance 354This value can be used to lower the softlockup tolerance threshold. The
355threshold. The default threshold is 10s. If a cpu is locked up 355default threshold is 60 seconds. If a cpu is locked up for 60 seconds,
356for 10s, the kernel complains. Valid values are 1-60s. 356the kernel complains. Valid values are 1-60 seconds. Setting this
357tunable to zero will disable the softlockup detection altogether.
357 358
358============================================================== 359==============================================================
359 360
diff --git a/Documentation/usb/anchors.txt b/Documentation/usb/anchors.txt
index 7304bcf5a306..5e6b64c20d25 100644
--- a/Documentation/usb/anchors.txt
+++ b/Documentation/usb/anchors.txt
@@ -42,9 +42,21 @@ This function kills all URBs associated with an anchor. The URBs
42are called in the reverse temporal order they were submitted. 42are called in the reverse temporal order they were submitted.
43This way no data can be reordered. 43This way no data can be reordered.
44 44
45usb_unlink_anchored_urbs()
46--------------------------
47
48This function unlinks all URBs associated with an anchor. The URBs
49are processed in the reverse temporal order they were submitted.
50This is similar to usb_kill_anchored_urbs(), but it will not sleep.
51Therefore no guarantee is made that the URBs have been unlinked when
52the call returns. They may be unlinked later but will be unlinked in
53finite time.
54
45usb_wait_anchor_empty_timeout() 55usb_wait_anchor_empty_timeout()
46------------------------------- 56-------------------------------
47 57
48This function waits for all URBs associated with an anchor to finish 58This function waits for all URBs associated with an anchor to finish
49or a timeout, whichever comes first. Its return value will tell you 59or a timeout, whichever comes first. Its return value will tell you
50whether the timeout was reached. 60whether the timeout was reached.
61
62
diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx
index 89c7f32abf9f..53449cb99b17 100644
--- a/Documentation/video4linux/CARDLIST.em28xx
+++ b/Documentation/video4linux/CARDLIST.em28xx
@@ -46,7 +46,7 @@
46 45 -> Pinnacle PCTV DVB-T (em2870) 46 45 -> Pinnacle PCTV DVB-T (em2870)
47 46 -> Compro, VideoMate U3 (em2870) [185b:2870] 47 46 -> Compro, VideoMate U3 (em2870) [185b:2870]
48 47 -> KWorld DVB-T 305U (em2880) [eb1a:e305] 48 47 -> KWorld DVB-T 305U (em2880) [eb1a:e305]
49 48 -> KWorld DVB-T 310U (em2880) 49 48 -> KWorld DVB-T 310U (em2880) [eb1a:e310]
50 49 -> MSI DigiVox A/D (em2880) [eb1a:e310] 50 49 -> MSI DigiVox A/D (em2880) [eb1a:e310]
51 50 -> MSI DigiVox A/D II (em2880) [eb1a:e320] 51 50 -> MSI DigiVox A/D II (em2880) [eb1a:e320]
52 51 -> Terratec Hybrid XS Secam (em2880) [0ccd:004c] 52 51 -> Terratec Hybrid XS Secam (em2880) [0ccd:004c]
diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt
index 0f03900c48fb..9a3e4d797fa8 100644
--- a/Documentation/video4linux/gspca.txt
+++ b/Documentation/video4linux/gspca.txt
@@ -190,6 +190,7 @@ pac7311 093a:260f SnakeCam
190pac7311 093a:2621 PAC731x 190pac7311 093a:2621 PAC731x
191pac7311 093a:2624 PAC7302 191pac7311 093a:2624 PAC7302
192pac7311 093a:2626 Labtec 2200 192pac7311 093a:2626 Labtec 2200
193pac7311 093a:262a Webcam 300k
193zc3xx 0ac8:0302 Z-star Vimicro zc0302 194zc3xx 0ac8:0302 Z-star Vimicro zc0302
194vc032x 0ac8:0321 Vimicro generic vc0321 195vc032x 0ac8:0321 Vimicro generic vc0321
195vc032x 0ac8:0323 Vimicro Vc0323 196vc032x 0ac8:0323 Vimicro Vc0323
diff --git a/Documentation/x86/00-INDEX b/Documentation/x86/00-INDEX
new file mode 100644
index 000000000000..dbe3377754af
--- /dev/null
+++ b/Documentation/x86/00-INDEX
@@ -0,0 +1,4 @@
100-INDEX
2 - this file
3mtrr.txt
4 - how to use x86 Memory Type Range Registers to increase performance
diff --git a/Documentation/x86/i386/boot.txt b/Documentation/x86/boot.txt
index 147bfe511cdd..83c0033ee9e0 100644
--- a/Documentation/x86/i386/boot.txt
+++ b/Documentation/x86/boot.txt
@@ -308,7 +308,7 @@ Protocol: 2.00+
308 308
309Field name: start_sys 309Field name: start_sys
310Type: read 310Type: read
311Offset/size: 0x20c/4 311Offset/size: 0x20c/2
312Protocol: 2.00+ 312Protocol: 2.00+
313 313
314 The load low segment (0x1000). Obsolete. 314 The load low segment (0x1000). Obsolete.
diff --git a/Documentation/mtrr.txt b/Documentation/x86/mtrr.txt
index c39ac395970e..cc071dc333c2 100644
--- a/Documentation/mtrr.txt
+++ b/Documentation/x86/mtrr.txt
@@ -18,7 +18,7 @@ Richard Gooch
18 The AMD K6-2 (stepping 8 and above) and K6-3 processors have two 18 The AMD K6-2 (stepping 8 and above) and K6-3 processors have two
19 MTRRs. These are supported. The AMD Athlon family provide 8 Intel 19 MTRRs. These are supported. The AMD Athlon family provide 8 Intel
20 style MTRRs. 20 style MTRRs.
21 21
22 The Centaur C6 (WinChip) has 8 MCRs, allowing write-combining. These 22 The Centaur C6 (WinChip) has 8 MCRs, allowing write-combining. These
23 are supported. 23 are supported.
24 24
@@ -87,7 +87,7 @@ reg00: base=0x00000000 ( 0MB), size= 64MB: write-back, count=1
87reg01: base=0xfb000000 (4016MB), size= 16MB: write-combining, count=1 87reg01: base=0xfb000000 (4016MB), size= 16MB: write-combining, count=1
88reg02: base=0xfb000000 (4016MB), size= 4kB: uncachable, count=1 88reg02: base=0xfb000000 (4016MB), size= 4kB: uncachable, count=1
89 89
90Some cards (especially Voodoo Graphics boards) need this 4 kB area 90Some cards (especially Voodoo Graphics boards) need this 4 kB area
91excluded from the beginning of the region because it is used for 91excluded from the beginning of the region because it is used for
92registers. 92registers.
93 93
diff --git a/Documentation/x86/pat.txt b/Documentation/x86/pat.txt
index 17965f927c15..c93ff5f4c0dd 100644
--- a/Documentation/x86/pat.txt
+++ b/Documentation/x86/pat.txt
@@ -14,6 +14,10 @@ PAT allows for different types of memory attributes. The most commonly used
14ones that will be supported at this time are Write-back, Uncached, 14ones that will be supported at this time are Write-back, Uncached,
15Write-combined and Uncached Minus. 15Write-combined and Uncached Minus.
16 16
17
18PAT APIs
19--------
20
17There are many different APIs in the kernel that allows setting of memory 21There are many different APIs in the kernel that allows setting of memory
18attributes at the page level. In order to avoid aliasing, these interfaces 22attributes at the page level. In order to avoid aliasing, these interfaces
19should be used thoughtfully. Below is a table of interfaces available, 23should be used thoughtfully. Below is a table of interfaces available,
@@ -26,38 +30,38 @@ address range to avoid any aliasing.
26API | RAM | ACPI,... | Reserved/Holes | 30API | RAM | ACPI,... | Reserved/Holes |
27-----------------------|----------|------------|------------------| 31-----------------------|----------|------------|------------------|
28 | | | | 32 | | | |
29ioremap | -- | UC | UC | 33ioremap | -- | UC- | UC- |
30 | | | | 34 | | | |
31ioremap_cache | -- | WB | WB | 35ioremap_cache | -- | WB | WB |
32 | | | | 36 | | | |
33ioremap_nocache | -- | UC | UC | 37ioremap_nocache | -- | UC- | UC- |
34 | | | | 38 | | | |
35ioremap_wc | -- | -- | WC | 39ioremap_wc | -- | -- | WC |
36 | | | | 40 | | | |
37set_memory_uc | UC | -- | -- | 41set_memory_uc | UC- | -- | -- |
38 set_memory_wb | | | | 42 set_memory_wb | | | |
39 | | | | 43 | | | |
40set_memory_wc | WC | -- | -- | 44set_memory_wc | WC | -- | -- |
41 set_memory_wb | | | | 45 set_memory_wb | | | |
42 | | | | 46 | | | |
43pci sysfs resource | -- | -- | UC | 47pci sysfs resource | -- | -- | UC- |
44 | | | | 48 | | | |
45pci sysfs resource_wc | -- | -- | WC | 49pci sysfs resource_wc | -- | -- | WC |
46 is IORESOURCE_PREFETCH| | | | 50 is IORESOURCE_PREFETCH| | | |
47 | | | | 51 | | | |
48pci proc | -- | -- | UC | 52pci proc | -- | -- | UC- |
49 !PCIIOC_WRITE_COMBINE | | | | 53 !PCIIOC_WRITE_COMBINE | | | |
50 | | | | 54 | | | |
51pci proc | -- | -- | WC | 55pci proc | -- | -- | WC |
52 PCIIOC_WRITE_COMBINE | | | | 56 PCIIOC_WRITE_COMBINE | | | |
53 | | | | 57 | | | |
54/dev/mem | -- | UC | UC | 58/dev/mem | -- | WB/WC/UC- | WB/WC/UC- |
55 read-write | | | | 59 read-write | | | |
56 | | | | 60 | | | |
57/dev/mem | -- | UC | UC | 61/dev/mem | -- | UC- | UC- |
58 mmap SYNC flag | | | | 62 mmap SYNC flag | | | |
59 | | | | 63 | | | |
60/dev/mem | -- | WB/WC/UC | WB/WC/UC | 64/dev/mem | -- | WB/WC/UC- | WB/WC/UC- |
61 mmap !SYNC flag | |(from exist-| (from exist- | 65 mmap !SYNC flag | |(from exist-| (from exist- |
62 and | | ing alias)| ing alias) | 66 and | | ing alias)| ing alias) |
63 any alias to this area| | | | 67 any alias to this area| | | |
@@ -68,7 +72,7 @@ pci proc | -- | -- | WC |
68 and | | | | 72 and | | | |
69 MTRR says WB | | | | 73 MTRR says WB | | | |
70 | | | | 74 | | | |
71/dev/mem | -- | -- | UC_MINUS | 75/dev/mem | -- | -- | UC- |
72 mmap !SYNC flag | | | | 76 mmap !SYNC flag | | | |
73 no alias to this area | | | | 77 no alias to this area | | | |
74 and | | | | 78 and | | | |
@@ -98,3 +102,35 @@ types.
98 102
99Drivers should use set_memory_[uc|wc] to set access type for RAM ranges. 103Drivers should use set_memory_[uc|wc] to set access type for RAM ranges.
100 104
105
106PAT debugging
107-------------
108
109With CONFIG_DEBUG_FS enabled, PAT memtype list can be examined by
110
111# mount -t debugfs debugfs /sys/kernel/debug
112# cat /sys/kernel/debug/x86/pat_memtype_list
113PAT memtype list:
114uncached-minus @ 0x7fadf000-0x7fae0000
115uncached-minus @ 0x7fb19000-0x7fb1a000
116uncached-minus @ 0x7fb1a000-0x7fb1b000
117uncached-minus @ 0x7fb1b000-0x7fb1c000
118uncached-minus @ 0x7fb1c000-0x7fb1d000
119uncached-minus @ 0x7fb1d000-0x7fb1e000
120uncached-minus @ 0x7fb1e000-0x7fb25000
121uncached-minus @ 0x7fb25000-0x7fb26000
122uncached-minus @ 0x7fb26000-0x7fb27000
123uncached-minus @ 0x7fb27000-0x7fb28000
124uncached-minus @ 0x7fb28000-0x7fb2e000
125uncached-minus @ 0x7fb2e000-0x7fb2f000
126uncached-minus @ 0x7fb2f000-0x7fb30000
127uncached-minus @ 0x7fb31000-0x7fb32000
128uncached-minus @ 0x80000000-0x90000000
129
130This list shows physical address ranges and various PAT settings used to
131access those physical address ranges.
132
133Another, more verbose way of getting PAT related debug messages is with
134"debugpat" boot parameter. With this parameter, various debug messages are
135printed to dmesg log.
136
diff --git a/Documentation/x86/i386/usb-legacy-support.txt b/Documentation/x86/usb-legacy-support.txt
index 1894cdfc69d9..1894cdfc69d9 100644
--- a/Documentation/x86/i386/usb-legacy-support.txt
+++ b/Documentation/x86/usb-legacy-support.txt
diff --git a/Documentation/x86/x86_64/boot-options.txt b/Documentation/x86/x86_64/boot-options.txt
index b0c7b6c4abda..72ffb5373ec7 100644
--- a/Documentation/x86/x86_64/boot-options.txt
+++ b/Documentation/x86/x86_64/boot-options.txt
@@ -54,10 +54,6 @@ APICs
54 apicmaintimer. Useful when your PIT timer is totally 54 apicmaintimer. Useful when your PIT timer is totally
55 broken. 55 broken.
56 56
57 disable_8254_timer / enable_8254_timer
58 Enable interrupt 0 timer routing over the 8254 in addition to over
59 the IO-APIC. The kernel tries to set a sensible default.
60
61Early Console 57Early Console
62 58
63 syntax: earlyprintk=vga 59 syntax: earlyprintk=vga
diff --git a/Documentation/x86/i386/zero-page.txt b/Documentation/x86/zero-page.txt
index 169ad423a3d1..169ad423a3d1 100644
--- a/Documentation/x86/i386/zero-page.txt
+++ b/Documentation/x86/zero-page.txt
diff --git a/MAINTAINERS b/MAINTAINERS
index 186be3ba5069..3c124d7989e0 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -271,20 +271,20 @@ W: http://www.lesswatts.org/projects/acpi/
271S: Supported 271S: Supported
272 272
273ACPI WMI DRIVER 273ACPI WMI DRIVER
274P: Carlos Corbacho 274P: Carlos Corbacho
275M: carlos@strangeworlds.co.uk 275M: carlos@strangeworlds.co.uk
276L: linux-acpi@vger.kernel.org 276L: linux-acpi@vger.kernel.org
277W: http://www.lesswatts.org/projects/acpi/ 277W: http://www.lesswatts.org/projects/acpi/
278S: Maintained 278S: Maintained
279 279
280AD1889 ALSA SOUND DRIVER 280AD1889 ALSA SOUND DRIVER
281P: Kyle McMartin 281P: Kyle McMartin
282M: kyle@mcmartin.ca 282M: kyle@mcmartin.ca
283P: Thibaut Varene 283P: Thibaut Varene
284M: T-Bone@parisc-linux.org 284M: T-Bone@parisc-linux.org
285W: http://wiki.parisc-linux.org/AD1889 285W: http://wiki.parisc-linux.org/AD1889
286L: linux-parisc@vger.kernel.org 286L: linux-parisc@vger.kernel.org
287S: Maintained 287S: Maintained
288 288
289ADM1025 HARDWARE MONITOR DRIVER 289ADM1025 HARDWARE MONITOR DRIVER
290P: Jean Delvare 290P: Jean Delvare
@@ -387,6 +387,7 @@ AMD IOMMU (AMD-VI)
387P: Joerg Roedel 387P: Joerg Roedel
388M: joerg.roedel@amd.com 388M: joerg.roedel@amd.com
389L: iommu@lists.linux-foundation.org 389L: iommu@lists.linux-foundation.org
390T: git://git.kernel.org/pub/scm/linux/kernel/git/joro/linux-2.6-iommu.git
390S: Supported 391S: Supported
391 392
392AMS (Apple Motion Sensor) DRIVER 393AMS (Apple Motion Sensor) DRIVER
@@ -473,11 +474,11 @@ L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
473S: Maintained 474S: Maintained
474 475
475ARM/ATMEL AT91RM9200 ARM ARCHITECTURE 476ARM/ATMEL AT91RM9200 ARM ARCHITECTURE
476P: Andrew Victor 477P: Andrew Victor
477M: linux@maxim.org.za 478M: linux@maxim.org.za
478L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only) 479L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
479W: http://maxim.org.za/at91_26.html 480W: http://maxim.org.za/at91_26.html
480S: Maintained 481S: Maintained
481 482
482ARM/CIRRUS LOGIC EP93XX ARM ARCHITECTURE 483ARM/CIRRUS LOGIC EP93XX ARM ARCHITECTURE
483P: Lennert Buytenhek 484P: Lennert Buytenhek
@@ -532,10 +533,10 @@ L: linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
532S: Maintained 533S: Maintained
533 534
534ARM/HP JORNADA 7XX MACHINE SUPPORT 535ARM/HP JORNADA 7XX MACHINE SUPPORT
535P: Kristoffer Ericson 536P: Kristoffer Ericson
536M: kristoffer.ericson@gmail.com 537M: kristoffer.ericson@gmail.com
537W: www.jlime.com 538W: www.jlime.com
538S: Maintained 539S: Maintained
539 540
540ARM/INTEL IOP32X ARM ARCHITECTURE 541ARM/INTEL IOP32X ARM ARCHITECTURE
541P: Lennert Buytenhek 542P: Lennert Buytenhek
@@ -1017,7 +1018,7 @@ T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git
1017S: Maintained 1018S: Maintained
1018 1019
1019CAFE CMOS INTEGRATED CAMERA CONTROLLER DRIVER 1020CAFE CMOS INTEGRATED CAMERA CONTROLLER DRIVER
1020P: Jonathan Corbet 1021P: Jonathan Corbet
1021M: corbet@lwn.net 1022M: corbet@lwn.net
1022L: video4linux-list@redhat.com 1023L: video4linux-list@redhat.com
1023S: Maintained 1024S: Maintained
@@ -1198,9 +1199,7 @@ M: hpa@zytor.com
1198S: Maintained 1199S: Maintained
1199 1200
1200CPUSETS 1201CPUSETS
1201P: Paul Jackson
1202P: Paul Menage 1202P: Paul Menage
1203M: pj@sgi.com
1204M: menage@google.com 1203M: menage@google.com
1205L: linux-kernel@vger.kernel.org 1204L: linux-kernel@vger.kernel.org
1206W: http://www.bullopensource.org/cpuset/ 1205W: http://www.bullopensource.org/cpuset/
@@ -1359,7 +1358,7 @@ P: Digi International, Inc
1359M: Eng.Linux@digi.com 1358M: Eng.Linux@digi.com
1360L: Eng.Linux@digi.com 1359L: Eng.Linux@digi.com
1361W: http://www.digi.com 1360W: http://www.digi.com
1362S: Orphaned 1361S: Orphan
1363 1362
1364DIRECTORY NOTIFICATION 1363DIRECTORY NOTIFICATION
1365P: Stephen Rothwell 1364P: Stephen Rothwell
@@ -1423,12 +1422,12 @@ L: linux-acpi@vger.kernel.org
1423S: Supported 1422S: Supported
1424 1423
1425DOCUMENTATION (/Documentation directory) 1424DOCUMENTATION (/Documentation directory)
1426P: Michael Kerrisk 1425P: Michael Kerrisk
1427M: mtk.manpages@gmail.com 1426M: mtk.manpages@gmail.com
1428P: Randy Dunlap 1427P: Randy Dunlap
1429M: rdunlap@xenotime.net 1428M: rdunlap@xenotime.net
1430L: linux-doc@vger.kernel.org 1429L: linux-doc@vger.kernel.org
1431S: Maintained 1430S: Maintained
1432 1431
1433DOUBLETALK DRIVER 1432DOUBLETALK DRIVER
1434P: James R. Van Zandt 1433P: James R. Van Zandt
@@ -1459,7 +1458,7 @@ S: Maintained
1459DVB SUBSYSTEM AND DRIVERS 1458DVB SUBSYSTEM AND DRIVERS
1460P: LinuxTV.org Project 1459P: LinuxTV.org Project
1461M: v4l-dvb-maintainer@linuxtv.org 1460M: v4l-dvb-maintainer@linuxtv.org
1462L: linux-dvb@linuxtv.org (subscription required) 1461L: linux-dvb@linuxtv.org (subscription required)
1463W: http://linuxtv.org/ 1462W: http://linuxtv.org/
1464T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git 1463T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git
1465S: Maintained 1464S: Maintained
@@ -1797,7 +1796,7 @@ FUTURE DOMAIN TMC-16x0 SCSI DRIVER (16-bit)
1797P: Rik Faith 1796P: Rik Faith
1798M: faith@cs.unc.edu 1797M: faith@cs.unc.edu
1799L: linux-scsi@vger.kernel.org 1798L: linux-scsi@vger.kernel.org
1800S: Odd fixes (e.g., new signatures) 1799S: Odd Fixes (e.g., new signatures)
1801 1800
1802GDT SCSI DISK ARRAY CONTROLLER DRIVER 1801GDT SCSI DISK ARRAY CONTROLLER DRIVER
1803P: Achim Leubner 1802P: Achim Leubner
@@ -1838,10 +1837,10 @@ S: Maintained
1838HARDWARE MONITORING 1837HARDWARE MONITORING
1839L: lm-sensors@lm-sensors.org 1838L: lm-sensors@lm-sensors.org
1840W: http://www.lm-sensors.org/ 1839W: http://www.lm-sensors.org/
1841S: Orphaned 1840S: Orphan
1842 1841
1843HARDWARE RANDOM NUMBER GENERATOR CORE 1842HARDWARE RANDOM NUMBER GENERATOR CORE
1844S: Orphaned 1843S: Orphan
1845 1844
1846HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER 1845HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER
1847P: Robert Love 1846P: Robert Love
@@ -1984,7 +1983,7 @@ S: Maintained
1984I2C/SMBUS STUB DRIVER 1983I2C/SMBUS STUB DRIVER
1985P: Mark M. Hoffman 1984P: Mark M. Hoffman
1986M: mhoffman@lightlink.com 1985M: mhoffman@lightlink.com
1987L: lm-sensors@lm-sensors.org 1986L: i2c@lm-sensors.org
1988S: Maintained 1987S: Maintained
1989 1988
1990I2C SUBSYSTEM 1989I2C SUBSYSTEM
@@ -2108,7 +2107,7 @@ M: rolandd@cisco.com
2108P: Sean Hefty 2107P: Sean Hefty
2109M: sean.hefty@intel.com 2108M: sean.hefty@intel.com
2110P: Hal Rosenstock 2109P: Hal Rosenstock
2111M: hal.rosenstock@gmail.com 2110M: hal.rosenstock@gmail.com
2112L: general@lists.openfabrics.org 2111L: general@lists.openfabrics.org
2113W: http://www.openib.org/ 2112W: http://www.openib.org/
2114T: git kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git 2113T: git kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git
@@ -2696,17 +2695,18 @@ S: Maintained
2696 2695
2697MARVELL YUKON / SYSKONNECT DRIVER 2696MARVELL YUKON / SYSKONNECT DRIVER
2698P: Mirko Lindner 2697P: Mirko Lindner
2699M: mlindner@syskonnect.de 2698M: mlindner@syskonnect.de
2700P: Ralph Roesler 2699P: Ralph Roesler
2701M: rroesler@syskonnect.de 2700M: rroesler@syskonnect.de
2702W: http://www.syskonnect.com 2701W: http://www.syskonnect.com
2703S: Supported 2702S: Supported
2704 2703
2705MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7 2704MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7
2706P: Michael Kerrisk 2705P: Michael Kerrisk
2707M: mtk.manpages@gmail.com 2706M: mtk.manpages@gmail.com
2708W: http://www.kernel.org/doc/man-pages 2707W: http://www.kernel.org/doc/man-pages
2709S: Supported 2708L: linux-man@vger.kernel.org
2709S: Supported
2710 2710
2711MARVELL LIBERTAS WIRELESS DRIVER 2711MARVELL LIBERTAS WIRELESS DRIVER
2712P: Dan Williams 2712P: Dan Williams
@@ -2735,7 +2735,7 @@ S: Maintained
2735MEGARAID SCSI DRIVERS 2735MEGARAID SCSI DRIVERS
2736P: Neela Syam Kolli 2736P: Neela Syam Kolli
2737M: megaraidlinux@lsi.com 2737M: megaraidlinux@lsi.com
2738S: linux-scsi@vger.kernel.org 2738L: linux-scsi@vger.kernel.org
2739W: http://megaraid.lsilogic.com 2739W: http://megaraid.lsilogic.com
2740S: Maintained 2740S: Maintained
2741 2741
@@ -2853,7 +2853,7 @@ MULTIMEDIA CARD (MMC) ETC. OVER SPI
2853P: David Brownell 2853P: David Brownell
2854M: dbrownell@users.sourceforge.net 2854M: dbrownell@users.sourceforge.net
2855L: linux-kernel@vger.kernel.org 2855L: linux-kernel@vger.kernel.org
2856S: Odd fixes 2856S: Odd Fixes
2857 2857
2858MULTISOUND SOUND DRIVER 2858MULTISOUND SOUND DRIVER
2859P: Andrew Veliath 2859P: Andrew Veliath
@@ -2867,10 +2867,10 @@ L: linux-kernel@vger.kernel.org
2867S: Maintained 2867S: Maintained
2868 2868
2869MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER 2869MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER
2870P: Felipe Balbi 2870P: Felipe Balbi
2871M: felipe.balbi@nokia.com 2871M: felipe.balbi@nokia.com
2872L: linux-usb@vger.kernel.org 2872L: linux-usb@vger.kernel.org
2873S: Maintained 2873S: Maintained
2874 2874
2875MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE) 2875MYRICOM MYRI-10G 10GbE DRIVER (MYRI10GE)
2876P: Andrew Gallatin 2876P: Andrew Gallatin
@@ -2882,7 +2882,7 @@ W: http://www.myri.com/scs/download-Myri10GE.html
2882S: Supported 2882S: Supported
2883 2883
2884NATSEMI ETHERNET DRIVER (DP8381x) 2884NATSEMI ETHERNET DRIVER (DP8381x)
2885P: Tim Hockin 2885P: Tim Hockin
2886M: thockin@hockin.org 2886M: thockin@hockin.org
2887S: Maintained 2887S: Maintained
2888 2888
@@ -3101,7 +3101,7 @@ M: laforge@gnumonks.org
3101S: Maintained 3101S: Maintained
3102 3102
3103OMNIVISION OV7670 SENSOR DRIVER 3103OMNIVISION OV7670 SENSOR DRIVER
3104P: Jonathan Corbet 3104P: Jonathan Corbet
3105M: corbet@lwn.net 3105M: corbet@lwn.net
3106L: video4linux-list@redhat.com 3106L: video4linux-list@redhat.com
3107S: Maintained 3107S: Maintained
@@ -3211,7 +3211,7 @@ T: git kernel.org:/pub/scm/linux/kernel/git/jbarnes/pci-2.6.git
3211S: Supported 3211S: Supported
3212 3212
3213PCI HOTPLUG CORE 3213PCI HOTPLUG CORE
3214P: Kristen Carlson Accardi 3214P: Kristen Carlson Accardi
3215M: kristen.c.accardi@intel.com 3215M: kristen.c.accardi@intel.com
3216S: Supported 3216S: Supported
3217 3217
@@ -3650,7 +3650,7 @@ M: jmorris@namei.org
3650P: Eric Paris 3650P: Eric Paris
3651M: eparis@parisplace.org 3651M: eparis@parisplace.org
3652L: linux-kernel@vger.kernel.org (kernel issues) 3652L: linux-kernel@vger.kernel.org (kernel issues)
3653L: selinux@tycho.nsa.gov (subscribers-only, general discussion) 3653L: selinux@tycho.nsa.gov (subscribers-only, general discussion)
3654W: http://www.nsa.gov/selinux 3654W: http://www.nsa.gov/selinux
3655S: Supported 3655S: Supported
3656 3656
@@ -3726,7 +3726,7 @@ S: Maintained
3726SIS 96X I2C/SMBUS DRIVER 3726SIS 96X I2C/SMBUS DRIVER
3727P: Mark M. Hoffman 3727P: Mark M. Hoffman
3728M: mhoffman@lightlink.com 3728M: mhoffman@lightlink.com
3729L: lm-sensors@lm-sensors.org 3729L: i2c@lm-sensors.org
3730S: Maintained 3730S: Maintained
3731 3731
3732SIS FRAMEBUFFER DRIVER 3732SIS FRAMEBUFFER DRIVER
@@ -3768,10 +3768,10 @@ M: bn@niasdigital.com
3768S: Maintained 3768S: Maintained
3769 3769
3770SOC-CAMERA V4L2 SUBSYSTEM 3770SOC-CAMERA V4L2 SUBSYSTEM
3771P: Guennadi Liakhovetski 3771P: Guennadi Liakhovetski
3772M: g.liakhovetski@gmx.de 3772M: g.liakhovetski@gmx.de
3773L: video4linux-list@redhat.com 3773L: video4linux-list@redhat.com
3774S: Maintained 3774S: Maintained
3775 3775
3776SOFTWARE RAID (Multiple Disks) SUPPORT 3776SOFTWARE RAID (Multiple Disks) SUPPORT
3777P: Ingo Molnar 3777P: Ingo Molnar
@@ -3833,11 +3833,12 @@ S: Maintained
3833 3833
3834SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT 3834SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEMENT
3835P: Liam Girdwood 3835P: Liam Girdwood
3836M: liam.girdwood@wolfsonmicro.com 3836M: lrg@slimlogic.co.uk
3837P: Mark Brown 3837P: Mark Brown
3838M: broonie@opensource.wolfsonmicro.com 3838M: broonie@opensource.wolfsonmicro.com
3839T: git opensource.wolfsonmicro.com/linux-2.6-asoc 3839T: git opensource.wolfsonmicro.com/linux-2.6-asoc
3840L: alsa-devel@alsa-project.org (subscribers-only) 3840L: alsa-devel@alsa-project.org (subscribers-only)
3841W: http://alsa-project.org/main/index.php/ASoC
3841S: Supported 3842S: Supported
3842 3843
3843SPI SUBSYSTEM 3844SPI SUBSYSTEM
@@ -3925,7 +3926,7 @@ S: Maintained
3925 3926
3926STARMODE RADIO IP (STRIP) PROTOCOL DRIVER 3927STARMODE RADIO IP (STRIP) PROTOCOL DRIVER
3927W: http://mosquitonet.Stanford.EDU/strip.html 3928W: http://mosquitonet.Stanford.EDU/strip.html
3928S: Unsupported ? 3929S: Orphan
3929 3930
3930STRADIS MPEG-2 DECODER DRIVER 3931STRADIS MPEG-2 DECODER DRIVER
3931P: Nathan Laredo 3932P: Nathan Laredo
@@ -4006,9 +4007,9 @@ T: git repo.or.cz/linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git
4006S: Maintained 4007S: Maintained
4007 4008
4008TI FLASH MEDIA INTERFACE DRIVER 4009TI FLASH MEDIA INTERFACE DRIVER
4009P: Alex Dubov 4010P: Alex Dubov
4010M: oakad@yahoo.com 4011M: oakad@yahoo.com
4011S: Maintained 4012S: Maintained
4012 4013
4013TI OMAP MMC INTERFACE DRIVER 4014TI OMAP MMC INTERFACE DRIVER
4014P: Carlos Aguiar, Anderson Briglia and Syed Khasim 4015P: Carlos Aguiar, Anderson Briglia and Syed Khasim
@@ -4154,13 +4155,13 @@ USB BLOCK DRIVER (UB ub)
4154P: Pete Zaitcev 4155P: Pete Zaitcev
4155M: zaitcev@redhat.com 4156M: zaitcev@redhat.com
4156L: linux-kernel@vger.kernel.org 4157L: linux-kernel@vger.kernel.org
4157L: linux-usb@vger.kernel.org 4158L: linux-usb@vger.kernel.org
4158S: Supported 4159S: Supported
4159 4160
4160USB CDC ETHERNET DRIVER 4161USB CDC ETHERNET DRIVER
4161P: Greg Kroah-Hartman 4162P: Greg Kroah-Hartman
4162M: greg@kroah.com 4163M: greg@kroah.com
4163L: linux-usb@vger.kernel.org 4164L: linux-usb@vger.kernel.org
4164S: Maintained 4165S: Maintained
4165W: http://www.kroah.com/linux-usb/ 4166W: http://www.kroah.com/linux-usb/
4166 4167
@@ -4187,13 +4188,13 @@ S: Maintained
4187USB EHCI DRIVER 4188USB EHCI DRIVER
4188P: David Brownell 4189P: David Brownell
4189M: dbrownell@users.sourceforge.net 4190M: dbrownell@users.sourceforge.net
4190L: linux-usb@vger.kernel.org 4191L: linux-usb@vger.kernel.org
4191S: Odd Fixes 4192S: Odd Fixes
4192 4193
4193USB ET61X[12]51 DRIVER 4194USB ET61X[12]51 DRIVER
4194P: Luca Risolia 4195P: Luca Risolia
4195M: luca.risolia@studio.unibo.it 4196M: luca.risolia@studio.unibo.it
4196L: linux-usb@vger.kernel.org 4197L: linux-usb@vger.kernel.org
4197L: video4linux-list@redhat.com 4198L: video4linux-list@redhat.com
4198W: http://www.linux-projects.org 4199W: http://www.linux-projects.org
4199S: Maintained 4200S: Maintained
@@ -4201,33 +4202,33 @@ S: Maintained
4201USB GADGET/PERIPHERAL SUBSYSTEM 4202USB GADGET/PERIPHERAL SUBSYSTEM
4202P: David Brownell 4203P: David Brownell
4203M: dbrownell@users.sourceforge.net 4204M: dbrownell@users.sourceforge.net
4204L: linux-usb@vger.kernel.org 4205L: linux-usb@vger.kernel.org
4205W: http://www.linux-usb.org/gadget 4206W: http://www.linux-usb.org/gadget
4206S: Maintained 4207S: Maintained
4207 4208
4208USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...) 4209USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...)
4209P: Jiri Kosina 4210P: Jiri Kosina
4210M: jkosina@suse.cz 4211M: jkosina@suse.cz
4211L: linux-usb@vger.kernel.org 4212L: linux-usb@vger.kernel.org
4212T: git kernel.org:/pub/scm/linux/kernel/git/jikos/hid.git 4213T: git kernel.org:/pub/scm/linux/kernel/git/jikos/hid.git
4213S: Maintained 4214S: Maintained
4214 4215
4215USB ISP116X DRIVER 4216USB ISP116X DRIVER
4216P: Olav Kongas 4217P: Olav Kongas
4217M: ok@artecdesign.ee 4218M: ok@artecdesign.ee
4218L: linux-usb@vger.kernel.org 4219L: linux-usb@vger.kernel.org
4219S: Maintained 4220S: Maintained
4220 4221
4221USB KAWASAKI LSI DRIVER 4222USB KAWASAKI LSI DRIVER
4222P: Oliver Neukum 4223P: Oliver Neukum
4223M: oliver@neukum.name 4224M: oliver@neukum.name
4224L: linux-usb@vger.kernel.org 4225L: linux-usb@vger.kernel.org
4225S: Maintained 4226S: Maintained
4226 4227
4227USB MASS STORAGE DRIVER 4228USB MASS STORAGE DRIVER
4228P: Matthew Dharm 4229P: Matthew Dharm
4229M: mdharm-usb@one-eyed-alien.net 4230M: mdharm-usb@one-eyed-alien.net
4230L: linux-usb@vger.kernel.org 4231L: linux-usb@vger.kernel.org
4231L: usb-storage@lists.one-eyed-alien.net 4232L: usb-storage@lists.one-eyed-alien.net
4232S: Maintained 4233S: Maintained
4233W: http://www.one-eyed-alien.net/~mdharm/linux-usb/ 4234W: http://www.one-eyed-alien.net/~mdharm/linux-usb/
@@ -4235,26 +4236,26 @@ W: http://www.one-eyed-alien.net/~mdharm/linux-usb/
4235USB OHCI DRIVER 4236USB OHCI DRIVER
4236P: David Brownell 4237P: David Brownell
4237M: dbrownell@users.sourceforge.net 4238M: dbrownell@users.sourceforge.net
4238L: linux-usb@vger.kernel.org 4239L: linux-usb@vger.kernel.org
4239S: Odd Fixes 4240S: Odd Fixes
4240 4241
4241USB OPTION-CARD DRIVER 4242USB OPTION-CARD DRIVER
4242P: Matthias Urlichs 4243P: Matthias Urlichs
4243M: smurf@smurf.noris.de 4244M: smurf@smurf.noris.de
4244L: linux-usb@vger.kernel.org 4245L: linux-usb@vger.kernel.org
4245S: Maintained 4246S: Maintained
4246 4247
4247USB OV511 DRIVER 4248USB OV511 DRIVER
4248P: Mark McClelland 4249P: Mark McClelland
4249M: mmcclell@bigfoot.com 4250M: mmcclell@bigfoot.com
4250L: linux-usb@vger.kernel.org 4251L: linux-usb@vger.kernel.org
4251W: http://alpha.dyndns.org/ov511/ 4252W: http://alpha.dyndns.org/ov511/
4252S: Maintained 4253S: Maintained
4253 4254
4254USB PEGASUS DRIVER 4255USB PEGASUS DRIVER
4255P: Petko Manolov 4256P: Petko Manolov
4256M: petkan@users.sourceforge.net 4257M: petkan@users.sourceforge.net
4257L: linux-usb@vger.kernel.org 4258L: linux-usb@vger.kernel.org
4258L: netdev@vger.kernel.org 4259L: netdev@vger.kernel.org
4259W: http://pegasus2.sourceforge.net/ 4260W: http://pegasus2.sourceforge.net/
4260S: Maintained 4261S: Maintained
@@ -4262,13 +4263,13 @@ S: Maintained
4262USB PRINTER DRIVER (usblp) 4263USB PRINTER DRIVER (usblp)
4263P: Pete Zaitcev 4264P: Pete Zaitcev
4264M: zaitcev@redhat.com 4265M: zaitcev@redhat.com
4265L: linux-usb@vger.kernel.org 4266L: linux-usb@vger.kernel.org
4266S: Supported 4267S: Supported
4267 4268
4268USB RTL8150 DRIVER 4269USB RTL8150 DRIVER
4269P: Petko Manolov 4270P: Petko Manolov
4270M: petkan@users.sourceforge.net 4271M: petkan@users.sourceforge.net
4271L: linux-usb@vger.kernel.org 4272L: linux-usb@vger.kernel.org
4272L: netdev@vger.kernel.org 4273L: netdev@vger.kernel.org
4273W: http://pegasus2.sourceforge.net/ 4274W: http://pegasus2.sourceforge.net/
4274S: Maintained 4275S: Maintained
@@ -4276,20 +4277,20 @@ S: Maintained
4276USB SE401 DRIVER 4277USB SE401 DRIVER
4277P: Jeroen Vreeken 4278P: Jeroen Vreeken
4278M: pe1rxq@amsat.org 4279M: pe1rxq@amsat.org
4279L: linux-usb@vger.kernel.org 4280L: linux-usb@vger.kernel.org
4280W: http://www.chello.nl/~j.vreeken/se401/ 4281W: http://www.chello.nl/~j.vreeken/se401/
4281S: Maintained 4282S: Maintained
4282 4283
4283USB SERIAL BELKIN F5U103 DRIVER 4284USB SERIAL BELKIN F5U103 DRIVER
4284P: William Greathouse 4285P: William Greathouse
4285M: wgreathouse@smva.com 4286M: wgreathouse@smva.com
4286L: linux-usb@vger.kernel.org 4287L: linux-usb@vger.kernel.org
4287S: Maintained 4288S: Maintained
4288 4289
4289USB SERIAL CYPRESS M8 DRIVER 4290USB SERIAL CYPRESS M8 DRIVER
4290P: Lonnie Mendez 4291P: Lonnie Mendez
4291M: dignome@gmail.com 4292M: dignome@gmail.com
4292L: linux-usb@vger.kernel.org 4293L: linux-usb@vger.kernel.org
4293S: Maintained 4294S: Maintained
4294W: http://geocities.com/i0xox0i 4295W: http://geocities.com/i0xox0i
4295W: http://firstlight.net/cvs 4296W: http://firstlight.net/cvs
@@ -4304,39 +4305,39 @@ USB SERIAL DIGI ACCELEPORT DRIVER
4304P: Peter Berger and Al Borchers 4305P: Peter Berger and Al Borchers
4305M: pberger@brimson.com 4306M: pberger@brimson.com
4306M: alborchers@steinerpoint.com 4307M: alborchers@steinerpoint.com
4307L: linux-usb@vger.kernel.org 4308L: linux-usb@vger.kernel.org
4308S: Maintained 4309S: Maintained
4309 4310
4310USB SERIAL DRIVER 4311USB SERIAL DRIVER
4311P: Greg Kroah-Hartman 4312P: Greg Kroah-Hartman
4312M: gregkh@suse.de 4313M: gregkh@suse.de
4313L: linux-usb@vger.kernel.org 4314L: linux-usb@vger.kernel.org
4314S: Supported 4315S: Supported
4315 4316
4316USB SERIAL EMPEG EMPEG-CAR MARK I/II DRIVER 4317USB SERIAL EMPEG EMPEG-CAR MARK I/II DRIVER
4317P: Gary Brubaker 4318P: Gary Brubaker
4318M: xavyer@ix.netcom.com 4319M: xavyer@ix.netcom.com
4319L: linux-usb@vger.kernel.org 4320L: linux-usb@vger.kernel.org
4320S: Maintained 4321S: Maintained
4321 4322
4322USB SERIAL KEYSPAN DRIVER 4323USB SERIAL KEYSPAN DRIVER
4323P: Greg Kroah-Hartman 4324P: Greg Kroah-Hartman
4324M: greg@kroah.com 4325M: greg@kroah.com
4325L: linux-usb@vger.kernel.org 4326L: linux-usb@vger.kernel.org
4326W: http://www.kroah.com/linux/ 4327W: http://www.kroah.com/linux/
4327S: Maintained 4328S: Maintained
4328 4329
4329USB SERIAL WHITEHEAT DRIVER 4330USB SERIAL WHITEHEAT DRIVER
4330P: Support Department 4331P: Support Department
4331M: support@connecttech.com 4332M: support@connecttech.com
4332L: linux-usb@vger.kernel.org 4333L: linux-usb@vger.kernel.org
4333W: http://www.connecttech.com 4334W: http://www.connecttech.com
4334S: Supported 4335S: Supported
4335 4336
4336USB SN9C1xx DRIVER 4337USB SN9C1xx DRIVER
4337P: Luca Risolia 4338P: Luca Risolia
4338M: luca.risolia@studio.unibo.it 4339M: luca.risolia@studio.unibo.it
4339L: linux-usb@vger.kernel.org 4340L: linux-usb@vger.kernel.org
4340L: video4linux-list@redhat.com 4341L: video4linux-list@redhat.com
4341W: http://www.linux-projects.org 4342W: http://www.linux-projects.org
4342S: Maintained 4343S: Maintained
@@ -4344,7 +4345,7 @@ S: Maintained
4344USB SUBSYSTEM 4345USB SUBSYSTEM
4345P: Greg Kroah-Hartman 4346P: Greg Kroah-Hartman
4346M: gregkh@suse.de 4347M: gregkh@suse.de
4347L: linux-usb@vger.kernel.org 4348L: linux-usb@vger.kernel.org
4348W: http://www.linux-usb.org 4349W: http://www.linux-usb.org
4349T: quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/ 4350T: quilt kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
4350S: Supported 4351S: Supported
@@ -4352,7 +4353,7 @@ S: Supported
4352USB UHCI DRIVER 4353USB UHCI DRIVER
4353P: Alan Stern 4354P: Alan Stern
4354M: stern@rowland.harvard.edu 4355M: stern@rowland.harvard.edu
4355L: linux-usb@vger.kernel.org 4356L: linux-usb@vger.kernel.org
4356S: Maintained 4357S: Maintained
4357 4358
4358USB "USBNET" DRIVER FRAMEWORK 4359USB "USBNET" DRIVER FRAMEWORK
@@ -4365,7 +4366,7 @@ S: Maintained
4365USB VIDEO CLASS 4366USB VIDEO CLASS
4366P: Laurent Pinchart 4367P: Laurent Pinchart
4367M: laurent.pinchart@skynet.be 4368M: laurent.pinchart@skynet.be
4368L: linx-uvc-devel@berlios.de 4369L: linux-uvc-devel@lists.berlios.de
4369L: video4linux-list@redhat.com 4370L: video4linux-list@redhat.com
4370W: http://linux-uvc.berlios.de 4371W: http://linux-uvc.berlios.de
4371S: Maintained 4372S: Maintained
@@ -4373,7 +4374,7 @@ S: Maintained
4373USB W996[87]CF DRIVER 4374USB W996[87]CF DRIVER
4374P: Luca Risolia 4375P: Luca Risolia
4375M: luca.risolia@studio.unibo.it 4376M: luca.risolia@studio.unibo.it
4376L: linux-usb@vger.kernel.org 4377L: linux-usb@vger.kernel.org
4377L: video4linux-list@redhat.com 4378L: video4linux-list@redhat.com
4378W: http://www.linux-projects.org 4379W: http://www.linux-projects.org
4379S: Maintained 4380S: Maintained
@@ -4387,7 +4388,7 @@ S: Maintained
4387USB ZC0301 DRIVER 4388USB ZC0301 DRIVER
4388P: Luca Risolia 4389P: Luca Risolia
4389M: luca.risolia@studio.unibo.it 4390M: luca.risolia@studio.unibo.it
4390L: linux-usb@vger.kernel.org 4391L: linux-usb@vger.kernel.org
4391L: video4linux-list@redhat.com 4392L: video4linux-list@redhat.com
4392W: http://www.linux-projects.org 4393W: http://www.linux-projects.org
4393S: Maintained 4394S: Maintained
@@ -4395,14 +4396,14 @@ S: Maintained
4395USB ZD1201 DRIVER 4396USB ZD1201 DRIVER
4396P: Jeroen Vreeken 4397P: Jeroen Vreeken
4397M: pe1rxq@amsat.org 4398M: pe1rxq@amsat.org
4398L: linux-usb@vger.kernel.org 4399L: linux-usb@vger.kernel.org
4399W: http://linux-lc100020.sourceforge.net 4400W: http://linux-lc100020.sourceforge.net
4400S: Maintained 4401S: Maintained
4401 4402
4402USB ZR364XX DRIVER 4403USB ZR364XX DRIVER
4403P: Antoine Jacquet 4404P: Antoine Jacquet
4404M: royale@zerezo.com 4405M: royale@zerezo.com
4405L: linux-usb@vger.kernel.org 4406L: linux-usb@vger.kernel.org
4406L: video4linux-list@redhat.com 4407L: video4linux-list@redhat.com
4407W: http://royale.zerezo.com/zr364xx/ 4408W: http://royale.zerezo.com/zr364xx/
4408S: Maintained 4409S: Maintained
diff --git a/Makefile b/Makefile
index 4ff83ea36c19..16e3fbb968a8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 27 3SUBLEVEL = 27
4EXTRAVERSION = -rc6 4EXTRAVERSION =
5NAME = Rotary Wombat 5NAME = Rotary Wombat
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/include/asm/pci.h b/arch/arm/include/asm/pci.h
index 721c03d53f4b..918d0cbbf064 100644
--- a/arch/arm/include/asm/pci.h
+++ b/arch/arm/include/asm/pci.h
@@ -30,7 +30,7 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
30 * The networking and block device layers use this boolean for bounce 30 * The networking and block device layers use this boolean for bounce
31 * buffer decisions. 31 * buffer decisions.
32 */ 32 */
33#define PCI_DMA_BUS_IS_PHYS (0) 33#define PCI_DMA_BUS_IS_PHYS (1)
34 34
35/* 35/*
36 * Whether pci_unmap_{single,page} is a nop depends upon the 36 * Whether pci_unmap_{single,page} is a nop depends upon the
diff --git a/arch/arm/kernel/kgdb.c b/arch/arm/kernel/kgdb.c
index aaffaecffcd1..ba8ccfede964 100644
--- a/arch/arm/kernel/kgdb.c
+++ b/arch/arm/kernel/kgdb.c
@@ -111,8 +111,6 @@ int kgdb_arch_handle_exception(int exception_vector, int signo,
111 case 'D': 111 case 'D':
112 case 'k': 112 case 'k':
113 case 'c': 113 case 'c':
114 kgdb_contthread = NULL;
115
116 /* 114 /*
117 * Try to read optional parameter, pc unchanged if no parm. 115 * Try to read optional parameter, pc unchanged if no parm.
118 * If this was a compiled breakpoint, we need to move 116 * If this was a compiled breakpoint, we need to move
diff --git a/arch/arm/mach-davinci/psc.c b/arch/arm/mach-davinci/psc.c
index 720c48b9ee04..aa2fc375a325 100644
--- a/arch/arm/mach-davinci/psc.c
+++ b/arch/arm/mach-davinci/psc.c
@@ -70,9 +70,6 @@ void davinci_psc_config(unsigned int domain, unsigned int id, char enable)
70{ 70{
71 u32 epcpr, ptcmd, ptstat, pdstat, pdctl1, mdstat, mdctl, mdstat_mask; 71 u32 epcpr, ptcmd, ptstat, pdstat, pdctl1, mdstat, mdctl, mdstat_mask;
72 72
73 if (id < 0)
74 return;
75
76 mdctl = davinci_readl(DAVINCI_PWR_SLEEP_CNTRL_BASE + MDCTL + 4 * id); 73 mdctl = davinci_readl(DAVINCI_PWR_SLEEP_CNTRL_BASE + MDCTL + 4 * id);
77 if (enable) 74 if (enable)
78 mdctl |= 0x00000003; /* Enable Module */ 75 mdctl |= 0x00000003; /* Enable Module */
diff --git a/arch/arm/mach-mx3/pcm037.c b/arch/arm/mach-mx3/pcm037.c
index 0a152ed15a85..df8582a6231b 100644
--- a/arch/arm/mach-mx3/pcm037.c
+++ b/arch/arm/mach-mx3/pcm037.c
@@ -54,7 +54,7 @@ static struct platform_device pcm037_flash = {
54}; 54};
55 55
56static struct imxuart_platform_data uart_pdata = { 56static struct imxuart_platform_data uart_pdata = {
57 .flags = 0, 57 .flags = IMXUART_HAVE_RTSCTS,
58}; 58};
59 59
60static struct platform_device *devices[] __initdata = { 60static struct platform_device *devices[] __initdata = {
diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c
index 67e18509d7bf..b0d6b32654cf 100644
--- a/arch/arm/mach-pxa/time.c
+++ b/arch/arm/mach-pxa/time.c
@@ -17,9 +17,9 @@
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/clockchips.h> 18#include <linux/clockchips.h>
19#include <linux/sched.h> 19#include <linux/sched.h>
20#include <linux/cnt32_to_63.h>
20 21
21#include <asm/div64.h> 22#include <asm/div64.h>
22#include <asm/cnt32_to_63.h>
23#include <asm/mach/irq.h> 23#include <asm/mach/irq.h>
24#include <asm/mach/time.h> 24#include <asm/mach/time.h>
25#include <mach/pxa-regs.h> 25#include <mach/pxa-regs.h>
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 5dab30eafddc..9f3ef9eb32e3 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -50,6 +50,7 @@
50#include <asm/mach/sharpsl_param.h> 50#include <asm/mach/sharpsl_param.h>
51 51
52#include "generic.h" 52#include "generic.h"
53#include "clock.h"
53#include "devices.h" 54#include "devices.h"
54 55
55static unsigned long tosa_pin_config[] = { 56static unsigned long tosa_pin_config[] = {
@@ -521,6 +522,14 @@ static struct gpio_keys_button tosa_gpio_keys[] = {
521 .wakeup = 1, 522 .wakeup = 1,
522 .active_low = 1, 523 .active_low = 1,
523 }, 524 },
525 {
526 .type = EV_SW,
527 .code = SW_HEADPHONE_INSERT,
528 .gpio = TOSA_GPIO_EAR_IN,
529 .desc = "HeadPhone insert",
530 .active_low = 1,
531 .debounce_interval = 300,
532 },
524}; 533};
525 534
526static struct gpio_keys_platform_data tosa_gpio_keys_platform_data = { 535static struct gpio_keys_platform_data tosa_gpio_keys_platform_data = {
@@ -792,6 +801,8 @@ static void __init tosa_init(void)
792 pxa_set_i2c_info(NULL); 801 pxa_set_i2c_info(NULL);
793 platform_scoop_config = &tosa_pcmcia_config; 802 platform_scoop_config = &tosa_pcmcia_config;
794 803
804 clk_add_alias("CLK_CK3P6MI", &tc6393xb_device.dev, "GPIO11_CLK", NULL);
805
795 platform_add_devices(devices, ARRAY_SIZE(devices)); 806 platform_add_devices(devices, ARRAY_SIZE(devices));
796} 807}
797 808
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 1362994c78aa..b422526f6d8b 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -18,9 +18,9 @@
18#include <linux/ioport.h> 18#include <linux/ioport.h>
19#include <linux/sched.h> /* just for sched_clock() - funny that */ 19#include <linux/sched.h> /* just for sched_clock() - funny that */
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/cnt32_to_63.h>
21 22
22#include <asm/div64.h> 23#include <asm/div64.h>
23#include <asm/cnt32_to_63.h>
24#include <mach/hardware.h> 24#include <mach/hardware.h>
25#include <asm/system.h> 25#include <asm/system.h>
26#include <asm/pgtable.h> 26#include <asm/pgtable.h>
diff --git a/arch/arm/mach-sa1100/include/mach/jornada720.h b/arch/arm/mach-sa1100/include/mach/jornada720.h
index bc120850d313..cc6b4bfcecf6 100644
--- a/arch/arm/mach-sa1100/include/mach/jornada720.h
+++ b/arch/arm/mach-sa1100/include/mach/jornada720.h
@@ -1,10 +1,10 @@
1/* 1/*
2 * arch/arm/mach-sa1100/include/mach/jornada720.h 2 * arch/arm/mach-sa1100/include/mach/jornada720.h
3 * 3 *
4 * This file contains SSP/MCU communication definitions for HP Jornada 710/720/728 4 * SSP/MCU communication definitions for HP Jornada 710/720/728
5 * 5 *
6 * Copyright (C) 2007 Kristoffer Ericson <Kristoffer.Ericson@gmail.com> 6 * Copyright 2007,2008 Kristoffer Ericson <Kristoffer.Ericson@gmail.com>
7 * Copyright (C) 2000 John Ankcorn <jca@lcs.mit.edu> 7 * Copyright 2000 John Ankcorn <jca@lcs.mit.edu>
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
@@ -25,3 +25,8 @@
25#define PWMOFF 0xDF 25#define PWMOFF 0xDF
26#define TXDUMMY 0x11 26#define TXDUMMY 0x11
27#define ERRORCODE 0x00 27#define ERRORCODE 0x00
28
29extern void jornada_ssp_start(void);
30extern void jornada_ssp_end(void);
31extern int jornada_ssp_inout(u8 byte);
32extern int jornada_ssp_byte(u8 byte);
diff --git a/arch/arm/mach-sa1100/jornada720_ssp.c b/arch/arm/mach-sa1100/jornada720_ssp.c
index 06ea7abd9170..28cf36967977 100644
--- a/arch/arm/mach-sa1100/jornada720_ssp.c
+++ b/arch/arm/mach-sa1100/jornada720_ssp.c
@@ -21,8 +21,8 @@
21#include <linux/slab.h> 21#include <linux/slab.h>
22 22
23#include <mach/hardware.h> 23#include <mach/hardware.h>
24#include <asm/hardware/ssp.h>
25#include <mach/jornada720.h> 24#include <mach/jornada720.h>
25#include <asm/hardware/ssp.h>
26 26
27static DEFINE_SPINLOCK(jornada_ssp_lock); 27static DEFINE_SPINLOCK(jornada_ssp_lock);
28static unsigned long jornada_ssp_flags; 28static unsigned long jornada_ssp_flags;
@@ -109,12 +109,12 @@ EXPORT_SYMBOL(jornada_ssp_inout);
109 * jornada_ssp_start - enable mcu 109 * jornada_ssp_start - enable mcu
110 * 110 *
111 */ 111 */
112int jornada_ssp_start() 112void jornada_ssp_start(void)
113{ 113{
114 spin_lock_irqsave(&jornada_ssp_lock, jornada_ssp_flags); 114 spin_lock_irqsave(&jornada_ssp_lock, jornada_ssp_flags);
115 GPCR = GPIO_GPIO25; 115 GPCR = GPIO_GPIO25;
116 udelay(50); 116 udelay(50);
117 return 0; 117 return;
118}; 118};
119EXPORT_SYMBOL(jornada_ssp_start); 119EXPORT_SYMBOL(jornada_ssp_start);
120 120
@@ -122,11 +122,11 @@ EXPORT_SYMBOL(jornada_ssp_start);
122 * jornada_ssp_end - disable mcu and turn off lock 122 * jornada_ssp_end - disable mcu and turn off lock
123 * 123 *
124 */ 124 */
125int jornada_ssp_end() 125void jornada_ssp_end(void)
126{ 126{
127 GPSR = GPIO_GPIO25; 127 GPSR = GPIO_GPIO25;
128 spin_unlock_irqrestore(&jornada_ssp_lock, jornada_ssp_flags); 128 spin_unlock_irqrestore(&jornada_ssp_lock, jornada_ssp_flags);
129 return 0; 129 return;
130}; 130};
131EXPORT_SYMBOL(jornada_ssp_end); 131EXPORT_SYMBOL(jornada_ssp_end);
132 132
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index d75e795c893e..b638f10411e8 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -28,8 +28,8 @@
28#include <linux/amba/clcd.h> 28#include <linux/amba/clcd.h>
29#include <linux/clocksource.h> 29#include <linux/clocksource.h>
30#include <linux/clockchips.h> 30#include <linux/clockchips.h>
31#include <linux/cnt32_to_63.h>
31 32
32#include <asm/cnt32_to_63.h>
33#include <asm/system.h> 33#include <asm/system.h>
34#include <mach/hardware.h> 34#include <mach/hardware.h>
35#include <asm/io.h> 35#include <asm/io.h>
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index 187e3d8bfdfe..01da719a7453 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -21,6 +21,7 @@
21 21
22#include <mach/tc.h> 22#include <mach/tc.h>
23#include <mach/board.h> 23#include <mach/board.h>
24#include <mach/mmc.h>
24#include <mach/mux.h> 25#include <mach/mux.h>
25#include <mach/gpio.h> 26#include <mach/gpio.h>
26#include <mach/menelaus.h> 27#include <mach/menelaus.h>
@@ -194,25 +195,38 @@ void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
194 195
195/*-------------------------------------------------------------------------*/ 196/*-------------------------------------------------------------------------*/
196 197
197#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) 198#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
199 defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
198 200
199#ifdef CONFIG_ARCH_OMAP24XX 201#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
200#define OMAP_MMC1_BASE 0x4809c000 202#define OMAP_MMC1_BASE 0x4809c000
201#define OMAP_MMC1_INT INT_24XX_MMC_IRQ 203#define OMAP_MMC1_END (OMAP_MMC1_BASE + 0x1fc)
204#define OMAP_MMC1_INT INT_24XX_MMC_IRQ
205
206#define OMAP_MMC2_BASE 0x480b4000
207#define OMAP_MMC2_END (OMAP_MMC2_BASE + 0x1fc)
208#define OMAP_MMC2_INT INT_24XX_MMC2_IRQ
209
202#else 210#else
211
203#define OMAP_MMC1_BASE 0xfffb7800 212#define OMAP_MMC1_BASE 0xfffb7800
213#define OMAP_MMC1_END (OMAP_MMC1_BASE + 0x7f)
204#define OMAP_MMC1_INT INT_MMC 214#define OMAP_MMC1_INT INT_MMC
205#endif 215
206#define OMAP_MMC2_BASE 0xfffb7c00 /* omap16xx only */ 216#define OMAP_MMC2_BASE 0xfffb7c00 /* omap16xx only */
217#define OMAP_MMC2_END (OMAP_MMC2_BASE + 0x7f)
218#define OMAP_MMC2_INT INT_1610_MMC2
219
220#endif
207 221
208static struct omap_mmc_conf mmc1_conf; 222static struct omap_mmc_platform_data mmc1_data;
209 223
210static u64 mmc1_dmamask = 0xffffffff; 224static u64 mmc1_dmamask = 0xffffffff;
211 225
212static struct resource mmc1_resources[] = { 226static struct resource mmc1_resources[] = {
213 { 227 {
214 .start = OMAP_MMC1_BASE, 228 .start = OMAP_MMC1_BASE,
215 .end = OMAP_MMC1_BASE + 0x7f, 229 .end = OMAP_MMC1_END,
216 .flags = IORESOURCE_MEM, 230 .flags = IORESOURCE_MEM,
217 }, 231 },
218 { 232 {
@@ -226,26 +240,27 @@ static struct platform_device mmc_omap_device1 = {
226 .id = 1, 240 .id = 1,
227 .dev = { 241 .dev = {
228 .dma_mask = &mmc1_dmamask, 242 .dma_mask = &mmc1_dmamask,
229 .platform_data = &mmc1_conf, 243 .platform_data = &mmc1_data,
230 }, 244 },
231 .num_resources = ARRAY_SIZE(mmc1_resources), 245 .num_resources = ARRAY_SIZE(mmc1_resources),
232 .resource = mmc1_resources, 246 .resource = mmc1_resources,
233}; 247};
234 248
235#ifdef CONFIG_ARCH_OMAP16XX 249#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2430) || \
250 defined(CONFIG_ARCH_OMAP34XX)
236 251
237static struct omap_mmc_conf mmc2_conf; 252static struct omap_mmc_platform_data mmc2_data;
238 253
239static u64 mmc2_dmamask = 0xffffffff; 254static u64 mmc2_dmamask = 0xffffffff;
240 255
241static struct resource mmc2_resources[] = { 256static struct resource mmc2_resources[] = {
242 { 257 {
243 .start = OMAP_MMC2_BASE, 258 .start = OMAP_MMC2_BASE,
244 .end = OMAP_MMC2_BASE + 0x7f, 259 .end = OMAP_MMC2_END,
245 .flags = IORESOURCE_MEM, 260 .flags = IORESOURCE_MEM,
246 }, 261 },
247 { 262 {
248 .start = INT_1610_MMC2, 263 .start = OMAP_MMC2_INT,
249 .flags = IORESOURCE_IRQ, 264 .flags = IORESOURCE_IRQ,
250 }, 265 },
251}; 266};
@@ -255,26 +270,19 @@ static struct platform_device mmc_omap_device2 = {
255 .id = 2, 270 .id = 2,
256 .dev = { 271 .dev = {
257 .dma_mask = &mmc2_dmamask, 272 .dma_mask = &mmc2_dmamask,
258 .platform_data = &mmc2_conf, 273 .platform_data = &mmc2_data,
259 }, 274 },
260 .num_resources = ARRAY_SIZE(mmc2_resources), 275 .num_resources = ARRAY_SIZE(mmc2_resources),
261 .resource = mmc2_resources, 276 .resource = mmc2_resources,
262}; 277};
263#endif 278#endif
264 279
265static void __init omap_init_mmc(void) 280static inline void omap_init_mmc_conf(const struct omap_mmc_config *mmc_conf)
266{ 281{
267 const struct omap_mmc_config *mmc_conf; 282 if (cpu_is_omap2430() || cpu_is_omap34xx())
268 const struct omap_mmc_conf *mmc;
269
270 /* NOTE: assumes MMC was never (wrongly) enabled */
271 mmc_conf = omap_get_config(OMAP_TAG_MMC, struct omap_mmc_config);
272 if (!mmc_conf)
273 return; 283 return;
274 284
275 /* block 1 is always available and has just one pinout option */ 285 if (mmc_conf->mmc[0].enabled) {
276 mmc = &mmc_conf->mmc[0];
277 if (mmc->enabled) {
278 if (cpu_is_omap24xx()) { 286 if (cpu_is_omap24xx()) {
279 omap_cfg_reg(H18_24XX_MMC_CMD); 287 omap_cfg_reg(H18_24XX_MMC_CMD);
280 omap_cfg_reg(H15_24XX_MMC_CLKI); 288 omap_cfg_reg(H15_24XX_MMC_CLKI);
@@ -292,7 +300,7 @@ static void __init omap_init_mmc(void)
292 omap_cfg_reg(P20_1710_MMC_DATDIR0); 300 omap_cfg_reg(P20_1710_MMC_DATDIR0);
293 } 301 }
294 } 302 }
295 if (mmc->wire4) { 303 if (mmc_conf->mmc[0].wire4) {
296 if (cpu_is_omap24xx()) { 304 if (cpu_is_omap24xx()) {
297 omap_cfg_reg(H14_24XX_MMC_DAT1); 305 omap_cfg_reg(H14_24XX_MMC_DAT1);
298 omap_cfg_reg(E19_24XX_MMC_DAT2); 306 omap_cfg_reg(E19_24XX_MMC_DAT2);
@@ -303,25 +311,22 @@ static void __init omap_init_mmc(void)
303 } else { 311 } else {
304 omap_cfg_reg(MMC_DAT1); 312 omap_cfg_reg(MMC_DAT1);
305 /* NOTE: DAT2 can be on W10 (here) or M15 */ 313 /* NOTE: DAT2 can be on W10 (here) or M15 */
306 if (!mmc->nomux) 314 if (!mmc_conf->mmc[0].nomux)
307 omap_cfg_reg(MMC_DAT2); 315 omap_cfg_reg(MMC_DAT2);
308 omap_cfg_reg(MMC_DAT3); 316 omap_cfg_reg(MMC_DAT3);
309 } 317 }
310 } 318 }
311 mmc1_conf = *mmc;
312 (void) platform_device_register(&mmc_omap_device1);
313 } 319 }
314 320
315#ifdef CONFIG_ARCH_OMAP16XX 321#ifdef CONFIG_ARCH_OMAP16XX
316 /* block 2 is on newer chips, and has many pinout options */ 322 /* block 2 is on newer chips, and has many pinout options */
317 mmc = &mmc_conf->mmc[1]; 323 if (mmc_conf->mmc[1].enabled) {
318 if (mmc->enabled) { 324 if (!mmc_conf->mmc[1].nomux) {
319 if (!mmc->nomux) {
320 omap_cfg_reg(Y8_1610_MMC2_CMD); 325 omap_cfg_reg(Y8_1610_MMC2_CMD);
321 omap_cfg_reg(Y10_1610_MMC2_CLK); 326 omap_cfg_reg(Y10_1610_MMC2_CLK);
322 omap_cfg_reg(R18_1610_MMC2_CLKIN); 327 omap_cfg_reg(R18_1610_MMC2_CLKIN);
323 omap_cfg_reg(W8_1610_MMC2_DAT0); 328 omap_cfg_reg(W8_1610_MMC2_DAT0);
324 if (mmc->wire4) { 329 if (mmc_conf->mmc[1].wire4) {
325 omap_cfg_reg(V8_1610_MMC2_DAT1); 330 omap_cfg_reg(V8_1610_MMC2_DAT1);
326 omap_cfg_reg(W15_1610_MMC2_DAT2); 331 omap_cfg_reg(W15_1610_MMC2_DAT2);
327 omap_cfg_reg(R10_1610_MMC2_DAT3); 332 omap_cfg_reg(R10_1610_MMC2_DAT3);
@@ -337,14 +342,55 @@ static void __init omap_init_mmc(void)
337 if (cpu_is_omap1710()) 342 if (cpu_is_omap1710())
338 omap_writel(omap_readl(MOD_CONF_CTRL_1) | (1 << 24), 343 omap_writel(omap_readl(MOD_CONF_CTRL_1) | (1 << 24),
339 MOD_CONF_CTRL_1); 344 MOD_CONF_CTRL_1);
340 mmc2_conf = *mmc; 345 }
346#endif
347}
348
349static void __init omap_init_mmc(void)
350{
351 const struct omap_mmc_config *mmc_conf;
352
353 /* NOTE: assumes MMC was never (wrongly) enabled */
354 mmc_conf = omap_get_config(OMAP_TAG_MMC, struct omap_mmc_config);
355 if (!mmc_conf)
356 return;
357
358 omap_init_mmc_conf(mmc_conf);
359
360 if (mmc_conf->mmc[0].enabled) {
361 mmc1_data.conf = mmc_conf->mmc[0];
362 (void) platform_device_register(&mmc_omap_device1);
363 }
364
365#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2430) || \
366 defined(CONFIG_ARCH_OMAP34XX)
367 if (mmc_conf->mmc[1].enabled) {
368 mmc2_data.conf = mmc_conf->mmc[1];
341 (void) platform_device_register(&mmc_omap_device2); 369 (void) platform_device_register(&mmc_omap_device2);
342 } 370 }
343#endif 371#endif
344 return;
345} 372}
373
374void omap_set_mmc_info(int host, const struct omap_mmc_platform_data *info)
375{
376 switch (host) {
377 case 1:
378 mmc1_data = *info;
379 break;
380#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP2430) || \
381 defined(CONFIG_ARCH_OMAP34XX)
382 case 2:
383 mmc2_data = *info;
384 break;
385#endif
386 default:
387 BUG();
388 }
389}
390
346#else 391#else
347static inline void omap_init_mmc(void) {} 392static inline void omap_init_mmc(void) {}
393void omap_set_mmc_info(int host, const struct omap_mmc_platform_data *info) {}
348#endif 394#endif
349 395
350/*-------------------------------------------------------------------------*/ 396/*-------------------------------------------------------------------------*/
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index ee4c292683e1..dfc3443e23aa 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -325,7 +325,7 @@ static int __init atstk1002_init(void)
325#ifdef CONFIG_BOARD_ATSTK100X_SPI1 325#ifdef CONFIG_BOARD_ATSTK100X_SPI1
326 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info)); 326 at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
327#endif 327#endif
328#ifndef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM 328#ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
329 at32_add_device_mci(0, MCI_PDATA); 329 at32_add_device_mci(0, MCI_PDATA);
330#endif 330#endif
331#ifdef CONFIG_BOARD_ATSTK1002_SW5_CUSTOM 331#ifdef CONFIG_BOARD_ATSTK1002_SW5_CUSTOM
diff --git a/arch/avr32/boot/images/.gitignore b/arch/avr32/boot/images/.gitignore
new file mode 100644
index 000000000000..64ea9d0141d2
--- /dev/null
+++ b/arch/avr32/boot/images/.gitignore
@@ -0,0 +1,4 @@
1uImage
2uImage.srec
3vmlinux.cso
4sfdwarf.log
diff --git a/arch/avr32/kernel/.gitignore b/arch/avr32/kernel/.gitignore
new file mode 100644
index 000000000000..c5f676c3c224
--- /dev/null
+++ b/arch/avr32/kernel/.gitignore
@@ -0,0 +1 @@
vmlinux.lds
diff --git a/arch/avr32/kernel/avr32_ksyms.c b/arch/avr32/kernel/avr32_ksyms.c
index 84a7d44edc67..11e310c567a9 100644
--- a/arch/avr32/kernel/avr32_ksyms.c
+++ b/arch/avr32/kernel/avr32_ksyms.c
@@ -58,6 +58,7 @@ EXPORT_SYMBOL(find_first_zero_bit);
58EXPORT_SYMBOL(find_next_zero_bit); 58EXPORT_SYMBOL(find_next_zero_bit);
59EXPORT_SYMBOL(find_first_bit); 59EXPORT_SYMBOL(find_first_bit);
60EXPORT_SYMBOL(find_next_bit); 60EXPORT_SYMBOL(find_next_bit);
61EXPORT_SYMBOL(generic_find_next_le_bit);
61EXPORT_SYMBOL(generic_find_next_zero_le_bit); 62EXPORT_SYMBOL(generic_find_next_zero_le_bit);
62 63
63/* I/O primitives (lib/io-*.S) */ 64/* I/O primitives (lib/io-*.S) */
diff --git a/arch/avr32/kernel/syscall-stubs.S b/arch/avr32/kernel/syscall-stubs.S
index 890286a1e62b..673178e235f3 100644
--- a/arch/avr32/kernel/syscall-stubs.S
+++ b/arch/avr32/kernel/syscall-stubs.S
@@ -109,3 +109,12 @@ __sys_epoll_pwait:
109 rcall sys_epoll_pwait 109 rcall sys_epoll_pwait
110 sub sp, -4 110 sub sp, -4
111 popm pc 111 popm pc
112
113 .global __sys_sync_file_range
114 .type __sys_sync_file_range,@function
115__sys_sync_file_range:
116 pushm lr
117 st.w --sp, ARG6
118 rcall sys_sync_file_range
119 sub sp, -4
120 popm pc
diff --git a/arch/avr32/kernel/syscall_table.S b/arch/avr32/kernel/syscall_table.S
index 478bda4c4a09..7ee0057613b3 100644
--- a/arch/avr32/kernel/syscall_table.S
+++ b/arch/avr32/kernel/syscall_table.S
@@ -275,7 +275,7 @@ sys_call_table:
275 .long sys_set_robust_list 275 .long sys_set_robust_list
276 .long sys_get_robust_list /* 260 */ 276 .long sys_get_robust_list /* 260 */
277 .long __sys_splice 277 .long __sys_splice
278 .long sys_sync_file_range 278 .long __sys_sync_file_range
279 .long sys_tee 279 .long sys_tee
280 .long sys_vmsplice 280 .long sys_vmsplice
281 .long __sys_epoll_pwait /* 265 */ 281 .long __sys_epoll_pwait /* 265 */
diff --git a/arch/avr32/kernel/traps.c b/arch/avr32/kernel/traps.c
index b835c4c01368..0d987373bc01 100644
--- a/arch/avr32/kernel/traps.c
+++ b/arch/avr32/kernel/traps.c
@@ -116,15 +116,15 @@ asmlinkage void do_nmi(unsigned long ecr, struct pt_regs *regs)
116 switch (ret) { 116 switch (ret) {
117 case NOTIFY_OK: 117 case NOTIFY_OK:
118 case NOTIFY_STOP: 118 case NOTIFY_STOP:
119 return; 119 break;
120 case NOTIFY_BAD: 120 case NOTIFY_BAD:
121 die("Fatal Non-Maskable Interrupt", regs, SIGINT); 121 die("Fatal Non-Maskable Interrupt", regs, SIGINT);
122 default: 122 default:
123 printk(KERN_ALERT "Got NMI, but nobody cared. Disabling...\n");
124 nmi_disable();
123 break; 125 break;
124 } 126 }
125 127 nmi_exit();
126 printk(KERN_ALERT "Got NMI, but nobody cared. Disabling...\n");
127 nmi_disable();
128} 128}
129 129
130asmlinkage void do_critical_exception(unsigned long ecr, struct pt_regs *regs) 130asmlinkage void do_critical_exception(unsigned long ecr, struct pt_regs *regs)
diff --git a/arch/avr32/lib/findbit.S b/arch/avr32/lib/findbit.S
index c6b91dee857c..997b33b2288a 100644
--- a/arch/avr32/lib/findbit.S
+++ b/arch/avr32/lib/findbit.S
@@ -123,6 +123,36 @@ ENTRY(find_next_bit)
123 brgt 1b 123 brgt 1b
124 retal r11 124 retal r11
125 125
126ENTRY(generic_find_next_le_bit)
127 lsr r8, r10, 5
128 sub r9, r11, r10
129 retle r11
130
131 lsl r8, 2
132 add r12, r8
133 andl r10, 31, COH
134 breq 1f
135
136 /* offset is not word-aligned. Handle the first (32 - r10) bits */
137 ldswp.w r8, r12[0]
138 sub r12, -4
139 lsr r8, r8, r10
140 brne .L_found
141
142 /* r9 = r9 - (32 - r10) = r9 + r10 - 32 */
143 add r9, r10
144 sub r9, 32
145 retle r11
146
147 /* Main loop. offset must be word-aligned */
1481: ldswp.w r8, r12[0]
149 cp.w r8, 0
150 brne .L_found
151 sub r12, -4
152 sub r9, 32
153 brgt 1b
154 retal r11
155
126ENTRY(generic_find_next_zero_le_bit) 156ENTRY(generic_find_next_zero_le_bit)
127 lsr r8, r10, 5 157 lsr r8, r10, 5
128 sub r9, r11, r10 158 sub r9, r11, r10
diff --git a/arch/ia64/include/asm/dma-mapping.h b/arch/ia64/include/asm/dma-mapping.h
index 9f0df9bd46b7..06ff1ba21465 100644
--- a/arch/ia64/include/asm/dma-mapping.h
+++ b/arch/ia64/include/asm/dma-mapping.h
@@ -8,7 +8,9 @@
8#include <asm/machvec.h> 8#include <asm/machvec.h>
9#include <linux/scatterlist.h> 9#include <linux/scatterlist.h>
10 10
11#define dma_alloc_coherent platform_dma_alloc_coherent 11#define dma_alloc_coherent(dev, size, handle, gfp) \
12 platform_dma_alloc_coherent(dev, size, handle, (gfp) | GFP_DMA)
13
12/* coherent mem. is cheap */ 14/* coherent mem. is cheap */
13static inline void * 15static inline void *
14dma_alloc_noncoherent(struct device *dev, size_t size, dma_addr_t *dma_handle, 16dma_alloc_noncoherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
diff --git a/arch/ia64/include/asm/elf.h b/arch/ia64/include/asm/elf.h
index 5e0c1a6bce8d..2acb6b6543c9 100644
--- a/arch/ia64/include/asm/elf.h
+++ b/arch/ia64/include/asm/elf.h
@@ -266,4 +266,19 @@ do { \
266 } \ 266 } \
267} while (0) 267} while (0)
268 268
269/*
270 * format for entries in the Global Offset Table
271 */
272struct got_entry {
273 uint64_t val;
274};
275
276/*
277 * Layout of the Function Descriptor
278 */
279struct fdesc {
280 uint64_t ip;
281 uint64_t gp;
282};
283
269#endif /* _ASM_IA64_ELF_H */ 284#endif /* _ASM_IA64_ELF_H */
diff --git a/arch/ia64/include/asm/sections.h b/arch/ia64/include/asm/sections.h
index a7acad2bc2f0..1a873b36a4a1 100644
--- a/arch/ia64/include/asm/sections.h
+++ b/arch/ia64/include/asm/sections.h
@@ -6,9 +6,14 @@
6 * David Mosberger-Tang <davidm@hpl.hp.com> 6 * David Mosberger-Tang <davidm@hpl.hp.com>
7 */ 7 */
8 8
9#include <linux/elf.h>
10#include <linux/uaccess.h>
9#include <asm-generic/sections.h> 11#include <asm-generic/sections.h>
10 12
11extern char __per_cpu_start[], __per_cpu_end[], __phys_per_cpu_start[]; 13extern char __per_cpu_start[], __per_cpu_end[], __phys_per_cpu_start[];
14#ifdef CONFIG_SMP
15extern char __cpu0_per_cpu[];
16#endif
12extern char __start___vtop_patchlist[], __end___vtop_patchlist[]; 17extern char __start___vtop_patchlist[], __end___vtop_patchlist[];
13extern char __start___rse_patchlist[], __end___rse_patchlist[]; 18extern char __start___rse_patchlist[], __end___rse_patchlist[];
14extern char __start___mckinley_e9_bundles[], __end___mckinley_e9_bundles[]; 19extern char __start___mckinley_e9_bundles[], __end___mckinley_e9_bundles[];
@@ -22,7 +27,16 @@ extern char __start_unwind[], __end_unwind[];
22extern char __start_ivt_text[], __end_ivt_text[]; 27extern char __start_ivt_text[], __end_ivt_text[];
23 28
24#undef dereference_function_descriptor 29#undef dereference_function_descriptor
25void *dereference_function_descriptor(void *); 30static inline void *dereference_function_descriptor(void *ptr)
31{
32 struct fdesc *desc = ptr;
33 void *p;
34
35 if (!probe_kernel_address(&desc->ip, p))
36 ptr = p;
37 return ptr;
38}
39
26 40
27#endif /* _ASM_IA64_SECTIONS_H */ 41#endif /* _ASM_IA64_SECTIONS_H */
28 42
diff --git a/arch/ia64/include/asm/sn/bte.h b/arch/ia64/include/asm/sn/bte.h
index a0d214f43115..5efecf06c9a4 100644
--- a/arch/ia64/include/asm/sn/bte.h
+++ b/arch/ia64/include/asm/sn/bte.h
@@ -223,10 +223,11 @@ extern void bte_error_handler(unsigned long);
223 * until the transfer is complete. In order to get the asynch 223 * until the transfer is complete. In order to get the asynch
224 * version of bte_copy, you must perform this check yourself. 224 * version of bte_copy, you must perform this check yourself.
225 */ 225 */
226#define BTE_UNALIGNED_COPY(src, dest, len, mode) \ 226#define BTE_UNALIGNED_COPY(src, dest, len, mode) \
227 (((len & L1_CACHE_MASK) || (src & L1_CACHE_MASK) || \ 227 (((len & (L1_CACHE_BYTES - 1)) || \
228 (dest & L1_CACHE_MASK)) ? \ 228 (src & (L1_CACHE_BYTES - 1)) || \
229 bte_unaligned_copy(src, dest, len, mode) : \ 229 (dest & (L1_CACHE_BYTES - 1))) ? \
230 bte_unaligned_copy(src, dest, len, mode) : \
230 bte_copy(src, dest, len, mode, NULL)) 231 bte_copy(src, dest, len, mode, NULL))
231 232
232 233
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index d45f215bc8fc..51b75cea7018 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -1232,9 +1232,10 @@ efi_initialize_iomem_resources(struct resource *code_resource,
1232 if (md->attribute & EFI_MEMORY_WP) { 1232 if (md->attribute & EFI_MEMORY_WP) {
1233 name = "System ROM"; 1233 name = "System ROM";
1234 flags |= IORESOURCE_READONLY; 1234 flags |= IORESOURCE_READONLY;
1235 } else { 1235 } else if (md->attribute == EFI_MEMORY_UC)
1236 name = "Uncached RAM";
1237 else
1236 name = "System RAM"; 1238 name = "System RAM";
1237 }
1238 break; 1239 break;
1239 1240
1240 case EFI_ACPI_MEMORY_NVS: 1241 case EFI_ACPI_MEMORY_NVS:
diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S
index 8bdea8eb62e3..66e491d8baac 100644
--- a/arch/ia64/kernel/head.S
+++ b/arch/ia64/kernel/head.S
@@ -367,16 +367,17 @@ start_ap:
367 ;; 367 ;;
368#else 368#else
369(isAP) br.few 2f 369(isAP) br.few 2f
370 mov r20=r19 370 movl r20=__cpu0_per_cpu
371 sub r19=r19,r18
372 ;; 371 ;;
373 shr.u r18=r18,3 372 shr.u r18=r18,3
3741: 3731:
375 ld8 r21=[r20],8;; 374 ld8 r21=[r19],8;;
376 st8[r19]=r21,8 375 st8[r20]=r21,8
377 adds r18=-1,r18;; 376 adds r18=-1,r18;;
378 cmp4.lt p7,p6=0,r18 377 cmp4.lt p7,p6=0,r18
379(p7) br.cond.dptk.few 1b 378(p7) br.cond.dptk.few 1b
379 mov r19=r20
380 ;;
3802: 3812:
381#endif 382#endif
382 tpa r19=r19 383 tpa r19=r19
diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c
index 545626f66a4c..aaa7d901521f 100644
--- a/arch/ia64/kernel/module.c
+++ b/arch/ia64/kernel/module.c
@@ -31,11 +31,9 @@
31#include <linux/elf.h> 31#include <linux/elf.h>
32#include <linux/moduleloader.h> 32#include <linux/moduleloader.h>
33#include <linux/string.h> 33#include <linux/string.h>
34#include <linux/uaccess.h>
35#include <linux/vmalloc.h> 34#include <linux/vmalloc.h>
36 35
37#include <asm/patch.h> 36#include <asm/patch.h>
38#include <asm/sections.h>
39#include <asm/unaligned.h> 37#include <asm/unaligned.h>
40 38
41#define ARCH_MODULE_DEBUG 0 39#define ARCH_MODULE_DEBUG 0
@@ -137,15 +135,6 @@ static const char *reloc_name[256] = {
137 135
138#undef N 136#undef N
139 137
140struct got_entry {
141 uint64_t val;
142};
143
144struct fdesc {
145 uint64_t ip;
146 uint64_t gp;
147};
148
149/* Opaque struct for insns, to protect against derefs. */ 138/* Opaque struct for insns, to protect against derefs. */
150struct insn; 139struct insn;
151 140
@@ -943,13 +932,3 @@ module_arch_cleanup (struct module *mod)
943 if (mod->arch.core_unw_table) 932 if (mod->arch.core_unw_table)
944 unw_remove_unwind_table(mod->arch.core_unw_table); 933 unw_remove_unwind_table(mod->arch.core_unw_table);
945} 934}
946
947void *dereference_function_descriptor(void *ptr)
948{
949 struct fdesc *desc = ptr;
950 void *p;
951
952 if (!probe_kernel_address(&desc->ip, p))
953 ptr = p;
954 return ptr;
955}
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index c27d5b2c182b..de636b215677 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -616,7 +616,9 @@ setup_arch (char **cmdline_p)
616 ia64_mca_init(); 616 ia64_mca_init();
617 617
618 platform_setup(cmdline_p); 618 platform_setup(cmdline_p);
619#ifndef CONFIG_IA64_HP_SIM
619 check_sal_cache_flush(); 620 check_sal_cache_flush();
621#endif
620 paging_init(); 622 paging_init();
621} 623}
622 624
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index bcea81e432fd..d8f05e504fbf 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -741,16 +741,14 @@ int __cpu_disable(void)
741 return -EBUSY; 741 return -EBUSY;
742 } 742 }
743 743
744 cpu_clear(cpu, cpu_online_map);
745
746 if (migrate_platform_irqs(cpu)) { 744 if (migrate_platform_irqs(cpu)) {
747 cpu_set(cpu, cpu_online_map); 745 cpu_set(cpu, cpu_online_map);
748 return (-EBUSY); 746 return (-EBUSY);
749 } 747 }
750 748
751 remove_siblinginfo(cpu); 749 remove_siblinginfo(cpu);
752 cpu_clear(cpu, cpu_online_map);
753 fixup_irqs(); 750 fixup_irqs();
751 cpu_clear(cpu, cpu_online_map);
754 local_flush_tlb_all(); 752 local_flush_tlb_all();
755 cpu_clear(cpu, cpu_callin_map); 753 cpu_clear(cpu, cpu_callin_map);
756 return 0; 754 return 0;
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index de71da811cd6..10a7d47e8510 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -215,9 +215,6 @@ SECTIONS
215 /* Per-cpu data: */ 215 /* Per-cpu data: */
216 percpu : { } :percpu 216 percpu : { } :percpu
217 . = ALIGN(PERCPU_PAGE_SIZE); 217 . = ALIGN(PERCPU_PAGE_SIZE);
218#ifdef CONFIG_SMP
219 . = . + PERCPU_PAGE_SIZE; /* cpu0 per-cpu space */
220#endif
221 __phys_per_cpu_start = .; 218 __phys_per_cpu_start = .;
222 .data.percpu PERCPU_ADDR : AT(__phys_per_cpu_start - LOAD_OFFSET) 219 .data.percpu PERCPU_ADDR : AT(__phys_per_cpu_start - LOAD_OFFSET)
223 { 220 {
@@ -233,6 +230,11 @@ SECTIONS
233 data : { } :data 230 data : { } :data
234 .data : AT(ADDR(.data) - LOAD_OFFSET) 231 .data : AT(ADDR(.data) - LOAD_OFFSET)
235 { 232 {
233#ifdef CONFIG_SMP
234 . = ALIGN(PERCPU_PAGE_SIZE);
235 __cpu0_per_cpu = .;
236 . = . + PERCPU_PAGE_SIZE; /* cpu0 per-cpu space */
237#endif
236 DATA_DATA 238 DATA_DATA
237 *(.data1) 239 *(.data1)
238 *(.gnu.linkonce.d*) 240 *(.gnu.linkonce.d*)
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index 7a37d06376be..cd0d1a7284b7 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -38,6 +38,7 @@
38#include <asm/cacheflush.h> 38#include <asm/cacheflush.h>
39#include <asm/div64.h> 39#include <asm/div64.h>
40#include <asm/tlb.h> 40#include <asm/tlb.h>
41#include <asm/elf.h>
41 42
42#include "misc.h" 43#include "misc.h"
43#include "vti.h" 44#include "vti.h"
@@ -61,12 +62,6 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
61 { NULL } 62 { NULL }
62}; 63};
63 64
64
65struct fdesc{
66 unsigned long ip;
67 unsigned long gp;
68};
69
70static void kvm_flush_icache(unsigned long start, unsigned long len) 65static void kvm_flush_icache(unsigned long start, unsigned long len)
71{ 66{
72 int l; 67 int l;
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
index e566ff43884a..0ee085efbe29 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -163,7 +163,7 @@ per_cpu_init (void)
163 * get_zeroed_page(). 163 * get_zeroed_page().
164 */ 164 */
165 if (first_time) { 165 if (first_time) {
166 void *cpu0_data = __phys_per_cpu_start - PERCPU_PAGE_SIZE; 166 void *cpu0_data = __cpu0_per_cpu;
167 167
168 first_time=0; 168 first_time=0;
169 169
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index 78026aabaa7f..d8c5fcd89e5b 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -144,7 +144,7 @@ static void *per_cpu_node_setup(void *cpu_data, int node)
144 144
145 for_each_possible_early_cpu(cpu) { 145 for_each_possible_early_cpu(cpu) {
146 if (cpu == 0) { 146 if (cpu == 0) {
147 void *cpu0_data = __phys_per_cpu_start - PERCPU_PAGE_SIZE; 147 void *cpu0_data = __cpu0_per_cpu;
148 __per_cpu_offset[cpu] = (char*)cpu0_data - 148 __per_cpu_offset[cpu] = (char*)cpu0_data -
149 __per_cpu_start; 149 __per_cpu_start;
150 } else if (node == node_cpuid[cpu].nid) { 150 } else if (node == node_cpuid[cpu].nid) {
diff --git a/arch/ia64/sn/pci/tioca_provider.c b/arch/ia64/sn/pci/tioca_provider.c
index 529462c01570..79165122501c 100644
--- a/arch/ia64/sn/pci/tioca_provider.c
+++ b/arch/ia64/sn/pci/tioca_provider.c
@@ -420,8 +420,10 @@ tioca_dma_mapped(struct pci_dev *pdev, u64 paddr, size_t req_size)
420 entry = find_next_zero_bit(map, mapsize, last_entry); 420 entry = find_next_zero_bit(map, mapsize, last_entry);
421 } 421 }
422 422
423 if (entry > mapsize) 423 if (entry > mapsize) {
424 kfree(ca_dmamap);
424 goto map_return; 425 goto map_return;
426 }
425 427
426 for (i = 0; i < entries; i++) 428 for (i = 0; i < entries; i++)
427 set_bit(entry + i, map); 429 set_bit(entry + i, map);
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index a5f864c445b2..f57113f1f892 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -216,10 +216,6 @@ config MEMORY_SIZE
216 default "01000000" if PLAT_M32104UT 216 default "01000000" if PLAT_M32104UT
217 default "00800000" if PLAT_OAKS32R 217 default "00800000" if PLAT_OAKS32R
218 218
219config NOHIGHMEM
220 bool
221 default y
222
223config ARCH_DISCONTIGMEM_ENABLE 219config ARCH_DISCONTIGMEM_ENABLE
224 bool "Internal RAM Support" 220 bool "Internal RAM Support"
225 depends on CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP || CHIP_M32104 221 depends on CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP || CHIP_M32104
@@ -410,11 +406,7 @@ config PCI_DIRECT
410source "drivers/pci/Kconfig" 406source "drivers/pci/Kconfig"
411 407
412config ISA 408config ISA
413 bool "ISA support" 409 bool
414 help
415 Find out whether you have ISA slots on your motherboard. ISA is the
416 name of a bus system, i.e. the way the CPU talks to the other stuff
417 inside your box. If you have ISA, say Y, otherwise N.
418 410
419source "drivers/pcmcia/Kconfig" 411source "drivers/pcmcia/Kconfig"
420 412
diff --git a/arch/m32r/kernel/entry.S b/arch/m32r/kernel/entry.S
index d4eaa2fd1818..612d35b082a6 100644
--- a/arch/m32r/kernel/entry.S
+++ b/arch/m32r/kernel/entry.S
@@ -143,7 +143,7 @@ ret_from_intr:
143 and3 r4, r4, #0x8000 ; check BSM bit 143 and3 r4, r4, #0x8000 ; check BSM bit
144#endif 144#endif
145 beqz r4, resume_kernel 145 beqz r4, resume_kernel
146ENTRY(resume_userspace) 146resume_userspace:
147 DISABLE_INTERRUPTS(r4) ; make sure we don't miss an interrupt 147 DISABLE_INTERRUPTS(r4) ; make sure we don't miss an interrupt
148 ; setting need_resched or sigpending 148 ; setting need_resched or sigpending
149 ; between sampling and the iret 149 ; between sampling and the iret
diff --git a/arch/m32r/kernel/head.S b/arch/m32r/kernel/head.S
index dab7436d7bbe..40180778a5c7 100644
--- a/arch/m32r/kernel/head.S
+++ b/arch/m32r/kernel/head.S
@@ -29,7 +29,6 @@ __INITDATA
29 .global _end 29 .global _end
30ENTRY(stext) 30ENTRY(stext)
31ENTRY(_stext) 31ENTRY(_stext)
32ENTRY(startup_32)
33 /* Setup up the stack pointer */ 32 /* Setup up the stack pointer */
34 LDIMM (r0, spi_stack_top) 33 LDIMM (r0, spi_stack_top)
35 LDIMM (r1, spu_stack_top) 34 LDIMM (r1, spu_stack_top)
diff --git a/arch/m32r/kernel/irq.c b/arch/m32r/kernel/irq.c
index d0c5b0b7da2f..2aeae4670098 100644
--- a/arch/m32r/kernel/irq.c
+++ b/arch/m32r/kernel/irq.c
@@ -22,9 +22,6 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <asm/uaccess.h> 23#include <asm/uaccess.h>
24 24
25atomic_t irq_err_count;
26atomic_t irq_mis_count;
27
28/* 25/*
29 * Generic, controller-independent functions: 26 * Generic, controller-independent functions:
30 */ 27 */
@@ -63,9 +60,6 @@ int show_interrupts(struct seq_file *p, void *v)
63 seq_putc(p, '\n'); 60 seq_putc(p, '\n');
64skip: 61skip:
65 spin_unlock_irqrestore(&irq_desc[i].lock, flags); 62 spin_unlock_irqrestore(&irq_desc[i].lock, flags);
66 } else if (i == NR_IRQS) {
67 seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
68 seq_printf(p, "MIS: %10u\n", atomic_read(&irq_mis_count));
69 } 63 }
70 return 0; 64 return 0;
71} 65}
diff --git a/arch/m32r/kernel/m32r_ksyms.c b/arch/m32r/kernel/m32r_ksyms.c
index 16bcb189a383..22624b51d4d3 100644
--- a/arch/m32r/kernel/m32r_ksyms.c
+++ b/arch/m32r/kernel/m32r_ksyms.c
@@ -14,6 +14,7 @@
14#include <asm/delay.h> 14#include <asm/delay.h>
15#include <asm/irq.h> 15#include <asm/irq.h>
16#include <asm/tlbflush.h> 16#include <asm/tlbflush.h>
17#include <asm/pgtable.h>
17 18
18/* platform dependent support */ 19/* platform dependent support */
19EXPORT_SYMBOL(boot_cpu_data); 20EXPORT_SYMBOL(boot_cpu_data);
@@ -65,6 +66,7 @@ EXPORT_SYMBOL(memset);
65EXPORT_SYMBOL(copy_page); 66EXPORT_SYMBOL(copy_page);
66EXPORT_SYMBOL(clear_page); 67EXPORT_SYMBOL(clear_page);
67EXPORT_SYMBOL(strlen); 68EXPORT_SYMBOL(strlen);
69EXPORT_SYMBOL(empty_zero_page);
68 70
69EXPORT_SYMBOL(_inb); 71EXPORT_SYMBOL(_inb);
70EXPORT_SYMBOL(_inw); 72EXPORT_SYMBOL(_inw);
diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c
index a689e2978b6e..5be4faaf5b1c 100644
--- a/arch/m32r/kernel/process.c
+++ b/arch/m32r/kernel/process.c
@@ -35,8 +35,6 @@
35 35
36#include <linux/err.h> 36#include <linux/err.h>
37 37
38static int hlt_counter=0;
39
40/* 38/*
41 * Return saved PC of a blocked thread. 39 * Return saved PC of a blocked thread.
42 */ 40 */
@@ -48,31 +46,16 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
48/* 46/*
49 * Powermanagement idle function, if any.. 47 * Powermanagement idle function, if any..
50 */ 48 */
51void (*pm_idle)(void) = NULL; 49static void (*pm_idle)(void) = NULL;
52EXPORT_SYMBOL(pm_idle);
53 50
54void (*pm_power_off)(void) = NULL; 51void (*pm_power_off)(void) = NULL;
55EXPORT_SYMBOL(pm_power_off); 52EXPORT_SYMBOL(pm_power_off);
56 53
57void disable_hlt(void)
58{
59 hlt_counter++;
60}
61
62EXPORT_SYMBOL(disable_hlt);
63
64void enable_hlt(void)
65{
66 hlt_counter--;
67}
68
69EXPORT_SYMBOL(enable_hlt);
70
71/* 54/*
72 * We use this is we don't have any better 55 * We use this is we don't have any better
73 * idle routine.. 56 * idle routine..
74 */ 57 */
75void default_idle(void) 58static void default_idle(void)
76{ 59{
77 /* M32R_FIXME: Please use "cpu_sleep" mode. */ 60 /* M32R_FIXME: Please use "cpu_sleep" mode. */
78 cpu_relax(); 61 cpu_relax();
@@ -260,15 +243,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long spu,
260 return 0; 243 return 0;
261} 244}
262 245
263/*
264 * Capture the user space registers if the task is not running (in user space)
265 */
266int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs)
267{
268 /* M32R_FIXME */
269 return 1;
270}
271
272asmlinkage int sys_fork(unsigned long r0, unsigned long r1, unsigned long r2, 246asmlinkage int sys_fork(unsigned long r0, unsigned long r1, unsigned long r2,
273 unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, 247 unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6,
274 struct pt_regs regs) 248 struct pt_regs regs)
diff --git a/arch/m32r/kernel/smp.c b/arch/m32r/kernel/smp.c
index 7577f971ea4e..929e5c9d3ad9 100644
--- a/arch/m32r/kernel/smp.c
+++ b/arch/m32r/kernel/smp.c
@@ -84,7 +84,7 @@ void smp_send_timer(void);
84void smp_ipi_timer_interrupt(struct pt_regs *); 84void smp_ipi_timer_interrupt(struct pt_regs *);
85void smp_local_timer_interrupt(void); 85void smp_local_timer_interrupt(void);
86 86
87void send_IPI_allbutself(int, int); 87static void send_IPI_allbutself(int, int);
88static void send_IPI_mask(cpumask_t, int, int); 88static void send_IPI_mask(cpumask_t, int, int);
89unsigned long send_IPI_mask_phys(cpumask_t, int, int); 89unsigned long send_IPI_mask_phys(cpumask_t, int, int);
90 90
@@ -722,7 +722,7 @@ void smp_local_timer_interrupt(void)
722 * ---------- --- -------------------------------------------------------- 722 * ---------- --- --------------------------------------------------------
723 * 723 *
724 *==========================================================================*/ 724 *==========================================================================*/
725void send_IPI_allbutself(int ipi_num, int try) 725static void send_IPI_allbutself(int ipi_num, int try)
726{ 726{
727 cpumask_t cpumask; 727 cpumask_t cpumask;
728 728
diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c
index 994cc1556355..6ea017727cce 100644
--- a/arch/m32r/kernel/time.c
+++ b/arch/m32r/kernel/time.c
@@ -34,7 +34,6 @@
34#include <asm/hw_irq.h> 34#include <asm/hw_irq.h>
35 35
36#ifdef CONFIG_SMP 36#ifdef CONFIG_SMP
37extern void send_IPI_allbutself(int, int);
38extern void smp_local_timer_interrupt(void); 37extern void smp_local_timer_interrupt(void);
39#endif 38#endif
40 39
@@ -188,7 +187,7 @@ static long last_rtc_update = 0;
188 * timer_interrupt() needs to keep up the real-time clock, 187 * timer_interrupt() needs to keep up the real-time clock,
189 * as well as call the "do_timer()" routine every clocktick 188 * as well as call the "do_timer()" routine every clocktick
190 */ 189 */
191irqreturn_t timer_interrupt(int irq, void *dev_id) 190static irqreturn_t timer_interrupt(int irq, void *dev_id)
192{ 191{
193#ifndef CONFIG_SMP 192#ifndef CONFIG_SMP
194 profile_tick(CPU_PROFILING); 193 profile_tick(CPU_PROFILING);
@@ -228,7 +227,7 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
228 return IRQ_HANDLED; 227 return IRQ_HANDLED;
229} 228}
230 229
231struct irqaction irq0 = { 230static struct irqaction irq0 = {
232 .handler = timer_interrupt, 231 .handler = timer_interrupt,
233 .flags = IRQF_DISABLED, 232 .flags = IRQF_DISABLED,
234 .mask = CPU_MASK_NONE, 233 .mask = CPU_MASK_NONE,
diff --git a/arch/m32r/kernel/traps.c b/arch/m32r/kernel/traps.c
index 46159a4e644b..03b14e55cd89 100644
--- a/arch/m32r/kernel/traps.c
+++ b/arch/m32r/kernel/traps.c
@@ -61,7 +61,7 @@ extern unsigned long eit_vector[];
61 ((unsigned long)func - (unsigned long)eit_vector - entry*4)/4 \ 61 ((unsigned long)func - (unsigned long)eit_vector - entry*4)/4 \
62 + 0xff000000UL 62 + 0xff000000UL
63 63
64void set_eit_vector_entries(void) 64static void set_eit_vector_entries(void)
65{ 65{
66 extern void default_eit_handler(void); 66 extern void default_eit_handler(void);
67 extern void system_call(void); 67 extern void system_call(void);
@@ -121,9 +121,9 @@ void __init trap_init(void)
121 cpu_init(); 121 cpu_init();
122} 122}
123 123
124int kstack_depth_to_print = 24; 124static int kstack_depth_to_print = 24;
125 125
126void show_trace(struct task_struct *task, unsigned long *stack) 126static void show_trace(struct task_struct *task, unsigned long *stack)
127{ 127{
128 unsigned long addr; 128 unsigned long addr;
129 129
@@ -224,7 +224,7 @@ bad:
224 printk("\n"); 224 printk("\n");
225} 225}
226 226
227DEFINE_SPINLOCK(die_lock); 227static DEFINE_SPINLOCK(die_lock);
228 228
229void die(const char * str, struct pt_regs * regs, long err) 229void die(const char * str, struct pt_regs * regs, long err)
230{ 230{
diff --git a/arch/m32r/lib/delay.c b/arch/m32r/lib/delay.c
index 59bfc34e0d9f..ced549be80f5 100644
--- a/arch/m32r/lib/delay.c
+++ b/arch/m32r/lib/delay.c
@@ -6,6 +6,7 @@
6 */ 6 */
7 7
8#include <linux/param.h> 8#include <linux/param.h>
9#include <linux/module.h>
9#ifdef CONFIG_SMP 10#ifdef CONFIG_SMP
10#include <linux/sched.h> 11#include <linux/sched.h>
11#include <asm/current.h> 12#include <asm/current.h>
@@ -121,3 +122,4 @@ void __ndelay(unsigned long nsecs)
121{ 122{
122 __const_udelay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */ 123 __const_udelay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */
123} 124}
125EXPORT_SYMBOL(__ndelay);
diff --git a/arch/m68k/configs/amiga_defconfig b/arch/m68k/configs/amiga_defconfig
index 8e2a0f5faf53..8bd61a640fc9 100644
--- a/arch/m68k/configs/amiga_defconfig
+++ b/arch/m68k/configs/amiga_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc4 3# Linux kernel version: 2.6.27-rc6
4# Wed May 28 22:47:35 2008 4# Wed Sep 10 09:02:00 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,7 +52,6 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
56CONFIG_KALLSYMS=y 55CONFIG_KALLSYMS=y
57# CONFIG_KALLSYMS_EXTRA_PASS is not set 56# CONFIG_KALLSYMS_EXTRA_PASS is not set
58CONFIG_HOTPLUG=y 57CONFIG_HOTPLUG=y
@@ -75,10 +74,16 @@ CONFIG_SLAB=y
75# CONFIG_PROFILING is not set 74# CONFIG_PROFILING is not set
76# CONFIG_MARKERS is not set 75# CONFIG_MARKERS is not set
77# CONFIG_HAVE_OPROFILE is not set 76# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
78# CONFIG_HAVE_IOREMAP_PROT is not set
78# CONFIG_HAVE_KPROBES is not set 79# CONFIG_HAVE_KPROBES is not set
79# CONFIG_HAVE_KRETPROBES is not set 80# CONFIG_HAVE_KRETPROBES is not set
81# CONFIG_HAVE_ARCH_TRACEHOOK is not set
80# CONFIG_HAVE_DMA_ATTRS is not set 82# CONFIG_HAVE_DMA_ATTRS is not set
83# CONFIG_USE_GENERIC_SMP_HELPERS is not set
84# CONFIG_HAVE_CLK is not set
81CONFIG_PROC_PAGE_MONITOR=y 85CONFIG_PROC_PAGE_MONITOR=y
86# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
82CONFIG_SLABINFO=y 87CONFIG_SLABINFO=y
83CONFIG_RT_MUTEXES=y 88CONFIG_RT_MUTEXES=y
84# CONFIG_TINY_SHMEM is not set 89# CONFIG_TINY_SHMEM is not set
@@ -95,6 +100,7 @@ CONFIG_BLOCK=y
95# CONFIG_BLK_DEV_IO_TRACE is not set 100# CONFIG_BLK_DEV_IO_TRACE is not set
96# CONFIG_LSF is not set 101# CONFIG_LSF is not set
97CONFIG_BLK_DEV_BSG=y 102CONFIG_BLK_DEV_BSG=y
103# CONFIG_BLK_DEV_INTEGRITY is not set
98 104
99# 105#
100# IO Schedulers 106# IO Schedulers
@@ -166,10 +172,6 @@ CONFIG_GENERIC_ISA_DMA=y
166CONFIG_ZONE_DMA=y 172CONFIG_ZONE_DMA=y
167# CONFIG_ARCH_SUPPORTS_MSI is not set 173# CONFIG_ARCH_SUPPORTS_MSI is not set
168CONFIG_ZORRO_NAMES=y 174CONFIG_ZORRO_NAMES=y
169
170#
171# Networking
172#
173CONFIG_NET=y 175CONFIG_NET=y
174 176
175# 177#
@@ -183,6 +185,7 @@ CONFIG_XFRM=y
183# CONFIG_XFRM_SUB_POLICY is not set 185# CONFIG_XFRM_SUB_POLICY is not set
184CONFIG_XFRM_MIGRATE=y 186CONFIG_XFRM_MIGRATE=y
185# CONFIG_XFRM_STATISTICS is not set 187# CONFIG_XFRM_STATISTICS is not set
188CONFIG_XFRM_IPCOMP=m
186CONFIG_NET_KEY=y 189CONFIG_NET_KEY=y
187CONFIG_NET_KEY_MIGRATE=y 190CONFIG_NET_KEY_MIGRATE=y
188CONFIG_INET=y 191CONFIG_INET=y
@@ -413,6 +416,7 @@ CONFIG_NET_CLS_ROUTE=y
413# 416#
414# CONFIG_CFG80211 is not set 417# CONFIG_CFG80211 is not set
415CONFIG_WIRELESS_EXT=y 418CONFIG_WIRELESS_EXT=y
419# CONFIG_WIRELESS_EXT_SYSFS is not set
416# CONFIG_MAC80211 is not set 420# CONFIG_MAC80211 is not set
417CONFIG_IEEE80211=m 421CONFIG_IEEE80211=m
418# CONFIG_IEEE80211_DEBUG is not set 422# CONFIG_IEEE80211_DEBUG is not set
@@ -432,7 +436,9 @@ CONFIG_IEEE80211_CRYPT_TKIP=m
432CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 436CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
433CONFIG_STANDALONE=y 437CONFIG_STANDALONE=y
434CONFIG_PREVENT_FIRMWARE_BUILD=y 438CONFIG_PREVENT_FIRMWARE_BUILD=y
435CONFIG_FW_LOADER=m 439CONFIG_FW_LOADER=y
440# CONFIG_FIRMWARE_IN_KERNEL is not set
441CONFIG_EXTRA_FIRMWARE=""
436# CONFIG_SYS_HYPERVISOR is not set 442# CONFIG_SYS_HYPERVISOR is not set
437CONFIG_CONNECTOR=m 443CONFIG_CONNECTOR=m
438# CONFIG_MTD is not set 444# CONFIG_MTD is not set
@@ -460,6 +466,7 @@ CONFIG_CDROM_PKTCDVD=m
460CONFIG_CDROM_PKTCDVD_BUFFERS=8 466CONFIG_CDROM_PKTCDVD_BUFFERS=8
461# CONFIG_CDROM_PKTCDVD_WCACHE is not set 467# CONFIG_CDROM_PKTCDVD_WCACHE is not set
462CONFIG_ATA_OVER_ETH=m 468CONFIG_ATA_OVER_ETH=m
469# CONFIG_BLK_DEV_HD is not set
463CONFIG_MISC_DEVICES=y 470CONFIG_MISC_DEVICES=y
464# CONFIG_EEPROM_93CX6 is not set 471# CONFIG_EEPROM_93CX6 is not set
465# CONFIG_ENCLOSURE_SERVICES is not set 472# CONFIG_ENCLOSURE_SERVICES is not set
@@ -470,6 +477,7 @@ CONFIG_BLK_DEV_IDE=y
470# 477#
471# Please see Documentation/ide/ide.txt for help/info on IDE drives 478# Please see Documentation/ide/ide.txt for help/info on IDE drives
472# 479#
480CONFIG_IDE_ATAPI=y
473# CONFIG_BLK_DEV_IDE_SATA is not set 481# CONFIG_BLK_DEV_IDE_SATA is not set
474CONFIG_BLK_DEV_IDEDISK=y 482CONFIG_BLK_DEV_IDEDISK=y
475# CONFIG_IDEDISK_MULTI_MODE is not set 483# CONFIG_IDEDISK_MULTI_MODE is not set
@@ -489,8 +497,6 @@ CONFIG_BLK_DEV_GAYLE=y
489CONFIG_BLK_DEV_IDEDOUBLER=y 497CONFIG_BLK_DEV_IDEDOUBLER=y
490CONFIG_BLK_DEV_BUDDHA=y 498CONFIG_BLK_DEV_BUDDHA=y
491# CONFIG_BLK_DEV_IDEDMA is not set 499# CONFIG_BLK_DEV_IDEDMA is not set
492# CONFIG_BLK_DEV_HD_ONLY is not set
493# CONFIG_BLK_DEV_HD is not set
494 500
495# 501#
496# SCSI device support 502# SCSI device support
@@ -556,6 +562,7 @@ CONFIG_A2091_SCSI=y
556CONFIG_GVP11_SCSI=y 562CONFIG_GVP11_SCSI=y
557CONFIG_SCSI_A4000T=y 563CONFIG_SCSI_A4000T=y
558CONFIG_SCSI_ZORRO7XX=y 564CONFIG_SCSI_ZORRO7XX=y
565# CONFIG_SCSI_DH is not set
559CONFIG_MD=y 566CONFIG_MD=y
560CONFIG_BLK_DEV_MD=m 567CONFIG_BLK_DEV_MD=m
561CONFIG_MD_LINEAR=m 568CONFIG_MD_LINEAR=m
@@ -564,7 +571,7 @@ CONFIG_MD_RAID1=m
564# CONFIG_MD_RAID10 is not set 571# CONFIG_MD_RAID10 is not set
565CONFIG_MD_RAID456=m 572CONFIG_MD_RAID456=m
566CONFIG_MD_RAID5_RESHAPE=y 573CONFIG_MD_RAID5_RESHAPE=y
567CONFIG_MD_MULTIPATH=m 574# CONFIG_MD_MULTIPATH is not set
568# CONFIG_MD_FAULTY is not set 575# CONFIG_MD_FAULTY is not set
569CONFIG_BLK_DEV_DM=m 576CONFIG_BLK_DEV_DM=m
570# CONFIG_DM_DEBUG is not set 577# CONFIG_DM_DEBUG is not set
@@ -573,13 +580,9 @@ CONFIG_DM_SNAPSHOT=m
573CONFIG_DM_MIRROR=m 580CONFIG_DM_MIRROR=m
574CONFIG_DM_ZERO=m 581CONFIG_DM_ZERO=m
575CONFIG_DM_MULTIPATH=m 582CONFIG_DM_MULTIPATH=m
576CONFIG_DM_MULTIPATH_EMC=m
577CONFIG_DM_MULTIPATH_RDAC=m
578CONFIG_DM_MULTIPATH_HP=m
579# CONFIG_DM_DELAY is not set 583# CONFIG_DM_DELAY is not set
580CONFIG_DM_UEVENT=y 584CONFIG_DM_UEVENT=y
581CONFIG_NETDEVICES=y 585CONFIG_NETDEVICES=y
582# CONFIG_NETDEVICES_MULTIQUEUE is not set
583CONFIG_DUMMY=m 586CONFIG_DUMMY=m
584# CONFIG_BONDING is not set 587# CONFIG_BONDING is not set
585CONFIG_MACVLAN=m 588CONFIG_MACVLAN=m
@@ -722,6 +725,7 @@ CONFIG_INPUT_M68K_BEEP=m
722# Character devices 725# Character devices
723# 726#
724CONFIG_VT=y 727CONFIG_VT=y
728CONFIG_CONSOLE_TRANSLATIONS=y
725CONFIG_VT_CONSOLE=y 729CONFIG_VT_CONSOLE=y
726CONFIG_HW_CONSOLE=y 730CONFIG_HW_CONSOLE=y
727CONFIG_VT_HW_CONSOLE_BINDING=y 731CONFIG_VT_HW_CONSOLE_BINDING=y
@@ -757,6 +761,7 @@ CONFIG_GEN_RTC_X=y
757# CONFIG_POWER_SUPPLY is not set 761# CONFIG_POWER_SUPPLY is not set
758# CONFIG_HWMON is not set 762# CONFIG_HWMON is not set
759# CONFIG_THERMAL is not set 763# CONFIG_THERMAL is not set
764# CONFIG_THERMAL_HWMON is not set
760# CONFIG_WATCHDOG is not set 765# CONFIG_WATCHDOG is not set
761 766
762# 767#
@@ -768,8 +773,10 @@ CONFIG_SSB_POSSIBLE=y
768# 773#
769# Multifunction device drivers 774# Multifunction device drivers
770# 775#
776# CONFIG_MFD_CORE is not set
771# CONFIG_MFD_SM501 is not set 777# CONFIG_MFD_SM501 is not set
772# CONFIG_HTC_PASIC3 is not set 778# CONFIG_HTC_PASIC3 is not set
779# CONFIG_MFD_TMIO is not set
773 780
774# 781#
775# Multimedia devices 782# Multimedia devices
@@ -844,10 +851,6 @@ CONFIG_LOGO=y
844CONFIG_LOGO_LINUX_MONO=y 851CONFIG_LOGO_LINUX_MONO=y
845CONFIG_LOGO_LINUX_VGA16=y 852CONFIG_LOGO_LINUX_VGA16=y
846CONFIG_LOGO_LINUX_CLUT224=y 853CONFIG_LOGO_LINUX_CLUT224=y
847
848#
849# Sound
850#
851CONFIG_SOUND=m 854CONFIG_SOUND=m
852CONFIG_DMASOUND_PAULA=m 855CONFIG_DMASOUND_PAULA=m
853CONFIG_DMASOUND=m 856CONFIG_DMASOUND=m
@@ -861,6 +864,7 @@ CONFIG_HIDRAW=y
861# CONFIG_NEW_LEDS is not set 864# CONFIG_NEW_LEDS is not set
862# CONFIG_ACCESSIBILITY is not set 865# CONFIG_ACCESSIBILITY is not set
863# CONFIG_RTC_CLASS is not set 866# CONFIG_RTC_CLASS is not set
867# CONFIG_DMADEVICES is not set
864# CONFIG_AUXDISPLAY is not set 868# CONFIG_AUXDISPLAY is not set
865# CONFIG_UIO is not set 869# CONFIG_UIO is not set
866 870
@@ -899,6 +903,7 @@ CONFIG_XFS_FS=m
899CONFIG_OCFS2_FS=m 903CONFIG_OCFS2_FS=m
900CONFIG_OCFS2_FS_O2CB=m 904CONFIG_OCFS2_FS_O2CB=m
901CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m 905CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
906# CONFIG_OCFS2_FS_STATS is not set
902# CONFIG_OCFS2_DEBUG_MASKLOG is not set 907# CONFIG_OCFS2_DEBUG_MASKLOG is not set
903# CONFIG_OCFS2_DEBUG_FS is not set 908# CONFIG_OCFS2_DEBUG_FS is not set
904CONFIG_DNOTIFY=y 909CONFIG_DNOTIFY=y
@@ -958,6 +963,7 @@ CONFIG_HFSPLUS_FS=m
958CONFIG_CRAMFS=m 963CONFIG_CRAMFS=m
959# CONFIG_VXFS_FS is not set 964# CONFIG_VXFS_FS is not set
960CONFIG_MINIX_FS=y 965CONFIG_MINIX_FS=y
966# CONFIG_OMFS_FS is not set
961CONFIG_HPFS_FS=m 967CONFIG_HPFS_FS=m
962# CONFIG_QNX4FS_FS is not set 968# CONFIG_QNX4FS_FS is not set
963# CONFIG_ROMFS_FS is not set 969# CONFIG_ROMFS_FS is not set
@@ -980,7 +986,6 @@ CONFIG_EXPORTFS=m
980CONFIG_NFS_COMMON=y 986CONFIG_NFS_COMMON=y
981CONFIG_SUNRPC=m 987CONFIG_SUNRPC=m
982CONFIG_SUNRPC_GSS=m 988CONFIG_SUNRPC_GSS=m
983CONFIG_SUNRPC_BIND34=y
984CONFIG_RPCSEC_GSS_KRB5=m 989CONFIG_RPCSEC_GSS_KRB5=m
985# CONFIG_RPCSEC_GSS_SPKM3 is not set 990# CONFIG_RPCSEC_GSS_SPKM3 is not set
986CONFIG_SMB_FS=m 991CONFIG_SMB_FS=m
@@ -989,7 +994,6 @@ CONFIG_SMB_NLS_REMOTE="cp437"
989# CONFIG_CIFS is not set 994# CONFIG_CIFS is not set
990# CONFIG_NCP_FS is not set 995# CONFIG_NCP_FS is not set
991CONFIG_CODA_FS=m 996CONFIG_CODA_FS=m
992# CONFIG_CODA_FS_OLD_API is not set
993# CONFIG_AFS_FS is not set 997# CONFIG_AFS_FS is not set
994 998
995# 999#
@@ -1054,6 +1058,8 @@ CONFIG_MAGIC_SYSRQ=y
1054# CONFIG_HEADERS_CHECK is not set 1058# CONFIG_HEADERS_CHECK is not set
1055# CONFIG_DEBUG_KERNEL is not set 1059# CONFIG_DEBUG_KERNEL is not set
1056CONFIG_DEBUG_BUGVERBOSE=y 1060CONFIG_DEBUG_BUGVERBOSE=y
1061CONFIG_DEBUG_MEMORY_INIT=y
1062CONFIG_SYSCTL_SYSCALL_CHECK=y
1057# CONFIG_SAMPLES is not set 1063# CONFIG_SAMPLES is not set
1058 1064
1059# 1065#
@@ -1113,6 +1119,10 @@ CONFIG_CRYPTO_CRC32C=m
1113CONFIG_CRYPTO_MD4=m 1119CONFIG_CRYPTO_MD4=m
1114CONFIG_CRYPTO_MD5=m 1120CONFIG_CRYPTO_MD5=m
1115CONFIG_CRYPTO_MICHAEL_MIC=m 1121CONFIG_CRYPTO_MICHAEL_MIC=m
1122CONFIG_CRYPTO_RMD128=m
1123CONFIG_CRYPTO_RMD160=m
1124CONFIG_CRYPTO_RMD256=m
1125CONFIG_CRYPTO_RMD320=m
1116CONFIG_CRYPTO_SHA1=m 1126CONFIG_CRYPTO_SHA1=m
1117CONFIG_CRYPTO_SHA256=m 1127CONFIG_CRYPTO_SHA256=m
1118CONFIG_CRYPTO_SHA512=m 1128CONFIG_CRYPTO_SHA512=m
@@ -1154,6 +1164,7 @@ CONFIG_BITREVERSE=y
1154# CONFIG_GENERIC_FIND_NEXT_BIT is not set 1164# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1155CONFIG_CRC_CCITT=m 1165CONFIG_CRC_CCITT=m
1156CONFIG_CRC16=m 1166CONFIG_CRC16=m
1167CONFIG_CRC_T10DIF=y
1157CONFIG_CRC_ITU_T=m 1168CONFIG_CRC_ITU_T=m
1158CONFIG_CRC32=y 1169CONFIG_CRC32=y
1159# CONFIG_CRC7 is not set 1170# CONFIG_CRC7 is not set
diff --git a/arch/m68k/configs/apollo_defconfig b/arch/m68k/configs/apollo_defconfig
index e2d511e2a1d1..c41b854c0284 100644
--- a/arch/m68k/configs/apollo_defconfig
+++ b/arch/m68k/configs/apollo_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc4 3# Linux kernel version: 2.6.27-rc6
4# Wed May 28 22:47:35 2008 4# Wed Sep 10 09:02:01 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,7 +52,6 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
56CONFIG_KALLSYMS=y 55CONFIG_KALLSYMS=y
57# CONFIG_KALLSYMS_EXTRA_PASS is not set 56# CONFIG_KALLSYMS_EXTRA_PASS is not set
58CONFIG_HOTPLUG=y 57CONFIG_HOTPLUG=y
@@ -75,10 +74,16 @@ CONFIG_SLAB=y
75# CONFIG_PROFILING is not set 74# CONFIG_PROFILING is not set
76# CONFIG_MARKERS is not set 75# CONFIG_MARKERS is not set
77# CONFIG_HAVE_OPROFILE is not set 76# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
78# CONFIG_HAVE_IOREMAP_PROT is not set
78# CONFIG_HAVE_KPROBES is not set 79# CONFIG_HAVE_KPROBES is not set
79# CONFIG_HAVE_KRETPROBES is not set 80# CONFIG_HAVE_KRETPROBES is not set
81# CONFIG_HAVE_ARCH_TRACEHOOK is not set
80# CONFIG_HAVE_DMA_ATTRS is not set 82# CONFIG_HAVE_DMA_ATTRS is not set
83# CONFIG_USE_GENERIC_SMP_HELPERS is not set
84# CONFIG_HAVE_CLK is not set
81CONFIG_PROC_PAGE_MONITOR=y 85CONFIG_PROC_PAGE_MONITOR=y
86# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
82CONFIG_SLABINFO=y 87CONFIG_SLABINFO=y
83CONFIG_RT_MUTEXES=y 88CONFIG_RT_MUTEXES=y
84# CONFIG_TINY_SHMEM is not set 89# CONFIG_TINY_SHMEM is not set
@@ -95,6 +100,7 @@ CONFIG_BLOCK=y
95# CONFIG_BLK_DEV_IO_TRACE is not set 100# CONFIG_BLK_DEV_IO_TRACE is not set
96# CONFIG_LSF is not set 101# CONFIG_LSF is not set
97CONFIG_BLK_DEV_BSG=y 102CONFIG_BLK_DEV_BSG=y
103# CONFIG_BLK_DEV_INTEGRITY is not set
98 104
99# 105#
100# IO Schedulers 106# IO Schedulers
@@ -161,10 +167,6 @@ CONFIG_HEARTBEAT=y
161CONFIG_PROC_HARDWARE=y 167CONFIG_PROC_HARDWARE=y
162CONFIG_ZONE_DMA=y 168CONFIG_ZONE_DMA=y
163# CONFIG_ARCH_SUPPORTS_MSI is not set 169# CONFIG_ARCH_SUPPORTS_MSI is not set
164
165#
166# Networking
167#
168CONFIG_NET=y 170CONFIG_NET=y
169 171
170# 172#
@@ -178,6 +180,7 @@ CONFIG_XFRM=y
178# CONFIG_XFRM_SUB_POLICY is not set 180# CONFIG_XFRM_SUB_POLICY is not set
179CONFIG_XFRM_MIGRATE=y 181CONFIG_XFRM_MIGRATE=y
180# CONFIG_XFRM_STATISTICS is not set 182# CONFIG_XFRM_STATISTICS is not set
183CONFIG_XFRM_IPCOMP=m
181CONFIG_NET_KEY=y 184CONFIG_NET_KEY=y
182CONFIG_NET_KEY_MIGRATE=y 185CONFIG_NET_KEY_MIGRATE=y
183CONFIG_INET=y 186CONFIG_INET=y
@@ -411,6 +414,7 @@ CONFIG_NET_CLS_ROUTE=y
411# 414#
412# CONFIG_CFG80211 is not set 415# CONFIG_CFG80211 is not set
413CONFIG_WIRELESS_EXT=y 416CONFIG_WIRELESS_EXT=y
417# CONFIG_WIRELESS_EXT_SYSFS is not set
414# CONFIG_MAC80211 is not set 418# CONFIG_MAC80211 is not set
415CONFIG_IEEE80211=m 419CONFIG_IEEE80211=m
416# CONFIG_IEEE80211_DEBUG is not set 420# CONFIG_IEEE80211_DEBUG is not set
@@ -430,7 +434,9 @@ CONFIG_IEEE80211_CRYPT_TKIP=m
430CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 434CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
431CONFIG_STANDALONE=y 435CONFIG_STANDALONE=y
432CONFIG_PREVENT_FIRMWARE_BUILD=y 436CONFIG_PREVENT_FIRMWARE_BUILD=y
433CONFIG_FW_LOADER=m 437CONFIG_FW_LOADER=y
438# CONFIG_FIRMWARE_IN_KERNEL is not set
439CONFIG_EXTRA_FIRMWARE=""
434# CONFIG_SYS_HYPERVISOR is not set 440# CONFIG_SYS_HYPERVISOR is not set
435CONFIG_CONNECTOR=m 441CONFIG_CONNECTOR=m
436# CONFIG_MTD is not set 442# CONFIG_MTD is not set
@@ -448,6 +454,7 @@ CONFIG_CDROM_PKTCDVD=m
448CONFIG_CDROM_PKTCDVD_BUFFERS=8 454CONFIG_CDROM_PKTCDVD_BUFFERS=8
449# CONFIG_CDROM_PKTCDVD_WCACHE is not set 455# CONFIG_CDROM_PKTCDVD_WCACHE is not set
450CONFIG_ATA_OVER_ETH=m 456CONFIG_ATA_OVER_ETH=m
457# CONFIG_BLK_DEV_HD is not set
451CONFIG_MISC_DEVICES=y 458CONFIG_MISC_DEVICES=y
452# CONFIG_EEPROM_93CX6 is not set 459# CONFIG_EEPROM_93CX6 is not set
453# CONFIG_ENCLOSURE_SERVICES is not set 460# CONFIG_ENCLOSURE_SERVICES is not set
@@ -499,6 +506,7 @@ CONFIG_SCSI_SRP_TGT_ATTRS=y
499CONFIG_SCSI_LOWLEVEL=y 506CONFIG_SCSI_LOWLEVEL=y
500CONFIG_ISCSI_TCP=m 507CONFIG_ISCSI_TCP=m
501# CONFIG_SCSI_DEBUG is not set 508# CONFIG_SCSI_DEBUG is not set
509# CONFIG_SCSI_DH is not set
502CONFIG_MD=y 510CONFIG_MD=y
503CONFIG_BLK_DEV_MD=m 511CONFIG_BLK_DEV_MD=m
504CONFIG_MD_LINEAR=m 512CONFIG_MD_LINEAR=m
@@ -507,7 +515,7 @@ CONFIG_MD_RAID1=m
507# CONFIG_MD_RAID10 is not set 515# CONFIG_MD_RAID10 is not set
508CONFIG_MD_RAID456=m 516CONFIG_MD_RAID456=m
509CONFIG_MD_RAID5_RESHAPE=y 517CONFIG_MD_RAID5_RESHAPE=y
510CONFIG_MD_MULTIPATH=m 518# CONFIG_MD_MULTIPATH is not set
511# CONFIG_MD_FAULTY is not set 519# CONFIG_MD_FAULTY is not set
512CONFIG_BLK_DEV_DM=m 520CONFIG_BLK_DEV_DM=m
513# CONFIG_DM_DEBUG is not set 521# CONFIG_DM_DEBUG is not set
@@ -516,13 +524,9 @@ CONFIG_DM_SNAPSHOT=m
516CONFIG_DM_MIRROR=m 524CONFIG_DM_MIRROR=m
517CONFIG_DM_ZERO=m 525CONFIG_DM_ZERO=m
518CONFIG_DM_MULTIPATH=m 526CONFIG_DM_MULTIPATH=m
519CONFIG_DM_MULTIPATH_EMC=m
520CONFIG_DM_MULTIPATH_RDAC=m
521CONFIG_DM_MULTIPATH_HP=m
522# CONFIG_DM_DELAY is not set 527# CONFIG_DM_DELAY is not set
523CONFIG_DM_UEVENT=y 528CONFIG_DM_UEVENT=y
524CONFIG_NETDEVICES=y 529CONFIG_NETDEVICES=y
525# CONFIG_NETDEVICES_MULTIQUEUE is not set
526CONFIG_DUMMY=m 530CONFIG_DUMMY=m
527# CONFIG_BONDING is not set 531# CONFIG_BONDING is not set
528CONFIG_MACVLAN=m 532CONFIG_MACVLAN=m
@@ -532,7 +536,6 @@ CONFIG_VETH=m
532# CONFIG_PHYLIB is not set 536# CONFIG_PHYLIB is not set
533CONFIG_NET_ETHERNET=y 537CONFIG_NET_ETHERNET=y
534# CONFIG_MII is not set 538# CONFIG_MII is not set
535CONFIG_APOLLO_ELPLUS=y
536# CONFIG_IBM_NEW_EMAC_ZMII is not set 539# CONFIG_IBM_NEW_EMAC_ZMII is not set
537# CONFIG_IBM_NEW_EMAC_RGMII is not set 540# CONFIG_IBM_NEW_EMAC_RGMII is not set
538# CONFIG_IBM_NEW_EMAC_TAH is not set 541# CONFIG_IBM_NEW_EMAC_TAH is not set
@@ -627,6 +630,7 @@ CONFIG_SERIO_LIBPS2=m
627# Character devices 630# Character devices
628# 631#
629CONFIG_VT=y 632CONFIG_VT=y
633CONFIG_CONSOLE_TRANSLATIONS=y
630CONFIG_VT_CONSOLE=y 634CONFIG_VT_CONSOLE=y
631CONFIG_HW_CONSOLE=y 635CONFIG_HW_CONSOLE=y
632CONFIG_VT_HW_CONSOLE_BINDING=y 636CONFIG_VT_HW_CONSOLE_BINDING=y
@@ -657,6 +661,7 @@ CONFIG_GEN_RTC_X=y
657# CONFIG_POWER_SUPPLY is not set 661# CONFIG_POWER_SUPPLY is not set
658# CONFIG_HWMON is not set 662# CONFIG_HWMON is not set
659# CONFIG_THERMAL is not set 663# CONFIG_THERMAL is not set
664# CONFIG_THERMAL_HWMON is not set
660# CONFIG_WATCHDOG is not set 665# CONFIG_WATCHDOG is not set
661 666
662# 667#
@@ -668,8 +673,10 @@ CONFIG_SSB_POSSIBLE=y
668# 673#
669# Multifunction device drivers 674# Multifunction device drivers
670# 675#
676# CONFIG_MFD_CORE is not set
671# CONFIG_MFD_SM501 is not set 677# CONFIG_MFD_SM501 is not set
672# CONFIG_HTC_PASIC3 is not set 678# CONFIG_HTC_PASIC3 is not set
679# CONFIG_MFD_TMIO is not set
673 680
674# 681#
675# Multimedia devices 682# Multimedia devices
@@ -738,10 +745,6 @@ CONFIG_LOGO=y
738CONFIG_LOGO_LINUX_MONO=y 745CONFIG_LOGO_LINUX_MONO=y
739# CONFIG_LOGO_LINUX_VGA16 is not set 746# CONFIG_LOGO_LINUX_VGA16 is not set
740# CONFIG_LOGO_LINUX_CLUT224 is not set 747# CONFIG_LOGO_LINUX_CLUT224 is not set
741
742#
743# Sound
744#
745# CONFIG_SOUND is not set 748# CONFIG_SOUND is not set
746CONFIG_HID_SUPPORT=y 749CONFIG_HID_SUPPORT=y
747CONFIG_HID=m 750CONFIG_HID=m
@@ -753,6 +756,7 @@ CONFIG_HIDRAW=y
753# CONFIG_NEW_LEDS is not set 756# CONFIG_NEW_LEDS is not set
754# CONFIG_ACCESSIBILITY is not set 757# CONFIG_ACCESSIBILITY is not set
755# CONFIG_RTC_CLASS is not set 758# CONFIG_RTC_CLASS is not set
759# CONFIG_DMADEVICES is not set
756# CONFIG_UIO is not set 760# CONFIG_UIO is not set
757 761
758# 762#
@@ -789,6 +793,7 @@ CONFIG_XFS_FS=m
789CONFIG_OCFS2_FS=m 793CONFIG_OCFS2_FS=m
790CONFIG_OCFS2_FS_O2CB=m 794CONFIG_OCFS2_FS_O2CB=m
791CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m 795CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
796# CONFIG_OCFS2_FS_STATS is not set
792# CONFIG_OCFS2_DEBUG_MASKLOG is not set 797# CONFIG_OCFS2_DEBUG_MASKLOG is not set
793# CONFIG_OCFS2_DEBUG_FS is not set 798# CONFIG_OCFS2_DEBUG_FS is not set
794CONFIG_DNOTIFY=y 799CONFIG_DNOTIFY=y
@@ -848,6 +853,7 @@ CONFIG_HFSPLUS_FS=m
848CONFIG_CRAMFS=m 853CONFIG_CRAMFS=m
849# CONFIG_VXFS_FS is not set 854# CONFIG_VXFS_FS is not set
850CONFIG_MINIX_FS=y 855CONFIG_MINIX_FS=y
856# CONFIG_OMFS_FS is not set
851CONFIG_HPFS_FS=m 857CONFIG_HPFS_FS=m
852# CONFIG_QNX4FS_FS is not set 858# CONFIG_QNX4FS_FS is not set
853# CONFIG_ROMFS_FS is not set 859# CONFIG_ROMFS_FS is not set
@@ -860,18 +866,17 @@ CONFIG_NFS_FS=y
860CONFIG_NFS_V3=y 866CONFIG_NFS_V3=y
861# CONFIG_NFS_V3_ACL is not set 867# CONFIG_NFS_V3_ACL is not set
862CONFIG_NFS_V4=y 868CONFIG_NFS_V4=y
869CONFIG_ROOT_NFS=y
863CONFIG_NFSD=m 870CONFIG_NFSD=m
864CONFIG_NFSD_V3=y 871CONFIG_NFSD_V3=y
865# CONFIG_NFSD_V3_ACL is not set 872# CONFIG_NFSD_V3_ACL is not set
866# CONFIG_NFSD_V4 is not set 873# CONFIG_NFSD_V4 is not set
867CONFIG_ROOT_NFS=y
868CONFIG_LOCKD=y 874CONFIG_LOCKD=y
869CONFIG_LOCKD_V4=y 875CONFIG_LOCKD_V4=y
870CONFIG_EXPORTFS=m 876CONFIG_EXPORTFS=m
871CONFIG_NFS_COMMON=y 877CONFIG_NFS_COMMON=y
872CONFIG_SUNRPC=y 878CONFIG_SUNRPC=y
873CONFIG_SUNRPC_GSS=y 879CONFIG_SUNRPC_GSS=y
874CONFIG_SUNRPC_BIND34=y
875CONFIG_RPCSEC_GSS_KRB5=y 880CONFIG_RPCSEC_GSS_KRB5=y
876# CONFIG_RPCSEC_GSS_SPKM3 is not set 881# CONFIG_RPCSEC_GSS_SPKM3 is not set
877CONFIG_SMB_FS=m 882CONFIG_SMB_FS=m
@@ -880,7 +885,6 @@ CONFIG_SMB_NLS_REMOTE="cp437"
880# CONFIG_CIFS is not set 885# CONFIG_CIFS is not set
881# CONFIG_NCP_FS is not set 886# CONFIG_NCP_FS is not set
882CONFIG_CODA_FS=m 887CONFIG_CODA_FS=m
883# CONFIG_CODA_FS_OLD_API is not set
884# CONFIG_AFS_FS is not set 888# CONFIG_AFS_FS is not set
885 889
886# 890#
@@ -944,6 +948,8 @@ CONFIG_MAGIC_SYSRQ=y
944# CONFIG_HEADERS_CHECK is not set 948# CONFIG_HEADERS_CHECK is not set
945# CONFIG_DEBUG_KERNEL is not set 949# CONFIG_DEBUG_KERNEL is not set
946CONFIG_DEBUG_BUGVERBOSE=y 950CONFIG_DEBUG_BUGVERBOSE=y
951CONFIG_DEBUG_MEMORY_INIT=y
952CONFIG_SYSCTL_SYSCALL_CHECK=y
947# CONFIG_SAMPLES is not set 953# CONFIG_SAMPLES is not set
948 954
949# 955#
@@ -1003,6 +1009,10 @@ CONFIG_CRYPTO_CRC32C=m
1003CONFIG_CRYPTO_MD4=m 1009CONFIG_CRYPTO_MD4=m
1004CONFIG_CRYPTO_MD5=y 1010CONFIG_CRYPTO_MD5=y
1005CONFIG_CRYPTO_MICHAEL_MIC=m 1011CONFIG_CRYPTO_MICHAEL_MIC=m
1012CONFIG_CRYPTO_RMD128=m
1013CONFIG_CRYPTO_RMD160=m
1014CONFIG_CRYPTO_RMD256=m
1015CONFIG_CRYPTO_RMD320=m
1006CONFIG_CRYPTO_SHA1=m 1016CONFIG_CRYPTO_SHA1=m
1007CONFIG_CRYPTO_SHA256=m 1017CONFIG_CRYPTO_SHA256=m
1008CONFIG_CRYPTO_SHA512=m 1018CONFIG_CRYPTO_SHA512=m
@@ -1044,6 +1054,7 @@ CONFIG_BITREVERSE=y
1044# CONFIG_GENERIC_FIND_NEXT_BIT is not set 1054# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1045CONFIG_CRC_CCITT=m 1055CONFIG_CRC_CCITT=m
1046CONFIG_CRC16=m 1056CONFIG_CRC16=m
1057CONFIG_CRC_T10DIF=y
1047CONFIG_CRC_ITU_T=m 1058CONFIG_CRC_ITU_T=m
1048CONFIG_CRC32=y 1059CONFIG_CRC32=y
1049# CONFIG_CRC7 is not set 1060# CONFIG_CRC7 is not set
diff --git a/arch/m68k/configs/atari_defconfig b/arch/m68k/configs/atari_defconfig
index 6e20d656adaf..654c5acb9e86 100644
--- a/arch/m68k/configs/atari_defconfig
+++ b/arch/m68k/configs/atari_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc4 3# Linux kernel version: 2.6.27-rc6
4# Wed May 28 22:47:35 2008 4# Wed Sep 10 09:02:02 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,7 +52,6 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
56CONFIG_KALLSYMS=y 55CONFIG_KALLSYMS=y
57# CONFIG_KALLSYMS_EXTRA_PASS is not set 56# CONFIG_KALLSYMS_EXTRA_PASS is not set
58CONFIG_HOTPLUG=y 57CONFIG_HOTPLUG=y
@@ -75,10 +74,16 @@ CONFIG_SLAB=y
75# CONFIG_PROFILING is not set 74# CONFIG_PROFILING is not set
76# CONFIG_MARKERS is not set 75# CONFIG_MARKERS is not set
77# CONFIG_HAVE_OPROFILE is not set 76# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
78# CONFIG_HAVE_IOREMAP_PROT is not set
78# CONFIG_HAVE_KPROBES is not set 79# CONFIG_HAVE_KPROBES is not set
79# CONFIG_HAVE_KRETPROBES is not set 80# CONFIG_HAVE_KRETPROBES is not set
81# CONFIG_HAVE_ARCH_TRACEHOOK is not set
80# CONFIG_HAVE_DMA_ATTRS is not set 82# CONFIG_HAVE_DMA_ATTRS is not set
83# CONFIG_USE_GENERIC_SMP_HELPERS is not set
84# CONFIG_HAVE_CLK is not set
81CONFIG_PROC_PAGE_MONITOR=y 85CONFIG_PROC_PAGE_MONITOR=y
86# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
82CONFIG_SLABINFO=y 87CONFIG_SLABINFO=y
83CONFIG_RT_MUTEXES=y 88CONFIG_RT_MUTEXES=y
84# CONFIG_TINY_SHMEM is not set 89# CONFIG_TINY_SHMEM is not set
@@ -95,6 +100,7 @@ CONFIG_BLOCK=y
95# CONFIG_BLK_DEV_IO_TRACE is not set 100# CONFIG_BLK_DEV_IO_TRACE is not set
96# CONFIG_LSF is not set 101# CONFIG_LSF is not set
97CONFIG_BLK_DEV_BSG=y 102CONFIG_BLK_DEV_BSG=y
103# CONFIG_BLK_DEV_INTEGRITY is not set
98 104
99# 105#
100# IO Schedulers 106# IO Schedulers
@@ -162,10 +168,6 @@ CONFIG_HEARTBEAT=y
162CONFIG_PROC_HARDWARE=y 168CONFIG_PROC_HARDWARE=y
163CONFIG_ZONE_DMA=y 169CONFIG_ZONE_DMA=y
164# CONFIG_ARCH_SUPPORTS_MSI is not set 170# CONFIG_ARCH_SUPPORTS_MSI is not set
165
166#
167# Networking
168#
169CONFIG_NET=y 171CONFIG_NET=y
170 172
171# 173#
@@ -179,6 +181,7 @@ CONFIG_XFRM=y
179# CONFIG_XFRM_SUB_POLICY is not set 181# CONFIG_XFRM_SUB_POLICY is not set
180CONFIG_XFRM_MIGRATE=y 182CONFIG_XFRM_MIGRATE=y
181# CONFIG_XFRM_STATISTICS is not set 183# CONFIG_XFRM_STATISTICS is not set
184CONFIG_XFRM_IPCOMP=m
182CONFIG_NET_KEY=y 185CONFIG_NET_KEY=y
183CONFIG_NET_KEY_MIGRATE=y 186CONFIG_NET_KEY_MIGRATE=y
184CONFIG_INET=y 187CONFIG_INET=y
@@ -409,6 +412,7 @@ CONFIG_NET_CLS_ROUTE=y
409# 412#
410# CONFIG_CFG80211 is not set 413# CONFIG_CFG80211 is not set
411CONFIG_WIRELESS_EXT=y 414CONFIG_WIRELESS_EXT=y
415# CONFIG_WIRELESS_EXT_SYSFS is not set
412# CONFIG_MAC80211 is not set 416# CONFIG_MAC80211 is not set
413CONFIG_IEEE80211=m 417CONFIG_IEEE80211=m
414# CONFIG_IEEE80211_DEBUG is not set 418# CONFIG_IEEE80211_DEBUG is not set
@@ -428,7 +432,9 @@ CONFIG_IEEE80211_CRYPT_TKIP=m
428CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 432CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
429CONFIG_STANDALONE=y 433CONFIG_STANDALONE=y
430CONFIG_PREVENT_FIRMWARE_BUILD=y 434CONFIG_PREVENT_FIRMWARE_BUILD=y
431CONFIG_FW_LOADER=m 435CONFIG_FW_LOADER=y
436# CONFIG_FIRMWARE_IN_KERNEL is not set
437CONFIG_EXTRA_FIRMWARE=""
432# CONFIG_SYS_HYPERVISOR is not set 438# CONFIG_SYS_HYPERVISOR is not set
433CONFIG_CONNECTOR=m 439CONFIG_CONNECTOR=m
434# CONFIG_MTD is not set 440# CONFIG_MTD is not set
@@ -452,6 +458,7 @@ CONFIG_CDROM_PKTCDVD=m
452CONFIG_CDROM_PKTCDVD_BUFFERS=8 458CONFIG_CDROM_PKTCDVD_BUFFERS=8
453# CONFIG_CDROM_PKTCDVD_WCACHE is not set 459# CONFIG_CDROM_PKTCDVD_WCACHE is not set
454CONFIG_ATA_OVER_ETH=m 460CONFIG_ATA_OVER_ETH=m
461# CONFIG_BLK_DEV_HD is not set
455CONFIG_MISC_DEVICES=y 462CONFIG_MISC_DEVICES=y
456# CONFIG_EEPROM_93CX6 is not set 463# CONFIG_EEPROM_93CX6 is not set
457# CONFIG_ENCLOSURE_SERVICES is not set 464# CONFIG_ENCLOSURE_SERVICES is not set
@@ -462,6 +469,7 @@ CONFIG_BLK_DEV_IDE=y
462# 469#
463# Please see Documentation/ide/ide.txt for help/info on IDE drives 470# Please see Documentation/ide/ide.txt for help/info on IDE drives
464# 471#
472CONFIG_IDE_ATAPI=y
465# CONFIG_BLK_DEV_IDE_SATA is not set 473# CONFIG_BLK_DEV_IDE_SATA is not set
466CONFIG_BLK_DEV_IDEDISK=y 474CONFIG_BLK_DEV_IDEDISK=y
467# CONFIG_IDEDISK_MULTI_MODE is not set 475# CONFIG_IDEDISK_MULTI_MODE is not set
@@ -479,8 +487,6 @@ CONFIG_IDE_PROC_FS=y
479# CONFIG_BLK_DEV_PLATFORM is not set 487# CONFIG_BLK_DEV_PLATFORM is not set
480CONFIG_BLK_DEV_FALCON_IDE=y 488CONFIG_BLK_DEV_FALCON_IDE=y
481# CONFIG_BLK_DEV_IDEDMA is not set 489# CONFIG_BLK_DEV_IDEDMA is not set
482# CONFIG_BLK_DEV_HD_ONLY is not set
483# CONFIG_BLK_DEV_HD is not set
484 490
485# 491#
486# SCSI device support 492# SCSI device support
@@ -530,6 +536,7 @@ CONFIG_ISCSI_TCP=m
530CONFIG_ATARI_SCSI=y 536CONFIG_ATARI_SCSI=y
531# CONFIG_ATARI_SCSI_TOSHIBA_DELAY is not set 537# CONFIG_ATARI_SCSI_TOSHIBA_DELAY is not set
532# CONFIG_ATARI_SCSI_RESET_BOOT is not set 538# CONFIG_ATARI_SCSI_RESET_BOOT is not set
539# CONFIG_SCSI_DH is not set
533CONFIG_MD=y 540CONFIG_MD=y
534CONFIG_BLK_DEV_MD=m 541CONFIG_BLK_DEV_MD=m
535CONFIG_MD_LINEAR=m 542CONFIG_MD_LINEAR=m
@@ -538,7 +545,7 @@ CONFIG_MD_RAID1=m
538# CONFIG_MD_RAID10 is not set 545# CONFIG_MD_RAID10 is not set
539CONFIG_MD_RAID456=m 546CONFIG_MD_RAID456=m
540CONFIG_MD_RAID5_RESHAPE=y 547CONFIG_MD_RAID5_RESHAPE=y
541CONFIG_MD_MULTIPATH=m 548# CONFIG_MD_MULTIPATH is not set
542# CONFIG_MD_FAULTY is not set 549# CONFIG_MD_FAULTY is not set
543CONFIG_BLK_DEV_DM=m 550CONFIG_BLK_DEV_DM=m
544# CONFIG_DM_DEBUG is not set 551# CONFIG_DM_DEBUG is not set
@@ -547,13 +554,9 @@ CONFIG_DM_SNAPSHOT=m
547CONFIG_DM_MIRROR=m 554CONFIG_DM_MIRROR=m
548CONFIG_DM_ZERO=m 555CONFIG_DM_ZERO=m
549CONFIG_DM_MULTIPATH=m 556CONFIG_DM_MULTIPATH=m
550CONFIG_DM_MULTIPATH_EMC=m
551CONFIG_DM_MULTIPATH_RDAC=m
552CONFIG_DM_MULTIPATH_HP=m
553# CONFIG_DM_DELAY is not set 557# CONFIG_DM_DELAY is not set
554CONFIG_DM_UEVENT=y 558CONFIG_DM_UEVENT=y
555CONFIG_NETDEVICES=y 559CONFIG_NETDEVICES=y
556# CONFIG_NETDEVICES_MULTIQUEUE is not set
557CONFIG_DUMMY=m 560CONFIG_DUMMY=m
558# CONFIG_BONDING is not set 561# CONFIG_BONDING is not set
559CONFIG_MACVLAN=m 562CONFIG_MACVLAN=m
@@ -666,6 +669,7 @@ CONFIG_SERIO_LIBPS2=y
666# Character devices 669# Character devices
667# 670#
668CONFIG_VT=y 671CONFIG_VT=y
672CONFIG_CONSOLE_TRANSLATIONS=y
669CONFIG_VT_CONSOLE=y 673CONFIG_VT_CONSOLE=y
670CONFIG_HW_CONSOLE=y 674CONFIG_HW_CONSOLE=y
671CONFIG_VT_HW_CONSOLE_BINDING=y 675CONFIG_VT_HW_CONSOLE_BINDING=y
@@ -700,6 +704,7 @@ CONFIG_GEN_RTC_X=y
700# CONFIG_POWER_SUPPLY is not set 704# CONFIG_POWER_SUPPLY is not set
701# CONFIG_HWMON is not set 705# CONFIG_HWMON is not set
702# CONFIG_THERMAL is not set 706# CONFIG_THERMAL is not set
707# CONFIG_THERMAL_HWMON is not set
703# CONFIG_WATCHDOG is not set 708# CONFIG_WATCHDOG is not set
704 709
705# 710#
@@ -711,8 +716,10 @@ CONFIG_SSB_POSSIBLE=y
711# 716#
712# Multifunction device drivers 717# Multifunction device drivers
713# 718#
719# CONFIG_MFD_CORE is not set
714# CONFIG_MFD_SM501 is not set 720# CONFIG_MFD_SM501 is not set
715# CONFIG_HTC_PASIC3 is not set 721# CONFIG_HTC_PASIC3 is not set
722# CONFIG_MFD_TMIO is not set
716 723
717# 724#
718# Multimedia devices 725# Multimedia devices
@@ -782,10 +789,6 @@ CONFIG_LOGO=y
782CONFIG_LOGO_LINUX_MONO=y 789CONFIG_LOGO_LINUX_MONO=y
783CONFIG_LOGO_LINUX_VGA16=y 790CONFIG_LOGO_LINUX_VGA16=y
784CONFIG_LOGO_LINUX_CLUT224=y 791CONFIG_LOGO_LINUX_CLUT224=y
785
786#
787# Sound
788#
789CONFIG_SOUND=m 792CONFIG_SOUND=m
790CONFIG_DMASOUND_ATARI=m 793CONFIG_DMASOUND_ATARI=m
791CONFIG_DMASOUND=m 794CONFIG_DMASOUND=m
@@ -799,6 +802,7 @@ CONFIG_HIDRAW=y
799# CONFIG_NEW_LEDS is not set 802# CONFIG_NEW_LEDS is not set
800# CONFIG_ACCESSIBILITY is not set 803# CONFIG_ACCESSIBILITY is not set
801# CONFIG_RTC_CLASS is not set 804# CONFIG_RTC_CLASS is not set
805# CONFIG_DMADEVICES is not set
802# CONFIG_AUXDISPLAY is not set 806# CONFIG_AUXDISPLAY is not set
803# CONFIG_UIO is not set 807# CONFIG_UIO is not set
804 808
@@ -806,11 +810,8 @@ CONFIG_HIDRAW=y
806# Character devices 810# Character devices
807# 811#
808CONFIG_ATARI_MFPSER=m 812CONFIG_ATARI_MFPSER=m
809CONFIG_ATARI_SCC=y
810CONFIG_ATARI_SCC_DMA=y
811CONFIG_ATARI_MIDI=m 813CONFIG_ATARI_MIDI=m
812CONFIG_ATARI_DSP56K=m 814CONFIG_ATARI_DSP56K=m
813# CONFIG_SERIAL_CONSOLE is not set
814 815
815# 816#
816# File systems 817# File systems
@@ -820,8 +821,10 @@ CONFIG_EXT2_FS=y
820# CONFIG_EXT2_FS_XIP is not set 821# CONFIG_EXT2_FS_XIP is not set
821CONFIG_EXT3_FS=y 822CONFIG_EXT3_FS=y
822# CONFIG_EXT3_FS_XATTR is not set 823# CONFIG_EXT3_FS_XATTR is not set
823# CONFIG_EXT4DEV_FS is not set 824CONFIG_EXT4DEV_FS=y
825# CONFIG_EXT4DEV_FS_XATTR is not set
824CONFIG_JBD=y 826CONFIG_JBD=y
827CONFIG_JBD2=y
825CONFIG_REISERFS_FS=m 828CONFIG_REISERFS_FS=m
826# CONFIG_REISERFS_CHECK is not set 829# CONFIG_REISERFS_CHECK is not set
827# CONFIG_REISERFS_PROC_INFO is not set 830# CONFIG_REISERFS_PROC_INFO is not set
@@ -840,6 +843,7 @@ CONFIG_XFS_FS=m
840CONFIG_OCFS2_FS=m 843CONFIG_OCFS2_FS=m
841CONFIG_OCFS2_FS_O2CB=m 844CONFIG_OCFS2_FS_O2CB=m
842CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m 845CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
846# CONFIG_OCFS2_FS_STATS is not set
843# CONFIG_OCFS2_DEBUG_MASKLOG is not set 847# CONFIG_OCFS2_DEBUG_MASKLOG is not set
844# CONFIG_OCFS2_DEBUG_FS is not set 848# CONFIG_OCFS2_DEBUG_FS is not set
845CONFIG_DNOTIFY=y 849CONFIG_DNOTIFY=y
@@ -899,6 +903,7 @@ CONFIG_HFSPLUS_FS=m
899CONFIG_CRAMFS=m 903CONFIG_CRAMFS=m
900# CONFIG_VXFS_FS is not set 904# CONFIG_VXFS_FS is not set
901CONFIG_MINIX_FS=y 905CONFIG_MINIX_FS=y
906# CONFIG_OMFS_FS is not set
902CONFIG_HPFS_FS=m 907CONFIG_HPFS_FS=m
903# CONFIG_QNX4FS_FS is not set 908# CONFIG_QNX4FS_FS is not set
904# CONFIG_ROMFS_FS is not set 909# CONFIG_ROMFS_FS is not set
@@ -920,7 +925,6 @@ CONFIG_LOCKD_V4=y
920CONFIG_EXPORTFS=m 925CONFIG_EXPORTFS=m
921CONFIG_NFS_COMMON=y 926CONFIG_NFS_COMMON=y
922CONFIG_SUNRPC=m 927CONFIG_SUNRPC=m
923CONFIG_SUNRPC_BIND34=y
924# CONFIG_RPCSEC_GSS_KRB5 is not set 928# CONFIG_RPCSEC_GSS_KRB5 is not set
925# CONFIG_RPCSEC_GSS_SPKM3 is not set 929# CONFIG_RPCSEC_GSS_SPKM3 is not set
926CONFIG_SMB_FS=m 930CONFIG_SMB_FS=m
@@ -929,7 +933,6 @@ CONFIG_SMB_NLS_REMOTE="cp437"
929# CONFIG_CIFS is not set 933# CONFIG_CIFS is not set
930# CONFIG_NCP_FS is not set 934# CONFIG_NCP_FS is not set
931CONFIG_CODA_FS=m 935CONFIG_CODA_FS=m
932# CONFIG_CODA_FS_OLD_API is not set
933# CONFIG_AFS_FS is not set 936# CONFIG_AFS_FS is not set
934 937
935# 938#
@@ -994,6 +997,8 @@ CONFIG_MAGIC_SYSRQ=y
994# CONFIG_HEADERS_CHECK is not set 997# CONFIG_HEADERS_CHECK is not set
995# CONFIG_DEBUG_KERNEL is not set 998# CONFIG_DEBUG_KERNEL is not set
996CONFIG_DEBUG_BUGVERBOSE=y 999CONFIG_DEBUG_BUGVERBOSE=y
1000CONFIG_DEBUG_MEMORY_INIT=y
1001CONFIG_SYSCTL_SYSCALL_CHECK=y
997# CONFIG_SAMPLES is not set 1002# CONFIG_SAMPLES is not set
998 1003
999# 1004#
@@ -1053,6 +1058,10 @@ CONFIG_CRYPTO_CRC32C=m
1053CONFIG_CRYPTO_MD4=m 1058CONFIG_CRYPTO_MD4=m
1054CONFIG_CRYPTO_MD5=m 1059CONFIG_CRYPTO_MD5=m
1055CONFIG_CRYPTO_MICHAEL_MIC=m 1060CONFIG_CRYPTO_MICHAEL_MIC=m
1061CONFIG_CRYPTO_RMD128=m
1062CONFIG_CRYPTO_RMD160=m
1063CONFIG_CRYPTO_RMD256=m
1064CONFIG_CRYPTO_RMD320=m
1056CONFIG_CRYPTO_SHA1=m 1065CONFIG_CRYPTO_SHA1=m
1057CONFIG_CRYPTO_SHA256=m 1066CONFIG_CRYPTO_SHA256=m
1058CONFIG_CRYPTO_SHA512=m 1067CONFIG_CRYPTO_SHA512=m
@@ -1094,6 +1103,7 @@ CONFIG_BITREVERSE=y
1094# CONFIG_GENERIC_FIND_NEXT_BIT is not set 1103# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1095CONFIG_CRC_CCITT=m 1104CONFIG_CRC_CCITT=m
1096CONFIG_CRC16=y 1105CONFIG_CRC16=y
1106CONFIG_CRC_T10DIF=y
1097CONFIG_CRC_ITU_T=m 1107CONFIG_CRC_ITU_T=m
1098CONFIG_CRC32=y 1108CONFIG_CRC32=y
1099# CONFIG_CRC7 is not set 1109# CONFIG_CRC7 is not set
diff --git a/arch/m68k/configs/bvme6000_defconfig b/arch/m68k/configs/bvme6000_defconfig
index a0a9b30bb502..2e44af0fe54a 100644
--- a/arch/m68k/configs/bvme6000_defconfig
+++ b/arch/m68k/configs/bvme6000_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc4 3# Linux kernel version: 2.6.27-rc6
4# Wed May 28 22:47:35 2008 4# Wed Sep 10 09:02:03 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,7 +52,6 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
56CONFIG_KALLSYMS=y 55CONFIG_KALLSYMS=y
57# CONFIG_KALLSYMS_EXTRA_PASS is not set 56# CONFIG_KALLSYMS_EXTRA_PASS is not set
58CONFIG_HOTPLUG=y 57CONFIG_HOTPLUG=y
@@ -75,10 +74,16 @@ CONFIG_SLAB=y
75# CONFIG_PROFILING is not set 74# CONFIG_PROFILING is not set
76# CONFIG_MARKERS is not set 75# CONFIG_MARKERS is not set
77# CONFIG_HAVE_OPROFILE is not set 76# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
78# CONFIG_HAVE_IOREMAP_PROT is not set
78# CONFIG_HAVE_KPROBES is not set 79# CONFIG_HAVE_KPROBES is not set
79# CONFIG_HAVE_KRETPROBES is not set 80# CONFIG_HAVE_KRETPROBES is not set
81# CONFIG_HAVE_ARCH_TRACEHOOK is not set
80# CONFIG_HAVE_DMA_ATTRS is not set 82# CONFIG_HAVE_DMA_ATTRS is not set
83# CONFIG_USE_GENERIC_SMP_HELPERS is not set
84# CONFIG_HAVE_CLK is not set
81CONFIG_PROC_PAGE_MONITOR=y 85CONFIG_PROC_PAGE_MONITOR=y
86# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
82CONFIG_SLABINFO=y 87CONFIG_SLABINFO=y
83CONFIG_RT_MUTEXES=y 88CONFIG_RT_MUTEXES=y
84# CONFIG_TINY_SHMEM is not set 89# CONFIG_TINY_SHMEM is not set
@@ -95,6 +100,7 @@ CONFIG_BLOCK=y
95# CONFIG_BLK_DEV_IO_TRACE is not set 100# CONFIG_BLK_DEV_IO_TRACE is not set
96# CONFIG_LSF is not set 101# CONFIG_LSF is not set
97CONFIG_BLK_DEV_BSG=y 102CONFIG_BLK_DEV_BSG=y
103# CONFIG_BLK_DEV_INTEGRITY is not set
98 104
99# 105#
100# IO Schedulers 106# IO Schedulers
@@ -163,10 +169,6 @@ CONFIG_BINFMT_MISC=m
163CONFIG_PROC_HARDWARE=y 169CONFIG_PROC_HARDWARE=y
164CONFIG_ZONE_DMA=y 170CONFIG_ZONE_DMA=y
165# CONFIG_ARCH_SUPPORTS_MSI is not set 171# CONFIG_ARCH_SUPPORTS_MSI is not set
166
167#
168# Networking
169#
170CONFIG_NET=y 172CONFIG_NET=y
171 173
172# 174#
@@ -180,6 +182,7 @@ CONFIG_XFRM=y
180# CONFIG_XFRM_SUB_POLICY is not set 182# CONFIG_XFRM_SUB_POLICY is not set
181CONFIG_XFRM_MIGRATE=y 183CONFIG_XFRM_MIGRATE=y
182# CONFIG_XFRM_STATISTICS is not set 184# CONFIG_XFRM_STATISTICS is not set
185CONFIG_XFRM_IPCOMP=m
183CONFIG_NET_KEY=y 186CONFIG_NET_KEY=y
184CONFIG_NET_KEY_MIGRATE=y 187CONFIG_NET_KEY_MIGRATE=y
185CONFIG_INET=y 188CONFIG_INET=y
@@ -413,6 +416,7 @@ CONFIG_NET_CLS_ROUTE=y
413# 416#
414# CONFIG_CFG80211 is not set 417# CONFIG_CFG80211 is not set
415CONFIG_WIRELESS_EXT=y 418CONFIG_WIRELESS_EXT=y
419# CONFIG_WIRELESS_EXT_SYSFS is not set
416# CONFIG_MAC80211 is not set 420# CONFIG_MAC80211 is not set
417CONFIG_IEEE80211=m 421CONFIG_IEEE80211=m
418# CONFIG_IEEE80211_DEBUG is not set 422# CONFIG_IEEE80211_DEBUG is not set
@@ -432,7 +436,9 @@ CONFIG_IEEE80211_CRYPT_TKIP=m
432CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 436CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
433CONFIG_STANDALONE=y 437CONFIG_STANDALONE=y
434CONFIG_PREVENT_FIRMWARE_BUILD=y 438CONFIG_PREVENT_FIRMWARE_BUILD=y
435CONFIG_FW_LOADER=m 439CONFIG_FW_LOADER=y
440# CONFIG_FIRMWARE_IN_KERNEL is not set
441CONFIG_EXTRA_FIRMWARE=""
436# CONFIG_SYS_HYPERVISOR is not set 442# CONFIG_SYS_HYPERVISOR is not set
437CONFIG_CONNECTOR=m 443CONFIG_CONNECTOR=m
438# CONFIG_MTD is not set 444# CONFIG_MTD is not set
@@ -450,6 +456,7 @@ CONFIG_CDROM_PKTCDVD=m
450CONFIG_CDROM_PKTCDVD_BUFFERS=8 456CONFIG_CDROM_PKTCDVD_BUFFERS=8
451# CONFIG_CDROM_PKTCDVD_WCACHE is not set 457# CONFIG_CDROM_PKTCDVD_WCACHE is not set
452CONFIG_ATA_OVER_ETH=m 458CONFIG_ATA_OVER_ETH=m
459# CONFIG_BLK_DEV_HD is not set
453CONFIG_MISC_DEVICES=y 460CONFIG_MISC_DEVICES=y
454# CONFIG_EEPROM_93CX6 is not set 461# CONFIG_EEPROM_93CX6 is not set
455# CONFIG_ENCLOSURE_SERVICES is not set 462# CONFIG_ENCLOSURE_SERVICES is not set
@@ -503,6 +510,7 @@ CONFIG_ISCSI_TCP=m
503CONFIG_53C700_BE_BUS=y 510CONFIG_53C700_BE_BUS=y
504# CONFIG_SCSI_DEBUG is not set 511# CONFIG_SCSI_DEBUG is not set
505CONFIG_BVME6000_SCSI=y 512CONFIG_BVME6000_SCSI=y
513# CONFIG_SCSI_DH is not set
506CONFIG_MD=y 514CONFIG_MD=y
507CONFIG_BLK_DEV_MD=m 515CONFIG_BLK_DEV_MD=m
508CONFIG_MD_LINEAR=m 516CONFIG_MD_LINEAR=m
@@ -511,7 +519,7 @@ CONFIG_MD_RAID1=m
511# CONFIG_MD_RAID10 is not set 519# CONFIG_MD_RAID10 is not set
512CONFIG_MD_RAID456=m 520CONFIG_MD_RAID456=m
513CONFIG_MD_RAID5_RESHAPE=y 521CONFIG_MD_RAID5_RESHAPE=y
514CONFIG_MD_MULTIPATH=m 522# CONFIG_MD_MULTIPATH is not set
515# CONFIG_MD_FAULTY is not set 523# CONFIG_MD_FAULTY is not set
516CONFIG_BLK_DEV_DM=m 524CONFIG_BLK_DEV_DM=m
517# CONFIG_DM_DEBUG is not set 525# CONFIG_DM_DEBUG is not set
@@ -520,13 +528,9 @@ CONFIG_DM_SNAPSHOT=m
520CONFIG_DM_MIRROR=m 528CONFIG_DM_MIRROR=m
521CONFIG_DM_ZERO=m 529CONFIG_DM_ZERO=m
522CONFIG_DM_MULTIPATH=m 530CONFIG_DM_MULTIPATH=m
523CONFIG_DM_MULTIPATH_EMC=m
524CONFIG_DM_MULTIPATH_RDAC=m
525CONFIG_DM_MULTIPATH_HP=m
526# CONFIG_DM_DELAY is not set 531# CONFIG_DM_DELAY is not set
527CONFIG_DM_UEVENT=y 532CONFIG_DM_UEVENT=y
528CONFIG_NETDEVICES=y 533CONFIG_NETDEVICES=y
529# CONFIG_NETDEVICES_MULTIQUEUE is not set
530CONFIG_DUMMY=m 534CONFIG_DUMMY=m
531# CONFIG_BONDING is not set 535# CONFIG_BONDING is not set
532CONFIG_MACVLAN=m 536CONFIG_MACVLAN=m
@@ -631,6 +635,7 @@ CONFIG_SERIO_LIBPS2=m
631# Character devices 635# Character devices
632# 636#
633CONFIG_VT=y 637CONFIG_VT=y
638CONFIG_CONSOLE_TRANSLATIONS=y
634CONFIG_VT_CONSOLE=y 639CONFIG_VT_CONSOLE=y
635CONFIG_HW_CONSOLE=y 640CONFIG_HW_CONSOLE=y
636CONFIG_VT_HW_CONSOLE_BINDING=y 641CONFIG_VT_HW_CONSOLE_BINDING=y
@@ -661,6 +666,7 @@ CONFIG_GEN_RTC_X=y
661# CONFIG_POWER_SUPPLY is not set 666# CONFIG_POWER_SUPPLY is not set
662# CONFIG_HWMON is not set 667# CONFIG_HWMON is not set
663# CONFIG_THERMAL is not set 668# CONFIG_THERMAL is not set
669# CONFIG_THERMAL_HWMON is not set
664# CONFIG_WATCHDOG is not set 670# CONFIG_WATCHDOG is not set
665 671
666# 672#
@@ -672,8 +678,10 @@ CONFIG_SSB_POSSIBLE=y
672# 678#
673# Multifunction device drivers 679# Multifunction device drivers
674# 680#
681# CONFIG_MFD_CORE is not set
675# CONFIG_MFD_SM501 is not set 682# CONFIG_MFD_SM501 is not set
676# CONFIG_HTC_PASIC3 is not set 683# CONFIG_HTC_PASIC3 is not set
684# CONFIG_MFD_TMIO is not set
677 685
678# 686#
679# Multimedia devices 687# Multimedia devices
@@ -708,10 +716,6 @@ CONFIG_SSB_POSSIBLE=y
708# Console display driver support 716# Console display driver support
709# 717#
710CONFIG_DUMMY_CONSOLE=y 718CONFIG_DUMMY_CONSOLE=y
711
712#
713# Sound
714#
715# CONFIG_SOUND is not set 719# CONFIG_SOUND is not set
716CONFIG_HID_SUPPORT=y 720CONFIG_HID_SUPPORT=y
717CONFIG_HID=m 721CONFIG_HID=m
@@ -723,6 +727,7 @@ CONFIG_HIDRAW=y
723# CONFIG_NEW_LEDS is not set 727# CONFIG_NEW_LEDS is not set
724# CONFIG_ACCESSIBILITY is not set 728# CONFIG_ACCESSIBILITY is not set
725# CONFIG_RTC_CLASS is not set 729# CONFIG_RTC_CLASS is not set
730# CONFIG_DMADEVICES is not set
726# CONFIG_UIO is not set 731# CONFIG_UIO is not set
727 732
728# 733#
@@ -759,6 +764,7 @@ CONFIG_XFS_FS=m
759CONFIG_OCFS2_FS=m 764CONFIG_OCFS2_FS=m
760CONFIG_OCFS2_FS_O2CB=m 765CONFIG_OCFS2_FS_O2CB=m
761CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m 766CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
767# CONFIG_OCFS2_FS_STATS is not set
762# CONFIG_OCFS2_DEBUG_MASKLOG is not set 768# CONFIG_OCFS2_DEBUG_MASKLOG is not set
763# CONFIG_OCFS2_DEBUG_FS is not set 769# CONFIG_OCFS2_DEBUG_FS is not set
764CONFIG_DNOTIFY=y 770CONFIG_DNOTIFY=y
@@ -818,6 +824,7 @@ CONFIG_HFSPLUS_FS=m
818CONFIG_CRAMFS=m 824CONFIG_CRAMFS=m
819# CONFIG_VXFS_FS is not set 825# CONFIG_VXFS_FS is not set
820CONFIG_MINIX_FS=y 826CONFIG_MINIX_FS=y
827# CONFIG_OMFS_FS is not set
821CONFIG_HPFS_FS=m 828CONFIG_HPFS_FS=m
822# CONFIG_QNX4FS_FS is not set 829# CONFIG_QNX4FS_FS is not set
823# CONFIG_ROMFS_FS is not set 830# CONFIG_ROMFS_FS is not set
@@ -830,18 +837,17 @@ CONFIG_NFS_FS=y
830CONFIG_NFS_V3=y 837CONFIG_NFS_V3=y
831# CONFIG_NFS_V3_ACL is not set 838# CONFIG_NFS_V3_ACL is not set
832CONFIG_NFS_V4=y 839CONFIG_NFS_V4=y
840CONFIG_ROOT_NFS=y
833CONFIG_NFSD=m 841CONFIG_NFSD=m
834CONFIG_NFSD_V3=y 842CONFIG_NFSD_V3=y
835# CONFIG_NFSD_V3_ACL is not set 843# CONFIG_NFSD_V3_ACL is not set
836# CONFIG_NFSD_V4 is not set 844# CONFIG_NFSD_V4 is not set
837CONFIG_ROOT_NFS=y
838CONFIG_LOCKD=y 845CONFIG_LOCKD=y
839CONFIG_LOCKD_V4=y 846CONFIG_LOCKD_V4=y
840CONFIG_EXPORTFS=m 847CONFIG_EXPORTFS=m
841CONFIG_NFS_COMMON=y 848CONFIG_NFS_COMMON=y
842CONFIG_SUNRPC=y 849CONFIG_SUNRPC=y
843CONFIG_SUNRPC_GSS=y 850CONFIG_SUNRPC_GSS=y
844CONFIG_SUNRPC_BIND34=y
845CONFIG_RPCSEC_GSS_KRB5=y 851CONFIG_RPCSEC_GSS_KRB5=y
846# CONFIG_RPCSEC_GSS_SPKM3 is not set 852# CONFIG_RPCSEC_GSS_SPKM3 is not set
847CONFIG_SMB_FS=m 853CONFIG_SMB_FS=m
@@ -850,7 +856,6 @@ CONFIG_SMB_NLS_REMOTE="cp437"
850# CONFIG_CIFS is not set 856# CONFIG_CIFS is not set
851# CONFIG_NCP_FS is not set 857# CONFIG_NCP_FS is not set
852CONFIG_CODA_FS=m 858CONFIG_CODA_FS=m
853# CONFIG_CODA_FS_OLD_API is not set
854# CONFIG_AFS_FS is not set 859# CONFIG_AFS_FS is not set
855 860
856# 861#
@@ -915,6 +920,8 @@ CONFIG_MAGIC_SYSRQ=y
915# CONFIG_HEADERS_CHECK is not set 920# CONFIG_HEADERS_CHECK is not set
916# CONFIG_DEBUG_KERNEL is not set 921# CONFIG_DEBUG_KERNEL is not set
917CONFIG_DEBUG_BUGVERBOSE=y 922CONFIG_DEBUG_BUGVERBOSE=y
923CONFIG_DEBUG_MEMORY_INIT=y
924CONFIG_SYSCTL_SYSCALL_CHECK=y
918# CONFIG_SAMPLES is not set 925# CONFIG_SAMPLES is not set
919 926
920# 927#
@@ -974,6 +981,10 @@ CONFIG_CRYPTO_CRC32C=m
974CONFIG_CRYPTO_MD4=m 981CONFIG_CRYPTO_MD4=m
975CONFIG_CRYPTO_MD5=y 982CONFIG_CRYPTO_MD5=y
976CONFIG_CRYPTO_MICHAEL_MIC=m 983CONFIG_CRYPTO_MICHAEL_MIC=m
984CONFIG_CRYPTO_RMD128=m
985CONFIG_CRYPTO_RMD160=m
986CONFIG_CRYPTO_RMD256=m
987CONFIG_CRYPTO_RMD320=m
977CONFIG_CRYPTO_SHA1=m 988CONFIG_CRYPTO_SHA1=m
978CONFIG_CRYPTO_SHA256=m 989CONFIG_CRYPTO_SHA256=m
979CONFIG_CRYPTO_SHA512=m 990CONFIG_CRYPTO_SHA512=m
@@ -1015,6 +1026,7 @@ CONFIG_BITREVERSE=m
1015# CONFIG_GENERIC_FIND_NEXT_BIT is not set 1026# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1016CONFIG_CRC_CCITT=m 1027CONFIG_CRC_CCITT=m
1017CONFIG_CRC16=m 1028CONFIG_CRC16=m
1029CONFIG_CRC_T10DIF=y
1018CONFIG_CRC_ITU_T=m 1030CONFIG_CRC_ITU_T=m
1019CONFIG_CRC32=m 1031CONFIG_CRC32=m
1020# CONFIG_CRC7 is not set 1032# CONFIG_CRC7 is not set
diff --git a/arch/m68k/configs/hp300_defconfig b/arch/m68k/configs/hp300_defconfig
index 6778041de262..3570fc89b089 100644
--- a/arch/m68k/configs/hp300_defconfig
+++ b/arch/m68k/configs/hp300_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc4 3# Linux kernel version: 2.6.27-rc6
4# Wed May 28 22:47:35 2008 4# Wed Sep 10 09:02:04 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,7 +52,6 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
56CONFIG_KALLSYMS=y 55CONFIG_KALLSYMS=y
57# CONFIG_KALLSYMS_EXTRA_PASS is not set 56# CONFIG_KALLSYMS_EXTRA_PASS is not set
58CONFIG_HOTPLUG=y 57CONFIG_HOTPLUG=y
@@ -75,10 +74,16 @@ CONFIG_SLAB=y
75# CONFIG_PROFILING is not set 74# CONFIG_PROFILING is not set
76# CONFIG_MARKERS is not set 75# CONFIG_MARKERS is not set
77# CONFIG_HAVE_OPROFILE is not set 76# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
78# CONFIG_HAVE_IOREMAP_PROT is not set
78# CONFIG_HAVE_KPROBES is not set 79# CONFIG_HAVE_KPROBES is not set
79# CONFIG_HAVE_KRETPROBES is not set 80# CONFIG_HAVE_KRETPROBES is not set
81# CONFIG_HAVE_ARCH_TRACEHOOK is not set
80# CONFIG_HAVE_DMA_ATTRS is not set 82# CONFIG_HAVE_DMA_ATTRS is not set
83# CONFIG_USE_GENERIC_SMP_HELPERS is not set
84# CONFIG_HAVE_CLK is not set
81CONFIG_PROC_PAGE_MONITOR=y 85CONFIG_PROC_PAGE_MONITOR=y
86# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
82CONFIG_SLABINFO=y 87CONFIG_SLABINFO=y
83CONFIG_RT_MUTEXES=y 88CONFIG_RT_MUTEXES=y
84# CONFIG_TINY_SHMEM is not set 89# CONFIG_TINY_SHMEM is not set
@@ -95,6 +100,7 @@ CONFIG_BLOCK=y
95# CONFIG_BLK_DEV_IO_TRACE is not set 100# CONFIG_BLK_DEV_IO_TRACE is not set
96# CONFIG_LSF is not set 101# CONFIG_LSF is not set
97CONFIG_BLK_DEV_BSG=y 102CONFIG_BLK_DEV_BSG=y
103# CONFIG_BLK_DEV_INTEGRITY is not set
98 104
99# 105#
100# IO Schedulers 106# IO Schedulers
@@ -162,10 +168,6 @@ CONFIG_HEARTBEAT=y
162CONFIG_PROC_HARDWARE=y 168CONFIG_PROC_HARDWARE=y
163CONFIG_ZONE_DMA=y 169CONFIG_ZONE_DMA=y
164# CONFIG_ARCH_SUPPORTS_MSI is not set 170# CONFIG_ARCH_SUPPORTS_MSI is not set
165
166#
167# Networking
168#
169CONFIG_NET=y 171CONFIG_NET=y
170 172
171# 173#
@@ -179,6 +181,7 @@ CONFIG_XFRM=y
179# CONFIG_XFRM_SUB_POLICY is not set 181# CONFIG_XFRM_SUB_POLICY is not set
180CONFIG_XFRM_MIGRATE=y 182CONFIG_XFRM_MIGRATE=y
181# CONFIG_XFRM_STATISTICS is not set 183# CONFIG_XFRM_STATISTICS is not set
184CONFIG_XFRM_IPCOMP=m
182CONFIG_NET_KEY=y 185CONFIG_NET_KEY=y
183CONFIG_NET_KEY_MIGRATE=y 186CONFIG_NET_KEY_MIGRATE=y
184CONFIG_INET=y 187CONFIG_INET=y
@@ -412,6 +415,7 @@ CONFIG_NET_CLS_ROUTE=y
412# 415#
413# CONFIG_CFG80211 is not set 416# CONFIG_CFG80211 is not set
414CONFIG_WIRELESS_EXT=y 417CONFIG_WIRELESS_EXT=y
418# CONFIG_WIRELESS_EXT_SYSFS is not set
415# CONFIG_MAC80211 is not set 419# CONFIG_MAC80211 is not set
416CONFIG_IEEE80211=m 420CONFIG_IEEE80211=m
417# CONFIG_IEEE80211_DEBUG is not set 421# CONFIG_IEEE80211_DEBUG is not set
@@ -431,7 +435,9 @@ CONFIG_IEEE80211_CRYPT_TKIP=m
431CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 435CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
432CONFIG_STANDALONE=y 436CONFIG_STANDALONE=y
433CONFIG_PREVENT_FIRMWARE_BUILD=y 437CONFIG_PREVENT_FIRMWARE_BUILD=y
434CONFIG_FW_LOADER=m 438CONFIG_FW_LOADER=y
439# CONFIG_FIRMWARE_IN_KERNEL is not set
440CONFIG_EXTRA_FIRMWARE=""
435# CONFIG_SYS_HYPERVISOR is not set 441# CONFIG_SYS_HYPERVISOR is not set
436CONFIG_CONNECTOR=m 442CONFIG_CONNECTOR=m
437# CONFIG_MTD is not set 443# CONFIG_MTD is not set
@@ -449,6 +455,7 @@ CONFIG_CDROM_PKTCDVD=m
449CONFIG_CDROM_PKTCDVD_BUFFERS=8 455CONFIG_CDROM_PKTCDVD_BUFFERS=8
450# CONFIG_CDROM_PKTCDVD_WCACHE is not set 456# CONFIG_CDROM_PKTCDVD_WCACHE is not set
451CONFIG_ATA_OVER_ETH=m 457CONFIG_ATA_OVER_ETH=m
458# CONFIG_BLK_DEV_HD is not set
452CONFIG_MISC_DEVICES=y 459CONFIG_MISC_DEVICES=y
453# CONFIG_EEPROM_93CX6 is not set 460# CONFIG_EEPROM_93CX6 is not set
454# CONFIG_ENCLOSURE_SERVICES is not set 461# CONFIG_ENCLOSURE_SERVICES is not set
@@ -500,6 +507,7 @@ CONFIG_SCSI_SRP_TGT_ATTRS=y
500CONFIG_SCSI_LOWLEVEL=y 507CONFIG_SCSI_LOWLEVEL=y
501CONFIG_ISCSI_TCP=m 508CONFIG_ISCSI_TCP=m
502# CONFIG_SCSI_DEBUG is not set 509# CONFIG_SCSI_DEBUG is not set
510# CONFIG_SCSI_DH is not set
503CONFIG_MD=y 511CONFIG_MD=y
504CONFIG_BLK_DEV_MD=m 512CONFIG_BLK_DEV_MD=m
505CONFIG_MD_LINEAR=m 513CONFIG_MD_LINEAR=m
@@ -508,7 +516,7 @@ CONFIG_MD_RAID1=m
508# CONFIG_MD_RAID10 is not set 516# CONFIG_MD_RAID10 is not set
509CONFIG_MD_RAID456=m 517CONFIG_MD_RAID456=m
510CONFIG_MD_RAID5_RESHAPE=y 518CONFIG_MD_RAID5_RESHAPE=y
511CONFIG_MD_MULTIPATH=m 519# CONFIG_MD_MULTIPATH is not set
512# CONFIG_MD_FAULTY is not set 520# CONFIG_MD_FAULTY is not set
513CONFIG_BLK_DEV_DM=m 521CONFIG_BLK_DEV_DM=m
514# CONFIG_DM_DEBUG is not set 522# CONFIG_DM_DEBUG is not set
@@ -517,13 +525,9 @@ CONFIG_DM_SNAPSHOT=m
517CONFIG_DM_MIRROR=m 525CONFIG_DM_MIRROR=m
518CONFIG_DM_ZERO=m 526CONFIG_DM_ZERO=m
519CONFIG_DM_MULTIPATH=m 527CONFIG_DM_MULTIPATH=m
520CONFIG_DM_MULTIPATH_EMC=m
521CONFIG_DM_MULTIPATH_RDAC=m
522CONFIG_DM_MULTIPATH_HP=m
523# CONFIG_DM_DELAY is not set 528# CONFIG_DM_DELAY is not set
524CONFIG_DM_UEVENT=y 529CONFIG_DM_UEVENT=y
525CONFIG_NETDEVICES=y 530CONFIG_NETDEVICES=y
526# CONFIG_NETDEVICES_MULTIQUEUE is not set
527CONFIG_DUMMY=m 531CONFIG_DUMMY=m
528# CONFIG_BONDING is not set 532# CONFIG_BONDING is not set
529CONFIG_MACVLAN=m 533CONFIG_MACVLAN=m
@@ -636,6 +640,7 @@ CONFIG_SERIO_LIBPS2=m
636# Character devices 640# Character devices
637# 641#
638CONFIG_VT=y 642CONFIG_VT=y
643CONFIG_CONSOLE_TRANSLATIONS=y
639CONFIG_VT_CONSOLE=y 644CONFIG_VT_CONSOLE=y
640CONFIG_HW_CONSOLE=y 645CONFIG_HW_CONSOLE=y
641CONFIG_VT_HW_CONSOLE_BINDING=y 646CONFIG_VT_HW_CONSOLE_BINDING=y
@@ -666,6 +671,7 @@ CONFIG_GEN_RTC_X=y
666# CONFIG_POWER_SUPPLY is not set 671# CONFIG_POWER_SUPPLY is not set
667# CONFIG_HWMON is not set 672# CONFIG_HWMON is not set
668# CONFIG_THERMAL is not set 673# CONFIG_THERMAL is not set
674# CONFIG_THERMAL_HWMON is not set
669# CONFIG_WATCHDOG is not set 675# CONFIG_WATCHDOG is not set
670 676
671# 677#
@@ -677,8 +683,10 @@ CONFIG_SSB_POSSIBLE=y
677# 683#
678# Multifunction device drivers 684# Multifunction device drivers
679# 685#
686# CONFIG_MFD_CORE is not set
680# CONFIG_MFD_SM501 is not set 687# CONFIG_MFD_SM501 is not set
681# CONFIG_HTC_PASIC3 is not set 688# CONFIG_HTC_PASIC3 is not set
689# CONFIG_MFD_TMIO is not set
682 690
683# 691#
684# Multimedia devices 692# Multimedia devices
@@ -747,10 +755,6 @@ CONFIG_LOGO=y
747# CONFIG_LOGO_LINUX_MONO is not set 755# CONFIG_LOGO_LINUX_MONO is not set
748# CONFIG_LOGO_LINUX_VGA16 is not set 756# CONFIG_LOGO_LINUX_VGA16 is not set
749CONFIG_LOGO_LINUX_CLUT224=y 757CONFIG_LOGO_LINUX_CLUT224=y
750
751#
752# Sound
753#
754# CONFIG_SOUND is not set 758# CONFIG_SOUND is not set
755CONFIG_HID_SUPPORT=y 759CONFIG_HID_SUPPORT=y
756CONFIG_HID=m 760CONFIG_HID=m
@@ -762,6 +766,7 @@ CONFIG_HIDRAW=y
762# CONFIG_NEW_LEDS is not set 766# CONFIG_NEW_LEDS is not set
763# CONFIG_ACCESSIBILITY is not set 767# CONFIG_ACCESSIBILITY is not set
764# CONFIG_RTC_CLASS is not set 768# CONFIG_RTC_CLASS is not set
769# CONFIG_DMADEVICES is not set
765# CONFIG_UIO is not set 770# CONFIG_UIO is not set
766 771
767# 772#
@@ -796,6 +801,7 @@ CONFIG_XFS_FS=m
796CONFIG_OCFS2_FS=m 801CONFIG_OCFS2_FS=m
797CONFIG_OCFS2_FS_O2CB=m 802CONFIG_OCFS2_FS_O2CB=m
798CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m 803CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
804# CONFIG_OCFS2_FS_STATS is not set
799# CONFIG_OCFS2_DEBUG_MASKLOG is not set 805# CONFIG_OCFS2_DEBUG_MASKLOG is not set
800# CONFIG_OCFS2_DEBUG_FS is not set 806# CONFIG_OCFS2_DEBUG_FS is not set
801CONFIG_DNOTIFY=y 807CONFIG_DNOTIFY=y
@@ -855,6 +861,7 @@ CONFIG_HFSPLUS_FS=m
855CONFIG_CRAMFS=m 861CONFIG_CRAMFS=m
856# CONFIG_VXFS_FS is not set 862# CONFIG_VXFS_FS is not set
857CONFIG_MINIX_FS=y 863CONFIG_MINIX_FS=y
864# CONFIG_OMFS_FS is not set
858CONFIG_HPFS_FS=m 865CONFIG_HPFS_FS=m
859# CONFIG_QNX4FS_FS is not set 866# CONFIG_QNX4FS_FS is not set
860# CONFIG_ROMFS_FS is not set 867# CONFIG_ROMFS_FS is not set
@@ -867,18 +874,17 @@ CONFIG_NFS_FS=y
867CONFIG_NFS_V3=y 874CONFIG_NFS_V3=y
868# CONFIG_NFS_V3_ACL is not set 875# CONFIG_NFS_V3_ACL is not set
869CONFIG_NFS_V4=y 876CONFIG_NFS_V4=y
877CONFIG_ROOT_NFS=y
870CONFIG_NFSD=m 878CONFIG_NFSD=m
871CONFIG_NFSD_V3=y 879CONFIG_NFSD_V3=y
872# CONFIG_NFSD_V3_ACL is not set 880# CONFIG_NFSD_V3_ACL is not set
873# CONFIG_NFSD_V4 is not set 881# CONFIG_NFSD_V4 is not set
874CONFIG_ROOT_NFS=y
875CONFIG_LOCKD=y 882CONFIG_LOCKD=y
876CONFIG_LOCKD_V4=y 883CONFIG_LOCKD_V4=y
877CONFIG_EXPORTFS=m 884CONFIG_EXPORTFS=m
878CONFIG_NFS_COMMON=y 885CONFIG_NFS_COMMON=y
879CONFIG_SUNRPC=y 886CONFIG_SUNRPC=y
880CONFIG_SUNRPC_GSS=y 887CONFIG_SUNRPC_GSS=y
881CONFIG_SUNRPC_BIND34=y
882CONFIG_RPCSEC_GSS_KRB5=y 888CONFIG_RPCSEC_GSS_KRB5=y
883# CONFIG_RPCSEC_GSS_SPKM3 is not set 889# CONFIG_RPCSEC_GSS_SPKM3 is not set
884CONFIG_SMB_FS=m 890CONFIG_SMB_FS=m
@@ -887,7 +893,6 @@ CONFIG_SMB_NLS_REMOTE="cp437"
887# CONFIG_CIFS is not set 893# CONFIG_CIFS is not set
888# CONFIG_NCP_FS is not set 894# CONFIG_NCP_FS is not set
889CONFIG_CODA_FS=m 895CONFIG_CODA_FS=m
890# CONFIG_CODA_FS_OLD_API is not set
891# CONFIG_AFS_FS is not set 896# CONFIG_AFS_FS is not set
892 897
893# 898#
@@ -951,6 +956,8 @@ CONFIG_MAGIC_SYSRQ=y
951# CONFIG_HEADERS_CHECK is not set 956# CONFIG_HEADERS_CHECK is not set
952# CONFIG_DEBUG_KERNEL is not set 957# CONFIG_DEBUG_KERNEL is not set
953CONFIG_DEBUG_BUGVERBOSE=y 958CONFIG_DEBUG_BUGVERBOSE=y
959CONFIG_DEBUG_MEMORY_INIT=y
960CONFIG_SYSCTL_SYSCALL_CHECK=y
954# CONFIG_SAMPLES is not set 961# CONFIG_SAMPLES is not set
955 962
956# 963#
@@ -1010,6 +1017,10 @@ CONFIG_CRYPTO_CRC32C=m
1010CONFIG_CRYPTO_MD4=m 1017CONFIG_CRYPTO_MD4=m
1011CONFIG_CRYPTO_MD5=y 1018CONFIG_CRYPTO_MD5=y
1012CONFIG_CRYPTO_MICHAEL_MIC=m 1019CONFIG_CRYPTO_MICHAEL_MIC=m
1020CONFIG_CRYPTO_RMD128=m
1021CONFIG_CRYPTO_RMD160=m
1022CONFIG_CRYPTO_RMD256=m
1023CONFIG_CRYPTO_RMD320=m
1013CONFIG_CRYPTO_SHA1=m 1024CONFIG_CRYPTO_SHA1=m
1014CONFIG_CRYPTO_SHA256=m 1025CONFIG_CRYPTO_SHA256=m
1015CONFIG_CRYPTO_SHA512=m 1026CONFIG_CRYPTO_SHA512=m
@@ -1051,6 +1062,7 @@ CONFIG_BITREVERSE=y
1051# CONFIG_GENERIC_FIND_NEXT_BIT is not set 1062# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1052CONFIG_CRC_CCITT=m 1063CONFIG_CRC_CCITT=m
1053CONFIG_CRC16=m 1064CONFIG_CRC16=m
1065CONFIG_CRC_T10DIF=y
1054CONFIG_CRC_ITU_T=m 1066CONFIG_CRC_ITU_T=m
1055CONFIG_CRC32=y 1067CONFIG_CRC32=y
1056# CONFIG_CRC7 is not set 1068# CONFIG_CRC7 is not set
diff --git a/arch/m68k/configs/mac_defconfig b/arch/m68k/configs/mac_defconfig
index 7cd375740348..db6e8822594a 100644
--- a/arch/m68k/configs/mac_defconfig
+++ b/arch/m68k/configs/mac_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc4 3# Linux kernel version: 2.6.27-rc6
4# Wed May 28 22:47:35 2008 4# Wed Sep 10 09:02:06 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,7 +52,6 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
56CONFIG_KALLSYMS=y 55CONFIG_KALLSYMS=y
57# CONFIG_KALLSYMS_EXTRA_PASS is not set 56# CONFIG_KALLSYMS_EXTRA_PASS is not set
58CONFIG_HOTPLUG=y 57CONFIG_HOTPLUG=y
@@ -75,10 +74,16 @@ CONFIG_SLAB=y
75# CONFIG_PROFILING is not set 74# CONFIG_PROFILING is not set
76# CONFIG_MARKERS is not set 75# CONFIG_MARKERS is not set
77# CONFIG_HAVE_OPROFILE is not set 76# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
78# CONFIG_HAVE_IOREMAP_PROT is not set
78# CONFIG_HAVE_KPROBES is not set 79# CONFIG_HAVE_KPROBES is not set
79# CONFIG_HAVE_KRETPROBES is not set 80# CONFIG_HAVE_KRETPROBES is not set
81# CONFIG_HAVE_ARCH_TRACEHOOK is not set
80# CONFIG_HAVE_DMA_ATTRS is not set 82# CONFIG_HAVE_DMA_ATTRS is not set
83# CONFIG_USE_GENERIC_SMP_HELPERS is not set
84# CONFIG_HAVE_CLK is not set
81CONFIG_PROC_PAGE_MONITOR=y 85CONFIG_PROC_PAGE_MONITOR=y
86# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
82CONFIG_SLABINFO=y 87CONFIG_SLABINFO=y
83CONFIG_RT_MUTEXES=y 88CONFIG_RT_MUTEXES=y
84# CONFIG_TINY_SHMEM is not set 89# CONFIG_TINY_SHMEM is not set
@@ -95,6 +100,7 @@ CONFIG_BLOCK=y
95# CONFIG_BLK_DEV_IO_TRACE is not set 100# CONFIG_BLK_DEV_IO_TRACE is not set
96# CONFIG_LSF is not set 101# CONFIG_LSF is not set
97CONFIG_BLK_DEV_BSG=y 102CONFIG_BLK_DEV_BSG=y
103# CONFIG_BLK_DEV_INTEGRITY is not set
98 104
99# 105#
100# IO Schedulers 106# IO Schedulers
@@ -163,10 +169,6 @@ CONFIG_BINFMT_MISC=m
163CONFIG_PROC_HARDWARE=y 169CONFIG_PROC_HARDWARE=y
164CONFIG_ZONE_DMA=y 170CONFIG_ZONE_DMA=y
165# CONFIG_ARCH_SUPPORTS_MSI is not set 171# CONFIG_ARCH_SUPPORTS_MSI is not set
166
167#
168# Networking
169#
170CONFIG_NET=y 172CONFIG_NET=y
171 173
172# 174#
@@ -180,6 +182,7 @@ CONFIG_XFRM=y
180# CONFIG_XFRM_SUB_POLICY is not set 182# CONFIG_XFRM_SUB_POLICY is not set
181CONFIG_XFRM_MIGRATE=y 183CONFIG_XFRM_MIGRATE=y
182# CONFIG_XFRM_STATISTICS is not set 184# CONFIG_XFRM_STATISTICS is not set
185CONFIG_XFRM_IPCOMP=m
183CONFIG_NET_KEY=y 186CONFIG_NET_KEY=y
184CONFIG_NET_KEY_MIGRATE=y 187CONFIG_NET_KEY_MIGRATE=y
185CONFIG_INET=y 188CONFIG_INET=y
@@ -413,6 +416,7 @@ CONFIG_NET_CLS_ROUTE=y
413# 416#
414# CONFIG_CFG80211 is not set 417# CONFIG_CFG80211 is not set
415CONFIG_WIRELESS_EXT=y 418CONFIG_WIRELESS_EXT=y
419# CONFIG_WIRELESS_EXT_SYSFS is not set
416# CONFIG_MAC80211 is not set 420# CONFIG_MAC80211 is not set
417CONFIG_IEEE80211=m 421CONFIG_IEEE80211=m
418# CONFIG_IEEE80211_DEBUG is not set 422# CONFIG_IEEE80211_DEBUG is not set
@@ -432,7 +436,9 @@ CONFIG_IEEE80211_CRYPT_TKIP=m
432CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 436CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
433CONFIG_STANDALONE=y 437CONFIG_STANDALONE=y
434CONFIG_PREVENT_FIRMWARE_BUILD=y 438CONFIG_PREVENT_FIRMWARE_BUILD=y
435CONFIG_FW_LOADER=m 439CONFIG_FW_LOADER=y
440# CONFIG_FIRMWARE_IN_KERNEL is not set
441CONFIG_EXTRA_FIRMWARE=""
436# CONFIG_SYS_HYPERVISOR is not set 442# CONFIG_SYS_HYPERVISOR is not set
437CONFIG_CONNECTOR=m 443CONFIG_CONNECTOR=m
438# CONFIG_MTD is not set 444# CONFIG_MTD is not set
@@ -450,6 +456,7 @@ CONFIG_CDROM_PKTCDVD=m
450CONFIG_CDROM_PKTCDVD_BUFFERS=8 456CONFIG_CDROM_PKTCDVD_BUFFERS=8
451# CONFIG_CDROM_PKTCDVD_WCACHE is not set 457# CONFIG_CDROM_PKTCDVD_WCACHE is not set
452CONFIG_ATA_OVER_ETH=m 458CONFIG_ATA_OVER_ETH=m
459# CONFIG_BLK_DEV_HD is not set
453CONFIG_MISC_DEVICES=y 460CONFIG_MISC_DEVICES=y
454# CONFIG_EEPROM_93CX6 is not set 461# CONFIG_EEPROM_93CX6 is not set
455# CONFIG_ENCLOSURE_SERVICES is not set 462# CONFIG_ENCLOSURE_SERVICES is not set
@@ -460,6 +467,7 @@ CONFIG_BLK_DEV_IDE=y
460# 467#
461# Please see Documentation/ide/ide.txt for help/info on IDE drives 468# Please see Documentation/ide/ide.txt for help/info on IDE drives
462# 469#
470CONFIG_IDE_ATAPI=y
463# CONFIG_BLK_DEV_IDE_SATA is not set 471# CONFIG_BLK_DEV_IDE_SATA is not set
464CONFIG_BLK_DEV_IDEDISK=y 472CONFIG_BLK_DEV_IDEDISK=y
465# CONFIG_IDEDISK_MULTI_MODE is not set 473# CONFIG_IDEDISK_MULTI_MODE is not set
@@ -477,8 +485,6 @@ CONFIG_IDE_PROC_FS=y
477# CONFIG_BLK_DEV_PLATFORM is not set 485# CONFIG_BLK_DEV_PLATFORM is not set
478CONFIG_BLK_DEV_MAC_IDE=y 486CONFIG_BLK_DEV_MAC_IDE=y
479# CONFIG_BLK_DEV_IDEDMA is not set 487# CONFIG_BLK_DEV_IDEDMA is not set
480# CONFIG_BLK_DEV_HD_ONLY is not set
481# CONFIG_BLK_DEV_HD is not set
482 488
483# 489#
484# SCSI device support 490# SCSI device support
@@ -527,6 +533,7 @@ CONFIG_ISCSI_TCP=m
527# CONFIG_SCSI_DEBUG is not set 533# CONFIG_SCSI_DEBUG is not set
528CONFIG_MAC_SCSI=y 534CONFIG_MAC_SCSI=y
529CONFIG_SCSI_MAC_ESP=y 535CONFIG_SCSI_MAC_ESP=y
536# CONFIG_SCSI_DH is not set
530CONFIG_MD=y 537CONFIG_MD=y
531CONFIG_BLK_DEV_MD=m 538CONFIG_BLK_DEV_MD=m
532CONFIG_MD_LINEAR=m 539CONFIG_MD_LINEAR=m
@@ -535,7 +542,7 @@ CONFIG_MD_RAID1=m
535# CONFIG_MD_RAID10 is not set 542# CONFIG_MD_RAID10 is not set
536CONFIG_MD_RAID456=m 543CONFIG_MD_RAID456=m
537CONFIG_MD_RAID5_RESHAPE=y 544CONFIG_MD_RAID5_RESHAPE=y
538CONFIG_MD_MULTIPATH=m 545# CONFIG_MD_MULTIPATH is not set
539# CONFIG_MD_FAULTY is not set 546# CONFIG_MD_FAULTY is not set
540CONFIG_BLK_DEV_DM=m 547CONFIG_BLK_DEV_DM=m
541# CONFIG_DM_DEBUG is not set 548# CONFIG_DM_DEBUG is not set
@@ -544,9 +551,6 @@ CONFIG_DM_SNAPSHOT=m
544CONFIG_DM_MIRROR=m 551CONFIG_DM_MIRROR=m
545CONFIG_DM_ZERO=m 552CONFIG_DM_ZERO=m
546CONFIG_DM_MULTIPATH=m 553CONFIG_DM_MULTIPATH=m
547CONFIG_DM_MULTIPATH_EMC=m
548CONFIG_DM_MULTIPATH_RDAC=m
549CONFIG_DM_MULTIPATH_HP=m
550# CONFIG_DM_DELAY is not set 554# CONFIG_DM_DELAY is not set
551CONFIG_DM_UEVENT=y 555CONFIG_DM_UEVENT=y
552CONFIG_MACINTOSH_DRIVERS=y 556CONFIG_MACINTOSH_DRIVERS=y
@@ -559,7 +563,6 @@ CONFIG_ADB_CUDA=y
559CONFIG_INPUT_ADBHID=y 563CONFIG_INPUT_ADBHID=y
560CONFIG_MAC_EMUMOUSEBTN=y 564CONFIG_MAC_EMUMOUSEBTN=y
561CONFIG_NETDEVICES=y 565CONFIG_NETDEVICES=y
562# CONFIG_NETDEVICES_MULTIQUEUE is not set
563CONFIG_DUMMY=m 566CONFIG_DUMMY=m
564# CONFIG_BONDING is not set 567# CONFIG_BONDING is not set
565CONFIG_MACVLAN=m 568CONFIG_MACVLAN=m
@@ -670,6 +673,7 @@ CONFIG_SERIO_LIBPS2=m
670# Character devices 673# Character devices
671# 674#
672CONFIG_VT=y 675CONFIG_VT=y
676CONFIG_CONSOLE_TRANSLATIONS=y
673CONFIG_VT_CONSOLE=y 677CONFIG_VT_CONSOLE=y
674CONFIG_HW_CONSOLE=y 678CONFIG_HW_CONSOLE=y
675CONFIG_VT_HW_CONSOLE_BINDING=y 679CONFIG_VT_HW_CONSOLE_BINDING=y
@@ -700,6 +704,7 @@ CONFIG_GEN_RTC_X=y
700# CONFIG_POWER_SUPPLY is not set 704# CONFIG_POWER_SUPPLY is not set
701# CONFIG_HWMON is not set 705# CONFIG_HWMON is not set
702# CONFIG_THERMAL is not set 706# CONFIG_THERMAL is not set
707# CONFIG_THERMAL_HWMON is not set
703# CONFIG_WATCHDOG is not set 708# CONFIG_WATCHDOG is not set
704 709
705# 710#
@@ -711,8 +716,10 @@ CONFIG_SSB_POSSIBLE=y
711# 716#
712# Multifunction device drivers 717# Multifunction device drivers
713# 718#
719# CONFIG_MFD_CORE is not set
714# CONFIG_MFD_SM501 is not set 720# CONFIG_MFD_SM501 is not set
715# CONFIG_HTC_PASIC3 is not set 721# CONFIG_HTC_PASIC3 is not set
722# CONFIG_MFD_TMIO is not set
716 723
717# 724#
718# Multimedia devices 725# Multimedia devices
@@ -784,10 +791,6 @@ CONFIG_LOGO_LINUX_MONO=y
784CONFIG_LOGO_LINUX_VGA16=y 791CONFIG_LOGO_LINUX_VGA16=y
785CONFIG_LOGO_LINUX_CLUT224=y 792CONFIG_LOGO_LINUX_CLUT224=y
786CONFIG_LOGO_MAC_CLUT224=y 793CONFIG_LOGO_MAC_CLUT224=y
787
788#
789# Sound
790#
791# CONFIG_SOUND is not set 794# CONFIG_SOUND is not set
792CONFIG_HID_SUPPORT=y 795CONFIG_HID_SUPPORT=y
793CONFIG_HID=m 796CONFIG_HID=m
@@ -799,6 +802,7 @@ CONFIG_HIDRAW=y
799# CONFIG_NEW_LEDS is not set 802# CONFIG_NEW_LEDS is not set
800# CONFIG_ACCESSIBILITY is not set 803# CONFIG_ACCESSIBILITY is not set
801# CONFIG_RTC_CLASS is not set 804# CONFIG_RTC_CLASS is not set
805# CONFIG_DMADEVICES is not set
802# CONFIG_UIO is not set 806# CONFIG_UIO is not set
803 807
804# 808#
@@ -836,6 +840,7 @@ CONFIG_XFS_FS=m
836CONFIG_OCFS2_FS=m 840CONFIG_OCFS2_FS=m
837CONFIG_OCFS2_FS_O2CB=m 841CONFIG_OCFS2_FS_O2CB=m
838CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m 842CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
843# CONFIG_OCFS2_FS_STATS is not set
839# CONFIG_OCFS2_DEBUG_MASKLOG is not set 844# CONFIG_OCFS2_DEBUG_MASKLOG is not set
840# CONFIG_OCFS2_DEBUG_FS is not set 845# CONFIG_OCFS2_DEBUG_FS is not set
841CONFIG_DNOTIFY=y 846CONFIG_DNOTIFY=y
@@ -895,6 +900,7 @@ CONFIG_HFSPLUS_FS=y
895CONFIG_CRAMFS=m 900CONFIG_CRAMFS=m
896# CONFIG_VXFS_FS is not set 901# CONFIG_VXFS_FS is not set
897CONFIG_MINIX_FS=y 902CONFIG_MINIX_FS=y
903# CONFIG_OMFS_FS is not set
898CONFIG_HPFS_FS=m 904CONFIG_HPFS_FS=m
899# CONFIG_QNX4FS_FS is not set 905# CONFIG_QNX4FS_FS is not set
900# CONFIG_ROMFS_FS is not set 906# CONFIG_ROMFS_FS is not set
@@ -917,7 +923,6 @@ CONFIG_EXPORTFS=m
917CONFIG_NFS_COMMON=y 923CONFIG_NFS_COMMON=y
918CONFIG_SUNRPC=m 924CONFIG_SUNRPC=m
919CONFIG_SUNRPC_GSS=m 925CONFIG_SUNRPC_GSS=m
920CONFIG_SUNRPC_BIND34=y
921CONFIG_RPCSEC_GSS_KRB5=m 926CONFIG_RPCSEC_GSS_KRB5=m
922# CONFIG_RPCSEC_GSS_SPKM3 is not set 927# CONFIG_RPCSEC_GSS_SPKM3 is not set
923CONFIG_SMB_FS=m 928CONFIG_SMB_FS=m
@@ -926,7 +931,6 @@ CONFIG_SMB_NLS_REMOTE="cp437"
926# CONFIG_CIFS is not set 931# CONFIG_CIFS is not set
927# CONFIG_NCP_FS is not set 932# CONFIG_NCP_FS is not set
928CONFIG_CODA_FS=m 933CONFIG_CODA_FS=m
929# CONFIG_CODA_FS_OLD_API is not set
930# CONFIG_AFS_FS is not set 934# CONFIG_AFS_FS is not set
931 935
932# 936#
@@ -991,6 +995,8 @@ CONFIG_MAGIC_SYSRQ=y
991# CONFIG_HEADERS_CHECK is not set 995# CONFIG_HEADERS_CHECK is not set
992# CONFIG_DEBUG_KERNEL is not set 996# CONFIG_DEBUG_KERNEL is not set
993CONFIG_DEBUG_BUGVERBOSE=y 997CONFIG_DEBUG_BUGVERBOSE=y
998CONFIG_DEBUG_MEMORY_INIT=y
999CONFIG_SYSCTL_SYSCALL_CHECK=y
994# CONFIG_SAMPLES is not set 1000# CONFIG_SAMPLES is not set
995 1001
996# 1002#
@@ -1050,6 +1056,10 @@ CONFIG_CRYPTO_CRC32C=m
1050CONFIG_CRYPTO_MD4=m 1056CONFIG_CRYPTO_MD4=m
1051CONFIG_CRYPTO_MD5=m 1057CONFIG_CRYPTO_MD5=m
1052CONFIG_CRYPTO_MICHAEL_MIC=m 1058CONFIG_CRYPTO_MICHAEL_MIC=m
1059CONFIG_CRYPTO_RMD128=m
1060CONFIG_CRYPTO_RMD160=m
1061CONFIG_CRYPTO_RMD256=m
1062CONFIG_CRYPTO_RMD320=m
1053CONFIG_CRYPTO_SHA1=m 1063CONFIG_CRYPTO_SHA1=m
1054CONFIG_CRYPTO_SHA256=m 1064CONFIG_CRYPTO_SHA256=m
1055CONFIG_CRYPTO_SHA512=m 1065CONFIG_CRYPTO_SHA512=m
@@ -1091,6 +1101,7 @@ CONFIG_BITREVERSE=y
1091# CONFIG_GENERIC_FIND_NEXT_BIT is not set 1101# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1092CONFIG_CRC_CCITT=m 1102CONFIG_CRC_CCITT=m
1093CONFIG_CRC16=m 1103CONFIG_CRC16=m
1104CONFIG_CRC_T10DIF=y
1094CONFIG_CRC_ITU_T=m 1105CONFIG_CRC_ITU_T=m
1095CONFIG_CRC32=y 1106CONFIG_CRC32=y
1096# CONFIG_CRC7 is not set 1107# CONFIG_CRC7 is not set
diff --git a/arch/m68k/configs/multi_defconfig b/arch/m68k/configs/multi_defconfig
index 0747fa3984df..1a806102b999 100644
--- a/arch/m68k/configs/multi_defconfig
+++ b/arch/m68k/configs/multi_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc4 3# Linux kernel version: 2.6.27-rc6
4# Wed May 28 22:47:35 2008 4# Wed Sep 10 09:02:07 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,7 +52,6 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
56CONFIG_KALLSYMS=y 55CONFIG_KALLSYMS=y
57# CONFIG_KALLSYMS_EXTRA_PASS is not set 56# CONFIG_KALLSYMS_EXTRA_PASS is not set
58CONFIG_HOTPLUG=y 57CONFIG_HOTPLUG=y
@@ -75,10 +74,16 @@ CONFIG_SLAB=y
75# CONFIG_PROFILING is not set 74# CONFIG_PROFILING is not set
76# CONFIG_MARKERS is not set 75# CONFIG_MARKERS is not set
77# CONFIG_HAVE_OPROFILE is not set 76# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
78# CONFIG_HAVE_IOREMAP_PROT is not set
78# CONFIG_HAVE_KPROBES is not set 79# CONFIG_HAVE_KPROBES is not set
79# CONFIG_HAVE_KRETPROBES is not set 80# CONFIG_HAVE_KRETPROBES is not set
81# CONFIG_HAVE_ARCH_TRACEHOOK is not set
80# CONFIG_HAVE_DMA_ATTRS is not set 82# CONFIG_HAVE_DMA_ATTRS is not set
83# CONFIG_USE_GENERIC_SMP_HELPERS is not set
84# CONFIG_HAVE_CLK is not set
81CONFIG_PROC_PAGE_MONITOR=y 85CONFIG_PROC_PAGE_MONITOR=y
86# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
82CONFIG_SLABINFO=y 87CONFIG_SLABINFO=y
83CONFIG_RT_MUTEXES=y 88CONFIG_RT_MUTEXES=y
84# CONFIG_TINY_SHMEM is not set 89# CONFIG_TINY_SHMEM is not set
@@ -95,6 +100,7 @@ CONFIG_BLOCK=y
95# CONFIG_BLK_DEV_IO_TRACE is not set 100# CONFIG_BLK_DEV_IO_TRACE is not set
96# CONFIG_LSF is not set 101# CONFIG_LSF is not set
97CONFIG_BLK_DEV_BSG=y 102CONFIG_BLK_DEV_BSG=y
103# CONFIG_BLK_DEV_INTEGRITY is not set
98 104
99# 105#
100# IO Schedulers 106# IO Schedulers
@@ -173,10 +179,6 @@ CONFIG_GENERIC_ISA_DMA=y
173CONFIG_ZONE_DMA=y 179CONFIG_ZONE_DMA=y
174# CONFIG_ARCH_SUPPORTS_MSI is not set 180# CONFIG_ARCH_SUPPORTS_MSI is not set
175CONFIG_ZORRO_NAMES=y 181CONFIG_ZORRO_NAMES=y
176
177#
178# Networking
179#
180CONFIG_NET=y 182CONFIG_NET=y
181 183
182# 184#
@@ -190,6 +192,7 @@ CONFIG_XFRM=y
190# CONFIG_XFRM_SUB_POLICY is not set 192# CONFIG_XFRM_SUB_POLICY is not set
191CONFIG_XFRM_MIGRATE=y 193CONFIG_XFRM_MIGRATE=y
192# CONFIG_XFRM_STATISTICS is not set 194# CONFIG_XFRM_STATISTICS is not set
195CONFIG_XFRM_IPCOMP=m
193CONFIG_NET_KEY=y 196CONFIG_NET_KEY=y
194CONFIG_NET_KEY_MIGRATE=y 197CONFIG_NET_KEY_MIGRATE=y
195CONFIG_INET=y 198CONFIG_INET=y
@@ -427,6 +430,7 @@ CONFIG_NET_CLS_ROUTE=y
427# 430#
428# CONFIG_CFG80211 is not set 431# CONFIG_CFG80211 is not set
429CONFIG_WIRELESS_EXT=y 432CONFIG_WIRELESS_EXT=y
433# CONFIG_WIRELESS_EXT_SYSFS is not set
430# CONFIG_MAC80211 is not set 434# CONFIG_MAC80211 is not set
431CONFIG_IEEE80211=m 435CONFIG_IEEE80211=m
432# CONFIG_IEEE80211_DEBUG is not set 436# CONFIG_IEEE80211_DEBUG is not set
@@ -446,7 +450,9 @@ CONFIG_IEEE80211_CRYPT_TKIP=m
446CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 450CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
447CONFIG_STANDALONE=y 451CONFIG_STANDALONE=y
448CONFIG_PREVENT_FIRMWARE_BUILD=y 452CONFIG_PREVENT_FIRMWARE_BUILD=y
449CONFIG_FW_LOADER=m 453CONFIG_FW_LOADER=y
454# CONFIG_FIRMWARE_IN_KERNEL is not set
455CONFIG_EXTRA_FIRMWARE=""
450# CONFIG_SYS_HYPERVISOR is not set 456# CONFIG_SYS_HYPERVISOR is not set
451CONFIG_CONNECTOR=m 457CONFIG_CONNECTOR=m
452# CONFIG_MTD is not set 458# CONFIG_MTD is not set
@@ -476,6 +482,7 @@ CONFIG_CDROM_PKTCDVD=m
476CONFIG_CDROM_PKTCDVD_BUFFERS=8 482CONFIG_CDROM_PKTCDVD_BUFFERS=8
477# CONFIG_CDROM_PKTCDVD_WCACHE is not set 483# CONFIG_CDROM_PKTCDVD_WCACHE is not set
478CONFIG_ATA_OVER_ETH=m 484CONFIG_ATA_OVER_ETH=m
485# CONFIG_BLK_DEV_HD is not set
479CONFIG_MISC_DEVICES=y 486CONFIG_MISC_DEVICES=y
480# CONFIG_EEPROM_93CX6 is not set 487# CONFIG_EEPROM_93CX6 is not set
481# CONFIG_ENCLOSURE_SERVICES is not set 488# CONFIG_ENCLOSURE_SERVICES is not set
@@ -486,6 +493,7 @@ CONFIG_BLK_DEV_IDE=y
486# 493#
487# Please see Documentation/ide/ide.txt for help/info on IDE drives 494# Please see Documentation/ide/ide.txt for help/info on IDE drives
488# 495#
496CONFIG_IDE_ATAPI=y
489# CONFIG_BLK_DEV_IDE_SATA is not set 497# CONFIG_BLK_DEV_IDE_SATA is not set
490CONFIG_BLK_DEV_IDEDISK=y 498CONFIG_BLK_DEV_IDEDISK=y
491# CONFIG_IDEDISK_MULTI_MODE is not set 499# CONFIG_IDEDISK_MULTI_MODE is not set
@@ -508,8 +516,6 @@ CONFIG_BLK_DEV_FALCON_IDE=y
508CONFIG_BLK_DEV_MAC_IDE=y 516CONFIG_BLK_DEV_MAC_IDE=y
509CONFIG_BLK_DEV_Q40IDE=y 517CONFIG_BLK_DEV_Q40IDE=y
510# CONFIG_BLK_DEV_IDEDMA is not set 518# CONFIG_BLK_DEV_IDEDMA is not set
511# CONFIG_BLK_DEV_HD_ONLY is not set
512# CONFIG_BLK_DEV_HD is not set
513 519
514# 520#
515# SCSI device support 521# SCSI device support
@@ -584,6 +590,7 @@ CONFIG_MVME147_SCSI=y
584CONFIG_MVME16x_SCSI=y 590CONFIG_MVME16x_SCSI=y
585CONFIG_BVME6000_SCSI=y 591CONFIG_BVME6000_SCSI=y
586CONFIG_SUN3X_ESP=y 592CONFIG_SUN3X_ESP=y
593# CONFIG_SCSI_DH is not set
587CONFIG_MD=y 594CONFIG_MD=y
588CONFIG_BLK_DEV_MD=m 595CONFIG_BLK_DEV_MD=m
589CONFIG_MD_LINEAR=m 596CONFIG_MD_LINEAR=m
@@ -592,7 +599,7 @@ CONFIG_MD_RAID1=m
592# CONFIG_MD_RAID10 is not set 599# CONFIG_MD_RAID10 is not set
593CONFIG_MD_RAID456=m 600CONFIG_MD_RAID456=m
594CONFIG_MD_RAID5_RESHAPE=y 601CONFIG_MD_RAID5_RESHAPE=y
595CONFIG_MD_MULTIPATH=m 602# CONFIG_MD_MULTIPATH is not set
596# CONFIG_MD_FAULTY is not set 603# CONFIG_MD_FAULTY is not set
597CONFIG_BLK_DEV_DM=m 604CONFIG_BLK_DEV_DM=m
598# CONFIG_DM_DEBUG is not set 605# CONFIG_DM_DEBUG is not set
@@ -601,9 +608,6 @@ CONFIG_DM_SNAPSHOT=m
601CONFIG_DM_MIRROR=m 608CONFIG_DM_MIRROR=m
602CONFIG_DM_ZERO=m 609CONFIG_DM_ZERO=m
603CONFIG_DM_MULTIPATH=m 610CONFIG_DM_MULTIPATH=m
604CONFIG_DM_MULTIPATH_EMC=m
605CONFIG_DM_MULTIPATH_RDAC=m
606CONFIG_DM_MULTIPATH_HP=m
607# CONFIG_DM_DELAY is not set 611# CONFIG_DM_DELAY is not set
608CONFIG_DM_UEVENT=y 612CONFIG_DM_UEVENT=y
609CONFIG_MACINTOSH_DRIVERS=y 613CONFIG_MACINTOSH_DRIVERS=y
@@ -616,7 +620,6 @@ CONFIG_ADB_CUDA=y
616CONFIG_INPUT_ADBHID=y 620CONFIG_INPUT_ADBHID=y
617CONFIG_MAC_EMUMOUSEBTN=y 621CONFIG_MAC_EMUMOUSEBTN=y
618CONFIG_NETDEVICES=y 622CONFIG_NETDEVICES=y
619# CONFIG_NETDEVICES_MULTIQUEUE is not set
620CONFIG_DUMMY=m 623CONFIG_DUMMY=m
621# CONFIG_BONDING is not set 624# CONFIG_BONDING is not set
622CONFIG_MACVLAN=m 625CONFIG_MACVLAN=m
@@ -632,7 +635,6 @@ CONFIG_A2065=m
632CONFIG_HYDRA=m 635CONFIG_HYDRA=m
633CONFIG_ZORRO8390=m 636CONFIG_ZORRO8390=m
634CONFIG_APNE=m 637CONFIG_APNE=m
635CONFIG_APOLLO_ELPLUS=y
636CONFIG_MAC8390=y 638CONFIG_MAC8390=y
637CONFIG_MAC89x0=m 639CONFIG_MAC89x0=m
638CONFIG_MACSONIC=m 640CONFIG_MACSONIC=m
@@ -791,6 +793,7 @@ CONFIG_SERIO_LIBPS2=y
791# Character devices 793# Character devices
792# 794#
793CONFIG_VT=y 795CONFIG_VT=y
796CONFIG_CONSOLE_TRANSLATIONS=y
794CONFIG_VT_CONSOLE=y 797CONFIG_VT_CONSOLE=y
795CONFIG_HW_CONSOLE=y 798CONFIG_HW_CONSOLE=y
796CONFIG_VT_HW_CONSOLE_BINDING=y 799CONFIG_VT_HW_CONSOLE_BINDING=y
@@ -827,6 +830,7 @@ CONFIG_GEN_RTC_X=y
827# CONFIG_POWER_SUPPLY is not set 830# CONFIG_POWER_SUPPLY is not set
828# CONFIG_HWMON is not set 831# CONFIG_HWMON is not set
829# CONFIG_THERMAL is not set 832# CONFIG_THERMAL is not set
833# CONFIG_THERMAL_HWMON is not set
830# CONFIG_WATCHDOG is not set 834# CONFIG_WATCHDOG is not set
831 835
832# 836#
@@ -838,8 +842,10 @@ CONFIG_SSB_POSSIBLE=y
838# 842#
839# Multifunction device drivers 843# Multifunction device drivers
840# 844#
845# CONFIG_MFD_CORE is not set
841# CONFIG_MFD_SM501 is not set 846# CONFIG_MFD_SM501 is not set
842# CONFIG_HTC_PASIC3 is not set 847# CONFIG_HTC_PASIC3 is not set
848# CONFIG_MFD_TMIO is not set
843 849
844# 850#
845# Multimedia devices 851# Multimedia devices
@@ -923,10 +929,6 @@ CONFIG_LOGO_LINUX_MONO=y
923CONFIG_LOGO_LINUX_VGA16=y 929CONFIG_LOGO_LINUX_VGA16=y
924CONFIG_LOGO_LINUX_CLUT224=y 930CONFIG_LOGO_LINUX_CLUT224=y
925CONFIG_LOGO_MAC_CLUT224=y 931CONFIG_LOGO_MAC_CLUT224=y
926
927#
928# Sound
929#
930CONFIG_SOUND=m 932CONFIG_SOUND=m
931CONFIG_DMASOUND_ATARI=m 933CONFIG_DMASOUND_ATARI=m
932CONFIG_DMASOUND_PAULA=m 934CONFIG_DMASOUND_PAULA=m
@@ -942,6 +944,7 @@ CONFIG_HIDRAW=y
942# CONFIG_NEW_LEDS is not set 944# CONFIG_NEW_LEDS is not set
943# CONFIG_ACCESSIBILITY is not set 945# CONFIG_ACCESSIBILITY is not set
944# CONFIG_RTC_CLASS is not set 946# CONFIG_RTC_CLASS is not set
947# CONFIG_DMADEVICES is not set
945# CONFIG_AUXDISPLAY is not set 948# CONFIG_AUXDISPLAY is not set
946# CONFIG_UIO is not set 949# CONFIG_UIO is not set
947 950
@@ -949,8 +952,6 @@ CONFIG_HIDRAW=y
949# Character devices 952# Character devices
950# 953#
951CONFIG_ATARI_MFPSER=m 954CONFIG_ATARI_MFPSER=m
952CONFIG_ATARI_SCC=y
953CONFIG_ATARI_SCC_DMA=y
954CONFIG_ATARI_MIDI=m 955CONFIG_ATARI_MIDI=m
955CONFIG_ATARI_DSP56K=m 956CONFIG_ATARI_DSP56K=m
956CONFIG_AMIGA_BUILTIN_SERIAL=y 957CONFIG_AMIGA_BUILTIN_SERIAL=y
@@ -972,8 +973,10 @@ CONFIG_EXT2_FS=y
972# CONFIG_EXT2_FS_XIP is not set 973# CONFIG_EXT2_FS_XIP is not set
973CONFIG_EXT3_FS=y 974CONFIG_EXT3_FS=y
974# CONFIG_EXT3_FS_XATTR is not set 975# CONFIG_EXT3_FS_XATTR is not set
975# CONFIG_EXT4DEV_FS is not set 976CONFIG_EXT4DEV_FS=y
977# CONFIG_EXT4DEV_FS_XATTR is not set
976CONFIG_JBD=y 978CONFIG_JBD=y
979CONFIG_JBD2=y
977CONFIG_REISERFS_FS=m 980CONFIG_REISERFS_FS=m
978# CONFIG_REISERFS_CHECK is not set 981# CONFIG_REISERFS_CHECK is not set
979# CONFIG_REISERFS_PROC_INFO is not set 982# CONFIG_REISERFS_PROC_INFO is not set
@@ -992,6 +995,7 @@ CONFIG_XFS_FS=m
992CONFIG_OCFS2_FS=m 995CONFIG_OCFS2_FS=m
993CONFIG_OCFS2_FS_O2CB=m 996CONFIG_OCFS2_FS_O2CB=m
994CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m 997CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
998# CONFIG_OCFS2_FS_STATS is not set
995# CONFIG_OCFS2_DEBUG_MASKLOG is not set 999# CONFIG_OCFS2_DEBUG_MASKLOG is not set
996# CONFIG_OCFS2_DEBUG_FS is not set 1000# CONFIG_OCFS2_DEBUG_FS is not set
997CONFIG_DNOTIFY=y 1001CONFIG_DNOTIFY=y
@@ -1051,6 +1055,7 @@ CONFIG_HFSPLUS_FS=y
1051CONFIG_CRAMFS=m 1055CONFIG_CRAMFS=m
1052# CONFIG_VXFS_FS is not set 1056# CONFIG_VXFS_FS is not set
1053CONFIG_MINIX_FS=y 1057CONFIG_MINIX_FS=y
1058# CONFIG_OMFS_FS is not set
1054CONFIG_HPFS_FS=m 1059CONFIG_HPFS_FS=m
1055# CONFIG_QNX4FS_FS is not set 1060# CONFIG_QNX4FS_FS is not set
1056# CONFIG_ROMFS_FS is not set 1061# CONFIG_ROMFS_FS is not set
@@ -1063,18 +1068,17 @@ CONFIG_NFS_FS=y
1063CONFIG_NFS_V3=y 1068CONFIG_NFS_V3=y
1064# CONFIG_NFS_V3_ACL is not set 1069# CONFIG_NFS_V3_ACL is not set
1065CONFIG_NFS_V4=y 1070CONFIG_NFS_V4=y
1071CONFIG_ROOT_NFS=y
1066CONFIG_NFSD=m 1072CONFIG_NFSD=m
1067CONFIG_NFSD_V3=y 1073CONFIG_NFSD_V3=y
1068# CONFIG_NFSD_V3_ACL is not set 1074# CONFIG_NFSD_V3_ACL is not set
1069# CONFIG_NFSD_V4 is not set 1075# CONFIG_NFSD_V4 is not set
1070CONFIG_ROOT_NFS=y
1071CONFIG_LOCKD=y 1076CONFIG_LOCKD=y
1072CONFIG_LOCKD_V4=y 1077CONFIG_LOCKD_V4=y
1073CONFIG_EXPORTFS=m 1078CONFIG_EXPORTFS=m
1074CONFIG_NFS_COMMON=y 1079CONFIG_NFS_COMMON=y
1075CONFIG_SUNRPC=y 1080CONFIG_SUNRPC=y
1076CONFIG_SUNRPC_GSS=y 1081CONFIG_SUNRPC_GSS=y
1077CONFIG_SUNRPC_BIND34=y
1078CONFIG_RPCSEC_GSS_KRB5=y 1082CONFIG_RPCSEC_GSS_KRB5=y
1079# CONFIG_RPCSEC_GSS_SPKM3 is not set 1083# CONFIG_RPCSEC_GSS_SPKM3 is not set
1080CONFIG_SMB_FS=m 1084CONFIG_SMB_FS=m
@@ -1083,7 +1087,6 @@ CONFIG_SMB_NLS_REMOTE="cp437"
1083# CONFIG_CIFS is not set 1087# CONFIG_CIFS is not set
1084# CONFIG_NCP_FS is not set 1088# CONFIG_NCP_FS is not set
1085CONFIG_CODA_FS=m 1089CONFIG_CODA_FS=m
1086# CONFIG_CODA_FS_OLD_API is not set
1087# CONFIG_AFS_FS is not set 1090# CONFIG_AFS_FS is not set
1088 1091
1089# 1092#
@@ -1152,6 +1155,8 @@ CONFIG_MAGIC_SYSRQ=y
1152# CONFIG_HEADERS_CHECK is not set 1155# CONFIG_HEADERS_CHECK is not set
1153# CONFIG_DEBUG_KERNEL is not set 1156# CONFIG_DEBUG_KERNEL is not set
1154CONFIG_DEBUG_BUGVERBOSE=y 1157CONFIG_DEBUG_BUGVERBOSE=y
1158CONFIG_DEBUG_MEMORY_INIT=y
1159CONFIG_SYSCTL_SYSCALL_CHECK=y
1155# CONFIG_SAMPLES is not set 1160# CONFIG_SAMPLES is not set
1156 1161
1157# 1162#
@@ -1211,6 +1216,10 @@ CONFIG_CRYPTO_CRC32C=m
1211CONFIG_CRYPTO_MD4=m 1216CONFIG_CRYPTO_MD4=m
1212CONFIG_CRYPTO_MD5=y 1217CONFIG_CRYPTO_MD5=y
1213CONFIG_CRYPTO_MICHAEL_MIC=m 1218CONFIG_CRYPTO_MICHAEL_MIC=m
1219CONFIG_CRYPTO_RMD128=m
1220CONFIG_CRYPTO_RMD160=m
1221CONFIG_CRYPTO_RMD256=m
1222CONFIG_CRYPTO_RMD320=m
1214CONFIG_CRYPTO_SHA1=m 1223CONFIG_CRYPTO_SHA1=m
1215CONFIG_CRYPTO_SHA256=m 1224CONFIG_CRYPTO_SHA256=m
1216CONFIG_CRYPTO_SHA512=m 1225CONFIG_CRYPTO_SHA512=m
@@ -1252,6 +1261,7 @@ CONFIG_BITREVERSE=y
1252# CONFIG_GENERIC_FIND_NEXT_BIT is not set 1261# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1253CONFIG_CRC_CCITT=m 1262CONFIG_CRC_CCITT=m
1254CONFIG_CRC16=y 1263CONFIG_CRC16=y
1264CONFIG_CRC_T10DIF=y
1255CONFIG_CRC_ITU_T=m 1265CONFIG_CRC_ITU_T=m
1256CONFIG_CRC32=y 1266CONFIG_CRC32=y
1257# CONFIG_CRC7 is not set 1267# CONFIG_CRC7 is not set
diff --git a/arch/m68k/configs/mvme147_defconfig b/arch/m68k/configs/mvme147_defconfig
index e7a8246840b5..cacb5aef6a37 100644
--- a/arch/m68k/configs/mvme147_defconfig
+++ b/arch/m68k/configs/mvme147_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc4 3# Linux kernel version: 2.6.27-rc6
4# Wed May 28 22:47:35 2008 4# Wed Sep 10 09:02:08 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,7 +52,6 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
56CONFIG_KALLSYMS=y 55CONFIG_KALLSYMS=y
57# CONFIG_KALLSYMS_EXTRA_PASS is not set 56# CONFIG_KALLSYMS_EXTRA_PASS is not set
58CONFIG_HOTPLUG=y 57CONFIG_HOTPLUG=y
@@ -75,10 +74,16 @@ CONFIG_SLAB=y
75# CONFIG_PROFILING is not set 74# CONFIG_PROFILING is not set
76# CONFIG_MARKERS is not set 75# CONFIG_MARKERS is not set
77# CONFIG_HAVE_OPROFILE is not set 76# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
78# CONFIG_HAVE_IOREMAP_PROT is not set
78# CONFIG_HAVE_KPROBES is not set 79# CONFIG_HAVE_KPROBES is not set
79# CONFIG_HAVE_KRETPROBES is not set 80# CONFIG_HAVE_KRETPROBES is not set
81# CONFIG_HAVE_ARCH_TRACEHOOK is not set
80# CONFIG_HAVE_DMA_ATTRS is not set 82# CONFIG_HAVE_DMA_ATTRS is not set
83# CONFIG_USE_GENERIC_SMP_HELPERS is not set
84# CONFIG_HAVE_CLK is not set
81CONFIG_PROC_PAGE_MONITOR=y 85CONFIG_PROC_PAGE_MONITOR=y
86# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
82CONFIG_SLABINFO=y 87CONFIG_SLABINFO=y
83CONFIG_RT_MUTEXES=y 88CONFIG_RT_MUTEXES=y
84# CONFIG_TINY_SHMEM is not set 89# CONFIG_TINY_SHMEM is not set
@@ -95,6 +100,7 @@ CONFIG_BLOCK=y
95# CONFIG_BLK_DEV_IO_TRACE is not set 100# CONFIG_BLK_DEV_IO_TRACE is not set
96# CONFIG_LSF is not set 101# CONFIG_LSF is not set
97CONFIG_BLK_DEV_BSG=y 102CONFIG_BLK_DEV_BSG=y
103# CONFIG_BLK_DEV_INTEGRITY is not set
98 104
99# 105#
100# IO Schedulers 106# IO Schedulers
@@ -163,10 +169,6 @@ CONFIG_BINFMT_MISC=m
163CONFIG_PROC_HARDWARE=y 169CONFIG_PROC_HARDWARE=y
164CONFIG_ZONE_DMA=y 170CONFIG_ZONE_DMA=y
165# CONFIG_ARCH_SUPPORTS_MSI is not set 171# CONFIG_ARCH_SUPPORTS_MSI is not set
166
167#
168# Networking
169#
170CONFIG_NET=y 172CONFIG_NET=y
171 173
172# 174#
@@ -180,6 +182,7 @@ CONFIG_XFRM=y
180# CONFIG_XFRM_SUB_POLICY is not set 182# CONFIG_XFRM_SUB_POLICY is not set
181CONFIG_XFRM_MIGRATE=y 183CONFIG_XFRM_MIGRATE=y
182# CONFIG_XFRM_STATISTICS is not set 184# CONFIG_XFRM_STATISTICS is not set
185CONFIG_XFRM_IPCOMP=m
183CONFIG_NET_KEY=y 186CONFIG_NET_KEY=y
184CONFIG_NET_KEY_MIGRATE=y 187CONFIG_NET_KEY_MIGRATE=y
185CONFIG_INET=y 188CONFIG_INET=y
@@ -413,6 +416,7 @@ CONFIG_NET_CLS_ROUTE=y
413# 416#
414# CONFIG_CFG80211 is not set 417# CONFIG_CFG80211 is not set
415CONFIG_WIRELESS_EXT=y 418CONFIG_WIRELESS_EXT=y
419# CONFIG_WIRELESS_EXT_SYSFS is not set
416# CONFIG_MAC80211 is not set 420# CONFIG_MAC80211 is not set
417CONFIG_IEEE80211=m 421CONFIG_IEEE80211=m
418# CONFIG_IEEE80211_DEBUG is not set 422# CONFIG_IEEE80211_DEBUG is not set
@@ -432,7 +436,9 @@ CONFIG_IEEE80211_CRYPT_TKIP=m
432CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 436CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
433CONFIG_STANDALONE=y 437CONFIG_STANDALONE=y
434CONFIG_PREVENT_FIRMWARE_BUILD=y 438CONFIG_PREVENT_FIRMWARE_BUILD=y
435CONFIG_FW_LOADER=m 439CONFIG_FW_LOADER=y
440# CONFIG_FIRMWARE_IN_KERNEL is not set
441CONFIG_EXTRA_FIRMWARE=""
436# CONFIG_SYS_HYPERVISOR is not set 442# CONFIG_SYS_HYPERVISOR is not set
437CONFIG_CONNECTOR=m 443CONFIG_CONNECTOR=m
438# CONFIG_MTD is not set 444# CONFIG_MTD is not set
@@ -450,6 +456,7 @@ CONFIG_CDROM_PKTCDVD=m
450CONFIG_CDROM_PKTCDVD_BUFFERS=8 456CONFIG_CDROM_PKTCDVD_BUFFERS=8
451# CONFIG_CDROM_PKTCDVD_WCACHE is not set 457# CONFIG_CDROM_PKTCDVD_WCACHE is not set
452CONFIG_ATA_OVER_ETH=m 458CONFIG_ATA_OVER_ETH=m
459# CONFIG_BLK_DEV_HD is not set
453CONFIG_MISC_DEVICES=y 460CONFIG_MISC_DEVICES=y
454# CONFIG_EEPROM_93CX6 is not set 461# CONFIG_EEPROM_93CX6 is not set
455# CONFIG_ENCLOSURE_SERVICES is not set 462# CONFIG_ENCLOSURE_SERVICES is not set
@@ -502,6 +509,7 @@ CONFIG_SCSI_LOWLEVEL=y
502CONFIG_ISCSI_TCP=m 509CONFIG_ISCSI_TCP=m
503# CONFIG_SCSI_DEBUG is not set 510# CONFIG_SCSI_DEBUG is not set
504CONFIG_MVME147_SCSI=y 511CONFIG_MVME147_SCSI=y
512# CONFIG_SCSI_DH is not set
505CONFIG_MD=y 513CONFIG_MD=y
506CONFIG_BLK_DEV_MD=m 514CONFIG_BLK_DEV_MD=m
507CONFIG_MD_LINEAR=m 515CONFIG_MD_LINEAR=m
@@ -510,7 +518,7 @@ CONFIG_MD_RAID1=m
510# CONFIG_MD_RAID10 is not set 518# CONFIG_MD_RAID10 is not set
511CONFIG_MD_RAID456=m 519CONFIG_MD_RAID456=m
512CONFIG_MD_RAID5_RESHAPE=y 520CONFIG_MD_RAID5_RESHAPE=y
513CONFIG_MD_MULTIPATH=m 521# CONFIG_MD_MULTIPATH is not set
514# CONFIG_MD_FAULTY is not set 522# CONFIG_MD_FAULTY is not set
515CONFIG_BLK_DEV_DM=m 523CONFIG_BLK_DEV_DM=m
516# CONFIG_DM_DEBUG is not set 524# CONFIG_DM_DEBUG is not set
@@ -519,13 +527,9 @@ CONFIG_DM_SNAPSHOT=m
519CONFIG_DM_MIRROR=m 527CONFIG_DM_MIRROR=m
520CONFIG_DM_ZERO=m 528CONFIG_DM_ZERO=m
521CONFIG_DM_MULTIPATH=m 529CONFIG_DM_MULTIPATH=m
522CONFIG_DM_MULTIPATH_EMC=m
523CONFIG_DM_MULTIPATH_RDAC=m
524CONFIG_DM_MULTIPATH_HP=m
525# CONFIG_DM_DELAY is not set 530# CONFIG_DM_DELAY is not set
526CONFIG_DM_UEVENT=y 531CONFIG_DM_UEVENT=y
527CONFIG_NETDEVICES=y 532CONFIG_NETDEVICES=y
528# CONFIG_NETDEVICES_MULTIQUEUE is not set
529CONFIG_DUMMY=m 533CONFIG_DUMMY=m
530# CONFIG_BONDING is not set 534# CONFIG_BONDING is not set
531CONFIG_MACVLAN=m 535CONFIG_MACVLAN=m
@@ -630,6 +634,7 @@ CONFIG_SERIO_LIBPS2=m
630# Character devices 634# Character devices
631# 635#
632CONFIG_VT=y 636CONFIG_VT=y
637CONFIG_CONSOLE_TRANSLATIONS=y
633CONFIG_VT_CONSOLE=y 638CONFIG_VT_CONSOLE=y
634CONFIG_HW_CONSOLE=y 639CONFIG_HW_CONSOLE=y
635CONFIG_VT_HW_CONSOLE_BINDING=y 640CONFIG_VT_HW_CONSOLE_BINDING=y
@@ -660,6 +665,7 @@ CONFIG_GEN_RTC_X=y
660# CONFIG_POWER_SUPPLY is not set 665# CONFIG_POWER_SUPPLY is not set
661# CONFIG_HWMON is not set 666# CONFIG_HWMON is not set
662# CONFIG_THERMAL is not set 667# CONFIG_THERMAL is not set
668# CONFIG_THERMAL_HWMON is not set
663# CONFIG_WATCHDOG is not set 669# CONFIG_WATCHDOG is not set
664 670
665# 671#
@@ -671,8 +677,10 @@ CONFIG_SSB_POSSIBLE=y
671# 677#
672# Multifunction device drivers 678# Multifunction device drivers
673# 679#
680# CONFIG_MFD_CORE is not set
674# CONFIG_MFD_SM501 is not set 681# CONFIG_MFD_SM501 is not set
675# CONFIG_HTC_PASIC3 is not set 682# CONFIG_HTC_PASIC3 is not set
683# CONFIG_MFD_TMIO is not set
676 684
677# 685#
678# Multimedia devices 686# Multimedia devices
@@ -707,10 +715,6 @@ CONFIG_SSB_POSSIBLE=y
707# Console display driver support 715# Console display driver support
708# 716#
709CONFIG_DUMMY_CONSOLE=y 717CONFIG_DUMMY_CONSOLE=y
710
711#
712# Sound
713#
714# CONFIG_SOUND is not set 718# CONFIG_SOUND is not set
715CONFIG_HID_SUPPORT=y 719CONFIG_HID_SUPPORT=y
716CONFIG_HID=m 720CONFIG_HID=m
@@ -722,6 +726,7 @@ CONFIG_HIDRAW=y
722# CONFIG_NEW_LEDS is not set 726# CONFIG_NEW_LEDS is not set
723# CONFIG_ACCESSIBILITY is not set 727# CONFIG_ACCESSIBILITY is not set
724# CONFIG_RTC_CLASS is not set 728# CONFIG_RTC_CLASS is not set
729# CONFIG_DMADEVICES is not set
725# CONFIG_UIO is not set 730# CONFIG_UIO is not set
726 731
727# 732#
@@ -758,6 +763,7 @@ CONFIG_XFS_FS=m
758CONFIG_OCFS2_FS=m 763CONFIG_OCFS2_FS=m
759CONFIG_OCFS2_FS_O2CB=m 764CONFIG_OCFS2_FS_O2CB=m
760CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m 765CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
766# CONFIG_OCFS2_FS_STATS is not set
761# CONFIG_OCFS2_DEBUG_MASKLOG is not set 767# CONFIG_OCFS2_DEBUG_MASKLOG is not set
762# CONFIG_OCFS2_DEBUG_FS is not set 768# CONFIG_OCFS2_DEBUG_FS is not set
763CONFIG_DNOTIFY=y 769CONFIG_DNOTIFY=y
@@ -817,6 +823,7 @@ CONFIG_HFSPLUS_FS=m
817CONFIG_CRAMFS=m 823CONFIG_CRAMFS=m
818# CONFIG_VXFS_FS is not set 824# CONFIG_VXFS_FS is not set
819CONFIG_MINIX_FS=y 825CONFIG_MINIX_FS=y
826# CONFIG_OMFS_FS is not set
820CONFIG_HPFS_FS=m 827CONFIG_HPFS_FS=m
821# CONFIG_QNX4FS_FS is not set 828# CONFIG_QNX4FS_FS is not set
822# CONFIG_ROMFS_FS is not set 829# CONFIG_ROMFS_FS is not set
@@ -829,18 +836,17 @@ CONFIG_NFS_FS=y
829CONFIG_NFS_V3=y 836CONFIG_NFS_V3=y
830# CONFIG_NFS_V3_ACL is not set 837# CONFIG_NFS_V3_ACL is not set
831CONFIG_NFS_V4=y 838CONFIG_NFS_V4=y
839CONFIG_ROOT_NFS=y
832CONFIG_NFSD=m 840CONFIG_NFSD=m
833CONFIG_NFSD_V3=y 841CONFIG_NFSD_V3=y
834# CONFIG_NFSD_V3_ACL is not set 842# CONFIG_NFSD_V3_ACL is not set
835# CONFIG_NFSD_V4 is not set 843# CONFIG_NFSD_V4 is not set
836CONFIG_ROOT_NFS=y
837CONFIG_LOCKD=y 844CONFIG_LOCKD=y
838CONFIG_LOCKD_V4=y 845CONFIG_LOCKD_V4=y
839CONFIG_EXPORTFS=m 846CONFIG_EXPORTFS=m
840CONFIG_NFS_COMMON=y 847CONFIG_NFS_COMMON=y
841CONFIG_SUNRPC=y 848CONFIG_SUNRPC=y
842CONFIG_SUNRPC_GSS=y 849CONFIG_SUNRPC_GSS=y
843CONFIG_SUNRPC_BIND34=y
844CONFIG_RPCSEC_GSS_KRB5=y 850CONFIG_RPCSEC_GSS_KRB5=y
845# CONFIG_RPCSEC_GSS_SPKM3 is not set 851# CONFIG_RPCSEC_GSS_SPKM3 is not set
846CONFIG_SMB_FS=m 852CONFIG_SMB_FS=m
@@ -849,7 +855,6 @@ CONFIG_SMB_NLS_REMOTE="cp437"
849# CONFIG_CIFS is not set 855# CONFIG_CIFS is not set
850# CONFIG_NCP_FS is not set 856# CONFIG_NCP_FS is not set
851CONFIG_CODA_FS=m 857CONFIG_CODA_FS=m
852# CONFIG_CODA_FS_OLD_API is not set
853# CONFIG_AFS_FS is not set 858# CONFIG_AFS_FS is not set
854 859
855# 860#
@@ -914,6 +919,8 @@ CONFIG_MAGIC_SYSRQ=y
914# CONFIG_HEADERS_CHECK is not set 919# CONFIG_HEADERS_CHECK is not set
915# CONFIG_DEBUG_KERNEL is not set 920# CONFIG_DEBUG_KERNEL is not set
916CONFIG_DEBUG_BUGVERBOSE=y 921CONFIG_DEBUG_BUGVERBOSE=y
922CONFIG_DEBUG_MEMORY_INIT=y
923CONFIG_SYSCTL_SYSCALL_CHECK=y
917# CONFIG_SAMPLES is not set 924# CONFIG_SAMPLES is not set
918 925
919# 926#
@@ -973,6 +980,10 @@ CONFIG_CRYPTO_CRC32C=m
973CONFIG_CRYPTO_MD4=m 980CONFIG_CRYPTO_MD4=m
974CONFIG_CRYPTO_MD5=y 981CONFIG_CRYPTO_MD5=y
975CONFIG_CRYPTO_MICHAEL_MIC=m 982CONFIG_CRYPTO_MICHAEL_MIC=m
983CONFIG_CRYPTO_RMD128=m
984CONFIG_CRYPTO_RMD160=m
985CONFIG_CRYPTO_RMD256=m
986CONFIG_CRYPTO_RMD320=m
976CONFIG_CRYPTO_SHA1=m 987CONFIG_CRYPTO_SHA1=m
977CONFIG_CRYPTO_SHA256=m 988CONFIG_CRYPTO_SHA256=m
978CONFIG_CRYPTO_SHA512=m 989CONFIG_CRYPTO_SHA512=m
@@ -1014,6 +1025,7 @@ CONFIG_BITREVERSE=y
1014# CONFIG_GENERIC_FIND_NEXT_BIT is not set 1025# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1015CONFIG_CRC_CCITT=m 1026CONFIG_CRC_CCITT=m
1016CONFIG_CRC16=m 1027CONFIG_CRC16=m
1028CONFIG_CRC_T10DIF=y
1017CONFIG_CRC_ITU_T=m 1029CONFIG_CRC_ITU_T=m
1018CONFIG_CRC32=y 1030CONFIG_CRC32=y
1019# CONFIG_CRC7 is not set 1031# CONFIG_CRC7 is not set
diff --git a/arch/m68k/configs/mvme16x_defconfig b/arch/m68k/configs/mvme16x_defconfig
index ab536eb172bb..a183e25e348d 100644
--- a/arch/m68k/configs/mvme16x_defconfig
+++ b/arch/m68k/configs/mvme16x_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc4 3# Linux kernel version: 2.6.27-rc6
4# Wed May 28 22:47:35 2008 4# Wed Sep 10 09:02:09 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,7 +52,6 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
56CONFIG_KALLSYMS=y 55CONFIG_KALLSYMS=y
57# CONFIG_KALLSYMS_EXTRA_PASS is not set 56# CONFIG_KALLSYMS_EXTRA_PASS is not set
58CONFIG_HOTPLUG=y 57CONFIG_HOTPLUG=y
@@ -75,10 +74,16 @@ CONFIG_SLAB=y
75# CONFIG_PROFILING is not set 74# CONFIG_PROFILING is not set
76# CONFIG_MARKERS is not set 75# CONFIG_MARKERS is not set
77# CONFIG_HAVE_OPROFILE is not set 76# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
78# CONFIG_HAVE_IOREMAP_PROT is not set
78# CONFIG_HAVE_KPROBES is not set 79# CONFIG_HAVE_KPROBES is not set
79# CONFIG_HAVE_KRETPROBES is not set 80# CONFIG_HAVE_KRETPROBES is not set
81# CONFIG_HAVE_ARCH_TRACEHOOK is not set
80# CONFIG_HAVE_DMA_ATTRS is not set 82# CONFIG_HAVE_DMA_ATTRS is not set
83# CONFIG_USE_GENERIC_SMP_HELPERS is not set
84# CONFIG_HAVE_CLK is not set
81CONFIG_PROC_PAGE_MONITOR=y 85CONFIG_PROC_PAGE_MONITOR=y
86# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
82CONFIG_SLABINFO=y 87CONFIG_SLABINFO=y
83CONFIG_RT_MUTEXES=y 88CONFIG_RT_MUTEXES=y
84# CONFIG_TINY_SHMEM is not set 89# CONFIG_TINY_SHMEM is not set
@@ -95,6 +100,7 @@ CONFIG_BLOCK=y
95# CONFIG_BLK_DEV_IO_TRACE is not set 100# CONFIG_BLK_DEV_IO_TRACE is not set
96# CONFIG_LSF is not set 101# CONFIG_LSF is not set
97CONFIG_BLK_DEV_BSG=y 102CONFIG_BLK_DEV_BSG=y
103# CONFIG_BLK_DEV_INTEGRITY is not set
98 104
99# 105#
100# IO Schedulers 106# IO Schedulers
@@ -163,10 +169,6 @@ CONFIG_BINFMT_MISC=m
163CONFIG_PROC_HARDWARE=y 169CONFIG_PROC_HARDWARE=y
164CONFIG_ZONE_DMA=y 170CONFIG_ZONE_DMA=y
165# CONFIG_ARCH_SUPPORTS_MSI is not set 171# CONFIG_ARCH_SUPPORTS_MSI is not set
166
167#
168# Networking
169#
170CONFIG_NET=y 172CONFIG_NET=y
171 173
172# 174#
@@ -180,6 +182,7 @@ CONFIG_XFRM=y
180# CONFIG_XFRM_SUB_POLICY is not set 182# CONFIG_XFRM_SUB_POLICY is not set
181CONFIG_XFRM_MIGRATE=y 183CONFIG_XFRM_MIGRATE=y
182# CONFIG_XFRM_STATISTICS is not set 184# CONFIG_XFRM_STATISTICS is not set
185CONFIG_XFRM_IPCOMP=m
183CONFIG_NET_KEY=y 186CONFIG_NET_KEY=y
184CONFIG_NET_KEY_MIGRATE=y 187CONFIG_NET_KEY_MIGRATE=y
185CONFIG_INET=y 188CONFIG_INET=y
@@ -413,6 +416,7 @@ CONFIG_NET_CLS_ROUTE=y
413# 416#
414# CONFIG_CFG80211 is not set 417# CONFIG_CFG80211 is not set
415CONFIG_WIRELESS_EXT=y 418CONFIG_WIRELESS_EXT=y
419# CONFIG_WIRELESS_EXT_SYSFS is not set
416# CONFIG_MAC80211 is not set 420# CONFIG_MAC80211 is not set
417CONFIG_IEEE80211=m 421CONFIG_IEEE80211=m
418# CONFIG_IEEE80211_DEBUG is not set 422# CONFIG_IEEE80211_DEBUG is not set
@@ -432,7 +436,9 @@ CONFIG_IEEE80211_CRYPT_TKIP=m
432CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 436CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
433CONFIG_STANDALONE=y 437CONFIG_STANDALONE=y
434CONFIG_PREVENT_FIRMWARE_BUILD=y 438CONFIG_PREVENT_FIRMWARE_BUILD=y
435CONFIG_FW_LOADER=m 439CONFIG_FW_LOADER=y
440# CONFIG_FIRMWARE_IN_KERNEL is not set
441CONFIG_EXTRA_FIRMWARE=""
436# CONFIG_SYS_HYPERVISOR is not set 442# CONFIG_SYS_HYPERVISOR is not set
437CONFIG_CONNECTOR=m 443CONFIG_CONNECTOR=m
438# CONFIG_MTD is not set 444# CONFIG_MTD is not set
@@ -450,6 +456,7 @@ CONFIG_CDROM_PKTCDVD=m
450CONFIG_CDROM_PKTCDVD_BUFFERS=8 456CONFIG_CDROM_PKTCDVD_BUFFERS=8
451# CONFIG_CDROM_PKTCDVD_WCACHE is not set 457# CONFIG_CDROM_PKTCDVD_WCACHE is not set
452CONFIG_ATA_OVER_ETH=m 458CONFIG_ATA_OVER_ETH=m
459# CONFIG_BLK_DEV_HD is not set
453CONFIG_MISC_DEVICES=y 460CONFIG_MISC_DEVICES=y
454# CONFIG_EEPROM_93CX6 is not set 461# CONFIG_EEPROM_93CX6 is not set
455# CONFIG_ENCLOSURE_SERVICES is not set 462# CONFIG_ENCLOSURE_SERVICES is not set
@@ -503,6 +510,7 @@ CONFIG_ISCSI_TCP=m
503CONFIG_53C700_BE_BUS=y 510CONFIG_53C700_BE_BUS=y
504# CONFIG_SCSI_DEBUG is not set 511# CONFIG_SCSI_DEBUG is not set
505CONFIG_MVME16x_SCSI=y 512CONFIG_MVME16x_SCSI=y
513# CONFIG_SCSI_DH is not set
506CONFIG_MD=y 514CONFIG_MD=y
507CONFIG_BLK_DEV_MD=m 515CONFIG_BLK_DEV_MD=m
508CONFIG_MD_LINEAR=m 516CONFIG_MD_LINEAR=m
@@ -511,7 +519,7 @@ CONFIG_MD_RAID1=m
511# CONFIG_MD_RAID10 is not set 519# CONFIG_MD_RAID10 is not set
512CONFIG_MD_RAID456=m 520CONFIG_MD_RAID456=m
513CONFIG_MD_RAID5_RESHAPE=y 521CONFIG_MD_RAID5_RESHAPE=y
514CONFIG_MD_MULTIPATH=m 522# CONFIG_MD_MULTIPATH is not set
515# CONFIG_MD_FAULTY is not set 523# CONFIG_MD_FAULTY is not set
516CONFIG_BLK_DEV_DM=m 524CONFIG_BLK_DEV_DM=m
517# CONFIG_DM_DEBUG is not set 525# CONFIG_DM_DEBUG is not set
@@ -520,13 +528,9 @@ CONFIG_DM_SNAPSHOT=m
520CONFIG_DM_MIRROR=m 528CONFIG_DM_MIRROR=m
521CONFIG_DM_ZERO=m 529CONFIG_DM_ZERO=m
522CONFIG_DM_MULTIPATH=m 530CONFIG_DM_MULTIPATH=m
523CONFIG_DM_MULTIPATH_EMC=m
524CONFIG_DM_MULTIPATH_RDAC=m
525CONFIG_DM_MULTIPATH_HP=m
526# CONFIG_DM_DELAY is not set 531# CONFIG_DM_DELAY is not set
527CONFIG_DM_UEVENT=y 532CONFIG_DM_UEVENT=y
528CONFIG_NETDEVICES=y 533CONFIG_NETDEVICES=y
529# CONFIG_NETDEVICES_MULTIQUEUE is not set
530CONFIG_DUMMY=m 534CONFIG_DUMMY=m
531# CONFIG_BONDING is not set 535# CONFIG_BONDING is not set
532CONFIG_MACVLAN=m 536CONFIG_MACVLAN=m
@@ -631,6 +635,7 @@ CONFIG_SERIO_LIBPS2=m
631# Character devices 635# Character devices
632# 636#
633CONFIG_VT=y 637CONFIG_VT=y
638CONFIG_CONSOLE_TRANSLATIONS=y
634CONFIG_VT_CONSOLE=y 639CONFIG_VT_CONSOLE=y
635CONFIG_HW_CONSOLE=y 640CONFIG_HW_CONSOLE=y
636CONFIG_VT_HW_CONSOLE_BINDING=y 641CONFIG_VT_HW_CONSOLE_BINDING=y
@@ -661,6 +666,7 @@ CONFIG_GEN_RTC_X=y
661# CONFIG_POWER_SUPPLY is not set 666# CONFIG_POWER_SUPPLY is not set
662# CONFIG_HWMON is not set 667# CONFIG_HWMON is not set
663# CONFIG_THERMAL is not set 668# CONFIG_THERMAL is not set
669# CONFIG_THERMAL_HWMON is not set
664# CONFIG_WATCHDOG is not set 670# CONFIG_WATCHDOG is not set
665 671
666# 672#
@@ -672,8 +678,10 @@ CONFIG_SSB_POSSIBLE=y
672# 678#
673# Multifunction device drivers 679# Multifunction device drivers
674# 680#
681# CONFIG_MFD_CORE is not set
675# CONFIG_MFD_SM501 is not set 682# CONFIG_MFD_SM501 is not set
676# CONFIG_HTC_PASIC3 is not set 683# CONFIG_HTC_PASIC3 is not set
684# CONFIG_MFD_TMIO is not set
677 685
678# 686#
679# Multimedia devices 687# Multimedia devices
@@ -708,10 +716,6 @@ CONFIG_SSB_POSSIBLE=y
708# Console display driver support 716# Console display driver support
709# 717#
710CONFIG_DUMMY_CONSOLE=y 718CONFIG_DUMMY_CONSOLE=y
711
712#
713# Sound
714#
715# CONFIG_SOUND is not set 719# CONFIG_SOUND is not set
716CONFIG_HID_SUPPORT=y 720CONFIG_HID_SUPPORT=y
717CONFIG_HID=m 721CONFIG_HID=m
@@ -723,6 +727,7 @@ CONFIG_HIDRAW=y
723# CONFIG_NEW_LEDS is not set 727# CONFIG_NEW_LEDS is not set
724# CONFIG_ACCESSIBILITY is not set 728# CONFIG_ACCESSIBILITY is not set
725# CONFIG_RTC_CLASS is not set 729# CONFIG_RTC_CLASS is not set
730# CONFIG_DMADEVICES is not set
726# CONFIG_UIO is not set 731# CONFIG_UIO is not set
727 732
728# 733#
@@ -760,6 +765,7 @@ CONFIG_XFS_FS=m
760CONFIG_OCFS2_FS=m 765CONFIG_OCFS2_FS=m
761CONFIG_OCFS2_FS_O2CB=m 766CONFIG_OCFS2_FS_O2CB=m
762CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m 767CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
768# CONFIG_OCFS2_FS_STATS is not set
763# CONFIG_OCFS2_DEBUG_MASKLOG is not set 769# CONFIG_OCFS2_DEBUG_MASKLOG is not set
764# CONFIG_OCFS2_DEBUG_FS is not set 770# CONFIG_OCFS2_DEBUG_FS is not set
765CONFIG_DNOTIFY=y 771CONFIG_DNOTIFY=y
@@ -819,6 +825,7 @@ CONFIG_HFSPLUS_FS=m
819CONFIG_CRAMFS=m 825CONFIG_CRAMFS=m
820# CONFIG_VXFS_FS is not set 826# CONFIG_VXFS_FS is not set
821CONFIG_MINIX_FS=y 827CONFIG_MINIX_FS=y
828# CONFIG_OMFS_FS is not set
822CONFIG_HPFS_FS=m 829CONFIG_HPFS_FS=m
823# CONFIG_QNX4FS_FS is not set 830# CONFIG_QNX4FS_FS is not set
824# CONFIG_ROMFS_FS is not set 831# CONFIG_ROMFS_FS is not set
@@ -831,18 +838,17 @@ CONFIG_NFS_FS=y
831CONFIG_NFS_V3=y 838CONFIG_NFS_V3=y
832# CONFIG_NFS_V3_ACL is not set 839# CONFIG_NFS_V3_ACL is not set
833CONFIG_NFS_V4=y 840CONFIG_NFS_V4=y
841CONFIG_ROOT_NFS=y
834CONFIG_NFSD=m 842CONFIG_NFSD=m
835CONFIG_NFSD_V3=y 843CONFIG_NFSD_V3=y
836# CONFIG_NFSD_V3_ACL is not set 844# CONFIG_NFSD_V3_ACL is not set
837# CONFIG_NFSD_V4 is not set 845# CONFIG_NFSD_V4 is not set
838CONFIG_ROOT_NFS=y
839CONFIG_LOCKD=y 846CONFIG_LOCKD=y
840CONFIG_LOCKD_V4=y 847CONFIG_LOCKD_V4=y
841CONFIG_EXPORTFS=m 848CONFIG_EXPORTFS=m
842CONFIG_NFS_COMMON=y 849CONFIG_NFS_COMMON=y
843CONFIG_SUNRPC=y 850CONFIG_SUNRPC=y
844CONFIG_SUNRPC_GSS=y 851CONFIG_SUNRPC_GSS=y
845CONFIG_SUNRPC_BIND34=y
846CONFIG_RPCSEC_GSS_KRB5=y 852CONFIG_RPCSEC_GSS_KRB5=y
847# CONFIG_RPCSEC_GSS_SPKM3 is not set 853# CONFIG_RPCSEC_GSS_SPKM3 is not set
848CONFIG_SMB_FS=m 854CONFIG_SMB_FS=m
@@ -851,7 +857,6 @@ CONFIG_SMB_NLS_REMOTE="cp437"
851# CONFIG_CIFS is not set 857# CONFIG_CIFS is not set
852# CONFIG_NCP_FS is not set 858# CONFIG_NCP_FS is not set
853CONFIG_CODA_FS=m 859CONFIG_CODA_FS=m
854# CONFIG_CODA_FS_OLD_API is not set
855# CONFIG_AFS_FS is not set 860# CONFIG_AFS_FS is not set
856 861
857# 862#
@@ -916,6 +921,8 @@ CONFIG_MAGIC_SYSRQ=y
916# CONFIG_HEADERS_CHECK is not set 921# CONFIG_HEADERS_CHECK is not set
917# CONFIG_DEBUG_KERNEL is not set 922# CONFIG_DEBUG_KERNEL is not set
918CONFIG_DEBUG_BUGVERBOSE=y 923CONFIG_DEBUG_BUGVERBOSE=y
924CONFIG_DEBUG_MEMORY_INIT=y
925CONFIG_SYSCTL_SYSCALL_CHECK=y
919# CONFIG_SAMPLES is not set 926# CONFIG_SAMPLES is not set
920 927
921# 928#
@@ -975,6 +982,10 @@ CONFIG_CRYPTO_CRC32C=m
975CONFIG_CRYPTO_MD4=m 982CONFIG_CRYPTO_MD4=m
976CONFIG_CRYPTO_MD5=y 983CONFIG_CRYPTO_MD5=y
977CONFIG_CRYPTO_MICHAEL_MIC=m 984CONFIG_CRYPTO_MICHAEL_MIC=m
985CONFIG_CRYPTO_RMD128=m
986CONFIG_CRYPTO_RMD160=m
987CONFIG_CRYPTO_RMD256=m
988CONFIG_CRYPTO_RMD320=m
978CONFIG_CRYPTO_SHA1=m 989CONFIG_CRYPTO_SHA1=m
979CONFIG_CRYPTO_SHA256=m 990CONFIG_CRYPTO_SHA256=m
980CONFIG_CRYPTO_SHA512=m 991CONFIG_CRYPTO_SHA512=m
@@ -1016,6 +1027,7 @@ CONFIG_BITREVERSE=y
1016# CONFIG_GENERIC_FIND_NEXT_BIT is not set 1027# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1017CONFIG_CRC_CCITT=m 1028CONFIG_CRC_CCITT=m
1018CONFIG_CRC16=m 1029CONFIG_CRC16=m
1030CONFIG_CRC_T10DIF=y
1019CONFIG_CRC_ITU_T=m 1031CONFIG_CRC_ITU_T=m
1020CONFIG_CRC32=y 1032CONFIG_CRC32=y
1021# CONFIG_CRC7 is not set 1033# CONFIG_CRC7 is not set
diff --git a/arch/m68k/configs/q40_defconfig b/arch/m68k/configs/q40_defconfig
index e05be687b500..72eaff0776b8 100644
--- a/arch/m68k/configs/q40_defconfig
+++ b/arch/m68k/configs/q40_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc4 3# Linux kernel version: 2.6.27-rc6
4# Wed May 28 22:47:35 2008 4# Wed Sep 10 09:02:10 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,7 +52,6 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
56CONFIG_KALLSYMS=y 55CONFIG_KALLSYMS=y
57# CONFIG_KALLSYMS_EXTRA_PASS is not set 56# CONFIG_KALLSYMS_EXTRA_PASS is not set
58CONFIG_HOTPLUG=y 57CONFIG_HOTPLUG=y
@@ -75,10 +74,16 @@ CONFIG_SLAB=y
75# CONFIG_PROFILING is not set 74# CONFIG_PROFILING is not set
76# CONFIG_MARKERS is not set 75# CONFIG_MARKERS is not set
77# CONFIG_HAVE_OPROFILE is not set 76# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
78# CONFIG_HAVE_IOREMAP_PROT is not set
78# CONFIG_HAVE_KPROBES is not set 79# CONFIG_HAVE_KPROBES is not set
79# CONFIG_HAVE_KRETPROBES is not set 80# CONFIG_HAVE_KRETPROBES is not set
81# CONFIG_HAVE_ARCH_TRACEHOOK is not set
80# CONFIG_HAVE_DMA_ATTRS is not set 82# CONFIG_HAVE_DMA_ATTRS is not set
83# CONFIG_USE_GENERIC_SMP_HELPERS is not set
84# CONFIG_HAVE_CLK is not set
81CONFIG_PROC_PAGE_MONITOR=y 85CONFIG_PROC_PAGE_MONITOR=y
86# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
82CONFIG_SLABINFO=y 87CONFIG_SLABINFO=y
83CONFIG_RT_MUTEXES=y 88CONFIG_RT_MUTEXES=y
84# CONFIG_TINY_SHMEM is not set 89# CONFIG_TINY_SHMEM is not set
@@ -95,6 +100,7 @@ CONFIG_BLOCK=y
95# CONFIG_BLK_DEV_IO_TRACE is not set 100# CONFIG_BLK_DEV_IO_TRACE is not set
96# CONFIG_LSF is not set 101# CONFIG_LSF is not set
97CONFIG_BLK_DEV_BSG=y 102CONFIG_BLK_DEV_BSG=y
103# CONFIG_BLK_DEV_INTEGRITY is not set
98 104
99# 105#
100# IO Schedulers 106# IO Schedulers
@@ -163,10 +169,6 @@ CONFIG_ISA=y
163CONFIG_GENERIC_ISA_DMA=y 169CONFIG_GENERIC_ISA_DMA=y
164CONFIG_ZONE_DMA=y 170CONFIG_ZONE_DMA=y
165# CONFIG_ARCH_SUPPORTS_MSI is not set 171# CONFIG_ARCH_SUPPORTS_MSI is not set
166
167#
168# Networking
169#
170CONFIG_NET=y 172CONFIG_NET=y
171 173
172# 174#
@@ -180,6 +182,7 @@ CONFIG_XFRM=y
180# CONFIG_XFRM_SUB_POLICY is not set 182# CONFIG_XFRM_SUB_POLICY is not set
181CONFIG_XFRM_MIGRATE=y 183CONFIG_XFRM_MIGRATE=y
182# CONFIG_XFRM_STATISTICS is not set 184# CONFIG_XFRM_STATISTICS is not set
185CONFIG_XFRM_IPCOMP=m
183CONFIG_NET_KEY=y 186CONFIG_NET_KEY=y
184CONFIG_NET_KEY_MIGRATE=y 187CONFIG_NET_KEY_MIGRATE=y
185CONFIG_INET=y 188CONFIG_INET=y
@@ -410,6 +413,7 @@ CONFIG_NET_CLS_ROUTE=y
410# 413#
411# CONFIG_CFG80211 is not set 414# CONFIG_CFG80211 is not set
412CONFIG_WIRELESS_EXT=y 415CONFIG_WIRELESS_EXT=y
416# CONFIG_WIRELESS_EXT_SYSFS is not set
413# CONFIG_MAC80211 is not set 417# CONFIG_MAC80211 is not set
414CONFIG_IEEE80211=m 418CONFIG_IEEE80211=m
415# CONFIG_IEEE80211_DEBUG is not set 419# CONFIG_IEEE80211_DEBUG is not set
@@ -429,7 +433,9 @@ CONFIG_IEEE80211_CRYPT_TKIP=m
429CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 433CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
430CONFIG_STANDALONE=y 434CONFIG_STANDALONE=y
431CONFIG_PREVENT_FIRMWARE_BUILD=y 435CONFIG_PREVENT_FIRMWARE_BUILD=y
432CONFIG_FW_LOADER=m 436CONFIG_FW_LOADER=y
437# CONFIG_FIRMWARE_IN_KERNEL is not set
438CONFIG_EXTRA_FIRMWARE=""
433# CONFIG_SYS_HYPERVISOR is not set 439# CONFIG_SYS_HYPERVISOR is not set
434CONFIG_CONNECTOR=m 440CONFIG_CONNECTOR=m
435# CONFIG_MTD is not set 441# CONFIG_MTD is not set
@@ -448,6 +454,7 @@ CONFIG_CDROM_PKTCDVD=m
448CONFIG_CDROM_PKTCDVD_BUFFERS=8 454CONFIG_CDROM_PKTCDVD_BUFFERS=8
449# CONFIG_CDROM_PKTCDVD_WCACHE is not set 455# CONFIG_CDROM_PKTCDVD_WCACHE is not set
450CONFIG_ATA_OVER_ETH=m 456CONFIG_ATA_OVER_ETH=m
457# CONFIG_BLK_DEV_HD is not set
451CONFIG_MISC_DEVICES=y 458CONFIG_MISC_DEVICES=y
452# CONFIG_EEPROM_93CX6 is not set 459# CONFIG_EEPROM_93CX6 is not set
453# CONFIG_ENCLOSURE_SERVICES is not set 460# CONFIG_ENCLOSURE_SERVICES is not set
@@ -458,6 +465,7 @@ CONFIG_BLK_DEV_IDE=y
458# 465#
459# Please see Documentation/ide/ide.txt for help/info on IDE drives 466# Please see Documentation/ide/ide.txt for help/info on IDE drives
460# 467#
468CONFIG_IDE_ATAPI=y
461# CONFIG_BLK_DEV_IDE_SATA is not set 469# CONFIG_BLK_DEV_IDE_SATA is not set
462CONFIG_BLK_DEV_IDEDISK=y 470CONFIG_BLK_DEV_IDEDISK=y
463# CONFIG_IDEDISK_MULTI_MODE is not set 471# CONFIG_IDEDISK_MULTI_MODE is not set
@@ -475,8 +483,6 @@ CONFIG_IDE_PROC_FS=y
475# CONFIG_BLK_DEV_PLATFORM is not set 483# CONFIG_BLK_DEV_PLATFORM is not set
476CONFIG_BLK_DEV_Q40IDE=y 484CONFIG_BLK_DEV_Q40IDE=y
477# CONFIG_BLK_DEV_IDEDMA is not set 485# CONFIG_BLK_DEV_IDEDMA is not set
478# CONFIG_BLK_DEV_HD_ONLY is not set
479# CONFIG_BLK_DEV_HD is not set
480 486
481# 487#
482# SCSI device support 488# SCSI device support
@@ -536,6 +542,7 @@ CONFIG_ISCSI_TCP=m
536# CONFIG_SCSI_SYM53C416 is not set 542# CONFIG_SCSI_SYM53C416 is not set
537# CONFIG_SCSI_T128 is not set 543# CONFIG_SCSI_T128 is not set
538# CONFIG_SCSI_DEBUG is not set 544# CONFIG_SCSI_DEBUG is not set
545# CONFIG_SCSI_DH is not set
539CONFIG_MD=y 546CONFIG_MD=y
540CONFIG_BLK_DEV_MD=m 547CONFIG_BLK_DEV_MD=m
541CONFIG_MD_LINEAR=m 548CONFIG_MD_LINEAR=m
@@ -544,7 +551,7 @@ CONFIG_MD_RAID1=m
544# CONFIG_MD_RAID10 is not set 551# CONFIG_MD_RAID10 is not set
545CONFIG_MD_RAID456=m 552CONFIG_MD_RAID456=m
546CONFIG_MD_RAID5_RESHAPE=y 553CONFIG_MD_RAID5_RESHAPE=y
547CONFIG_MD_MULTIPATH=m 554# CONFIG_MD_MULTIPATH is not set
548# CONFIG_MD_FAULTY is not set 555# CONFIG_MD_FAULTY is not set
549CONFIG_BLK_DEV_DM=m 556CONFIG_BLK_DEV_DM=m
550# CONFIG_DM_DEBUG is not set 557# CONFIG_DM_DEBUG is not set
@@ -553,13 +560,9 @@ CONFIG_DM_SNAPSHOT=m
553CONFIG_DM_MIRROR=m 560CONFIG_DM_MIRROR=m
554CONFIG_DM_ZERO=m 561CONFIG_DM_ZERO=m
555CONFIG_DM_MULTIPATH=m 562CONFIG_DM_MULTIPATH=m
556CONFIG_DM_MULTIPATH_EMC=m
557CONFIG_DM_MULTIPATH_RDAC=m
558CONFIG_DM_MULTIPATH_HP=m
559# CONFIG_DM_DELAY is not set 563# CONFIG_DM_DELAY is not set
560CONFIG_DM_UEVENT=y 564CONFIG_DM_UEVENT=y
561CONFIG_NETDEVICES=y 565CONFIG_NETDEVICES=y
562# CONFIG_NETDEVICES_MULTIQUEUE is not set
563CONFIG_DUMMY=m 566CONFIG_DUMMY=m
564# CONFIG_BONDING is not set 567# CONFIG_BONDING is not set
565CONFIG_MACVLAN=m 568CONFIG_MACVLAN=m
@@ -680,6 +683,7 @@ CONFIG_SERIO_LIBPS2=m
680# Character devices 683# Character devices
681# 684#
682CONFIG_VT=y 685CONFIG_VT=y
686CONFIG_CONSOLE_TRANSLATIONS=y
683CONFIG_VT_CONSOLE=y 687CONFIG_VT_CONSOLE=y
684CONFIG_HW_CONSOLE=y 688CONFIG_HW_CONSOLE=y
685CONFIG_VT_HW_CONSOLE_BINDING=y 689CONFIG_VT_HW_CONSOLE_BINDING=y
@@ -711,6 +715,7 @@ CONFIG_GEN_RTC_X=y
711# CONFIG_POWER_SUPPLY is not set 715# CONFIG_POWER_SUPPLY is not set
712# CONFIG_HWMON is not set 716# CONFIG_HWMON is not set
713# CONFIG_THERMAL is not set 717# CONFIG_THERMAL is not set
718# CONFIG_THERMAL_HWMON is not set
714# CONFIG_WATCHDOG is not set 719# CONFIG_WATCHDOG is not set
715 720
716# 721#
@@ -722,8 +727,10 @@ CONFIG_SSB_POSSIBLE=y
722# 727#
723# Multifunction device drivers 728# Multifunction device drivers
724# 729#
730# CONFIG_MFD_CORE is not set
725# CONFIG_MFD_SM501 is not set 731# CONFIG_MFD_SM501 is not set
726# CONFIG_HTC_PASIC3 is not set 732# CONFIG_HTC_PASIC3 is not set
733# CONFIG_MFD_TMIO is not set
727 734
728# 735#
729# Multimedia devices 736# Multimedia devices
@@ -792,10 +799,6 @@ CONFIG_LOGO=y
792CONFIG_LOGO_LINUX_MONO=y 799CONFIG_LOGO_LINUX_MONO=y
793CONFIG_LOGO_LINUX_VGA16=y 800CONFIG_LOGO_LINUX_VGA16=y
794CONFIG_LOGO_LINUX_CLUT224=y 801CONFIG_LOGO_LINUX_CLUT224=y
795
796#
797# Sound
798#
799CONFIG_SOUND=m 802CONFIG_SOUND=m
800CONFIG_DMASOUND_Q40=m 803CONFIG_DMASOUND_Q40=m
801CONFIG_DMASOUND=m 804CONFIG_DMASOUND=m
@@ -809,6 +812,7 @@ CONFIG_HIDRAW=y
809# CONFIG_NEW_LEDS is not set 812# CONFIG_NEW_LEDS is not set
810# CONFIG_ACCESSIBILITY is not set 813# CONFIG_ACCESSIBILITY is not set
811# CONFIG_RTC_CLASS is not set 814# CONFIG_RTC_CLASS is not set
815# CONFIG_DMADEVICES is not set
812# CONFIG_UIO is not set 816# CONFIG_UIO is not set
813 817
814# 818#
@@ -843,6 +847,7 @@ CONFIG_XFS_FS=m
843CONFIG_OCFS2_FS=m 847CONFIG_OCFS2_FS=m
844CONFIG_OCFS2_FS_O2CB=m 848CONFIG_OCFS2_FS_O2CB=m
845CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m 849CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
850# CONFIG_OCFS2_FS_STATS is not set
846# CONFIG_OCFS2_DEBUG_MASKLOG is not set 851# CONFIG_OCFS2_DEBUG_MASKLOG is not set
847# CONFIG_OCFS2_DEBUG_FS is not set 852# CONFIG_OCFS2_DEBUG_FS is not set
848CONFIG_DNOTIFY=y 853CONFIG_DNOTIFY=y
@@ -902,6 +907,7 @@ CONFIG_HFSPLUS_FS=m
902CONFIG_CRAMFS=m 907CONFIG_CRAMFS=m
903# CONFIG_VXFS_FS is not set 908# CONFIG_VXFS_FS is not set
904CONFIG_MINIX_FS=y 909CONFIG_MINIX_FS=y
910# CONFIG_OMFS_FS is not set
905CONFIG_HPFS_FS=m 911CONFIG_HPFS_FS=m
906# CONFIG_QNX4FS_FS is not set 912# CONFIG_QNX4FS_FS is not set
907# CONFIG_ROMFS_FS is not set 913# CONFIG_ROMFS_FS is not set
@@ -924,7 +930,6 @@ CONFIG_EXPORTFS=m
924CONFIG_NFS_COMMON=y 930CONFIG_NFS_COMMON=y
925CONFIG_SUNRPC=y 931CONFIG_SUNRPC=y
926CONFIG_SUNRPC_GSS=y 932CONFIG_SUNRPC_GSS=y
927CONFIG_SUNRPC_BIND34=y
928CONFIG_RPCSEC_GSS_KRB5=y 933CONFIG_RPCSEC_GSS_KRB5=y
929# CONFIG_RPCSEC_GSS_SPKM3 is not set 934# CONFIG_RPCSEC_GSS_SPKM3 is not set
930CONFIG_SMB_FS=m 935CONFIG_SMB_FS=m
@@ -933,7 +938,6 @@ CONFIG_SMB_NLS_REMOTE="cp437"
933# CONFIG_CIFS is not set 938# CONFIG_CIFS is not set
934# CONFIG_NCP_FS is not set 939# CONFIG_NCP_FS is not set
935CONFIG_CODA_FS=m 940CONFIG_CODA_FS=m
936# CONFIG_CODA_FS_OLD_API is not set
937# CONFIG_AFS_FS is not set 941# CONFIG_AFS_FS is not set
938 942
939# 943#
@@ -997,6 +1001,8 @@ CONFIG_MAGIC_SYSRQ=y
997# CONFIG_HEADERS_CHECK is not set 1001# CONFIG_HEADERS_CHECK is not set
998# CONFIG_DEBUG_KERNEL is not set 1002# CONFIG_DEBUG_KERNEL is not set
999CONFIG_DEBUG_BUGVERBOSE=y 1003CONFIG_DEBUG_BUGVERBOSE=y
1004CONFIG_DEBUG_MEMORY_INIT=y
1005CONFIG_SYSCTL_SYSCALL_CHECK=y
1000# CONFIG_SAMPLES is not set 1006# CONFIG_SAMPLES is not set
1001 1007
1002# 1008#
@@ -1056,6 +1062,10 @@ CONFIG_CRYPTO_CRC32C=m
1056CONFIG_CRYPTO_MD4=m 1062CONFIG_CRYPTO_MD4=m
1057CONFIG_CRYPTO_MD5=y 1063CONFIG_CRYPTO_MD5=y
1058CONFIG_CRYPTO_MICHAEL_MIC=m 1064CONFIG_CRYPTO_MICHAEL_MIC=m
1065CONFIG_CRYPTO_RMD128=m
1066CONFIG_CRYPTO_RMD160=m
1067CONFIG_CRYPTO_RMD256=m
1068CONFIG_CRYPTO_RMD320=m
1059CONFIG_CRYPTO_SHA1=m 1069CONFIG_CRYPTO_SHA1=m
1060CONFIG_CRYPTO_SHA256=m 1070CONFIG_CRYPTO_SHA256=m
1061CONFIG_CRYPTO_SHA512=m 1071CONFIG_CRYPTO_SHA512=m
@@ -1097,6 +1107,7 @@ CONFIG_BITREVERSE=y
1097# CONFIG_GENERIC_FIND_NEXT_BIT is not set 1107# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1098CONFIG_CRC_CCITT=m 1108CONFIG_CRC_CCITT=m
1099CONFIG_CRC16=m 1109CONFIG_CRC16=m
1110CONFIG_CRC_T10DIF=y
1100CONFIG_CRC_ITU_T=m 1111CONFIG_CRC_ITU_T=m
1101CONFIG_CRC32=y 1112CONFIG_CRC32=y
1102# CONFIG_CRC7 is not set 1113# CONFIG_CRC7 is not set
diff --git a/arch/m68k/configs/sun3_defconfig b/arch/m68k/configs/sun3_defconfig
index 296340d2b315..cb62b96d766e 100644
--- a/arch/m68k/configs/sun3_defconfig
+++ b/arch/m68k/configs/sun3_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc4 3# Linux kernel version: 2.6.27-rc6
4# Wed May 28 22:47:35 2008 4# Wed Sep 10 09:02:11 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,7 +52,6 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
56CONFIG_KALLSYMS=y 55CONFIG_KALLSYMS=y
57# CONFIG_KALLSYMS_EXTRA_PASS is not set 56# CONFIG_KALLSYMS_EXTRA_PASS is not set
58CONFIG_HOTPLUG=y 57CONFIG_HOTPLUG=y
@@ -75,10 +74,16 @@ CONFIG_SLAB=y
75# CONFIG_PROFILING is not set 74# CONFIG_PROFILING is not set
76# CONFIG_MARKERS is not set 75# CONFIG_MARKERS is not set
77# CONFIG_HAVE_OPROFILE is not set 76# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
78# CONFIG_HAVE_IOREMAP_PROT is not set
78# CONFIG_HAVE_KPROBES is not set 79# CONFIG_HAVE_KPROBES is not set
79# CONFIG_HAVE_KRETPROBES is not set 80# CONFIG_HAVE_KRETPROBES is not set
81# CONFIG_HAVE_ARCH_TRACEHOOK is not set
80# CONFIG_HAVE_DMA_ATTRS is not set 82# CONFIG_HAVE_DMA_ATTRS is not set
83# CONFIG_USE_GENERIC_SMP_HELPERS is not set
84# CONFIG_HAVE_CLK is not set
81CONFIG_PROC_PAGE_MONITOR=y 85CONFIG_PROC_PAGE_MONITOR=y
86# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
82CONFIG_SLABINFO=y 87CONFIG_SLABINFO=y
83CONFIG_RT_MUTEXES=y 88CONFIG_RT_MUTEXES=y
84# CONFIG_TINY_SHMEM is not set 89# CONFIG_TINY_SHMEM is not set
@@ -95,6 +100,7 @@ CONFIG_BLOCK=y
95# CONFIG_BLK_DEV_IO_TRACE is not set 100# CONFIG_BLK_DEV_IO_TRACE is not set
96# CONFIG_LSF is not set 101# CONFIG_LSF is not set
97CONFIG_BLK_DEV_BSG=y 102CONFIG_BLK_DEV_BSG=y
103# CONFIG_BLK_DEV_INTEGRITY is not set
98 104
99# 105#
100# IO Schedulers 106# IO Schedulers
@@ -149,10 +155,6 @@ CONFIG_BINFMT_MISC=m
149CONFIG_PROC_HARDWARE=y 155CONFIG_PROC_HARDWARE=y
150CONFIG_ZONE_DMA=y 156CONFIG_ZONE_DMA=y
151# CONFIG_ARCH_SUPPORTS_MSI is not set 157# CONFIG_ARCH_SUPPORTS_MSI is not set
152
153#
154# Networking
155#
156CONFIG_NET=y 158CONFIG_NET=y
157 159
158# 160#
@@ -166,6 +168,7 @@ CONFIG_XFRM=y
166# CONFIG_XFRM_SUB_POLICY is not set 168# CONFIG_XFRM_SUB_POLICY is not set
167CONFIG_XFRM_MIGRATE=y 169CONFIG_XFRM_MIGRATE=y
168# CONFIG_XFRM_STATISTICS is not set 170# CONFIG_XFRM_STATISTICS is not set
171CONFIG_XFRM_IPCOMP=m
169CONFIG_NET_KEY=y 172CONFIG_NET_KEY=y
170CONFIG_NET_KEY_MIGRATE=y 173CONFIG_NET_KEY_MIGRATE=y
171CONFIG_INET=y 174CONFIG_INET=y
@@ -399,6 +402,7 @@ CONFIG_NET_CLS_ROUTE=y
399# 402#
400# CONFIG_CFG80211 is not set 403# CONFIG_CFG80211 is not set
401CONFIG_WIRELESS_EXT=y 404CONFIG_WIRELESS_EXT=y
405# CONFIG_WIRELESS_EXT_SYSFS is not set
402# CONFIG_MAC80211 is not set 406# CONFIG_MAC80211 is not set
403CONFIG_IEEE80211=m 407CONFIG_IEEE80211=m
404# CONFIG_IEEE80211_DEBUG is not set 408# CONFIG_IEEE80211_DEBUG is not set
@@ -418,7 +422,9 @@ CONFIG_IEEE80211_CRYPT_TKIP=m
418CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 422CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
419CONFIG_STANDALONE=y 423CONFIG_STANDALONE=y
420CONFIG_PREVENT_FIRMWARE_BUILD=y 424CONFIG_PREVENT_FIRMWARE_BUILD=y
421CONFIG_FW_LOADER=m 425CONFIG_FW_LOADER=y
426# CONFIG_FIRMWARE_IN_KERNEL is not set
427CONFIG_EXTRA_FIRMWARE=""
422# CONFIG_SYS_HYPERVISOR is not set 428# CONFIG_SYS_HYPERVISOR is not set
423CONFIG_CONNECTOR=m 429CONFIG_CONNECTOR=m
424# CONFIG_MTD is not set 430# CONFIG_MTD is not set
@@ -436,6 +442,7 @@ CONFIG_CDROM_PKTCDVD=m
436CONFIG_CDROM_PKTCDVD_BUFFERS=8 442CONFIG_CDROM_PKTCDVD_BUFFERS=8
437# CONFIG_CDROM_PKTCDVD_WCACHE is not set 443# CONFIG_CDROM_PKTCDVD_WCACHE is not set
438CONFIG_ATA_OVER_ETH=m 444CONFIG_ATA_OVER_ETH=m
445# CONFIG_BLK_DEV_HD is not set
439CONFIG_MISC_DEVICES=y 446CONFIG_MISC_DEVICES=y
440# CONFIG_EEPROM_93CX6 is not set 447# CONFIG_EEPROM_93CX6 is not set
441# CONFIG_ENCLOSURE_SERVICES is not set 448# CONFIG_ENCLOSURE_SERVICES is not set
@@ -488,6 +495,7 @@ CONFIG_SCSI_LOWLEVEL=y
488CONFIG_ISCSI_TCP=m 495CONFIG_ISCSI_TCP=m
489# CONFIG_SCSI_DEBUG is not set 496# CONFIG_SCSI_DEBUG is not set
490CONFIG_SUN3_SCSI=y 497CONFIG_SUN3_SCSI=y
498# CONFIG_SCSI_DH is not set
491CONFIG_MD=y 499CONFIG_MD=y
492CONFIG_BLK_DEV_MD=m 500CONFIG_BLK_DEV_MD=m
493CONFIG_MD_LINEAR=m 501CONFIG_MD_LINEAR=m
@@ -496,7 +504,7 @@ CONFIG_MD_RAID1=m
496# CONFIG_MD_RAID10 is not set 504# CONFIG_MD_RAID10 is not set
497CONFIG_MD_RAID456=m 505CONFIG_MD_RAID456=m
498CONFIG_MD_RAID5_RESHAPE=y 506CONFIG_MD_RAID5_RESHAPE=y
499CONFIG_MD_MULTIPATH=m 507# CONFIG_MD_MULTIPATH is not set
500# CONFIG_MD_FAULTY is not set 508# CONFIG_MD_FAULTY is not set
501CONFIG_BLK_DEV_DM=m 509CONFIG_BLK_DEV_DM=m
502# CONFIG_DM_DEBUG is not set 510# CONFIG_DM_DEBUG is not set
@@ -505,13 +513,9 @@ CONFIG_DM_SNAPSHOT=m
505CONFIG_DM_MIRROR=m 513CONFIG_DM_MIRROR=m
506CONFIG_DM_ZERO=m 514CONFIG_DM_ZERO=m
507CONFIG_DM_MULTIPATH=m 515CONFIG_DM_MULTIPATH=m
508CONFIG_DM_MULTIPATH_EMC=m
509CONFIG_DM_MULTIPATH_RDAC=m
510CONFIG_DM_MULTIPATH_HP=m
511# CONFIG_DM_DELAY is not set 516# CONFIG_DM_DELAY is not set
512CONFIG_DM_UEVENT=y 517CONFIG_DM_UEVENT=y
513CONFIG_NETDEVICES=y 518CONFIG_NETDEVICES=y
514# CONFIG_NETDEVICES_MULTIQUEUE is not set
515CONFIG_DUMMY=m 519CONFIG_DUMMY=m
516# CONFIG_BONDING is not set 520# CONFIG_BONDING is not set
517CONFIG_MACVLAN=m 521CONFIG_MACVLAN=m
@@ -527,7 +531,6 @@ CONFIG_SUN3_82586=y
527# CONFIG_IBM_NEW_EMAC_RGMII is not set 531# CONFIG_IBM_NEW_EMAC_RGMII is not set
528# CONFIG_IBM_NEW_EMAC_TAH is not set 532# CONFIG_IBM_NEW_EMAC_TAH is not set
529# CONFIG_IBM_NEW_EMAC_EMAC4 is not set 533# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
530# CONFIG_B44 is not set
531# CONFIG_NETDEV_1000 is not set 534# CONFIG_NETDEV_1000 is not set
532# CONFIG_NETDEV_10000 is not set 535# CONFIG_NETDEV_10000 is not set
533 536
@@ -617,6 +620,7 @@ CONFIG_SERIO_LIBPS2=m
617# Character devices 620# Character devices
618# 621#
619CONFIG_VT=y 622CONFIG_VT=y
623CONFIG_CONSOLE_TRANSLATIONS=y
620CONFIG_VT_CONSOLE=y 624CONFIG_VT_CONSOLE=y
621CONFIG_HW_CONSOLE=y 625CONFIG_HW_CONSOLE=y
622CONFIG_VT_HW_CONSOLE_BINDING=y 626CONFIG_VT_HW_CONSOLE_BINDING=y
@@ -647,19 +651,20 @@ CONFIG_GEN_RTC_X=y
647# CONFIG_POWER_SUPPLY is not set 651# CONFIG_POWER_SUPPLY is not set
648# CONFIG_HWMON is not set 652# CONFIG_HWMON is not set
649# CONFIG_THERMAL is not set 653# CONFIG_THERMAL is not set
654# CONFIG_THERMAL_HWMON is not set
650# CONFIG_WATCHDOG is not set 655# CONFIG_WATCHDOG is not set
651 656
652# 657#
653# Sonics Silicon Backplane 658# Sonics Silicon Backplane
654# 659#
655CONFIG_SSB_POSSIBLE=y
656# CONFIG_SSB is not set
657 660
658# 661#
659# Multifunction device drivers 662# Multifunction device drivers
660# 663#
664# CONFIG_MFD_CORE is not set
661# CONFIG_MFD_SM501 is not set 665# CONFIG_MFD_SM501 is not set
662# CONFIG_HTC_PASIC3 is not set 666# CONFIG_HTC_PASIC3 is not set
667# CONFIG_MFD_TMIO is not set
663 668
664# 669#
665# Multimedia devices 670# Multimedia devices
@@ -727,10 +732,6 @@ CONFIG_LOGO=y
727CONFIG_LOGO_LINUX_MONO=y 732CONFIG_LOGO_LINUX_MONO=y
728CONFIG_LOGO_LINUX_VGA16=y 733CONFIG_LOGO_LINUX_VGA16=y
729CONFIG_LOGO_LINUX_CLUT224=y 734CONFIG_LOGO_LINUX_CLUT224=y
730
731#
732# Sound
733#
734# CONFIG_SOUND is not set 735# CONFIG_SOUND is not set
735CONFIG_HID_SUPPORT=y 736CONFIG_HID_SUPPORT=y
736CONFIG_HID=m 737CONFIG_HID=m
@@ -776,6 +777,7 @@ CONFIG_XFS_FS=m
776CONFIG_OCFS2_FS=m 777CONFIG_OCFS2_FS=m
777CONFIG_OCFS2_FS_O2CB=m 778CONFIG_OCFS2_FS_O2CB=m
778CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m 779CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
780# CONFIG_OCFS2_FS_STATS is not set
779# CONFIG_OCFS2_DEBUG_MASKLOG is not set 781# CONFIG_OCFS2_DEBUG_MASKLOG is not set
780# CONFIG_OCFS2_DEBUG_FS is not set 782# CONFIG_OCFS2_DEBUG_FS is not set
781CONFIG_DNOTIFY=y 783CONFIG_DNOTIFY=y
@@ -835,6 +837,7 @@ CONFIG_HFSPLUS_FS=m
835CONFIG_CRAMFS=m 837CONFIG_CRAMFS=m
836# CONFIG_VXFS_FS is not set 838# CONFIG_VXFS_FS is not set
837CONFIG_MINIX_FS=y 839CONFIG_MINIX_FS=y
840# CONFIG_OMFS_FS is not set
838CONFIG_HPFS_FS=m 841CONFIG_HPFS_FS=m
839# CONFIG_QNX4FS_FS is not set 842# CONFIG_QNX4FS_FS is not set
840# CONFIG_ROMFS_FS is not set 843# CONFIG_ROMFS_FS is not set
@@ -847,18 +850,17 @@ CONFIG_NFS_FS=y
847CONFIG_NFS_V3=y 850CONFIG_NFS_V3=y
848# CONFIG_NFS_V3_ACL is not set 851# CONFIG_NFS_V3_ACL is not set
849CONFIG_NFS_V4=y 852CONFIG_NFS_V4=y
853CONFIG_ROOT_NFS=y
850CONFIG_NFSD=m 854CONFIG_NFSD=m
851CONFIG_NFSD_V3=y 855CONFIG_NFSD_V3=y
852# CONFIG_NFSD_V3_ACL is not set 856# CONFIG_NFSD_V3_ACL is not set
853# CONFIG_NFSD_V4 is not set 857# CONFIG_NFSD_V4 is not set
854CONFIG_ROOT_NFS=y
855CONFIG_LOCKD=y 858CONFIG_LOCKD=y
856CONFIG_LOCKD_V4=y 859CONFIG_LOCKD_V4=y
857CONFIG_EXPORTFS=m 860CONFIG_EXPORTFS=m
858CONFIG_NFS_COMMON=y 861CONFIG_NFS_COMMON=y
859CONFIG_SUNRPC=y 862CONFIG_SUNRPC=y
860CONFIG_SUNRPC_GSS=y 863CONFIG_SUNRPC_GSS=y
861CONFIG_SUNRPC_BIND34=y
862CONFIG_RPCSEC_GSS_KRB5=y 864CONFIG_RPCSEC_GSS_KRB5=y
863# CONFIG_RPCSEC_GSS_SPKM3 is not set 865# CONFIG_RPCSEC_GSS_SPKM3 is not set
864CONFIG_SMB_FS=m 866CONFIG_SMB_FS=m
@@ -867,7 +869,6 @@ CONFIG_SMB_NLS_REMOTE="cp437"
867# CONFIG_CIFS is not set 869# CONFIG_CIFS is not set
868# CONFIG_NCP_FS is not set 870# CONFIG_NCP_FS is not set
869CONFIG_CODA_FS=m 871CONFIG_CODA_FS=m
870# CONFIG_CODA_FS_OLD_API is not set
871# CONFIG_AFS_FS is not set 872# CONFIG_AFS_FS is not set
872 873
873# 874#
@@ -932,6 +933,8 @@ CONFIG_MAGIC_SYSRQ=y
932# CONFIG_HEADERS_CHECK is not set 933# CONFIG_HEADERS_CHECK is not set
933# CONFIG_DEBUG_KERNEL is not set 934# CONFIG_DEBUG_KERNEL is not set
934CONFIG_DEBUG_BUGVERBOSE=y 935CONFIG_DEBUG_BUGVERBOSE=y
936CONFIG_DEBUG_MEMORY_INIT=y
937CONFIG_SYSCTL_SYSCALL_CHECK=y
935# CONFIG_SAMPLES is not set 938# CONFIG_SAMPLES is not set
936 939
937# 940#
@@ -991,6 +994,10 @@ CONFIG_CRYPTO_CRC32C=m
991CONFIG_CRYPTO_MD4=m 994CONFIG_CRYPTO_MD4=m
992CONFIG_CRYPTO_MD5=y 995CONFIG_CRYPTO_MD5=y
993CONFIG_CRYPTO_MICHAEL_MIC=m 996CONFIG_CRYPTO_MICHAEL_MIC=m
997CONFIG_CRYPTO_RMD128=m
998CONFIG_CRYPTO_RMD160=m
999CONFIG_CRYPTO_RMD256=m
1000CONFIG_CRYPTO_RMD320=m
994CONFIG_CRYPTO_SHA1=m 1001CONFIG_CRYPTO_SHA1=m
995CONFIG_CRYPTO_SHA256=m 1002CONFIG_CRYPTO_SHA256=m
996CONFIG_CRYPTO_SHA512=m 1003CONFIG_CRYPTO_SHA512=m
@@ -1032,6 +1039,7 @@ CONFIG_BITREVERSE=y
1032# CONFIG_GENERIC_FIND_NEXT_BIT is not set 1039# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1033CONFIG_CRC_CCITT=m 1040CONFIG_CRC_CCITT=m
1034CONFIG_CRC16=m 1041CONFIG_CRC16=m
1042CONFIG_CRC_T10DIF=y
1035CONFIG_CRC_ITU_T=m 1043CONFIG_CRC_ITU_T=m
1036CONFIG_CRC32=y 1044CONFIG_CRC32=y
1037# CONFIG_CRC7 is not set 1045# CONFIG_CRC7 is not set
diff --git a/arch/m68k/configs/sun3x_defconfig b/arch/m68k/configs/sun3x_defconfig
index 8d3a416c92bf..04b4363a7050 100644
--- a/arch/m68k/configs/sun3x_defconfig
+++ b/arch/m68k/configs/sun3x_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26-rc4 3# Linux kernel version: 2.6.27-rc6
4# Wed May 28 22:47:35 2008 4# Wed Sep 10 09:02:12 2008
5# 5#
6CONFIG_M68K=y 6CONFIG_M68K=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -52,7 +52,6 @@ CONFIG_SYSCTL=y
52# CONFIG_EMBEDDED is not set 52# CONFIG_EMBEDDED is not set
53CONFIG_UID16=y 53CONFIG_UID16=y
54CONFIG_SYSCTL_SYSCALL=y 54CONFIG_SYSCTL_SYSCALL=y
55CONFIG_SYSCTL_SYSCALL_CHECK=y
56CONFIG_KALLSYMS=y 55CONFIG_KALLSYMS=y
57# CONFIG_KALLSYMS_EXTRA_PASS is not set 56# CONFIG_KALLSYMS_EXTRA_PASS is not set
58CONFIG_HOTPLUG=y 57CONFIG_HOTPLUG=y
@@ -75,10 +74,16 @@ CONFIG_SLAB=y
75# CONFIG_PROFILING is not set 74# CONFIG_PROFILING is not set
76# CONFIG_MARKERS is not set 75# CONFIG_MARKERS is not set
77# CONFIG_HAVE_OPROFILE is not set 76# CONFIG_HAVE_OPROFILE is not set
77# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
78# CONFIG_HAVE_IOREMAP_PROT is not set
78# CONFIG_HAVE_KPROBES is not set 79# CONFIG_HAVE_KPROBES is not set
79# CONFIG_HAVE_KRETPROBES is not set 80# CONFIG_HAVE_KRETPROBES is not set
81# CONFIG_HAVE_ARCH_TRACEHOOK is not set
80# CONFIG_HAVE_DMA_ATTRS is not set 82# CONFIG_HAVE_DMA_ATTRS is not set
83# CONFIG_USE_GENERIC_SMP_HELPERS is not set
84# CONFIG_HAVE_CLK is not set
81CONFIG_PROC_PAGE_MONITOR=y 85CONFIG_PROC_PAGE_MONITOR=y
86# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
82CONFIG_SLABINFO=y 87CONFIG_SLABINFO=y
83CONFIG_RT_MUTEXES=y 88CONFIG_RT_MUTEXES=y
84# CONFIG_TINY_SHMEM is not set 89# CONFIG_TINY_SHMEM is not set
@@ -95,6 +100,7 @@ CONFIG_BLOCK=y
95# CONFIG_BLK_DEV_IO_TRACE is not set 100# CONFIG_BLK_DEV_IO_TRACE is not set
96# CONFIG_LSF is not set 101# CONFIG_LSF is not set
97CONFIG_BLK_DEV_BSG=y 102CONFIG_BLK_DEV_BSG=y
103# CONFIG_BLK_DEV_INTEGRITY is not set
98 104
99# 105#
100# IO Schedulers 106# IO Schedulers
@@ -160,10 +166,6 @@ CONFIG_BINFMT_MISC=m
160CONFIG_PROC_HARDWARE=y 166CONFIG_PROC_HARDWARE=y
161CONFIG_ZONE_DMA=y 167CONFIG_ZONE_DMA=y
162# CONFIG_ARCH_SUPPORTS_MSI is not set 168# CONFIG_ARCH_SUPPORTS_MSI is not set
163
164#
165# Networking
166#
167CONFIG_NET=y 169CONFIG_NET=y
168 170
169# 171#
@@ -177,6 +179,7 @@ CONFIG_XFRM=y
177# CONFIG_XFRM_SUB_POLICY is not set 179# CONFIG_XFRM_SUB_POLICY is not set
178CONFIG_XFRM_MIGRATE=y 180CONFIG_XFRM_MIGRATE=y
179# CONFIG_XFRM_STATISTICS is not set 181# CONFIG_XFRM_STATISTICS is not set
182CONFIG_XFRM_IPCOMP=m
180CONFIG_NET_KEY=y 183CONFIG_NET_KEY=y
181CONFIG_NET_KEY_MIGRATE=y 184CONFIG_NET_KEY_MIGRATE=y
182CONFIG_INET=y 185CONFIG_INET=y
@@ -410,6 +413,7 @@ CONFIG_NET_CLS_ROUTE=y
410# 413#
411# CONFIG_CFG80211 is not set 414# CONFIG_CFG80211 is not set
412CONFIG_WIRELESS_EXT=y 415CONFIG_WIRELESS_EXT=y
416# CONFIG_WIRELESS_EXT_SYSFS is not set
413# CONFIG_MAC80211 is not set 417# CONFIG_MAC80211 is not set
414CONFIG_IEEE80211=m 418CONFIG_IEEE80211=m
415# CONFIG_IEEE80211_DEBUG is not set 419# CONFIG_IEEE80211_DEBUG is not set
@@ -429,7 +433,9 @@ CONFIG_IEEE80211_CRYPT_TKIP=m
429CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 433CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
430CONFIG_STANDALONE=y 434CONFIG_STANDALONE=y
431CONFIG_PREVENT_FIRMWARE_BUILD=y 435CONFIG_PREVENT_FIRMWARE_BUILD=y
432CONFIG_FW_LOADER=m 436CONFIG_FW_LOADER=y
437# CONFIG_FIRMWARE_IN_KERNEL is not set
438CONFIG_EXTRA_FIRMWARE=""
433# CONFIG_SYS_HYPERVISOR is not set 439# CONFIG_SYS_HYPERVISOR is not set
434CONFIG_CONNECTOR=m 440CONFIG_CONNECTOR=m
435# CONFIG_MTD is not set 441# CONFIG_MTD is not set
@@ -447,6 +453,7 @@ CONFIG_CDROM_PKTCDVD=m
447CONFIG_CDROM_PKTCDVD_BUFFERS=8 453CONFIG_CDROM_PKTCDVD_BUFFERS=8
448# CONFIG_CDROM_PKTCDVD_WCACHE is not set 454# CONFIG_CDROM_PKTCDVD_WCACHE is not set
449CONFIG_ATA_OVER_ETH=m 455CONFIG_ATA_OVER_ETH=m
456# CONFIG_BLK_DEV_HD is not set
450CONFIG_MISC_DEVICES=y 457CONFIG_MISC_DEVICES=y
451# CONFIG_EEPROM_93CX6 is not set 458# CONFIG_EEPROM_93CX6 is not set
452# CONFIG_ENCLOSURE_SERVICES is not set 459# CONFIG_ENCLOSURE_SERVICES is not set
@@ -499,6 +506,7 @@ CONFIG_SCSI_LOWLEVEL=y
499CONFIG_ISCSI_TCP=m 506CONFIG_ISCSI_TCP=m
500# CONFIG_SCSI_DEBUG is not set 507# CONFIG_SCSI_DEBUG is not set
501CONFIG_SUN3X_ESP=y 508CONFIG_SUN3X_ESP=y
509# CONFIG_SCSI_DH is not set
502CONFIG_MD=y 510CONFIG_MD=y
503CONFIG_BLK_DEV_MD=m 511CONFIG_BLK_DEV_MD=m
504CONFIG_MD_LINEAR=m 512CONFIG_MD_LINEAR=m
@@ -507,7 +515,7 @@ CONFIG_MD_RAID1=m
507# CONFIG_MD_RAID10 is not set 515# CONFIG_MD_RAID10 is not set
508CONFIG_MD_RAID456=m 516CONFIG_MD_RAID456=m
509CONFIG_MD_RAID5_RESHAPE=y 517CONFIG_MD_RAID5_RESHAPE=y
510CONFIG_MD_MULTIPATH=m 518# CONFIG_MD_MULTIPATH is not set
511# CONFIG_MD_FAULTY is not set 519# CONFIG_MD_FAULTY is not set
512CONFIG_BLK_DEV_DM=m 520CONFIG_BLK_DEV_DM=m
513# CONFIG_DM_DEBUG is not set 521# CONFIG_DM_DEBUG is not set
@@ -516,13 +524,9 @@ CONFIG_DM_SNAPSHOT=m
516CONFIG_DM_MIRROR=m 524CONFIG_DM_MIRROR=m
517CONFIG_DM_ZERO=m 525CONFIG_DM_ZERO=m
518CONFIG_DM_MULTIPATH=m 526CONFIG_DM_MULTIPATH=m
519CONFIG_DM_MULTIPATH_EMC=m
520CONFIG_DM_MULTIPATH_RDAC=m
521CONFIG_DM_MULTIPATH_HP=m
522# CONFIG_DM_DELAY is not set 527# CONFIG_DM_DELAY is not set
523CONFIG_DM_UEVENT=y 528CONFIG_DM_UEVENT=y
524CONFIG_NETDEVICES=y 529CONFIG_NETDEVICES=y
525# CONFIG_NETDEVICES_MULTIQUEUE is not set
526CONFIG_DUMMY=m 530CONFIG_DUMMY=m
527# CONFIG_BONDING is not set 531# CONFIG_BONDING is not set
528CONFIG_MACVLAN=m 532CONFIG_MACVLAN=m
@@ -627,6 +631,7 @@ CONFIG_SERIO_LIBPS2=m
627# Character devices 631# Character devices
628# 632#
629CONFIG_VT=y 633CONFIG_VT=y
634CONFIG_CONSOLE_TRANSLATIONS=y
630CONFIG_VT_CONSOLE=y 635CONFIG_VT_CONSOLE=y
631CONFIG_HW_CONSOLE=y 636CONFIG_HW_CONSOLE=y
632CONFIG_VT_HW_CONSOLE_BINDING=y 637CONFIG_VT_HW_CONSOLE_BINDING=y
@@ -657,6 +662,7 @@ CONFIG_GEN_RTC_X=y
657# CONFIG_POWER_SUPPLY is not set 662# CONFIG_POWER_SUPPLY is not set
658# CONFIG_HWMON is not set 663# CONFIG_HWMON is not set
659# CONFIG_THERMAL is not set 664# CONFIG_THERMAL is not set
665# CONFIG_THERMAL_HWMON is not set
660# CONFIG_WATCHDOG is not set 666# CONFIG_WATCHDOG is not set
661 667
662# 668#
@@ -668,8 +674,10 @@ CONFIG_SSB_POSSIBLE=y
668# 674#
669# Multifunction device drivers 675# Multifunction device drivers
670# 676#
677# CONFIG_MFD_CORE is not set
671# CONFIG_MFD_SM501 is not set 678# CONFIG_MFD_SM501 is not set
672# CONFIG_HTC_PASIC3 is not set 679# CONFIG_HTC_PASIC3 is not set
680# CONFIG_MFD_TMIO is not set
673 681
674# 682#
675# Multimedia devices 683# Multimedia devices
@@ -737,10 +745,6 @@ CONFIG_LOGO=y
737CONFIG_LOGO_LINUX_MONO=y 745CONFIG_LOGO_LINUX_MONO=y
738CONFIG_LOGO_LINUX_VGA16=y 746CONFIG_LOGO_LINUX_VGA16=y
739CONFIG_LOGO_LINUX_CLUT224=y 747CONFIG_LOGO_LINUX_CLUT224=y
740
741#
742# Sound
743#
744# CONFIG_SOUND is not set 748# CONFIG_SOUND is not set
745CONFIG_HID_SUPPORT=y 749CONFIG_HID_SUPPORT=y
746CONFIG_HID=m 750CONFIG_HID=m
@@ -752,6 +756,7 @@ CONFIG_HIDRAW=y
752# CONFIG_NEW_LEDS is not set 756# CONFIG_NEW_LEDS is not set
753# CONFIG_ACCESSIBILITY is not set 757# CONFIG_ACCESSIBILITY is not set
754# CONFIG_RTC_CLASS is not set 758# CONFIG_RTC_CLASS is not set
759# CONFIG_DMADEVICES is not set
755# CONFIG_UIO is not set 760# CONFIG_UIO is not set
756 761
757# 762#
@@ -786,6 +791,7 @@ CONFIG_XFS_FS=m
786CONFIG_OCFS2_FS=m 791CONFIG_OCFS2_FS=m
787CONFIG_OCFS2_FS_O2CB=m 792CONFIG_OCFS2_FS_O2CB=m
788CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m 793CONFIG_OCFS2_FS_USERSPACE_CLUSTER=m
794# CONFIG_OCFS2_FS_STATS is not set
789# CONFIG_OCFS2_DEBUG_MASKLOG is not set 795# CONFIG_OCFS2_DEBUG_MASKLOG is not set
790# CONFIG_OCFS2_DEBUG_FS is not set 796# CONFIG_OCFS2_DEBUG_FS is not set
791CONFIG_DNOTIFY=y 797CONFIG_DNOTIFY=y
@@ -845,6 +851,7 @@ CONFIG_HFSPLUS_FS=m
845CONFIG_CRAMFS=m 851CONFIG_CRAMFS=m
846# CONFIG_VXFS_FS is not set 852# CONFIG_VXFS_FS is not set
847CONFIG_MINIX_FS=y 853CONFIG_MINIX_FS=y
854# CONFIG_OMFS_FS is not set
848CONFIG_HPFS_FS=m 855CONFIG_HPFS_FS=m
849# CONFIG_QNX4FS_FS is not set 856# CONFIG_QNX4FS_FS is not set
850# CONFIG_ROMFS_FS is not set 857# CONFIG_ROMFS_FS is not set
@@ -857,18 +864,17 @@ CONFIG_NFS_FS=y
857CONFIG_NFS_V3=y 864CONFIG_NFS_V3=y
858# CONFIG_NFS_V3_ACL is not set 865# CONFIG_NFS_V3_ACL is not set
859CONFIG_NFS_V4=y 866CONFIG_NFS_V4=y
867CONFIG_ROOT_NFS=y
860CONFIG_NFSD=m 868CONFIG_NFSD=m
861CONFIG_NFSD_V3=y 869CONFIG_NFSD_V3=y
862# CONFIG_NFSD_V3_ACL is not set 870# CONFIG_NFSD_V3_ACL is not set
863# CONFIG_NFSD_V4 is not set 871# CONFIG_NFSD_V4 is not set
864CONFIG_ROOT_NFS=y
865CONFIG_LOCKD=y 872CONFIG_LOCKD=y
866CONFIG_LOCKD_V4=y 873CONFIG_LOCKD_V4=y
867CONFIG_EXPORTFS=m 874CONFIG_EXPORTFS=m
868CONFIG_NFS_COMMON=y 875CONFIG_NFS_COMMON=y
869CONFIG_SUNRPC=y 876CONFIG_SUNRPC=y
870CONFIG_SUNRPC_GSS=y 877CONFIG_SUNRPC_GSS=y
871CONFIG_SUNRPC_BIND34=y
872CONFIG_RPCSEC_GSS_KRB5=y 878CONFIG_RPCSEC_GSS_KRB5=y
873# CONFIG_RPCSEC_GSS_SPKM3 is not set 879# CONFIG_RPCSEC_GSS_SPKM3 is not set
874CONFIG_SMB_FS=m 880CONFIG_SMB_FS=m
@@ -877,7 +883,6 @@ CONFIG_SMB_NLS_REMOTE="cp437"
877# CONFIG_CIFS is not set 883# CONFIG_CIFS is not set
878# CONFIG_NCP_FS is not set 884# CONFIG_NCP_FS is not set
879CONFIG_CODA_FS=m 885CONFIG_CODA_FS=m
880# CONFIG_CODA_FS_OLD_API is not set
881# CONFIG_AFS_FS is not set 886# CONFIG_AFS_FS is not set
882 887
883# 888#
@@ -942,6 +947,8 @@ CONFIG_MAGIC_SYSRQ=y
942# CONFIG_HEADERS_CHECK is not set 947# CONFIG_HEADERS_CHECK is not set
943# CONFIG_DEBUG_KERNEL is not set 948# CONFIG_DEBUG_KERNEL is not set
944CONFIG_DEBUG_BUGVERBOSE=y 949CONFIG_DEBUG_BUGVERBOSE=y
950CONFIG_DEBUG_MEMORY_INIT=y
951CONFIG_SYSCTL_SYSCALL_CHECK=y
945# CONFIG_SAMPLES is not set 952# CONFIG_SAMPLES is not set
946 953
947# 954#
@@ -1001,6 +1008,10 @@ CONFIG_CRYPTO_CRC32C=m
1001CONFIG_CRYPTO_MD4=m 1008CONFIG_CRYPTO_MD4=m
1002CONFIG_CRYPTO_MD5=y 1009CONFIG_CRYPTO_MD5=y
1003CONFIG_CRYPTO_MICHAEL_MIC=m 1010CONFIG_CRYPTO_MICHAEL_MIC=m
1011CONFIG_CRYPTO_RMD128=m
1012CONFIG_CRYPTO_RMD160=m
1013CONFIG_CRYPTO_RMD256=m
1014CONFIG_CRYPTO_RMD320=m
1004CONFIG_CRYPTO_SHA1=m 1015CONFIG_CRYPTO_SHA1=m
1005CONFIG_CRYPTO_SHA256=m 1016CONFIG_CRYPTO_SHA256=m
1006CONFIG_CRYPTO_SHA512=m 1017CONFIG_CRYPTO_SHA512=m
@@ -1042,6 +1053,7 @@ CONFIG_BITREVERSE=y
1042# CONFIG_GENERIC_FIND_NEXT_BIT is not set 1053# CONFIG_GENERIC_FIND_NEXT_BIT is not set
1043CONFIG_CRC_CCITT=m 1054CONFIG_CRC_CCITT=m
1044CONFIG_CRC16=m 1055CONFIG_CRC16=m
1056CONFIG_CRC_T10DIF=y
1045CONFIG_CRC_ITU_T=m 1057CONFIG_CRC_ITU_T=m
1046CONFIG_CRC32=y 1058CONFIG_CRC32=y
1047# CONFIG_CRC7 is not set 1059# CONFIG_CRC7 is not set
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 49896a2a1d72..1e06d233fa83 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -211,6 +211,7 @@ config MIPS_MALTA
211 select SYS_SUPPORTS_64BIT_KERNEL 211 select SYS_SUPPORTS_64BIT_KERNEL
212 select SYS_SUPPORTS_BIG_ENDIAN 212 select SYS_SUPPORTS_BIG_ENDIAN
213 select SYS_SUPPORTS_LITTLE_ENDIAN 213 select SYS_SUPPORTS_LITTLE_ENDIAN
214 select SYS_SUPPORTS_MIPS_CMP if BROKEN # because SYNC_R4K is broken
214 select SYS_SUPPORTS_MULTITHREADING 215 select SYS_SUPPORTS_MULTITHREADING
215 select SYS_SUPPORTS_SMARTMIPS 216 select SYS_SUPPORTS_SMARTMIPS
216 help 217 help
@@ -1403,7 +1404,6 @@ config MIPS_MT_SMTC
1403 depends on CPU_MIPS32_R2 1404 depends on CPU_MIPS32_R2
1404 #depends on CPU_MIPS64_R2 # once there is hardware ... 1405 #depends on CPU_MIPS64_R2 # once there is hardware ...
1405 depends on SYS_SUPPORTS_MULTITHREADING 1406 depends on SYS_SUPPORTS_MULTITHREADING
1406 select GENERIC_CLOCKEVENTS_BROADCAST
1407 select CPU_MIPSR2_IRQ_VI 1407 select CPU_MIPSR2_IRQ_VI
1408 select CPU_MIPSR2_IRQ_EI 1408 select CPU_MIPSR2_IRQ_EI
1409 select MIPS_MT 1409 select MIPS_MT
@@ -1451,32 +1451,17 @@ config MIPS_VPE_LOADER
1451 Includes a loader for loading an elf relocatable object 1451 Includes a loader for loading an elf relocatable object
1452 onto another VPE and running it. 1452 onto another VPE and running it.
1453 1453
1454config MIPS_MT_SMTC_INSTANT_REPLAY
1455 bool "Low-latency Dispatch of Deferred SMTC IPIs"
1456 depends on MIPS_MT_SMTC && !PREEMPT
1457 default y
1458 help
1459 SMTC pseudo-interrupts between TCs are deferred and queued
1460 if the target TC is interrupt-inhibited (IXMT). In the first
1461 SMTC prototypes, these queued IPIs were serviced on return
1462 to user mode, or on entry into the kernel idle loop. The
1463 INSTANT_REPLAY option dispatches them as part of local_irq_restore()
1464 processing, which adds runtime overhead (hence the option to turn
1465 it off), but ensures that IPIs are handled promptly even under
1466 heavy I/O interrupt load.
1467
1468config MIPS_MT_SMTC_IM_BACKSTOP 1454config MIPS_MT_SMTC_IM_BACKSTOP
1469 bool "Use per-TC register bits as backstop for inhibited IM bits" 1455 bool "Use per-TC register bits as backstop for inhibited IM bits"
1470 depends on MIPS_MT_SMTC 1456 depends on MIPS_MT_SMTC
1471 default y 1457 default n
1472 help 1458 help
1473 To support multiple TC microthreads acting as "CPUs" within 1459 To support multiple TC microthreads acting as "CPUs" within
1474 a VPE, VPE-wide interrupt mask bits must be specially manipulated 1460 a VPE, VPE-wide interrupt mask bits must be specially manipulated
1475 during interrupt handling. To support legacy drivers and interrupt 1461 during interrupt handling. To support legacy drivers and interrupt
1476 controller management code, SMTC has a "backstop" to track and 1462 controller management code, SMTC has a "backstop" to track and
1477 if necessary restore the interrupt mask. This has some performance 1463 if necessary restore the interrupt mask. This has some performance
1478 impact on interrupt service overhead. Disable it only if you know 1464 impact on interrupt service overhead.
1479 what you are doing.
1480 1465
1481config MIPS_MT_SMTC_IRQAFF 1466config MIPS_MT_SMTC_IRQAFF
1482 bool "Support IRQ affinity API" 1467 bool "Support IRQ affinity API"
@@ -1486,10 +1471,8 @@ config MIPS_MT_SMTC_IRQAFF
1486 Enables SMP IRQ affinity API (/proc/irq/*/smp_affinity, etc.) 1471 Enables SMP IRQ affinity API (/proc/irq/*/smp_affinity, etc.)
1487 for SMTC Linux kernel. Requires platform support, of which 1472 for SMTC Linux kernel. Requires platform support, of which
1488 an example can be found in the MIPS kernel i8259 and Malta 1473 an example can be found in the MIPS kernel i8259 and Malta
1489 platform code. It is recommended that MIPS_MT_SMTC_INSTANT_REPLAY 1474 platform code. Adds some overhead to interrupt dispatch, and
1490 be enabled if MIPS_MT_SMTC_IRQAFF is used. Adds overhead to 1475 should be used only if you know what you are doing.
1491 interrupt dispatch, and should be used only if you know what
1492 you are doing.
1493 1476
1494config MIPS_VPE_LOADER_TOM 1477config MIPS_VPE_LOADER_TOM
1495 bool "Load VPE program into memory hidden from linux" 1478 bool "Load VPE program into memory hidden from linux"
@@ -1517,6 +1500,18 @@ config MIPS_APSP_KSPD
1517 "exit" syscall notifying other kernel modules the SP program is 1500 "exit" syscall notifying other kernel modules the SP program is
1518 exiting. You probably want to say yes here. 1501 exiting. You probably want to say yes here.
1519 1502
1503config MIPS_CMP
1504 bool "MIPS CMP framework support"
1505 depends on SYS_SUPPORTS_MIPS_CMP
1506 select SYNC_R4K if BROKEN
1507 select SYS_SUPPORTS_SMP
1508 select SYS_SUPPORTS_SCHED_SMT if SMP
1509 select WEAK_ORDERING
1510 default n
1511 help
1512 This is a placeholder option for the GCMP work. It will need to
1513 be handled differently...
1514
1520config SB1_PASS_1_WORKAROUNDS 1515config SB1_PASS_1_WORKAROUNDS
1521 bool 1516 bool
1522 depends on CPU_SB1_PASS_1 1517 depends on CPU_SB1_PASS_1
@@ -1693,6 +1688,9 @@ config SMP
1693config SMP_UP 1688config SMP_UP
1694 bool 1689 bool
1695 1690
1691config SYS_SUPPORTS_MIPS_CMP
1692 bool
1693
1696config SYS_SUPPORTS_SMP 1694config SYS_SUPPORTS_SMP
1697 bool 1695 bool
1698 1696
@@ -1740,17 +1738,6 @@ config NR_CPUS
1740 performance should round up your number of processors to the next 1738 performance should round up your number of processors to the next
1741 power of two. 1739 power of two.
1742 1740
1743config MIPS_CMP
1744 bool "MIPS CMP framework support"
1745 depends on SMP
1746 select SYNC_R4K
1747 select SYS_SUPPORTS_SCHED_SMT
1748 select WEAK_ORDERING
1749 default n
1750 help
1751 This is a placeholder option for the GCMP work. It will need to
1752 be handled differently...
1753
1754source "kernel/time/Kconfig" 1741source "kernel/time/Kconfig"
1755 1742
1756# 1743#
diff --git a/arch/mips/au1000/common/gpio.c b/arch/mips/au1000/common/gpio.c
index b485d94ce8a5..e660ddd611c4 100644
--- a/arch/mips/au1000/common/gpio.c
+++ b/arch/mips/au1000/common/gpio.c
@@ -48,7 +48,7 @@ static void au1xxx_gpio2_write(unsigned gpio, int value)
48{ 48{
49 gpio -= AU1XXX_GPIO_BASE; 49 gpio -= AU1XXX_GPIO_BASE;
50 50
51 gpio2->output = (GPIO2_OUTPUT_ENABLE_MASK << gpio) | (value << gpio); 51 gpio2->output = (GPIO2_OUTPUT_ENABLE_MASK << gpio) | ((!!value) << gpio);
52} 52}
53 53
54static int au1xxx_gpio2_direction_input(unsigned gpio) 54static int au1xxx_gpio2_direction_input(unsigned gpio)
@@ -61,7 +61,8 @@ static int au1xxx_gpio2_direction_input(unsigned gpio)
61static int au1xxx_gpio2_direction_output(unsigned gpio, int value) 61static int au1xxx_gpio2_direction_output(unsigned gpio, int value)
62{ 62{
63 gpio -= AU1XXX_GPIO_BASE; 63 gpio -= AU1XXX_GPIO_BASE;
64 gpio2->dir = (0x01 << gpio) | (value << gpio); 64 gpio2->dir |= 0x01 << gpio;
65 gpio2->output = (GPIO2_OUTPUT_ENABLE_MASK << gpio) | ((!!value) << gpio);
65 return 0; 66 return 0;
66} 67}
67 68
@@ -90,6 +91,7 @@ static int au1xxx_gpio1_direction_input(unsigned gpio)
90static int au1xxx_gpio1_direction_output(unsigned gpio, int value) 91static int au1xxx_gpio1_direction_output(unsigned gpio, int value)
91{ 92{
92 gpio1->trioutclr = (0x01 & gpio); 93 gpio1->trioutclr = (0x01 & gpio);
94 au1xxx_gpio1_write(gpio, value);
93 return 0; 95 return 0;
94} 96}
95 97
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 706f93974797..25775cb54000 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -10,6 +10,7 @@ obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \
10 10
11obj-$(CONFIG_CEVT_BCM1480) += cevt-bcm1480.o 11obj-$(CONFIG_CEVT_BCM1480) += cevt-bcm1480.o
12obj-$(CONFIG_CEVT_R4K) += cevt-r4k.o 12obj-$(CONFIG_CEVT_R4K) += cevt-r4k.o
13obj-$(CONFIG_MIPS_MT_SMTC) += cevt-smtc.o
13obj-$(CONFIG_CEVT_DS1287) += cevt-ds1287.o 14obj-$(CONFIG_CEVT_DS1287) += cevt-ds1287.o
14obj-$(CONFIG_CEVT_GT641XX) += cevt-gt641xx.o 15obj-$(CONFIG_CEVT_GT641XX) += cevt-gt641xx.o
15obj-$(CONFIG_CEVT_SB1250) += cevt-sb1250.o 16obj-$(CONFIG_CEVT_SB1250) += cevt-sb1250.o
diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c
index 24a2d907aa0d..4a4c59f2737a 100644
--- a/arch/mips/kernel/cevt-r4k.c
+++ b/arch/mips/kernel/cevt-r4k.c
@@ -12,6 +12,14 @@
12 12
13#include <asm/smtc_ipi.h> 13#include <asm/smtc_ipi.h>
14#include <asm/time.h> 14#include <asm/time.h>
15#include <asm/cevt-r4k.h>
16
17/*
18 * The SMTC Kernel for the 34K, 1004K, et. al. replaces several
19 * of these routines with SMTC-specific variants.
20 */
21
22#ifndef CONFIG_MIPS_MT_SMTC
15 23
16static int mips_next_event(unsigned long delta, 24static int mips_next_event(unsigned long delta,
17 struct clock_event_device *evt) 25 struct clock_event_device *evt)
@@ -19,60 +27,27 @@ static int mips_next_event(unsigned long delta,
19 unsigned int cnt; 27 unsigned int cnt;
20 int res; 28 int res;
21 29
22#ifdef CONFIG_MIPS_MT_SMTC
23 {
24 unsigned long flags, vpflags;
25 local_irq_save(flags);
26 vpflags = dvpe();
27#endif
28 cnt = read_c0_count(); 30 cnt = read_c0_count();
29 cnt += delta; 31 cnt += delta;
30 write_c0_compare(cnt); 32 write_c0_compare(cnt);
31 res = ((int)(read_c0_count() - cnt) > 0) ? -ETIME : 0; 33 res = ((int)(read_c0_count() - cnt) > 0) ? -ETIME : 0;
32#ifdef CONFIG_MIPS_MT_SMTC
33 evpe(vpflags);
34 local_irq_restore(flags);
35 }
36#endif
37 return res; 34 return res;
38} 35}
39 36
40static void mips_set_mode(enum clock_event_mode mode, 37#endif /* CONFIG_MIPS_MT_SMTC */
41 struct clock_event_device *evt) 38
39void mips_set_clock_mode(enum clock_event_mode mode,
40 struct clock_event_device *evt)
42{ 41{
43 /* Nothing to do ... */ 42 /* Nothing to do ... */
44} 43}
45 44
46static DEFINE_PER_CPU(struct clock_event_device, mips_clockevent_device); 45DEFINE_PER_CPU(struct clock_event_device, mips_clockevent_device);
47static int cp0_timer_irq_installed; 46int cp0_timer_irq_installed;
48 47
49/* 48#ifndef CONFIG_MIPS_MT_SMTC
50 * Timer ack for an R4k-compatible timer of a known frequency.
51 */
52static void c0_timer_ack(void)
53{
54 write_c0_compare(read_c0_compare());
55}
56 49
57/* 50irqreturn_t c0_compare_interrupt(int irq, void *dev_id)
58 * Possibly handle a performance counter interrupt.
59 * Return true if the timer interrupt should not be checked
60 */
61static inline int handle_perf_irq(int r2)
62{
63 /*
64 * The performance counter overflow interrupt may be shared with the
65 * timer interrupt (cp0_perfcount_irq < 0). If it is and a
66 * performance counter has overflowed (perf_irq() == IRQ_HANDLED)
67 * and we can't reliably determine if a counter interrupt has also
68 * happened (!r2) then don't check for a timer interrupt.
69 */
70 return (cp0_perfcount_irq < 0) &&
71 perf_irq() == IRQ_HANDLED &&
72 !r2;
73}
74
75static irqreturn_t c0_compare_interrupt(int irq, void *dev_id)
76{ 51{
77 const int r2 = cpu_has_mips_r2; 52 const int r2 = cpu_has_mips_r2;
78 struct clock_event_device *cd; 53 struct clock_event_device *cd;
@@ -93,12 +68,8 @@ static irqreturn_t c0_compare_interrupt(int irq, void *dev_id)
93 * interrupt. Being the paranoiacs we are we check anyway. 68 * interrupt. Being the paranoiacs we are we check anyway.
94 */ 69 */
95 if (!r2 || (read_c0_cause() & (1 << 30))) { 70 if (!r2 || (read_c0_cause() & (1 << 30))) {
96 c0_timer_ack(); 71 /* Clear Count/Compare Interrupt */
97#ifdef CONFIG_MIPS_MT_SMTC 72 write_c0_compare(read_c0_compare());
98 if (cpu_data[cpu].vpe_id)
99 goto out;
100 cpu = 0;
101#endif
102 cd = &per_cpu(mips_clockevent_device, cpu); 73 cd = &per_cpu(mips_clockevent_device, cpu);
103 cd->event_handler(cd); 74 cd->event_handler(cd);
104 } 75 }
@@ -107,65 +78,16 @@ out:
107 return IRQ_HANDLED; 78 return IRQ_HANDLED;
108} 79}
109 80
110static struct irqaction c0_compare_irqaction = { 81#endif /* Not CONFIG_MIPS_MT_SMTC */
82
83struct irqaction c0_compare_irqaction = {
111 .handler = c0_compare_interrupt, 84 .handler = c0_compare_interrupt,
112#ifdef CONFIG_MIPS_MT_SMTC
113 .flags = IRQF_DISABLED,
114#else
115 .flags = IRQF_DISABLED | IRQF_PERCPU, 85 .flags = IRQF_DISABLED | IRQF_PERCPU,
116#endif
117 .name = "timer", 86 .name = "timer",
118}; 87};
119 88
120#ifdef CONFIG_MIPS_MT_SMTC
121DEFINE_PER_CPU(struct clock_event_device, smtc_dummy_clockevent_device);
122
123static void smtc_set_mode(enum clock_event_mode mode,
124 struct clock_event_device *evt)
125{
126}
127
128static void mips_broadcast(cpumask_t mask)
129{
130 unsigned int cpu;
131
132 for_each_cpu_mask(cpu, mask)
133 smtc_send_ipi(cpu, SMTC_CLOCK_TICK, 0);
134}
135
136static void setup_smtc_dummy_clockevent_device(void)
137{
138 //uint64_t mips_freq = mips_hpt_^frequency;
139 unsigned int cpu = smp_processor_id();
140 struct clock_event_device *cd;
141 89
142 cd = &per_cpu(smtc_dummy_clockevent_device, cpu); 90void mips_event_handler(struct clock_event_device *dev)
143
144 cd->name = "SMTC";
145 cd->features = CLOCK_EVT_FEAT_DUMMY;
146
147 /* Calculate the min / max delta */
148 cd->mult = 0; //div_sc((unsigned long) mips_freq, NSEC_PER_SEC, 32);
149 cd->shift = 0; //32;
150 cd->max_delta_ns = 0; //clockevent_delta2ns(0x7fffffff, cd);
151 cd->min_delta_ns = 0; //clockevent_delta2ns(0x30, cd);
152
153 cd->rating = 200;
154 cd->irq = 17; //-1;
155// if (cpu)
156// cd->cpumask = CPU_MASK_ALL; // cpumask_of_cpu(cpu);
157// else
158 cd->cpumask = cpumask_of_cpu(cpu);
159
160 cd->set_mode = smtc_set_mode;
161
162 cd->broadcast = mips_broadcast;
163
164 clockevents_register_device(cd);
165}
166#endif
167
168static void mips_event_handler(struct clock_event_device *dev)
169{ 91{
170} 92}
171 93
@@ -177,7 +99,23 @@ static int c0_compare_int_pending(void)
177 return (read_c0_cause() >> cp0_compare_irq) & 0x100; 99 return (read_c0_cause() >> cp0_compare_irq) & 0x100;
178} 100}
179 101
180static int c0_compare_int_usable(void) 102/*
103 * Compare interrupt can be routed and latched outside the core,
104 * so a single execution hazard barrier may not be enough to give
105 * it time to clear as seen in the Cause register. 4 time the
106 * pipeline depth seems reasonably conservative, and empirically
107 * works better in configurations with high CPU/bus clock ratios.
108 */
109
110#define compare_change_hazard() \
111 do { \
112 irq_disable_hazard(); \
113 irq_disable_hazard(); \
114 irq_disable_hazard(); \
115 irq_disable_hazard(); \
116 } while (0)
117
118int c0_compare_int_usable(void)
181{ 119{
182 unsigned int delta; 120 unsigned int delta;
183 unsigned int cnt; 121 unsigned int cnt;
@@ -187,7 +125,7 @@ static int c0_compare_int_usable(void)
187 */ 125 */
188 if (c0_compare_int_pending()) { 126 if (c0_compare_int_pending()) {
189 write_c0_compare(read_c0_count()); 127 write_c0_compare(read_c0_count());
190 irq_disable_hazard(); 128 compare_change_hazard();
191 if (c0_compare_int_pending()) 129 if (c0_compare_int_pending())
192 return 0; 130 return 0;
193 } 131 }
@@ -196,7 +134,7 @@ static int c0_compare_int_usable(void)
196 cnt = read_c0_count(); 134 cnt = read_c0_count();
197 cnt += delta; 135 cnt += delta;
198 write_c0_compare(cnt); 136 write_c0_compare(cnt);
199 irq_disable_hazard(); 137 compare_change_hazard();
200 if ((int)(read_c0_count() - cnt) < 0) 138 if ((int)(read_c0_count() - cnt) < 0)
201 break; 139 break;
202 /* increase delta if the timer was already expired */ 140 /* increase delta if the timer was already expired */
@@ -205,11 +143,12 @@ static int c0_compare_int_usable(void)
205 while ((int)(read_c0_count() - cnt) <= 0) 143 while ((int)(read_c0_count() - cnt) <= 0)
206 ; /* Wait for expiry */ 144 ; /* Wait for expiry */
207 145
146 compare_change_hazard();
208 if (!c0_compare_int_pending()) 147 if (!c0_compare_int_pending())
209 return 0; 148 return 0;
210 149
211 write_c0_compare(read_c0_count()); 150 write_c0_compare(read_c0_count());
212 irq_disable_hazard(); 151 compare_change_hazard();
213 if (c0_compare_int_pending()) 152 if (c0_compare_int_pending())
214 return 0; 153 return 0;
215 154
@@ -219,6 +158,8 @@ static int c0_compare_int_usable(void)
219 return 1; 158 return 1;
220} 159}
221 160
161#ifndef CONFIG_MIPS_MT_SMTC
162
222int __cpuinit mips_clockevent_init(void) 163int __cpuinit mips_clockevent_init(void)
223{ 164{
224 uint64_t mips_freq = mips_hpt_frequency; 165 uint64_t mips_freq = mips_hpt_frequency;
@@ -229,17 +170,6 @@ int __cpuinit mips_clockevent_init(void)
229 if (!cpu_has_counter || !mips_hpt_frequency) 170 if (!cpu_has_counter || !mips_hpt_frequency)
230 return -ENXIO; 171 return -ENXIO;
231 172
232#ifdef CONFIG_MIPS_MT_SMTC
233 setup_smtc_dummy_clockevent_device();
234
235 /*
236 * On SMTC we only register VPE0's compare interrupt as clockevent
237 * device.
238 */
239 if (cpu)
240 return 0;
241#endif
242
243 if (!c0_compare_int_usable()) 173 if (!c0_compare_int_usable())
244 return -ENXIO; 174 return -ENXIO;
245 175
@@ -265,13 +195,9 @@ int __cpuinit mips_clockevent_init(void)
265 195
266 cd->rating = 300; 196 cd->rating = 300;
267 cd->irq = irq; 197 cd->irq = irq;
268#ifdef CONFIG_MIPS_MT_SMTC
269 cd->cpumask = CPU_MASK_ALL;
270#else
271 cd->cpumask = cpumask_of_cpu(cpu); 198 cd->cpumask = cpumask_of_cpu(cpu);
272#endif
273 cd->set_next_event = mips_next_event; 199 cd->set_next_event = mips_next_event;
274 cd->set_mode = mips_set_mode; 200 cd->set_mode = mips_set_clock_mode;
275 cd->event_handler = mips_event_handler; 201 cd->event_handler = mips_event_handler;
276 202
277 clockevents_register_device(cd); 203 clockevents_register_device(cd);
@@ -281,12 +207,9 @@ int __cpuinit mips_clockevent_init(void)
281 207
282 cp0_timer_irq_installed = 1; 208 cp0_timer_irq_installed = 1;
283 209
284#ifdef CONFIG_MIPS_MT_SMTC
285#define CPUCTR_IMASKBIT (0x100 << cp0_compare_irq)
286 setup_irq_smtc(irq, &c0_compare_irqaction, CPUCTR_IMASKBIT);
287#else
288 setup_irq(irq, &c0_compare_irqaction); 210 setup_irq(irq, &c0_compare_irqaction);
289#endif
290 211
291 return 0; 212 return 0;
292} 213}
214
215#endif /* Not CONFIG_MIPS_MT_SMTC */
diff --git a/arch/mips/kernel/cevt-smtc.c b/arch/mips/kernel/cevt-smtc.c
new file mode 100644
index 000000000000..5162fe4b5952
--- /dev/null
+++ b/arch/mips/kernel/cevt-smtc.c
@@ -0,0 +1,321 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2007 MIPS Technologies, Inc.
7 * Copyright (C) 2007 Ralf Baechle <ralf@linux-mips.org>
8 * Copyright (C) 2008 Kevin D. Kissell, Paralogos sarl
9 */
10#include <linux/clockchips.h>
11#include <linux/interrupt.h>
12#include <linux/percpu.h>
13
14#include <asm/smtc_ipi.h>
15#include <asm/time.h>
16#include <asm/cevt-r4k.h>
17
18/*
19 * Variant clock event timer support for SMTC on MIPS 34K, 1004K
20 * or other MIPS MT cores.
21 *
22 * Notes on SMTC Support:
23 *
24 * SMTC has multiple microthread TCs pretending to be Linux CPUs.
25 * But there's only one Count/Compare pair per VPE, and Compare
26 * interrupts are taken opportunisitically by available TCs
27 * bound to the VPE with the Count register. The new timer
28 * framework provides for global broadcasts, but we really
29 * want VPE-level multicasts for best behavior. So instead
30 * of invoking the high-level clock-event broadcast code,
31 * this version of SMTC support uses the historical SMTC
32 * multicast mechanisms "under the hood", appearing to the
33 * generic clock layer as if the interrupts are per-CPU.
34 *
35 * The approach taken here is to maintain a set of NR_CPUS
36 * virtual timers, and track which "CPU" needs to be alerted
37 * at each event.
38 *
39 * It's unlikely that we'll see a MIPS MT core with more than
40 * 2 VPEs, but we *know* that we won't need to handle more
41 * VPEs than we have "CPUs". So NCPUs arrays of NCPUs elements
42 * is always going to be overkill, but always going to be enough.
43 */
44
45unsigned long smtc_nexttime[NR_CPUS][NR_CPUS];
46static int smtc_nextinvpe[NR_CPUS];
47
48/*
49 * Timestamps stored are absolute values to be programmed
50 * into Count register. Valid timestamps will never be zero.
51 * If a Zero Count value is actually calculated, it is converted
52 * to be a 1, which will introduce 1 or two CPU cycles of error
53 * roughly once every four billion events, which at 1000 HZ means
54 * about once every 50 days. If that's actually a problem, one
55 * could alternate squashing 0 to 1 and to -1.
56 */
57
58#define MAKEVALID(x) (((x) == 0L) ? 1L : (x))
59#define ISVALID(x) ((x) != 0L)
60
61/*
62 * Time comparison is subtle, as it's really truncated
63 * modular arithmetic.
64 */
65
66#define IS_SOONER(a, b, reference) \
67 (((a) - (unsigned long)(reference)) < ((b) - (unsigned long)(reference)))
68
69/*
70 * CATCHUP_INCREMENT, used when the function falls behind the counter.
71 * Could be an increasing function instead of a constant;
72 */
73
74#define CATCHUP_INCREMENT 64
75
76static int mips_next_event(unsigned long delta,
77 struct clock_event_device *evt)
78{
79 unsigned long flags;
80 unsigned int mtflags;
81 unsigned long timestamp, reference, previous;
82 unsigned long nextcomp = 0L;
83 int vpe = current_cpu_data.vpe_id;
84 int cpu = smp_processor_id();
85 local_irq_save(flags);
86 mtflags = dmt();
87
88 /*
89 * Maintain the per-TC virtual timer
90 * and program the per-VPE shared Count register
91 * as appropriate here...
92 */
93 reference = (unsigned long)read_c0_count();
94 timestamp = MAKEVALID(reference + delta);
95 /*
96 * To really model the clock, we have to catch the case
97 * where the current next-in-VPE timestamp is the old
98 * timestamp for the calling CPE, but the new value is
99 * in fact later. In that case, we have to do a full
100 * scan and discover the new next-in-VPE CPU id and
101 * timestamp.
102 */
103 previous = smtc_nexttime[vpe][cpu];
104 if (cpu == smtc_nextinvpe[vpe] && ISVALID(previous)
105 && IS_SOONER(previous, timestamp, reference)) {
106 int i;
107 int soonest = cpu;
108
109 /*
110 * Update timestamp array here, so that new
111 * value gets considered along with those of
112 * other virtual CPUs on the VPE.
113 */
114 smtc_nexttime[vpe][cpu] = timestamp;
115 for_each_online_cpu(i) {
116 if (ISVALID(smtc_nexttime[vpe][i])
117 && IS_SOONER(smtc_nexttime[vpe][i],
118 smtc_nexttime[vpe][soonest], reference)) {
119 soonest = i;
120 }
121 }
122 smtc_nextinvpe[vpe] = soonest;
123 nextcomp = smtc_nexttime[vpe][soonest];
124 /*
125 * Otherwise, we don't have to process the whole array rank,
126 * we just have to see if the event horizon has gotten closer.
127 */
128 } else {
129 if (!ISVALID(smtc_nexttime[vpe][smtc_nextinvpe[vpe]]) ||
130 IS_SOONER(timestamp,
131 smtc_nexttime[vpe][smtc_nextinvpe[vpe]], reference)) {
132 smtc_nextinvpe[vpe] = cpu;
133 nextcomp = timestamp;
134 }
135 /*
136 * Since next-in-VPE may me the same as the executing
137 * virtual CPU, we update the array *after* checking
138 * its value.
139 */
140 smtc_nexttime[vpe][cpu] = timestamp;
141 }
142
143 /*
144 * It may be that, in fact, we don't need to update Compare,
145 * but if we do, we want to make sure we didn't fall into
146 * a crack just behind Count.
147 */
148 if (ISVALID(nextcomp)) {
149 write_c0_compare(nextcomp);
150 ehb();
151 /*
152 * We never return an error, we just make sure
153 * that we trigger the handlers as quickly as
154 * we can if we fell behind.
155 */
156 while ((nextcomp - (unsigned long)read_c0_count())
157 > (unsigned long)LONG_MAX) {
158 nextcomp += CATCHUP_INCREMENT;
159 write_c0_compare(nextcomp);
160 ehb();
161 }
162 }
163 emt(mtflags);
164 local_irq_restore(flags);
165 return 0;
166}
167
168
169void smtc_distribute_timer(int vpe)
170{
171 unsigned long flags;
172 unsigned int mtflags;
173 int cpu;
174 struct clock_event_device *cd;
175 unsigned long nextstamp = 0L;
176 unsigned long reference;
177
178
179repeat:
180 for_each_online_cpu(cpu) {
181 /*
182 * Find virtual CPUs within the current VPE who have
183 * unserviced timer requests whose time is now past.
184 */
185 local_irq_save(flags);
186 mtflags = dmt();
187 if (cpu_data[cpu].vpe_id == vpe &&
188 ISVALID(smtc_nexttime[vpe][cpu])) {
189 reference = (unsigned long)read_c0_count();
190 if ((smtc_nexttime[vpe][cpu] - reference)
191 > (unsigned long)LONG_MAX) {
192 smtc_nexttime[vpe][cpu] = 0L;
193 emt(mtflags);
194 local_irq_restore(flags);
195 /*
196 * We don't send IPIs to ourself.
197 */
198 if (cpu != smp_processor_id()) {
199 smtc_send_ipi(cpu, SMTC_CLOCK_TICK, 0);
200 } else {
201 cd = &per_cpu(mips_clockevent_device, cpu);
202 cd->event_handler(cd);
203 }
204 } else {
205 /* Local to VPE but Valid Time not yet reached. */
206 if (!ISVALID(nextstamp) ||
207 IS_SOONER(smtc_nexttime[vpe][cpu], nextstamp,
208 reference)) {
209 smtc_nextinvpe[vpe] = cpu;
210 nextstamp = smtc_nexttime[vpe][cpu];
211 }
212 emt(mtflags);
213 local_irq_restore(flags);
214 }
215 } else {
216 emt(mtflags);
217 local_irq_restore(flags);
218
219 }
220 }
221 /* Reprogram for interrupt at next soonest timestamp for VPE */
222 if (ISVALID(nextstamp)) {
223 write_c0_compare(nextstamp);
224 ehb();
225 if ((nextstamp - (unsigned long)read_c0_count())
226 > (unsigned long)LONG_MAX)
227 goto repeat;
228 }
229}
230
231
232irqreturn_t c0_compare_interrupt(int irq, void *dev_id)
233{
234 int cpu = smp_processor_id();
235
236 /* If we're running SMTC, we've got MIPS MT and therefore MIPS32R2 */
237 handle_perf_irq(1);
238
239 if (read_c0_cause() & (1 << 30)) {
240 /* Clear Count/Compare Interrupt */
241 write_c0_compare(read_c0_compare());
242 smtc_distribute_timer(cpu_data[cpu].vpe_id);
243 }
244 return IRQ_HANDLED;
245}
246
247
248int __cpuinit mips_clockevent_init(void)
249{
250 uint64_t mips_freq = mips_hpt_frequency;
251 unsigned int cpu = smp_processor_id();
252 struct clock_event_device *cd;
253 unsigned int irq;
254 int i;
255 int j;
256
257 if (!cpu_has_counter || !mips_hpt_frequency)
258 return -ENXIO;
259 if (cpu == 0) {
260 for (i = 0; i < num_possible_cpus(); i++) {
261 smtc_nextinvpe[i] = 0;
262 for (j = 0; j < num_possible_cpus(); j++)
263 smtc_nexttime[i][j] = 0L;
264 }
265 /*
266 * SMTC also can't have the usablility test
267 * run by secondary TCs once Compare is in use.
268 */
269 if (!c0_compare_int_usable())
270 return -ENXIO;
271 }
272
273 /*
274 * With vectored interrupts things are getting platform specific.
275 * get_c0_compare_int is a hook to allow a platform to return the
276 * interrupt number of it's liking.
277 */
278 irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq;
279 if (get_c0_compare_int)
280 irq = get_c0_compare_int();
281
282 cd = &per_cpu(mips_clockevent_device, cpu);
283
284 cd->name = "MIPS";
285 cd->features = CLOCK_EVT_FEAT_ONESHOT;
286
287 /* Calculate the min / max delta */
288 cd->mult = div_sc((unsigned long) mips_freq, NSEC_PER_SEC, 32);
289 cd->shift = 32;
290 cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd);
291 cd->min_delta_ns = clockevent_delta2ns(0x300, cd);
292
293 cd->rating = 300;
294 cd->irq = irq;
295 cd->cpumask = cpumask_of_cpu(cpu);
296 cd->set_next_event = mips_next_event;
297 cd->set_mode = mips_set_clock_mode;
298 cd->event_handler = mips_event_handler;
299
300 clockevents_register_device(cd);
301
302 /*
303 * On SMTC we only want to do the data structure
304 * initialization and IRQ setup once.
305 */
306 if (cpu)
307 return 0;
308 /*
309 * And we need the hwmask associated with the c0_compare
310 * vector to be initialized.
311 */
312 irq_hwmask[irq] = (0x100 << cp0_compare_irq);
313 if (cp0_timer_irq_installed)
314 return 0;
315
316 cp0_timer_irq_installed = 1;
317
318 setup_irq(irq, &c0_compare_irqaction);
319
320 return 0;
321}
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 335a6ae3d594..e621fda8ab37 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -45,18 +45,7 @@ static void r39xx_wait(void)
45 local_irq_enable(); 45 local_irq_enable();
46} 46}
47 47
48/* 48extern void r4k_wait(void);
49 * There is a race when WAIT instruction executed with interrupt
50 * enabled.
51 * But it is implementation-dependent wheter the pipelie restarts when
52 * a non-enabled interrupt is requested.
53 */
54static void r4k_wait(void)
55{
56 __asm__(" .set mips3 \n"
57 " wait \n"
58 " .set mips0 \n");
59}
60 49
61/* 50/*
62 * This variant is preferable as it allows testing need_resched and going to 51 * This variant is preferable as it allows testing need_resched and going to
@@ -65,14 +54,18 @@ static void r4k_wait(void)
65 * interrupt is requested" restriction in the MIPS32/MIPS64 architecture makes 54 * interrupt is requested" restriction in the MIPS32/MIPS64 architecture makes
66 * using this version a gamble. 55 * using this version a gamble.
67 */ 56 */
68static void r4k_wait_irqoff(void) 57void r4k_wait_irqoff(void)
69{ 58{
70 local_irq_disable(); 59 local_irq_disable();
71 if (!need_resched()) 60 if (!need_resched())
72 __asm__(" .set mips3 \n" 61 __asm__(" .set push \n"
62 " .set mips3 \n"
73 " wait \n" 63 " wait \n"
74 " .set mips0 \n"); 64 " .set pop \n");
75 local_irq_enable(); 65 local_irq_enable();
66 __asm__(" .globl __pastwait \n"
67 "__pastwait: \n");
68 return;
76} 69}
77 70
78/* 71/*
@@ -128,7 +121,7 @@ static int __init wait_disable(char *s)
128 121
129__setup("nowait", wait_disable); 122__setup("nowait", wait_disable);
130 123
131static inline void check_wait(void) 124void __init check_wait(void)
132{ 125{
133 struct cpuinfo_mips *c = &current_cpu_data; 126 struct cpuinfo_mips *c = &current_cpu_data;
134 127
@@ -242,7 +235,6 @@ static inline void check_errata(void)
242 235
243void __init check_bugs32(void) 236void __init check_bugs32(void)
244{ 237{
245 check_wait();
246 check_errata(); 238 check_errata();
247} 239}
248 240
diff --git a/arch/mips/kernel/entry.S b/arch/mips/kernel/entry.S
index e29598ae939d..ffa331029e08 100644
--- a/arch/mips/kernel/entry.S
+++ b/arch/mips/kernel/entry.S
@@ -79,11 +79,6 @@ FEXPORT(syscall_exit)
79 79
80FEXPORT(restore_all) # restore full frame 80FEXPORT(restore_all) # restore full frame
81#ifdef CONFIG_MIPS_MT_SMTC 81#ifdef CONFIG_MIPS_MT_SMTC
82/* Detect and execute deferred IPI "interrupts" */
83 LONG_L s0, TI_REGS($28)
84 LONG_S sp, TI_REGS($28)
85 jal deferred_smtc_ipi
86 LONG_S s0, TI_REGS($28)
87#ifdef CONFIG_MIPS_MT_SMTC_IM_BACKSTOP 82#ifdef CONFIG_MIPS_MT_SMTC_IM_BACKSTOP
88/* Re-arm any temporarily masked interrupts not explicitly "acked" */ 83/* Re-arm any temporarily masked interrupts not explicitly "acked" */
89 mfc0 v0, CP0_TCSTATUS 84 mfc0 v0, CP0_TCSTATUS
@@ -112,6 +107,11 @@ FEXPORT(restore_all) # restore full frame
112 xor t0, t0, t3 107 xor t0, t0, t3
113 mtc0 t0, CP0_TCCONTEXT 108 mtc0 t0, CP0_TCCONTEXT
114#endif /* CONFIG_MIPS_MT_SMTC_IM_BACKSTOP */ 109#endif /* CONFIG_MIPS_MT_SMTC_IM_BACKSTOP */
110/* Detect and execute deferred IPI "interrupts" */
111 LONG_L s0, TI_REGS($28)
112 LONG_S sp, TI_REGS($28)
113 jal deferred_smtc_ipi
114 LONG_S s0, TI_REGS($28)
115#endif /* CONFIG_MIPS_MT_SMTC */ 115#endif /* CONFIG_MIPS_MT_SMTC */
116 .set noat 116 .set noat
117 RESTORE_TEMP 117 RESTORE_TEMP
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index c6ada98ee042..01dcbe38fa01 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -20,6 +20,7 @@
20#include <asm/stackframe.h> 20#include <asm/stackframe.h>
21#include <asm/war.h> 21#include <asm/war.h>
22#include <asm/page.h> 22#include <asm/page.h>
23#include <asm/thread_info.h>
23 24
24#define PANIC_PIC(msg) \ 25#define PANIC_PIC(msg) \
25 .set push; \ 26 .set push; \
@@ -126,7 +127,42 @@ handle_vcei:
126 127
127 __FINIT 128 __FINIT
128 129
130 .align 5 /* 32 byte rollback region */
131LEAF(r4k_wait)
132 .set push
133 .set noreorder
134 /* start of rollback region */
135 LONG_L t0, TI_FLAGS($28)
136 nop
137 andi t0, _TIF_NEED_RESCHED
138 bnez t0, 1f
139 nop
140 nop
141 nop
142 .set mips3
143 wait
144 /* end of rollback region (the region size must be power of two) */
145 .set pop
1461:
147 jr ra
148 END(r4k_wait)
149
150 .macro BUILD_ROLLBACK_PROLOGUE handler
151 FEXPORT(rollback_\handler)
152 .set push
153 .set noat
154 MFC0 k0, CP0_EPC
155 PTR_LA k1, r4k_wait
156 ori k0, 0x1f /* 32 byte rollback region */
157 xori k0, 0x1f
158 bne k0, k1, 9f
159 MTC0 k0, CP0_EPC
1609:
161 .set pop
162 .endm
163
129 .align 5 164 .align 5
165BUILD_ROLLBACK_PROLOGUE handle_int
130NESTED(handle_int, PT_SIZE, sp) 166NESTED(handle_int, PT_SIZE, sp)
131#ifdef CONFIG_TRACE_IRQFLAGS 167#ifdef CONFIG_TRACE_IRQFLAGS
132 /* 168 /*
@@ -201,6 +237,7 @@ NESTED(except_vec_ejtag_debug, 0, sp)
201 * This prototype is copied to ebase + n*IntCtl.VS and patched 237 * This prototype is copied to ebase + n*IntCtl.VS and patched
202 * to invoke the handler 238 * to invoke the handler
203 */ 239 */
240BUILD_ROLLBACK_PROLOGUE except_vec_vi
204NESTED(except_vec_vi, 0, sp) 241NESTED(except_vec_vi, 0, sp)
205 SAVE_SOME 242 SAVE_SOME
206 SAVE_AT 243 SAVE_AT
@@ -245,8 +282,8 @@ NESTED(except_vec_vi_handler, 0, sp)
245 and t0, a0, t1 282 and t0, a0, t1
246#ifdef CONFIG_MIPS_MT_SMTC_IM_BACKSTOP 283#ifdef CONFIG_MIPS_MT_SMTC_IM_BACKSTOP
247 mfc0 t2, CP0_TCCONTEXT 284 mfc0 t2, CP0_TCCONTEXT
248 or t0, t0, t2 285 or t2, t0, t2
249 mtc0 t0, CP0_TCCONTEXT 286 mtc0 t2, CP0_TCCONTEXT
250#endif /* CONFIG_MIPS_MT_SMTC_IM_BACKSTOP */ 287#endif /* CONFIG_MIPS_MT_SMTC_IM_BACKSTOP */
251 xor t1, t1, t0 288 xor t1, t1, t0
252 mtc0 t1, CP0_STATUS 289 mtc0 t1, CP0_STATUS
diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index 361364501d34..492a0a8d70fb 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -22,6 +22,7 @@
22#include <asm/irqflags.h> 22#include <asm/irqflags.h>
23#include <asm/regdef.h> 23#include <asm/regdef.h>
24#include <asm/page.h> 24#include <asm/page.h>
25#include <asm/pgtable-bits.h>
25#include <asm/mipsregs.h> 26#include <asm/mipsregs.h>
26#include <asm/stackframe.h> 27#include <asm/stackframe.h>
27 28
diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c
index 8f6d58ede33c..6e152c80cd4a 100644
--- a/arch/mips/kernel/kgdb.c
+++ b/arch/mips/kernel/kgdb.c
@@ -236,8 +236,7 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code,
236 236
237 atomic_set(&kgdb_cpu_doing_single_step, -1); 237 atomic_set(&kgdb_cpu_doing_single_step, -1);
238 if (remcom_in_buffer[0] == 's') 238 if (remcom_in_buffer[0] == 's')
239 if (kgdb_contthread) 239 atomic_set(&kgdb_cpu_doing_single_step, cpu);
240 atomic_set(&kgdb_cpu_doing_single_step, cpu);
241 240
242 return 0; 241 return 0;
243 } 242 }
diff --git a/arch/mips/kernel/mips-mt-fpaff.c b/arch/mips/kernel/mips-mt-fpaff.c
index df4d3f2f740c..dc9eb72ed9de 100644
--- a/arch/mips/kernel/mips-mt-fpaff.c
+++ b/arch/mips/kernel/mips-mt-fpaff.c
@@ -159,7 +159,7 @@ __setup("fpaff=", fpaff_thresh);
159/* 159/*
160 * FPU Use Factor empirically derived from experiments on 34K 160 * FPU Use Factor empirically derived from experiments on 34K
161 */ 161 */
162#define FPUSEFACTOR 333 162#define FPUSEFACTOR 2000
163 163
164static __init int mt_fp_affinity_init(void) 164static __init int mt_fp_affinity_init(void)
165{ 165{
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index b16facd9ea8e..22fc19bbe87f 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -55,7 +55,7 @@ void __noreturn cpu_idle(void)
55 while (1) { 55 while (1) {
56 tick_nohz_stop_sched_tick(1); 56 tick_nohz_stop_sched_tick(1);
57 while (!need_resched()) { 57 while (!need_resched()) {
58#ifdef CONFIG_SMTC_IDLE_HOOK_DEBUG 58#ifdef CONFIG_MIPS_MT_SMTC
59 extern void smtc_idle_loop_hook(void); 59 extern void smtc_idle_loop_hook(void);
60 60
61 smtc_idle_loop_hook(); 61 smtc_idle_loop_hook();
@@ -145,17 +145,18 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
145 */ 145 */
146 p->thread.cp0_status = read_c0_status() & ~(ST0_CU2|ST0_CU1); 146 p->thread.cp0_status = read_c0_status() & ~(ST0_CU2|ST0_CU1);
147 childregs->cp0_status &= ~(ST0_CU2|ST0_CU1); 147 childregs->cp0_status &= ~(ST0_CU2|ST0_CU1);
148 clear_tsk_thread_flag(p, TIF_USEDFPU);
149 148
150#ifdef CONFIG_MIPS_MT_FPAFF 149#ifdef CONFIG_MIPS_MT_SMTC
151 /* 150 /*
152 * FPU affinity support is cleaner if we track the 151 * SMTC restores TCStatus after Status, and the CU bits
153 * user-visible CPU affinity from the very beginning. 152 * are aliased there.
154 * The generic cpus_allowed mask will already have
155 * been copied from the parent before copy_thread
156 * is invoked.
157 */ 153 */
158 p->thread.user_cpus_allowed = p->cpus_allowed; 154 childregs->cp0_tcstatus &= ~(ST0_CU2|ST0_CU1);
155#endif
156 clear_tsk_thread_flag(p, TIF_USEDFPU);
157
158#ifdef CONFIG_MIPS_MT_FPAFF
159 clear_tsk_thread_flag(p, TIF_FPUBOUND);
159#endif /* CONFIG_MIPS_MT_FPAFF */ 160#endif /* CONFIG_MIPS_MT_FPAFF */
160 161
161 if (clone_flags & CLONE_SETTLS) 162 if (clone_flags & CLONE_SETTLS)
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index 35234b92b9a5..96ffc9c6d194 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -238,7 +238,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
238 case FPC_EIR: { /* implementation / version register */ 238 case FPC_EIR: { /* implementation / version register */
239 unsigned int flags; 239 unsigned int flags;
240#ifdef CONFIG_MIPS_MT_SMTC 240#ifdef CONFIG_MIPS_MT_SMTC
241 unsigned int irqflags; 241 unsigned long irqflags;
242 unsigned int mtflags; 242 unsigned int mtflags;
243#endif /* CONFIG_MIPS_MT_SMTC */ 243#endif /* CONFIG_MIPS_MT_SMTC */
244 244
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index a516286532ab..897fb2b4751c 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -1,4 +1,21 @@
1/* Copyright (C) 2004 Mips Technologies, Inc */ 1/*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version 2
5 * of the License, or (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 *
16 * Copyright (C) 2004 Mips Technologies, Inc
17 * Copyright (C) 2008 Kevin D. Kissell
18 */
2 19
3#include <linux/clockchips.h> 20#include <linux/clockchips.h>
4#include <linux/kernel.h> 21#include <linux/kernel.h>
@@ -21,7 +38,6 @@
21#include <asm/time.h> 38#include <asm/time.h>
22#include <asm/addrspace.h> 39#include <asm/addrspace.h>
23#include <asm/smtc.h> 40#include <asm/smtc.h>
24#include <asm/smtc_ipi.h>
25#include <asm/smtc_proc.h> 41#include <asm/smtc_proc.h>
26 42
27/* 43/*
@@ -58,11 +74,6 @@ unsigned long irq_hwmask[NR_IRQS];
58 74
59asiduse smtc_live_asid[MAX_SMTC_TLBS][MAX_SMTC_ASIDS]; 75asiduse smtc_live_asid[MAX_SMTC_TLBS][MAX_SMTC_ASIDS];
60 76
61/*
62 * Clock interrupt "latch" buffers, per "CPU"
63 */
64
65static atomic_t ipi_timer_latch[NR_CPUS];
66 77
67/* 78/*
68 * Number of InterProcessor Interrupt (IPI) message buffers to allocate 79 * Number of InterProcessor Interrupt (IPI) message buffers to allocate
@@ -70,7 +81,7 @@ static atomic_t ipi_timer_latch[NR_CPUS];
70 81
71#define IPIBUF_PER_CPU 4 82#define IPIBUF_PER_CPU 4
72 83
73static struct smtc_ipi_q IPIQ[NR_CPUS]; 84struct smtc_ipi_q IPIQ[NR_CPUS];
74static struct smtc_ipi_q freeIPIq; 85static struct smtc_ipi_q freeIPIq;
75 86
76 87
@@ -282,7 +293,7 @@ static void smtc_configure_tlb(void)
282 * phys_cpu_present_map and the logical/physical mappings. 293 * phys_cpu_present_map and the logical/physical mappings.
283 */ 294 */
284 295
285int __init mipsmt_build_cpu_map(int start_cpu_slot) 296int __init smtc_build_cpu_map(int start_cpu_slot)
286{ 297{
287 int i, ntcs; 298 int i, ntcs;
288 299
@@ -325,7 +336,12 @@ static void smtc_tc_setup(int vpe, int tc, int cpu)
325 write_tc_c0_tcstatus((read_tc_c0_tcstatus() 336 write_tc_c0_tcstatus((read_tc_c0_tcstatus()
326 & ~(TCSTATUS_TKSU | TCSTATUS_DA | TCSTATUS_IXMT)) 337 & ~(TCSTATUS_TKSU | TCSTATUS_DA | TCSTATUS_IXMT))
327 | TCSTATUS_A); 338 | TCSTATUS_A);
328 write_tc_c0_tccontext(0); 339 /*
340 * TCContext gets an offset from the base of the IPIQ array
341 * to be used in low-level code to detect the presence of
342 * an active IPI queue
343 */
344 write_tc_c0_tccontext((sizeof(struct smtc_ipi_q) * cpu) << 16);
329 /* Bind tc to vpe */ 345 /* Bind tc to vpe */
330 write_tc_c0_tcbind(vpe); 346 write_tc_c0_tcbind(vpe);
331 /* In general, all TCs should have the same cpu_data indications */ 347 /* In general, all TCs should have the same cpu_data indications */
@@ -336,10 +352,18 @@ static void smtc_tc_setup(int vpe, int tc, int cpu)
336 cpu_data[cpu].options &= ~MIPS_CPU_FPU; 352 cpu_data[cpu].options &= ~MIPS_CPU_FPU;
337 cpu_data[cpu].vpe_id = vpe; 353 cpu_data[cpu].vpe_id = vpe;
338 cpu_data[cpu].tc_id = tc; 354 cpu_data[cpu].tc_id = tc;
355 /* Multi-core SMTC hasn't been tested, but be prepared */
356 cpu_data[cpu].core = (read_vpe_c0_ebase() >> 1) & 0xff;
339} 357}
340 358
359/*
360 * Tweak to get Count registes in as close a sync as possible.
361 * Value seems good for 34K-class cores.
362 */
363
364#define CP0_SKEW 8
341 365
342void mipsmt_prepare_cpus(void) 366void smtc_prepare_cpus(int cpus)
343{ 367{
344 int i, vpe, tc, ntc, nvpe, tcpervpe[NR_CPUS], slop, cpu; 368 int i, vpe, tc, ntc, nvpe, tcpervpe[NR_CPUS], slop, cpu;
345 unsigned long flags; 369 unsigned long flags;
@@ -363,13 +387,13 @@ void mipsmt_prepare_cpus(void)
363 IPIQ[i].head = IPIQ[i].tail = NULL; 387 IPIQ[i].head = IPIQ[i].tail = NULL;
364 spin_lock_init(&IPIQ[i].lock); 388 spin_lock_init(&IPIQ[i].lock);
365 IPIQ[i].depth = 0; 389 IPIQ[i].depth = 0;
366 atomic_set(&ipi_timer_latch[i], 0);
367 } 390 }
368 391
369 /* cpu_data index starts at zero */ 392 /* cpu_data index starts at zero */
370 cpu = 0; 393 cpu = 0;
371 cpu_data[cpu].vpe_id = 0; 394 cpu_data[cpu].vpe_id = 0;
372 cpu_data[cpu].tc_id = 0; 395 cpu_data[cpu].tc_id = 0;
396 cpu_data[cpu].core = (read_c0_ebase() >> 1) & 0xff;
373 cpu++; 397 cpu++;
374 398
375 /* Report on boot-time options */ 399 /* Report on boot-time options */
@@ -484,7 +508,8 @@ void mipsmt_prepare_cpus(void)
484 write_vpe_c0_compare(0); 508 write_vpe_c0_compare(0);
485 /* Propagate Config7 */ 509 /* Propagate Config7 */
486 write_vpe_c0_config7(read_c0_config7()); 510 write_vpe_c0_config7(read_c0_config7());
487 write_vpe_c0_count(read_c0_count()); 511 write_vpe_c0_count(read_c0_count() + CP0_SKEW);
512 ehb();
488 } 513 }
489 /* enable multi-threading within VPE */ 514 /* enable multi-threading within VPE */
490 write_vpe_c0_vpecontrol(read_vpe_c0_vpecontrol() | VPECONTROL_TE); 515 write_vpe_c0_vpecontrol(read_vpe_c0_vpecontrol() | VPECONTROL_TE);
@@ -556,7 +581,7 @@ void mipsmt_prepare_cpus(void)
556void __cpuinit smtc_boot_secondary(int cpu, struct task_struct *idle) 581void __cpuinit smtc_boot_secondary(int cpu, struct task_struct *idle)
557{ 582{
558 extern u32 kernelsp[NR_CPUS]; 583 extern u32 kernelsp[NR_CPUS];
559 long flags; 584 unsigned long flags;
560 int mtflags; 585 int mtflags;
561 586
562 LOCK_MT_PRA(); 587 LOCK_MT_PRA();
@@ -585,24 +610,22 @@ void __cpuinit smtc_boot_secondary(int cpu, struct task_struct *idle)
585 610
586void smtc_init_secondary(void) 611void smtc_init_secondary(void)
587{ 612{
588 /*
589 * Start timer on secondary VPEs if necessary.
590 * plat_timer_setup has already have been invoked by init/main
591 * on "boot" TC. Like per_cpu_trap_init() hack, this assumes that
592 * SMTC init code assigns TCs consdecutively and in ascending order
593 * to across available VPEs.
594 */
595 if (((read_c0_tcbind() & TCBIND_CURTC) != 0) &&
596 ((read_c0_tcbind() & TCBIND_CURVPE)
597 != cpu_data[smp_processor_id() - 1].vpe_id)){
598 write_c0_compare(read_c0_count() + mips_hpt_frequency/HZ);
599 }
600
601 local_irq_enable(); 613 local_irq_enable();
602} 614}
603 615
604void smtc_smp_finish(void) 616void smtc_smp_finish(void)
605{ 617{
618 int cpu = smp_processor_id();
619
620 /*
621 * Lowest-numbered CPU per VPE starts a clock tick.
622 * Like per_cpu_trap_init() hack, this assumes that
623 * SMTC init code assigns TCs consdecutively and
624 * in ascending order across available VPEs.
625 */
626 if (cpu > 0 && (cpu_data[cpu].vpe_id != cpu_data[cpu - 1].vpe_id))
627 write_c0_compare(read_c0_count() + mips_hpt_frequency/HZ);
628
606 printk("TC %d going on-line as CPU %d\n", 629 printk("TC %d going on-line as CPU %d\n",
607 cpu_data[smp_processor_id()].tc_id, smp_processor_id()); 630 cpu_data[smp_processor_id()].tc_id, smp_processor_id());
608} 631}
@@ -753,8 +776,10 @@ void smtc_send_ipi(int cpu, int type, unsigned int action)
753{ 776{
754 int tcstatus; 777 int tcstatus;
755 struct smtc_ipi *pipi; 778 struct smtc_ipi *pipi;
756 long flags; 779 unsigned long flags;
757 int mtflags; 780 int mtflags;
781 unsigned long tcrestart;
782 extern void r4k_wait_irqoff(void), __pastwait(void);
758 783
759 if (cpu == smp_processor_id()) { 784 if (cpu == smp_processor_id()) {
760 printk("Cannot Send IPI to self!\n"); 785 printk("Cannot Send IPI to self!\n");
@@ -771,8 +796,6 @@ void smtc_send_ipi(int cpu, int type, unsigned int action)
771 pipi->arg = (void *)action; 796 pipi->arg = (void *)action;
772 pipi->dest = cpu; 797 pipi->dest = cpu;
773 if (cpu_data[cpu].vpe_id != cpu_data[smp_processor_id()].vpe_id) { 798 if (cpu_data[cpu].vpe_id != cpu_data[smp_processor_id()].vpe_id) {
774 if (type == SMTC_CLOCK_TICK)
775 atomic_inc(&ipi_timer_latch[cpu]);
776 /* If not on same VPE, enqueue and send cross-VPE interrupt */ 799 /* If not on same VPE, enqueue and send cross-VPE interrupt */
777 smtc_ipi_nq(&IPIQ[cpu], pipi); 800 smtc_ipi_nq(&IPIQ[cpu], pipi);
778 LOCK_CORE_PRA(); 801 LOCK_CORE_PRA();
@@ -800,22 +823,29 @@ void smtc_send_ipi(int cpu, int type, unsigned int action)
800 823
801 if ((tcstatus & TCSTATUS_IXMT) != 0) { 824 if ((tcstatus & TCSTATUS_IXMT) != 0) {
802 /* 825 /*
803 * Spin-waiting here can deadlock, 826 * If we're in the the irq-off version of the wait
804 * so we queue the message for the target TC. 827 * loop, we need to force exit from the wait and
828 * do a direct post of the IPI.
829 */
830 if (cpu_wait == r4k_wait_irqoff) {
831 tcrestart = read_tc_c0_tcrestart();
832 if (tcrestart >= (unsigned long)r4k_wait_irqoff
833 && tcrestart < (unsigned long)__pastwait) {
834 write_tc_c0_tcrestart(__pastwait);
835 tcstatus &= ~TCSTATUS_IXMT;
836 write_tc_c0_tcstatus(tcstatus);
837 goto postdirect;
838 }
839 }
840 /*
841 * Otherwise we queue the message for the target TC
842 * to pick up when he does a local_irq_restore()
805 */ 843 */
806 write_tc_c0_tchalt(0); 844 write_tc_c0_tchalt(0);
807 UNLOCK_CORE_PRA(); 845 UNLOCK_CORE_PRA();
808 /* Try to reduce redundant timer interrupt messages */
809 if (type == SMTC_CLOCK_TICK) {
810 if (atomic_postincrement(&ipi_timer_latch[cpu])!=0){
811 smtc_ipi_nq(&freeIPIq, pipi);
812 return;
813 }
814 }
815 smtc_ipi_nq(&IPIQ[cpu], pipi); 846 smtc_ipi_nq(&IPIQ[cpu], pipi);
816 } else { 847 } else {
817 if (type == SMTC_CLOCK_TICK) 848postdirect:
818 atomic_inc(&ipi_timer_latch[cpu]);
819 post_direct_ipi(cpu, pipi); 849 post_direct_ipi(cpu, pipi);
820 write_tc_c0_tchalt(0); 850 write_tc_c0_tchalt(0);
821 UNLOCK_CORE_PRA(); 851 UNLOCK_CORE_PRA();
@@ -883,7 +913,7 @@ static void ipi_call_interrupt(void)
883 smp_call_function_interrupt(); 913 smp_call_function_interrupt();
884} 914}
885 915
886DECLARE_PER_CPU(struct clock_event_device, smtc_dummy_clockevent_device); 916DECLARE_PER_CPU(struct clock_event_device, mips_clockevent_device);
887 917
888void ipi_decode(struct smtc_ipi *pipi) 918void ipi_decode(struct smtc_ipi *pipi)
889{ 919{
@@ -891,20 +921,13 @@ void ipi_decode(struct smtc_ipi *pipi)
891 struct clock_event_device *cd; 921 struct clock_event_device *cd;
892 void *arg_copy = pipi->arg; 922 void *arg_copy = pipi->arg;
893 int type_copy = pipi->type; 923 int type_copy = pipi->type;
894 int ticks;
895
896 smtc_ipi_nq(&freeIPIq, pipi); 924 smtc_ipi_nq(&freeIPIq, pipi);
897 switch (type_copy) { 925 switch (type_copy) {
898 case SMTC_CLOCK_TICK: 926 case SMTC_CLOCK_TICK:
899 irq_enter(); 927 irq_enter();
900 kstat_this_cpu.irqs[MIPS_CPU_IRQ_BASE + 1]++; 928 kstat_this_cpu.irqs[MIPS_CPU_IRQ_BASE + 1]++;
901 cd = &per_cpu(smtc_dummy_clockevent_device, cpu); 929 cd = &per_cpu(mips_clockevent_device, cpu);
902 ticks = atomic_read(&ipi_timer_latch[cpu]); 930 cd->event_handler(cd);
903 atomic_sub(ticks, &ipi_timer_latch[cpu]);
904 while (ticks) {
905 cd->event_handler(cd);
906 ticks--;
907 }
908 irq_exit(); 931 irq_exit();
909 break; 932 break;
910 933
@@ -937,24 +960,48 @@ void ipi_decode(struct smtc_ipi *pipi)
937 } 960 }
938} 961}
939 962
963/*
964 * Similar to smtc_ipi_replay(), but invoked from context restore,
965 * so it reuses the current exception frame rather than set up a
966 * new one with self_ipi.
967 */
968
940void deferred_smtc_ipi(void) 969void deferred_smtc_ipi(void)
941{ 970{
942 struct smtc_ipi *pipi; 971 int cpu = smp_processor_id();
943 unsigned long flags;
944/* DEBUG */
945 int q = smp_processor_id();
946 972
947 /* 973 /*
948 * Test is not atomic, but much faster than a dequeue, 974 * Test is not atomic, but much faster than a dequeue,
949 * and the vast majority of invocations will have a null queue. 975 * and the vast majority of invocations will have a null queue.
976 * If irq_disabled when this was called, then any IPIs queued
977 * after we test last will be taken on the next irq_enable/restore.
978 * If interrupts were enabled, then any IPIs added after the
979 * last test will be taken directly.
950 */ 980 */
951 if (IPIQ[q].head != NULL) { 981
952 while((pipi = smtc_ipi_dq(&IPIQ[q])) != NULL) { 982 while (IPIQ[cpu].head != NULL) {
953 /* ipi_decode() should be called with interrupts off */ 983 struct smtc_ipi_q *q = &IPIQ[cpu];
954 local_irq_save(flags); 984 struct smtc_ipi *pipi;
985 unsigned long flags;
986
987 /*
988 * It may be possible we'll come in with interrupts
989 * already enabled.
990 */
991 local_irq_save(flags);
992
993 spin_lock(&q->lock);
994 pipi = __smtc_ipi_dq(q);
995 spin_unlock(&q->lock);
996 if (pipi != NULL)
955 ipi_decode(pipi); 997 ipi_decode(pipi);
956 local_irq_restore(flags); 998 /*
957 } 999 * The use of the __raw_local restore isn't
1000 * as obviously necessary here as in smtc_ipi_replay(),
1001 * but it's more efficient, given that we're already
1002 * running down the IPI queue.
1003 */
1004 __raw_local_irq_restore(flags);
958 } 1005 }
959} 1006}
960 1007
@@ -975,7 +1022,7 @@ static irqreturn_t ipi_interrupt(int irq, void *dev_idm)
975 struct smtc_ipi *pipi; 1022 struct smtc_ipi *pipi;
976 unsigned long tcstatus; 1023 unsigned long tcstatus;
977 int sent; 1024 int sent;
978 long flags; 1025 unsigned long flags;
979 unsigned int mtflags; 1026 unsigned int mtflags;
980 unsigned int vpflags; 1027 unsigned int vpflags;
981 1028
@@ -1066,55 +1113,53 @@ static void setup_cross_vpe_interrupts(unsigned int nvpe)
1066 1113
1067/* 1114/*
1068 * SMTC-specific hacks invoked from elsewhere in the kernel. 1115 * SMTC-specific hacks invoked from elsewhere in the kernel.
1069 *
1070 * smtc_ipi_replay is called from raw_local_irq_restore which is only ever
1071 * called with interrupts disabled. We do rely on interrupts being disabled
1072 * here because using spin_lock_irqsave()/spin_unlock_irqrestore() would
1073 * result in a recursive call to raw_local_irq_restore().
1074 */ 1116 */
1075 1117
1076static void __smtc_ipi_replay(void) 1118 /*
1119 * smtc_ipi_replay is called from raw_local_irq_restore
1120 */
1121
1122void smtc_ipi_replay(void)
1077{ 1123{
1078 unsigned int cpu = smp_processor_id(); 1124 unsigned int cpu = smp_processor_id();
1079 1125
1080 /* 1126 /*
1081 * To the extent that we've ever turned interrupts off, 1127 * To the extent that we've ever turned interrupts off,
1082 * we may have accumulated deferred IPIs. This is subtle. 1128 * we may have accumulated deferred IPIs. This is subtle.
1083 * If we use the smtc_ipi_qdepth() macro, we'll get an
1084 * exact number - but we'll also disable interrupts
1085 * and create a window of failure where a new IPI gets
1086 * queued after we test the depth but before we re-enable
1087 * interrupts. So long as IXMT never gets set, however,
1088 * we should be OK: If we pick up something and dispatch 1129 * we should be OK: If we pick up something and dispatch
1089 * it here, that's great. If we see nothing, but concurrent 1130 * it here, that's great. If we see nothing, but concurrent
1090 * with this operation, another TC sends us an IPI, IXMT 1131 * with this operation, another TC sends us an IPI, IXMT
1091 * is clear, and we'll handle it as a real pseudo-interrupt 1132 * is clear, and we'll handle it as a real pseudo-interrupt
1092 * and not a pseudo-pseudo interrupt. 1133 * and not a pseudo-pseudo interrupt. The important thing
1134 * is to do the last check for queued message *after* the
1135 * re-enabling of interrupts.
1093 */ 1136 */
1094 if (IPIQ[cpu].depth > 0) { 1137 while (IPIQ[cpu].head != NULL) {
1095 while (1) { 1138 struct smtc_ipi_q *q = &IPIQ[cpu];
1096 struct smtc_ipi_q *q = &IPIQ[cpu]; 1139 struct smtc_ipi *pipi;
1097 struct smtc_ipi *pipi; 1140 unsigned long flags;
1098 extern void self_ipi(struct smtc_ipi *); 1141
1099 1142 /*
1100 spin_lock(&q->lock); 1143 * It's just possible we'll come in with interrupts
1101 pipi = __smtc_ipi_dq(q); 1144 * already enabled.
1102 spin_unlock(&q->lock); 1145 */
1103 if (!pipi) 1146 local_irq_save(flags);
1104 break; 1147
1148 spin_lock(&q->lock);
1149 pipi = __smtc_ipi_dq(q);
1150 spin_unlock(&q->lock);
1151 /*
1152 ** But use a raw restore here to avoid recursion.
1153 */
1154 __raw_local_irq_restore(flags);
1105 1155
1156 if (pipi) {
1106 self_ipi(pipi); 1157 self_ipi(pipi);
1107 smtc_cpu_stats[cpu].selfipis++; 1158 smtc_cpu_stats[cpu].selfipis++;
1108 } 1159 }
1109 } 1160 }
1110} 1161}
1111 1162
1112void smtc_ipi_replay(void)
1113{
1114 raw_local_irq_disable();
1115 __smtc_ipi_replay();
1116}
1117
1118EXPORT_SYMBOL(smtc_ipi_replay); 1163EXPORT_SYMBOL(smtc_ipi_replay);
1119 1164
1120void smtc_idle_loop_hook(void) 1165void smtc_idle_loop_hook(void)
@@ -1193,40 +1238,13 @@ void smtc_idle_loop_hook(void)
1193 } 1238 }
1194 } 1239 }
1195 1240
1196 /*
1197 * Now that we limit outstanding timer IPIs, check for hung TC
1198 */
1199 for (tc = 0; tc < NR_CPUS; tc++) {
1200 /* Don't check ourself - we'll dequeue IPIs just below */
1201 if ((tc != smp_processor_id()) &&
1202 atomic_read(&ipi_timer_latch[tc]) > timerq_limit) {
1203 if (clock_hang_reported[tc] == 0) {
1204 pdb_msg += sprintf(pdb_msg,
1205 "TC %d looks hung with timer latch at %d\n",
1206 tc, atomic_read(&ipi_timer_latch[tc]));
1207 clock_hang_reported[tc]++;
1208 }
1209 }
1210 }
1211 emt(mtflags); 1241 emt(mtflags);
1212 local_irq_restore(flags); 1242 local_irq_restore(flags);
1213 if (pdb_msg != &id_ho_db_msg[0]) 1243 if (pdb_msg != &id_ho_db_msg[0])
1214 printk("CPU%d: %s", smp_processor_id(), id_ho_db_msg); 1244 printk("CPU%d: %s", smp_processor_id(), id_ho_db_msg);
1215#endif /* CONFIG_SMTC_IDLE_HOOK_DEBUG */ 1245#endif /* CONFIG_SMTC_IDLE_HOOK_DEBUG */
1216 1246
1217 /* 1247 smtc_ipi_replay();
1218 * Replay any accumulated deferred IPIs. If "Instant Replay"
1219 * is in use, there should never be any.
1220 */
1221#ifndef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY
1222 {
1223 unsigned long flags;
1224
1225 local_irq_save(flags);
1226 __smtc_ipi_replay();
1227 local_irq_restore(flags);
1228 }
1229#endif /* CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY */
1230} 1248}
1231 1249
1232void smtc_soft_dump(void) 1250void smtc_soft_dump(void)
@@ -1242,10 +1260,6 @@ void smtc_soft_dump(void)
1242 printk("%d: %ld\n", i, smtc_cpu_stats[i].selfipis); 1260 printk("%d: %ld\n", i, smtc_cpu_stats[i].selfipis);
1243 } 1261 }
1244 smtc_ipi_qdump(); 1262 smtc_ipi_qdump();
1245 printk("Timer IPI Backlogs:\n");
1246 for (i=0; i < NR_CPUS; i++) {
1247 printk("%d: %d\n", i, atomic_read(&ipi_timer_latch[i]));
1248 }
1249 printk("%d Recoveries of \"stolen\" FPU\n", 1263 printk("%d Recoveries of \"stolen\" FPU\n",
1250 atomic_read(&smtc_fpu_recoveries)); 1264 atomic_read(&smtc_fpu_recoveries));
1251} 1265}
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 6bee29097a56..b602ac6eb47d 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -46,6 +46,9 @@
46#include <asm/types.h> 46#include <asm/types.h>
47#include <asm/stacktrace.h> 47#include <asm/stacktrace.h>
48 48
49extern void check_wait(void);
50extern asmlinkage void r4k_wait(void);
51extern asmlinkage void rollback_handle_int(void);
49extern asmlinkage void handle_int(void); 52extern asmlinkage void handle_int(void);
50extern asmlinkage void handle_tlbm(void); 53extern asmlinkage void handle_tlbm(void);
51extern asmlinkage void handle_tlbl(void); 54extern asmlinkage void handle_tlbl(void);
@@ -822,8 +825,10 @@ static void mt_ase_fp_affinity(void)
822 if (cpus_intersects(current->cpus_allowed, mt_fpu_cpumask)) { 825 if (cpus_intersects(current->cpus_allowed, mt_fpu_cpumask)) {
823 cpumask_t tmask; 826 cpumask_t tmask;
824 827
825 cpus_and(tmask, current->thread.user_cpus_allowed, 828 current->thread.user_cpus_allowed
826 mt_fpu_cpumask); 829 = current->cpus_allowed;
830 cpus_and(tmask, current->cpus_allowed,
831 mt_fpu_cpumask);
827 set_cpus_allowed(current, tmask); 832 set_cpus_allowed(current, tmask);
828 set_thread_flag(TIF_FPUBOUND); 833 set_thread_flag(TIF_FPUBOUND);
829 } 834 }
@@ -1251,6 +1256,9 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
1251 1256
1252 extern char except_vec_vi, except_vec_vi_lui; 1257 extern char except_vec_vi, except_vec_vi_lui;
1253 extern char except_vec_vi_ori, except_vec_vi_end; 1258 extern char except_vec_vi_ori, except_vec_vi_end;
1259 extern char rollback_except_vec_vi;
1260 char *vec_start = (cpu_wait == r4k_wait) ?
1261 &rollback_except_vec_vi : &except_vec_vi;
1254#ifdef CONFIG_MIPS_MT_SMTC 1262#ifdef CONFIG_MIPS_MT_SMTC
1255 /* 1263 /*
1256 * We need to provide the SMTC vectored interrupt handler 1264 * We need to provide the SMTC vectored interrupt handler
@@ -1258,11 +1266,11 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
1258 * Status.IM bit to be masked before going there. 1266 * Status.IM bit to be masked before going there.
1259 */ 1267 */
1260 extern char except_vec_vi_mori; 1268 extern char except_vec_vi_mori;
1261 const int mori_offset = &except_vec_vi_mori - &except_vec_vi; 1269 const int mori_offset = &except_vec_vi_mori - vec_start;
1262#endif /* CONFIG_MIPS_MT_SMTC */ 1270#endif /* CONFIG_MIPS_MT_SMTC */
1263 const int handler_len = &except_vec_vi_end - &except_vec_vi; 1271 const int handler_len = &except_vec_vi_end - vec_start;
1264 const int lui_offset = &except_vec_vi_lui - &except_vec_vi; 1272 const int lui_offset = &except_vec_vi_lui - vec_start;
1265 const int ori_offset = &except_vec_vi_ori - &except_vec_vi; 1273 const int ori_offset = &except_vec_vi_ori - vec_start;
1266 1274
1267 if (handler_len > VECTORSPACING) { 1275 if (handler_len > VECTORSPACING) {
1268 /* 1276 /*
@@ -1272,7 +1280,7 @@ static void *set_vi_srs_handler(int n, vi_handler_t addr, int srs)
1272 panic("VECTORSPACING too small"); 1280 panic("VECTORSPACING too small");
1273 } 1281 }
1274 1282
1275 memcpy(b, &except_vec_vi, handler_len); 1283 memcpy(b, vec_start, handler_len);
1276#ifdef CONFIG_MIPS_MT_SMTC 1284#ifdef CONFIG_MIPS_MT_SMTC
1277 BUG_ON(n > 7); /* Vector index %d exceeds SMTC maximum. */ 1285 BUG_ON(n > 7); /* Vector index %d exceeds SMTC maximum. */
1278 1286
@@ -1554,6 +1562,10 @@ void __init trap_init(void)
1554 extern char except_vec3_generic, except_vec3_r4000; 1562 extern char except_vec3_generic, except_vec3_r4000;
1555 extern char except_vec4; 1563 extern char except_vec4;
1556 unsigned long i; 1564 unsigned long i;
1565 int rollback;
1566
1567 check_wait();
1568 rollback = (cpu_wait == r4k_wait);
1557 1569
1558#if defined(CONFIG_KGDB) 1570#if defined(CONFIG_KGDB)
1559 if (kgdb_early_setup) 1571 if (kgdb_early_setup)
@@ -1618,7 +1630,7 @@ void __init trap_init(void)
1618 if (board_be_init) 1630 if (board_be_init)
1619 board_be_init(); 1631 board_be_init();
1620 1632
1621 set_except_vector(0, handle_int); 1633 set_except_vector(0, rollback ? rollback_handle_int : handle_int);
1622 set_except_vector(1, handle_tlbm); 1634 set_except_vector(1, handle_tlbm);
1623 set_except_vector(2, handle_tlbl); 1635 set_except_vector(2, handle_tlbl);
1624 set_except_vector(3, handle_tlbs); 1636 set_except_vector(3, handle_tlbs);
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
index b5470ceb418b..afb119f35682 100644
--- a/arch/mips/kernel/vmlinux.lds.S
+++ b/arch/mips/kernel/vmlinux.lds.S
@@ -36,6 +36,7 @@ SECTIONS
36 SCHED_TEXT 36 SCHED_TEXT
37 LOCK_TEXT 37 LOCK_TEXT
38 KPROBES_TEXT 38 KPROBES_TEXT
39 *(.text.*)
39 *(.fixup) 40 *(.fixup)
40 *(.gnu.warning) 41 *(.gnu.warning)
41 } :text = 0 42 } :text = 0
diff --git a/arch/mips/lib/csum_partial.S b/arch/mips/lib/csum_partial.S
index 8d7784122c14..edac9892c51a 100644
--- a/arch/mips/lib/csum_partial.S
+++ b/arch/mips/lib/csum_partial.S
@@ -39,12 +39,14 @@
39#ifdef USE_DOUBLE 39#ifdef USE_DOUBLE
40 40
41#define LOAD ld 41#define LOAD ld
42#define LOAD32 lwu
42#define ADD daddu 43#define ADD daddu
43#define NBYTES 8 44#define NBYTES 8
44 45
45#else 46#else
46 47
47#define LOAD lw 48#define LOAD lw
49#define LOAD32 lw
48#define ADD addu 50#define ADD addu
49#define NBYTES 4 51#define NBYTES 4
50 52
@@ -60,6 +62,14 @@
60 ADD sum, v1; \ 62 ADD sum, v1; \
61 .set pop 63 .set pop
62 64
65#define ADDC32(sum,reg) \
66 .set push; \
67 .set noat; \
68 addu sum, reg; \
69 sltu v1, sum, reg; \
70 addu sum, v1; \
71 .set pop
72
63#define CSUM_BIGCHUNK1(src, offset, sum, _t0, _t1, _t2, _t3) \ 73#define CSUM_BIGCHUNK1(src, offset, sum, _t0, _t1, _t2, _t3) \
64 LOAD _t0, (offset + UNIT(0))(src); \ 74 LOAD _t0, (offset + UNIT(0))(src); \
65 LOAD _t1, (offset + UNIT(1))(src); \ 75 LOAD _t1, (offset + UNIT(1))(src); \
@@ -132,7 +142,7 @@ LEAF(csum_partial)
132 beqz t8, .Lqword_align 142 beqz t8, .Lqword_align
133 andi t8, src, 0x8 143 andi t8, src, 0x8
134 144
135 lw t0, 0x00(src) 145 LOAD32 t0, 0x00(src)
136 LONG_SUBU a1, a1, 0x4 146 LONG_SUBU a1, a1, 0x4
137 ADDC(sum, t0) 147 ADDC(sum, t0)
138 PTR_ADDU src, src, 0x4 148 PTR_ADDU src, src, 0x4
@@ -211,7 +221,7 @@ LEAF(csum_partial)
211 LONG_SRL t8, t8, 0x2 221 LONG_SRL t8, t8, 0x2
212 222
213.Lend_words: 223.Lend_words:
214 lw t0, (src) 224 LOAD32 t0, (src)
215 LONG_SUBU t8, t8, 0x1 225 LONG_SUBU t8, t8, 0x1
216 ADDC(sum, t0) 226 ADDC(sum, t0)
217 .set reorder /* DADDI_WAR */ 227 .set reorder /* DADDI_WAR */
@@ -230,6 +240,9 @@ LEAF(csum_partial)
230 /* Still a full word to go */ 240 /* Still a full word to go */
231 ulw t1, (src) 241 ulw t1, (src)
232 PTR_ADDIU src, 4 242 PTR_ADDIU src, 4
243#ifdef USE_DOUBLE
244 dsll t1, t1, 32 /* clear lower 32bit */
245#endif
233 ADDC(sum, t1) 246 ADDC(sum, t1)
234 247
2351: move t1, zero 2481: move t1, zero
@@ -280,7 +293,7 @@ LEAF(csum_partial)
2801: 2931:
281 .set reorder 294 .set reorder
282 /* Add the passed partial csum. */ 295 /* Add the passed partial csum. */
283 ADDC(sum, a2) 296 ADDC32(sum, a2)
284 jr ra 297 jr ra
285 .set noreorder 298 .set noreorder
286 END(csum_partial) 299 END(csum_partial)
@@ -681,7 +694,7 @@ EXC( sb t0, NBYTES-2(dst), .Ls_exc)
681 .set pop 694 .set pop
6821: 6951:
683 .set reorder 696 .set reorder
684 ADDC(sum, psum) 697 ADDC32(sum, psum)
685 jr ra 698 jr ra
686 .set noreorder 699 .set noreorder
687 700
diff --git a/arch/mips/mti-malta/Makefile b/arch/mips/mti-malta/Makefile
index 3b7dd722c32a..cef2db8d2225 100644
--- a/arch/mips/mti-malta/Makefile
+++ b/arch/mips/mti-malta/Makefile
@@ -15,6 +15,6 @@ obj-$(CONFIG_EARLY_PRINTK) += malta-console.o
15obj-$(CONFIG_PCI) += malta-pci.o 15obj-$(CONFIG_PCI) += malta-pci.o
16 16
17# FIXME FIXME FIXME 17# FIXME FIXME FIXME
18obj-$(CONFIG_MIPS_MT_SMTC) += malta_smtc.o 18obj-$(CONFIG_MIPS_MT_SMTC) += malta-smtc.o
19 19
20EXTRA_CFLAGS += -Werror 20EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/mti-malta/malta-smtc.c b/arch/mips/mti-malta/malta-smtc.c
index 5ea705e49454..f84a46a8ae6e 100644
--- a/arch/mips/mti-malta/malta-smtc.c
+++ b/arch/mips/mti-malta/malta-smtc.c
@@ -84,12 +84,17 @@ static void msmtc_cpus_done(void)
84 84
85static void __init msmtc_smp_setup(void) 85static void __init msmtc_smp_setup(void)
86{ 86{
87 mipsmt_build_cpu_map(0); 87 /*
88 * we won't get the definitive value until
89 * we've run smtc_prepare_cpus later, but
90 * we would appear to need an upper bound now.
91 */
92 smp_num_siblings = smtc_build_cpu_map(0);
88} 93}
89 94
90static void __init msmtc_prepare_cpus(unsigned int max_cpus) 95static void __init msmtc_prepare_cpus(unsigned int max_cpus)
91{ 96{
92 mipsmt_prepare_cpus(); 97 smtc_prepare_cpus(max_cpus);
93} 98}
94 99
95struct plat_smp_ops msmtc_smp_ops = { 100struct plat_smp_ops msmtc_smp_ops = {
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index 15e01aec37fd..c8c32f417b6c 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_SOC_TX3927) += ops-tx3927.o
15obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o 15obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o
16obj-$(CONFIG_MARKEINS) += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o 16obj-$(CONFIG_MARKEINS) += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o
17obj-$(CONFIG_PCI_TX4927) += ops-tx4927.o 17obj-$(CONFIG_PCI_TX4927) += ops-tx4927.o
18obj-$(CONFIG_BCM47XX) += pci-bcm47xx.o
18 19
19# 20#
20# These are still pretty much in the old state, watch, go blind. 21# These are still pretty much in the old state, watch, go blind.
diff --git a/arch/mips/pci/pci-bcm47xx.c b/arch/mips/pci/pci-bcm47xx.c
new file mode 100644
index 000000000000..bea9b6cdfdbf
--- /dev/null
+++ b/arch/mips/pci/pci-bcm47xx.c
@@ -0,0 +1,60 @@
1/*
2 * Copyright (C) 2008 Aurelien Jarno <aurelien@aurel32.net>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
10 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
12 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
13 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
14 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
15 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
16 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
17 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
18 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 675 Mass Ave, Cambridge, MA 02139, USA.
23 */
24
25#include <linux/types.h>
26#include <linux/pci.h>
27#include <linux/ssb/ssb.h>
28
29int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
30{
31 return 0;
32}
33
34int pcibios_plat_dev_init(struct pci_dev *dev)
35{
36 int res;
37 u8 slot, pin;
38
39 res = ssb_pcibios_plat_dev_init(dev);
40 if (res < 0) {
41 printk(KERN_ALERT "PCI: Failed to init device %s\n",
42 pci_name(dev));
43 return res;
44 }
45
46 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
47 slot = PCI_SLOT(dev->devfn);
48 res = ssb_pcibios_map_irq(dev, slot, pin);
49
50 /* IRQ-0 and IRQ-1 are software interrupts. */
51 if (res < 2) {
52 printk(KERN_ALERT "PCI: Failed to map IRQ of device %s\n",
53 pci_name(dev));
54 return res;
55 }
56
57 dev->irq = res;
58 return 0;
59}
60
diff --git a/arch/mips/pci/pci-ip27.c b/arch/mips/pci/pci-ip27.c
index bd78368c82bf..f97ab1461012 100644
--- a/arch/mips/pci/pci-ip27.c
+++ b/arch/mips/pci/pci-ip27.c
@@ -143,25 +143,47 @@ int __cpuinit bridge_probe(nasid_t nasid, int widget_id, int masterwid)
143 */ 143 */
144int __devinit pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 144int __devinit pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
145{ 145{
146 return 0;
147}
148
149/* Most MIPS systems have straight-forward swizzling needs. */
150static inline u8 bridge_swizzle(u8 pin, u8 slot)
151{
152 return (((pin - 1) + slot) % 4) + 1;
153}
154
155static inline struct pci_dev *bridge_root_dev(struct pci_dev *dev)
156{
157 while (dev->bus->parent) {
158 /* Move up the chain of bridges. */
159 dev = dev->bus->self;
160 }
161
162 return dev;
163}
164
165/* Do platform specific device initialization at pci_enable_device() time */
166int pcibios_plat_dev_init(struct pci_dev *dev)
167{
146 struct bridge_controller *bc = BRIDGE_CONTROLLER(dev->bus); 168 struct bridge_controller *bc = BRIDGE_CONTROLLER(dev->bus);
147 int irq = bc->pci_int[slot]; 169 struct pci_dev *rdev = bridge_root_dev(dev);
170 int slot = PCI_SLOT(rdev->devfn);
171 int irq;
148 172
173 irq = bc->pci_int[slot];
149 if (irq == -1) { 174 if (irq == -1) {
150 irq = bc->pci_int[slot] = request_bridge_irq(bc); 175 irq = request_bridge_irq(bc);
151 if (irq < 0) 176 if (irq < 0)
152 panic("Can't allocate interrupt for PCI device %s\n", 177 return irq;
153 pci_name(dev)); 178
179 bc->pci_int[slot] = irq;
154 } 180 }
155 181
156 irq_to_bridge[irq] = bc; 182 irq_to_bridge[irq] = bc;
157 irq_to_slot[irq] = slot; 183 irq_to_slot[irq] = slot;
158 184
159 return irq; 185 dev->irq = irq;
160}
161 186
162/* Do platform specific device initialization at pci_enable_device() time */
163int pcibios_plat_dev_init(struct pci_dev *dev)
164{
165 return 0; 187 return 0;
166} 188}
167 189
diff --git a/arch/mips/sibyte/swarm/Makefile b/arch/mips/sibyte/swarm/Makefile
index f18ba9201bbc..7b45f199d92a 100644
--- a/arch/mips/sibyte/swarm/Makefile
+++ b/arch/mips/sibyte/swarm/Makefile
@@ -1,3 +1,4 @@
1obj-y := setup.o rtc_xicor1241.o rtc_m41t81.o 1obj-y := platform.o setup.o rtc_xicor1241.o \
2 rtc_m41t81.o
2 3
3obj-$(CONFIG_I2C_BOARDINFO) += swarm-i2c.o 4obj-$(CONFIG_I2C_BOARDINFO) += swarm-i2c.o
diff --git a/arch/mips/sibyte/swarm/platform.c b/arch/mips/sibyte/swarm/platform.c
new file mode 100644
index 000000000000..54847fe1e564
--- /dev/null
+++ b/arch/mips/sibyte/swarm/platform.c
@@ -0,0 +1,85 @@
1#include <linux/err.h>
2#include <linux/kernel.h>
3#include <linux/init.h>
4#include <linux/io.h>
5#include <linux/platform_device.h>
6#include <linux/ata_platform.h>
7
8#include <asm/sibyte/board.h>
9#include <asm/sibyte/sb1250_genbus.h>
10#include <asm/sibyte/sb1250_regs.h>
11
12#if defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_LITTLESUR)
13
14#define DRV_NAME "pata-swarm"
15
16#define SWARM_IDE_SHIFT 5
17#define SWARM_IDE_BASE 0x1f0
18#define SWARM_IDE_CTRL 0x3f6
19
20static struct resource swarm_pata_resource[] = {
21 {
22 .name = "Swarm GenBus IDE",
23 .flags = IORESOURCE_MEM,
24 }, {
25 .name = "Swarm GenBus IDE",
26 .flags = IORESOURCE_MEM,
27 }, {
28 .name = "Swarm GenBus IDE",
29 .flags = IORESOURCE_IRQ,
30 .start = K_INT_GB_IDE,
31 .end = K_INT_GB_IDE,
32 },
33};
34
35static struct pata_platform_info pata_platform_data = {
36 .ioport_shift = SWARM_IDE_SHIFT,
37};
38
39static struct platform_device swarm_pata_device = {
40 .name = "pata_platform",
41 .id = -1,
42 .resource = swarm_pata_resource,
43 .num_resources = ARRAY_SIZE(swarm_pata_resource),
44 .dev = {
45 .platform_data = &pata_platform_data,
46 .coherent_dma_mask = ~0, /* grumble */
47 },
48};
49
50static int __init swarm_pata_init(void)
51{
52 u8 __iomem *base;
53 phys_t offset, size;
54 struct resource *r;
55
56 if (!SIBYTE_HAVE_IDE)
57 return -ENODEV;
58
59 base = ioremap(A_IO_EXT_BASE, 0x800);
60 offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS));
61 size = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_MULT_SIZE, IDE_CS));
62 iounmap(base);
63
64 offset = G_IO_START_ADDR(offset) << S_IO_ADDRBASE;
65 size = (G_IO_MULT_SIZE(size) + 1) << S_IO_REGSIZE;
66 if (offset < A_PHYS_GENBUS || offset >= A_PHYS_GENBUS_END) {
67 pr_info(DRV_NAME ": PATA interface at GenBus disabled\n");
68
69 return -EBUSY;
70 }
71
72 pr_info(DRV_NAME ": PATA interface at GenBus slot %i\n", IDE_CS);
73
74 r = swarm_pata_resource;
75 r[0].start = offset + (SWARM_IDE_BASE << SWARM_IDE_SHIFT);
76 r[0].end = offset + ((SWARM_IDE_BASE + 8) << SWARM_IDE_SHIFT) - 1;
77 r[1].start = offset + (SWARM_IDE_CTRL << SWARM_IDE_SHIFT);
78 r[1].end = offset + ((SWARM_IDE_CTRL + 1) << SWARM_IDE_SHIFT) - 1;
79
80 return platform_device_register(&swarm_pata_device);
81}
82
83device_initcall(swarm_pata_init);
84
85#endif /* defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_LITTLESUR) */
diff --git a/arch/mips/vr41xx/common/irq.c b/arch/mips/vr41xx/common/irq.c
index cba36a247e32..92dd1a0ca352 100644
--- a/arch/mips/vr41xx/common/irq.c
+++ b/arch/mips/vr41xx/common/irq.c
@@ -72,6 +72,7 @@ static void irq_dispatch(unsigned int irq)
72 cascade = irq_cascade + irq; 72 cascade = irq_cascade + irq;
73 if (cascade->get_irq != NULL) { 73 if (cascade->get_irq != NULL) {
74 unsigned int source_irq = irq; 74 unsigned int source_irq = irq;
75 int ret;
75 desc = irq_desc + source_irq; 76 desc = irq_desc + source_irq;
76 if (desc->chip->mask_ack) 77 if (desc->chip->mask_ack)
77 desc->chip->mask_ack(source_irq); 78 desc->chip->mask_ack(source_irq);
@@ -79,8 +80,9 @@ static void irq_dispatch(unsigned int irq)
79 desc->chip->mask(source_irq); 80 desc->chip->mask(source_irq);
80 desc->chip->ack(source_irq); 81 desc->chip->ack(source_irq);
81 } 82 }
82 irq = cascade->get_irq(irq); 83 ret = cascade->get_irq(irq);
83 if (irq < 0) 84 irq = ret;
85 if (ret < 0)
84 atomic_inc(&irq_err_count); 86 atomic_inc(&irq_err_count);
85 else 87 else
86 irq_dispatch(irq); 88 irq_dispatch(irq);
diff --git a/arch/mn10300/kernel/irq.c b/arch/mn10300/kernel/irq.c
index 761c434a2488..56c64ccc9c21 100644
--- a/arch/mn10300/kernel/irq.c
+++ b/arch/mn10300/kernel/irq.c
@@ -20,22 +20,8 @@ EXPORT_SYMBOL(__mn10300_irq_enabled_epsw);
20atomic_t irq_err_count; 20atomic_t irq_err_count;
21 21
22/* 22/*
23 * MN10300 INTC controller operations 23 * MN10300 interrupt controller operations
24 */ 24 */
25static void mn10300_cpupic_disable(unsigned int irq)
26{
27 u16 tmp = GxICR(irq);
28 GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_DETECT;
29 tmp = GxICR(irq);
30}
31
32static void mn10300_cpupic_enable(unsigned int irq)
33{
34 u16 tmp = GxICR(irq);
35 GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE;
36 tmp = GxICR(irq);
37}
38
39static void mn10300_cpupic_ack(unsigned int irq) 25static void mn10300_cpupic_ack(unsigned int irq)
40{ 26{
41 u16 tmp; 27 u16 tmp;
@@ -60,26 +46,54 @@ static void mn10300_cpupic_mask_ack(unsigned int irq)
60static void mn10300_cpupic_unmask(unsigned int irq) 46static void mn10300_cpupic_unmask(unsigned int irq)
61{ 47{
62 u16 tmp = GxICR(irq); 48 u16 tmp = GxICR(irq);
63 GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE | GxICR_DETECT; 49 GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE;
64 tmp = GxICR(irq); 50 tmp = GxICR(irq);
65} 51}
66 52
67static void mn10300_cpupic_end(unsigned int irq) 53static void mn10300_cpupic_unmask_clear(unsigned int irq)
68{ 54{
55 /* the MN10300 PIC latches its interrupt request bit, even after the
56 * device has ceased to assert its interrupt line and the interrupt
57 * channel has been disabled in the PIC, so for level-triggered
58 * interrupts we need to clear the request bit when we re-enable */
69 u16 tmp = GxICR(irq); 59 u16 tmp = GxICR(irq);
70 GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE; 60 GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE | GxICR_DETECT;
71 tmp = GxICR(irq); 61 tmp = GxICR(irq);
72} 62}
73 63
74static struct irq_chip mn10300_cpu_pic = { 64/*
75 .name = "cpu", 65 * MN10300 PIC level-triggered IRQ handling.
76 .disable = mn10300_cpupic_disable, 66 *
77 .enable = mn10300_cpupic_enable, 67 * The PIC has no 'ACK' function per se. It is possible to clear individual
68 * channel latches, but each latch relatches whether or not the channel is
69 * masked, so we need to clear the latch when we unmask the channel.
70 *
71 * Also for this reason, we don't supply an ack() op (it's unused anyway if
72 * mask_ack() is provided), and mask_ack() just masks.
73 */
74static struct irq_chip mn10300_cpu_pic_level = {
75 .name = "cpu_l",
76 .disable = mn10300_cpupic_mask,
77 .enable = mn10300_cpupic_unmask_clear,
78 .ack = NULL,
79 .mask = mn10300_cpupic_mask,
80 .mask_ack = mn10300_cpupic_mask,
81 .unmask = mn10300_cpupic_unmask_clear,
82};
83
84/*
85 * MN10300 PIC edge-triggered IRQ handling.
86 *
87 * We use the latch clearing function of the PIC as the 'ACK' function.
88 */
89static struct irq_chip mn10300_cpu_pic_edge = {
90 .name = "cpu_e",
91 .disable = mn10300_cpupic_mask,
92 .enable = mn10300_cpupic_unmask,
78 .ack = mn10300_cpupic_ack, 93 .ack = mn10300_cpupic_ack,
79 .mask = mn10300_cpupic_mask, 94 .mask = mn10300_cpupic_mask,
80 .mask_ack = mn10300_cpupic_mask_ack, 95 .mask_ack = mn10300_cpupic_mask_ack,
81 .unmask = mn10300_cpupic_unmask, 96 .unmask = mn10300_cpupic_unmask,
82 .end = mn10300_cpupic_end,
83}; 97};
84 98
85/* 99/*
@@ -114,7 +128,8 @@ void set_intr_level(int irq, u16 level)
114 */ 128 */
115void set_intr_postackable(int irq) 129void set_intr_postackable(int irq)
116{ 130{
117 set_irq_handler(irq, handle_level_irq); 131 set_irq_chip_and_handler(irq, &mn10300_cpu_pic_level,
132 handle_level_irq);
118} 133}
119 134
120/* 135/*
@@ -126,8 +141,12 @@ void __init init_IRQ(void)
126 141
127 for (irq = 0; irq < NR_IRQS; irq++) 142 for (irq = 0; irq < NR_IRQS; irq++)
128 if (irq_desc[irq].chip == &no_irq_type) 143 if (irq_desc[irq].chip == &no_irq_type)
129 set_irq_chip_and_handler(irq, &mn10300_cpu_pic, 144 /* due to the PIC latching interrupt requests, even
130 handle_edge_irq); 145 * when the IRQ is disabled, IRQ_PENDING is superfluous
146 * and we can use handle_level_irq() for edge-triggered
147 * interrupts */
148 set_irq_chip_and_handler(irq, &mn10300_cpu_pic_edge,
149 handle_level_irq);
131 unit_init_IRQ(); 150 unit_init_IRQ();
132} 151}
133 152
diff --git a/arch/mn10300/kernel/time.c b/arch/mn10300/kernel/time.c
index babb7c2ac377..e4606586f94c 100644
--- a/arch/mn10300/kernel/time.c
+++ b/arch/mn10300/kernel/time.c
@@ -1,6 +1,6 @@
1/* MN10300 Low level time management 1/* MN10300 Low level time management
2 * 2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2007-2008 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
5 * - Derived from arch/i386/kernel/time.c 5 * - Derived from arch/i386/kernel/time.c
6 * 6 *
@@ -16,6 +16,7 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/smp.h> 17#include <linux/smp.h>
18#include <linux/profile.h> 18#include <linux/profile.h>
19#include <linux/cnt32_to_63.h>
19#include <asm/irq.h> 20#include <asm/irq.h>
20#include <asm/div64.h> 21#include <asm/div64.h>
21#include <asm/processor.h> 22#include <asm/processor.h>
@@ -40,27 +41,54 @@ static struct irqaction timer_irq = {
40 .name = "timer", 41 .name = "timer",
41}; 42};
42 43
44static unsigned long sched_clock_multiplier;
45
43/* 46/*
44 * scheduler clock - returns current time in nanosec units. 47 * scheduler clock - returns current time in nanosec units.
45 */ 48 */
46unsigned long long sched_clock(void) 49unsigned long long sched_clock(void)
47{ 50{
48 union { 51 union {
49 unsigned long long l; 52 unsigned long long ll;
50 u32 w[2]; 53 unsigned l[2];
51 } quot; 54 } tsc64, result;
55 unsigned long tsc, tmp;
56 unsigned product[3]; /* 96-bit intermediate value */
57
58 /* read the TSC value
59 */
60 tsc = 0 - get_cycles(); /* get_cycles() counts down */
52 61
53 quot.w[0] = mn10300_last_tsc - get_cycles(); 62 /* expand to 64-bits.
54 quot.w[1] = 1000000000; 63 * - sched_clock() must be called once a minute or better or the
64 * following will go horribly wrong - see cnt32_to_63()
65 */
66 tsc64.ll = cnt32_to_63(tsc) & 0x7fffffffffffffffULL;
55 67
56 asm("mulu %2,%3,%0,%1" 68 /* scale the 64-bit TSC value to a nanosecond value via a 96-bit
57 : "=r"(quot.w[1]), "=r"(quot.w[0]) 69 * intermediate
58 : "0"(quot.w[1]), "1"(quot.w[0]) 70 */
71 asm("mulu %2,%0,%3,%0 \n" /* LSW * mult -> 0:%3:%0 */
72 "mulu %2,%1,%2,%1 \n" /* MSW * mult -> %2:%1:0 */
73 "add %3,%1 \n"
74 "addc 0,%2 \n" /* result in %2:%1:%0 */
75 : "=r"(product[0]), "=r"(product[1]), "=r"(product[2]), "=r"(tmp)
76 : "0"(tsc64.l[0]), "1"(tsc64.l[1]), "2"(sched_clock_multiplier)
59 : "cc"); 77 : "cc");
60 78
61 do_div(quot.l, MN10300_TSCCLK); 79 result.l[0] = product[1] << 16 | product[0] >> 16;
80 result.l[1] = product[2] << 16 | product[1] >> 16;
62 81
63 return quot.l; 82 return result.ll;
83}
84
85/*
86 * initialise the scheduler clock
87 */
88static void __init mn10300_sched_clock_init(void)
89{
90 sched_clock_multiplier =
91 __muldiv64u(NSEC_PER_SEC, 1 << 16, MN10300_TSCCLK);
64} 92}
65 93
66/* 94/*
@@ -128,4 +156,6 @@ void __init time_init(void)
128 /* start the watchdog timer */ 156 /* start the watchdog timer */
129 watchdog_go(); 157 watchdog_go();
130#endif 158#endif
159
160 mn10300_sched_clock_init();
131} 161}
diff --git a/arch/mn10300/mm/fault.c b/arch/mn10300/mm/fault.c
index 78f092ca0316..33cf25025dac 100644
--- a/arch/mn10300/mm/fault.c
+++ b/arch/mn10300/mm/fault.c
@@ -174,7 +174,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long fault_code,
174 * If we're in an interrupt or have no user 174 * If we're in an interrupt or have no user
175 * context, we must not take the fault.. 175 * context, we must not take the fault..
176 */ 176 */
177 if (in_interrupt() || !mm) 177 if (in_atomic() || !mm)
178 goto no_context; 178 goto no_context;
179 179
180 down_read(&mm->mmap_sem); 180 down_read(&mm->mmap_sem);
diff --git a/arch/mn10300/unit-asb2303/unit-init.c b/arch/mn10300/unit-asb2303/unit-init.c
index 14b2c817cff8..70e8cb4ea266 100644
--- a/arch/mn10300/unit-asb2303/unit-init.c
+++ b/arch/mn10300/unit-asb2303/unit-init.c
@@ -51,7 +51,7 @@ void __init unit_init_IRQ(void)
51 switch (GET_XIRQ_TRIGGER(extnum)) { 51 switch (GET_XIRQ_TRIGGER(extnum)) {
52 case XIRQ_TRIGGER_HILEVEL: 52 case XIRQ_TRIGGER_HILEVEL:
53 case XIRQ_TRIGGER_LOWLEVEL: 53 case XIRQ_TRIGGER_LOWLEVEL:
54 set_irq_handler(XIRQ2IRQ(extnum), handle_level_irq); 54 set_intr_postackable(XIRQ2IRQ(extnum));
55 break; 55 break;
56 default: 56 default:
57 break; 57 break;
diff --git a/arch/mn10300/unit-asb2305/unit-init.c b/arch/mn10300/unit-asb2305/unit-init.c
index 6a352414a358..72812a9439ac 100644
--- a/arch/mn10300/unit-asb2305/unit-init.c
+++ b/arch/mn10300/unit-asb2305/unit-init.c
@@ -52,7 +52,7 @@ void __init unit_init_IRQ(void)
52 switch (GET_XIRQ_TRIGGER(extnum)) { 52 switch (GET_XIRQ_TRIGGER(extnum)) {
53 case XIRQ_TRIGGER_HILEVEL: 53 case XIRQ_TRIGGER_HILEVEL:
54 case XIRQ_TRIGGER_LOWLEVEL: 54 case XIRQ_TRIGGER_LOWLEVEL:
55 set_irq_handler(XIRQ2IRQ(extnum), handle_level_irq); 55 set_intr_postackable(XIRQ2IRQ(extnum));
56 break; 56 break;
57 default: 57 default:
58 break; 58 break;
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 717a3bc1352e..65d1a8454d2c 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -195,7 +195,7 @@ image-$(CONFIG_PPC_CELLEB) += zImage.pseries
195image-$(CONFIG_PPC_CHRP) += zImage.chrp 195image-$(CONFIG_PPC_CHRP) += zImage.chrp
196image-$(CONFIG_PPC_EFIKA) += zImage.chrp 196image-$(CONFIG_PPC_EFIKA) += zImage.chrp
197image-$(CONFIG_PPC_PMAC) += zImage.pmac 197image-$(CONFIG_PPC_PMAC) += zImage.pmac
198image-$(CONFIG_PPC_HOLLY) += zImage.holly 198image-$(CONFIG_PPC_HOLLY) += dtbImage.holly
199image-$(CONFIG_PPC_PRPMC2800) += dtbImage.prpmc2800 199image-$(CONFIG_PPC_PRPMC2800) += dtbImage.prpmc2800
200image-$(CONFIG_PPC_ISERIES) += zImage.iseries 200image-$(CONFIG_PPC_ISERIES) += zImage.iseries
201image-$(CONFIG_DEFAULT_UIMAGE) += uImage 201image-$(CONFIG_DEFAULT_UIMAGE) += uImage
diff --git a/arch/powerpc/boot/dts/holly.dts b/arch/powerpc/boot/dts/holly.dts
index f87fe7b9ced9..c6e11ebecebb 100644
--- a/arch/powerpc/boot/dts/holly.dts
+++ b/arch/powerpc/boot/dts/holly.dts
@@ -133,61 +133,61 @@
133 reg = <0x00007400 0x00000400>; 133 reg = <0x00007400 0x00000400>;
134 big-endian; 134 big-endian;
135 }; 135 };
136 };
136 137
137 pci@1000 { 138 pci@c0001000 {
138 device_type = "pci"; 139 device_type = "pci";
139 compatible = "tsi109-pci", "tsi108-pci"; 140 compatible = "tsi109-pci", "tsi108-pci";
140 #interrupt-cells = <1>; 141 #interrupt-cells = <1>;
141 #size-cells = <2>; 142 #size-cells = <2>;
142 #address-cells = <3>; 143 #address-cells = <3>;
143 reg = <0x00001000 0x00001000>; 144 reg = <0xc0001000 0x00001000>;
144 bus-range = <0x0 0x0>; 145 bus-range = <0x0 0x0>;
145 /*----------------------------------------------------+ 146 /*----------------------------------------------------+
146 | PCI memory range. 147 | PCI memory range.
147 | 01 denotes I/O space 148 | 01 denotes I/O space
148 | 02 denotes 32-bit memory space 149 | 02 denotes 32-bit memory space
149 +----------------------------------------------------*/ 150 +----------------------------------------------------*/
150 ranges = <0x02000000 0x00000000 0x40000000 0x40000000 0x00000000 0x10000000 151 ranges = <0x02000000 0x00000000 0x40000000 0x40000000 0x00000000 0x10000000
151 0x01000000 0x00000000 0x00000000 0x7e000000 0x00000000 0x00010000>; 152 0x01000000 0x00000000 0x00000000 0x7e000000 0x00000000 0x00010000>;
152 clock-frequency = <133333332>; 153 clock-frequency = <133333332>;
153 interrupt-parent = <&MPIC>; 154 interrupt-parent = <&MPIC>;
155 interrupts = <0x17 0x2>;
156 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
157 /*----------------------------------------------------+
158 | The INTA, INTB, INTC, INTD are shared.
159 +----------------------------------------------------*/
160 interrupt-map = <
161 0x800 0x0 0x0 0x1 &RT0 0x24 0x0
162 0x800 0x0 0x0 0x2 &RT0 0x25 0x0
163 0x800 0x0 0x0 0x3 &RT0 0x26 0x0
164 0x800 0x0 0x0 0x4 &RT0 0x27 0x0
165
166 0x1000 0x0 0x0 0x1 &RT0 0x25 0x0
167 0x1000 0x0 0x0 0x2 &RT0 0x26 0x0
168 0x1000 0x0 0x0 0x3 &RT0 0x27 0x0
169 0x1000 0x0 0x0 0x4 &RT0 0x24 0x0
170
171 0x1800 0x0 0x0 0x1 &RT0 0x26 0x0
172 0x1800 0x0 0x0 0x2 &RT0 0x27 0x0
173 0x1800 0x0 0x0 0x3 &RT0 0x24 0x0
174 0x1800 0x0 0x0 0x4 &RT0 0x25 0x0
175
176 0x2000 0x0 0x0 0x1 &RT0 0x27 0x0
177 0x2000 0x0 0x0 0x2 &RT0 0x24 0x0
178 0x2000 0x0 0x0 0x3 &RT0 0x25 0x0
179 0x2000 0x0 0x0 0x4 &RT0 0x26 0x0
180 >;
181
182 RT0: router@1180 {
183 device_type = "pic-router";
184 interrupt-controller;
185 big-endian;
186 clock-frequency = <0>;
187 #address-cells = <0>;
188 #interrupt-cells = <2>;
154 interrupts = <0x17 0x2>; 189 interrupts = <0x17 0x2>;
155 interrupt-map-mask = <0xf800 0x0 0x0 0x7>; 190 interrupt-parent = <&MPIC>;
156 /*----------------------------------------------------+
157 | The INTA, INTB, INTC, INTD are shared.
158 +----------------------------------------------------*/
159 interrupt-map = <
160 0x800 0x0 0x0 0x1 &RT0 0x24 0x0
161 0x800 0x0 0x0 0x2 &RT0 0x25 0x0
162 0x800 0x0 0x0 0x3 &RT0 0x26 0x0
163 0x800 0x0 0x0 0x4 &RT0 0x27 0x0
164
165 0x1000 0x0 0x0 0x1 &RT0 0x25 0x0
166 0x1000 0x0 0x0 0x2 &RT0 0x26 0x0
167 0x1000 0x0 0x0 0x3 &RT0 0x27 0x0
168 0x1000 0x0 0x0 0x4 &RT0 0x24 0x0
169
170 0x1800 0x0 0x0 0x1 &RT0 0x26 0x0
171 0x1800 0x0 0x0 0x2 &RT0 0x27 0x0
172 0x1800 0x0 0x0 0x3 &RT0 0x24 0x0
173 0x1800 0x0 0x0 0x4 &RT0 0x25 0x0
174
175 0x2000 0x0 0x0 0x1 &RT0 0x27 0x0
176 0x2000 0x0 0x0 0x2 &RT0 0x24 0x0
177 0x2000 0x0 0x0 0x3 &RT0 0x25 0x0
178 0x2000 0x0 0x0 0x4 &RT0 0x26 0x0
179 >;
180
181 RT0: router@1180 {
182 device_type = "pic-router";
183 interrupt-controller;
184 big-endian;
185 clock-frequency = <0>;
186 #address-cells = <0>;
187 #interrupt-cells = <2>;
188 interrupts = <0x17 0x2>;
189 interrupt-parent = <&MPIC>;
190 };
191 }; 191 };
192 }; 192 };
193 193
diff --git a/arch/powerpc/boot/dts/mpc8610_hpcd.dts b/arch/powerpc/boot/dts/mpc8610_hpcd.dts
index 3b3a1062cb25..584a4f184eb2 100644
--- a/arch/powerpc/boot/dts/mpc8610_hpcd.dts
+++ b/arch/powerpc/boot/dts/mpc8610_hpcd.dts
@@ -281,7 +281,7 @@
281 cell-index = <0>; 281 cell-index = <0>;
282 reg = <0x0 0x80>; 282 reg = <0x0 0x80>;
283 interrupt-parent = <&mpic>; 283 interrupt-parent = <&mpic>;
284 interrupts = <60 2>; 284 interrupts = <76 2>;
285 }; 285 };
286 dma-channel@1 { 286 dma-channel@1 {
287 compatible = "fsl,mpc8610-dma-channel", 287 compatible = "fsl,mpc8610-dma-channel",
@@ -289,7 +289,7 @@
289 cell-index = <1>; 289 cell-index = <1>;
290 reg = <0x80 0x80>; 290 reg = <0x80 0x80>;
291 interrupt-parent = <&mpic>; 291 interrupt-parent = <&mpic>;
292 interrupts = <61 2>; 292 interrupts = <77 2>;
293 }; 293 };
294 dma-channel@2 { 294 dma-channel@2 {
295 compatible = "fsl,mpc8610-dma-channel", 295 compatible = "fsl,mpc8610-dma-channel",
@@ -297,7 +297,7 @@
297 cell-index = <2>; 297 cell-index = <2>;
298 reg = <0x100 0x80>; 298 reg = <0x100 0x80>;
299 interrupt-parent = <&mpic>; 299 interrupt-parent = <&mpic>;
300 interrupts = <62 2>; 300 interrupts = <78 2>;
301 }; 301 };
302 dma-channel@3 { 302 dma-channel@3 {
303 compatible = "fsl,mpc8610-dma-channel", 303 compatible = "fsl,mpc8610-dma-channel",
@@ -305,7 +305,7 @@
305 cell-index = <3>; 305 cell-index = <3>;
306 reg = <0x180 0x80>; 306 reg = <0x180 0x80>;
307 interrupt-parent = <&mpic>; 307 interrupt-parent = <&mpic>;
308 interrupts = <63 2>; 308 interrupts = <79 2>;
309 }; 309 };
310 }; 310 };
311 311
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index 80d1f399ee51..64c6ee22eefd 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -409,6 +409,13 @@ do { \
409/* Keep this the last entry. */ 409/* Keep this the last entry. */
410#define R_PPC64_NUM 107 410#define R_PPC64_NUM 107
411 411
412/* There's actually a third entry here, but it's unused */
413struct ppc64_opd_entry
414{
415 unsigned long funcaddr;
416 unsigned long r2;
417};
418
412#ifdef __KERNEL__ 419#ifdef __KERNEL__
413 420
414#ifdef CONFIG_SPU_BASE 421#ifdef CONFIG_SPU_BASE
diff --git a/arch/powerpc/include/asm/sections.h b/arch/powerpc/include/asm/sections.h
index 7710e9e6660f..07956f3e7844 100644
--- a/arch/powerpc/include/asm/sections.h
+++ b/arch/powerpc/include/asm/sections.h
@@ -2,6 +2,8 @@
2#define _ASM_POWERPC_SECTIONS_H 2#define _ASM_POWERPC_SECTIONS_H
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5#include <linux/elf.h>
6#include <linux/uaccess.h>
5#include <asm-generic/sections.h> 7#include <asm-generic/sections.h>
6 8
7#ifdef __powerpc64__ 9#ifdef __powerpc64__
@@ -17,7 +19,15 @@ static inline int in_kernel_text(unsigned long addr)
17} 19}
18 20
19#undef dereference_function_descriptor 21#undef dereference_function_descriptor
20void *dereference_function_descriptor(void *); 22static inline void *dereference_function_descriptor(void *ptr)
23{
24 struct ppc64_opd_entry *desc = ptr;
25 void *p;
26
27 if (!probe_kernel_address(&desc->funcaddr, p))
28 ptr = p;
29 return ptr;
30}
21 31
22#endif 32#endif
23 33
diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index d308a9f70f1b..31982d05d81a 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -34,11 +34,7 @@
34#include <asm/smp.h> 34#include <asm/smp.h>
35 35
36#ifdef CONFIG_HOTPLUG_CPU 36#ifdef CONFIG_HOTPLUG_CPU
37/* this is used for software suspend, and that shuts down 37#define cpu_should_die() cpu_is_offline(smp_processor_id())
38 * CPUs even while the system is still booting... */
39#define cpu_should_die() (cpu_is_offline(smp_processor_id()) && \
40 (system_state == SYSTEM_RUNNING \
41 || system_state == SYSTEM_BOOTING))
42#else 38#else
43#define cpu_should_die() 0 39#define cpu_should_die() 0
44#endif 40#endif
diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index b4fdf2f2743c..fe8f71dd0b3f 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -347,9 +347,8 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code,
347 linux_regs->msr |= MSR_SE; 347 linux_regs->msr |= MSR_SE;
348#endif 348#endif
349 kgdb_single_step = 1; 349 kgdb_single_step = 1;
350 if (kgdb_contthread) 350 atomic_set(&kgdb_cpu_doing_single_step,
351 atomic_set(&kgdb_cpu_doing_single_step, 351 raw_smp_processor_id());
352 raw_smp_processor_id());
353 } 352 }
354 return 0; 353 return 0;
355 } 354 }
diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
index ad79de272ff3..1af2377e4992 100644
--- a/arch/powerpc/kernel/module_64.c
+++ b/arch/powerpc/kernel/module_64.c
@@ -21,9 +21,7 @@
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/vmalloc.h> 22#include <linux/vmalloc.h>
23#include <linux/bug.h> 23#include <linux/bug.h>
24#include <linux/uaccess.h>
25#include <asm/module.h> 24#include <asm/module.h>
26#include <asm/sections.h>
27#include <asm/firmware.h> 25#include <asm/firmware.h>
28#include <asm/code-patching.h> 26#include <asm/code-patching.h>
29#include <linux/sort.h> 27#include <linux/sort.h>
@@ -43,13 +41,6 @@
43#define DEBUGP(fmt , ...) 41#define DEBUGP(fmt , ...)
44#endif 42#endif
45 43
46/* There's actually a third entry here, but it's unused */
47struct ppc64_opd_entry
48{
49 unsigned long funcaddr;
50 unsigned long r2;
51};
52
53/* Like PPC32, we need little trampolines to do > 24-bit jumps (into 44/* Like PPC32, we need little trampolines to do > 24-bit jumps (into
54 the kernel itself). But on PPC64, these need to be used for every 45 the kernel itself). But on PPC64, these need to be used for every
55 jump, actually, to reset r2 (TOC+0x8000). */ 46 jump, actually, to reset r2 (TOC+0x8000). */
@@ -452,13 +443,3 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
452 443
453 return 0; 444 return 0;
454} 445}
455
456void *dereference_function_descriptor(void *ptr)
457{
458 struct ppc64_opd_entry *desc = ptr;
459 void *p;
460
461 if (!probe_kernel_address(&desc->funcaddr, p))
462 ptr = p;
463 return ptr;
464}
diff --git a/arch/powerpc/platforms/fsl_uli1575.c b/arch/powerpc/platforms/fsl_uli1575.c
index ef74a0763ec1..8c619963becc 100644
--- a/arch/powerpc/platforms/fsl_uli1575.c
+++ b/arch/powerpc/platforms/fsl_uli1575.c
@@ -219,11 +219,21 @@ static void __devinit quirk_final_uli5249(struct pci_dev *dev)
219 int i; 219 int i;
220 u8 *dummy; 220 u8 *dummy;
221 struct pci_bus *bus = dev->bus; 221 struct pci_bus *bus = dev->bus;
222 resource_size_t end = 0;
223
224 for (i = PCI_BRIDGE_RESOURCES; i < PCI_BRIDGE_RESOURCES+3; i++) {
225 unsigned long flags = pci_resource_flags(dev, i);
226 if ((flags & (IORESOURCE_MEM|IORESOURCE_PREFETCH)) == IORESOURCE_MEM)
227 end = pci_resource_end(dev, i);
228 }
222 229
223 for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) { 230 for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
224 if ((bus->resource[i]) && 231 if ((bus->resource[i]) &&
225 (bus->resource[i]->flags & IORESOURCE_MEM)) { 232 (bus->resource[i]->flags & IORESOURCE_MEM)) {
226 dummy = ioremap(bus->resource[i]->end - 3, 0x4); 233 if (bus->resource[i]->end == end)
234 dummy = ioremap(bus->resource[i]->start, 0x4);
235 else
236 dummy = ioremap(bus->resource[i]->end - 3, 0x4);
227 if (dummy) { 237 if (dummy) {
228 in_8(dummy); 238 in_8(dummy);
229 iounmap(dummy); 239 iounmap(dummy);
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index ca114fe46ffb..06acb1a18bbc 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -169,6 +169,8 @@ void init_cpu_timer(void)
169 169
170static void clock_comparator_interrupt(__u16 code) 170static void clock_comparator_interrupt(__u16 code)
171{ 171{
172 if (S390_lowcore.clock_comparator == -1ULL)
173 set_clock_comparator(S390_lowcore.clock_comparator);
172} 174}
173 175
174static void etr_timing_alert(struct etr_irq_parm *); 176static void etr_timing_alert(struct etr_irq_parm *);
diff --git a/arch/s390/lib/delay.c b/arch/s390/lib/delay.c
index fc6ab6094df8..0953cee05efc 100644
--- a/arch/s390/lib/delay.c
+++ b/arch/s390/lib/delay.c
@@ -1,14 +1,9 @@
1/* 1/*
2 * arch/s390/lib/delay.c
3 * Precise Delay Loops for S390 2 * Precise Delay Loops for S390
4 * 3 *
5 * S390 version 4 * Copyright IBM Corp. 1999,2008
6 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation 5 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>,
7 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), 6 * Heiko Carstens <heiko.carstens@de.ibm.com>,
8 *
9 * Derived from "arch/i386/lib/delay.c"
10 * Copyright (C) 1993 Linus Torvalds
11 * Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
12 */ 7 */
13 8
14#include <linux/sched.h> 9#include <linux/sched.h>
@@ -29,30 +24,31 @@ void __delay(unsigned long loops)
29 asm volatile("0: brct %0,0b" : : "d" ((loops/2) + 1)); 24 asm volatile("0: brct %0,0b" : : "d" ((loops/2) + 1));
30} 25}
31 26
32/* 27static void __udelay_disabled(unsigned long usecs)
33 * Waits for 'usecs' microseconds using the TOD clock comparator.
34 */
35void __udelay(unsigned long usecs)
36{ 28{
37 u64 end, time, old_cc = 0; 29 unsigned long mask, cr0, cr0_saved;
38 unsigned long flags, cr0, mask, dummy; 30 u64 clock_saved;
39 int irq_context;
40 31
41 irq_context = in_interrupt(); 32 clock_saved = local_tick_disable();
42 if (!irq_context) 33 set_clock_comparator(get_clock() + ((u64) usecs << 12));
43 local_bh_disable(); 34 __ctl_store(cr0_saved, 0, 0);
44 local_irq_save(flags); 35 cr0 = (cr0_saved & 0xffff00e0) | 0x00000800;
45 if (raw_irqs_disabled_flags(flags)) { 36 __ctl_load(cr0 , 0, 0);
46 old_cc = local_tick_disable(); 37 mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT;
47 S390_lowcore.clock_comparator = -1ULL; 38 trace_hardirqs_on();
48 __ctl_store(cr0, 0, 0); 39 __load_psw_mask(mask);
49 dummy = (cr0 & 0xffff00e0) | 0x00000800; 40 local_irq_disable();
50 __ctl_load(dummy , 0, 0); 41 __ctl_load(cr0_saved, 0, 0);
51 mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT; 42 local_tick_enable(clock_saved);
52 } else 43 set_clock_comparator(S390_lowcore.clock_comparator);
53 mask = psw_kernel_bits | PSW_MASK_WAIT | 44}
54 PSW_MASK_EXT | PSW_MASK_IO;
55 45
46static void __udelay_enabled(unsigned long usecs)
47{
48 unsigned long mask;
49 u64 end, time;
50
51 mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT | PSW_MASK_IO;
56 end = get_clock() + ((u64) usecs << 12); 52 end = get_clock() + ((u64) usecs << 12);
57 do { 53 do {
58 time = end < S390_lowcore.clock_comparator ? 54 time = end < S390_lowcore.clock_comparator ?
@@ -62,13 +58,37 @@ void __udelay(unsigned long usecs)
62 __load_psw_mask(mask); 58 __load_psw_mask(mask);
63 local_irq_disable(); 59 local_irq_disable();
64 } while (get_clock() < end); 60 } while (get_clock() < end);
61 set_clock_comparator(S390_lowcore.clock_comparator);
62}
65 63
66 if (raw_irqs_disabled_flags(flags)) { 64/*
67 __ctl_load(cr0, 0, 0); 65 * Waits for 'usecs' microseconds using the TOD clock comparator.
68 local_tick_enable(old_cc); 66 */
67void __udelay(unsigned long usecs)
68{
69 unsigned long flags;
70
71 preempt_disable();
72 local_irq_save(flags);
73 if (in_irq()) {
74 __udelay_disabled(usecs);
75 goto out;
76 }
77 if (in_softirq()) {
78 if (raw_irqs_disabled_flags(flags))
79 __udelay_disabled(usecs);
80 else
81 __udelay_enabled(usecs);
82 goto out;
69 } 83 }
70 if (!irq_context) 84 if (raw_irqs_disabled_flags(flags)) {
85 local_bh_disable();
86 __udelay_disabled(usecs);
71 _local_bh_enable(); 87 _local_bh_enable();
72 set_clock_comparator(S390_lowcore.clock_comparator); 88 goto out;
89 }
90 __udelay_enabled(usecs);
91out:
73 local_irq_restore(flags); 92 local_irq_restore(flags);
93 preempt_enable();
74} 94}
diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c
index c481d45f97b7..f58c537446a8 100644
--- a/arch/sparc/kernel/of_device.c
+++ b/arch/sparc/kernel/of_device.c
@@ -241,7 +241,7 @@ static int of_bus_sbus_map(u32 *addr, const u32 *range, int na, int ns, int pna)
241 return of_bus_default_map(addr, range, na, ns, pna); 241 return of_bus_default_map(addr, range, na, ns, pna);
242} 242}
243 243
244static unsigned int of_bus_sbus_get_flags(const u32 *addr) 244static unsigned long of_bus_sbus_get_flags(const u32 *addr, unsigned long flags)
245{ 245{
246 return IORESOURCE_MEM; 246 return IORESOURCE_MEM;
247} 247}
diff --git a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace.c
index 20699c701412..8ce6285a06d5 100644
--- a/arch/sparc/kernel/ptrace.c
+++ b/arch/sparc/kernel/ptrace.c
@@ -288,7 +288,7 @@ static const struct user_regset sparc32_regsets[] = {
288 */ 288 */
289 [REGSET_GENERAL] = { 289 [REGSET_GENERAL] = {
290 .core_note_type = NT_PRSTATUS, 290 .core_note_type = NT_PRSTATUS,
291 .n = 38 * sizeof(u32), 291 .n = 38,
292 .size = sizeof(u32), .align = sizeof(u32), 292 .size = sizeof(u32), .align = sizeof(u32),
293 .get = genregs32_get, .set = genregs32_set 293 .get = genregs32_get, .set = genregs32_set
294 }, 294 },
@@ -304,7 +304,7 @@ static const struct user_regset sparc32_regsets[] = {
304 */ 304 */
305 [REGSET_FP] = { 305 [REGSET_FP] = {
306 .core_note_type = NT_PRFPREG, 306 .core_note_type = NT_PRFPREG,
307 .n = 99 * sizeof(u32), 307 .n = 99,
308 .size = sizeof(u32), .align = sizeof(u32), 308 .size = sizeof(u32), .align = sizeof(u32),
309 .get = fpregs32_get, .set = fpregs32_set 309 .get = fpregs32_get, .set = fpregs32_set
310 }, 310 },
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
index 23963882bc18..7495bc774685 100644
--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc64/kernel/irq.c
@@ -7,6 +7,7 @@
7 7
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/linkage.h>
10#include <linux/ptrace.h> 11#include <linux/ptrace.h>
11#include <linux/errno.h> 12#include <linux/errno.h>
12#include <linux/kernel_stat.h> 13#include <linux/kernel_stat.h>
@@ -866,7 +867,7 @@ static void kill_prom_timer(void)
866 : "g1", "g2"); 867 : "g1", "g2");
867} 868}
868 869
869void init_irqwork_curcpu(void) 870void notrace init_irqwork_curcpu(void)
870{ 871{
871 int cpu = hard_smp_processor_id(); 872 int cpu = hard_smp_processor_id();
872 873
@@ -897,7 +898,7 @@ static void __cpuinit register_one_mondo(unsigned long paddr, unsigned long type
897 } 898 }
898} 899}
899 900
900void __cpuinit sun4v_register_mondo_queues(int this_cpu) 901void __cpuinit notrace sun4v_register_mondo_queues(int this_cpu)
901{ 902{
902 struct trap_per_cpu *tb = &trap_block[this_cpu]; 903 struct trap_per_cpu *tb = &trap_block[this_cpu];
903 904
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c
index f845f150f565..100ebd527499 100644
--- a/arch/sparc64/kernel/of_device.c
+++ b/arch/sparc64/kernel/of_device.c
@@ -169,7 +169,7 @@ static unsigned long of_bus_default_get_flags(const u32 *addr, unsigned long fla
169 169
170static int of_bus_pci_match(struct device_node *np) 170static int of_bus_pci_match(struct device_node *np)
171{ 171{
172 if (!strcmp(np->type, "pci") || !strcmp(np->type, "pciex")) { 172 if (!strcmp(np->name, "pci")) {
173 const char *model = of_get_property(np, "model", NULL); 173 const char *model = of_get_property(np, "model", NULL);
174 174
175 if (model && !strcmp(model, "SUNW,simba")) 175 if (model && !strcmp(model, "SUNW,simba"))
@@ -200,7 +200,7 @@ static int of_bus_simba_match(struct device_node *np)
200 /* Treat PCI busses lacking ranges property just like 200 /* Treat PCI busses lacking ranges property just like
201 * simba. 201 * simba.
202 */ 202 */
203 if (!strcmp(np->type, "pci") || !strcmp(np->type, "pciex")) { 203 if (!strcmp(np->name, "pci")) {
204 if (!of_find_property(np, "ranges", NULL)) 204 if (!of_find_property(np, "ranges", NULL))
205 return 1; 205 return 1;
206 } 206 }
@@ -429,7 +429,7 @@ static int __init use_1to1_mapping(struct device_node *pp)
429 * it lacks a ranges property, and this will include 429 * it lacks a ranges property, and this will include
430 * cases like Simba. 430 * cases like Simba.
431 */ 431 */
432 if (!strcmp(pp->type, "pci") || !strcmp(pp->type, "pciex")) 432 if (!strcmp(pp->name, "pci"))
433 return 0; 433 return 0;
434 434
435 return 1; 435 return 1;
@@ -714,8 +714,7 @@ static unsigned int __init build_one_device_irq(struct of_device *op,
714 break; 714 break;
715 } 715 }
716 } else { 716 } else {
717 if (!strcmp(pp->type, "pci") || 717 if (!strcmp(pp->name, "pci")) {
718 !strcmp(pp->type, "pciex")) {
719 unsigned int this_orig_irq = irq; 718 unsigned int this_orig_irq = irq;
720 719
721 irq = pci_irq_swizzle(dp, pp, irq); 720 irq = pci_irq_swizzle(dp, pp, irq);
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index 55096195458f..80dad76f8b81 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -425,7 +425,7 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
425 dev->current_state = 4; /* unknown power state */ 425 dev->current_state = 4; /* unknown power state */
426 dev->error_state = pci_channel_io_normal; 426 dev->error_state = pci_channel_io_normal;
427 427
428 if (!strcmp(type, "pci") || !strcmp(type, "pciex")) { 428 if (!strcmp(node->name, "pci")) {
429 /* a PCI-PCI bridge */ 429 /* a PCI-PCI bridge */
430 dev->hdr_type = PCI_HEADER_TYPE_BRIDGE; 430 dev->hdr_type = PCI_HEADER_TYPE_BRIDGE;
431 dev->rom_base_reg = PCI_ROM_ADDRESS1; 431 dev->rom_base_reg = PCI_ROM_ADDRESS1;
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c
index ef5fe29202c2..f85b6bebb0be 100644
--- a/arch/sparc64/kernel/pci_psycho.c
+++ b/arch/sparc64/kernel/pci_psycho.c
@@ -575,7 +575,7 @@ static irqreturn_t psycho_pcierr_intr_other(struct pci_pbm_info *pbm, int is_pbm
575{ 575{
576 unsigned long csr_reg, csr, csr_error_bits; 576 unsigned long csr_reg, csr, csr_error_bits;
577 irqreturn_t ret = IRQ_NONE; 577 irqreturn_t ret = IRQ_NONE;
578 u16 stat; 578 u16 stat, *addr;
579 579
580 if (is_pbm_a) { 580 if (is_pbm_a) {
581 csr_reg = pbm->controller_regs + PSYCHO_PCIA_CTRL; 581 csr_reg = pbm->controller_regs + PSYCHO_PCIA_CTRL;
@@ -597,7 +597,9 @@ static irqreturn_t psycho_pcierr_intr_other(struct pci_pbm_info *pbm, int is_pbm
597 printk("%s: PCI SERR signal asserted.\n", pbm->name); 597 printk("%s: PCI SERR signal asserted.\n", pbm->name);
598 ret = IRQ_HANDLED; 598 ret = IRQ_HANDLED;
599 } 599 }
600 pci_read_config_word(pbm->pci_bus->self, PCI_STATUS, &stat); 600 addr = psycho_pci_config_mkaddr(pbm, pbm->pci_first_busno,
601 0, PCI_STATUS);
602 pci_config_read16(addr, &stat);
601 if (stat & (PCI_STATUS_PARITY | 603 if (stat & (PCI_STATUS_PARITY |
602 PCI_STATUS_SIG_TARGET_ABORT | 604 PCI_STATUS_SIG_TARGET_ABORT |
603 PCI_STATUS_REC_TARGET_ABORT | 605 PCI_STATUS_REC_TARGET_ABORT |
@@ -605,7 +607,7 @@ static irqreturn_t psycho_pcierr_intr_other(struct pci_pbm_info *pbm, int is_pbm
605 PCI_STATUS_SIG_SYSTEM_ERROR)) { 607 PCI_STATUS_SIG_SYSTEM_ERROR)) {
606 printk("%s: PCI bus error, PCI_STATUS[%04x]\n", 608 printk("%s: PCI bus error, PCI_STATUS[%04x]\n",
607 pbm->name, stat); 609 pbm->name, stat);
608 pci_write_config_word(pbm->pci_bus->self, PCI_STATUS, 0xffff); 610 pci_config_write16(addr, 0xffff);
609 ret = IRQ_HANDLED; 611 ret = IRQ_HANDLED;
610 } 612 }
611 return ret; 613 return ret;
@@ -744,16 +746,16 @@ static void psycho_register_error_handlers(struct pci_pbm_info *pbm)
744 * the second will just error out since we do not pass in 746 * the second will just error out since we do not pass in
745 * IRQF_SHARED. 747 * IRQF_SHARED.
746 */ 748 */
747 err = request_irq(op->irqs[1], psycho_ue_intr, 0, 749 err = request_irq(op->irqs[1], psycho_ue_intr, IRQF_SHARED,
748 "PSYCHO_UE", pbm); 750 "PSYCHO_UE", pbm);
749 err = request_irq(op->irqs[2], psycho_ce_intr, 0, 751 err = request_irq(op->irqs[2], psycho_ce_intr, IRQF_SHARED,
750 "PSYCHO_CE", pbm); 752 "PSYCHO_CE", pbm);
751 753
752 /* This one, however, ought not to fail. We can just warn 754 /* This one, however, ought not to fail. We can just warn
753 * about it since the system can still operate properly even 755 * about it since the system can still operate properly even
754 * if this fails. 756 * if this fails.
755 */ 757 */
756 err = request_irq(op->irqs[0], psycho_pcierr_intr, 0, 758 err = request_irq(op->irqs[0], psycho_pcierr_intr, IRQF_SHARED,
757 "PSYCHO_PCIERR", pbm); 759 "PSYCHO_PCIERR", pbm);
758 if (err) 760 if (err)
759 printk(KERN_WARNING "%s: Could not register PCIERR, " 761 printk(KERN_WARNING "%s: Could not register PCIERR, "
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index 3c048ac4e638..7151513f156e 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -156,55 +156,11 @@ static unsigned long psycho_pcislot_imap_offset(unsigned long ino)
156 return PSYCHO_IMAP_B_SLOT0 + (slot * 8); 156 return PSYCHO_IMAP_B_SLOT0 + (slot * 8);
157} 157}
158 158
159#define PSYCHO_IMAP_SCSI 0x1000UL 159#define PSYCHO_OBIO_IMAP_BASE 0x1000UL
160#define PSYCHO_IMAP_ETH 0x1008UL 160
161#define PSYCHO_IMAP_BPP 0x1010UL
162#define PSYCHO_IMAP_AU_REC 0x1018UL
163#define PSYCHO_IMAP_AU_PLAY 0x1020UL
164#define PSYCHO_IMAP_PFAIL 0x1028UL
165#define PSYCHO_IMAP_KMS 0x1030UL
166#define PSYCHO_IMAP_FLPY 0x1038UL
167#define PSYCHO_IMAP_SHW 0x1040UL
168#define PSYCHO_IMAP_KBD 0x1048UL
169#define PSYCHO_IMAP_MS 0x1050UL
170#define PSYCHO_IMAP_SER 0x1058UL
171#define PSYCHO_IMAP_TIM0 0x1060UL
172#define PSYCHO_IMAP_TIM1 0x1068UL
173#define PSYCHO_IMAP_UE 0x1070UL
174#define PSYCHO_IMAP_CE 0x1078UL
175#define PSYCHO_IMAP_A_ERR 0x1080UL
176#define PSYCHO_IMAP_B_ERR 0x1088UL
177#define PSYCHO_IMAP_PMGMT 0x1090UL
178#define PSYCHO_IMAP_GFX 0x1098UL
179#define PSYCHO_IMAP_EUPA 0x10a0UL
180
181static unsigned long __psycho_onboard_imap_off[] = {
182/*0x20*/ PSYCHO_IMAP_SCSI,
183/*0x21*/ PSYCHO_IMAP_ETH,
184/*0x22*/ PSYCHO_IMAP_BPP,
185/*0x23*/ PSYCHO_IMAP_AU_REC,
186/*0x24*/ PSYCHO_IMAP_AU_PLAY,
187/*0x25*/ PSYCHO_IMAP_PFAIL,
188/*0x26*/ PSYCHO_IMAP_KMS,
189/*0x27*/ PSYCHO_IMAP_FLPY,
190/*0x28*/ PSYCHO_IMAP_SHW,
191/*0x29*/ PSYCHO_IMAP_KBD,
192/*0x2a*/ PSYCHO_IMAP_MS,
193/*0x2b*/ PSYCHO_IMAP_SER,
194/*0x2c*/ PSYCHO_IMAP_TIM0,
195/*0x2d*/ PSYCHO_IMAP_TIM1,
196/*0x2e*/ PSYCHO_IMAP_UE,
197/*0x2f*/ PSYCHO_IMAP_CE,
198/*0x30*/ PSYCHO_IMAP_A_ERR,
199/*0x31*/ PSYCHO_IMAP_B_ERR,
200/*0x32*/ PSYCHO_IMAP_PMGMT,
201/*0x33*/ PSYCHO_IMAP_GFX,
202/*0x34*/ PSYCHO_IMAP_EUPA,
203};
204#define PSYCHO_ONBOARD_IRQ_BASE 0x20 161#define PSYCHO_ONBOARD_IRQ_BASE 0x20
205#define PSYCHO_ONBOARD_IRQ_LAST 0x34
206#define psycho_onboard_imap_offset(__ino) \ 162#define psycho_onboard_imap_offset(__ino) \
207 __psycho_onboard_imap_off[(__ino) - PSYCHO_ONBOARD_IRQ_BASE] 163 (PSYCHO_OBIO_IMAP_BASE + (((__ino) & 0x1f) << 3))
208 164
209#define PSYCHO_ICLR_A_SLOT0 0x1400UL 165#define PSYCHO_ICLR_A_SLOT0 0x1400UL
210#define PSYCHO_ICLR_SCSI 0x1800UL 166#define PSYCHO_ICLR_SCSI 0x1800UL
@@ -228,10 +184,6 @@ static unsigned int psycho_irq_build(struct device_node *dp,
228 imap_off = psycho_pcislot_imap_offset(ino); 184 imap_off = psycho_pcislot_imap_offset(ino);
229 } else { 185 } else {
230 /* Onboard device */ 186 /* Onboard device */
231 if (ino > PSYCHO_ONBOARD_IRQ_LAST) {
232 prom_printf("psycho_irq_build: Wacky INO [%x]\n", ino);
233 prom_halt();
234 }
235 imap_off = psycho_onboard_imap_offset(ino); 187 imap_off = psycho_onboard_imap_offset(ino);
236 } 188 }
237 189
@@ -318,23 +270,6 @@ static void sabre_wsync_handler(unsigned int ino, void *_arg1, void *_arg2)
318 270
319#define SABRE_IMAP_A_SLOT0 0x0c00UL 271#define SABRE_IMAP_A_SLOT0 0x0c00UL
320#define SABRE_IMAP_B_SLOT0 0x0c20UL 272#define SABRE_IMAP_B_SLOT0 0x0c20UL
321#define SABRE_IMAP_SCSI 0x1000UL
322#define SABRE_IMAP_ETH 0x1008UL
323#define SABRE_IMAP_BPP 0x1010UL
324#define SABRE_IMAP_AU_REC 0x1018UL
325#define SABRE_IMAP_AU_PLAY 0x1020UL
326#define SABRE_IMAP_PFAIL 0x1028UL
327#define SABRE_IMAP_KMS 0x1030UL
328#define SABRE_IMAP_FLPY 0x1038UL
329#define SABRE_IMAP_SHW 0x1040UL
330#define SABRE_IMAP_KBD 0x1048UL
331#define SABRE_IMAP_MS 0x1050UL
332#define SABRE_IMAP_SER 0x1058UL
333#define SABRE_IMAP_UE 0x1070UL
334#define SABRE_IMAP_CE 0x1078UL
335#define SABRE_IMAP_PCIERR 0x1080UL
336#define SABRE_IMAP_GFX 0x1098UL
337#define SABRE_IMAP_EUPA 0x10a0UL
338#define SABRE_ICLR_A_SLOT0 0x1400UL 273#define SABRE_ICLR_A_SLOT0 0x1400UL
339#define SABRE_ICLR_B_SLOT0 0x1480UL 274#define SABRE_ICLR_B_SLOT0 0x1480UL
340#define SABRE_ICLR_SCSI 0x1800UL 275#define SABRE_ICLR_SCSI 0x1800UL
@@ -364,33 +299,10 @@ static unsigned long sabre_pcislot_imap_offset(unsigned long ino)
364 return SABRE_IMAP_B_SLOT0 + (slot * 8); 299 return SABRE_IMAP_B_SLOT0 + (slot * 8);
365} 300}
366 301
367static unsigned long __sabre_onboard_imap_off[] = { 302#define SABRE_OBIO_IMAP_BASE 0x1000UL
368/*0x20*/ SABRE_IMAP_SCSI, 303#define SABRE_ONBOARD_IRQ_BASE 0x20
369/*0x21*/ SABRE_IMAP_ETH,
370/*0x22*/ SABRE_IMAP_BPP,
371/*0x23*/ SABRE_IMAP_AU_REC,
372/*0x24*/ SABRE_IMAP_AU_PLAY,
373/*0x25*/ SABRE_IMAP_PFAIL,
374/*0x26*/ SABRE_IMAP_KMS,
375/*0x27*/ SABRE_IMAP_FLPY,
376/*0x28*/ SABRE_IMAP_SHW,
377/*0x29*/ SABRE_IMAP_KBD,
378/*0x2a*/ SABRE_IMAP_MS,
379/*0x2b*/ SABRE_IMAP_SER,
380/*0x2c*/ 0 /* reserved */,
381/*0x2d*/ 0 /* reserved */,
382/*0x2e*/ SABRE_IMAP_UE,
383/*0x2f*/ SABRE_IMAP_CE,
384/*0x30*/ SABRE_IMAP_PCIERR,
385/*0x31*/ 0 /* reserved */,
386/*0x32*/ 0 /* reserved */,
387/*0x33*/ SABRE_IMAP_GFX,
388/*0x34*/ SABRE_IMAP_EUPA,
389};
390#define SABRE_ONBOARD_IRQ_BASE 0x20
391#define SABRE_ONBOARD_IRQ_LAST 0x30
392#define sabre_onboard_imap_offset(__ino) \ 304#define sabre_onboard_imap_offset(__ino) \
393 __sabre_onboard_imap_off[(__ino) - SABRE_ONBOARD_IRQ_BASE] 305 (SABRE_OBIO_IMAP_BASE + (((__ino) & 0x1f) << 3))
394 306
395#define sabre_iclr_offset(ino) \ 307#define sabre_iclr_offset(ino) \
396 ((ino & 0x20) ? (SABRE_ICLR_SCSI + (((ino) & 0x1f) << 3)) : \ 308 ((ino & 0x20) ? (SABRE_ICLR_SCSI + (((ino) & 0x1f) << 3)) : \
@@ -453,10 +365,6 @@ static unsigned int sabre_irq_build(struct device_node *dp,
453 imap_off = sabre_pcislot_imap_offset(ino); 365 imap_off = sabre_pcislot_imap_offset(ino);
454 } else { 366 } else {
455 /* onboard device */ 367 /* onboard device */
456 if (ino > SABRE_ONBOARD_IRQ_LAST) {
457 prom_printf("sabre_irq_build: Wacky INO [%x]\n", ino);
458 prom_halt();
459 }
460 imap_off = sabre_onboard_imap_offset(ino); 368 imap_off = sabre_onboard_imap_offset(ino);
461 } 369 }
462 370
diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c
index bd578cc4856d..10306e476e38 100644
--- a/arch/sparc64/kernel/ptrace.c
+++ b/arch/sparc64/kernel/ptrace.c
@@ -443,7 +443,7 @@ static const struct user_regset sparc64_regsets[] = {
443 */ 443 */
444 [REGSET_GENERAL] = { 444 [REGSET_GENERAL] = {
445 .core_note_type = NT_PRSTATUS, 445 .core_note_type = NT_PRSTATUS,
446 .n = 36 * sizeof(u64), 446 .n = 36,
447 .size = sizeof(u64), .align = sizeof(u64), 447 .size = sizeof(u64), .align = sizeof(u64),
448 .get = genregs64_get, .set = genregs64_set 448 .get = genregs64_get, .set = genregs64_set
449 }, 449 },
@@ -455,7 +455,7 @@ static const struct user_regset sparc64_regsets[] = {
455 */ 455 */
456 [REGSET_FP] = { 456 [REGSET_FP] = {
457 .core_note_type = NT_PRFPREG, 457 .core_note_type = NT_PRFPREG,
458 .n = 35 * sizeof(u64), 458 .n = 35,
459 .size = sizeof(u64), .align = sizeof(u64), 459 .size = sizeof(u64), .align = sizeof(u64),
460 .get = fpregs64_get, .set = fpregs64_set 460 .get = fpregs64_get, .set = fpregs64_set
461 }, 461 },
@@ -801,7 +801,7 @@ static const struct user_regset sparc32_regsets[] = {
801 */ 801 */
802 [REGSET_GENERAL] = { 802 [REGSET_GENERAL] = {
803 .core_note_type = NT_PRSTATUS, 803 .core_note_type = NT_PRSTATUS,
804 .n = 38 * sizeof(u32), 804 .n = 38,
805 .size = sizeof(u32), .align = sizeof(u32), 805 .size = sizeof(u32), .align = sizeof(u32),
806 .get = genregs32_get, .set = genregs32_set 806 .get = genregs32_get, .set = genregs32_set
807 }, 807 },
@@ -817,7 +817,7 @@ static const struct user_regset sparc32_regsets[] = {
817 */ 817 */
818 [REGSET_FP] = { 818 [REGSET_FP] = {
819 .core_note_type = NT_PRFPREG, 819 .core_note_type = NT_PRFPREG,
820 .n = 99 * sizeof(u32), 820 .n = 99,
821 .size = sizeof(u32), .align = sizeof(u32), 821 .size = sizeof(u32), .align = sizeof(u32),
822 .get = fpregs32_get, .set = fpregs32_set 822 .get = fpregs32_get, .set = fpregs32_set
823 }, 823 },
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index 3d924121c796..c824df13f589 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -10,6 +10,7 @@
10 10
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/linkage.h>
13#include <linux/kernel.h> 14#include <linux/kernel.h>
14#include <linux/signal.h> 15#include <linux/signal.h>
15#include <linux/smp.h> 16#include <linux/smp.h>
@@ -2453,7 +2454,7 @@ struct trap_per_cpu trap_block[NR_CPUS];
2453/* This can get invoked before sched_init() so play it super safe 2454/* This can get invoked before sched_init() so play it super safe
2454 * and use hard_smp_processor_id(). 2455 * and use hard_smp_processor_id().
2455 */ 2456 */
2456void init_cur_cpu_trap(struct thread_info *t) 2457void notrace init_cur_cpu_trap(struct thread_info *t)
2457{ 2458{
2458 int cpu = hard_smp_processor_id(); 2459 int cpu = hard_smp_processor_id();
2459 struct trap_per_cpu *p = &trap_block[cpu]; 2460 struct trap_per_cpu *p = &trap_block[cpu];
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 21ef9dd36187..44d4f2130d01 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -29,6 +29,7 @@ config X86
29 select HAVE_FTRACE 29 select HAVE_FTRACE
30 select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) 30 select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64)
31 select HAVE_ARCH_KGDB if !X86_VOYAGER 31 select HAVE_ARCH_KGDB if !X86_VOYAGER
32 select HAVE_ARCH_TRACEHOOK
32 select HAVE_GENERIC_DMA_COHERENT if X86_32 33 select HAVE_GENERIC_DMA_COHERENT if X86_32
33 select HAVE_EFFICIENT_UNALIGNED_ACCESS 34 select HAVE_EFFICIENT_UNALIGNED_ACCESS
34 35
@@ -553,6 +554,7 @@ config CALGARY_IOMMU_ENABLED_BY_DEFAULT
553config AMD_IOMMU 554config AMD_IOMMU
554 bool "AMD IOMMU support" 555 bool "AMD IOMMU support"
555 select SWIOTLB 556 select SWIOTLB
557 select PCI_MSI
556 depends on X86_64 && PCI && ACPI 558 depends on X86_64 && PCI && ACPI
557 help 559 help
558 With this option you can enable support for AMD IOMMU hardware in 560 With this option you can enable support for AMD IOMMU hardware in
@@ -1020,7 +1022,7 @@ config HAVE_ARCH_ALLOC_REMAP
1020 1022
1021config ARCH_FLATMEM_ENABLE 1023config ARCH_FLATMEM_ENABLE
1022 def_bool y 1024 def_bool y
1023 depends on X86_32 && ARCH_SELECT_MEMORY_MODEL && X86_PC && !NUMA 1025 depends on X86_32 && ARCH_SELECT_MEMORY_MODEL && !NUMA
1024 1026
1025config ARCH_DISCONTIGMEM_ENABLE 1027config ARCH_DISCONTIGMEM_ENABLE
1026 def_bool y 1028 def_bool y
@@ -1036,7 +1038,7 @@ config ARCH_SPARSEMEM_DEFAULT
1036 1038
1037config ARCH_SPARSEMEM_ENABLE 1039config ARCH_SPARSEMEM_ENABLE
1038 def_bool y 1040 def_bool y
1039 depends on X86_64 || NUMA || (EXPERIMENTAL && X86_PC) 1041 depends on X86_64 || NUMA || (EXPERIMENTAL && X86_PC) || X86_GENERICARCH
1040 select SPARSEMEM_STATIC if X86_32 1042 select SPARSEMEM_STATIC if X86_32
1041 select SPARSEMEM_VMEMMAP_ENABLE if X86_64 1043 select SPARSEMEM_VMEMMAP_ENABLE if X86_64
1042 1044
@@ -1117,10 +1119,10 @@ config MTRR
1117 You can safely say Y even if your machine doesn't have MTRRs, you'll 1119 You can safely say Y even if your machine doesn't have MTRRs, you'll
1118 just add about 9 KB to your kernel. 1120 just add about 9 KB to your kernel.
1119 1121
1120 See <file:Documentation/mtrr.txt> for more information. 1122 See <file:Documentation/x86/mtrr.txt> for more information.
1121 1123
1122config MTRR_SANITIZER 1124config MTRR_SANITIZER
1123 bool 1125 def_bool y
1124 prompt "MTRR cleanup support" 1126 prompt "MTRR cleanup support"
1125 depends on MTRR 1127 depends on MTRR
1126 help 1128 help
@@ -1131,7 +1133,7 @@ config MTRR_SANITIZER
1131 The largest mtrr entry size for a continous block can be set with 1133 The largest mtrr entry size for a continous block can be set with
1132 mtrr_chunk_size. 1134 mtrr_chunk_size.
1133 1135
1134 If unsure, say N. 1136 If unsure, say Y.
1135 1137
1136config MTRR_SANITIZER_ENABLE_DEFAULT 1138config MTRR_SANITIZER_ENABLE_DEFAULT
1137 int "MTRR cleanup enable value (0-1)" 1139 int "MTRR cleanup enable value (0-1)"
@@ -1191,7 +1193,6 @@ config IRQBALANCE
1191config SECCOMP 1193config SECCOMP
1192 def_bool y 1194 def_bool y
1193 prompt "Enable seccomp to safely compute untrusted bytecode" 1195 prompt "Enable seccomp to safely compute untrusted bytecode"
1194 depends on PROC_FS
1195 help 1196 help
1196 This kernel feature is useful for number crunching applications 1197 This kernel feature is useful for number crunching applications
1197 that may need to compute untrusted bytecode during their 1198 that may need to compute untrusted bytecode during their
@@ -1199,7 +1200,7 @@ config SECCOMP
1199 the process as file descriptors supporting the read/write 1200 the process as file descriptors supporting the read/write
1200 syscalls, it's possible to isolate those applications in 1201 syscalls, it's possible to isolate those applications in
1201 their own address space using seccomp. Once seccomp is 1202 their own address space using seccomp. Once seccomp is
1202 enabled via /proc/<pid>/seccomp, it cannot be disabled 1203 enabled via prctl(PR_SET_SECCOMP), it cannot be disabled
1203 and the task is only allowed to execute a few safe syscalls 1204 and the task is only allowed to execute a few safe syscalls
1204 defined by each seccomp mode. 1205 defined by each seccomp mode.
1205 1206
@@ -1356,14 +1357,14 @@ config PHYSICAL_ALIGN
1356 Don't change this unless you know what you are doing. 1357 Don't change this unless you know what you are doing.
1357 1358
1358config HOTPLUG_CPU 1359config HOTPLUG_CPU
1359 bool "Support for suspend on SMP and hot-pluggable CPUs (EXPERIMENTAL)" 1360 bool "Support for hot-pluggable CPUs"
1360 depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER 1361 depends on SMP && HOTPLUG && !X86_VOYAGER
1361 ---help--- 1362 ---help---
1362 Say Y here to experiment with turning CPUs off and on, and to 1363 Say Y here to allow turning CPUs off and on. CPUs can be
1363 enable suspend on SMP systems. CPUs can be controlled through 1364 controlled through /sys/devices/system/cpu.
1364 /sys/devices/system/cpu. 1365 ( Note: power management support will enable this option
1365 Say N if you want to disable CPU hotplug and don't need to 1366 automatically on SMP systems. )
1366 suspend. 1367 Say N if you want to disable CPU hotplug.
1367 1368
1368config COMPAT_VDSO 1369config COMPAT_VDSO
1369 def_bool y 1370 def_bool y
@@ -1378,6 +1379,51 @@ config COMPAT_VDSO
1378 1379
1379 If unsure, say Y. 1380 If unsure, say Y.
1380 1381
1382config CMDLINE_BOOL
1383 bool "Built-in kernel command line"
1384 default n
1385 help
1386 Allow for specifying boot arguments to the kernel at
1387 build time. On some systems (e.g. embedded ones), it is
1388 necessary or convenient to provide some or all of the
1389 kernel boot arguments with the kernel itself (that is,
1390 to not rely on the boot loader to provide them.)
1391
1392 To compile command line arguments into the kernel,
1393 set this option to 'Y', then fill in the
1394 the boot arguments in CONFIG_CMDLINE.
1395
1396 Systems with fully functional boot loaders (i.e. non-embedded)
1397 should leave this option set to 'N'.
1398
1399config CMDLINE
1400 string "Built-in kernel command string"
1401 depends on CMDLINE_BOOL
1402 default ""
1403 help
1404 Enter arguments here that should be compiled into the kernel
1405 image and used at boot time. If the boot loader provides a
1406 command line at boot time, it is appended to this string to
1407 form the full kernel command line, when the system boots.
1408
1409 However, you can use the CONFIG_CMDLINE_OVERRIDE option to
1410 change this behavior.
1411
1412 In most cases, the command line (whether built-in or provided
1413 by the boot loader) should specify the device for the root
1414 file system.
1415
1416config CMDLINE_OVERRIDE
1417 bool "Built-in command line overrides boot loader arguments"
1418 default n
1419 depends on CMDLINE_BOOL
1420 help
1421 Set this option to 'Y' to have the kernel ignore the boot loader
1422 command line, and use ONLY the built-in command line.
1423
1424 This is used to work around broken boot loaders. This should
1425 be set to 'N' under normal conditions.
1426
1381endmenu 1427endmenu
1382 1428
1383config ARCH_ENABLE_MEMORY_HOTPLUG 1429config ARCH_ENABLE_MEMORY_HOTPLUG
@@ -1781,7 +1827,7 @@ config COMPAT_FOR_U64_ALIGNMENT
1781 1827
1782config SYSVIPC_COMPAT 1828config SYSVIPC_COMPAT
1783 def_bool y 1829 def_bool y
1784 depends on X86_64 && COMPAT && SYSVIPC 1830 depends on COMPAT && SYSVIPC
1785 1831
1786endmenu 1832endmenu
1787 1833
diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S
index ba7736cf2ec7..29c5fbf08392 100644
--- a/arch/x86/boot/compressed/head_32.S
+++ b/arch/x86/boot/compressed/head_32.S
@@ -137,14 +137,15 @@ relocated:
137 */ 137 */
138 movl output_len(%ebx), %eax 138 movl output_len(%ebx), %eax
139 pushl %eax 139 pushl %eax
140 # push arguments for decompress_kernel:
140 pushl %ebp # output address 141 pushl %ebp # output address
141 movl input_len(%ebx), %eax 142 movl input_len(%ebx), %eax
142 pushl %eax # input_len 143 pushl %eax # input_len
143 leal input_data(%ebx), %eax 144 leal input_data(%ebx), %eax
144 pushl %eax # input_data 145 pushl %eax # input_data
145 leal boot_heap(%ebx), %eax 146 leal boot_heap(%ebx), %eax
146 pushl %eax # heap area as third argument 147 pushl %eax # heap area
147 pushl %esi # real mode pointer as second arg 148 pushl %esi # real mode pointer
148 call decompress_kernel 149 call decompress_kernel
149 addl $20, %esp 150 addl $20, %esp
150 popl %ecx 151 popl %ecx
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index aaf5a2131efc..5780d361105b 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -27,7 +27,7 @@
27#include <linux/linkage.h> 27#include <linux/linkage.h>
28#include <linux/screen_info.h> 28#include <linux/screen_info.h>
29#include <linux/elf.h> 29#include <linux/elf.h>
30#include <asm/io.h> 30#include <linux/io.h>
31#include <asm/page.h> 31#include <asm/page.h>
32#include <asm/boot.h> 32#include <asm/boot.h>
33#include <asm/bootparam.h> 33#include <asm/bootparam.h>
@@ -251,7 +251,7 @@ static void __putstr(int error, const char *s)
251 y--; 251 y--;
252 } 252 }
253 } else { 253 } else {
254 vidmem [(x + cols * y) * 2] = c; 254 vidmem[(x + cols * y) * 2] = c;
255 if (++x >= cols) { 255 if (++x >= cols) {
256 x = 0; 256 x = 0;
257 if (++y >= lines) { 257 if (++y >= lines) {
@@ -277,7 +277,8 @@ static void *memset(void *s, int c, unsigned n)
277 int i; 277 int i;
278 char *ss = s; 278 char *ss = s;
279 279
280 for (i = 0; i < n; i++) ss[i] = c; 280 for (i = 0; i < n; i++)
281 ss[i] = c;
281 return s; 282 return s;
282} 283}
283 284
@@ -287,7 +288,8 @@ static void *memcpy(void *dest, const void *src, unsigned n)
287 const char *s = src; 288 const char *s = src;
288 char *d = dest; 289 char *d = dest;
289 290
290 for (i = 0; i < n; i++) d[i] = s[i]; 291 for (i = 0; i < n; i++)
292 d[i] = s[i];
291 return dest; 293 return dest;
292} 294}
293 295
diff --git a/arch/x86/boot/compressed/relocs.c b/arch/x86/boot/compressed/relocs.c
index a1310c52fc0c..857e492c571e 100644
--- a/arch/x86/boot/compressed/relocs.c
+++ b/arch/x86/boot/compressed/relocs.c
@@ -492,7 +492,7 @@ static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym))
492 continue; 492 continue;
493 } 493 }
494 sh_symtab = sec_symtab->symtab; 494 sh_symtab = sec_symtab->symtab;
495 sym_strtab = sec->link->strtab; 495 sym_strtab = sec_symtab->link->strtab;
496 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Rel); j++) { 496 for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Rel); j++) {
497 Elf32_Rel *rel; 497 Elf32_Rel *rel;
498 Elf32_Sym *sym; 498 Elf32_Sym *sym;
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
index af86e431acfa..b993062e9a5f 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -30,7 +30,6 @@ SYSSEG = DEF_SYSSEG /* system loaded at 0x10000 (65536) */
30SYSSIZE = DEF_SYSSIZE /* system size: # of 16-byte clicks */ 30SYSSIZE = DEF_SYSSIZE /* system size: # of 16-byte clicks */
31 /* to be loaded */ 31 /* to be loaded */
32ROOT_DEV = 0 /* ROOT_DEV is now written by "build" */ 32ROOT_DEV = 0 /* ROOT_DEV is now written by "build" */
33SWAP_DEV = 0 /* SWAP_DEV is now written by "build" */
34 33
35#ifndef SVGA_MODE 34#ifndef SVGA_MODE
36#define SVGA_MODE ASK_VGA 35#define SVGA_MODE ASK_VGA
diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig
index 104275e191a8..ef9a52005ec9 100644
--- a/arch/x86/configs/i386_defconfig
+++ b/arch/x86/configs/i386_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.27-rc4 3# Linux kernel version: 2.6.27-rc5
4# Mon Aug 25 15:04:00 2008 4# Wed Sep 3 17:23:09 2008
5# 5#
6# CONFIG_64BIT is not set 6# CONFIG_64BIT is not set
7CONFIG_X86_32=y 7CONFIG_X86_32=y
@@ -202,7 +202,7 @@ CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
202# CONFIG_M586 is not set 202# CONFIG_M586 is not set
203# CONFIG_M586TSC is not set 203# CONFIG_M586TSC is not set
204# CONFIG_M586MMX is not set 204# CONFIG_M586MMX is not set
205# CONFIG_M686 is not set 205CONFIG_M686=y
206# CONFIG_MPENTIUMII is not set 206# CONFIG_MPENTIUMII is not set
207# CONFIG_MPENTIUMIII is not set 207# CONFIG_MPENTIUMIII is not set
208# CONFIG_MPENTIUMM is not set 208# CONFIG_MPENTIUMM is not set
@@ -221,13 +221,14 @@ CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
221# CONFIG_MVIAC3_2 is not set 221# CONFIG_MVIAC3_2 is not set
222# CONFIG_MVIAC7 is not set 222# CONFIG_MVIAC7 is not set
223# CONFIG_MPSC is not set 223# CONFIG_MPSC is not set
224CONFIG_MCORE2=y 224# CONFIG_MCORE2 is not set
225# CONFIG_GENERIC_CPU is not set 225# CONFIG_GENERIC_CPU is not set
226CONFIG_X86_GENERIC=y 226CONFIG_X86_GENERIC=y
227CONFIG_X86_CPU=y 227CONFIG_X86_CPU=y
228CONFIG_X86_CMPXCHG=y 228CONFIG_X86_CMPXCHG=y
229CONFIG_X86_L1_CACHE_SHIFT=7 229CONFIG_X86_L1_CACHE_SHIFT=7
230CONFIG_X86_XADD=y 230CONFIG_X86_XADD=y
231# CONFIG_X86_PPRO_FENCE is not set
231CONFIG_X86_WP_WORKS_OK=y 232CONFIG_X86_WP_WORKS_OK=y
232CONFIG_X86_INVLPG=y 233CONFIG_X86_INVLPG=y
233CONFIG_X86_BSWAP=y 234CONFIG_X86_BSWAP=y
@@ -235,14 +236,15 @@ CONFIG_X86_POPAD_OK=y
235CONFIG_X86_INTEL_USERCOPY=y 236CONFIG_X86_INTEL_USERCOPY=y
236CONFIG_X86_USE_PPRO_CHECKSUM=y 237CONFIG_X86_USE_PPRO_CHECKSUM=y
237CONFIG_X86_TSC=y 238CONFIG_X86_TSC=y
239CONFIG_X86_CMOV=y
238CONFIG_X86_MINIMUM_CPU_FAMILY=4 240CONFIG_X86_MINIMUM_CPU_FAMILY=4
239CONFIG_X86_DEBUGCTLMSR=y 241CONFIG_X86_DEBUGCTLMSR=y
240CONFIG_HPET_TIMER=y 242CONFIG_HPET_TIMER=y
241CONFIG_HPET_EMULATE_RTC=y 243CONFIG_HPET_EMULATE_RTC=y
242CONFIG_DMI=y 244CONFIG_DMI=y
243# CONFIG_IOMMU_HELPER is not set 245# CONFIG_IOMMU_HELPER is not set
244CONFIG_NR_CPUS=4 246CONFIG_NR_CPUS=64
245# CONFIG_SCHED_SMT is not set 247CONFIG_SCHED_SMT=y
246CONFIG_SCHED_MC=y 248CONFIG_SCHED_MC=y
247# CONFIG_PREEMPT_NONE is not set 249# CONFIG_PREEMPT_NONE is not set
248CONFIG_PREEMPT_VOLUNTARY=y 250CONFIG_PREEMPT_VOLUNTARY=y
@@ -254,7 +256,8 @@ CONFIG_VM86=y
254# CONFIG_TOSHIBA is not set 256# CONFIG_TOSHIBA is not set
255# CONFIG_I8K is not set 257# CONFIG_I8K is not set
256CONFIG_X86_REBOOTFIXUPS=y 258CONFIG_X86_REBOOTFIXUPS=y
257# CONFIG_MICROCODE is not set 259CONFIG_MICROCODE=y
260CONFIG_MICROCODE_OLD_INTERFACE=y
258CONFIG_X86_MSR=y 261CONFIG_X86_MSR=y
259CONFIG_X86_CPUID=y 262CONFIG_X86_CPUID=y
260# CONFIG_NOHIGHMEM is not set 263# CONFIG_NOHIGHMEM is not set
@@ -2115,7 +2118,7 @@ CONFIG_IO_DELAY_0X80=y
2115CONFIG_DEFAULT_IO_DELAY_TYPE=0 2118CONFIG_DEFAULT_IO_DELAY_TYPE=0
2116CONFIG_DEBUG_BOOT_PARAMS=y 2119CONFIG_DEBUG_BOOT_PARAMS=y
2117# CONFIG_CPA_DEBUG is not set 2120# CONFIG_CPA_DEBUG is not set
2118# CONFIG_OPTIMIZE_INLINING is not set 2121CONFIG_OPTIMIZE_INLINING=y
2119 2122
2120# 2123#
2121# Security options 2124# Security options
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
index 678c8acefe04..e620ea6e2a7a 100644
--- a/arch/x86/configs/x86_64_defconfig
+++ b/arch/x86/configs/x86_64_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.27-rc4 3# Linux kernel version: 2.6.27-rc5
4# Mon Aug 25 14:40:46 2008 4# Wed Sep 3 17:13:39 2008
5# 5#
6CONFIG_64BIT=y 6CONFIG_64BIT=y
7# CONFIG_X86_32 is not set 7# CONFIG_X86_32 is not set
@@ -218,17 +218,14 @@ CONFIG_X86_PC=y
218# CONFIG_MVIAC3_2 is not set 218# CONFIG_MVIAC3_2 is not set
219# CONFIG_MVIAC7 is not set 219# CONFIG_MVIAC7 is not set
220# CONFIG_MPSC is not set 220# CONFIG_MPSC is not set
221CONFIG_MCORE2=y 221# CONFIG_MCORE2 is not set
222# CONFIG_GENERIC_CPU is not set 222CONFIG_GENERIC_CPU=y
223CONFIG_X86_CPU=y 223CONFIG_X86_CPU=y
224CONFIG_X86_L1_CACHE_BYTES=64 224CONFIG_X86_L1_CACHE_BYTES=128
225CONFIG_X86_INTERNODE_CACHE_BYTES=64 225CONFIG_X86_INTERNODE_CACHE_BYTES=128
226CONFIG_X86_CMPXCHG=y 226CONFIG_X86_CMPXCHG=y
227CONFIG_X86_L1_CACHE_SHIFT=6 227CONFIG_X86_L1_CACHE_SHIFT=7
228CONFIG_X86_WP_WORKS_OK=y 228CONFIG_X86_WP_WORKS_OK=y
229CONFIG_X86_INTEL_USERCOPY=y
230CONFIG_X86_USE_PPRO_CHECKSUM=y
231CONFIG_X86_P6_NOP=y
232CONFIG_X86_TSC=y 229CONFIG_X86_TSC=y
233CONFIG_X86_CMPXCHG64=y 230CONFIG_X86_CMPXCHG64=y
234CONFIG_X86_CMOV=y 231CONFIG_X86_CMOV=y
@@ -243,9 +240,8 @@ CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT=y
243CONFIG_AMD_IOMMU=y 240CONFIG_AMD_IOMMU=y
244CONFIG_SWIOTLB=y 241CONFIG_SWIOTLB=y
245CONFIG_IOMMU_HELPER=y 242CONFIG_IOMMU_HELPER=y
246# CONFIG_MAXSMP is not set 243CONFIG_NR_CPUS=64
247CONFIG_NR_CPUS=4 244CONFIG_SCHED_SMT=y
248# CONFIG_SCHED_SMT is not set
249CONFIG_SCHED_MC=y 245CONFIG_SCHED_MC=y
250# CONFIG_PREEMPT_NONE is not set 246# CONFIG_PREEMPT_NONE is not set
251CONFIG_PREEMPT_VOLUNTARY=y 247CONFIG_PREEMPT_VOLUNTARY=y
@@ -254,7 +250,8 @@ CONFIG_X86_LOCAL_APIC=y
254CONFIG_X86_IO_APIC=y 250CONFIG_X86_IO_APIC=y
255# CONFIG_X86_MCE is not set 251# CONFIG_X86_MCE is not set
256# CONFIG_I8K is not set 252# CONFIG_I8K is not set
257# CONFIG_MICROCODE is not set 253CONFIG_MICROCODE=y
254CONFIG_MICROCODE_OLD_INTERFACE=y
258CONFIG_X86_MSR=y 255CONFIG_X86_MSR=y
259CONFIG_X86_CPUID=y 256CONFIG_X86_CPUID=y
260CONFIG_NUMA=y 257CONFIG_NUMA=y
@@ -290,7 +287,7 @@ CONFIG_BOUNCE=y
290CONFIG_VIRT_TO_BUS=y 287CONFIG_VIRT_TO_BUS=y
291CONFIG_MTRR=y 288CONFIG_MTRR=y
292# CONFIG_MTRR_SANITIZER is not set 289# CONFIG_MTRR_SANITIZER is not set
293# CONFIG_X86_PAT is not set 290CONFIG_X86_PAT=y
294CONFIG_EFI=y 291CONFIG_EFI=y
295CONFIG_SECCOMP=y 292CONFIG_SECCOMP=y
296# CONFIG_HZ_100 is not set 293# CONFIG_HZ_100 is not set
@@ -2089,7 +2086,7 @@ CONFIG_IO_DELAY_0X80=y
2089CONFIG_DEFAULT_IO_DELAY_TYPE=0 2086CONFIG_DEFAULT_IO_DELAY_TYPE=0
2090CONFIG_DEBUG_BOOT_PARAMS=y 2087CONFIG_DEBUG_BOOT_PARAMS=y
2091# CONFIG_CPA_DEBUG is not set 2088# CONFIG_CPA_DEBUG is not set
2092# CONFIG_OPTIMIZE_INLINING is not set 2089CONFIG_OPTIMIZE_INLINING=y
2093 2090
2094# 2091#
2095# Security options 2092# Security options
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
index a0e1dbe67dc1..127ec3f07214 100644
--- a/arch/x86/ia32/ia32_aout.c
+++ b/arch/x86/ia32/ia32_aout.c
@@ -85,8 +85,10 @@ static void dump_thread32(struct pt_regs *regs, struct user32 *dump)
85 dump->regs.ax = regs->ax; 85 dump->regs.ax = regs->ax;
86 dump->regs.ds = current->thread.ds; 86 dump->regs.ds = current->thread.ds;
87 dump->regs.es = current->thread.es; 87 dump->regs.es = current->thread.es;
88 asm("movl %%fs,%0" : "=r" (fs)); dump->regs.fs = fs; 88 savesegment(fs, fs);
89 asm("movl %%gs,%0" : "=r" (gs)); dump->regs.gs = gs; 89 dump->regs.fs = fs;
90 savesegment(gs, gs);
91 dump->regs.gs = gs;
90 dump->regs.orig_ax = regs->orig_ax; 92 dump->regs.orig_ax = regs->orig_ax;
91 dump->regs.ip = regs->ip; 93 dump->regs.ip = regs->ip;
92 dump->regs.cs = regs->cs; 94 dump->regs.cs = regs->cs;
@@ -430,8 +432,9 @@ beyond_if:
430 current->mm->start_stack = 432 current->mm->start_stack =
431 (unsigned long)create_aout_tables((char __user *)bprm->p, bprm); 433 (unsigned long)create_aout_tables((char __user *)bprm->p, bprm);
432 /* start thread */ 434 /* start thread */
433 asm volatile("movl %0,%%fs" :: "r" (0)); \ 435 loadsegment(fs, 0);
434 asm volatile("movl %0,%%es; movl %0,%%ds": :"r" (__USER32_DS)); 436 loadsegment(ds, __USER32_DS);
437 loadsegment(es, __USER32_DS);
435 load_gs_index(0); 438 load_gs_index(0);
436 (regs)->ip = ex.a_entry; 439 (regs)->ip = ex.a_entry;
437 (regs)->sp = current->mm->start_stack; 440 (regs)->sp = current->mm->start_stack;
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
index f25a10124005..8d64c1bc8474 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
@@ -207,7 +207,7 @@ struct rt_sigframe
207 { unsigned int cur; \ 207 { unsigned int cur; \
208 unsigned short pre; \ 208 unsigned short pre; \
209 err |= __get_user(pre, &sc->seg); \ 209 err |= __get_user(pre, &sc->seg); \
210 asm volatile("movl %%" #seg ",%0" : "=r" (cur)); \ 210 savesegment(seg, cur); \
211 pre |= mask; \ 211 pre |= mask; \
212 if (pre != cur) loadsegment(seg, pre); } 212 if (pre != cur) loadsegment(seg, pre); }
213 213
@@ -236,7 +236,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
236 */ 236 */
237 err |= __get_user(gs, &sc->gs); 237 err |= __get_user(gs, &sc->gs);
238 gs |= 3; 238 gs |= 3;
239 asm("movl %%gs,%0" : "=r" (oldgs)); 239 savesegment(gs, oldgs);
240 if (gs != oldgs) 240 if (gs != oldgs)
241 load_gs_index(gs); 241 load_gs_index(gs);
242 242
@@ -342,14 +342,13 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc,
342{ 342{
343 int tmp, err = 0; 343 int tmp, err = 0;
344 344
345 tmp = 0; 345 savesegment(gs, tmp);
346 __asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp));
347 err |= __put_user(tmp, (unsigned int __user *)&sc->gs); 346 err |= __put_user(tmp, (unsigned int __user *)&sc->gs);
348 __asm__("movl %%fs,%0" : "=r"(tmp): "0"(tmp)); 347 savesegment(fs, tmp);
349 err |= __put_user(tmp, (unsigned int __user *)&sc->fs); 348 err |= __put_user(tmp, (unsigned int __user *)&sc->fs);
350 __asm__("movl %%ds,%0" : "=r"(tmp): "0"(tmp)); 349 savesegment(ds, tmp);
351 err |= __put_user(tmp, (unsigned int __user *)&sc->ds); 350 err |= __put_user(tmp, (unsigned int __user *)&sc->ds);
352 __asm__("movl %%es,%0" : "=r"(tmp): "0"(tmp)); 351 savesegment(es, tmp);
353 err |= __put_user(tmp, (unsigned int __user *)&sc->es); 352 err |= __put_user(tmp, (unsigned int __user *)&sc->es);
354 353
355 err |= __put_user((u32)regs->di, &sc->di); 354 err |= __put_user((u32)regs->di, &sc->di);
@@ -491,8 +490,8 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
491 regs->dx = 0; 490 regs->dx = 0;
492 regs->cx = 0; 491 regs->cx = 0;
493 492
494 asm volatile("movl %0,%%ds" :: "r" (__USER32_DS)); 493 loadsegment(ds, __USER32_DS);
495 asm volatile("movl %0,%%es" :: "r" (__USER32_DS)); 494 loadsegment(es, __USER32_DS);
496 495
497 regs->cs = __USER32_CS; 496 regs->cs = __USER32_CS;
498 regs->ss = __USER32_DS; 497 regs->ss = __USER32_DS;
@@ -588,8 +587,8 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
588 regs->dx = (unsigned long) &frame->info; 587 regs->dx = (unsigned long) &frame->info;
589 regs->cx = (unsigned long) &frame->uc; 588 regs->cx = (unsigned long) &frame->uc;
590 589
591 asm volatile("movl %0,%%ds" :: "r" (__USER32_DS)); 590 loadsegment(ds, __USER32_DS);
592 asm volatile("movl %0,%%es" :: "r" (__USER32_DS)); 591 loadsegment(es, __USER32_DS);
593 592
594 regs->cs = __USER32_CS; 593 regs->cs = __USER32_CS;
595 regs->ss = __USER32_DS; 594 regs->ss = __USER32_DS;
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index d3c64088b981..beda4232ce69 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -556,15 +556,6 @@ asmlinkage long sys32_rt_sigqueueinfo(int pid, int sig,
556 return ret; 556 return ret;
557} 557}
558 558
559/* These are here just in case some old ia32 binary calls it. */
560asmlinkage long sys32_pause(void)
561{
562 current->state = TASK_INTERRUPTIBLE;
563 schedule();
564 return -ERESTARTNOHAND;
565}
566
567
568#ifdef CONFIG_SYSCTL_SYSCALL 559#ifdef CONFIG_SYSCTL_SYSCALL
569struct sysctl_ia32 { 560struct sysctl_ia32 {
570 unsigned int name; 561 unsigned int name;
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 27ef365e757d..c2ac1b4515a0 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -58,7 +58,6 @@ EXPORT_SYMBOL(acpi_disabled);
58#ifdef CONFIG_X86_64 58#ifdef CONFIG_X86_64
59 59
60#include <asm/proto.h> 60#include <asm/proto.h>
61#include <asm/genapic.h>
62 61
63#else /* X86 */ 62#else /* X86 */
64 63
@@ -97,8 +96,6 @@ static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
97#warning ACPI uses CMPXCHG, i486 and later hardware 96#warning ACPI uses CMPXCHG, i486 and later hardware
98#endif 97#endif
99 98
100static int acpi_mcfg_64bit_base_addr __initdata = FALSE;
101
102/* -------------------------------------------------------------------------- 99/* --------------------------------------------------------------------------
103 Boot-time Configuration 100 Boot-time Configuration
104 -------------------------------------------------------------------------- */ 101 -------------------------------------------------------------------------- */
@@ -160,6 +157,8 @@ char *__init __acpi_map_table(unsigned long phys, unsigned long size)
160struct acpi_mcfg_allocation *pci_mmcfg_config; 157struct acpi_mcfg_allocation *pci_mmcfg_config;
161int pci_mmcfg_config_num; 158int pci_mmcfg_config_num;
162 159
160static int acpi_mcfg_64bit_base_addr __initdata = FALSE;
161
163static int __init acpi_mcfg_oem_check(struct acpi_table_mcfg *mcfg) 162static int __init acpi_mcfg_oem_check(struct acpi_table_mcfg *mcfg)
164{ 163{
165 if (!strcmp(mcfg->header.oem_id, "SGI")) 164 if (!strcmp(mcfg->header.oem_id, "SGI"))
@@ -253,10 +252,8 @@ static void __cpuinit acpi_register_lapic(int id, u8 enabled)
253 return; 252 return;
254 } 253 }
255 254
256#ifdef CONFIG_X86_32
257 if (boot_cpu_physical_apicid != -1U) 255 if (boot_cpu_physical_apicid != -1U)
258 ver = apic_version[boot_cpu_physical_apicid]; 256 ver = apic_version[boot_cpu_physical_apicid];
259#endif
260 257
261 generic_processor_info(id, ver); 258 generic_processor_info(id, ver);
262} 259}
@@ -776,10 +773,8 @@ static void __init acpi_register_lapic_address(unsigned long address)
776 set_fixmap_nocache(FIX_APIC_BASE, address); 773 set_fixmap_nocache(FIX_APIC_BASE, address);
777 if (boot_cpu_physical_apicid == -1U) { 774 if (boot_cpu_physical_apicid == -1U) {
778 boot_cpu_physical_apicid = read_apic_id(); 775 boot_cpu_physical_apicid = read_apic_id();
779#ifdef CONFIG_X86_32
780 apic_version[boot_cpu_physical_apicid] = 776 apic_version[boot_cpu_physical_apicid] =
781 GET_APIC_VERSION(apic_read(APIC_LVR)); 777 GET_APIC_VERSION(apic_read(APIC_LVR));
782#endif
783 } 778 }
784} 779}
785 780
@@ -1607,6 +1602,14 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
1607 */ 1602 */
1608 { 1603 {
1609 .callback = dmi_ignore_irq0_timer_override, 1604 .callback = dmi_ignore_irq0_timer_override,
1605 .ident = "HP nx6115 laptop",
1606 .matches = {
1607 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
1608 DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6115"),
1609 },
1610 },
1611 {
1612 .callback = dmi_ignore_irq0_timer_override,
1610 .ident = "HP NX6125 laptop", 1613 .ident = "HP NX6125 laptop",
1611 .matches = { 1614 .matches = {
1612 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 1615 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
@@ -1621,6 +1624,14 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
1621 DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6325"), 1624 DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6325"),
1622 }, 1625 },
1623 }, 1626 },
1627 {
1628 .callback = dmi_ignore_irq0_timer_override,
1629 .ident = "HP 6715b laptop",
1630 .matches = {
1631 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
1632 DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq 6715b"),
1633 },
1634 },
1624 {} 1635 {}
1625}; 1636};
1626 1637
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 65a0c1b48696..fb04e49776ba 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -231,25 +231,25 @@ static void alternatives_smp_lock(u8 **start, u8 **end, u8 *text, u8 *text_end)
231 continue; 231 continue;
232 if (*ptr > text_end) 232 if (*ptr > text_end)
233 continue; 233 continue;
234 text_poke(*ptr, ((unsigned char []){0xf0}), 1); /* add lock prefix */ 234 /* turn DS segment override prefix into lock prefix */
235 text_poke(*ptr, ((unsigned char []){0xf0}), 1);
235 }; 236 };
236} 237}
237 238
238static void alternatives_smp_unlock(u8 **start, u8 **end, u8 *text, u8 *text_end) 239static void alternatives_smp_unlock(u8 **start, u8 **end, u8 *text, u8 *text_end)
239{ 240{
240 u8 **ptr; 241 u8 **ptr;
241 char insn[1];
242 242
243 if (noreplace_smp) 243 if (noreplace_smp)
244 return; 244 return;
245 245
246 add_nops(insn, 1);
247 for (ptr = start; ptr < end; ptr++) { 246 for (ptr = start; ptr < end; ptr++) {
248 if (*ptr < text) 247 if (*ptr < text)
249 continue; 248 continue;
250 if (*ptr > text_end) 249 if (*ptr > text_end)
251 continue; 250 continue;
252 text_poke(*ptr, insn, 1); 251 /* turn lock prefix into DS segment override prefix */
252 text_poke(*ptr, ((unsigned char []){0x3E}), 1);
253 }; 253 };
254} 254}
255 255
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 69b4d060b21c..34e4d112b1ef 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -33,6 +33,10 @@
33 33
34static DEFINE_RWLOCK(amd_iommu_devtable_lock); 34static DEFINE_RWLOCK(amd_iommu_devtable_lock);
35 35
36/* A list of preallocated protection domains */
37static LIST_HEAD(iommu_pd_list);
38static DEFINE_SPINLOCK(iommu_pd_list_lock);
39
36/* 40/*
37 * general struct to manage commands send to an IOMMU 41 * general struct to manage commands send to an IOMMU
38 */ 42 */
@@ -51,6 +55,102 @@ static int iommu_has_npcache(struct amd_iommu *iommu)
51 55
52/**************************************************************************** 56/****************************************************************************
53 * 57 *
58 * Interrupt handling functions
59 *
60 ****************************************************************************/
61
62static void iommu_print_event(void *__evt)
63{
64 u32 *event = __evt;
65 int type = (event[1] >> EVENT_TYPE_SHIFT) & EVENT_TYPE_MASK;
66 int devid = (event[0] >> EVENT_DEVID_SHIFT) & EVENT_DEVID_MASK;
67 int domid = (event[1] >> EVENT_DOMID_SHIFT) & EVENT_DOMID_MASK;
68 int flags = (event[1] >> EVENT_FLAGS_SHIFT) & EVENT_FLAGS_MASK;
69 u64 address = (u64)(((u64)event[3]) << 32) | event[2];
70
71 printk(KERN_ERR "AMD IOMMU: Event logged [");
72
73 switch (type) {
74 case EVENT_TYPE_ILL_DEV:
75 printk("ILLEGAL_DEV_TABLE_ENTRY device=%02x:%02x.%x "
76 "address=0x%016llx flags=0x%04x]\n",
77 PCI_BUS(devid), PCI_SLOT(devid), PCI_FUNC(devid),
78 address, flags);
79 break;
80 case EVENT_TYPE_IO_FAULT:
81 printk("IO_PAGE_FAULT device=%02x:%02x.%x "
82 "domain=0x%04x address=0x%016llx flags=0x%04x]\n",
83 PCI_BUS(devid), PCI_SLOT(devid), PCI_FUNC(devid),
84 domid, address, flags);
85 break;
86 case EVENT_TYPE_DEV_TAB_ERR:
87 printk("DEV_TAB_HARDWARE_ERROR device=%02x:%02x.%x "
88 "address=0x%016llx flags=0x%04x]\n",
89 PCI_BUS(devid), PCI_SLOT(devid), PCI_FUNC(devid),
90 address, flags);
91 break;
92 case EVENT_TYPE_PAGE_TAB_ERR:
93 printk("PAGE_TAB_HARDWARE_ERROR device=%02x:%02x.%x "
94 "domain=0x%04x address=0x%016llx flags=0x%04x]\n",
95 PCI_BUS(devid), PCI_SLOT(devid), PCI_FUNC(devid),
96 domid, address, flags);
97 break;
98 case EVENT_TYPE_ILL_CMD:
99 printk("ILLEGAL_COMMAND_ERROR address=0x%016llx]\n", address);
100 break;
101 case EVENT_TYPE_CMD_HARD_ERR:
102 printk("COMMAND_HARDWARE_ERROR address=0x%016llx "
103 "flags=0x%04x]\n", address, flags);
104 break;
105 case EVENT_TYPE_IOTLB_INV_TO:
106 printk("IOTLB_INV_TIMEOUT device=%02x:%02x.%x "
107 "address=0x%016llx]\n",
108 PCI_BUS(devid), PCI_SLOT(devid), PCI_FUNC(devid),
109 address);
110 break;
111 case EVENT_TYPE_INV_DEV_REQ:
112 printk("INVALID_DEVICE_REQUEST device=%02x:%02x.%x "
113 "address=0x%016llx flags=0x%04x]\n",
114 PCI_BUS(devid), PCI_SLOT(devid), PCI_FUNC(devid),
115 address, flags);
116 break;
117 default:
118 printk(KERN_ERR "UNKNOWN type=0x%02x]\n", type);
119 }
120}
121
122static void iommu_poll_events(struct amd_iommu *iommu)
123{
124 u32 head, tail;
125 unsigned long flags;
126
127 spin_lock_irqsave(&iommu->lock, flags);
128
129 head = readl(iommu->mmio_base + MMIO_EVT_HEAD_OFFSET);
130 tail = readl(iommu->mmio_base + MMIO_EVT_TAIL_OFFSET);
131
132 while (head != tail) {
133 iommu_print_event(iommu->evt_buf + head);
134 head = (head + EVENT_ENTRY_SIZE) % iommu->evt_buf_size;
135 }
136
137 writel(head, iommu->mmio_base + MMIO_EVT_HEAD_OFFSET);
138
139 spin_unlock_irqrestore(&iommu->lock, flags);
140}
141
142irqreturn_t amd_iommu_int_handler(int irq, void *data)
143{
144 struct amd_iommu *iommu;
145
146 list_for_each_entry(iommu, &amd_iommu_list, list)
147 iommu_poll_events(iommu);
148
149 return IRQ_HANDLED;
150}
151
152/****************************************************************************
153 *
54 * IOMMU command queuing functions 154 * IOMMU command queuing functions
55 * 155 *
56 ****************************************************************************/ 156 ****************************************************************************/
@@ -101,10 +201,10 @@ static int iommu_queue_command(struct amd_iommu *iommu, struct iommu_cmd *cmd)
101 */ 201 */
102static int iommu_completion_wait(struct amd_iommu *iommu) 202static int iommu_completion_wait(struct amd_iommu *iommu)
103{ 203{
104 int ret, ready = 0; 204 int ret = 0, ready = 0;
105 unsigned status = 0; 205 unsigned status = 0;
106 struct iommu_cmd cmd; 206 struct iommu_cmd cmd;
107 unsigned long i = 0; 207 unsigned long flags, i = 0;
108 208
109 memset(&cmd, 0, sizeof(cmd)); 209 memset(&cmd, 0, sizeof(cmd));
110 cmd.data[0] = CMD_COMPL_WAIT_INT_MASK; 210 cmd.data[0] = CMD_COMPL_WAIT_INT_MASK;
@@ -112,10 +212,12 @@ static int iommu_completion_wait(struct amd_iommu *iommu)
112 212
113 iommu->need_sync = 0; 213 iommu->need_sync = 0;
114 214
115 ret = iommu_queue_command(iommu, &cmd); 215 spin_lock_irqsave(&iommu->lock, flags);
216
217 ret = __iommu_queue_command(iommu, &cmd);
116 218
117 if (ret) 219 if (ret)
118 return ret; 220 goto out;
119 221
120 while (!ready && (i < EXIT_LOOP_COUNT)) { 222 while (!ready && (i < EXIT_LOOP_COUNT)) {
121 ++i; 223 ++i;
@@ -130,6 +232,8 @@ static int iommu_completion_wait(struct amd_iommu *iommu)
130 232
131 if (unlikely((i == EXIT_LOOP_COUNT) && printk_ratelimit())) 233 if (unlikely((i == EXIT_LOOP_COUNT) && printk_ratelimit()))
132 printk(KERN_WARNING "AMD IOMMU: Completion wait loop failed\n"); 234 printk(KERN_WARNING "AMD IOMMU: Completion wait loop failed\n");
235out:
236 spin_unlock_irqrestore(&iommu->lock, flags);
133 237
134 return 0; 238 return 0;
135} 239}
@@ -140,6 +244,7 @@ static int iommu_completion_wait(struct amd_iommu *iommu)
140static int iommu_queue_inv_dev_entry(struct amd_iommu *iommu, u16 devid) 244static int iommu_queue_inv_dev_entry(struct amd_iommu *iommu, u16 devid)
141{ 245{
142 struct iommu_cmd cmd; 246 struct iommu_cmd cmd;
247 int ret;
143 248
144 BUG_ON(iommu == NULL); 249 BUG_ON(iommu == NULL);
145 250
@@ -147,9 +252,11 @@ static int iommu_queue_inv_dev_entry(struct amd_iommu *iommu, u16 devid)
147 CMD_SET_TYPE(&cmd, CMD_INV_DEV_ENTRY); 252 CMD_SET_TYPE(&cmd, CMD_INV_DEV_ENTRY);
148 cmd.data[0] = devid; 253 cmd.data[0] = devid;
149 254
255 ret = iommu_queue_command(iommu, &cmd);
256
150 iommu->need_sync = 1; 257 iommu->need_sync = 1;
151 258
152 return iommu_queue_command(iommu, &cmd); 259 return ret;
153} 260}
154 261
155/* 262/*
@@ -159,6 +266,7 @@ static int iommu_queue_inv_iommu_pages(struct amd_iommu *iommu,
159 u64 address, u16 domid, int pde, int s) 266 u64 address, u16 domid, int pde, int s)
160{ 267{
161 struct iommu_cmd cmd; 268 struct iommu_cmd cmd;
269 int ret;
162 270
163 memset(&cmd, 0, sizeof(cmd)); 271 memset(&cmd, 0, sizeof(cmd));
164 address &= PAGE_MASK; 272 address &= PAGE_MASK;
@@ -171,9 +279,11 @@ static int iommu_queue_inv_iommu_pages(struct amd_iommu *iommu,
171 if (pde) /* PDE bit - we wan't flush everything not only the PTEs */ 279 if (pde) /* PDE bit - we wan't flush everything not only the PTEs */
172 cmd.data[2] |= CMD_INV_IOMMU_PAGES_PDE_MASK; 280 cmd.data[2] |= CMD_INV_IOMMU_PAGES_PDE_MASK;
173 281
282 ret = iommu_queue_command(iommu, &cmd);
283
174 iommu->need_sync = 1; 284 iommu->need_sync = 1;
175 285
176 return iommu_queue_command(iommu, &cmd); 286 return ret;
177} 287}
178 288
179/* 289/*
@@ -203,6 +313,14 @@ static int iommu_flush_pages(struct amd_iommu *iommu, u16 domid,
203 return 0; 313 return 0;
204} 314}
205 315
316/* Flush the whole IO/TLB for a given protection domain */
317static void iommu_flush_tlb(struct amd_iommu *iommu, u16 domid)
318{
319 u64 address = CMD_INV_IOMMU_ALL_PAGES_ADDRESS;
320
321 iommu_queue_inv_iommu_pages(iommu, address, domid, 0, 1);
322}
323
206/**************************************************************************** 324/****************************************************************************
207 * 325 *
208 * The functions below are used the create the page table mappings for 326 * The functions below are used the create the page table mappings for
@@ -362,11 +480,6 @@ static int init_unity_mappings_for_device(struct dma_ops_domain *dma_dom,
362 * efficient allocator. 480 * efficient allocator.
363 * 481 *
364 ****************************************************************************/ 482 ****************************************************************************/
365static unsigned long dma_mask_to_pages(unsigned long mask)
366{
367 return (mask >> PAGE_SHIFT) +
368 (PAGE_ALIGN(mask & ~PAGE_MASK) >> PAGE_SHIFT);
369}
370 483
371/* 484/*
372 * The address allocator core function. 485 * The address allocator core function.
@@ -375,25 +488,31 @@ static unsigned long dma_mask_to_pages(unsigned long mask)
375 */ 488 */
376static unsigned long dma_ops_alloc_addresses(struct device *dev, 489static unsigned long dma_ops_alloc_addresses(struct device *dev,
377 struct dma_ops_domain *dom, 490 struct dma_ops_domain *dom,
378 unsigned int pages) 491 unsigned int pages,
492 unsigned long align_mask,
493 u64 dma_mask)
379{ 494{
380 unsigned long limit = dma_mask_to_pages(*dev->dma_mask); 495 unsigned long limit;
381 unsigned long address; 496 unsigned long address;
382 unsigned long size = dom->aperture_size >> PAGE_SHIFT;
383 unsigned long boundary_size; 497 unsigned long boundary_size;
384 498
385 boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1, 499 boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1,
386 PAGE_SIZE) >> PAGE_SHIFT; 500 PAGE_SIZE) >> PAGE_SHIFT;
387 limit = limit < size ? limit : size; 501 limit = iommu_device_max_index(dom->aperture_size >> PAGE_SHIFT, 0,
502 dma_mask >> PAGE_SHIFT);
388 503
389 if (dom->next_bit >= limit) 504 if (dom->next_bit >= limit) {
390 dom->next_bit = 0; 505 dom->next_bit = 0;
506 dom->need_flush = true;
507 }
391 508
392 address = iommu_area_alloc(dom->bitmap, limit, dom->next_bit, pages, 509 address = iommu_area_alloc(dom->bitmap, limit, dom->next_bit, pages,
393 0 , boundary_size, 0); 510 0 , boundary_size, align_mask);
394 if (address == -1) 511 if (address == -1) {
395 address = iommu_area_alloc(dom->bitmap, limit, 0, pages, 512 address = iommu_area_alloc(dom->bitmap, limit, 0, pages,
396 0, boundary_size, 0); 513 0, boundary_size, align_mask);
514 dom->need_flush = true;
515 }
397 516
398 if (likely(address != -1)) { 517 if (likely(address != -1)) {
399 dom->next_bit = address + pages; 518 dom->next_bit = address + pages;
@@ -459,7 +578,7 @@ static void dma_ops_reserve_addresses(struct dma_ops_domain *dom,
459 if (start_page + pages > last_page) 578 if (start_page + pages > last_page)
460 pages = last_page - start_page; 579 pages = last_page - start_page;
461 580
462 set_bit_string(dom->bitmap, start_page, pages); 581 iommu_area_reserve(dom->bitmap, start_page, pages);
463} 582}
464 583
465static void dma_ops_free_pagetable(struct dma_ops_domain *dma_dom) 584static void dma_ops_free_pagetable(struct dma_ops_domain *dma_dom)
@@ -553,6 +672,9 @@ static struct dma_ops_domain *dma_ops_domain_alloc(struct amd_iommu *iommu,
553 dma_dom->bitmap[0] = 1; 672 dma_dom->bitmap[0] = 1;
554 dma_dom->next_bit = 0; 673 dma_dom->next_bit = 0;
555 674
675 dma_dom->need_flush = false;
676 dma_dom->target_dev = 0xffff;
677
556 /* Intialize the exclusion range if necessary */ 678 /* Intialize the exclusion range if necessary */
557 if (iommu->exclusion_start && 679 if (iommu->exclusion_start &&
558 iommu->exclusion_start < dma_dom->aperture_size) { 680 iommu->exclusion_start < dma_dom->aperture_size) {
@@ -623,12 +745,13 @@ static void set_device_domain(struct amd_iommu *iommu,
623 745
624 u64 pte_root = virt_to_phys(domain->pt_root); 746 u64 pte_root = virt_to_phys(domain->pt_root);
625 747
626 pte_root |= (domain->mode & 0x07) << 9; 748 pte_root |= (domain->mode & DEV_ENTRY_MODE_MASK)
627 pte_root |= IOMMU_PTE_IR | IOMMU_PTE_IW | IOMMU_PTE_P | 2; 749 << DEV_ENTRY_MODE_SHIFT;
750 pte_root |= IOMMU_PTE_IR | IOMMU_PTE_IW | IOMMU_PTE_P | IOMMU_PTE_TV;
628 751
629 write_lock_irqsave(&amd_iommu_devtable_lock, flags); 752 write_lock_irqsave(&amd_iommu_devtable_lock, flags);
630 amd_iommu_dev_table[devid].data[0] = pte_root; 753 amd_iommu_dev_table[devid].data[0] = lower_32_bits(pte_root);
631 amd_iommu_dev_table[devid].data[1] = pte_root >> 32; 754 amd_iommu_dev_table[devid].data[1] = upper_32_bits(pte_root);
632 amd_iommu_dev_table[devid].data[2] = domain->id; 755 amd_iommu_dev_table[devid].data[2] = domain->id;
633 756
634 amd_iommu_pd_table[devid] = domain; 757 amd_iommu_pd_table[devid] = domain;
@@ -646,6 +769,45 @@ static void set_device_domain(struct amd_iommu *iommu,
646 *****************************************************************************/ 769 *****************************************************************************/
647 770
648/* 771/*
772 * This function checks if the driver got a valid device from the caller to
773 * avoid dereferencing invalid pointers.
774 */
775static bool check_device(struct device *dev)
776{
777 if (!dev || !dev->dma_mask)
778 return false;
779
780 return true;
781}
782
783/*
784 * In this function the list of preallocated protection domains is traversed to
785 * find the domain for a specific device
786 */
787static struct dma_ops_domain *find_protection_domain(u16 devid)
788{
789 struct dma_ops_domain *entry, *ret = NULL;
790 unsigned long flags;
791
792 if (list_empty(&iommu_pd_list))
793 return NULL;
794
795 spin_lock_irqsave(&iommu_pd_list_lock, flags);
796
797 list_for_each_entry(entry, &iommu_pd_list, list) {
798 if (entry->target_dev == devid) {
799 ret = entry;
800 list_del(&ret->list);
801 break;
802 }
803 }
804
805 spin_unlock_irqrestore(&iommu_pd_list_lock, flags);
806
807 return ret;
808}
809
810/*
649 * In the dma_ops path we only have the struct device. This function 811 * In the dma_ops path we only have the struct device. This function
650 * finds the corresponding IOMMU, the protection domain and the 812 * finds the corresponding IOMMU, the protection domain and the
651 * requestor id for a given device. 813 * requestor id for a given device.
@@ -661,27 +823,30 @@ static int get_device_resources(struct device *dev,
661 struct pci_dev *pcidev; 823 struct pci_dev *pcidev;
662 u16 _bdf; 824 u16 _bdf;
663 825
664 BUG_ON(!dev || dev->bus != &pci_bus_type || !dev->dma_mask); 826 *iommu = NULL;
827 *domain = NULL;
828 *bdf = 0xffff;
829
830 if (dev->bus != &pci_bus_type)
831 return 0;
665 832
666 pcidev = to_pci_dev(dev); 833 pcidev = to_pci_dev(dev);
667 _bdf = calc_devid(pcidev->bus->number, pcidev->devfn); 834 _bdf = calc_devid(pcidev->bus->number, pcidev->devfn);
668 835
669 /* device not translated by any IOMMU in the system? */ 836 /* device not translated by any IOMMU in the system? */
670 if (_bdf > amd_iommu_last_bdf) { 837 if (_bdf > amd_iommu_last_bdf)
671 *iommu = NULL;
672 *domain = NULL;
673 *bdf = 0xffff;
674 return 0; 838 return 0;
675 }
676 839
677 *bdf = amd_iommu_alias_table[_bdf]; 840 *bdf = amd_iommu_alias_table[_bdf];
678 841
679 *iommu = amd_iommu_rlookup_table[*bdf]; 842 *iommu = amd_iommu_rlookup_table[*bdf];
680 if (*iommu == NULL) 843 if (*iommu == NULL)
681 return 0; 844 return 0;
682 dma_dom = (*iommu)->default_dom;
683 *domain = domain_for_device(*bdf); 845 *domain = domain_for_device(*bdf);
684 if (*domain == NULL) { 846 if (*domain == NULL) {
847 dma_dom = find_protection_domain(*bdf);
848 if (!dma_dom)
849 dma_dom = (*iommu)->default_dom;
685 *domain = &dma_dom->domain; 850 *domain = &dma_dom->domain;
686 set_device_domain(*iommu, *domain, *bdf); 851 set_device_domain(*iommu, *domain, *bdf);
687 printk(KERN_INFO "AMD IOMMU: Using protection domain %d for " 852 printk(KERN_INFO "AMD IOMMU: Using protection domain %d for "
@@ -760,17 +925,24 @@ static dma_addr_t __map_single(struct device *dev,
760 struct dma_ops_domain *dma_dom, 925 struct dma_ops_domain *dma_dom,
761 phys_addr_t paddr, 926 phys_addr_t paddr,
762 size_t size, 927 size_t size,
763 int dir) 928 int dir,
929 bool align,
930 u64 dma_mask)
764{ 931{
765 dma_addr_t offset = paddr & ~PAGE_MASK; 932 dma_addr_t offset = paddr & ~PAGE_MASK;
766 dma_addr_t address, start; 933 dma_addr_t address, start;
767 unsigned int pages; 934 unsigned int pages;
935 unsigned long align_mask = 0;
768 int i; 936 int i;
769 937
770 pages = iommu_num_pages(paddr, size); 938 pages = iommu_num_pages(paddr, size);
771 paddr &= PAGE_MASK; 939 paddr &= PAGE_MASK;
772 940
773 address = dma_ops_alloc_addresses(dev, dma_dom, pages); 941 if (align)
942 align_mask = (1UL << get_order(size)) - 1;
943
944 address = dma_ops_alloc_addresses(dev, dma_dom, pages, align_mask,
945 dma_mask);
774 if (unlikely(address == bad_dma_address)) 946 if (unlikely(address == bad_dma_address))
775 goto out; 947 goto out;
776 948
@@ -782,6 +954,12 @@ static dma_addr_t __map_single(struct device *dev,
782 } 954 }
783 address += offset; 955 address += offset;
784 956
957 if (unlikely(dma_dom->need_flush && !amd_iommu_unmap_flush)) {
958 iommu_flush_tlb(iommu, dma_dom->domain.id);
959 dma_dom->need_flush = false;
960 } else if (unlikely(iommu_has_npcache(iommu)))
961 iommu_flush_pages(iommu, dma_dom->domain.id, address, size);
962
785out: 963out:
786 return address; 964 return address;
787} 965}
@@ -812,6 +990,9 @@ static void __unmap_single(struct amd_iommu *iommu,
812 } 990 }
813 991
814 dma_ops_free_addresses(dma_dom, dma_addr, pages); 992 dma_ops_free_addresses(dma_dom, dma_addr, pages);
993
994 if (amd_iommu_unmap_flush)
995 iommu_flush_pages(iommu, dma_dom->domain.id, dma_addr, size);
815} 996}
816 997
817/* 998/*
@@ -825,6 +1006,12 @@ static dma_addr_t map_single(struct device *dev, phys_addr_t paddr,
825 struct protection_domain *domain; 1006 struct protection_domain *domain;
826 u16 devid; 1007 u16 devid;
827 dma_addr_t addr; 1008 dma_addr_t addr;
1009 u64 dma_mask;
1010
1011 if (!check_device(dev))
1012 return bad_dma_address;
1013
1014 dma_mask = *dev->dma_mask;
828 1015
829 get_device_resources(dev, &iommu, &domain, &devid); 1016 get_device_resources(dev, &iommu, &domain, &devid);
830 1017
@@ -833,14 +1020,12 @@ static dma_addr_t map_single(struct device *dev, phys_addr_t paddr,
833 return (dma_addr_t)paddr; 1020 return (dma_addr_t)paddr;
834 1021
835 spin_lock_irqsave(&domain->lock, flags); 1022 spin_lock_irqsave(&domain->lock, flags);
836 addr = __map_single(dev, iommu, domain->priv, paddr, size, dir); 1023 addr = __map_single(dev, iommu, domain->priv, paddr, size, dir, false,
1024 dma_mask);
837 if (addr == bad_dma_address) 1025 if (addr == bad_dma_address)
838 goto out; 1026 goto out;
839 1027
840 if (iommu_has_npcache(iommu)) 1028 if (unlikely(iommu->need_sync))
841 iommu_flush_pages(iommu, domain->id, addr, size);
842
843 if (iommu->need_sync)
844 iommu_completion_wait(iommu); 1029 iommu_completion_wait(iommu);
845 1030
846out: 1031out:
@@ -860,7 +1045,8 @@ static void unmap_single(struct device *dev, dma_addr_t dma_addr,
860 struct protection_domain *domain; 1045 struct protection_domain *domain;
861 u16 devid; 1046 u16 devid;
862 1047
863 if (!get_device_resources(dev, &iommu, &domain, &devid)) 1048 if (!check_device(dev) ||
1049 !get_device_resources(dev, &iommu, &domain, &devid))
864 /* device not handled by any AMD IOMMU */ 1050 /* device not handled by any AMD IOMMU */
865 return; 1051 return;
866 1052
@@ -868,9 +1054,7 @@ static void unmap_single(struct device *dev, dma_addr_t dma_addr,
868 1054
869 __unmap_single(iommu, domain->priv, dma_addr, size, dir); 1055 __unmap_single(iommu, domain->priv, dma_addr, size, dir);
870 1056
871 iommu_flush_pages(iommu, domain->id, dma_addr, size); 1057 if (unlikely(iommu->need_sync))
872
873 if (iommu->need_sync)
874 iommu_completion_wait(iommu); 1058 iommu_completion_wait(iommu);
875 1059
876 spin_unlock_irqrestore(&domain->lock, flags); 1060 spin_unlock_irqrestore(&domain->lock, flags);
@@ -909,6 +1093,12 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,
909 struct scatterlist *s; 1093 struct scatterlist *s;
910 phys_addr_t paddr; 1094 phys_addr_t paddr;
911 int mapped_elems = 0; 1095 int mapped_elems = 0;
1096 u64 dma_mask;
1097
1098 if (!check_device(dev))
1099 return 0;
1100
1101 dma_mask = *dev->dma_mask;
912 1102
913 get_device_resources(dev, &iommu, &domain, &devid); 1103 get_device_resources(dev, &iommu, &domain, &devid);
914 1104
@@ -921,19 +1111,17 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,
921 paddr = sg_phys(s); 1111 paddr = sg_phys(s);
922 1112
923 s->dma_address = __map_single(dev, iommu, domain->priv, 1113 s->dma_address = __map_single(dev, iommu, domain->priv,
924 paddr, s->length, dir); 1114 paddr, s->length, dir, false,
1115 dma_mask);
925 1116
926 if (s->dma_address) { 1117 if (s->dma_address) {
927 s->dma_length = s->length; 1118 s->dma_length = s->length;
928 mapped_elems++; 1119 mapped_elems++;
929 } else 1120 } else
930 goto unmap; 1121 goto unmap;
931 if (iommu_has_npcache(iommu))
932 iommu_flush_pages(iommu, domain->id, s->dma_address,
933 s->dma_length);
934 } 1122 }
935 1123
936 if (iommu->need_sync) 1124 if (unlikely(iommu->need_sync))
937 iommu_completion_wait(iommu); 1125 iommu_completion_wait(iommu);
938 1126
939out: 1127out:
@@ -967,7 +1155,8 @@ static void unmap_sg(struct device *dev, struct scatterlist *sglist,
967 u16 devid; 1155 u16 devid;
968 int i; 1156 int i;
969 1157
970 if (!get_device_resources(dev, &iommu, &domain, &devid)) 1158 if (!check_device(dev) ||
1159 !get_device_resources(dev, &iommu, &domain, &devid))
971 return; 1160 return;
972 1161
973 spin_lock_irqsave(&domain->lock, flags); 1162 spin_lock_irqsave(&domain->lock, flags);
@@ -975,12 +1164,10 @@ static void unmap_sg(struct device *dev, struct scatterlist *sglist,
975 for_each_sg(sglist, s, nelems, i) { 1164 for_each_sg(sglist, s, nelems, i) {
976 __unmap_single(iommu, domain->priv, s->dma_address, 1165 __unmap_single(iommu, domain->priv, s->dma_address,
977 s->dma_length, dir); 1166 s->dma_length, dir);
978 iommu_flush_pages(iommu, domain->id, s->dma_address,
979 s->dma_length);
980 s->dma_address = s->dma_length = 0; 1167 s->dma_address = s->dma_length = 0;
981 } 1168 }
982 1169
983 if (iommu->need_sync) 1170 if (unlikely(iommu->need_sync))
984 iommu_completion_wait(iommu); 1171 iommu_completion_wait(iommu);
985 1172
986 spin_unlock_irqrestore(&domain->lock, flags); 1173 spin_unlock_irqrestore(&domain->lock, flags);
@@ -998,25 +1185,33 @@ static void *alloc_coherent(struct device *dev, size_t size,
998 struct protection_domain *domain; 1185 struct protection_domain *domain;
999 u16 devid; 1186 u16 devid;
1000 phys_addr_t paddr; 1187 phys_addr_t paddr;
1188 u64 dma_mask = dev->coherent_dma_mask;
1189
1190 if (!check_device(dev))
1191 return NULL;
1001 1192
1193 if (!get_device_resources(dev, &iommu, &domain, &devid))
1194 flag &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
1195
1196 flag |= __GFP_ZERO;
1002 virt_addr = (void *)__get_free_pages(flag, get_order(size)); 1197 virt_addr = (void *)__get_free_pages(flag, get_order(size));
1003 if (!virt_addr) 1198 if (!virt_addr)
1004 return 0; 1199 return 0;
1005 1200
1006 memset(virt_addr, 0, size);
1007 paddr = virt_to_phys(virt_addr); 1201 paddr = virt_to_phys(virt_addr);
1008 1202
1009 get_device_resources(dev, &iommu, &domain, &devid);
1010
1011 if (!iommu || !domain) { 1203 if (!iommu || !domain) {
1012 *dma_addr = (dma_addr_t)paddr; 1204 *dma_addr = (dma_addr_t)paddr;
1013 return virt_addr; 1205 return virt_addr;
1014 } 1206 }
1015 1207
1208 if (!dma_mask)
1209 dma_mask = *dev->dma_mask;
1210
1016 spin_lock_irqsave(&domain->lock, flags); 1211 spin_lock_irqsave(&domain->lock, flags);
1017 1212
1018 *dma_addr = __map_single(dev, iommu, domain->priv, paddr, 1213 *dma_addr = __map_single(dev, iommu, domain->priv, paddr,
1019 size, DMA_BIDIRECTIONAL); 1214 size, DMA_BIDIRECTIONAL, true, dma_mask);
1020 1215
1021 if (*dma_addr == bad_dma_address) { 1216 if (*dma_addr == bad_dma_address) {
1022 free_pages((unsigned long)virt_addr, get_order(size)); 1217 free_pages((unsigned long)virt_addr, get_order(size));
@@ -1024,10 +1219,7 @@ static void *alloc_coherent(struct device *dev, size_t size,
1024 goto out; 1219 goto out;
1025 } 1220 }
1026 1221
1027 if (iommu_has_npcache(iommu)) 1222 if (unlikely(iommu->need_sync))
1028 iommu_flush_pages(iommu, domain->id, *dma_addr, size);
1029
1030 if (iommu->need_sync)
1031 iommu_completion_wait(iommu); 1223 iommu_completion_wait(iommu);
1032 1224
1033out: 1225out:
@@ -1038,8 +1230,6 @@ out:
1038 1230
1039/* 1231/*
1040 * The exported free_coherent function for dma_ops. 1232 * The exported free_coherent function for dma_ops.
1041 * FIXME: fix the generic x86 DMA layer so that it actually calls that
1042 * function.
1043 */ 1233 */
1044static void free_coherent(struct device *dev, size_t size, 1234static void free_coherent(struct device *dev, size_t size,
1045 void *virt_addr, dma_addr_t dma_addr) 1235 void *virt_addr, dma_addr_t dma_addr)
@@ -1049,6 +1239,9 @@ static void free_coherent(struct device *dev, size_t size,
1049 struct protection_domain *domain; 1239 struct protection_domain *domain;
1050 u16 devid; 1240 u16 devid;
1051 1241
1242 if (!check_device(dev))
1243 return;
1244
1052 get_device_resources(dev, &iommu, &domain, &devid); 1245 get_device_resources(dev, &iommu, &domain, &devid);
1053 1246
1054 if (!iommu || !domain) 1247 if (!iommu || !domain)
@@ -1057,9 +1250,8 @@ static void free_coherent(struct device *dev, size_t size,
1057 spin_lock_irqsave(&domain->lock, flags); 1250 spin_lock_irqsave(&domain->lock, flags);
1058 1251
1059 __unmap_single(iommu, domain->priv, dma_addr, size, DMA_BIDIRECTIONAL); 1252 __unmap_single(iommu, domain->priv, dma_addr, size, DMA_BIDIRECTIONAL);
1060 iommu_flush_pages(iommu, domain->id, dma_addr, size);
1061 1253
1062 if (iommu->need_sync) 1254 if (unlikely(iommu->need_sync))
1063 iommu_completion_wait(iommu); 1255 iommu_completion_wait(iommu);
1064 1256
1065 spin_unlock_irqrestore(&domain->lock, flags); 1257 spin_unlock_irqrestore(&domain->lock, flags);
@@ -1069,6 +1261,30 @@ free_mem:
1069} 1261}
1070 1262
1071/* 1263/*
1264 * This function is called by the DMA layer to find out if we can handle a
1265 * particular device. It is part of the dma_ops.
1266 */
1267static int amd_iommu_dma_supported(struct device *dev, u64 mask)
1268{
1269 u16 bdf;
1270 struct pci_dev *pcidev;
1271
1272 /* No device or no PCI device */
1273 if (!dev || dev->bus != &pci_bus_type)
1274 return 0;
1275
1276 pcidev = to_pci_dev(dev);
1277
1278 bdf = calc_devid(pcidev->bus->number, pcidev->devfn);
1279
1280 /* Out of our scope? */
1281 if (bdf > amd_iommu_last_bdf)
1282 return 0;
1283
1284 return 1;
1285}
1286
1287/*
1072 * The function for pre-allocating protection domains. 1288 * The function for pre-allocating protection domains.
1073 * 1289 *
1074 * If the driver core informs the DMA layer if a driver grabs a device 1290 * If the driver core informs the DMA layer if a driver grabs a device
@@ -1097,10 +1313,9 @@ void prealloc_protection_domains(void)
1097 if (!dma_dom) 1313 if (!dma_dom)
1098 continue; 1314 continue;
1099 init_unity_mappings_for_device(dma_dom, devid); 1315 init_unity_mappings_for_device(dma_dom, devid);
1100 set_device_domain(iommu, &dma_dom->domain, devid); 1316 dma_dom->target_dev = devid;
1101 printk(KERN_INFO "AMD IOMMU: Allocated domain %d for device ", 1317
1102 dma_dom->domain.id); 1318 list_add_tail(&dma_dom->list, &iommu_pd_list);
1103 print_devid(devid, 1);
1104 } 1319 }
1105} 1320}
1106 1321
@@ -1111,6 +1326,7 @@ static struct dma_mapping_ops amd_iommu_dma_ops = {
1111 .unmap_single = unmap_single, 1326 .unmap_single = unmap_single,
1112 .map_sg = map_sg, 1327 .map_sg = map_sg,
1113 .unmap_sg = unmap_sg, 1328 .unmap_sg = unmap_sg,
1329 .dma_supported = amd_iommu_dma_supported,
1114}; 1330};
1115 1331
1116/* 1332/*
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
index a69cc0f52042..148fcfe22f17 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -22,6 +22,8 @@
22#include <linux/gfp.h> 22#include <linux/gfp.h>
23#include <linux/list.h> 23#include <linux/list.h>
24#include <linux/sysdev.h> 24#include <linux/sysdev.h>
25#include <linux/interrupt.h>
26#include <linux/msi.h>
25#include <asm/pci-direct.h> 27#include <asm/pci-direct.h>
26#include <asm/amd_iommu_types.h> 28#include <asm/amd_iommu_types.h>
27#include <asm/amd_iommu.h> 29#include <asm/amd_iommu.h>
@@ -30,7 +32,6 @@
30/* 32/*
31 * definitions for the ACPI scanning code 33 * definitions for the ACPI scanning code
32 */ 34 */
33#define PCI_BUS(x) (((x) >> 8) & 0xff)
34#define IVRS_HEADER_LENGTH 48 35#define IVRS_HEADER_LENGTH 48
35 36
36#define ACPI_IVHD_TYPE 0x10 37#define ACPI_IVHD_TYPE 0x10
@@ -121,6 +122,7 @@ LIST_HEAD(amd_iommu_unity_map); /* a list of required unity mappings
121 we find in ACPI */ 122 we find in ACPI */
122unsigned amd_iommu_aperture_order = 26; /* size of aperture in power of 2 */ 123unsigned amd_iommu_aperture_order = 26; /* size of aperture in power of 2 */
123int amd_iommu_isolate; /* if 1, device isolation is enabled */ 124int amd_iommu_isolate; /* if 1, device isolation is enabled */
125bool amd_iommu_unmap_flush; /* if true, flush on every unmap */
124 126
125LIST_HEAD(amd_iommu_list); /* list of all AMD IOMMUs in the 127LIST_HEAD(amd_iommu_list); /* list of all AMD IOMMUs in the
126 system */ 128 system */
@@ -234,7 +236,7 @@ static void __init iommu_feature_disable(struct amd_iommu *iommu, u8 bit)
234{ 236{
235 u32 ctrl; 237 u32 ctrl;
236 238
237 ctrl = (u64)readl(iommu->mmio_base + MMIO_CONTROL_OFFSET); 239 ctrl = readl(iommu->mmio_base + MMIO_CONTROL_OFFSET);
238 ctrl &= ~(1 << bit); 240 ctrl &= ~(1 << bit);
239 writel(ctrl, iommu->mmio_base + MMIO_CONTROL_OFFSET); 241 writel(ctrl, iommu->mmio_base + MMIO_CONTROL_OFFSET);
240} 242}
@@ -242,13 +244,23 @@ static void __init iommu_feature_disable(struct amd_iommu *iommu, u8 bit)
242/* Function to enable the hardware */ 244/* Function to enable the hardware */
243void __init iommu_enable(struct amd_iommu *iommu) 245void __init iommu_enable(struct amd_iommu *iommu)
244{ 246{
245 printk(KERN_INFO "AMD IOMMU: Enabling IOMMU at "); 247 printk(KERN_INFO "AMD IOMMU: Enabling IOMMU "
246 print_devid(iommu->devid, 0); 248 "at %02x:%02x.%x cap 0x%hx\n",
247 printk(" cap 0x%hx\n", iommu->cap_ptr); 249 iommu->dev->bus->number,
250 PCI_SLOT(iommu->dev->devfn),
251 PCI_FUNC(iommu->dev->devfn),
252 iommu->cap_ptr);
248 253
249 iommu_feature_enable(iommu, CONTROL_IOMMU_EN); 254 iommu_feature_enable(iommu, CONTROL_IOMMU_EN);
250} 255}
251 256
257/* Function to enable IOMMU event logging and event interrupts */
258void __init iommu_enable_event_logging(struct amd_iommu *iommu)
259{
260 iommu_feature_enable(iommu, CONTROL_EVT_LOG_EN);
261 iommu_feature_enable(iommu, CONTROL_EVT_INT_EN);
262}
263
252/* 264/*
253 * mapping and unmapping functions for the IOMMU MMIO space. Each AMD IOMMU in 265 * mapping and unmapping functions for the IOMMU MMIO space. Each AMD IOMMU in
254 * the system has one. 266 * the system has one.
@@ -286,6 +298,14 @@ static void __init iommu_unmap_mmio_space(struct amd_iommu *iommu)
286 ****************************************************************************/ 298 ****************************************************************************/
287 299
288/* 300/*
301 * This function calculates the length of a given IVHD entry
302 */
303static inline int ivhd_entry_length(u8 *ivhd)
304{
305 return 0x04 << (*ivhd >> 6);
306}
307
308/*
289 * This function reads the last device id the IOMMU has to handle from the PCI 309 * This function reads the last device id the IOMMU has to handle from the PCI
290 * capability header for this IOMMU 310 * capability header for this IOMMU
291 */ 311 */
@@ -329,7 +349,7 @@ static int __init find_last_devid_from_ivhd(struct ivhd_header *h)
329 default: 349 default:
330 break; 350 break;
331 } 351 }
332 p += 0x04 << (*p >> 6); 352 p += ivhd_entry_length(p);
333 } 353 }
334 354
335 WARN_ON(p != end); 355 WARN_ON(p != end);
@@ -414,7 +434,32 @@ static u8 * __init alloc_command_buffer(struct amd_iommu *iommu)
414 434
415static void __init free_command_buffer(struct amd_iommu *iommu) 435static void __init free_command_buffer(struct amd_iommu *iommu)
416{ 436{
417 free_pages((unsigned long)iommu->cmd_buf, get_order(CMD_BUFFER_SIZE)); 437 free_pages((unsigned long)iommu->cmd_buf,
438 get_order(iommu->cmd_buf_size));
439}
440
441/* allocates the memory where the IOMMU will log its events to */
442static u8 * __init alloc_event_buffer(struct amd_iommu *iommu)
443{
444 u64 entry;
445 iommu->evt_buf = (u8 *)__get_free_pages(GFP_KERNEL | __GFP_ZERO,
446 get_order(EVT_BUFFER_SIZE));
447
448 if (iommu->evt_buf == NULL)
449 return NULL;
450
451 entry = (u64)virt_to_phys(iommu->evt_buf) | EVT_LEN_MASK;
452 memcpy_toio(iommu->mmio_base + MMIO_EVT_BUF_OFFSET,
453 &entry, sizeof(entry));
454
455 iommu->evt_buf_size = EVT_BUFFER_SIZE;
456
457 return iommu->evt_buf;
458}
459
460static void __init free_event_buffer(struct amd_iommu *iommu)
461{
462 free_pages((unsigned long)iommu->evt_buf, get_order(EVT_BUFFER_SIZE));
418} 463}
419 464
420/* sets a specific bit in the device table entry. */ 465/* sets a specific bit in the device table entry. */
@@ -487,19 +532,21 @@ static void __init set_device_exclusion_range(u16 devid, struct ivmd_header *m)
487 */ 532 */
488static void __init init_iommu_from_pci(struct amd_iommu *iommu) 533static void __init init_iommu_from_pci(struct amd_iommu *iommu)
489{ 534{
490 int bus = PCI_BUS(iommu->devid);
491 int dev = PCI_SLOT(iommu->devid);
492 int fn = PCI_FUNC(iommu->devid);
493 int cap_ptr = iommu->cap_ptr; 535 int cap_ptr = iommu->cap_ptr;
494 u32 range; 536 u32 range, misc;
495 537
496 iommu->cap = read_pci_config(bus, dev, fn, cap_ptr+MMIO_CAP_HDR_OFFSET); 538 pci_read_config_dword(iommu->dev, cap_ptr + MMIO_CAP_HDR_OFFSET,
539 &iommu->cap);
540 pci_read_config_dword(iommu->dev, cap_ptr + MMIO_RANGE_OFFSET,
541 &range);
542 pci_read_config_dword(iommu->dev, cap_ptr + MMIO_MISC_OFFSET,
543 &misc);
497 544
498 range = read_pci_config(bus, dev, fn, cap_ptr+MMIO_RANGE_OFFSET);
499 iommu->first_device = calc_devid(MMIO_GET_BUS(range), 545 iommu->first_device = calc_devid(MMIO_GET_BUS(range),
500 MMIO_GET_FD(range)); 546 MMIO_GET_FD(range));
501 iommu->last_device = calc_devid(MMIO_GET_BUS(range), 547 iommu->last_device = calc_devid(MMIO_GET_BUS(range),
502 MMIO_GET_LD(range)); 548 MMIO_GET_LD(range));
549 iommu->evt_msi_num = MMIO_MSI_NUM(misc);
503} 550}
504 551
505/* 552/*
@@ -604,7 +651,7 @@ static void __init init_iommu_from_acpi(struct amd_iommu *iommu,
604 break; 651 break;
605 } 652 }
606 653
607 p += 0x04 << (e->type >> 6); 654 p += ivhd_entry_length(p);
608 } 655 }
609} 656}
610 657
@@ -622,6 +669,7 @@ static int __init init_iommu_devices(struct amd_iommu *iommu)
622static void __init free_iommu_one(struct amd_iommu *iommu) 669static void __init free_iommu_one(struct amd_iommu *iommu)
623{ 670{
624 free_command_buffer(iommu); 671 free_command_buffer(iommu);
672 free_event_buffer(iommu);
625 iommu_unmap_mmio_space(iommu); 673 iommu_unmap_mmio_space(iommu);
626} 674}
627 675
@@ -649,8 +697,12 @@ static int __init init_iommu_one(struct amd_iommu *iommu, struct ivhd_header *h)
649 /* 697 /*
650 * Copy data from ACPI table entry to the iommu struct 698 * Copy data from ACPI table entry to the iommu struct
651 */ 699 */
652 iommu->devid = h->devid; 700 iommu->dev = pci_get_bus_and_slot(PCI_BUS(h->devid), h->devid & 0xff);
701 if (!iommu->dev)
702 return 1;
703
653 iommu->cap_ptr = h->cap_ptr; 704 iommu->cap_ptr = h->cap_ptr;
705 iommu->pci_seg = h->pci_seg;
654 iommu->mmio_phys = h->mmio_phys; 706 iommu->mmio_phys = h->mmio_phys;
655 iommu->mmio_base = iommu_map_mmio_space(h->mmio_phys); 707 iommu->mmio_base = iommu_map_mmio_space(h->mmio_phys);
656 if (!iommu->mmio_base) 708 if (!iommu->mmio_base)
@@ -661,10 +713,18 @@ static int __init init_iommu_one(struct amd_iommu *iommu, struct ivhd_header *h)
661 if (!iommu->cmd_buf) 713 if (!iommu->cmd_buf)
662 return -ENOMEM; 714 return -ENOMEM;
663 715
716 iommu->evt_buf = alloc_event_buffer(iommu);
717 if (!iommu->evt_buf)
718 return -ENOMEM;
719
720 iommu->int_enabled = false;
721
664 init_iommu_from_pci(iommu); 722 init_iommu_from_pci(iommu);
665 init_iommu_from_acpi(iommu, h); 723 init_iommu_from_acpi(iommu, h);
666 init_iommu_devices(iommu); 724 init_iommu_devices(iommu);
667 725
726 pci_enable_device(iommu->dev);
727
668 return 0; 728 return 0;
669} 729}
670 730
@@ -706,6 +766,95 @@ static int __init init_iommu_all(struct acpi_table_header *table)
706 766
707/**************************************************************************** 767/****************************************************************************
708 * 768 *
769 * The following functions initialize the MSI interrupts for all IOMMUs
770 * in the system. Its a bit challenging because there could be multiple
771 * IOMMUs per PCI BDF but we can call pci_enable_msi(x) only once per
772 * pci_dev.
773 *
774 ****************************************************************************/
775
776static int __init iommu_setup_msix(struct amd_iommu *iommu)
777{
778 struct amd_iommu *curr;
779 struct msix_entry entries[32]; /* only 32 supported by AMD IOMMU */
780 int nvec = 0, i;
781
782 list_for_each_entry(curr, &amd_iommu_list, list) {
783 if (curr->dev == iommu->dev) {
784 entries[nvec].entry = curr->evt_msi_num;
785 entries[nvec].vector = 0;
786 curr->int_enabled = true;
787 nvec++;
788 }
789 }
790
791 if (pci_enable_msix(iommu->dev, entries, nvec)) {
792 pci_disable_msix(iommu->dev);
793 return 1;
794 }
795
796 for (i = 0; i < nvec; ++i) {
797 int r = request_irq(entries->vector, amd_iommu_int_handler,
798 IRQF_SAMPLE_RANDOM,
799 "AMD IOMMU",
800 NULL);
801 if (r)
802 goto out_free;
803 }
804
805 return 0;
806
807out_free:
808 for (i -= 1; i >= 0; --i)
809 free_irq(entries->vector, NULL);
810
811 pci_disable_msix(iommu->dev);
812
813 return 1;
814}
815
816static int __init iommu_setup_msi(struct amd_iommu *iommu)
817{
818 int r;
819 struct amd_iommu *curr;
820
821 list_for_each_entry(curr, &amd_iommu_list, list) {
822 if (curr->dev == iommu->dev)
823 curr->int_enabled = true;
824 }
825
826
827 if (pci_enable_msi(iommu->dev))
828 return 1;
829
830 r = request_irq(iommu->dev->irq, amd_iommu_int_handler,
831 IRQF_SAMPLE_RANDOM,
832 "AMD IOMMU",
833 NULL);
834
835 if (r) {
836 pci_disable_msi(iommu->dev);
837 return 1;
838 }
839
840 return 0;
841}
842
843static int __init iommu_init_msi(struct amd_iommu *iommu)
844{
845 if (iommu->int_enabled)
846 return 0;
847
848 if (pci_find_capability(iommu->dev, PCI_CAP_ID_MSIX))
849 return iommu_setup_msix(iommu);
850 else if (pci_find_capability(iommu->dev, PCI_CAP_ID_MSI))
851 return iommu_setup_msi(iommu);
852
853 return 1;
854}
855
856/****************************************************************************
857 *
709 * The next functions belong to the third pass of parsing the ACPI 858 * The next functions belong to the third pass of parsing the ACPI
710 * table. In this last pass the memory mapping requirements are 859 * table. In this last pass the memory mapping requirements are
711 * gathered (like exclusion and unity mapping reanges). 860 * gathered (like exclusion and unity mapping reanges).
@@ -811,7 +960,6 @@ static void init_device_table(void)
811 for (devid = 0; devid <= amd_iommu_last_bdf; ++devid) { 960 for (devid = 0; devid <= amd_iommu_last_bdf; ++devid) {
812 set_dev_entry_bit(devid, DEV_ENTRY_VALID); 961 set_dev_entry_bit(devid, DEV_ENTRY_VALID);
813 set_dev_entry_bit(devid, DEV_ENTRY_TRANSLATION); 962 set_dev_entry_bit(devid, DEV_ENTRY_TRANSLATION);
814 set_dev_entry_bit(devid, DEV_ENTRY_NO_PAGE_FAULT);
815 } 963 }
816} 964}
817 965
@@ -825,6 +973,8 @@ static void __init enable_iommus(void)
825 973
826 list_for_each_entry(iommu, &amd_iommu_list, list) { 974 list_for_each_entry(iommu, &amd_iommu_list, list) {
827 iommu_set_exclusion_range(iommu); 975 iommu_set_exclusion_range(iommu);
976 iommu_init_msi(iommu);
977 iommu_enable_event_logging(iommu);
828 iommu_enable(iommu); 978 iommu_enable(iommu);
829 } 979 }
830} 980}
@@ -995,11 +1145,17 @@ int __init amd_iommu_init(void)
995 else 1145 else
996 printk("disabled\n"); 1146 printk("disabled\n");
997 1147
1148 if (amd_iommu_unmap_flush)
1149 printk(KERN_INFO "AMD IOMMU: IO/TLB flush on unmap enabled\n");
1150 else
1151 printk(KERN_INFO "AMD IOMMU: Lazy IO/TLB flushing enabled\n");
1152
998out: 1153out:
999 return ret; 1154 return ret;
1000 1155
1001free: 1156free:
1002 free_pages((unsigned long)amd_iommu_pd_alloc_bitmap, 1); 1157 free_pages((unsigned long)amd_iommu_pd_alloc_bitmap,
1158 get_order(MAX_DOMAIN_ID/8));
1003 1159
1004 free_pages((unsigned long)amd_iommu_pd_table, 1160 free_pages((unsigned long)amd_iommu_pd_table,
1005 get_order(rlookup_table_size)); 1161 get_order(rlookup_table_size));
@@ -1057,8 +1213,10 @@ void __init amd_iommu_detect(void)
1057static int __init parse_amd_iommu_options(char *str) 1213static int __init parse_amd_iommu_options(char *str)
1058{ 1214{
1059 for (; *str; ++str) { 1215 for (; *str; ++str) {
1060 if (strcmp(str, "isolate") == 0) 1216 if (strncmp(str, "isolate", 7) == 0)
1061 amd_iommu_isolate = 1; 1217 amd_iommu_isolate = 1;
1218 if (strncmp(str, "fullflush", 11) == 0)
1219 amd_iommu_unmap_flush = true;
1062 } 1220 }
1063 1221
1064 return 1; 1222 return 1;
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
index 44e21826db11..9a32b37ee2ee 100644
--- a/arch/x86/kernel/aperture_64.c
+++ b/arch/x86/kernel/aperture_64.c
@@ -455,11 +455,11 @@ out:
455 force_iommu || 455 force_iommu ||
456 valid_agp || 456 valid_agp ||
457 fallback_aper_force) { 457 fallback_aper_force) {
458 printk(KERN_ERR 458 printk(KERN_INFO
459 "Your BIOS doesn't leave a aperture memory hole\n"); 459 "Your BIOS doesn't leave a aperture memory hole\n");
460 printk(KERN_ERR 460 printk(KERN_INFO
461 "Please enable the IOMMU option in the BIOS setup\n"); 461 "Please enable the IOMMU option in the BIOS setup\n");
462 printk(KERN_ERR 462 printk(KERN_INFO
463 "This costs you %d MB of RAM\n", 463 "This costs you %d MB of RAM\n",
464 32 << fallback_aper_order); 464 32 << fallback_aper_order);
465 465
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index 584272105051..a91c57cb666a 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -60,10 +60,8 @@ unsigned long mp_lapic_addr;
60static int force_enable_local_apic; 60static int force_enable_local_apic;
61int disable_apic; 61int disable_apic;
62 62
63/* Local APIC timer verification ok */
64static int local_apic_timer_verify_ok;
65/* Disable local APIC timer from the kernel commandline or via dmi quirk */ 63/* Disable local APIC timer from the kernel commandline or via dmi quirk */
66static int local_apic_timer_disabled; 64static int disable_apic_timer __cpuinitdata;
67/* Local APIC timer works in C2 */ 65/* Local APIC timer works in C2 */
68int local_apic_timer_c2_ok; 66int local_apic_timer_c2_ok;
69EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok); 67EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok);
@@ -130,7 +128,11 @@ static inline int lapic_get_version(void)
130 */ 128 */
131static inline int lapic_is_integrated(void) 129static inline int lapic_is_integrated(void)
132{ 130{
131#ifdef CONFIG_X86_64
132 return 1;
133#else
133 return APIC_INTEGRATED(lapic_get_version()); 134 return APIC_INTEGRATED(lapic_get_version());
135#endif
134} 136}
135 137
136/* 138/*
@@ -244,8 +246,12 @@ int lapic_get_maxlvt(void)
244 * Local APIC timer 246 * Local APIC timer
245 */ 247 */
246 248
247/* Clock divisor is set to 16 */ 249/* Clock divisor */
250#ifdef CONFG_X86_64
251#define APIC_DIVISOR 1
252#else
248#define APIC_DIVISOR 16 253#define APIC_DIVISOR 16
254#endif
249 255
250/* 256/*
251 * This function sets up the local APIC timer, with a timeout of 257 * This function sets up the local APIC timer, with a timeout of
@@ -253,6 +259,9 @@ int lapic_get_maxlvt(void)
253 * this function twice on the boot CPU, once with a bogus timeout 259 * this function twice on the boot CPU, once with a bogus timeout
254 * value, second time for real. The other (noncalibrating) CPUs 260 * value, second time for real. The other (noncalibrating) CPUs
255 * call this function only once, with the real, calibrated value. 261 * call this function only once, with the real, calibrated value.
262 *
263 * We do reads before writes even if unnecessary, to get around the
264 * P5 APIC double write bug.
256 */ 265 */
257static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen) 266static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen)
258{ 267{
@@ -274,14 +283,44 @@ static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen)
274 */ 283 */
275 tmp_value = apic_read(APIC_TDCR); 284 tmp_value = apic_read(APIC_TDCR);
276 apic_write(APIC_TDCR, 285 apic_write(APIC_TDCR,
277 (tmp_value & ~(APIC_TDR_DIV_1 | APIC_TDR_DIV_TMBASE)) | 286 (tmp_value & ~(APIC_TDR_DIV_1 | APIC_TDR_DIV_TMBASE)) |
278 APIC_TDR_DIV_16); 287 APIC_TDR_DIV_16);
279 288
280 if (!oneshot) 289 if (!oneshot)
281 apic_write(APIC_TMICT, clocks / APIC_DIVISOR); 290 apic_write(APIC_TMICT, clocks / APIC_DIVISOR);
282} 291}
283 292
284/* 293/*
294 * Setup extended LVT, AMD specific (K8, family 10h)
295 *
296 * Vector mappings are hard coded. On K8 only offset 0 (APIC500) and
297 * MCE interrupts are supported. Thus MCE offset must be set to 0.
298 */
299
300#define APIC_EILVT_LVTOFF_MCE 0
301#define APIC_EILVT_LVTOFF_IBS 1
302
303static void setup_APIC_eilvt(u8 lvt_off, u8 vector, u8 msg_type, u8 mask)
304{
305 unsigned long reg = (lvt_off << 4) + APIC_EILVT0;
306 unsigned int v = (mask << 16) | (msg_type << 8) | vector;
307
308 apic_write(reg, v);
309}
310
311u8 setup_APIC_eilvt_mce(u8 vector, u8 msg_type, u8 mask)
312{
313 setup_APIC_eilvt(APIC_EILVT_LVTOFF_MCE, vector, msg_type, mask);
314 return APIC_EILVT_LVTOFF_MCE;
315}
316
317u8 setup_APIC_eilvt_ibs(u8 vector, u8 msg_type, u8 mask)
318{
319 setup_APIC_eilvt(APIC_EILVT_LVTOFF_IBS, vector, msg_type, mask);
320 return APIC_EILVT_LVTOFF_IBS;
321}
322
323/*
285 * Program the next event, relative to now 324 * Program the next event, relative to now
286 */ 325 */
287static int lapic_next_event(unsigned long delta, 326static int lapic_next_event(unsigned long delta,
@@ -300,8 +339,8 @@ static void lapic_timer_setup(enum clock_event_mode mode,
300 unsigned long flags; 339 unsigned long flags;
301 unsigned int v; 340 unsigned int v;
302 341
303 /* Lapic used for broadcast ? */ 342 /* Lapic used as dummy for broadcast ? */
304 if (!local_apic_timer_verify_ok) 343 if (evt->features & CLOCK_EVT_FEAT_DUMMY)
305 return; 344 return;
306 345
307 local_irq_save(flags); 346 local_irq_save(flags);
@@ -514,7 +553,7 @@ static int __init calibrate_APIC_clock(void)
514 return -1; 553 return -1;
515 } 554 }
516 555
517 local_apic_timer_verify_ok = 1; 556 levt->features &= ~CLOCK_EVT_FEAT_DUMMY;
518 557
519 /* We trust the pm timer based calibration */ 558 /* We trust the pm timer based calibration */
520 if (!pm_referenced) { 559 if (!pm_referenced) {
@@ -548,11 +587,11 @@ static int __init calibrate_APIC_clock(void)
548 if (deltaj >= LAPIC_CAL_LOOPS-2 && deltaj <= LAPIC_CAL_LOOPS+2) 587 if (deltaj >= LAPIC_CAL_LOOPS-2 && deltaj <= LAPIC_CAL_LOOPS+2)
549 apic_printk(APIC_VERBOSE, "... jiffies result ok\n"); 588 apic_printk(APIC_VERBOSE, "... jiffies result ok\n");
550 else 589 else
551 local_apic_timer_verify_ok = 0; 590 levt->features |= CLOCK_EVT_FEAT_DUMMY;
552 } else 591 } else
553 local_irq_enable(); 592 local_irq_enable();
554 593
555 if (!local_apic_timer_verify_ok) { 594 if (levt->features & CLOCK_EVT_FEAT_DUMMY) {
556 printk(KERN_WARNING 595 printk(KERN_WARNING
557 "APIC timer disabled due to verification failure.\n"); 596 "APIC timer disabled due to verification failure.\n");
558 return -1; 597 return -1;
@@ -574,7 +613,8 @@ void __init setup_boot_APIC_clock(void)
574 * timer as a dummy clock event source on SMP systems, so the 613 * timer as a dummy clock event source on SMP systems, so the
575 * broadcast mechanism is used. On UP systems simply ignore it. 614 * broadcast mechanism is used. On UP systems simply ignore it.
576 */ 615 */
577 if (local_apic_timer_disabled) { 616 if (disable_apic_timer) {
617 printk(KERN_INFO "Disabling APIC timer\n");
578 /* No broadcast on UP ! */ 618 /* No broadcast on UP ! */
579 if (num_possible_cpus() > 1) { 619 if (num_possible_cpus() > 1) {
580 lapic_clockevent.mult = 1; 620 lapic_clockevent.mult = 1;
@@ -643,7 +683,11 @@ static void local_apic_timer_interrupt(void)
643 /* 683 /*
644 * the NMI deadlock-detector uses this. 684 * the NMI deadlock-detector uses this.
645 */ 685 */
686#ifdef CONFIG_X86_64
687 add_pda(apic_timer_irqs, 1);
688#else
646 per_cpu(irq_stat, cpu).apic_timer_irqs++; 689 per_cpu(irq_stat, cpu).apic_timer_irqs++;
690#endif
647 691
648 evt->event_handler(evt); 692 evt->event_handler(evt);
649} 693}
@@ -683,35 +727,6 @@ int setup_profiling_timer(unsigned int multiplier)
683} 727}
684 728
685/* 729/*
686 * Setup extended LVT, AMD specific (K8, family 10h)
687 *
688 * Vector mappings are hard coded. On K8 only offset 0 (APIC500) and
689 * MCE interrupts are supported. Thus MCE offset must be set to 0.
690 */
691
692#define APIC_EILVT_LVTOFF_MCE 0
693#define APIC_EILVT_LVTOFF_IBS 1
694
695static void setup_APIC_eilvt(u8 lvt_off, u8 vector, u8 msg_type, u8 mask)
696{
697 unsigned long reg = (lvt_off << 4) + APIC_EILVT0;
698 unsigned int v = (mask << 16) | (msg_type << 8) | vector;
699 apic_write(reg, v);
700}
701
702u8 setup_APIC_eilvt_mce(u8 vector, u8 msg_type, u8 mask)
703{
704 setup_APIC_eilvt(APIC_EILVT_LVTOFF_MCE, vector, msg_type, mask);
705 return APIC_EILVT_LVTOFF_MCE;
706}
707
708u8 setup_APIC_eilvt_ibs(u8 vector, u8 msg_type, u8 mask)
709{
710 setup_APIC_eilvt(APIC_EILVT_LVTOFF_IBS, vector, msg_type, mask);
711 return APIC_EILVT_LVTOFF_IBS;
712}
713
714/*
715 * Local APIC start and shutdown 730 * Local APIC start and shutdown
716 */ 731 */
717 732
@@ -756,7 +771,7 @@ void clear_local_APIC(void)
756 } 771 }
757 772
758 /* lets not touch this if we didn't frob it */ 773 /* lets not touch this if we didn't frob it */
759#ifdef CONFIG_X86_MCE_P4THERMAL 774#if defined(CONFIG_X86_MCE_P4THERMAL) || defined(X86_MCE_INTEL)
760 if (maxlvt >= 5) { 775 if (maxlvt >= 5) {
761 v = apic_read(APIC_LVTTHMR); 776 v = apic_read(APIC_LVTTHMR);
762 apic_write(APIC_LVTTHMR, v | APIC_LVT_MASKED); 777 apic_write(APIC_LVTTHMR, v | APIC_LVT_MASKED);
@@ -773,10 +788,6 @@ void clear_local_APIC(void)
773 if (maxlvt >= 4) 788 if (maxlvt >= 4)
774 apic_write(APIC_LVTPC, APIC_LVT_MASKED); 789 apic_write(APIC_LVTPC, APIC_LVT_MASKED);
775 790
776#ifdef CONFIG_X86_MCE_P4THERMAL
777 if (maxlvt >= 5)
778 apic_write(APIC_LVTTHMR, APIC_LVT_MASKED);
779#endif
780 /* Integrated APIC (!82489DX) ? */ 791 /* Integrated APIC (!82489DX) ? */
781 if (lapic_is_integrated()) { 792 if (lapic_is_integrated()) {
782 if (maxlvt > 3) 793 if (maxlvt > 3)
@@ -791,7 +802,7 @@ void clear_local_APIC(void)
791 */ 802 */
792void disable_local_APIC(void) 803void disable_local_APIC(void)
793{ 804{
794 unsigned long value; 805 unsigned int value;
795 806
796 clear_local_APIC(); 807 clear_local_APIC();
797 808
@@ -803,6 +814,7 @@ void disable_local_APIC(void)
803 value &= ~APIC_SPIV_APIC_ENABLED; 814 value &= ~APIC_SPIV_APIC_ENABLED;
804 apic_write(APIC_SPIV, value); 815 apic_write(APIC_SPIV, value);
805 816
817#ifdef CONFIG_X86_32
806 /* 818 /*
807 * When LAPIC was disabled by the BIOS and enabled by the kernel, 819 * When LAPIC was disabled by the BIOS and enabled by the kernel,
808 * restore the disabled state. 820 * restore the disabled state.
@@ -814,6 +826,7 @@ void disable_local_APIC(void)
814 l &= ~MSR_IA32_APICBASE_ENABLE; 826 l &= ~MSR_IA32_APICBASE_ENABLE;
815 wrmsr(MSR_IA32_APICBASE, l, h); 827 wrmsr(MSR_IA32_APICBASE, l, h);
816 } 828 }
829#endif
817} 830}
818 831
819/* 832/*
@@ -830,11 +843,15 @@ void lapic_shutdown(void)
830 return; 843 return;
831 844
832 local_irq_save(flags); 845 local_irq_save(flags);
833 clear_local_APIC();
834 846
835 if (enabled_via_apicbase) 847#ifdef CONFIG_X86_32
848 if (!enabled_via_apicbase)
849 clear_local_APIC();
850 else
851#endif
836 disable_local_APIC(); 852 disable_local_APIC();
837 853
854
838 local_irq_restore(flags); 855 local_irq_restore(flags);
839} 856}
840 857
@@ -879,6 +896,12 @@ int __init verify_local_APIC(void)
879 */ 896 */
880 reg0 = apic_read(APIC_ID); 897 reg0 = apic_read(APIC_ID);
881 apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg0); 898 apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg0);
899 apic_write(APIC_ID, reg0 ^ APIC_ID_MASK);
900 reg1 = apic_read(APIC_ID);
901 apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg1);
902 apic_write(APIC_ID, reg0);
903 if (reg1 != (reg0 ^ APIC_ID_MASK))
904 return 0;
882 905
883 /* 906 /*
884 * The next two are just to see if we have sane values. 907 * The next two are just to see if we have sane values.
@@ -904,14 +927,15 @@ void __init sync_Arb_IDs(void)
904 */ 927 */
905 if (modern_apic() || boot_cpu_data.x86_vendor == X86_VENDOR_AMD) 928 if (modern_apic() || boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
906 return; 929 return;
930
907 /* 931 /*
908 * Wait for idle. 932 * Wait for idle.
909 */ 933 */
910 apic_wait_icr_idle(); 934 apic_wait_icr_idle();
911 935
912 apic_printk(APIC_DEBUG, "Synchronizing Arb IDs.\n"); 936 apic_printk(APIC_DEBUG, "Synchronizing Arb IDs.\n");
913 apic_write(APIC_ICR, 937 apic_write(APIC_ICR, APIC_DEST_ALLINC |
914 APIC_DEST_ALLINC | APIC_INT_LEVELTRIG | APIC_DM_INIT); 938 APIC_INT_LEVELTRIG | APIC_DM_INIT);
915} 939}
916 940
917/* 941/*
@@ -919,7 +943,7 @@ void __init sync_Arb_IDs(void)
919 */ 943 */
920void __init init_bsp_APIC(void) 944void __init init_bsp_APIC(void)
921{ 945{
922 unsigned long value; 946 unsigned int value;
923 947
924 /* 948 /*
925 * Don't do the setup now if we have a SMP BIOS as the 949 * Don't do the setup now if we have a SMP BIOS as the
@@ -940,11 +964,13 @@ void __init init_bsp_APIC(void)
940 value &= ~APIC_VECTOR_MASK; 964 value &= ~APIC_VECTOR_MASK;
941 value |= APIC_SPIV_APIC_ENABLED; 965 value |= APIC_SPIV_APIC_ENABLED;
942 966
967#ifdef CONFIG_X86_32
943 /* This bit is reserved on P4/Xeon and should be cleared */ 968 /* This bit is reserved on P4/Xeon and should be cleared */
944 if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && 969 if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) &&
945 (boot_cpu_data.x86 == 15)) 970 (boot_cpu_data.x86 == 15))
946 value &= ~APIC_SPIV_FOCUS_DISABLED; 971 value &= ~APIC_SPIV_FOCUS_DISABLED;
947 else 972 else
973#endif
948 value |= APIC_SPIV_FOCUS_DISABLED; 974 value |= APIC_SPIV_FOCUS_DISABLED;
949 value |= SPURIOUS_APIC_VECTOR; 975 value |= SPURIOUS_APIC_VECTOR;
950 apic_write(APIC_SPIV, value); 976 apic_write(APIC_SPIV, value);
@@ -963,6 +989,16 @@ static void __cpuinit lapic_setup_esr(void)
963{ 989{
964 unsigned long oldvalue, value, maxlvt; 990 unsigned long oldvalue, value, maxlvt;
965 if (lapic_is_integrated() && !esr_disable) { 991 if (lapic_is_integrated() && !esr_disable) {
992 if (esr_disable) {
993 /*
994 * Something untraceable is creating bad interrupts on
995 * secondary quads ... for the moment, just leave the
996 * ESR disabled - we can't do anything useful with the
997 * errors anyway - mbligh
998 */
999 printk(KERN_INFO "Leaving ESR disabled.\n");
1000 return;
1001 }
966 /* !82489DX */ 1002 /* !82489DX */
967 maxlvt = lapic_get_maxlvt(); 1003 maxlvt = lapic_get_maxlvt();
968 if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */ 1004 if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */
@@ -983,16 +1019,7 @@ static void __cpuinit lapic_setup_esr(void)
983 "vector: 0x%08lx after: 0x%08lx\n", 1019 "vector: 0x%08lx after: 0x%08lx\n",
984 oldvalue, value); 1020 oldvalue, value);
985 } else { 1021 } else {
986 if (esr_disable) 1022 printk(KERN_INFO "No ESR for 82489DX.\n");
987 /*
988 * Something untraceable is creating bad interrupts on
989 * secondary quads ... for the moment, just leave the
990 * ESR disabled - we can't do anything useful with the
991 * errors anyway - mbligh
992 */
993 printk(KERN_INFO "Leaving ESR disabled.\n");
994 else
995 printk(KERN_INFO "No ESR for 82489DX.\n");
996 } 1023 }
997} 1024}
998 1025
@@ -1130,13 +1157,17 @@ void __cpuinit setup_local_APIC(void)
1130 1157
1131void __cpuinit end_local_APIC_setup(void) 1158void __cpuinit end_local_APIC_setup(void)
1132{ 1159{
1133 unsigned long value;
1134
1135 lapic_setup_esr(); 1160 lapic_setup_esr();
1136 /* Disable the local apic timer */ 1161
1137 value = apic_read(APIC_LVTT); 1162#ifdef CONFIG_X86_32
1138 value |= (APIC_LVT_MASKED | LOCAL_TIMER_VECTOR); 1163 {
1139 apic_write(APIC_LVTT, value); 1164 unsigned int value;
1165 /* Disable the local apic timer */
1166 value = apic_read(APIC_LVTT);
1167 value |= (APIC_LVT_MASKED | LOCAL_TIMER_VECTOR);
1168 apic_write(APIC_LVTT, value);
1169 }
1170#endif
1140 1171
1141 setup_apic_nmi_watchdog(NULL); 1172 setup_apic_nmi_watchdog(NULL);
1142 apic_pm_activate(); 1173 apic_pm_activate();
@@ -1367,6 +1398,7 @@ void smp_error_interrupt(struct pt_regs *regs)
1367 */ 1398 */
1368void __init connect_bsp_APIC(void) 1399void __init connect_bsp_APIC(void)
1369{ 1400{
1401#ifdef CONFIG_X86_32
1370 if (pic_mode) { 1402 if (pic_mode) {
1371 /* 1403 /*
1372 * Do not trust the local APIC being empty at bootup. 1404 * Do not trust the local APIC being empty at bootup.
@@ -1381,6 +1413,7 @@ void __init connect_bsp_APIC(void)
1381 outb(0x70, 0x22); 1413 outb(0x70, 0x22);
1382 outb(0x01, 0x23); 1414 outb(0x01, 0x23);
1383 } 1415 }
1416#endif
1384 enable_apic_mode(); 1417 enable_apic_mode();
1385} 1418}
1386 1419
@@ -1393,6 +1426,9 @@ void __init connect_bsp_APIC(void)
1393 */ 1426 */
1394void disconnect_bsp_APIC(int virt_wire_setup) 1427void disconnect_bsp_APIC(int virt_wire_setup)
1395{ 1428{
1429 unsigned int value;
1430
1431#ifdef CONFIG_X86_32
1396 if (pic_mode) { 1432 if (pic_mode) {
1397 /* 1433 /*
1398 * Put the board back into PIC mode (has an effect only on 1434 * Put the board back into PIC mode (has an effect only on
@@ -1404,54 +1440,53 @@ void disconnect_bsp_APIC(int virt_wire_setup)
1404 "entering PIC mode.\n"); 1440 "entering PIC mode.\n");
1405 outb(0x70, 0x22); 1441 outb(0x70, 0x22);
1406 outb(0x00, 0x23); 1442 outb(0x00, 0x23);
1407 } else { 1443 return;
1408 /* Go back to Virtual Wire compatibility mode */ 1444 }
1409 unsigned long value; 1445#endif
1410 1446
1411 /* For the spurious interrupt use vector F, and enable it */ 1447 /* Go back to Virtual Wire compatibility mode */
1412 value = apic_read(APIC_SPIV);
1413 value &= ~APIC_VECTOR_MASK;
1414 value |= APIC_SPIV_APIC_ENABLED;
1415 value |= 0xf;
1416 apic_write(APIC_SPIV, value);
1417 1448
1418 if (!virt_wire_setup) { 1449 /* For the spurious interrupt use vector F, and enable it */
1419 /* 1450 value = apic_read(APIC_SPIV);
1420 * For LVT0 make it edge triggered, active high, 1451 value &= ~APIC_VECTOR_MASK;
1421 * external and enabled 1452 value |= APIC_SPIV_APIC_ENABLED;
1422 */ 1453 value |= 0xf;
1423 value = apic_read(APIC_LVT0); 1454 apic_write(APIC_SPIV, value);
1424 value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING |
1425 APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR |
1426 APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED);
1427 value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING;
1428 value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_EXTINT);
1429 apic_write(APIC_LVT0, value);
1430 } else {
1431 /* Disable LVT0 */
1432 apic_write(APIC_LVT0, APIC_LVT_MASKED);
1433 }
1434 1455
1456 if (!virt_wire_setup) {
1435 /* 1457 /*
1436 * For LVT1 make it edge triggered, active high, nmi and 1458 * For LVT0 make it edge triggered, active high,
1437 * enabled 1459 * external and enabled
1438 */ 1460 */
1439 value = apic_read(APIC_LVT1); 1461 value = apic_read(APIC_LVT0);
1440 value &= ~( 1462 value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING |
1441 APIC_MODE_MASK | APIC_SEND_PENDING |
1442 APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR | 1463 APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR |
1443 APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED); 1464 APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED);
1444 value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING; 1465 value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING;
1445 value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_NMI); 1466 value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_EXTINT);
1446 apic_write(APIC_LVT1, value); 1467 apic_write(APIC_LVT0, value);
1468 } else {
1469 /* Disable LVT0 */
1470 apic_write(APIC_LVT0, APIC_LVT_MASKED);
1447 } 1471 }
1472
1473 /*
1474 * For LVT1 make it edge triggered, active high,
1475 * nmi and enabled
1476 */
1477 value = apic_read(APIC_LVT1);
1478 value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING |
1479 APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR |
1480 APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED);
1481 value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING;
1482 value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_NMI);
1483 apic_write(APIC_LVT1, value);
1448} 1484}
1449 1485
1450void __cpuinit generic_processor_info(int apicid, int version) 1486void __cpuinit generic_processor_info(int apicid, int version)
1451{ 1487{
1452 int cpu; 1488 int cpu;
1453 cpumask_t tmp_map; 1489 cpumask_t tmp_map;
1454 physid_mask_t phys_cpu;
1455 1490
1456 /* 1491 /*
1457 * Validate version 1492 * Validate version
@@ -1464,9 +1499,6 @@ void __cpuinit generic_processor_info(int apicid, int version)
1464 } 1499 }
1465 apic_version[apicid] = version; 1500 apic_version[apicid] = version;
1466 1501
1467 phys_cpu = apicid_to_cpu_present(apicid);
1468 physids_or(phys_cpu_present_map, phys_cpu_present_map, phys_cpu);
1469
1470 if (num_processors >= NR_CPUS) { 1502 if (num_processors >= NR_CPUS) {
1471 printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached." 1503 printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached."
1472 " Processor ignored.\n", NR_CPUS); 1504 " Processor ignored.\n", NR_CPUS);
@@ -1477,17 +1509,19 @@ void __cpuinit generic_processor_info(int apicid, int version)
1477 cpus_complement(tmp_map, cpu_present_map); 1509 cpus_complement(tmp_map, cpu_present_map);
1478 cpu = first_cpu(tmp_map); 1510 cpu = first_cpu(tmp_map);
1479 1511
1480 if (apicid == boot_cpu_physical_apicid) 1512 physid_set(apicid, phys_cpu_present_map);
1513 if (apicid == boot_cpu_physical_apicid) {
1481 /* 1514 /*
1482 * x86_bios_cpu_apicid is required to have processors listed 1515 * x86_bios_cpu_apicid is required to have processors listed
1483 * in same order as logical cpu numbers. Hence the first 1516 * in same order as logical cpu numbers. Hence the first
1484 * entry is BSP, and so on. 1517 * entry is BSP, and so on.
1485 */ 1518 */
1486 cpu = 0; 1519 cpu = 0;
1487 1520 }
1488 if (apicid > max_physical_apicid) 1521 if (apicid > max_physical_apicid)
1489 max_physical_apicid = apicid; 1522 max_physical_apicid = apicid;
1490 1523
1524#ifdef CONFIG_X86_32
1491 /* 1525 /*
1492 * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y 1526 * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y
1493 * but we need to work other dependencies like SMP_SUSPEND etc 1527 * but we need to work other dependencies like SMP_SUSPEND etc
@@ -1507,7 +1541,9 @@ void __cpuinit generic_processor_info(int apicid, int version)
1507 def_to_bigsmp = 1; 1541 def_to_bigsmp = 1;
1508 } 1542 }
1509 } 1543 }
1510#ifdef CONFIG_SMP 1544#endif
1545
1546#if defined(CONFIG_X86_SMP) || defined(CONFIG_X86_64)
1511 /* are we being called early in kernel startup? */ 1547 /* are we being called early in kernel startup? */
1512 if (early_per_cpu_ptr(x86_cpu_to_apicid)) { 1548 if (early_per_cpu_ptr(x86_cpu_to_apicid)) {
1513 u16 *cpu_to_apicid = early_per_cpu_ptr(x86_cpu_to_apicid); 1549 u16 *cpu_to_apicid = early_per_cpu_ptr(x86_cpu_to_apicid);
@@ -1520,6 +1556,7 @@ void __cpuinit generic_processor_info(int apicid, int version)
1520 per_cpu(x86_bios_cpu_apicid, cpu) = apicid; 1556 per_cpu(x86_bios_cpu_apicid, cpu) = apicid;
1521 } 1557 }
1522#endif 1558#endif
1559
1523 cpu_set(cpu, cpu_possible_map); 1560 cpu_set(cpu, cpu_possible_map);
1524 cpu_set(cpu, cpu_present_map); 1561 cpu_set(cpu, cpu_present_map);
1525} 1562}
@@ -1530,6 +1567,11 @@ void __cpuinit generic_processor_info(int apicid, int version)
1530#ifdef CONFIG_PM 1567#ifdef CONFIG_PM
1531 1568
1532static struct { 1569static struct {
1570 /*
1571 * 'active' is true if the local APIC was enabled by us and
1572 * not the BIOS; this signifies that we are also responsible
1573 * for disabling it before entering apm/acpi suspend
1574 */
1533 int active; 1575 int active;
1534 /* r/w apic fields */ 1576 /* r/w apic fields */
1535 unsigned int apic_id; 1577 unsigned int apic_id;
@@ -1570,7 +1612,7 @@ static int lapic_suspend(struct sys_device *dev, pm_message_t state)
1570 apic_pm_state.apic_lvterr = apic_read(APIC_LVTERR); 1612 apic_pm_state.apic_lvterr = apic_read(APIC_LVTERR);
1571 apic_pm_state.apic_tmict = apic_read(APIC_TMICT); 1613 apic_pm_state.apic_tmict = apic_read(APIC_TMICT);
1572 apic_pm_state.apic_tdcr = apic_read(APIC_TDCR); 1614 apic_pm_state.apic_tdcr = apic_read(APIC_TDCR);
1573#ifdef CONFIG_X86_MCE_P4THERMAL 1615#if defined(CONFIG_X86_MCE_P4THERMAL) || defined(CONFIG_X86_MCE_INTEL)
1574 if (maxlvt >= 5) 1616 if (maxlvt >= 5)
1575 apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR); 1617 apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR);
1576#endif 1618#endif
@@ -1594,16 +1636,23 @@ static int lapic_resume(struct sys_device *dev)
1594 1636
1595 local_irq_save(flags); 1637 local_irq_save(flags);
1596 1638
1597 /* 1639#ifdef CONFIG_X86_64
1598 * Make sure the APICBASE points to the right address 1640 if (x2apic)
1599 * 1641 enable_x2apic();
1600 * FIXME! This will be wrong if we ever support suspend on 1642 else
1601 * SMP! We'll need to do this as part of the CPU restore! 1643#endif
1602 */ 1644 {
1603 rdmsr(MSR_IA32_APICBASE, l, h); 1645 /*
1604 l &= ~MSR_IA32_APICBASE_BASE; 1646 * Make sure the APICBASE points to the right address
1605 l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr; 1647 *
1606 wrmsr(MSR_IA32_APICBASE, l, h); 1648 * FIXME! This will be wrong if we ever support suspend on
1649 * SMP! We'll need to do this as part of the CPU restore!
1650 */
1651 rdmsr(MSR_IA32_APICBASE, l, h);
1652 l &= ~MSR_IA32_APICBASE_BASE;
1653 l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr;
1654 wrmsr(MSR_IA32_APICBASE, l, h);
1655 }
1607 1656
1608 apic_write(APIC_LVTERR, ERROR_APIC_VECTOR | APIC_LVT_MASKED); 1657 apic_write(APIC_LVTERR, ERROR_APIC_VECTOR | APIC_LVT_MASKED);
1609 apic_write(APIC_ID, apic_pm_state.apic_id); 1658 apic_write(APIC_ID, apic_pm_state.apic_id);
@@ -1613,7 +1662,7 @@ static int lapic_resume(struct sys_device *dev)
1613 apic_write(APIC_SPIV, apic_pm_state.apic_spiv); 1662 apic_write(APIC_SPIV, apic_pm_state.apic_spiv);
1614 apic_write(APIC_LVT0, apic_pm_state.apic_lvt0); 1663 apic_write(APIC_LVT0, apic_pm_state.apic_lvt0);
1615 apic_write(APIC_LVT1, apic_pm_state.apic_lvt1); 1664 apic_write(APIC_LVT1, apic_pm_state.apic_lvt1);
1616#ifdef CONFIG_X86_MCE_P4THERMAL 1665#if defined(CONFIG_X86_MCE_P4THERMAL) || defined(CONFIG_X86_MCE_INTEL)
1617 if (maxlvt >= 5) 1666 if (maxlvt >= 5)
1618 apic_write(APIC_LVTTHMR, apic_pm_state.apic_thmr); 1667 apic_write(APIC_LVTTHMR, apic_pm_state.apic_thmr);
1619#endif 1668#endif
@@ -1627,7 +1676,9 @@ static int lapic_resume(struct sys_device *dev)
1627 apic_write(APIC_LVTERR, apic_pm_state.apic_lvterr); 1676 apic_write(APIC_LVTERR, apic_pm_state.apic_lvterr);
1628 apic_write(APIC_ESR, 0); 1677 apic_write(APIC_ESR, 0);
1629 apic_read(APIC_ESR); 1678 apic_read(APIC_ESR);
1679
1630 local_irq_restore(flags); 1680 local_irq_restore(flags);
1681
1631 return 0; 1682 return 0;
1632} 1683}
1633 1684
@@ -1683,20 +1734,20 @@ static int __init parse_lapic(char *arg)
1683} 1734}
1684early_param("lapic", parse_lapic); 1735early_param("lapic", parse_lapic);
1685 1736
1686static int __init parse_nolapic(char *arg) 1737static int __init setup_disableapic(char *arg)
1687{ 1738{
1688 disable_apic = 1; 1739 disable_apic = 1;
1689 setup_clear_cpu_cap(X86_FEATURE_APIC); 1740 setup_clear_cpu_cap(X86_FEATURE_APIC);
1690 return 0; 1741 return 0;
1691} 1742}
1692early_param("nolapic", parse_nolapic); 1743early_param("disableapic", setup_disableapic);
1693 1744
1694static int __init parse_disable_lapic_timer(char *arg) 1745/* same as disableapic, for compatibility */
1746static int __init setup_nolapic(char *arg)
1695{ 1747{
1696 local_apic_timer_disabled = 1; 1748 return setup_disableapic(arg);
1697 return 0;
1698} 1749}
1699early_param("nolapic_timer", parse_disable_lapic_timer); 1750early_param("nolapic", setup_nolapic);
1700 1751
1701static int __init parse_lapic_timer_c2_ok(char *arg) 1752static int __init parse_lapic_timer_c2_ok(char *arg)
1702{ 1753{
@@ -1705,15 +1756,40 @@ static int __init parse_lapic_timer_c2_ok(char *arg)
1705} 1756}
1706early_param("lapic_timer_c2_ok", parse_lapic_timer_c2_ok); 1757early_param("lapic_timer_c2_ok", parse_lapic_timer_c2_ok);
1707 1758
1759static int __init parse_disable_apic_timer(char *arg)
1760{
1761 disable_apic_timer = 1;
1762 return 0;
1763}
1764early_param("noapictimer", parse_disable_apic_timer);
1765
1766static int __init parse_nolapic_timer(char *arg)
1767{
1768 disable_apic_timer = 1;
1769 return 0;
1770}
1771early_param("nolapic_timer", parse_nolapic_timer);
1772
1708static int __init apic_set_verbosity(char *arg) 1773static int __init apic_set_verbosity(char *arg)
1709{ 1774{
1710 if (!arg) 1775 if (!arg) {
1776#ifdef CONFIG_X86_64
1777 skip_ioapic_setup = 0;
1778 ioapic_force = 1;
1779 return 0;
1780#endif
1711 return -EINVAL; 1781 return -EINVAL;
1782 }
1712 1783
1713 if (strcmp(arg, "debug") == 0) 1784 if (strcmp("debug", arg) == 0)
1714 apic_verbosity = APIC_DEBUG; 1785 apic_verbosity = APIC_DEBUG;
1715 else if (strcmp(arg, "verbose") == 0) 1786 else if (strcmp("verbose", arg) == 0)
1716 apic_verbosity = APIC_VERBOSE; 1787 apic_verbosity = APIC_VERBOSE;
1788 else {
1789 printk(KERN_WARNING "APIC Verbosity level %s not recognised"
1790 " use apic=verbose or apic=debug\n", arg);
1791 return -EINVAL;
1792 }
1717 1793
1718 return 0; 1794 return 0;
1719} 1795}
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 1a6011855af3..53898b65a6ae 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -45,6 +45,7 @@
45#include <mach_ipi.h> 45#include <mach_ipi.h>
46#include <mach_apic.h> 46#include <mach_apic.h>
47 47
48/* Disable local APIC timer from the kernel commandline or via dmi quirk */
48static int disable_apic_timer __cpuinitdata; 49static int disable_apic_timer __cpuinitdata;
49static int apic_calibrate_pmtmr __initdata; 50static int apic_calibrate_pmtmr __initdata;
50int disable_apic; 51int disable_apic;
@@ -80,6 +81,9 @@ static void lapic_timer_setup(enum clock_event_mode mode,
80static void lapic_timer_broadcast(cpumask_t mask); 81static void lapic_timer_broadcast(cpumask_t mask);
81static void apic_pm_activate(void); 82static void apic_pm_activate(void);
82 83
84/*
85 * The local apic timer can be used for any function which is CPU local.
86 */
83static struct clock_event_device lapic_clockevent = { 87static struct clock_event_device lapic_clockevent = {
84 .name = "lapic", 88 .name = "lapic",
85 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT 89 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT
@@ -106,11 +110,15 @@ static inline int lapic_get_version(void)
106} 110}
107 111
108/* 112/*
109 * Check, if the APIC is integrated or a seperate chip 113 * Check, if the APIC is integrated or a separate chip
110 */ 114 */
111static inline int lapic_is_integrated(void) 115static inline int lapic_is_integrated(void)
112{ 116{
117#ifdef CONFIG_X86_64
113 return 1; 118 return 1;
119#else
120 return APIC_INTEGRATED(lapic_get_version());
121#endif
114} 122}
115 123
116/* 124/*
@@ -125,6 +133,11 @@ static int modern_apic(void)
125 return lapic_get_version() >= 0x14; 133 return lapic_get_version() >= 0x14;
126} 134}
127 135
136/*
137 * Paravirt kernels also might be using these below ops. So we still
138 * use generic apic_read()/apic_write(), which might be pointing to different
139 * ops in PARAVIRT case.
140 */
128void xapic_wait_icr_idle(void) 141void xapic_wait_icr_idle(void)
129{ 142{
130 while (apic_read(APIC_ICR) & APIC_ICR_BUSY) 143 while (apic_read(APIC_ICR) & APIC_ICR_BUSY)
@@ -149,7 +162,7 @@ u32 safe_xapic_wait_icr_idle(void)
149 162
150void xapic_icr_write(u32 low, u32 id) 163void xapic_icr_write(u32 low, u32 id)
151{ 164{
152 apic_write(APIC_ICR2, id << 24); 165 apic_write(APIC_ICR2, SET_APIC_DEST_FIELD(id));
153 apic_write(APIC_ICR, low); 166 apic_write(APIC_ICR, low);
154} 167}
155 168
@@ -160,7 +173,7 @@ u64 xapic_icr_read(void)
160 icr2 = apic_read(APIC_ICR2); 173 icr2 = apic_read(APIC_ICR2);
161 icr1 = apic_read(APIC_ICR); 174 icr1 = apic_read(APIC_ICR);
162 175
163 return (icr1 | ((u64)icr2 << 32)); 176 return icr1 | ((u64)icr2 << 32);
164} 177}
165 178
166static struct apic_ops xapic_ops = { 179static struct apic_ops xapic_ops = {
@@ -173,7 +186,6 @@ static struct apic_ops xapic_ops = {
173}; 186};
174 187
175struct apic_ops __read_mostly *apic_ops = &xapic_ops; 188struct apic_ops __read_mostly *apic_ops = &xapic_ops;
176
177EXPORT_SYMBOL_GPL(apic_ops); 189EXPORT_SYMBOL_GPL(apic_ops);
178 190
179static void x2apic_wait_icr_idle(void) 191static void x2apic_wait_icr_idle(void)
@@ -243,6 +255,17 @@ int lapic_get_maxlvt(void)
243} 255}
244 256
245/* 257/*
258 * Local APIC timer
259 */
260
261/* Clock divisor */
262#ifdef CONFG_X86_64
263#define APIC_DIVISOR 1
264#else
265#define APIC_DIVISOR 16
266#endif
267
268/*
246 * This function sets up the local APIC timer, with a timeout of 269 * This function sets up the local APIC timer, with a timeout of
247 * 'clocks' APIC bus clock. During calibration we actually call 270 * 'clocks' APIC bus clock. During calibration we actually call
248 * this function twice on the boot CPU, once with a bogus timeout 271 * this function twice on the boot CPU, once with a bogus timeout
@@ -252,7 +275,6 @@ int lapic_get_maxlvt(void)
252 * We do reads before writes even if unnecessary, to get around the 275 * We do reads before writes even if unnecessary, to get around the
253 * P5 APIC double write bug. 276 * P5 APIC double write bug.
254 */ 277 */
255
256static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen) 278static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen)
257{ 279{
258 unsigned int lvtt_value, tmp_value; 280 unsigned int lvtt_value, tmp_value;
@@ -260,6 +282,9 @@ static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen)
260 lvtt_value = LOCAL_TIMER_VECTOR; 282 lvtt_value = LOCAL_TIMER_VECTOR;
261 if (!oneshot) 283 if (!oneshot)
262 lvtt_value |= APIC_LVT_TIMER_PERIODIC; 284 lvtt_value |= APIC_LVT_TIMER_PERIODIC;
285 if (!lapic_is_integrated())
286 lvtt_value |= SET_APIC_TIMER_BASE(APIC_TIMER_BASE_DIV);
287
263 if (!irqen) 288 if (!irqen)
264 lvtt_value |= APIC_LVT_MASKED; 289 lvtt_value |= APIC_LVT_MASKED;
265 290
@@ -269,12 +294,12 @@ static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen)
269 * Divide PICLK by 16 294 * Divide PICLK by 16
270 */ 295 */
271 tmp_value = apic_read(APIC_TDCR); 296 tmp_value = apic_read(APIC_TDCR);
272 apic_write(APIC_TDCR, (tmp_value 297 apic_write(APIC_TDCR,
273 & ~(APIC_TDR_DIV_1 | APIC_TDR_DIV_TMBASE)) 298 (tmp_value & ~(APIC_TDR_DIV_1 | APIC_TDR_DIV_TMBASE)) |
274 | APIC_TDR_DIV_16); 299 APIC_TDR_DIV_16);
275 300
276 if (!oneshot) 301 if (!oneshot)
277 apic_write(APIC_TMICT, clocks); 302 apic_write(APIC_TMICT, clocks / APIC_DIVISOR);
278} 303}
279 304
280/* 305/*
@@ -444,7 +469,7 @@ static int __init calibrate_APIC_clock(void)
444 lapic_clockevent.min_delta_ns = 469 lapic_clockevent.min_delta_ns =
445 clockevent_delta2ns(0xF, &lapic_clockevent); 470 clockevent_delta2ns(0xF, &lapic_clockevent);
446 471
447 calibration_result = result / HZ; 472 calibration_result = (result * APIC_DIVISOR) / HZ;
448 473
449 /* 474 /*
450 * Do a sanity check on the APIC calibration result 475 * Do a sanity check on the APIC calibration result
@@ -466,10 +491,10 @@ static int __init calibrate_APIC_clock(void)
466void __init setup_boot_APIC_clock(void) 491void __init setup_boot_APIC_clock(void)
467{ 492{
468 /* 493 /*
469 * The local apic timer can be disabled via the kernel commandline. 494 * The local apic timer can be disabled via the kernel
470 * Register the lapic timer as a dummy clock event source on SMP 495 * commandline or from the CPU detection code. Register the lapic
471 * systems, so the broadcast mechanism is used. On UP systems simply 496 * timer as a dummy clock event source on SMP systems, so the
472 * ignore it. 497 * broadcast mechanism is used. On UP systems simply ignore it.
473 */ 498 */
474 if (disable_apic_timer) { 499 if (disable_apic_timer) {
475 printk(KERN_INFO "Disabling APIC timer\n"); 500 printk(KERN_INFO "Disabling APIC timer\n");
@@ -481,7 +506,9 @@ void __init setup_boot_APIC_clock(void)
481 return; 506 return;
482 } 507 }
483 508
484 printk(KERN_INFO "Using local APIC timer interrupts.\n"); 509 apic_printk(APIC_VERBOSE, "Using local APIC timer interrupts.\n"
510 "calibrating APIC timer ...\n");
511
485 if (calibrate_APIC_clock()) { 512 if (calibrate_APIC_clock()) {
486 /* No broadcast on UP ! */ 513 /* No broadcast on UP ! */
487 if (num_possible_cpus() > 1) 514 if (num_possible_cpus() > 1)
@@ -500,6 +527,7 @@ void __init setup_boot_APIC_clock(void)
500 printk(KERN_WARNING "APIC timer registered as dummy," 527 printk(KERN_WARNING "APIC timer registered as dummy,"
501 " due to nmi_watchdog=%d!\n", nmi_watchdog); 528 " due to nmi_watchdog=%d!\n", nmi_watchdog);
502 529
530 /* Setup the lapic or request the broadcast */
503 setup_APIC_timer(); 531 setup_APIC_timer();
504} 532}
505 533
@@ -538,7 +566,11 @@ static void local_apic_timer_interrupt(void)
538 /* 566 /*
539 * the NMI deadlock-detector uses this. 567 * the NMI deadlock-detector uses this.
540 */ 568 */
569#ifdef CONFIG_X86_64
541 add_pda(apic_timer_irqs, 1); 570 add_pda(apic_timer_irqs, 1);
571#else
572 per_cpu(irq_stat, cpu).apic_timer_irqs++;
573#endif
542 574
543 evt->event_handler(evt); 575 evt->event_handler(evt);
544} 576}
@@ -569,6 +601,7 @@ void smp_apic_timer_interrupt(struct pt_regs *regs)
569 irq_enter(); 601 irq_enter();
570 local_apic_timer_interrupt(); 602 local_apic_timer_interrupt();
571 irq_exit(); 603 irq_exit();
604
572 set_irq_regs(old_regs); 605 set_irq_regs(old_regs);
573} 606}
574 607
@@ -622,6 +655,13 @@ void clear_local_APIC(void)
622 apic_write(APIC_LVTPC, v | APIC_LVT_MASKED); 655 apic_write(APIC_LVTPC, v | APIC_LVT_MASKED);
623 } 656 }
624 657
658 /* lets not touch this if we didn't frob it */
659#if defined(CONFIG_X86_MCE_P4THERMAL) || defined(X86_MCE_INTEL)
660 if (maxlvt >= 5) {
661 v = apic_read(APIC_LVTTHMR);
662 apic_write(APIC_LVTTHMR, v | APIC_LVT_MASKED);
663 }
664#endif
625 /* 665 /*
626 * Clean APIC state for other OSs: 666 * Clean APIC state for other OSs:
627 */ 667 */
@@ -632,8 +672,14 @@ void clear_local_APIC(void)
632 apic_write(APIC_LVTERR, APIC_LVT_MASKED); 672 apic_write(APIC_LVTERR, APIC_LVT_MASKED);
633 if (maxlvt >= 4) 673 if (maxlvt >= 4)
634 apic_write(APIC_LVTPC, APIC_LVT_MASKED); 674 apic_write(APIC_LVTPC, APIC_LVT_MASKED);
635 apic_write(APIC_ESR, 0); 675
636 apic_read(APIC_ESR); 676 /* Integrated APIC (!82489DX) ? */
677 if (lapic_is_integrated()) {
678 if (maxlvt > 3)
679 /* Clear ESR due to Pentium errata 3AP and 11AP */
680 apic_write(APIC_ESR, 0);
681 apic_read(APIC_ESR);
682 }
637} 683}
638 684
639/** 685/**
@@ -652,8 +698,28 @@ void disable_local_APIC(void)
652 value = apic_read(APIC_SPIV); 698 value = apic_read(APIC_SPIV);
653 value &= ~APIC_SPIV_APIC_ENABLED; 699 value &= ~APIC_SPIV_APIC_ENABLED;
654 apic_write(APIC_SPIV, value); 700 apic_write(APIC_SPIV, value);
701
702#ifdef CONFIG_X86_32
703 /*
704 * When LAPIC was disabled by the BIOS and enabled by the kernel,
705 * restore the disabled state.
706 */
707 if (enabled_via_apicbase) {
708 unsigned int l, h;
709
710 rdmsr(MSR_IA32_APICBASE, l, h);
711 l &= ~MSR_IA32_APICBASE_ENABLE;
712 wrmsr(MSR_IA32_APICBASE, l, h);
713 }
714#endif
655} 715}
656 716
717/*
718 * If Linux enabled the LAPIC against the BIOS default disable it down before
719 * re-entering the BIOS on shutdown. Otherwise the BIOS may get confused and
720 * not power-off. Additionally clear all LVT entries before disable_local_APIC
721 * for the case where Linux didn't enable the LAPIC.
722 */
657void lapic_shutdown(void) 723void lapic_shutdown(void)
658{ 724{
659 unsigned long flags; 725 unsigned long flags;
@@ -663,7 +729,13 @@ void lapic_shutdown(void)
663 729
664 local_irq_save(flags); 730 local_irq_save(flags);
665 731
666 disable_local_APIC(); 732#ifdef CONFIG_X86_32
733 if (!enabled_via_apicbase)
734 clear_local_APIC();
735 else
736#endif
737 disable_local_APIC();
738
667 739
668 local_irq_restore(flags); 740 local_irq_restore(flags);
669} 741}
@@ -734,8 +806,11 @@ int __init verify_local_APIC(void)
734 */ 806 */
735void __init sync_Arb_IDs(void) 807void __init sync_Arb_IDs(void)
736{ 808{
737 /* Unsupported on P4 - see Intel Dev. Manual Vol. 3, Ch. 8.6.1 */ 809 /*
738 if (modern_apic()) 810 * Unsupported on P4 - see Intel Dev. Manual Vol. 3, Ch. 8.6.1 And not
811 * needed on AMD.
812 */
813 if (modern_apic() || boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
739 return; 814 return;
740 815
741 /* 816 /*
@@ -744,8 +819,8 @@ void __init sync_Arb_IDs(void)
744 apic_wait_icr_idle(); 819 apic_wait_icr_idle();
745 820
746 apic_printk(APIC_DEBUG, "Synchronizing Arb IDs.\n"); 821 apic_printk(APIC_DEBUG, "Synchronizing Arb IDs.\n");
747 apic_write(APIC_ICR, APIC_DEST_ALLINC | APIC_INT_LEVELTRIG 822 apic_write(APIC_ICR, APIC_DEST_ALLINC |
748 | APIC_DM_INIT); 823 APIC_INT_LEVELTRIG | APIC_DM_INIT);
749} 824}
750 825
751/* 826/*
@@ -762,8 +837,6 @@ void __init init_bsp_APIC(void)
762 if (smp_found_config || !cpu_has_apic) 837 if (smp_found_config || !cpu_has_apic)
763 return; 838 return;
764 839
765 value = apic_read(APIC_LVR);
766
767 /* 840 /*
768 * Do not trust the local APIC being empty at bootup. 841 * Do not trust the local APIC being empty at bootup.
769 */ 842 */
@@ -775,7 +848,15 @@ void __init init_bsp_APIC(void)
775 value = apic_read(APIC_SPIV); 848 value = apic_read(APIC_SPIV);
776 value &= ~APIC_VECTOR_MASK; 849 value &= ~APIC_VECTOR_MASK;
777 value |= APIC_SPIV_APIC_ENABLED; 850 value |= APIC_SPIV_APIC_ENABLED;
778 value |= APIC_SPIV_FOCUS_DISABLED; 851
852#ifdef CONFIG_X86_32
853 /* This bit is reserved on P4/Xeon and should be cleared */
854 if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) &&
855 (boot_cpu_data.x86 == 15))
856 value &= ~APIC_SPIV_FOCUS_DISABLED;
857 else
858#endif
859 value |= APIC_SPIV_FOCUS_DISABLED;
779 value |= SPURIOUS_APIC_VECTOR; 860 value |= SPURIOUS_APIC_VECTOR;
780 apic_write(APIC_SPIV, value); 861 apic_write(APIC_SPIV, value);
781 862
@@ -784,9 +865,50 @@ void __init init_bsp_APIC(void)
784 */ 865 */
785 apic_write(APIC_LVT0, APIC_DM_EXTINT); 866 apic_write(APIC_LVT0, APIC_DM_EXTINT);
786 value = APIC_DM_NMI; 867 value = APIC_DM_NMI;
868 if (!lapic_is_integrated()) /* 82489DX */
869 value |= APIC_LVT_LEVEL_TRIGGER;
787 apic_write(APIC_LVT1, value); 870 apic_write(APIC_LVT1, value);
788} 871}
789 872
873static void __cpuinit lapic_setup_esr(void)
874{
875 unsigned long oldvalue, value, maxlvt;
876 if (lapic_is_integrated() && !esr_disable) {
877 if (esr_disable) {
878 /*
879 * Something untraceable is creating bad interrupts on
880 * secondary quads ... for the moment, just leave the
881 * ESR disabled - we can't do anything useful with the
882 * errors anyway - mbligh
883 */
884 printk(KERN_INFO "Leaving ESR disabled.\n");
885 return;
886 }
887 /* !82489DX */
888 maxlvt = lapic_get_maxlvt();
889 if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */
890 apic_write(APIC_ESR, 0);
891 oldvalue = apic_read(APIC_ESR);
892
893 /* enables sending errors */
894 value = ERROR_APIC_VECTOR;
895 apic_write(APIC_LVTERR, value);
896 /*
897 * spec says clear errors after enabling vector.
898 */
899 if (maxlvt > 3)
900 apic_write(APIC_ESR, 0);
901 value = apic_read(APIC_ESR);
902 if (value != oldvalue)
903 apic_printk(APIC_VERBOSE, "ESR value before enabling "
904 "vector: 0x%08lx after: 0x%08lx\n",
905 oldvalue, value);
906 } else {
907 printk(KERN_INFO "No ESR for 82489DX.\n");
908 }
909}
910
911
790/** 912/**
791 * setup_local_APIC - setup the local APIC 913 * setup_local_APIC - setup the local APIC
792 */ 914 */
@@ -892,21 +1014,20 @@ void __cpuinit setup_local_APIC(void)
892 preempt_enable(); 1014 preempt_enable();
893} 1015}
894 1016
895static void __cpuinit lapic_setup_esr(void)
896{
897 unsigned maxlvt = lapic_get_maxlvt();
898
899 apic_write(APIC_LVTERR, ERROR_APIC_VECTOR);
900 /*
901 * spec says clear errors after enabling vector.
902 */
903 if (maxlvt > 3)
904 apic_write(APIC_ESR, 0);
905}
906
907void __cpuinit end_local_APIC_setup(void) 1017void __cpuinit end_local_APIC_setup(void)
908{ 1018{
909 lapic_setup_esr(); 1019 lapic_setup_esr();
1020
1021#ifdef CONFIG_X86_32
1022 {
1023 unsigned int value;
1024 /* Disable the local apic timer */
1025 value = apic_read(APIC_LVTT);
1026 value |= (APIC_LVT_MASKED | LOCAL_TIMER_VECTOR);
1027 apic_write(APIC_LVTT, value);
1028 }
1029#endif
1030
910 setup_apic_nmi_watchdog(NULL); 1031 setup_apic_nmi_watchdog(NULL);
911 apic_pm_activate(); 1032 apic_pm_activate();
912} 1033}
@@ -1108,6 +1229,8 @@ void __init init_apic_mappings(void)
1108 * This initializes the IO-APIC and APIC hardware if this is 1229 * This initializes the IO-APIC and APIC hardware if this is
1109 * a UP kernel. 1230 * a UP kernel.
1110 */ 1231 */
1232int apic_version[MAX_APICS];
1233
1111int __init APIC_init_uniprocessor(void) 1234int __init APIC_init_uniprocessor(void)
1112{ 1235{
1113 if (disable_apic) { 1236 if (disable_apic) {
@@ -1209,17 +1332,57 @@ asmlinkage void smp_error_interrupt(void)
1209} 1332}
1210 1333
1211/** 1334/**
1212 * * connect_bsp_APIC - attach the APIC to the interrupt system 1335 * connect_bsp_APIC - attach the APIC to the interrupt system
1213 * */ 1336 */
1214void __init connect_bsp_APIC(void) 1337void __init connect_bsp_APIC(void)
1215{ 1338{
1339#ifdef CONFIG_X86_32
1340 if (pic_mode) {
1341 /*
1342 * Do not trust the local APIC being empty at bootup.
1343 */
1344 clear_local_APIC();
1345 /*
1346 * PIC mode, enable APIC mode in the IMCR, i.e. connect BSP's
1347 * local APIC to INT and NMI lines.
1348 */
1349 apic_printk(APIC_VERBOSE, "leaving PIC mode, "
1350 "enabling APIC mode.\n");
1351 outb(0x70, 0x22);
1352 outb(0x01, 0x23);
1353 }
1354#endif
1216 enable_apic_mode(); 1355 enable_apic_mode();
1217} 1356}
1218 1357
1358/**
1359 * disconnect_bsp_APIC - detach the APIC from the interrupt system
1360 * @virt_wire_setup: indicates, whether virtual wire mode is selected
1361 *
1362 * Virtual wire mode is necessary to deliver legacy interrupts even when the
1363 * APIC is disabled.
1364 */
1219void disconnect_bsp_APIC(int virt_wire_setup) 1365void disconnect_bsp_APIC(int virt_wire_setup)
1220{ 1366{
1367 unsigned int value;
1368
1369#ifdef CONFIG_X86_32
1370 if (pic_mode) {
1371 /*
1372 * Put the board back into PIC mode (has an effect only on
1373 * certain older boards). Note that APIC interrupts, including
1374 * IPIs, won't work beyond this point! The only exception are
1375 * INIT IPIs.
1376 */
1377 apic_printk(APIC_VERBOSE, "disabling APIC mode, "
1378 "entering PIC mode.\n");
1379 outb(0x70, 0x22);
1380 outb(0x00, 0x23);
1381 return;
1382 }
1383#endif
1384
1221 /* Go back to Virtual Wire compatibility mode */ 1385 /* Go back to Virtual Wire compatibility mode */
1222 unsigned long value;
1223 1386
1224 /* For the spurious interrupt use vector F, and enable it */ 1387 /* For the spurious interrupt use vector F, and enable it */
1225 value = apic_read(APIC_SPIV); 1388 value = apic_read(APIC_SPIV);
@@ -1245,7 +1408,10 @@ void disconnect_bsp_APIC(int virt_wire_setup)
1245 apic_write(APIC_LVT0, APIC_LVT_MASKED); 1408 apic_write(APIC_LVT0, APIC_LVT_MASKED);
1246 } 1409 }
1247 1410
1248 /* For LVT1 make it edge triggered, active high, nmi and enabled */ 1411 /*
1412 * For LVT1 make it edge triggered, active high,
1413 * nmi and enabled
1414 */
1249 value = apic_read(APIC_LVT1); 1415 value = apic_read(APIC_LVT1);
1250 value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING | 1416 value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING |
1251 APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR | 1417 APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR |
@@ -1260,9 +1426,20 @@ void __cpuinit generic_processor_info(int apicid, int version)
1260 int cpu; 1426 int cpu;
1261 cpumask_t tmp_map; 1427 cpumask_t tmp_map;
1262 1428
1429 /*
1430 * Validate version
1431 */
1432 if (version == 0x0) {
1433 printk(KERN_WARNING "BIOS bug, APIC version is 0 for CPU#%d! "
1434 "fixing up to 0x10. (tell your hw vendor)\n",
1435 version);
1436 version = 0x10;
1437 }
1438 apic_version[apicid] = version;
1439
1263 if (num_processors >= NR_CPUS) { 1440 if (num_processors >= NR_CPUS) {
1264 printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached." 1441 printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached."
1265 " Processor ignored.\n", NR_CPUS); 1442 " Processor ignored.\n", NR_CPUS);
1266 return; 1443 return;
1267 } 1444 }
1268 1445
@@ -1282,6 +1459,29 @@ void __cpuinit generic_processor_info(int apicid, int version)
1282 if (apicid > max_physical_apicid) 1459 if (apicid > max_physical_apicid)
1283 max_physical_apicid = apicid; 1460 max_physical_apicid = apicid;
1284 1461
1462#ifdef CONFIG_X86_32
1463 /*
1464 * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y
1465 * but we need to work other dependencies like SMP_SUSPEND etc
1466 * before this can be done without some confusion.
1467 * if (CPU_HOTPLUG_ENABLED || num_processors > 8)
1468 * - Ashok Raj <ashok.raj@intel.com>
1469 */
1470 if (max_physical_apicid >= 8) {
1471 switch (boot_cpu_data.x86_vendor) {
1472 case X86_VENDOR_INTEL:
1473 if (!APIC_XAPIC(version)) {
1474 def_to_bigsmp = 0;
1475 break;
1476 }
1477 /* If P4 and above fall through */
1478 case X86_VENDOR_AMD:
1479 def_to_bigsmp = 1;
1480 }
1481 }
1482#endif
1483
1484#if defined(CONFIG_X86_SMP) || defined(CONFIG_X86_64)
1285 /* are we being called early in kernel startup? */ 1485 /* are we being called early in kernel startup? */
1286 if (early_per_cpu_ptr(x86_cpu_to_apicid)) { 1486 if (early_per_cpu_ptr(x86_cpu_to_apicid)) {
1287 u16 *cpu_to_apicid = early_per_cpu_ptr(x86_cpu_to_apicid); 1487 u16 *cpu_to_apicid = early_per_cpu_ptr(x86_cpu_to_apicid);
@@ -1293,6 +1493,7 @@ void __cpuinit generic_processor_info(int apicid, int version)
1293 per_cpu(x86_cpu_to_apicid, cpu) = apicid; 1493 per_cpu(x86_cpu_to_apicid, cpu) = apicid;
1294 per_cpu(x86_bios_cpu_apicid, cpu) = apicid; 1494 per_cpu(x86_bios_cpu_apicid, cpu) = apicid;
1295 } 1495 }
1496#endif
1296 1497
1297 cpu_set(cpu, cpu_possible_map); 1498 cpu_set(cpu, cpu_possible_map);
1298 cpu_set(cpu, cpu_present_map); 1499 cpu_set(cpu, cpu_present_map);
@@ -1309,9 +1510,11 @@ int hard_smp_processor_id(void)
1309#ifdef CONFIG_PM 1510#ifdef CONFIG_PM
1310 1511
1311static struct { 1512static struct {
1312 /* 'active' is true if the local APIC was enabled by us and 1513 /*
1313 not the BIOS; this signifies that we are also responsible 1514 * 'active' is true if the local APIC was enabled by us and
1314 for disabling it before entering apm/acpi suspend */ 1515 * not the BIOS; this signifies that we are also responsible
1516 * for disabling it before entering apm/acpi suspend
1517 */
1315 int active; 1518 int active;
1316 /* r/w apic fields */ 1519 /* r/w apic fields */
1317 unsigned int apic_id; 1520 unsigned int apic_id;
@@ -1352,10 +1555,11 @@ static int lapic_suspend(struct sys_device *dev, pm_message_t state)
1352 apic_pm_state.apic_lvterr = apic_read(APIC_LVTERR); 1555 apic_pm_state.apic_lvterr = apic_read(APIC_LVTERR);
1353 apic_pm_state.apic_tmict = apic_read(APIC_TMICT); 1556 apic_pm_state.apic_tmict = apic_read(APIC_TMICT);
1354 apic_pm_state.apic_tdcr = apic_read(APIC_TDCR); 1557 apic_pm_state.apic_tdcr = apic_read(APIC_TDCR);
1355#ifdef CONFIG_X86_MCE_INTEL 1558#if defined(CONFIG_X86_MCE_P4THERMAL) || defined(CONFIG_X86_MCE_INTEL)
1356 if (maxlvt >= 5) 1559 if (maxlvt >= 5)
1357 apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR); 1560 apic_pm_state.apic_thmr = apic_read(APIC_LVTTHMR);
1358#endif 1561#endif
1562
1359 local_irq_save(flags); 1563 local_irq_save(flags);
1360 disable_local_APIC(); 1564 disable_local_APIC();
1361 local_irq_restore(flags); 1565 local_irq_restore(flags);
@@ -1374,13 +1578,24 @@ static int lapic_resume(struct sys_device *dev)
1374 maxlvt = lapic_get_maxlvt(); 1578 maxlvt = lapic_get_maxlvt();
1375 1579
1376 local_irq_save(flags); 1580 local_irq_save(flags);
1377 if (!x2apic) { 1581
1582#ifdef CONFIG_X86_64
1583 if (x2apic)
1584 enable_x2apic();
1585 else
1586#endif
1587 {
1588 /*
1589 * Make sure the APICBASE points to the right address
1590 *
1591 * FIXME! This will be wrong if we ever support suspend on
1592 * SMP! We'll need to do this as part of the CPU restore!
1593 */
1378 rdmsr(MSR_IA32_APICBASE, l, h); 1594 rdmsr(MSR_IA32_APICBASE, l, h);
1379 l &= ~MSR_IA32_APICBASE_BASE; 1595 l &= ~MSR_IA32_APICBASE_BASE;
1380 l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr; 1596 l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr;
1381 wrmsr(MSR_IA32_APICBASE, l, h); 1597 wrmsr(MSR_IA32_APICBASE, l, h);
1382 } else 1598 }
1383 enable_x2apic();
1384 1599
1385 apic_write(APIC_LVTERR, ERROR_APIC_VECTOR | APIC_LVT_MASKED); 1600 apic_write(APIC_LVTERR, ERROR_APIC_VECTOR | APIC_LVT_MASKED);
1386 apic_write(APIC_ID, apic_pm_state.apic_id); 1601 apic_write(APIC_ID, apic_pm_state.apic_id);
@@ -1390,7 +1605,7 @@ static int lapic_resume(struct sys_device *dev)
1390 apic_write(APIC_SPIV, apic_pm_state.apic_spiv); 1605 apic_write(APIC_SPIV, apic_pm_state.apic_spiv);
1391 apic_write(APIC_LVT0, apic_pm_state.apic_lvt0); 1606 apic_write(APIC_LVT0, apic_pm_state.apic_lvt0);
1392 apic_write(APIC_LVT1, apic_pm_state.apic_lvt1); 1607 apic_write(APIC_LVT1, apic_pm_state.apic_lvt1);
1393#ifdef CONFIG_X86_MCE_INTEL 1608#if defined(CONFIG_X86_MCE_P4THERMAL) || defined(CONFIG_X86_MCE_INTEL)
1394 if (maxlvt >= 5) 1609 if (maxlvt >= 5)
1395 apic_write(APIC_LVTTHMR, apic_pm_state.apic_thmr); 1610 apic_write(APIC_LVTTHMR, apic_pm_state.apic_thmr);
1396#endif 1611#endif
@@ -1404,10 +1619,17 @@ static int lapic_resume(struct sys_device *dev)
1404 apic_write(APIC_LVTERR, apic_pm_state.apic_lvterr); 1619 apic_write(APIC_LVTERR, apic_pm_state.apic_lvterr);
1405 apic_write(APIC_ESR, 0); 1620 apic_write(APIC_ESR, 0);
1406 apic_read(APIC_ESR); 1621 apic_read(APIC_ESR);
1622
1407 local_irq_restore(flags); 1623 local_irq_restore(flags);
1624
1408 return 0; 1625 return 0;
1409} 1626}
1410 1627
1628/*
1629 * This device has no shutdown method - fully functioning local APICs
1630 * are needed on every CPU up until machine_halt/restart/poweroff.
1631 */
1632
1411static struct sysdev_class lapic_sysclass = { 1633static struct sysdev_class lapic_sysclass = {
1412 .name = "lapic", 1634 .name = "lapic",
1413 .resume = lapic_resume, 1635 .resume = lapic_resume,
@@ -1533,28 +1755,7 @@ early_param("nox2apic", setup_nox2apic);
1533/* 1755/*
1534 * APIC command line parameters 1756 * APIC command line parameters
1535 */ 1757 */
1536static int __init apic_set_verbosity(char *str) 1758static int __init setup_disableapic(char *arg)
1537{
1538 if (str == NULL) {
1539 skip_ioapic_setup = 0;
1540 ioapic_force = 1;
1541 return 0;
1542 }
1543 if (strcmp("debug", str) == 0)
1544 apic_verbosity = APIC_DEBUG;
1545 else if (strcmp("verbose", str) == 0)
1546 apic_verbosity = APIC_VERBOSE;
1547 else {
1548 printk(KERN_WARNING "APIC Verbosity level %s not recognised"
1549 " use apic=verbose or apic=debug\n", str);
1550 return -EINVAL;
1551 }
1552
1553 return 0;
1554}
1555early_param("apic", apic_set_verbosity);
1556
1557static __init int setup_disableapic(char *str)
1558{ 1759{
1559 disable_apic = 1; 1760 disable_apic = 1;
1560 setup_clear_cpu_cap(X86_FEATURE_APIC); 1761 setup_clear_cpu_cap(X86_FEATURE_APIC);
@@ -1563,9 +1764,9 @@ static __init int setup_disableapic(char *str)
1563early_param("disableapic", setup_disableapic); 1764early_param("disableapic", setup_disableapic);
1564 1765
1565/* same as disableapic, for compatibility */ 1766/* same as disableapic, for compatibility */
1566static __init int setup_nolapic(char *str) 1767static int __init setup_nolapic(char *arg)
1567{ 1768{
1568 return setup_disableapic(str); 1769 return setup_disableapic(arg);
1569} 1770}
1570early_param("nolapic", setup_nolapic); 1771early_param("nolapic", setup_nolapic);
1571 1772
@@ -1576,14 +1777,19 @@ static int __init parse_lapic_timer_c2_ok(char *arg)
1576} 1777}
1577early_param("lapic_timer_c2_ok", parse_lapic_timer_c2_ok); 1778early_param("lapic_timer_c2_ok", parse_lapic_timer_c2_ok);
1578 1779
1579static __init int setup_noapictimer(char *str) 1780static int __init parse_disable_apic_timer(char *arg)
1580{ 1781{
1581 if (str[0] != ' ' && str[0] != 0)
1582 return 0;
1583 disable_apic_timer = 1; 1782 disable_apic_timer = 1;
1584 return 1; 1783 return 0;
1784}
1785early_param("noapictimer", parse_disable_apic_timer);
1786
1787static int __init parse_nolapic_timer(char *arg)
1788{
1789 disable_apic_timer = 1;
1790 return 0;
1585} 1791}
1586__setup("noapictimer", setup_noapictimer); 1792early_param("nolapic_timer", parse_nolapic_timer);
1587 1793
1588static __init int setup_apicpmtimer(char *s) 1794static __init int setup_apicpmtimer(char *s)
1589{ 1795{
@@ -1593,6 +1799,31 @@ static __init int setup_apicpmtimer(char *s)
1593} 1799}
1594__setup("apicpmtimer", setup_apicpmtimer); 1800__setup("apicpmtimer", setup_apicpmtimer);
1595 1801
1802static int __init apic_set_verbosity(char *arg)
1803{
1804 if (!arg) {
1805#ifdef CONFIG_X86_64
1806 skip_ioapic_setup = 0;
1807 ioapic_force = 1;
1808 return 0;
1809#endif
1810 return -EINVAL;
1811 }
1812
1813 if (strcmp("debug", arg) == 0)
1814 apic_verbosity = APIC_DEBUG;
1815 else if (strcmp("verbose", arg) == 0)
1816 apic_verbosity = APIC_VERBOSE;
1817 else {
1818 printk(KERN_WARNING "APIC Verbosity level %s not recognised"
1819 " use apic=verbose or apic=debug\n", arg);
1820 return -EINVAL;
1821 }
1822
1823 return 0;
1824}
1825early_param("apic", apic_set_verbosity);
1826
1596static int __init lapic_insert_resource(void) 1827static int __init lapic_insert_resource(void)
1597{ 1828{
1598 if (!apic_phys) 1829 if (!apic_phys)
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index 9ee24e6bc4b0..5145a6e72bbb 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -228,12 +228,12 @@
228#include <linux/suspend.h> 228#include <linux/suspend.h>
229#include <linux/kthread.h> 229#include <linux/kthread.h>
230#include <linux/jiffies.h> 230#include <linux/jiffies.h>
231#include <linux/smp_lock.h>
232 231
233#include <asm/system.h> 232#include <asm/system.h>
234#include <asm/uaccess.h> 233#include <asm/uaccess.h>
235#include <asm/desc.h> 234#include <asm/desc.h>
236#include <asm/i8253.h> 235#include <asm/i8253.h>
236#include <asm/olpc.h>
237#include <asm/paravirt.h> 237#include <asm/paravirt.h>
238#include <asm/reboot.h> 238#include <asm/reboot.h>
239 239
@@ -2217,7 +2217,7 @@ static int __init apm_init(void)
2217 2217
2218 dmi_check_system(apm_dmi_table); 2218 dmi_check_system(apm_dmi_table);
2219 2219
2220 if (apm_info.bios.version == 0 || paravirt_enabled()) { 2220 if (apm_info.bios.version == 0 || paravirt_enabled() || machine_is_olpc()) {
2221 printk(KERN_INFO "apm: BIOS not found.\n"); 2221 printk(KERN_INFO "apm: BIOS not found.\n");
2222 return -ENODEV; 2222 return -ENODEV;
2223 } 2223 }
diff --git a/arch/x86/kernel/bios_uv.c b/arch/x86/kernel/bios_uv.c
index c639bd55391c..fdd585f9c53d 100644
--- a/arch/x86/kernel/bios_uv.c
+++ b/arch/x86/kernel/bios_uv.c
@@ -25,11 +25,11 @@ x86_bios_strerror(long status)
25{ 25{
26 const char *str; 26 const char *str;
27 switch (status) { 27 switch (status) {
28 case 0: str = "Call completed without error"; break; 28 case 0: str = "Call completed without error"; break;
29 case -1: str = "Not implemented"; break; 29 case -1: str = "Not implemented"; break;
30 case -2: str = "Invalid argument"; break; 30 case -2: str = "Invalid argument"; break;
31 case -3: str = "Call completed with error"; break; 31 case -3: str = "Call completed with error"; break;
32 default: str = "Unknown BIOS status code"; break; 32 default: str = "Unknown BIOS status code"; break;
33 } 33 }
34 return str; 34 return str;
35} 35}
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 84c4040efa80..7581b62df184 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -572,35 +572,15 @@ void __init early_cpu_init(void)
572 572
573/* 573/*
574 * The NOPL instruction is supposed to exist on all CPUs with 574 * The NOPL instruction is supposed to exist on all CPUs with
575 * family >= 6, unfortunately, that's not true in practice because 575 * family >= 6; unfortunately, that's not true in practice because
576 * of early VIA chips and (more importantly) broken virtualizers that 576 * of early VIA chips and (more importantly) broken virtualizers that
577 * are not easy to detect. Hence, probe for it based on first 577 * are not easy to detect. In the latter case it doesn't even *fail*
578 * principles. 578 * reliably, so probing for it doesn't even work. Disable it completely
579 * 579 * unless we can find a reliable way to detect all the broken cases.
580 * Note: no 64-bit chip is known to lack these, but put the code here
581 * for consistency with 32 bits, and to make it utterly trivial to
582 * diagnose the problem should it ever surface.
583 */ 580 */
584static void __cpuinit detect_nopl(struct cpuinfo_x86 *c) 581static void __cpuinit detect_nopl(struct cpuinfo_x86 *c)
585{ 582{
586 const u32 nopl_signature = 0x888c53b1; /* Random number */
587 u32 has_nopl = nopl_signature;
588
589 clear_cpu_cap(c, X86_FEATURE_NOPL); 583 clear_cpu_cap(c, X86_FEATURE_NOPL);
590 if (c->x86 >= 6) {
591 asm volatile("\n"
592 "1: .byte 0x0f,0x1f,0xc0\n" /* nopl %eax */
593 "2:\n"
594 " .section .fixup,\"ax\"\n"
595 "3: xor %0,%0\n"
596 " jmp 2b\n"
597 " .previous\n"
598 _ASM_EXTABLE(1b,3b)
599 : "+a" (has_nopl));
600
601 if (has_nopl == nopl_signature)
602 set_cpu_cap(c, X86_FEATURE_NOPL);
603 }
604} 584}
605 585
606static void __cpuinit generic_identify(struct cpuinfo_x86 *c) 586static void __cpuinit generic_identify(struct cpuinfo_x86 *c)
diff --git a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
index f1685fb91fbd..b8e05ee4f736 100644
--- a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
+++ b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
@@ -171,7 +171,7 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
171 } 171 }
172 172
173 if (c->x86 != 0xF) { 173 if (c->x86 != 0xF) {
174 printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. Please send an e-mail to <cpufreq@lists.linux.org.uk>\n"); 174 printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. Please send an e-mail to <cpufreq@vger.kernel.org>\n");
175 return 0; 175 return 0;
176 } 176 }
177 177
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
index 15e13c01cc36..3b5f06423e77 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -26,7 +26,7 @@
26#include <asm/cpufeature.h> 26#include <asm/cpufeature.h>
27 27
28#define PFX "speedstep-centrino: " 28#define PFX "speedstep-centrino: "
29#define MAINTAINER "cpufreq@lists.linux.org.uk" 29#define MAINTAINER "cpufreq@vger.kernel.org"
30 30
31#define dprintk(msg...) \ 31#define dprintk(msg...) \
32 cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "speedstep-centrino", msg) 32 cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "speedstep-centrino", msg)
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
index cb7d3b6a80eb..4e8d77f01eeb 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -401,12 +401,7 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base,
401 tmp |= ~((1<<(hi - 1)) - 1); 401 tmp |= ~((1<<(hi - 1)) - 1);
402 402
403 if (tmp != mask_lo) { 403 if (tmp != mask_lo) {
404 static int once = 1; 404 WARN_ONCE(1, KERN_INFO "mtrr: your BIOS has set up an incorrect mask, fixing it up.\n");
405
406 if (once) {
407 printk(KERN_INFO "mtrr: your BIOS has set up an incorrect mask, fixing it up.\n");
408 once = 0;
409 }
410 mask_lo = tmp; 405 mask_lo = tmp;
411 } 406 }
412 } 407 }
diff --git a/arch/x86/kernel/cpu/mtrr/if.c b/arch/x86/kernel/cpu/mtrr/if.c
index 84c480bb3715..4c4214690dd1 100644
--- a/arch/x86/kernel/cpu/mtrr/if.c
+++ b/arch/x86/kernel/cpu/mtrr/if.c
@@ -405,9 +405,9 @@ static int mtrr_seq_show(struct seq_file *seq, void *offset)
405 } 405 }
406 /* RED-PEN: base can be > 32bit */ 406 /* RED-PEN: base can be > 32bit */
407 len += seq_printf(seq, 407 len += seq_printf(seq,
408 "reg%02i: base=0x%05lx000 (%4luMB), size=%4lu%cB: %s, count=%d\n", 408 "reg%02i: base=0x%06lx000 (%5luMB), size=%5lu%cB, count=%d: %s\n",
409 i, base, base >> (20 - PAGE_SHIFT), size, factor, 409 i, base, base >> (20 - PAGE_SHIFT), size, factor,
410 mtrr_attrib_to_str(type), mtrr_usage_table[i]); 410 mtrr_usage_table[i], mtrr_attrib_to_str(type));
411 } 411 }
412 } 412 }
413 return 0; 413 return 0;
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index 58ac5d3d4361..c78c04821ea1 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -759,7 +759,8 @@ x86_get_mtrr_mem_range(struct res_range *range, int nr_range,
759 /* take out UC ranges */ 759 /* take out UC ranges */
760 for (i = 0; i < num_var_ranges; i++) { 760 for (i = 0; i < num_var_ranges; i++) {
761 type = range_state[i].type; 761 type = range_state[i].type;
762 if (type != MTRR_TYPE_UNCACHABLE) 762 if (type != MTRR_TYPE_UNCACHABLE &&
763 type != MTRR_TYPE_WRPROT)
763 continue; 764 continue;
764 size = range_state[i].size_pfn; 765 size = range_state[i].size_pfn;
765 if (!size) 766 if (!size)
@@ -834,7 +835,14 @@ static int __init enable_mtrr_cleanup_setup(char *str)
834 enable_mtrr_cleanup = 1; 835 enable_mtrr_cleanup = 1;
835 return 0; 836 return 0;
836} 837}
837early_param("enble_mtrr_cleanup", enable_mtrr_cleanup_setup); 838early_param("enable_mtrr_cleanup", enable_mtrr_cleanup_setup);
839
840static int __init mtrr_cleanup_debug_setup(char *str)
841{
842 debug_print = 1;
843 return 0;
844}
845early_param("mtrr_cleanup_debug", mtrr_cleanup_debug_setup);
838 846
839struct var_mtrr_state { 847struct var_mtrr_state {
840 unsigned long range_startk; 848 unsigned long range_startk;
@@ -898,6 +906,27 @@ set_var_mtrr_all(unsigned int address_bits)
898 } 906 }
899} 907}
900 908
909static unsigned long to_size_factor(unsigned long sizek, char *factorp)
910{
911 char factor;
912 unsigned long base = sizek;
913
914 if (base & ((1<<10) - 1)) {
915 /* not MB alignment */
916 factor = 'K';
917 } else if (base & ((1<<20) - 1)){
918 factor = 'M';
919 base >>= 10;
920 } else {
921 factor = 'G';
922 base >>= 20;
923 }
924
925 *factorp = factor;
926
927 return base;
928}
929
901static unsigned int __init 930static unsigned int __init
902range_to_mtrr(unsigned int reg, unsigned long range_startk, 931range_to_mtrr(unsigned int reg, unsigned long range_startk,
903 unsigned long range_sizek, unsigned char type) 932 unsigned long range_sizek, unsigned char type)
@@ -919,13 +948,21 @@ range_to_mtrr(unsigned int reg, unsigned long range_startk,
919 align = max_align; 948 align = max_align;
920 949
921 sizek = 1 << align; 950 sizek = 1 << align;
922 if (debug_print) 951 if (debug_print) {
952 char start_factor = 'K', size_factor = 'K';
953 unsigned long start_base, size_base;
954
955 start_base = to_size_factor(range_startk, &start_factor),
956 size_base = to_size_factor(sizek, &size_factor),
957
923 printk(KERN_DEBUG "Setting variable MTRR %d, " 958 printk(KERN_DEBUG "Setting variable MTRR %d, "
924 "base: %ldMB, range: %ldMB, type %s\n", 959 "base: %ld%cB, range: %ld%cB, type %s\n",
925 reg, range_startk >> 10, sizek >> 10, 960 reg, start_base, start_factor,
961 size_base, size_factor,
926 (type == MTRR_TYPE_UNCACHABLE)?"UC": 962 (type == MTRR_TYPE_UNCACHABLE)?"UC":
927 ((type == MTRR_TYPE_WRBACK)?"WB":"Other") 963 ((type == MTRR_TYPE_WRBACK)?"WB":"Other")
928 ); 964 );
965 }
929 save_var_mtrr(reg++, range_startk, sizek, type); 966 save_var_mtrr(reg++, range_startk, sizek, type);
930 range_startk += sizek; 967 range_startk += sizek;
931 range_sizek -= sizek; 968 range_sizek -= sizek;
@@ -970,6 +1007,8 @@ range_to_mtrr_with_hole(struct var_mtrr_state *state, unsigned long basek,
970 /* try to append some small hole */ 1007 /* try to append some small hole */
971 range0_basek = state->range_startk; 1008 range0_basek = state->range_startk;
972 range0_sizek = ALIGN(state->range_sizek, chunk_sizek); 1009 range0_sizek = ALIGN(state->range_sizek, chunk_sizek);
1010
1011 /* no increase */
973 if (range0_sizek == state->range_sizek) { 1012 if (range0_sizek == state->range_sizek) {
974 if (debug_print) 1013 if (debug_print)
975 printk(KERN_DEBUG "rangeX: %016lx - %016lx\n", 1014 printk(KERN_DEBUG "rangeX: %016lx - %016lx\n",
@@ -980,13 +1019,40 @@ range_to_mtrr_with_hole(struct var_mtrr_state *state, unsigned long basek,
980 return 0; 1019 return 0;
981 } 1020 }
982 1021
983 range0_sizek -= chunk_sizek; 1022 /* only cut back, when it is not the last */
984 if (range0_sizek && sizek) { 1023 if (sizek) {
985 while (range0_basek + range0_sizek > (basek + sizek)) { 1024 while (range0_basek + range0_sizek > (basek + sizek)) {
986 range0_sizek -= chunk_sizek; 1025 if (range0_sizek >= chunk_sizek)
987 if (!range0_sizek) 1026 range0_sizek -= chunk_sizek;
988 break; 1027 else
989 } 1028 range0_sizek = 0;
1029
1030 if (!range0_sizek)
1031 break;
1032 }
1033 }
1034
1035second_try:
1036 range_basek = range0_basek + range0_sizek;
1037
1038 /* one hole in the middle */
1039 if (range_basek > basek && range_basek <= (basek + sizek))
1040 second_sizek = range_basek - basek;
1041
1042 if (range0_sizek > state->range_sizek) {
1043
1044 /* one hole in middle or at end */
1045 hole_sizek = range0_sizek - state->range_sizek - second_sizek;
1046
1047 /* hole size should be less than half of range0 size */
1048 if (hole_sizek >= (range0_sizek >> 1) &&
1049 range0_sizek >= chunk_sizek) {
1050 range0_sizek -= chunk_sizek;
1051 second_sizek = 0;
1052 hole_sizek = 0;
1053
1054 goto second_try;
1055 }
990 } 1056 }
991 1057
992 if (range0_sizek) { 1058 if (range0_sizek) {
@@ -996,50 +1062,28 @@ range_to_mtrr_with_hole(struct var_mtrr_state *state, unsigned long basek,
996 (range0_basek + range0_sizek)<<10); 1062 (range0_basek + range0_sizek)<<10);
997 state->reg = range_to_mtrr(state->reg, range0_basek, 1063 state->reg = range_to_mtrr(state->reg, range0_basek,
998 range0_sizek, MTRR_TYPE_WRBACK); 1064 range0_sizek, MTRR_TYPE_WRBACK);
999
1000 }
1001
1002 range_basek = range0_basek + range0_sizek;
1003 range_sizek = chunk_sizek;
1004
1005 if (range_basek + range_sizek > basek &&
1006 range_basek + range_sizek <= (basek + sizek)) {
1007 /* one hole */
1008 second_basek = basek;
1009 second_sizek = range_basek + range_sizek - basek;
1010 } 1065 }
1011 1066
1012 /* if last piece, only could one hole near end */ 1067 if (range0_sizek < state->range_sizek) {
1013 if ((second_basek || !basek) && 1068 /* need to handle left over */
1014 range_sizek - (state->range_sizek - range0_sizek) - second_sizek <
1015 (chunk_sizek >> 1)) {
1016 /*
1017 * one hole in middle (second_sizek is 0) or at end
1018 * (second_sizek is 0 )
1019 */
1020 hole_sizek = range_sizek - (state->range_sizek - range0_sizek)
1021 - second_sizek;
1022 hole_basek = range_basek + range_sizek - hole_sizek
1023 - second_sizek;
1024 } else {
1025 /* fallback for big hole, or several holes */
1026 range_sizek = state->range_sizek - range0_sizek; 1069 range_sizek = state->range_sizek - range0_sizek;
1027 second_basek = 0; 1070
1028 second_sizek = 0; 1071 if (debug_print)
1072 printk(KERN_DEBUG "range: %016lx - %016lx\n",
1073 range_basek<<10,
1074 (range_basek + range_sizek)<<10);
1075 state->reg = range_to_mtrr(state->reg, range_basek,
1076 range_sizek, MTRR_TYPE_WRBACK);
1029 } 1077 }
1030 1078
1031 if (debug_print)
1032 printk(KERN_DEBUG "range: %016lx - %016lx\n", range_basek<<10,
1033 (range_basek + range_sizek)<<10);
1034 state->reg = range_to_mtrr(state->reg, range_basek, range_sizek,
1035 MTRR_TYPE_WRBACK);
1036 if (hole_sizek) { 1079 if (hole_sizek) {
1080 hole_basek = range_basek - hole_sizek - second_sizek;
1037 if (debug_print) 1081 if (debug_print)
1038 printk(KERN_DEBUG "hole: %016lx - %016lx\n", 1082 printk(KERN_DEBUG "hole: %016lx - %016lx\n",
1039 hole_basek<<10, (hole_basek + hole_sizek)<<10); 1083 hole_basek<<10,
1040 state->reg = range_to_mtrr(state->reg, hole_basek, hole_sizek, 1084 (hole_basek + hole_sizek)<<10);
1041 MTRR_TYPE_UNCACHABLE); 1085 state->reg = range_to_mtrr(state->reg, hole_basek,
1042 1086 hole_sizek, MTRR_TYPE_UNCACHABLE);
1043 } 1087 }
1044 1088
1045 return second_sizek; 1089 return second_sizek;
@@ -1154,11 +1198,11 @@ struct mtrr_cleanup_result {
1154}; 1198};
1155 1199
1156/* 1200/*
1157 * gran_size: 1M, 2M, ..., 2G 1201 * gran_size: 64K, 128K, 256K, 512K, 1M, 2M, ..., 2G
1158 * chunk size: gran_size, ..., 4G 1202 * chunk size: gran_size, ..., 2G
1159 * so we need (2+13)*6 1203 * so we need (1+16)*8
1160 */ 1204 */
1161#define NUM_RESULT 90 1205#define NUM_RESULT 136
1162#define PSHIFT (PAGE_SHIFT - 10) 1206#define PSHIFT (PAGE_SHIFT - 10)
1163 1207
1164static struct mtrr_cleanup_result __initdata result[NUM_RESULT]; 1208static struct mtrr_cleanup_result __initdata result[NUM_RESULT];
@@ -1168,13 +1212,14 @@ static unsigned long __initdata min_loss_pfn[RANGE_NUM];
1168static int __init mtrr_cleanup(unsigned address_bits) 1212static int __init mtrr_cleanup(unsigned address_bits)
1169{ 1213{
1170 unsigned long extra_remove_base, extra_remove_size; 1214 unsigned long extra_remove_base, extra_remove_size;
1171 unsigned long i, base, size, def, dummy; 1215 unsigned long base, size, def, dummy;
1172 mtrr_type type; 1216 mtrr_type type;
1173 int nr_range, nr_range_new; 1217 int nr_range, nr_range_new;
1174 u64 chunk_size, gran_size; 1218 u64 chunk_size, gran_size;
1175 unsigned long range_sums, range_sums_new; 1219 unsigned long range_sums, range_sums_new;
1176 int index_good; 1220 int index_good;
1177 int num_reg_good; 1221 int num_reg_good;
1222 int i;
1178 1223
1179 /* extra one for all 0 */ 1224 /* extra one for all 0 */
1180 int num[MTRR_NUM_TYPES + 1]; 1225 int num[MTRR_NUM_TYPES + 1];
@@ -1204,6 +1249,8 @@ static int __init mtrr_cleanup(unsigned address_bits)
1204 continue; 1249 continue;
1205 if (!size) 1250 if (!size)
1206 type = MTRR_NUM_TYPES; 1251 type = MTRR_NUM_TYPES;
1252 if (type == MTRR_TYPE_WRPROT)
1253 type = MTRR_TYPE_UNCACHABLE;
1207 num[type]++; 1254 num[type]++;
1208 } 1255 }
1209 1256
@@ -1216,23 +1263,57 @@ static int __init mtrr_cleanup(unsigned address_bits)
1216 num_var_ranges - num[MTRR_NUM_TYPES]) 1263 num_var_ranges - num[MTRR_NUM_TYPES])
1217 return 0; 1264 return 0;
1218 1265
1266 /* print original var MTRRs at first, for debugging: */
1267 printk(KERN_DEBUG "original variable MTRRs\n");
1268 for (i = 0; i < num_var_ranges; i++) {
1269 char start_factor = 'K', size_factor = 'K';
1270 unsigned long start_base, size_base;
1271
1272 size_base = range_state[i].size_pfn << (PAGE_SHIFT - 10);
1273 if (!size_base)
1274 continue;
1275
1276 size_base = to_size_factor(size_base, &size_factor),
1277 start_base = range_state[i].base_pfn << (PAGE_SHIFT - 10);
1278 start_base = to_size_factor(start_base, &start_factor),
1279 type = range_state[i].type;
1280
1281 printk(KERN_DEBUG "reg %d, base: %ld%cB, range: %ld%cB, type %s\n",
1282 i, start_base, start_factor,
1283 size_base, size_factor,
1284 (type == MTRR_TYPE_UNCACHABLE) ? "UC" :
1285 ((type == MTRR_TYPE_WRPROT) ? "WP" :
1286 ((type == MTRR_TYPE_WRBACK) ? "WB" : "Other"))
1287 );
1288 }
1289
1219 memset(range, 0, sizeof(range)); 1290 memset(range, 0, sizeof(range));
1220 extra_remove_size = 0; 1291 extra_remove_size = 0;
1221 if (mtrr_tom2) { 1292 extra_remove_base = 1 << (32 - PAGE_SHIFT);
1222 extra_remove_base = 1 << (32 - PAGE_SHIFT); 1293 if (mtrr_tom2)
1223 extra_remove_size = 1294 extra_remove_size =
1224 (mtrr_tom2 >> PAGE_SHIFT) - extra_remove_base; 1295 (mtrr_tom2 >> PAGE_SHIFT) - extra_remove_base;
1225 }
1226 nr_range = x86_get_mtrr_mem_range(range, 0, extra_remove_base, 1296 nr_range = x86_get_mtrr_mem_range(range, 0, extra_remove_base,
1227 extra_remove_size); 1297 extra_remove_size);
1298 /*
1299 * [0, 1M) should always be coverred by var mtrr with WB
1300 * and fixed mtrrs should take effective before var mtrr for it
1301 */
1302 nr_range = add_range_with_merge(range, nr_range, 0,
1303 (1ULL<<(20 - PAGE_SHIFT)) - 1);
1304 /* sort the ranges */
1305 sort(range, nr_range, sizeof(struct res_range), cmp_range, NULL);
1306
1228 range_sums = sum_ranges(range, nr_range); 1307 range_sums = sum_ranges(range, nr_range);
1229 printk(KERN_INFO "total RAM coverred: %ldM\n", 1308 printk(KERN_INFO "total RAM coverred: %ldM\n",
1230 range_sums >> (20 - PAGE_SHIFT)); 1309 range_sums >> (20 - PAGE_SHIFT));
1231 1310
1232 if (mtrr_chunk_size && mtrr_gran_size) { 1311 if (mtrr_chunk_size && mtrr_gran_size) {
1233 int num_reg; 1312 int num_reg;
1313 char gran_factor, chunk_factor, lose_factor;
1314 unsigned long gran_base, chunk_base, lose_base;
1234 1315
1235 debug_print = 1; 1316 debug_print++;
1236 /* convert ranges to var ranges state */ 1317 /* convert ranges to var ranges state */
1237 num_reg = x86_setup_var_mtrrs(range, nr_range, mtrr_chunk_size, 1318 num_reg = x86_setup_var_mtrrs(range, nr_range, mtrr_chunk_size,
1238 mtrr_gran_size); 1319 mtrr_gran_size);
@@ -1256,34 +1337,48 @@ static int __init mtrr_cleanup(unsigned address_bits)
1256 result[i].lose_cover_sizek = 1337 result[i].lose_cover_sizek =
1257 (range_sums - range_sums_new) << PSHIFT; 1338 (range_sums - range_sums_new) << PSHIFT;
1258 1339
1259 printk(KERN_INFO "%sgran_size: %ldM \tchunk_size: %ldM \t", 1340 gran_base = to_size_factor(result[i].gran_sizek, &gran_factor),
1260 result[i].bad?"*BAD*":" ", result[i].gran_sizek >> 10, 1341 chunk_base = to_size_factor(result[i].chunk_sizek, &chunk_factor),
1261 result[i].chunk_sizek >> 10); 1342 lose_base = to_size_factor(result[i].lose_cover_sizek, &lose_factor),
1262 printk(KERN_CONT "num_reg: %d \tlose cover RAM: %s%ldM \n", 1343 printk(KERN_INFO "%sgran_size: %ld%c \tchunk_size: %ld%c \t",
1344 result[i].bad?"*BAD*":" ",
1345 gran_base, gran_factor, chunk_base, chunk_factor);
1346 printk(KERN_CONT "num_reg: %d \tlose cover RAM: %s%ld%c\n",
1263 result[i].num_reg, result[i].bad?"-":"", 1347 result[i].num_reg, result[i].bad?"-":"",
1264 result[i].lose_cover_sizek >> 10); 1348 lose_base, lose_factor);
1265 if (!result[i].bad) { 1349 if (!result[i].bad) {
1266 set_var_mtrr_all(address_bits); 1350 set_var_mtrr_all(address_bits);
1267 return 1; 1351 return 1;
1268 } 1352 }
1269 printk(KERN_INFO "invalid mtrr_gran_size or mtrr_chunk_size, " 1353 printk(KERN_INFO "invalid mtrr_gran_size or mtrr_chunk_size, "
1270 "will find optimal one\n"); 1354 "will find optimal one\n");
1271 debug_print = 0; 1355 debug_print--;
1272 memset(result, 0, sizeof(result[0])); 1356 memset(result, 0, sizeof(result[0]));
1273 } 1357 }
1274 1358
1275 i = 0; 1359 i = 0;
1276 memset(min_loss_pfn, 0xff, sizeof(min_loss_pfn)); 1360 memset(min_loss_pfn, 0xff, sizeof(min_loss_pfn));
1277 memset(result, 0, sizeof(result)); 1361 memset(result, 0, sizeof(result));
1278 for (gran_size = (1ULL<<20); gran_size < (1ULL<<32); gran_size <<= 1) { 1362 for (gran_size = (1ULL<<16); gran_size < (1ULL<<32); gran_size <<= 1) {
1279 for (chunk_size = gran_size; chunk_size < (1ULL<<33); 1363 char gran_factor;
1364 unsigned long gran_base;
1365
1366 if (debug_print)
1367 gran_base = to_size_factor(gran_size >> 10, &gran_factor);
1368
1369 for (chunk_size = gran_size; chunk_size < (1ULL<<32);
1280 chunk_size <<= 1) { 1370 chunk_size <<= 1) {
1281 int num_reg; 1371 int num_reg;
1282 1372
1283 if (debug_print) 1373 if (debug_print) {
1284 printk(KERN_INFO 1374 char chunk_factor;
1285 "\ngran_size: %lldM chunk_size_size: %lldM\n", 1375 unsigned long chunk_base;
1286 gran_size >> 20, chunk_size >> 20); 1376
1377 chunk_base = to_size_factor(chunk_size>>10, &chunk_factor),
1378 printk(KERN_INFO "\n");
1379 printk(KERN_INFO "gran_size: %ld%c chunk_size: %ld%c \n",
1380 gran_base, gran_factor, chunk_base, chunk_factor);
1381 }
1287 if (i >= NUM_RESULT) 1382 if (i >= NUM_RESULT)
1288 continue; 1383 continue;
1289 1384
@@ -1326,12 +1421,18 @@ static int __init mtrr_cleanup(unsigned address_bits)
1326 1421
1327 /* print out all */ 1422 /* print out all */
1328 for (i = 0; i < NUM_RESULT; i++) { 1423 for (i = 0; i < NUM_RESULT; i++) {
1329 printk(KERN_INFO "%sgran_size: %ldM \tchunk_size: %ldM \t", 1424 char gran_factor, chunk_factor, lose_factor;
1330 result[i].bad?"*BAD* ":" ", result[i].gran_sizek >> 10, 1425 unsigned long gran_base, chunk_base, lose_base;
1331 result[i].chunk_sizek >> 10); 1426
1332 printk(KERN_CONT "num_reg: %d \tlose RAM: %s%ldM\n", 1427 gran_base = to_size_factor(result[i].gran_sizek, &gran_factor),
1333 result[i].num_reg, result[i].bad?"-":"", 1428 chunk_base = to_size_factor(result[i].chunk_sizek, &chunk_factor),
1334 result[i].lose_cover_sizek >> 10); 1429 lose_base = to_size_factor(result[i].lose_cover_sizek, &lose_factor),
1430 printk(KERN_INFO "%sgran_size: %ld%c \tchunk_size: %ld%c \t",
1431 result[i].bad?"*BAD*":" ",
1432 gran_base, gran_factor, chunk_base, chunk_factor);
1433 printk(KERN_CONT "num_reg: %d \tlose cover RAM: %s%ld%c\n",
1434 result[i].num_reg, result[i].bad?"-":"",
1435 lose_base, lose_factor);
1335 } 1436 }
1336 1437
1337 /* try to find the optimal index */ 1438 /* try to find the optimal index */
@@ -1339,10 +1440,8 @@ static int __init mtrr_cleanup(unsigned address_bits)
1339 nr_mtrr_spare_reg = num_var_ranges - 1; 1440 nr_mtrr_spare_reg = num_var_ranges - 1;
1340 num_reg_good = -1; 1441 num_reg_good = -1;
1341 for (i = num_var_ranges - nr_mtrr_spare_reg; i > 0; i--) { 1442 for (i = num_var_ranges - nr_mtrr_spare_reg; i > 0; i--) {
1342 if (!min_loss_pfn[i]) { 1443 if (!min_loss_pfn[i])
1343 num_reg_good = i; 1444 num_reg_good = i;
1344 break;
1345 }
1346 } 1445 }
1347 1446
1348 index_good = -1; 1447 index_good = -1;
@@ -1358,21 +1457,26 @@ static int __init mtrr_cleanup(unsigned address_bits)
1358 } 1457 }
1359 1458
1360 if (index_good != -1) { 1459 if (index_good != -1) {
1460 char gran_factor, chunk_factor, lose_factor;
1461 unsigned long gran_base, chunk_base, lose_base;
1462
1361 printk(KERN_INFO "Found optimal setting for mtrr clean up\n"); 1463 printk(KERN_INFO "Found optimal setting for mtrr clean up\n");
1362 i = index_good; 1464 i = index_good;
1363 printk(KERN_INFO "gran_size: %ldM \tchunk_size: %ldM \t", 1465 gran_base = to_size_factor(result[i].gran_sizek, &gran_factor),
1364 result[i].gran_sizek >> 10, 1466 chunk_base = to_size_factor(result[i].chunk_sizek, &chunk_factor),
1365 result[i].chunk_sizek >> 10); 1467 lose_base = to_size_factor(result[i].lose_cover_sizek, &lose_factor),
1366 printk(KERN_CONT "num_reg: %d \tlose RAM: %ldM\n", 1468 printk(KERN_INFO "gran_size: %ld%c \tchunk_size: %ld%c \t",
1367 result[i].num_reg, 1469 gran_base, gran_factor, chunk_base, chunk_factor);
1368 result[i].lose_cover_sizek >> 10); 1470 printk(KERN_CONT "num_reg: %d \tlose RAM: %ld%c\n",
1471 result[i].num_reg, lose_base, lose_factor);
1369 /* convert ranges to var ranges state */ 1472 /* convert ranges to var ranges state */
1370 chunk_size = result[i].chunk_sizek; 1473 chunk_size = result[i].chunk_sizek;
1371 chunk_size <<= 10; 1474 chunk_size <<= 10;
1372 gran_size = result[i].gran_sizek; 1475 gran_size = result[i].gran_sizek;
1373 gran_size <<= 10; 1476 gran_size <<= 10;
1374 debug_print = 1; 1477 debug_print++;
1375 x86_setup_var_mtrrs(range, nr_range, chunk_size, gran_size); 1478 x86_setup_var_mtrrs(range, nr_range, chunk_size, gran_size);
1479 debug_print--;
1376 set_var_mtrr_all(address_bits); 1480 set_var_mtrr_all(address_bits);
1377 return 1; 1481 return 1;
1378 } 1482 }
diff --git a/arch/x86/kernel/cpu/perfctr-watchdog.c b/arch/x86/kernel/cpu/perfctr-watchdog.c
index 05cc22dbd4ff..6bff382094f5 100644
--- a/arch/x86/kernel/cpu/perfctr-watchdog.c
+++ b/arch/x86/kernel/cpu/perfctr-watchdog.c
@@ -295,13 +295,19 @@ static int setup_k7_watchdog(unsigned nmi_hz)
295 /* setup the timer */ 295 /* setup the timer */
296 wrmsr(evntsel_msr, evntsel, 0); 296 wrmsr(evntsel_msr, evntsel, 0);
297 write_watchdog_counter(perfctr_msr, "K7_PERFCTR0",nmi_hz); 297 write_watchdog_counter(perfctr_msr, "K7_PERFCTR0",nmi_hz);
298 apic_write(APIC_LVTPC, APIC_DM_NMI);
299 evntsel |= K7_EVNTSEL_ENABLE;
300 wrmsr(evntsel_msr, evntsel, 0);
301 298
299 /* initialize the wd struct before enabling */
302 wd->perfctr_msr = perfctr_msr; 300 wd->perfctr_msr = perfctr_msr;
303 wd->evntsel_msr = evntsel_msr; 301 wd->evntsel_msr = evntsel_msr;
304 wd->cccr_msr = 0; /* unused */ 302 wd->cccr_msr = 0; /* unused */
303
304 /* ok, everything is initialized, announce that we're set */
305 cpu_nmi_set_wd_enabled();
306
307 apic_write(APIC_LVTPC, APIC_DM_NMI);
308 evntsel |= K7_EVNTSEL_ENABLE;
309 wrmsr(evntsel_msr, evntsel, 0);
310
305 return 1; 311 return 1;
306} 312}
307 313
@@ -379,13 +385,19 @@ static int setup_p6_watchdog(unsigned nmi_hz)
379 wrmsr(evntsel_msr, evntsel, 0); 385 wrmsr(evntsel_msr, evntsel, 0);
380 nmi_hz = adjust_for_32bit_ctr(nmi_hz); 386 nmi_hz = adjust_for_32bit_ctr(nmi_hz);
381 write_watchdog_counter32(perfctr_msr, "P6_PERFCTR0",nmi_hz); 387 write_watchdog_counter32(perfctr_msr, "P6_PERFCTR0",nmi_hz);
382 apic_write(APIC_LVTPC, APIC_DM_NMI);
383 evntsel |= P6_EVNTSEL0_ENABLE;
384 wrmsr(evntsel_msr, evntsel, 0);
385 388
389 /* initialize the wd struct before enabling */
386 wd->perfctr_msr = perfctr_msr; 390 wd->perfctr_msr = perfctr_msr;
387 wd->evntsel_msr = evntsel_msr; 391 wd->evntsel_msr = evntsel_msr;
388 wd->cccr_msr = 0; /* unused */ 392 wd->cccr_msr = 0; /* unused */
393
394 /* ok, everything is initialized, announce that we're set */
395 cpu_nmi_set_wd_enabled();
396
397 apic_write(APIC_LVTPC, APIC_DM_NMI);
398 evntsel |= P6_EVNTSEL0_ENABLE;
399 wrmsr(evntsel_msr, evntsel, 0);
400
389 return 1; 401 return 1;
390} 402}
391 403
@@ -432,6 +444,27 @@ static const struct wd_ops p6_wd_ops = {
432#define P4_CCCR_ENABLE (1 << 12) 444#define P4_CCCR_ENABLE (1 << 12)
433#define P4_CCCR_OVF (1 << 31) 445#define P4_CCCR_OVF (1 << 31)
434 446
447#define P4_CONTROLS 18
448static unsigned int p4_controls[18] = {
449 MSR_P4_BPU_CCCR0,
450 MSR_P4_BPU_CCCR1,
451 MSR_P4_BPU_CCCR2,
452 MSR_P4_BPU_CCCR3,
453 MSR_P4_MS_CCCR0,
454 MSR_P4_MS_CCCR1,
455 MSR_P4_MS_CCCR2,
456 MSR_P4_MS_CCCR3,
457 MSR_P4_FLAME_CCCR0,
458 MSR_P4_FLAME_CCCR1,
459 MSR_P4_FLAME_CCCR2,
460 MSR_P4_FLAME_CCCR3,
461 MSR_P4_IQ_CCCR0,
462 MSR_P4_IQ_CCCR1,
463 MSR_P4_IQ_CCCR2,
464 MSR_P4_IQ_CCCR3,
465 MSR_P4_IQ_CCCR4,
466 MSR_P4_IQ_CCCR5,
467};
435/* 468/*
436 * Set up IQ_COUNTER0 to behave like a clock, by having IQ_CCCR0 filter 469 * Set up IQ_COUNTER0 to behave like a clock, by having IQ_CCCR0 filter
437 * CRU_ESCR0 (with any non-null event selector) through a complemented 470 * CRU_ESCR0 (with any non-null event selector) through a complemented
@@ -473,6 +506,26 @@ static int setup_p4_watchdog(unsigned nmi_hz)
473 evntsel_msr = MSR_P4_CRU_ESCR0; 506 evntsel_msr = MSR_P4_CRU_ESCR0;
474 cccr_msr = MSR_P4_IQ_CCCR0; 507 cccr_msr = MSR_P4_IQ_CCCR0;
475 cccr_val = P4_CCCR_OVF_PMI0 | P4_CCCR_ESCR_SELECT(4); 508 cccr_val = P4_CCCR_OVF_PMI0 | P4_CCCR_ESCR_SELECT(4);
509
510 /*
511 * If we're on the kdump kernel or other situation, we may
512 * still have other performance counter registers set to
513 * interrupt and they'll keep interrupting forever because
514 * of the P4_CCCR_OVF quirk. So we need to ACK all the
515 * pending interrupts and disable all the registers here,
516 * before reenabling the NMI delivery. Refer to p4_rearm()
517 * about the P4_CCCR_OVF quirk.
518 */
519 if (reset_devices) {
520 unsigned int low, high;
521 int i;
522
523 for (i = 0; i < P4_CONTROLS; i++) {
524 rdmsr(p4_controls[i], low, high);
525 low &= ~(P4_CCCR_ENABLE | P4_CCCR_OVF);
526 wrmsr(p4_controls[i], low, high);
527 }
528 }
476 } else { 529 } else {
477 /* logical cpu 1 */ 530 /* logical cpu 1 */
478 perfctr_msr = MSR_P4_IQ_PERFCTR1; 531 perfctr_msr = MSR_P4_IQ_PERFCTR1;
@@ -499,12 +552,17 @@ static int setup_p4_watchdog(unsigned nmi_hz)
499 wrmsr(evntsel_msr, evntsel, 0); 552 wrmsr(evntsel_msr, evntsel, 0);
500 wrmsr(cccr_msr, cccr_val, 0); 553 wrmsr(cccr_msr, cccr_val, 0);
501 write_watchdog_counter(perfctr_msr, "P4_IQ_COUNTER0", nmi_hz); 554 write_watchdog_counter(perfctr_msr, "P4_IQ_COUNTER0", nmi_hz);
502 apic_write(APIC_LVTPC, APIC_DM_NMI); 555
503 cccr_val |= P4_CCCR_ENABLE;
504 wrmsr(cccr_msr, cccr_val, 0);
505 wd->perfctr_msr = perfctr_msr; 556 wd->perfctr_msr = perfctr_msr;
506 wd->evntsel_msr = evntsel_msr; 557 wd->evntsel_msr = evntsel_msr;
507 wd->cccr_msr = cccr_msr; 558 wd->cccr_msr = cccr_msr;
559
560 /* ok, everything is initialized, announce that we're set */
561 cpu_nmi_set_wd_enabled();
562
563 apic_write(APIC_LVTPC, APIC_DM_NMI);
564 cccr_val |= P4_CCCR_ENABLE;
565 wrmsr(cccr_msr, cccr_val, 0);
508 return 1; 566 return 1;
509} 567}
510 568
@@ -620,13 +678,17 @@ static int setup_intel_arch_watchdog(unsigned nmi_hz)
620 wrmsr(evntsel_msr, evntsel, 0); 678 wrmsr(evntsel_msr, evntsel, 0);
621 nmi_hz = adjust_for_32bit_ctr(nmi_hz); 679 nmi_hz = adjust_for_32bit_ctr(nmi_hz);
622 write_watchdog_counter32(perfctr_msr, "INTEL_ARCH_PERFCTR0", nmi_hz); 680 write_watchdog_counter32(perfctr_msr, "INTEL_ARCH_PERFCTR0", nmi_hz);
623 apic_write(APIC_LVTPC, APIC_DM_NMI);
624 evntsel |= ARCH_PERFMON_EVENTSEL0_ENABLE;
625 wrmsr(evntsel_msr, evntsel, 0);
626 681
627 wd->perfctr_msr = perfctr_msr; 682 wd->perfctr_msr = perfctr_msr;
628 wd->evntsel_msr = evntsel_msr; 683 wd->evntsel_msr = evntsel_msr;
629 wd->cccr_msr = 0; /* unused */ 684 wd->cccr_msr = 0; /* unused */
685
686 /* ok, everything is initialized, announce that we're set */
687 cpu_nmi_set_wd_enabled();
688
689 apic_write(APIC_LVTPC, APIC_DM_NMI);
690 evntsel |= ARCH_PERFMON_EVENTSEL0_ENABLE;
691 wrmsr(evntsel_msr, evntsel, 0);
630 intel_arch_wd_ops.checkbit = 1ULL << (eax.split.bit_width - 1); 692 intel_arch_wd_ops.checkbit = 1ULL << (eax.split.bit_width - 1);
631 return 1; 693 return 1;
632} 694}
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index 8e9cd6a8ec12..6a44d6465991 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -36,7 +36,6 @@
36#include <linux/smp_lock.h> 36#include <linux/smp_lock.h>
37#include <linux/major.h> 37#include <linux/major.h>
38#include <linux/fs.h> 38#include <linux/fs.h>
39#include <linux/smp_lock.h>
40#include <linux/device.h> 39#include <linux/device.h>
41#include <linux/cpu.h> 40#include <linux/cpu.h>
42#include <linux/notifier.h> 41#include <linux/notifier.h>
diff --git a/arch/x86/kernel/crash_dump_64.c b/arch/x86/kernel/crash_dump_64.c
index 15e6c6bc4a46..e90a60ef10c2 100644
--- a/arch/x86/kernel/crash_dump_64.c
+++ b/arch/x86/kernel/crash_dump_64.c
@@ -7,9 +7,8 @@
7 7
8#include <linux/errno.h> 8#include <linux/errno.h>
9#include <linux/crash_dump.h> 9#include <linux/crash_dump.h>
10 10#include <linux/uaccess.h>
11#include <asm/uaccess.h> 11#include <linux/io.h>
12#include <asm/io.h>
13 12
14/** 13/**
15 * copy_oldmem_page - copy one page from "oldmem" 14 * copy_oldmem_page - copy one page from "oldmem"
@@ -25,7 +24,7 @@
25 * in the current kernel. We stitch up a pte, similar to kmap_atomic. 24 * in the current kernel. We stitch up a pte, similar to kmap_atomic.
26 */ 25 */
27ssize_t copy_oldmem_page(unsigned long pfn, char *buf, 26ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
28 size_t csize, unsigned long offset, int userbuf) 27 size_t csize, unsigned long offset, int userbuf)
29{ 28{
30 void *vaddr; 29 void *vaddr;
31 30
@@ -33,14 +32,16 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
33 return 0; 32 return 0;
34 33
35 vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE); 34 vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
35 if (!vaddr)
36 return -ENOMEM;
36 37
37 if (userbuf) { 38 if (userbuf) {
38 if (copy_to_user(buf, (vaddr + offset), csize)) { 39 if (copy_to_user(buf, vaddr + offset, csize)) {
39 iounmap(vaddr); 40 iounmap(vaddr);
40 return -EFAULT; 41 return -EFAULT;
41 } 42 }
42 } else 43 } else
43 memcpy(buf, (vaddr + offset), csize); 44 memcpy(buf, vaddr + offset, csize);
44 45
45 iounmap(vaddr); 46 iounmap(vaddr);
46 return csize; 47 return csize;
diff --git a/arch/x86/kernel/ds.c b/arch/x86/kernel/ds.c
index ab21c270bfa4..2b69994fd3a8 100644
--- a/arch/x86/kernel/ds.c
+++ b/arch/x86/kernel/ds.c
@@ -479,12 +479,12 @@ static int ds_release(struct task_struct *task, enum ds_qualifier qual)
479 goto out; 479 goto out;
480 480
481 kfree(context->buffer[qual]); 481 kfree(context->buffer[qual]);
482 context->buffer[qual] = 0; 482 context->buffer[qual] = NULL;
483 483
484 current->mm->total_vm -= context->pages[qual]; 484 current->mm->total_vm -= context->pages[qual];
485 current->mm->locked_vm -= context->pages[qual]; 485 current->mm->locked_vm -= context->pages[qual];
486 context->pages[qual] = 0; 486 context->pages[qual] = 0;
487 context->owner[qual] = 0; 487 context->owner[qual] = NULL;
488 488
489 /* 489 /*
490 * we put the context twice: 490 * we put the context twice:
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index 4353cf5e6fac..24bb5faf5efa 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -95,6 +95,20 @@ static void __init nvidia_bugs(int num, int slot, int func)
95 95
96} 96}
97 97
98#ifdef CONFIG_DMAR
99static void __init intel_g33_dmar(int num, int slot, int func)
100{
101 struct acpi_table_header *dmar_tbl;
102 acpi_status status;
103
104 status = acpi_get_table(ACPI_SIG_DMAR, 0, &dmar_tbl);
105 if (ACPI_SUCCESS(status)) {
106 printk(KERN_INFO "BIOS BUG: DMAR advertised on Intel G31/G33 chipset -- ignoring\n");
107 dmar_disabled = 1;
108 }
109}
110#endif
111
98#define QFLAG_APPLY_ONCE 0x1 112#define QFLAG_APPLY_ONCE 0x1
99#define QFLAG_APPLIED 0x2 113#define QFLAG_APPLIED 0x2
100#define QFLAG_DONE (QFLAG_APPLY_ONCE|QFLAG_APPLIED) 114#define QFLAG_DONE (QFLAG_APPLY_ONCE|QFLAG_APPLIED)
@@ -114,6 +128,10 @@ static struct chipset early_qrk[] __initdata = {
114 PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, via_bugs }, 128 PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, via_bugs },
115 { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB, 129 { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB,
116 PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, fix_hypertransport_config }, 130 PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, fix_hypertransport_config },
131#ifdef CONFIG_DMAR
132 { PCI_VENDOR_ID_INTEL, 0x29c0,
133 PCI_CLASS_BRIDGE_HOST, PCI_ANY_ID, 0, intel_g33_dmar },
134#endif
117 {} 135 {}
118}; 136};
119 137
diff --git a/arch/x86/kernel/efi.c b/arch/x86/kernel/efi.c
index 06cc8d4254b1..945a31cdd81f 100644
--- a/arch/x86/kernel/efi.c
+++ b/arch/x86/kernel/efi.c
@@ -414,9 +414,11 @@ void __init efi_init(void)
414 if (memmap.map == NULL) 414 if (memmap.map == NULL)
415 printk(KERN_ERR "Could not map the EFI memory map!\n"); 415 printk(KERN_ERR "Could not map the EFI memory map!\n");
416 memmap.map_end = memmap.map + (memmap.nr_map * memmap.desc_size); 416 memmap.map_end = memmap.map + (memmap.nr_map * memmap.desc_size);
417
417 if (memmap.desc_size != sizeof(efi_memory_desc_t)) 418 if (memmap.desc_size != sizeof(efi_memory_desc_t))
418 printk(KERN_WARNING "Kernel-defined memdesc" 419 printk(KERN_WARNING
419 "doesn't match the one from EFI!\n"); 420 "Kernel-defined memdesc doesn't match the one from EFI!\n");
421
420 if (add_efi_memmap) 422 if (add_efi_memmap)
421 do_add_efi_memmap(); 423 do_add_efi_memmap();
422 424
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 9bfc4d72fb2e..d16084f90649 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -108,12 +108,11 @@ void __init x86_64_start_kernel(char * real_mode_data)
108 } 108 }
109 load_idt((const struct desc_ptr *)&idt_descr); 109 load_idt((const struct desc_ptr *)&idt_descr);
110 110
111 early_printk("Kernel alive\n"); 111 if (console_loglevel == 10)
112 early_printk("Kernel alive\n");
112 113
113 x86_64_init_pda(); 114 x86_64_init_pda();
114 115
115 early_printk("Kernel really alive\n");
116
117 x86_64_start_reservations(real_mode_data); 116 x86_64_start_reservations(real_mode_data);
118} 117}
119 118
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index a7010c3a377a..e835b4eea70b 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -172,10 +172,6 @@ num_subarch_entries = (. - subarch_entries) / 4
172 * 172 *
173 * Note that the stack is not yet set up! 173 * Note that the stack is not yet set up!
174 */ 174 */
175#define PTE_ATTR 0x007 /* PRESENT+RW+USER */
176#define PDE_ATTR 0x067 /* PRESENT+RW+USER+DIRTY+ACCESSED */
177#define PGD_ATTR 0x001 /* PRESENT (no other attributes) */
178
179default_entry: 175default_entry:
180#ifdef CONFIG_X86_PAE 176#ifdef CONFIG_X86_PAE
181 177
@@ -196,9 +192,9 @@ default_entry:
196 movl $pa(pg0), %edi 192 movl $pa(pg0), %edi
197 movl %edi, pa(init_pg_tables_start) 193 movl %edi, pa(init_pg_tables_start)
198 movl $pa(swapper_pg_pmd), %edx 194 movl $pa(swapper_pg_pmd), %edx
199 movl $PTE_ATTR, %eax 195 movl $PTE_IDENT_ATTR, %eax
20010: 19610:
201 leal PDE_ATTR(%edi),%ecx /* Create PMD entry */ 197 leal PDE_IDENT_ATTR(%edi),%ecx /* Create PMD entry */
202 movl %ecx,(%edx) /* Store PMD entry */ 198 movl %ecx,(%edx) /* Store PMD entry */
203 /* Upper half already zero */ 199 /* Upper half already zero */
204 addl $8,%edx 200 addl $8,%edx
@@ -215,7 +211,7 @@ default_entry:
215 * End condition: we must map up to and including INIT_MAP_BEYOND_END 211 * End condition: we must map up to and including INIT_MAP_BEYOND_END
216 * bytes beyond the end of our own page tables. 212 * bytes beyond the end of our own page tables.
217 */ 213 */
218 leal (INIT_MAP_BEYOND_END+PTE_ATTR)(%edi),%ebp 214 leal (INIT_MAP_BEYOND_END+PTE_IDENT_ATTR)(%edi),%ebp
219 cmpl %ebp,%eax 215 cmpl %ebp,%eax
220 jb 10b 216 jb 10b
2211: 2171:
@@ -224,7 +220,7 @@ default_entry:
224 movl %eax, pa(max_pfn_mapped) 220 movl %eax, pa(max_pfn_mapped)
225 221
226 /* Do early initialization of the fixmap area */ 222 /* Do early initialization of the fixmap area */
227 movl $pa(swapper_pg_fixmap)+PDE_ATTR,%eax 223 movl $pa(swapper_pg_fixmap)+PDE_IDENT_ATTR,%eax
228 movl %eax,pa(swapper_pg_pmd+0x1000*KPMDS-8) 224 movl %eax,pa(swapper_pg_pmd+0x1000*KPMDS-8)
229#else /* Not PAE */ 225#else /* Not PAE */
230 226
@@ -233,9 +229,9 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
233 movl $pa(pg0), %edi 229 movl $pa(pg0), %edi
234 movl %edi, pa(init_pg_tables_start) 230 movl %edi, pa(init_pg_tables_start)
235 movl $pa(swapper_pg_dir), %edx 231 movl $pa(swapper_pg_dir), %edx
236 movl $PTE_ATTR, %eax 232 movl $PTE_IDENT_ATTR, %eax
23710: 23310:
238 leal PDE_ATTR(%edi),%ecx /* Create PDE entry */ 234 leal PDE_IDENT_ATTR(%edi),%ecx /* Create PDE entry */
239 movl %ecx,(%edx) /* Store identity PDE entry */ 235 movl %ecx,(%edx) /* Store identity PDE entry */
240 movl %ecx,page_pde_offset(%edx) /* Store kernel PDE entry */ 236 movl %ecx,page_pde_offset(%edx) /* Store kernel PDE entry */
241 addl $4,%edx 237 addl $4,%edx
@@ -249,7 +245,7 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
249 * bytes beyond the end of our own page tables; the +0x007 is 245 * bytes beyond the end of our own page tables; the +0x007 is
250 * the attribute bits 246 * the attribute bits
251 */ 247 */
252 leal (INIT_MAP_BEYOND_END+PTE_ATTR)(%edi),%ebp 248 leal (INIT_MAP_BEYOND_END+PTE_IDENT_ATTR)(%edi),%ebp
253 cmpl %ebp,%eax 249 cmpl %ebp,%eax
254 jb 10b 250 jb 10b
255 movl %edi,pa(init_pg_tables_end) 251 movl %edi,pa(init_pg_tables_end)
@@ -257,7 +253,7 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
257 movl %eax, pa(max_pfn_mapped) 253 movl %eax, pa(max_pfn_mapped)
258 254
259 /* Do early initialization of the fixmap area */ 255 /* Do early initialization of the fixmap area */
260 movl $pa(swapper_pg_fixmap)+PDE_ATTR,%eax 256 movl $pa(swapper_pg_fixmap)+PDE_IDENT_ATTR,%eax
261 movl %eax,pa(swapper_pg_dir+0xffc) 257 movl %eax,pa(swapper_pg_dir+0xffc)
262#endif 258#endif
263 jmp 3f 259 jmp 3f
@@ -634,19 +630,19 @@ ENTRY(empty_zero_page)
634 /* Page-aligned for the benefit of paravirt? */ 630 /* Page-aligned for the benefit of paravirt? */
635 .align PAGE_SIZE_asm 631 .align PAGE_SIZE_asm
636ENTRY(swapper_pg_dir) 632ENTRY(swapper_pg_dir)
637 .long pa(swapper_pg_pmd+PGD_ATTR),0 /* low identity map */ 633 .long pa(swapper_pg_pmd+PGD_IDENT_ATTR),0 /* low identity map */
638# if KPMDS == 3 634# if KPMDS == 3
639 .long pa(swapper_pg_pmd+PGD_ATTR),0 635 .long pa(swapper_pg_pmd+PGD_IDENT_ATTR),0
640 .long pa(swapper_pg_pmd+PGD_ATTR+0x1000),0 636 .long pa(swapper_pg_pmd+PGD_IDENT_ATTR+0x1000),0
641 .long pa(swapper_pg_pmd+PGD_ATTR+0x2000),0 637 .long pa(swapper_pg_pmd+PGD_IDENT_ATTR+0x2000),0
642# elif KPMDS == 2 638# elif KPMDS == 2
643 .long 0,0 639 .long 0,0
644 .long pa(swapper_pg_pmd+PGD_ATTR),0 640 .long pa(swapper_pg_pmd+PGD_IDENT_ATTR),0
645 .long pa(swapper_pg_pmd+PGD_ATTR+0x1000),0 641 .long pa(swapper_pg_pmd+PGD_IDENT_ATTR+0x1000),0
646# elif KPMDS == 1 642# elif KPMDS == 1
647 .long 0,0 643 .long 0,0
648 .long 0,0 644 .long 0,0
649 .long pa(swapper_pg_pmd+PGD_ATTR),0 645 .long pa(swapper_pg_pmd+PGD_IDENT_ATTR),0
650# else 646# else
651# error "Kernel PMDs should be 1, 2 or 3" 647# error "Kernel PMDs should be 1, 2 or 3"
652# endif 648# endif
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index db3280afe886..26cfdc1d7c7f 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -110,7 +110,7 @@ startup_64:
110 movq %rdi, %rax 110 movq %rdi, %rax
111 shrq $PMD_SHIFT, %rax 111 shrq $PMD_SHIFT, %rax
112 andq $(PTRS_PER_PMD - 1), %rax 112 andq $(PTRS_PER_PMD - 1), %rax
113 leaq __PAGE_KERNEL_LARGE_EXEC(%rdi), %rdx 113 leaq __PAGE_KERNEL_IDENT_LARGE_EXEC(%rdi), %rdx
114 leaq level2_spare_pgt(%rip), %rbx 114 leaq level2_spare_pgt(%rip), %rbx
115 movq %rdx, 0(%rbx, %rax, 8) 115 movq %rdx, 0(%rbx, %rax, 8)
116ident_complete: 116ident_complete:
@@ -374,7 +374,7 @@ NEXT_PAGE(level2_ident_pgt)
374 /* Since I easily can, map the first 1G. 374 /* Since I easily can, map the first 1G.
375 * Don't set NX because code runs from these pages. 375 * Don't set NX because code runs from these pages.
376 */ 376 */
377 PMDS(0, __PAGE_KERNEL_LARGE_EXEC, PTRS_PER_PMD) 377 PMDS(0, __PAGE_KERNEL_IDENT_LARGE_EXEC, PTRS_PER_PMD)
378 378
379NEXT_PAGE(level2_kernel_pgt) 379NEXT_PAGE(level2_kernel_pgt)
380 /* 380 /*
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 1cf8c1fcc088..b71e02d42f4f 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -325,7 +325,7 @@ skip:
325 for_each_online_cpu(j) 325 for_each_online_cpu(j)
326 seq_printf(p, "%10u ", 326 seq_printf(p, "%10u ",
327 per_cpu(irq_stat,j).irq_call_count); 327 per_cpu(irq_stat,j).irq_call_count);
328 seq_printf(p, " function call interrupts\n"); 328 seq_printf(p, " Function call interrupts\n");
329 seq_printf(p, "TLB: "); 329 seq_printf(p, "TLB: ");
330 for_each_online_cpu(j) 330 for_each_online_cpu(j)
331 seq_printf(p, "%10u ", 331 seq_printf(p, "%10u ",
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index 1f78b238d8d2..f065fe9071b9 100644
--- a/arch/x86/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
@@ -129,7 +129,7 @@ skip:
129 seq_printf(p, "CAL: "); 129 seq_printf(p, "CAL: ");
130 for_each_online_cpu(j) 130 for_each_online_cpu(j)
131 seq_printf(p, "%10u ", cpu_pda(j)->irq_call_count); 131 seq_printf(p, "%10u ", cpu_pda(j)->irq_call_count);
132 seq_printf(p, " function call interrupts\n"); 132 seq_printf(p, " Function call interrupts\n");
133 seq_printf(p, "TLB: "); 133 seq_printf(p, "TLB: ");
134 for_each_online_cpu(j) 134 for_each_online_cpu(j)
135 seq_printf(p, "%10u ", cpu_pda(j)->irq_tlb_count); 135 seq_printf(p, "%10u ", cpu_pda(j)->irq_tlb_count);
diff --git a/arch/x86/kernel/k8.c b/arch/x86/kernel/k8.c
index 7377ccb21335..304d8bad6559 100644
--- a/arch/x86/kernel/k8.c
+++ b/arch/x86/kernel/k8.c
@@ -16,8 +16,9 @@ EXPORT_SYMBOL(num_k8_northbridges);
16static u32 *flush_words; 16static u32 *flush_words;
17 17
18struct pci_device_id k8_nb_ids[] = { 18struct pci_device_id k8_nb_ids[] = {
19 { PCI_DEVICE(PCI_VENDOR_ID_AMD, 0x1103) }, 19 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_K8_NB_MISC) },
20 { PCI_DEVICE(PCI_VENDOR_ID_AMD, 0x1203) }, 20 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) },
21 { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) },
21 {} 22 {}
22}; 23};
23EXPORT_SYMBOL(k8_nb_ids); 24EXPORT_SYMBOL(k8_nb_ids);
diff --git a/arch/x86/kernel/kdebugfs.c b/arch/x86/kernel/kdebugfs.c
index f2d43bc75514..ff7d3b0124f1 100644
--- a/arch/x86/kernel/kdebugfs.c
+++ b/arch/x86/kernel/kdebugfs.c
@@ -139,6 +139,7 @@ static int __init create_setup_data_nodes(struct dentry *parent)
139 if (PageHighMem(pg)) { 139 if (PageHighMem(pg)) {
140 data = ioremap_cache(pa_data, sizeof(*data)); 140 data = ioremap_cache(pa_data, sizeof(*data));
141 if (!data) { 141 if (!data) {
142 kfree(node);
142 error = -ENXIO; 143 error = -ENXIO;
143 goto err_dir; 144 goto err_dir;
144 } 145 }
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index f47f0eb886b8..10435a120d22 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -69,6 +69,9 @@ static int gdb_x86vector = -1;
69 */ 69 */
70void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) 70void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
71{ 71{
72#ifndef CONFIG_X86_32
73 u32 *gdb_regs32 = (u32 *)gdb_regs;
74#endif
72 gdb_regs[GDB_AX] = regs->ax; 75 gdb_regs[GDB_AX] = regs->ax;
73 gdb_regs[GDB_BX] = regs->bx; 76 gdb_regs[GDB_BX] = regs->bx;
74 gdb_regs[GDB_CX] = regs->cx; 77 gdb_regs[GDB_CX] = regs->cx;
@@ -76,9 +79,9 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
76 gdb_regs[GDB_SI] = regs->si; 79 gdb_regs[GDB_SI] = regs->si;
77 gdb_regs[GDB_DI] = regs->di; 80 gdb_regs[GDB_DI] = regs->di;
78 gdb_regs[GDB_BP] = regs->bp; 81 gdb_regs[GDB_BP] = regs->bp;
79 gdb_regs[GDB_PS] = regs->flags;
80 gdb_regs[GDB_PC] = regs->ip; 82 gdb_regs[GDB_PC] = regs->ip;
81#ifdef CONFIG_X86_32 83#ifdef CONFIG_X86_32
84 gdb_regs[GDB_PS] = regs->flags;
82 gdb_regs[GDB_DS] = regs->ds; 85 gdb_regs[GDB_DS] = regs->ds;
83 gdb_regs[GDB_ES] = regs->es; 86 gdb_regs[GDB_ES] = regs->es;
84 gdb_regs[GDB_CS] = regs->cs; 87 gdb_regs[GDB_CS] = regs->cs;
@@ -94,6 +97,9 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
94 gdb_regs[GDB_R13] = regs->r13; 97 gdb_regs[GDB_R13] = regs->r13;
95 gdb_regs[GDB_R14] = regs->r14; 98 gdb_regs[GDB_R14] = regs->r14;
96 gdb_regs[GDB_R15] = regs->r15; 99 gdb_regs[GDB_R15] = regs->r15;
100 gdb_regs32[GDB_PS] = regs->flags;
101 gdb_regs32[GDB_CS] = regs->cs;
102 gdb_regs32[GDB_SS] = regs->ss;
97#endif 103#endif
98 gdb_regs[GDB_SP] = regs->sp; 104 gdb_regs[GDB_SP] = regs->sp;
99} 105}
@@ -112,6 +118,9 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
112 */ 118 */
113void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) 119void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
114{ 120{
121#ifndef CONFIG_X86_32
122 u32 *gdb_regs32 = (u32 *)gdb_regs;
123#endif
115 gdb_regs[GDB_AX] = 0; 124 gdb_regs[GDB_AX] = 0;
116 gdb_regs[GDB_BX] = 0; 125 gdb_regs[GDB_BX] = 0;
117 gdb_regs[GDB_CX] = 0; 126 gdb_regs[GDB_CX] = 0;
@@ -129,8 +138,10 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
129 gdb_regs[GDB_FS] = 0xFFFF; 138 gdb_regs[GDB_FS] = 0xFFFF;
130 gdb_regs[GDB_GS] = 0xFFFF; 139 gdb_regs[GDB_GS] = 0xFFFF;
131#else 140#else
132 gdb_regs[GDB_PS] = *(unsigned long *)(p->thread.sp + 8); 141 gdb_regs32[GDB_PS] = *(unsigned long *)(p->thread.sp + 8);
133 gdb_regs[GDB_PC] = 0; 142 gdb_regs32[GDB_CS] = __KERNEL_CS;
143 gdb_regs32[GDB_SS] = __KERNEL_DS;
144 gdb_regs[GDB_PC] = p->thread.ip;
134 gdb_regs[GDB_R8] = 0; 145 gdb_regs[GDB_R8] = 0;
135 gdb_regs[GDB_R9] = 0; 146 gdb_regs[GDB_R9] = 0;
136 gdb_regs[GDB_R10] = 0; 147 gdb_regs[GDB_R10] = 0;
@@ -153,6 +164,9 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
153 */ 164 */
154void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs) 165void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
155{ 166{
167#ifndef CONFIG_X86_32
168 u32 *gdb_regs32 = (u32 *)gdb_regs;
169#endif
156 regs->ax = gdb_regs[GDB_AX]; 170 regs->ax = gdb_regs[GDB_AX];
157 regs->bx = gdb_regs[GDB_BX]; 171 regs->bx = gdb_regs[GDB_BX];
158 regs->cx = gdb_regs[GDB_CX]; 172 regs->cx = gdb_regs[GDB_CX];
@@ -160,9 +174,9 @@ void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
160 regs->si = gdb_regs[GDB_SI]; 174 regs->si = gdb_regs[GDB_SI];
161 regs->di = gdb_regs[GDB_DI]; 175 regs->di = gdb_regs[GDB_DI];
162 regs->bp = gdb_regs[GDB_BP]; 176 regs->bp = gdb_regs[GDB_BP];
163 regs->flags = gdb_regs[GDB_PS];
164 regs->ip = gdb_regs[GDB_PC]; 177 regs->ip = gdb_regs[GDB_PC];
165#ifdef CONFIG_X86_32 178#ifdef CONFIG_X86_32
179 regs->flags = gdb_regs[GDB_PS];
166 regs->ds = gdb_regs[GDB_DS]; 180 regs->ds = gdb_regs[GDB_DS];
167 regs->es = gdb_regs[GDB_ES]; 181 regs->es = gdb_regs[GDB_ES];
168 regs->cs = gdb_regs[GDB_CS]; 182 regs->cs = gdb_regs[GDB_CS];
@@ -175,6 +189,9 @@ void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
175 regs->r13 = gdb_regs[GDB_R13]; 189 regs->r13 = gdb_regs[GDB_R13];
176 regs->r14 = gdb_regs[GDB_R14]; 190 regs->r14 = gdb_regs[GDB_R14];
177 regs->r15 = gdb_regs[GDB_R15]; 191 regs->r15 = gdb_regs[GDB_R15];
192 regs->flags = gdb_regs32[GDB_PS];
193 regs->cs = gdb_regs32[GDB_CS];
194 regs->ss = gdb_regs32[GDB_SS];
178#endif 195#endif
179} 196}
180 197
@@ -378,10 +395,8 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
378 if (remcomInBuffer[0] == 's') { 395 if (remcomInBuffer[0] == 's') {
379 linux_regs->flags |= X86_EFLAGS_TF; 396 linux_regs->flags |= X86_EFLAGS_TF;
380 kgdb_single_step = 1; 397 kgdb_single_step = 1;
381 if (kgdb_contthread) { 398 atomic_set(&kgdb_cpu_doing_single_step,
382 atomic_set(&kgdb_cpu_doing_single_step, 399 raw_smp_processor_id());
383 raw_smp_processor_id());
384 }
385 } 400 }
386 401
387 get_debugreg(dr6, 6); 402 get_debugreg(dr6, 6);
@@ -440,12 +455,7 @@ static int __kgdb_notify(struct die_args *args, unsigned long cmd)
440 return NOTIFY_DONE; 455 return NOTIFY_DONE;
441 456
442 case DIE_NMI_IPI: 457 case DIE_NMI_IPI:
443 if (atomic_read(&kgdb_active) != -1) { 458 /* Just ignore, we will handle the roundup on DIE_NMI. */
444 /* KGDB CPU roundup */
445 kgdb_nmicallback(raw_smp_processor_id(), regs);
446 was_in_debug_nmi[raw_smp_processor_id()] = 1;
447 touch_nmi_watchdog();
448 }
449 return NOTIFY_DONE; 459 return NOTIFY_DONE;
450 460
451 case DIE_NMIUNKNOWN: 461 case DIE_NMIUNKNOWN:
@@ -466,9 +476,15 @@ static int __kgdb_notify(struct die_args *args, unsigned long cmd)
466 476
467 case DIE_DEBUG: 477 case DIE_DEBUG:
468 if (atomic_read(&kgdb_cpu_doing_single_step) == 478 if (atomic_read(&kgdb_cpu_doing_single_step) ==
469 raw_smp_processor_id() && 479 raw_smp_processor_id()) {
470 user_mode(regs)) 480 if (user_mode(regs))
471 return single_step_cont(regs, args); 481 return single_step_cont(regs, args);
482 break;
483 } else if (test_thread_flag(TIF_SINGLESTEP))
484 /* This means a user thread is single stepping
485 * a system call which should be ignored
486 */
487 return NOTIFY_DONE;
472 /* fall through */ 488 /* fall through */
473 default: 489 default:
474 if (user_mode(regs)) 490 if (user_mode(regs))
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 8b7a3cf37d2b..478bca986eca 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -178,7 +178,7 @@ static void kvm_flush_tlb(void)
178 kvm_deferred_mmu_op(&ftlb, sizeof ftlb); 178 kvm_deferred_mmu_op(&ftlb, sizeof ftlb);
179} 179}
180 180
181static void kvm_release_pt(u32 pfn) 181static void kvm_release_pt(unsigned long pfn)
182{ 182{
183 struct kvm_mmu_op_release_pt rpt = { 183 struct kvm_mmu_op_release_pt rpt = {
184 .header.op = KVM_MMU_OP_RELEASE_PT, 184 .header.op = KVM_MMU_OP_RELEASE_PT,
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
index abb78a2cc4ad..2c97f07f1c2c 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -299,6 +299,15 @@ void acpi_nmi_disable(void)
299 on_each_cpu(__acpi_nmi_disable, NULL, 1); 299 on_each_cpu(__acpi_nmi_disable, NULL, 1);
300} 300}
301 301
302/*
303 * This function is called as soon the LAPIC NMI watchdog driver has everything
304 * in place and it's ready to check if the NMIs belong to the NMI watchdog
305 */
306void cpu_nmi_set_wd_enabled(void)
307{
308 __get_cpu_var(wd_enabled) = 1;
309}
310
302void setup_apic_nmi_watchdog(void *unused) 311void setup_apic_nmi_watchdog(void *unused)
303{ 312{
304 if (__get_cpu_var(wd_enabled)) 313 if (__get_cpu_var(wd_enabled))
@@ -311,8 +320,6 @@ void setup_apic_nmi_watchdog(void *unused)
311 320
312 switch (nmi_watchdog) { 321 switch (nmi_watchdog) {
313 case NMI_LOCAL_APIC: 322 case NMI_LOCAL_APIC:
314 /* enable it before to avoid race with handler */
315 __get_cpu_var(wd_enabled) = 1;
316 if (lapic_watchdog_init(nmi_hz) < 0) { 323 if (lapic_watchdog_init(nmi_hz) < 0) {
317 __get_cpu_var(wd_enabled) = 0; 324 __get_cpu_var(wd_enabled) = 0;
318 return; 325 return;
diff --git a/arch/x86/kernel/olpc.c b/arch/x86/kernel/olpc.c
index 3e6672274807..7a13fac63a1f 100644
--- a/arch/x86/kernel/olpc.c
+++ b/arch/x86/kernel/olpc.c
@@ -190,12 +190,12 @@ EXPORT_SYMBOL_GPL(olpc_ec_cmd);
190static void __init platform_detect(void) 190static void __init platform_detect(void)
191{ 191{
192 size_t propsize; 192 size_t propsize;
193 u32 rev; 193 __be32 rev;
194 194
195 if (ofw("getprop", 4, 1, NULL, "board-revision-int", &rev, 4, 195 if (ofw("getprop", 4, 1, NULL, "board-revision-int", &rev, 4,
196 &propsize) || propsize != 4) { 196 &propsize) || propsize != 4) {
197 printk(KERN_ERR "ofw: getprop call failed!\n"); 197 printk(KERN_ERR "ofw: getprop call failed!\n");
198 rev = 0; 198 rev = cpu_to_be32(0);
199 } 199 }
200 olpc_platform_info.boardrev = be32_to_cpu(rev); 200 olpc_platform_info.boardrev = be32_to_cpu(rev);
201} 201}
@@ -203,7 +203,7 @@ static void __init platform_detect(void)
203static void __init platform_detect(void) 203static void __init platform_detect(void)
204{ 204{
205 /* stopgap until OFW support is added to the kernel */ 205 /* stopgap until OFW support is added to the kernel */
206 olpc_platform_info.boardrev = be32_to_cpu(0xc2); 206 olpc_platform_info.boardrev = 0xc2;
207} 207}
208#endif 208#endif
209 209
diff --git a/arch/x86/kernel/paravirt_patch_32.c b/arch/x86/kernel/paravirt_patch_32.c
index 58262218781b..9fe644f4861d 100644
--- a/arch/x86/kernel/paravirt_patch_32.c
+++ b/arch/x86/kernel/paravirt_patch_32.c
@@ -23,7 +23,7 @@ unsigned native_patch(u8 type, u16 clobbers, void *ibuf,
23 start = start_##ops##_##x; \ 23 start = start_##ops##_##x; \
24 end = end_##ops##_##x; \ 24 end = end_##ops##_##x; \
25 goto patch_site 25 goto patch_site
26 switch(type) { 26 switch (type) {
27 PATCH_SITE(pv_irq_ops, irq_disable); 27 PATCH_SITE(pv_irq_ops, irq_disable);
28 PATCH_SITE(pv_irq_ops, irq_enable); 28 PATCH_SITE(pv_irq_ops, irq_enable);
29 PATCH_SITE(pv_irq_ops, restore_fl); 29 PATCH_SITE(pv_irq_ops, restore_fl);
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
index dcdac6c826e9..080d1d27f37a 100644
--- a/arch/x86/kernel/pci-calgary_64.c
+++ b/arch/x86/kernel/pci-calgary_64.c
@@ -261,7 +261,7 @@ static void iommu_range_reserve(struct iommu_table *tbl,
261 badbit, tbl, start_addr, npages); 261 badbit, tbl, start_addr, npages);
262 } 262 }
263 263
264 set_bit_string(tbl->it_map, index, npages); 264 iommu_area_reserve(tbl->it_map, index, npages);
265 265
266 spin_unlock_irqrestore(&tbl->it_lock, flags); 266 spin_unlock_irqrestore(&tbl->it_lock, flags);
267} 267}
@@ -491,6 +491,8 @@ static void* calgary_alloc_coherent(struct device *dev, size_t size,
491 npages = size >> PAGE_SHIFT; 491 npages = size >> PAGE_SHIFT;
492 order = get_order(size); 492 order = get_order(size);
493 493
494 flag &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
495
494 /* alloc enough pages (and possibly more) */ 496 /* alloc enough pages (and possibly more) */
495 ret = (void *)__get_free_pages(flag, order); 497 ret = (void *)__get_free_pages(flag, order);
496 if (!ret) 498 if (!ret)
@@ -510,8 +512,22 @@ error:
510 return ret; 512 return ret;
511} 513}
512 514
515static void calgary_free_coherent(struct device *dev, size_t size,
516 void *vaddr, dma_addr_t dma_handle)
517{
518 unsigned int npages;
519 struct iommu_table *tbl = find_iommu_table(dev);
520
521 size = PAGE_ALIGN(size);
522 npages = size >> PAGE_SHIFT;
523
524 iommu_free(tbl, dma_handle, npages);
525 free_pages((unsigned long)vaddr, get_order(size));
526}
527
513static struct dma_mapping_ops calgary_dma_ops = { 528static struct dma_mapping_ops calgary_dma_ops = {
514 .alloc_coherent = calgary_alloc_coherent, 529 .alloc_coherent = calgary_alloc_coherent,
530 .free_coherent = calgary_free_coherent,
515 .map_single = calgary_map_single, 531 .map_single = calgary_map_single,
516 .unmap_single = calgary_unmap_single, 532 .unmap_single = calgary_unmap_single,
517 .map_sg = calgary_map_sg, 533 .map_sg = calgary_map_sg,
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 87d4d6964ec2..0a3824e837b4 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -41,11 +41,12 @@ EXPORT_SYMBOL(bad_dma_address);
41/* Dummy device used for NULL arguments (normally ISA). Better would 41/* Dummy device used for NULL arguments (normally ISA). Better would
42 be probably a smaller DMA mask, but this is bug-to-bug compatible 42 be probably a smaller DMA mask, but this is bug-to-bug compatible
43 to older i386. */ 43 to older i386. */
44struct device fallback_dev = { 44struct device x86_dma_fallback_dev = {
45 .bus_id = "fallback device", 45 .bus_id = "fallback device",
46 .coherent_dma_mask = DMA_32BIT_MASK, 46 .coherent_dma_mask = DMA_32BIT_MASK,
47 .dma_mask = &fallback_dev.coherent_dma_mask, 47 .dma_mask = &x86_dma_fallback_dev.coherent_dma_mask,
48}; 48};
49EXPORT_SYMBOL(x86_dma_fallback_dev);
49 50
50int dma_set_mask(struct device *dev, u64 mask) 51int dma_set_mask(struct device *dev, u64 mask)
51{ 52{
@@ -82,7 +83,7 @@ void __init dma32_reserve_bootmem(void)
82 * using 512M as goal 83 * using 512M as goal
83 */ 84 */
84 align = 64ULL<<20; 85 align = 64ULL<<20;
85 size = round_up(dma32_bootmem_size, align); 86 size = roundup(dma32_bootmem_size, align);
86 dma32_bootmem_ptr = __alloc_bootmem_nopanic(size, align, 87 dma32_bootmem_ptr = __alloc_bootmem_nopanic(size, align,
87 512ULL<<20); 88 512ULL<<20);
88 if (dma32_bootmem_ptr) 89 if (dma32_bootmem_ptr)
@@ -133,6 +134,37 @@ unsigned long iommu_num_pages(unsigned long addr, unsigned long len)
133EXPORT_SYMBOL(iommu_num_pages); 134EXPORT_SYMBOL(iommu_num_pages);
134#endif 135#endif
135 136
137void *dma_generic_alloc_coherent(struct device *dev, size_t size,
138 dma_addr_t *dma_addr, gfp_t flag)
139{
140 unsigned long dma_mask;
141 struct page *page;
142 dma_addr_t addr;
143
144 dma_mask = dma_alloc_coherent_mask(dev, flag);
145
146 flag |= __GFP_ZERO;
147again:
148 page = alloc_pages_node(dev_to_node(dev), flag, get_order(size));
149 if (!page)
150 return NULL;
151
152 addr = page_to_phys(page);
153 if (!is_buffer_dma_capable(dma_mask, addr, size)) {
154 __free_pages(page, get_order(size));
155
156 if (dma_mask < DMA_32BIT_MASK && !(flag & GFP_DMA)) {
157 flag = (flag & ~GFP_DMA32) | GFP_DMA;
158 goto again;
159 }
160
161 return NULL;
162 }
163
164 *dma_addr = addr;
165 return page_address(page);
166}
167
136/* 168/*
137 * See <Documentation/x86_64/boot-options.txt> for the iommu kernel parameter 169 * See <Documentation/x86_64/boot-options.txt> for the iommu kernel parameter
138 * documentation. 170 * documentation.
@@ -241,147 +273,6 @@ int dma_supported(struct device *dev, u64 mask)
241} 273}
242EXPORT_SYMBOL(dma_supported); 274EXPORT_SYMBOL(dma_supported);
243 275
244/* Allocate DMA memory on node near device */
245static noinline struct page *
246dma_alloc_pages(struct device *dev, gfp_t gfp, unsigned order)
247{
248 int node;
249
250 node = dev_to_node(dev);
251
252 return alloc_pages_node(node, gfp, order);
253}
254
255/*
256 * Allocate memory for a coherent mapping.
257 */
258void *
259dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
260 gfp_t gfp)
261{
262 struct dma_mapping_ops *ops = get_dma_ops(dev);
263 void *memory = NULL;
264 struct page *page;
265 unsigned long dma_mask = 0;
266 dma_addr_t bus;
267 int noretry = 0;
268
269 /* ignore region specifiers */
270 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
271
272 if (dma_alloc_from_coherent(dev, size, dma_handle, &memory))
273 return memory;
274
275 if (!dev) {
276 dev = &fallback_dev;
277 gfp |= GFP_DMA;
278 }
279 dma_mask = dev->coherent_dma_mask;
280 if (dma_mask == 0)
281 dma_mask = (gfp & GFP_DMA) ? DMA_24BIT_MASK : DMA_32BIT_MASK;
282
283 /* Device not DMA able */
284 if (dev->dma_mask == NULL)
285 return NULL;
286
287 /* Don't invoke OOM killer or retry in lower 16MB DMA zone */
288 if (gfp & __GFP_DMA)
289 noretry = 1;
290
291#ifdef CONFIG_X86_64
292 /* Why <=? Even when the mask is smaller than 4GB it is often
293 larger than 16MB and in this case we have a chance of
294 finding fitting memory in the next higher zone first. If
295 not retry with true GFP_DMA. -AK */
296 if (dma_mask <= DMA_32BIT_MASK && !(gfp & GFP_DMA)) {
297 gfp |= GFP_DMA32;
298 if (dma_mask < DMA_32BIT_MASK)
299 noretry = 1;
300 }
301#endif
302
303 again:
304 page = dma_alloc_pages(dev,
305 noretry ? gfp | __GFP_NORETRY : gfp, get_order(size));
306 if (page == NULL)
307 return NULL;
308
309 {
310 int high, mmu;
311 bus = page_to_phys(page);
312 memory = page_address(page);
313 high = (bus + size) >= dma_mask;
314 mmu = high;
315 if (force_iommu && !(gfp & GFP_DMA))
316 mmu = 1;
317 else if (high) {
318 free_pages((unsigned long)memory,
319 get_order(size));
320
321 /* Don't use the 16MB ZONE_DMA unless absolutely
322 needed. It's better to use remapping first. */
323 if (dma_mask < DMA_32BIT_MASK && !(gfp & GFP_DMA)) {
324 gfp = (gfp & ~GFP_DMA32) | GFP_DMA;
325 goto again;
326 }
327
328 /* Let low level make its own zone decisions */
329 gfp &= ~(GFP_DMA32|GFP_DMA);
330
331 if (ops->alloc_coherent)
332 return ops->alloc_coherent(dev, size,
333 dma_handle, gfp);
334 return NULL;
335 }
336
337 memset(memory, 0, size);
338 if (!mmu) {
339 *dma_handle = bus;
340 return memory;
341 }
342 }
343
344 if (ops->alloc_coherent) {
345 free_pages((unsigned long)memory, get_order(size));
346 gfp &= ~(GFP_DMA|GFP_DMA32);
347 return ops->alloc_coherent(dev, size, dma_handle, gfp);
348 }
349
350 if (ops->map_simple) {
351 *dma_handle = ops->map_simple(dev, virt_to_phys(memory),
352 size,
353 PCI_DMA_BIDIRECTIONAL);
354 if (*dma_handle != bad_dma_address)
355 return memory;
356 }
357
358 if (panic_on_overflow)
359 panic("dma_alloc_coherent: IOMMU overflow by %lu bytes\n",
360 (unsigned long)size);
361 free_pages((unsigned long)memory, get_order(size));
362 return NULL;
363}
364EXPORT_SYMBOL(dma_alloc_coherent);
365
366/*
367 * Unmap coherent memory.
368 * The caller must ensure that the device has finished accessing the mapping.
369 */
370void dma_free_coherent(struct device *dev, size_t size,
371 void *vaddr, dma_addr_t bus)
372{
373 struct dma_mapping_ops *ops = get_dma_ops(dev);
374
375 int order = get_order(size);
376 WARN_ON(irqs_disabled()); /* for portability */
377 if (dma_release_from_coherent(dev, order, vaddr))
378 return;
379 if (ops->unmap_single)
380 ops->unmap_single(dev, bus, size, 0);
381 free_pages((unsigned long)vaddr, order);
382}
383EXPORT_SYMBOL(dma_free_coherent);
384
385static int __init pci_iommu_init(void) 276static int __init pci_iommu_init(void)
386{ 277{
387 calgary_iommu_init(); 278 calgary_iommu_init();
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index 49285f8fd4d5..145f1c83369f 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -27,8 +27,8 @@
27#include <linux/scatterlist.h> 27#include <linux/scatterlist.h>
28#include <linux/iommu-helper.h> 28#include <linux/iommu-helper.h>
29#include <linux/sysdev.h> 29#include <linux/sysdev.h>
30#include <linux/io.h>
30#include <asm/atomic.h> 31#include <asm/atomic.h>
31#include <asm/io.h>
32#include <asm/mtrr.h> 32#include <asm/mtrr.h>
33#include <asm/pgtable.h> 33#include <asm/pgtable.h>
34#include <asm/proto.h> 34#include <asm/proto.h>
@@ -80,9 +80,10 @@ AGPEXTERN int agp_memory_reserved;
80AGPEXTERN __u32 *agp_gatt_table; 80AGPEXTERN __u32 *agp_gatt_table;
81 81
82static unsigned long next_bit; /* protected by iommu_bitmap_lock */ 82static unsigned long next_bit; /* protected by iommu_bitmap_lock */
83static int need_flush; /* global flush state. set for each gart wrap */ 83static bool need_flush; /* global flush state. set for each gart wrap */
84 84
85static unsigned long alloc_iommu(struct device *dev, int size) 85static unsigned long alloc_iommu(struct device *dev, int size,
86 unsigned long align_mask)
86{ 87{
87 unsigned long offset, flags; 88 unsigned long offset, flags;
88 unsigned long boundary_size; 89 unsigned long boundary_size;
@@ -90,26 +91,27 @@ static unsigned long alloc_iommu(struct device *dev, int size)
90 91
91 base_index = ALIGN(iommu_bus_base & dma_get_seg_boundary(dev), 92 base_index = ALIGN(iommu_bus_base & dma_get_seg_boundary(dev),
92 PAGE_SIZE) >> PAGE_SHIFT; 93 PAGE_SIZE) >> PAGE_SHIFT;
93 boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1, 94 boundary_size = ALIGN((unsigned long long)dma_get_seg_boundary(dev) + 1,
94 PAGE_SIZE) >> PAGE_SHIFT; 95 PAGE_SIZE) >> PAGE_SHIFT;
95 96
96 spin_lock_irqsave(&iommu_bitmap_lock, flags); 97 spin_lock_irqsave(&iommu_bitmap_lock, flags);
97 offset = iommu_area_alloc(iommu_gart_bitmap, iommu_pages, next_bit, 98 offset = iommu_area_alloc(iommu_gart_bitmap, iommu_pages, next_bit,
98 size, base_index, boundary_size, 0); 99 size, base_index, boundary_size, align_mask);
99 if (offset == -1) { 100 if (offset == -1) {
100 need_flush = 1; 101 need_flush = true;
101 offset = iommu_area_alloc(iommu_gart_bitmap, iommu_pages, 0, 102 offset = iommu_area_alloc(iommu_gart_bitmap, iommu_pages, 0,
102 size, base_index, boundary_size, 0); 103 size, base_index, boundary_size,
104 align_mask);
103 } 105 }
104 if (offset != -1) { 106 if (offset != -1) {
105 next_bit = offset+size; 107 next_bit = offset+size;
106 if (next_bit >= iommu_pages) { 108 if (next_bit >= iommu_pages) {
107 next_bit = 0; 109 next_bit = 0;
108 need_flush = 1; 110 need_flush = true;
109 } 111 }
110 } 112 }
111 if (iommu_fullflush) 113 if (iommu_fullflush)
112 need_flush = 1; 114 need_flush = true;
113 spin_unlock_irqrestore(&iommu_bitmap_lock, flags); 115 spin_unlock_irqrestore(&iommu_bitmap_lock, flags);
114 116
115 return offset; 117 return offset;
@@ -134,7 +136,7 @@ static void flush_gart(void)
134 spin_lock_irqsave(&iommu_bitmap_lock, flags); 136 spin_lock_irqsave(&iommu_bitmap_lock, flags);
135 if (need_flush) { 137 if (need_flush) {
136 k8_flush_garts(); 138 k8_flush_garts();
137 need_flush = 0; 139 need_flush = false;
138 } 140 }
139 spin_unlock_irqrestore(&iommu_bitmap_lock, flags); 141 spin_unlock_irqrestore(&iommu_bitmap_lock, flags);
140} 142}
@@ -173,7 +175,8 @@ static void dump_leak(void)
173 iommu_leak_pages); 175 iommu_leak_pages);
174 for (i = 0; i < iommu_leak_pages; i += 2) { 176 for (i = 0; i < iommu_leak_pages; i += 2) {
175 printk(KERN_DEBUG "%lu: ", iommu_pages-i); 177 printk(KERN_DEBUG "%lu: ", iommu_pages-i);
176 printk_address((unsigned long) iommu_leak_tab[iommu_pages-i], 0); 178 printk_address((unsigned long) iommu_leak_tab[iommu_pages-i],
179 0);
177 printk(KERN_CONT "%c", (i+1)%2 == 0 ? '\n' : ' '); 180 printk(KERN_CONT "%c", (i+1)%2 == 0 ? '\n' : ' ');
178 } 181 }
179 printk(KERN_DEBUG "\n"); 182 printk(KERN_DEBUG "\n");
@@ -212,34 +215,24 @@ static void iommu_full(struct device *dev, size_t size, int dir)
212static inline int 215static inline int
213need_iommu(struct device *dev, unsigned long addr, size_t size) 216need_iommu(struct device *dev, unsigned long addr, size_t size)
214{ 217{
215 u64 mask = *dev->dma_mask; 218 return force_iommu ||
216 int high = addr + size > mask; 219 !is_buffer_dma_capable(*dev->dma_mask, addr, size);
217 int mmu = high;
218
219 if (force_iommu)
220 mmu = 1;
221
222 return mmu;
223} 220}
224 221
225static inline int 222static inline int
226nonforced_iommu(struct device *dev, unsigned long addr, size_t size) 223nonforced_iommu(struct device *dev, unsigned long addr, size_t size)
227{ 224{
228 u64 mask = *dev->dma_mask; 225 return !is_buffer_dma_capable(*dev->dma_mask, addr, size);
229 int high = addr + size > mask;
230 int mmu = high;
231
232 return mmu;
233} 226}
234 227
235/* Map a single continuous physical area into the IOMMU. 228/* Map a single continuous physical area into the IOMMU.
236 * Caller needs to check if the iommu is needed and flush. 229 * Caller needs to check if the iommu is needed and flush.
237 */ 230 */
238static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem, 231static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem,
239 size_t size, int dir) 232 size_t size, int dir, unsigned long align_mask)
240{ 233{
241 unsigned long npages = iommu_num_pages(phys_mem, size); 234 unsigned long npages = iommu_num_pages(phys_mem, size);
242 unsigned long iommu_page = alloc_iommu(dev, npages); 235 unsigned long iommu_page = alloc_iommu(dev, npages, align_mask);
243 int i; 236 int i;
244 237
245 if (iommu_page == -1) { 238 if (iommu_page == -1) {
@@ -259,16 +252,6 @@ static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem,
259 return iommu_bus_base + iommu_page*PAGE_SIZE + (phys_mem & ~PAGE_MASK); 252 return iommu_bus_base + iommu_page*PAGE_SIZE + (phys_mem & ~PAGE_MASK);
260} 253}
261 254
262static dma_addr_t
263gart_map_simple(struct device *dev, phys_addr_t paddr, size_t size, int dir)
264{
265 dma_addr_t map = dma_map_area(dev, paddr, size, dir);
266
267 flush_gart();
268
269 return map;
270}
271
272/* Map a single area into the IOMMU */ 255/* Map a single area into the IOMMU */
273static dma_addr_t 256static dma_addr_t
274gart_map_single(struct device *dev, phys_addr_t paddr, size_t size, int dir) 257gart_map_single(struct device *dev, phys_addr_t paddr, size_t size, int dir)
@@ -276,12 +259,13 @@ gart_map_single(struct device *dev, phys_addr_t paddr, size_t size, int dir)
276 unsigned long bus; 259 unsigned long bus;
277 260
278 if (!dev) 261 if (!dev)
279 dev = &fallback_dev; 262 dev = &x86_dma_fallback_dev;
280 263
281 if (!need_iommu(dev, paddr, size)) 264 if (!need_iommu(dev, paddr, size))
282 return paddr; 265 return paddr;
283 266
284 bus = gart_map_simple(dev, paddr, size, dir); 267 bus = dma_map_area(dev, paddr, size, dir, 0);
268 flush_gart();
285 269
286 return bus; 270 return bus;
287} 271}
@@ -340,7 +324,7 @@ static int dma_map_sg_nonforce(struct device *dev, struct scatterlist *sg,
340 unsigned long addr = sg_phys(s); 324 unsigned long addr = sg_phys(s);
341 325
342 if (nonforced_iommu(dev, addr, s->length)) { 326 if (nonforced_iommu(dev, addr, s->length)) {
343 addr = dma_map_area(dev, addr, s->length, dir); 327 addr = dma_map_area(dev, addr, s->length, dir, 0);
344 if (addr == bad_dma_address) { 328 if (addr == bad_dma_address) {
345 if (i > 0) 329 if (i > 0)
346 gart_unmap_sg(dev, sg, i, dir); 330 gart_unmap_sg(dev, sg, i, dir);
@@ -362,7 +346,7 @@ static int __dma_map_cont(struct device *dev, struct scatterlist *start,
362 int nelems, struct scatterlist *sout, 346 int nelems, struct scatterlist *sout,
363 unsigned long pages) 347 unsigned long pages)
364{ 348{
365 unsigned long iommu_start = alloc_iommu(dev, pages); 349 unsigned long iommu_start = alloc_iommu(dev, pages, 0);
366 unsigned long iommu_page = iommu_start; 350 unsigned long iommu_page = iommu_start;
367 struct scatterlist *s; 351 struct scatterlist *s;
368 int i; 352 int i;
@@ -427,7 +411,7 @@ gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
427 return 0; 411 return 0;
428 412
429 if (!dev) 413 if (!dev)
430 dev = &fallback_dev; 414 dev = &x86_dma_fallback_dev;
431 415
432 out = 0; 416 out = 0;
433 start = 0; 417 start = 0;
@@ -499,6 +483,46 @@ error:
499 return 0; 483 return 0;
500} 484}
501 485
486/* allocate and map a coherent mapping */
487static void *
488gart_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_addr,
489 gfp_t flag)
490{
491 dma_addr_t paddr;
492 unsigned long align_mask;
493 struct page *page;
494
495 if (force_iommu && !(flag & GFP_DMA)) {
496 flag &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
497 page = alloc_pages(flag | __GFP_ZERO, get_order(size));
498 if (!page)
499 return NULL;
500
501 align_mask = (1UL << get_order(size)) - 1;
502 paddr = dma_map_area(dev, page_to_phys(page), size,
503 DMA_BIDIRECTIONAL, align_mask);
504
505 flush_gart();
506 if (paddr != bad_dma_address) {
507 *dma_addr = paddr;
508 return page_address(page);
509 }
510 __free_pages(page, get_order(size));
511 } else
512 return dma_generic_alloc_coherent(dev, size, dma_addr, flag);
513
514 return NULL;
515}
516
517/* free a coherent mapping */
518static void
519gart_free_coherent(struct device *dev, size_t size, void *vaddr,
520 dma_addr_t dma_addr)
521{
522 gart_unmap_single(dev, dma_addr, size, DMA_BIDIRECTIONAL);
523 free_pages((unsigned long)vaddr, get_order(size));
524}
525
502static int no_agp; 526static int no_agp;
503 527
504static __init unsigned long check_iommu_size(unsigned long aper, u64 aper_size) 528static __init unsigned long check_iommu_size(unsigned long aper, u64 aper_size)
@@ -626,7 +650,6 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
626 struct pci_dev *dev; 650 struct pci_dev *dev;
627 void *gatt; 651 void *gatt;
628 int i, error; 652 int i, error;
629 unsigned long start_pfn, end_pfn;
630 653
631 printk(KERN_INFO "PCI-DMA: Disabling AGP.\n"); 654 printk(KERN_INFO "PCI-DMA: Disabling AGP.\n");
632 aper_size = aper_base = info->aper_size = 0; 655 aper_size = aper_base = info->aper_size = 0;
@@ -650,13 +673,13 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
650 info->aper_size = aper_size >> 20; 673 info->aper_size = aper_size >> 20;
651 674
652 gatt_size = (aper_size >> PAGE_SHIFT) * sizeof(u32); 675 gatt_size = (aper_size >> PAGE_SHIFT) * sizeof(u32);
653 gatt = (void *)__get_free_pages(GFP_KERNEL, get_order(gatt_size)); 676 gatt = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO,
677 get_order(gatt_size));
654 if (!gatt) 678 if (!gatt)
655 panic("Cannot allocate GATT table"); 679 panic("Cannot allocate GATT table");
656 if (set_memory_uc((unsigned long)gatt, gatt_size >> PAGE_SHIFT)) 680 if (set_memory_uc((unsigned long)gatt, gatt_size >> PAGE_SHIFT))
657 panic("Could not set GART PTEs to uncacheable pages"); 681 panic("Could not set GART PTEs to uncacheable pages");
658 682
659 memset(gatt, 0, gatt_size);
660 agp_gatt_table = gatt; 683 agp_gatt_table = gatt;
661 684
662 enable_gart_translations(); 685 enable_gart_translations();
@@ -665,19 +688,14 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
665 if (!error) 688 if (!error)
666 error = sysdev_register(&device_gart); 689 error = sysdev_register(&device_gart);
667 if (error) 690 if (error)
668 panic("Could not register gart_sysdev -- would corrupt data on next suspend"); 691 panic("Could not register gart_sysdev -- "
692 "would corrupt data on next suspend");
669 693
670 flush_gart(); 694 flush_gart();
671 695
672 printk(KERN_INFO "PCI-DMA: aperture base @ %x size %u KB\n", 696 printk(KERN_INFO "PCI-DMA: aperture base @ %x size %u KB\n",
673 aper_base, aper_size>>10); 697 aper_base, aper_size>>10);
674 698
675 /* need to map that range */
676 end_pfn = (aper_base>>PAGE_SHIFT) + (aper_size>>PAGE_SHIFT);
677 if (end_pfn > max_low_pfn_mapped) {
678 start_pfn = (aper_base>>PAGE_SHIFT);
679 init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
680 }
681 return 0; 699 return 0;
682 700
683 nommu: 701 nommu:
@@ -687,20 +705,13 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
687 return -1; 705 return -1;
688} 706}
689 707
690extern int agp_amd64_init(void);
691
692static struct dma_mapping_ops gart_dma_ops = { 708static struct dma_mapping_ops gart_dma_ops = {
693 .map_single = gart_map_single, 709 .map_single = gart_map_single,
694 .map_simple = gart_map_simple,
695 .unmap_single = gart_unmap_single, 710 .unmap_single = gart_unmap_single,
696 .sync_single_for_cpu = NULL,
697 .sync_single_for_device = NULL,
698 .sync_single_range_for_cpu = NULL,
699 .sync_single_range_for_device = NULL,
700 .sync_sg_for_cpu = NULL,
701 .sync_sg_for_device = NULL,
702 .map_sg = gart_map_sg, 711 .map_sg = gart_map_sg,
703 .unmap_sg = gart_unmap_sg, 712 .unmap_sg = gart_unmap_sg,
713 .alloc_coherent = gart_alloc_coherent,
714 .free_coherent = gart_free_coherent,
704}; 715};
705 716
706void gart_iommu_shutdown(void) 717void gart_iommu_shutdown(void)
@@ -727,7 +738,8 @@ void __init gart_iommu_init(void)
727{ 738{
728 struct agp_kern_info info; 739 struct agp_kern_info info;
729 unsigned long iommu_start; 740 unsigned long iommu_start;
730 unsigned long aper_size; 741 unsigned long aper_base, aper_size;
742 unsigned long start_pfn, end_pfn;
731 unsigned long scratch; 743 unsigned long scratch;
732 long i; 744 long i;
733 745
@@ -759,30 +771,35 @@ void __init gart_iommu_init(void)
759 (no_agp && init_k8_gatt(&info) < 0)) { 771 (no_agp && init_k8_gatt(&info) < 0)) {
760 if (max_pfn > MAX_DMA32_PFN) { 772 if (max_pfn > MAX_DMA32_PFN) {
761 printk(KERN_WARNING "More than 4GB of memory " 773 printk(KERN_WARNING "More than 4GB of memory "
762 "but GART IOMMU not available.\n" 774 "but GART IOMMU not available.\n");
763 KERN_WARNING "falling back to iommu=soft.\n"); 775 printk(KERN_WARNING "falling back to iommu=soft.\n");
764 } 776 }
765 return; 777 return;
766 } 778 }
767 779
780 /* need to map that range */
781 aper_size = info.aper_size << 20;
782 aper_base = info.aper_base;
783 end_pfn = (aper_base>>PAGE_SHIFT) + (aper_size>>PAGE_SHIFT);
784 if (end_pfn > max_low_pfn_mapped) {
785 start_pfn = (aper_base>>PAGE_SHIFT);
786 init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
787 }
788
768 printk(KERN_INFO "PCI-DMA: using GART IOMMU.\n"); 789 printk(KERN_INFO "PCI-DMA: using GART IOMMU.\n");
769 aper_size = info.aper_size * 1024 * 1024;
770 iommu_size = check_iommu_size(info.aper_base, aper_size); 790 iommu_size = check_iommu_size(info.aper_base, aper_size);
771 iommu_pages = iommu_size >> PAGE_SHIFT; 791 iommu_pages = iommu_size >> PAGE_SHIFT;
772 792
773 iommu_gart_bitmap = (void *) __get_free_pages(GFP_KERNEL, 793 iommu_gart_bitmap = (void *) __get_free_pages(GFP_KERNEL | __GFP_ZERO,
774 get_order(iommu_pages/8)); 794 get_order(iommu_pages/8));
775 if (!iommu_gart_bitmap) 795 if (!iommu_gart_bitmap)
776 panic("Cannot allocate iommu bitmap\n"); 796 panic("Cannot allocate iommu bitmap\n");
777 memset(iommu_gart_bitmap, 0, iommu_pages/8);
778 797
779#ifdef CONFIG_IOMMU_LEAK 798#ifdef CONFIG_IOMMU_LEAK
780 if (leak_trace) { 799 if (leak_trace) {
781 iommu_leak_tab = (void *)__get_free_pages(GFP_KERNEL, 800 iommu_leak_tab = (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO,
782 get_order(iommu_pages*sizeof(void *))); 801 get_order(iommu_pages*sizeof(void *)));
783 if (iommu_leak_tab) 802 if (!iommu_leak_tab)
784 memset(iommu_leak_tab, 0, iommu_pages * 8);
785 else
786 printk(KERN_DEBUG 803 printk(KERN_DEBUG
787 "PCI-DMA: Cannot allocate leak trace area\n"); 804 "PCI-DMA: Cannot allocate leak trace area\n");
788 } 805 }
@@ -792,7 +809,7 @@ void __init gart_iommu_init(void)
792 * Out of IOMMU space handling. 809 * Out of IOMMU space handling.
793 * Reserve some invalid pages at the beginning of the GART. 810 * Reserve some invalid pages at the beginning of the GART.
794 */ 811 */
795 set_bit_string(iommu_gart_bitmap, 0, EMERGENCY_PAGES); 812 iommu_area_reserve(iommu_gart_bitmap, 0, EMERGENCY_PAGES);
796 813
797 agp_memory_reserved = iommu_size; 814 agp_memory_reserved = iommu_size;
798 printk(KERN_INFO 815 printk(KERN_INFO
@@ -850,7 +867,8 @@ void __init gart_parse_options(char *p)
850 if (!strncmp(p, "leak", 4)) { 867 if (!strncmp(p, "leak", 4)) {
851 leak_trace = 1; 868 leak_trace = 1;
852 p += 4; 869 p += 4;
853 if (*p == '=') ++p; 870 if (*p == '=')
871 ++p;
854 if (isdigit(*p) && get_option(&p, &arg)) 872 if (isdigit(*p) && get_option(&p, &arg))
855 iommu_leak_pages = arg; 873 iommu_leak_pages = arg;
856 } 874 }
diff --git a/arch/x86/kernel/pci-nommu.c b/arch/x86/kernel/pci-nommu.c
index 3f91f71cdc3e..c70ab5a5d4c8 100644
--- a/arch/x86/kernel/pci-nommu.c
+++ b/arch/x86/kernel/pci-nommu.c
@@ -14,7 +14,7 @@
14static int 14static int
15check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size) 15check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size)
16{ 16{
17 if (hwdev && bus + size > *hwdev->dma_mask) { 17 if (hwdev && !is_buffer_dma_capable(*hwdev->dma_mask, bus, size)) {
18 if (*hwdev->dma_mask >= DMA_32BIT_MASK) 18 if (*hwdev->dma_mask >= DMA_32BIT_MASK)
19 printk(KERN_ERR 19 printk(KERN_ERR
20 "nommu_%s: overflow %Lx+%zu of device mask %Lx\n", 20 "nommu_%s: overflow %Lx+%zu of device mask %Lx\n",
@@ -72,7 +72,15 @@ static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
72 return nents; 72 return nents;
73} 73}
74 74
75static void nommu_free_coherent(struct device *dev, size_t size, void *vaddr,
76 dma_addr_t dma_addr)
77{
78 free_pages((unsigned long)vaddr, get_order(size));
79}
80
75struct dma_mapping_ops nommu_dma_ops = { 81struct dma_mapping_ops nommu_dma_ops = {
82 .alloc_coherent = dma_generic_alloc_coherent,
83 .free_coherent = nommu_free_coherent,
76 .map_single = nommu_map_single, 84 .map_single = nommu_map_single,
77 .map_sg = nommu_map_sg, 85 .map_sg = nommu_map_sg,
78 .is_phys = 1, 86 .is_phys = 1,
diff --git a/arch/x86/kernel/pcspeaker.c b/arch/x86/kernel/pcspeaker.c
index bc1f2d3ea277..a311ffcaad16 100644
--- a/arch/x86/kernel/pcspeaker.c
+++ b/arch/x86/kernel/pcspeaker.c
@@ -1,20 +1,13 @@
1#include <linux/platform_device.h> 1#include <linux/platform_device.h>
2#include <linux/errno.h> 2#include <linux/err.h>
3#include <linux/init.h> 3#include <linux/init.h>
4 4
5static __init int add_pcspkr(void) 5static __init int add_pcspkr(void)
6{ 6{
7 struct platform_device *pd; 7 struct platform_device *pd;
8 int ret;
9 8
10 pd = platform_device_alloc("pcspkr", -1); 9 pd = platform_device_register_simple("pcspkr", -1, NULL, 0);
11 if (!pd)
12 return -ENOMEM;
13 10
14 ret = platform_device_add(pd); 11 return IS_ERR(pd) ? PTR_ERR(pd) : 0;
15 if (ret)
16 platform_device_put(pd);
17
18 return ret;
19} 12}
20device_initcall(add_pcspkr); 13device_initcall(add_pcspkr);
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 9f94bb1c8117..c622772744d8 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -184,7 +184,8 @@ static void mwait_idle(void)
184static void poll_idle(void) 184static void poll_idle(void)
185{ 185{
186 local_irq_enable(); 186 local_irq_enable();
187 cpu_relax(); 187 while (!need_resched())
188 cpu_relax();
188} 189}
189 190
190/* 191/*
@@ -245,6 +246,14 @@ static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c)
245 return 1; 246 return 1;
246} 247}
247 248
249static cpumask_t c1e_mask = CPU_MASK_NONE;
250static int c1e_detected;
251
252void c1e_remove_cpu(int cpu)
253{
254 cpu_clear(cpu, c1e_mask);
255}
256
248/* 257/*
249 * C1E aware idle routine. We check for C1E active in the interrupt 258 * C1E aware idle routine. We check for C1E active in the interrupt
250 * pending message MSR. If we detect C1E, then we handle it the same 259 * pending message MSR. If we detect C1E, then we handle it the same
@@ -252,9 +261,6 @@ static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c)
252 */ 261 */
253static void c1e_idle(void) 262static void c1e_idle(void)
254{ 263{
255 static cpumask_t c1e_mask = CPU_MASK_NONE;
256 static int c1e_detected;
257
258 if (need_resched()) 264 if (need_resched())
259 return; 265 return;
260 266
@@ -264,8 +270,10 @@ static void c1e_idle(void)
264 rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi); 270 rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi);
265 if (lo & K8_INTP_C1E_ACTIVE_MASK) { 271 if (lo & K8_INTP_C1E_ACTIVE_MASK) {
266 c1e_detected = 1; 272 c1e_detected = 1;
267 mark_tsc_unstable("TSC halt in C1E"); 273 if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC))
268 printk(KERN_INFO "System has C1E enabled\n"); 274 mark_tsc_unstable("TSC halt in AMD C1E");
275 printk(KERN_INFO "System has AMD C1E enabled\n");
276 set_cpu_cap(&boot_cpu_data, X86_FEATURE_AMDC1E);
269 } 277 }
270 } 278 }
271 279
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 1962d27c6b82..205188db9626 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -37,6 +37,7 @@
37#include <linux/tick.h> 37#include <linux/tick.h>
38#include <linux/percpu.h> 38#include <linux/percpu.h>
39#include <linux/prctl.h> 39#include <linux/prctl.h>
40#include <linux/dmi.h>
40 41
41#include <asm/uaccess.h> 42#include <asm/uaccess.h>
42#include <asm/pgtable.h> 43#include <asm/pgtable.h>
@@ -55,6 +56,7 @@
55#include <asm/tlbflush.h> 56#include <asm/tlbflush.h>
56#include <asm/cpu.h> 57#include <asm/cpu.h>
57#include <asm/kdebug.h> 58#include <asm/kdebug.h>
59#include <asm/idle.h>
58#include <asm/syscalls.h> 60#include <asm/syscalls.h>
59#include <asm/smp.h> 61#include <asm/smp.h>
60 62
@@ -90,6 +92,7 @@ static void cpu_exit_clear(void)
90 cpu_clear(cpu, cpu_callin_map); 92 cpu_clear(cpu, cpu_callin_map);
91 93
92 numa_remove_cpu(cpu); 94 numa_remove_cpu(cpu);
95 c1e_remove_cpu(cpu);
93} 96}
94 97
95/* We don't actually take CPU down, just spin without interrupts. */ 98/* We don't actually take CPU down, just spin without interrupts. */
@@ -161,6 +164,7 @@ void __show_registers(struct pt_regs *regs, int all)
161 unsigned long d0, d1, d2, d3, d6, d7; 164 unsigned long d0, d1, d2, d3, d6, d7;
162 unsigned long sp; 165 unsigned long sp;
163 unsigned short ss, gs; 166 unsigned short ss, gs;
167 const char *board;
164 168
165 if (user_mode_vm(regs)) { 169 if (user_mode_vm(regs)) {
166 sp = regs->sp; 170 sp = regs->sp;
@@ -173,11 +177,15 @@ void __show_registers(struct pt_regs *regs, int all)
173 } 177 }
174 178
175 printk("\n"); 179 printk("\n");
176 printk("Pid: %d, comm: %s %s (%s %.*s)\n", 180
181 board = dmi_get_system_info(DMI_PRODUCT_NAME);
182 if (!board)
183 board = "";
184 printk("Pid: %d, comm: %s %s (%s %.*s) %s\n",
177 task_pid_nr(current), current->comm, 185 task_pid_nr(current), current->comm,
178 print_tainted(), init_utsname()->release, 186 print_tainted(), init_utsname()->release,
179 (int)strcspn(init_utsname()->version, " "), 187 (int)strcspn(init_utsname()->version, " "),
180 init_utsname()->version); 188 init_utsname()->version, board);
181 189
182 printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n", 190 printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n",
183 (u16)regs->cs, regs->ip, regs->flags, 191 (u16)regs->cs, regs->ip, regs->flags,
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 08a9df08adba..2a8ccb9238b4 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -37,11 +37,11 @@
37#include <linux/kdebug.h> 37#include <linux/kdebug.h>
38#include <linux/tick.h> 38#include <linux/tick.h>
39#include <linux/prctl.h> 39#include <linux/prctl.h>
40#include <linux/uaccess.h>
41#include <linux/io.h>
40 42
41#include <asm/uaccess.h>
42#include <asm/pgtable.h> 43#include <asm/pgtable.h>
43#include <asm/system.h> 44#include <asm/system.h>
44#include <asm/io.h>
45#include <asm/processor.h> 45#include <asm/processor.h>
46#include <asm/i387.h> 46#include <asm/i387.h>
47#include <asm/mmu_context.h> 47#include <asm/mmu_context.h>
@@ -89,11 +89,13 @@ void exit_idle(void)
89#ifdef CONFIG_HOTPLUG_CPU 89#ifdef CONFIG_HOTPLUG_CPU
90DECLARE_PER_CPU(int, cpu_state); 90DECLARE_PER_CPU(int, cpu_state);
91 91
92#include <asm/nmi.h> 92#include <linux/nmi.h>
93/* We halt the CPU with physical CPU hotplug */ 93/* We halt the CPU with physical CPU hotplug */
94static inline void play_dead(void) 94static inline void play_dead(void)
95{ 95{
96 idle_task_exit(); 96 idle_task_exit();
97 c1e_remove_cpu(raw_smp_processor_id());
98
97 mb(); 99 mb();
98 /* Ack it */ 100 /* Ack it */
99 __get_cpu_var(cpu_state) = CPU_DEAD; 101 __get_cpu_var(cpu_state) = CPU_DEAD;
@@ -152,7 +154,7 @@ void cpu_idle(void)
152} 154}
153 155
154/* Prints also some state that isn't saved in the pt_regs */ 156/* Prints also some state that isn't saved in the pt_regs */
155void __show_regs(struct pt_regs * regs) 157void __show_regs(struct pt_regs *regs)
156{ 158{
157 unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs; 159 unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L, fs, gs, shadowgs;
158 unsigned long d0, d1, d2, d3, d6, d7; 160 unsigned long d0, d1, d2, d3, d6, d7;
@@ -161,59 +163,61 @@ void __show_regs(struct pt_regs * regs)
161 163
162 printk("\n"); 164 printk("\n");
163 print_modules(); 165 print_modules();
164 printk("Pid: %d, comm: %.20s %s %s %.*s\n", 166 printk(KERN_INFO "Pid: %d, comm: %.20s %s %s %.*s\n",
165 current->pid, current->comm, print_tainted(), 167 current->pid, current->comm, print_tainted(),
166 init_utsname()->release, 168 init_utsname()->release,
167 (int)strcspn(init_utsname()->version, " "), 169 (int)strcspn(init_utsname()->version, " "),
168 init_utsname()->version); 170 init_utsname()->version);
169 printk("RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip); 171 printk(KERN_INFO "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip);
170 printk_address(regs->ip, 1); 172 printk_address(regs->ip, 1);
171 printk("RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, regs->sp, 173 printk(KERN_INFO "RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss,
172 regs->flags); 174 regs->sp, regs->flags);
173 printk("RAX: %016lx RBX: %016lx RCX: %016lx\n", 175 printk(KERN_INFO "RAX: %016lx RBX: %016lx RCX: %016lx\n",
174 regs->ax, regs->bx, regs->cx); 176 regs->ax, regs->bx, regs->cx);
175 printk("RDX: %016lx RSI: %016lx RDI: %016lx\n", 177 printk(KERN_INFO "RDX: %016lx RSI: %016lx RDI: %016lx\n",
176 regs->dx, regs->si, regs->di); 178 regs->dx, regs->si, regs->di);
177 printk("RBP: %016lx R08: %016lx R09: %016lx\n", 179 printk(KERN_INFO "RBP: %016lx R08: %016lx R09: %016lx\n",
178 regs->bp, regs->r8, regs->r9); 180 regs->bp, regs->r8, regs->r9);
179 printk("R10: %016lx R11: %016lx R12: %016lx\n", 181 printk(KERN_INFO "R10: %016lx R11: %016lx R12: %016lx\n",
180 regs->r10, regs->r11, regs->r12); 182 regs->r10, regs->r11, regs->r12);
181 printk("R13: %016lx R14: %016lx R15: %016lx\n", 183 printk(KERN_INFO "R13: %016lx R14: %016lx R15: %016lx\n",
182 regs->r13, regs->r14, regs->r15); 184 regs->r13, regs->r14, regs->r15);
183 185
184 asm("movl %%ds,%0" : "=r" (ds)); 186 asm("movl %%ds,%0" : "=r" (ds));
185 asm("movl %%cs,%0" : "=r" (cs)); 187 asm("movl %%cs,%0" : "=r" (cs));
186 asm("movl %%es,%0" : "=r" (es)); 188 asm("movl %%es,%0" : "=r" (es));
187 asm("movl %%fs,%0" : "=r" (fsindex)); 189 asm("movl %%fs,%0" : "=r" (fsindex));
188 asm("movl %%gs,%0" : "=r" (gsindex)); 190 asm("movl %%gs,%0" : "=r" (gsindex));
189 191
190 rdmsrl(MSR_FS_BASE, fs); 192 rdmsrl(MSR_FS_BASE, fs);
191 rdmsrl(MSR_GS_BASE, gs); 193 rdmsrl(MSR_GS_BASE, gs);
192 rdmsrl(MSR_KERNEL_GS_BASE, shadowgs); 194 rdmsrl(MSR_KERNEL_GS_BASE, shadowgs);
193 195
194 cr0 = read_cr0(); 196 cr0 = read_cr0();
195 cr2 = read_cr2(); 197 cr2 = read_cr2();
196 cr3 = read_cr3(); 198 cr3 = read_cr3();
197 cr4 = read_cr4(); 199 cr4 = read_cr4();
198 200
199 printk("FS: %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n", 201 printk(KERN_INFO "FS: %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n",
200 fs,fsindex,gs,gsindex,shadowgs); 202 fs, fsindex, gs, gsindex, shadowgs);
201 printk("CS: %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds, es, cr0); 203 printk(KERN_INFO "CS: %04x DS: %04x ES: %04x CR0: %016lx\n", cs, ds,
202 printk("CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3, cr4); 204 es, cr0);
205 printk(KERN_INFO "CR2: %016lx CR3: %016lx CR4: %016lx\n", cr2, cr3,
206 cr4);
203 207
204 get_debugreg(d0, 0); 208 get_debugreg(d0, 0);
205 get_debugreg(d1, 1); 209 get_debugreg(d1, 1);
206 get_debugreg(d2, 2); 210 get_debugreg(d2, 2);
207 printk("DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2); 211 printk(KERN_INFO "DR0: %016lx DR1: %016lx DR2: %016lx\n", d0, d1, d2);
208 get_debugreg(d3, 3); 212 get_debugreg(d3, 3);
209 get_debugreg(d6, 6); 213 get_debugreg(d6, 6);
210 get_debugreg(d7, 7); 214 get_debugreg(d7, 7);
211 printk("DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7); 215 printk(KERN_INFO "DR3: %016lx DR6: %016lx DR7: %016lx\n", d3, d6, d7);
212} 216}
213 217
214void show_regs(struct pt_regs *regs) 218void show_regs(struct pt_regs *regs)
215{ 219{
216 printk("CPU %d:", smp_processor_id()); 220 printk(KERN_INFO "CPU %d:", smp_processor_id());
217 __show_regs(regs); 221 __show_regs(regs);
218 show_trace(NULL, regs, (void *)(regs + 1), regs->bp); 222 show_trace(NULL, regs, (void *)(regs + 1), regs->bp);
219} 223}
@@ -322,10 +326,10 @@ void prepare_to_copy(struct task_struct *tsk)
322 326
323int copy_thread(int nr, unsigned long clone_flags, unsigned long sp, 327int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
324 unsigned long unused, 328 unsigned long unused,
325 struct task_struct * p, struct pt_regs * regs) 329 struct task_struct *p, struct pt_regs *regs)
326{ 330{
327 int err; 331 int err;
328 struct pt_regs * childregs; 332 struct pt_regs *childregs;
329 struct task_struct *me = current; 333 struct task_struct *me = current;
330 334
331 childregs = ((struct pt_regs *) 335 childregs = ((struct pt_regs *)
@@ -370,10 +374,10 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
370 if (test_thread_flag(TIF_IA32)) 374 if (test_thread_flag(TIF_IA32))
371 err = do_set_thread_area(p, -1, 375 err = do_set_thread_area(p, -1,
372 (struct user_desc __user *)childregs->si, 0); 376 (struct user_desc __user *)childregs->si, 0);
373 else 377 else
374#endif 378#endif
375 err = do_arch_prctl(p, ARCH_SET_FS, childregs->r8); 379 err = do_arch_prctl(p, ARCH_SET_FS, childregs->r8);
376 if (err) 380 if (err)
377 goto out; 381 goto out;
378 } 382 }
379 err = 0; 383 err = 0;
@@ -566,7 +570,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
566 unsigned fsindex, gsindex; 570 unsigned fsindex, gsindex;
567 571
568 /* we're going to use this soon, after a few expensive things */ 572 /* we're going to use this soon, after a few expensive things */
569 if (next_p->fpu_counter>5) 573 if (next_p->fpu_counter > 5)
570 prefetch(next->xstate); 574 prefetch(next->xstate);
571 575
572 /* 576 /*
@@ -574,13 +578,13 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
574 */ 578 */
575 load_sp0(tss, next); 579 load_sp0(tss, next);
576 580
577 /* 581 /*
578 * Switch DS and ES. 582 * Switch DS and ES.
579 * This won't pick up thread selector changes, but I guess that is ok. 583 * This won't pick up thread selector changes, but I guess that is ok.
580 */ 584 */
581 savesegment(es, prev->es); 585 savesegment(es, prev->es);
582 if (unlikely(next->es | prev->es)) 586 if (unlikely(next->es | prev->es))
583 loadsegment(es, next->es); 587 loadsegment(es, next->es);
584 588
585 savesegment(ds, prev->ds); 589 savesegment(ds, prev->ds);
586 if (unlikely(next->ds | prev->ds)) 590 if (unlikely(next->ds | prev->ds))
@@ -606,7 +610,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
606 */ 610 */
607 arch_leave_lazy_cpu_mode(); 611 arch_leave_lazy_cpu_mode();
608 612
609 /* 613 /*
610 * Switch FS and GS. 614 * Switch FS and GS.
611 * 615 *
612 * Segment register != 0 always requires a reload. Also 616 * Segment register != 0 always requires a reload. Also
@@ -615,13 +619,13 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
615 */ 619 */
616 if (unlikely(fsindex | next->fsindex | prev->fs)) { 620 if (unlikely(fsindex | next->fsindex | prev->fs)) {
617 loadsegment(fs, next->fsindex); 621 loadsegment(fs, next->fsindex);
618 /* 622 /*
619 * Check if the user used a selector != 0; if yes 623 * Check if the user used a selector != 0; if yes
620 * clear 64bit base, since overloaded base is always 624 * clear 64bit base, since overloaded base is always
621 * mapped to the Null selector 625 * mapped to the Null selector
622 */ 626 */
623 if (fsindex) 627 if (fsindex)
624 prev->fs = 0; 628 prev->fs = 0;
625 } 629 }
626 /* when next process has a 64bit base use it */ 630 /* when next process has a 64bit base use it */
627 if (next->fs) 631 if (next->fs)
@@ -631,7 +635,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
631 if (unlikely(gsindex | next->gsindex | prev->gs)) { 635 if (unlikely(gsindex | next->gsindex | prev->gs)) {
632 load_gs_index(next->gsindex); 636 load_gs_index(next->gsindex);
633 if (gsindex) 637 if (gsindex)
634 prev->gs = 0; 638 prev->gs = 0;
635 } 639 }
636 if (next->gs) 640 if (next->gs)
637 wrmsrl(MSR_KERNEL_GS_BASE, next->gs); 641 wrmsrl(MSR_KERNEL_GS_BASE, next->gs);
@@ -640,12 +644,12 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
640 /* Must be after DS reload */ 644 /* Must be after DS reload */
641 unlazy_fpu(prev_p); 645 unlazy_fpu(prev_p);
642 646
643 /* 647 /*
644 * Switch the PDA and FPU contexts. 648 * Switch the PDA and FPU contexts.
645 */ 649 */
646 prev->usersp = read_pda(oldrsp); 650 prev->usersp = read_pda(oldrsp);
647 write_pda(oldrsp, next->usersp); 651 write_pda(oldrsp, next->usersp);
648 write_pda(pcurrent, next_p); 652 write_pda(pcurrent, next_p);
649 653
650 write_pda(kernelstack, 654 write_pda(kernelstack,
651 (unsigned long)task_stack_page(next_p) + 655 (unsigned long)task_stack_page(next_p) +
@@ -686,7 +690,7 @@ long sys_execve(char __user *name, char __user * __user *argv,
686 char __user * __user *envp, struct pt_regs *regs) 690 char __user * __user *envp, struct pt_regs *regs)
687{ 691{
688 long error; 692 long error;
689 char * filename; 693 char *filename;
690 694
691 filename = getname(name); 695 filename = getname(name);
692 error = PTR_ERR(filename); 696 error = PTR_ERR(filename);
@@ -744,55 +748,55 @@ asmlinkage long sys_vfork(struct pt_regs *regs)
744unsigned long get_wchan(struct task_struct *p) 748unsigned long get_wchan(struct task_struct *p)
745{ 749{
746 unsigned long stack; 750 unsigned long stack;
747 u64 fp,ip; 751 u64 fp, ip;
748 int count = 0; 752 int count = 0;
749 753
750 if (!p || p == current || p->state==TASK_RUNNING) 754 if (!p || p == current || p->state == TASK_RUNNING)
751 return 0; 755 return 0;
752 stack = (unsigned long)task_stack_page(p); 756 stack = (unsigned long)task_stack_page(p);
753 if (p->thread.sp < stack || p->thread.sp > stack+THREAD_SIZE) 757 if (p->thread.sp < stack || p->thread.sp > stack+THREAD_SIZE)
754 return 0; 758 return 0;
755 fp = *(u64 *)(p->thread.sp); 759 fp = *(u64 *)(p->thread.sp);
756 do { 760 do {
757 if (fp < (unsigned long)stack || 761 if (fp < (unsigned long)stack ||
758 fp > (unsigned long)stack+THREAD_SIZE) 762 fp > (unsigned long)stack+THREAD_SIZE)
759 return 0; 763 return 0;
760 ip = *(u64 *)(fp+8); 764 ip = *(u64 *)(fp+8);
761 if (!in_sched_functions(ip)) 765 if (!in_sched_functions(ip))
762 return ip; 766 return ip;
763 fp = *(u64 *)fp; 767 fp = *(u64 *)fp;
764 } while (count++ < 16); 768 } while (count++ < 16);
765 return 0; 769 return 0;
766} 770}
767 771
768long do_arch_prctl(struct task_struct *task, int code, unsigned long addr) 772long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
769{ 773{
770 int ret = 0; 774 int ret = 0;
771 int doit = task == current; 775 int doit = task == current;
772 int cpu; 776 int cpu;
773 777
774 switch (code) { 778 switch (code) {
775 case ARCH_SET_GS: 779 case ARCH_SET_GS:
776 if (addr >= TASK_SIZE_OF(task)) 780 if (addr >= TASK_SIZE_OF(task))
777 return -EPERM; 781 return -EPERM;
778 cpu = get_cpu(); 782 cpu = get_cpu();
779 /* handle small bases via the GDT because that's faster to 783 /* handle small bases via the GDT because that's faster to
780 switch. */ 784 switch. */
781 if (addr <= 0xffffffff) { 785 if (addr <= 0xffffffff) {
782 set_32bit_tls(task, GS_TLS, addr); 786 set_32bit_tls(task, GS_TLS, addr);
783 if (doit) { 787 if (doit) {
784 load_TLS(&task->thread, cpu); 788 load_TLS(&task->thread, cpu);
785 load_gs_index(GS_TLS_SEL); 789 load_gs_index(GS_TLS_SEL);
786 } 790 }
787 task->thread.gsindex = GS_TLS_SEL; 791 task->thread.gsindex = GS_TLS_SEL;
788 task->thread.gs = 0; 792 task->thread.gs = 0;
789 } else { 793 } else {
790 task->thread.gsindex = 0; 794 task->thread.gsindex = 0;
791 task->thread.gs = addr; 795 task->thread.gs = addr;
792 if (doit) { 796 if (doit) {
793 load_gs_index(0); 797 load_gs_index(0);
794 ret = checking_wrmsrl(MSR_KERNEL_GS_BASE, addr); 798 ret = checking_wrmsrl(MSR_KERNEL_GS_BASE, addr);
795 } 799 }
796 } 800 }
797 put_cpu(); 801 put_cpu();
798 break; 802 break;
@@ -846,8 +850,7 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
846 rdmsrl(MSR_KERNEL_GS_BASE, base); 850 rdmsrl(MSR_KERNEL_GS_BASE, base);
847 else 851 else
848 base = task->thread.gs; 852 base = task->thread.gs;
849 } 853 } else
850 else
851 base = task->thread.gs; 854 base = task->thread.gs;
852 ret = put_user(base, (unsigned long __user *)addr); 855 ret = put_user(base, (unsigned long __user *)addr);
853 break; 856 break;
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 58ce4b50211b..e375b658efc3 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -14,6 +14,7 @@
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/ptrace.h> 15#include <linux/ptrace.h>
16#include <linux/regset.h> 16#include <linux/regset.h>
17#include <linux/tracehook.h>
17#include <linux/user.h> 18#include <linux/user.h>
18#include <linux/elf.h> 19#include <linux/elf.h>
19#include <linux/security.h> 20#include <linux/security.h>
@@ -734,7 +735,7 @@ static int ptrace_bts_config(struct task_struct *child,
734 goto errout; 735 goto errout;
735 736
736 if (cfg.flags & PTRACE_BTS_O_ALLOC) { 737 if (cfg.flags & PTRACE_BTS_O_ALLOC) {
737 ds_ovfl_callback_t ovfl = 0; 738 ds_ovfl_callback_t ovfl = NULL;
738 unsigned int sig = 0; 739 unsigned int sig = 0;
739 740
740 /* we ignore the error in case we were not tracing child */ 741 /* we ignore the error in case we were not tracing child */
@@ -748,7 +749,7 @@ static int ptrace_bts_config(struct task_struct *child,
748 ovfl = ptrace_bts_ovfl; 749 ovfl = ptrace_bts_ovfl;
749 } 750 }
750 751
751 error = ds_request_bts(child, /* base = */ 0, cfg.size, ovfl); 752 error = ds_request_bts(child, /* base = */ NULL, cfg.size, ovfl);
752 if (error < 0) 753 if (error < 0)
753 goto errout; 754 goto errout;
754 755
@@ -1086,7 +1087,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
1086 break; 1087 break;
1087 1088
1088 case PTRACE_BTS_SIZE: 1089 case PTRACE_BTS_SIZE:
1089 ret = ds_get_bts_index(child, /* pos = */ 0); 1090 ret = ds_get_bts_index(child, /* pos = */ NULL);
1090 break; 1091 break;
1091 1092
1092 case PTRACE_BTS_GET: 1093 case PTRACE_BTS_GET:
@@ -1469,30 +1470,6 @@ void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code)
1469 force_sig_info(SIGTRAP, &info, tsk); 1470 force_sig_info(SIGTRAP, &info, tsk);
1470} 1471}
1471 1472
1472static void syscall_trace(struct pt_regs *regs)
1473{
1474 if (!(current->ptrace & PT_PTRACED))
1475 return;
1476
1477#if 0
1478 printk("trace %s ip %lx sp %lx ax %d origrax %d caller %lx tiflags %x ptrace %x\n",
1479 current->comm,
1480 regs->ip, regs->sp, regs->ax, regs->orig_ax, __builtin_return_address(0),
1481 current_thread_info()->flags, current->ptrace);
1482#endif
1483
1484 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
1485 ? 0x80 : 0));
1486 /*
1487 * this isn't the same as continuing with a signal, but it will do
1488 * for normal use. strace only continues with a signal if the
1489 * stopping signal is not SIGTRAP. -brl
1490 */
1491 if (current->exit_code) {
1492 send_sig(current->exit_code, current, 1);
1493 current->exit_code = 0;
1494 }
1495}
1496 1473
1497#ifdef CONFIG_X86_32 1474#ifdef CONFIG_X86_32
1498# define IS_IA32 1 1475# define IS_IA32 1
@@ -1526,8 +1503,9 @@ asmregparm long syscall_trace_enter(struct pt_regs *regs)
1526 if (unlikely(test_thread_flag(TIF_SYSCALL_EMU))) 1503 if (unlikely(test_thread_flag(TIF_SYSCALL_EMU)))
1527 ret = -1L; 1504 ret = -1L;
1528 1505
1529 if (ret || test_thread_flag(TIF_SYSCALL_TRACE)) 1506 if ((ret || test_thread_flag(TIF_SYSCALL_TRACE)) &&
1530 syscall_trace(regs); 1507 tracehook_report_syscall_entry(regs))
1508 ret = -1L;
1531 1509
1532 if (unlikely(current->audit_context)) { 1510 if (unlikely(current->audit_context)) {
1533 if (IS_IA32) 1511 if (IS_IA32)
@@ -1553,7 +1531,7 @@ asmregparm void syscall_trace_leave(struct pt_regs *regs)
1553 audit_syscall_exit(AUDITSC_RESULT(regs->ax), regs->ax); 1531 audit_syscall_exit(AUDITSC_RESULT(regs->ax), regs->ax);
1554 1532
1555 if (test_thread_flag(TIF_SYSCALL_TRACE)) 1533 if (test_thread_flag(TIF_SYSCALL_TRACE))
1556 syscall_trace(regs); 1534 tracehook_report_syscall_exit(regs, 0);
1557 1535
1558 /* 1536 /*
1559 * If TIF_SYSCALL_EMU is set, we only get here because of 1537 * If TIF_SYSCALL_EMU is set, we only get here because of
@@ -1569,6 +1547,6 @@ asmregparm void syscall_trace_leave(struct pt_regs *regs)
1569 * system call instruction. 1547 * system call instruction.
1570 */ 1548 */
1571 if (test_thread_flag(TIF_SINGLESTEP) && 1549 if (test_thread_flag(TIF_SINGLESTEP) &&
1572 (current->ptrace & PT_PTRACED)) 1550 tracehook_consider_fatal_signal(current, SIGTRAP, SIG_DFL))
1573 send_sigtrap(current, regs, 0); 1551 send_sigtrap(current, regs, 0);
1574} 1552}
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 724adfc63cb9..f4c93f1cfc19 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -29,7 +29,11 @@ EXPORT_SYMBOL(pm_power_off);
29 29
30static const struct desc_ptr no_idt = {}; 30static const struct desc_ptr no_idt = {};
31static int reboot_mode; 31static int reboot_mode;
32enum reboot_type reboot_type = BOOT_KBD; 32/*
33 * Keyboard reset and triple fault may result in INIT, not RESET, which
34 * doesn't work when we're in vmx root mode. Try ACPI first.
35 */
36enum reboot_type reboot_type = BOOT_ACPI;
33int reboot_force; 37int reboot_force;
34 38
35#if defined(CONFIG_X86_32) && defined(CONFIG_SMP) 39#if defined(CONFIG_X86_32) && defined(CONFIG_SMP)
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 673f12cf6eb0..46c98efbbf8d 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -223,6 +223,9 @@ unsigned long saved_video_mode;
223#define RAMDISK_LOAD_FLAG 0x4000 223#define RAMDISK_LOAD_FLAG 0x4000
224 224
225static char __initdata command_line[COMMAND_LINE_SIZE]; 225static char __initdata command_line[COMMAND_LINE_SIZE];
226#ifdef CONFIG_CMDLINE_BOOL
227static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
228#endif
226 229
227#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE) 230#if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
228struct edd edd; 231struct edd edd;
@@ -665,11 +668,28 @@ void __init setup_arch(char **cmdline_p)
665 bss_resource.start = virt_to_phys(&__bss_start); 668 bss_resource.start = virt_to_phys(&__bss_start);
666 bss_resource.end = virt_to_phys(&__bss_stop)-1; 669 bss_resource.end = virt_to_phys(&__bss_stop)-1;
667 670
671#ifdef CONFIG_CMDLINE_BOOL
672#ifdef CONFIG_CMDLINE_OVERRIDE
673 strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
674#else
675 if (builtin_cmdline[0]) {
676 /* append boot loader cmdline to builtin */
677 strlcat(builtin_cmdline, " ", COMMAND_LINE_SIZE);
678 strlcat(builtin_cmdline, boot_command_line, COMMAND_LINE_SIZE);
679 strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE);
680 }
681#endif
682#endif
683
668 strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); 684 strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
669 *cmdline_p = command_line; 685 *cmdline_p = command_line;
670 686
671 parse_early_param(); 687 parse_early_param();
672 688
689#ifdef CONFIG_X86_64
690 check_efer();
691#endif
692
673#if defined(CONFIG_VMI) && defined(CONFIG_X86_32) 693#if defined(CONFIG_VMI) && defined(CONFIG_X86_32)
674 /* 694 /*
675 * Must be before kernel pagetables are setup 695 * Must be before kernel pagetables are setup
@@ -738,7 +758,6 @@ void __init setup_arch(char **cmdline_p)
738#else 758#else
739 num_physpages = max_pfn; 759 num_physpages = max_pfn;
740 760
741 check_efer();
742 if (cpu_has_x2apic) 761 if (cpu_has_x2apic)
743 check_x2apic(); 762 check_x2apic();
744 763
diff --git a/arch/x86/kernel/sigframe.h b/arch/x86/kernel/sigframe.h
index 6dd7e2b70a4b..cc673aa55ce4 100644
--- a/arch/x86/kernel/sigframe.h
+++ b/arch/x86/kernel/sigframe.h
@@ -34,4 +34,9 @@ struct rt_sigframe {
34 struct siginfo info; 34 struct siginfo info;
35 /* fp state follows here */ 35 /* fp state follows here */
36}; 36};
37
38int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
39 sigset_t *set, struct pt_regs *regs);
40int ia32_setup_frame(int sig, struct k_sigaction *ka,
41 sigset_t *set, struct pt_regs *regs);
37#endif 42#endif
diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c
index 8d380b699c0c..b21070ea33a4 100644
--- a/arch/x86/kernel/signal_32.c
+++ b/arch/x86/kernel/signal_32.c
@@ -17,6 +17,7 @@
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/sched.h> 18#include <linux/sched.h>
19#include <linux/wait.h> 19#include <linux/wait.h>
20#include <linux/tracehook.h>
20#include <linux/elf.h> 21#include <linux/elf.h>
21#include <linux/smp.h> 22#include <linux/smp.h>
22#include <linux/mm.h> 23#include <linux/mm.h>
@@ -556,8 +557,6 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
556 * handler too. 557 * handler too.
557 */ 558 */
558 regs->flags &= ~X86_EFLAGS_TF; 559 regs->flags &= ~X86_EFLAGS_TF;
559 if (test_thread_flag(TIF_SINGLESTEP))
560 ptrace_notify(SIGTRAP);
561 560
562 spin_lock_irq(&current->sighand->siglock); 561 spin_lock_irq(&current->sighand->siglock);
563 sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask); 562 sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask);
@@ -566,6 +565,9 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
566 recalc_sigpending(); 565 recalc_sigpending();
567 spin_unlock_irq(&current->sighand->siglock); 566 spin_unlock_irq(&current->sighand->siglock);
568 567
568 tracehook_signal_handler(sig, info, ka, regs,
569 test_thread_flag(TIF_SINGLESTEP));
570
569 return 0; 571 return 0;
570} 572}
571 573
@@ -659,5 +661,10 @@ do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags)
659 if (thread_info_flags & _TIF_SIGPENDING) 661 if (thread_info_flags & _TIF_SIGPENDING)
660 do_signal(regs); 662 do_signal(regs);
661 663
664 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
665 clear_thread_flag(TIF_NOTIFY_RESUME);
666 tracehook_notify_resume(regs);
667 }
668
662 clear_thread_flag(TIF_IRET); 669 clear_thread_flag(TIF_IRET);
663} 670}
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c
index 4665b598a376..823a55bf8c39 100644
--- a/arch/x86/kernel/signal_64.c
+++ b/arch/x86/kernel/signal_64.c
@@ -15,17 +15,20 @@
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/wait.h> 16#include <linux/wait.h>
17#include <linux/ptrace.h> 17#include <linux/ptrace.h>
18#include <linux/tracehook.h>
18#include <linux/unistd.h> 19#include <linux/unistd.h>
19#include <linux/stddef.h> 20#include <linux/stddef.h>
20#include <linux/personality.h> 21#include <linux/personality.h>
21#include <linux/compiler.h> 22#include <linux/compiler.h>
23#include <linux/uaccess.h>
24
22#include <asm/processor.h> 25#include <asm/processor.h>
23#include <asm/ucontext.h> 26#include <asm/ucontext.h>
24#include <asm/uaccess.h>
25#include <asm/i387.h> 27#include <asm/i387.h>
26#include <asm/proto.h> 28#include <asm/proto.h>
27#include <asm/ia32_unistd.h> 29#include <asm/ia32_unistd.h>
28#include <asm/mce.h> 30#include <asm/mce.h>
31#include <asm/syscall.h>
29#include <asm/syscalls.h> 32#include <asm/syscalls.h>
30#include "sigframe.h" 33#include "sigframe.h"
31 34
@@ -42,11 +45,6 @@
42# define FIX_EFLAGS __FIX_EFLAGS 45# define FIX_EFLAGS __FIX_EFLAGS
43#endif 46#endif
44 47
45int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
46 sigset_t *set, struct pt_regs * regs);
47int ia32_setup_frame(int sig, struct k_sigaction *ka,
48 sigset_t *set, struct pt_regs * regs);
49
50asmlinkage long 48asmlinkage long
51sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, 49sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
52 struct pt_regs *regs) 50 struct pt_regs *regs)
@@ -66,7 +64,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
66 /* Always make any pending restarted system calls return -EINTR */ 64 /* Always make any pending restarted system calls return -EINTR */
67 current_thread_info()->restart_block.fn = do_no_restart_syscall; 65 current_thread_info()->restart_block.fn = do_no_restart_syscall;
68 66
69#define COPY(x) err |= __get_user(regs->x, &sc->x) 67#define COPY(x) (err |= __get_user(regs->x, &sc->x))
70 68
71 COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx); 69 COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx);
72 COPY(dx); COPY(cx); COPY(ip); 70 COPY(dx); COPY(cx); COPY(ip);
@@ -96,7 +94,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
96 } 94 }
97 95
98 { 96 {
99 struct _fpstate __user * buf; 97 struct _fpstate __user *buf;
100 err |= __get_user(buf, &sc->fpstate); 98 err |= __get_user(buf, &sc->fpstate);
101 err |= restore_i387_xstate(buf); 99 err |= restore_i387_xstate(buf);
102 } 100 }
@@ -122,7 +120,7 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
122 current->blocked = set; 120 current->blocked = set;
123 recalc_sigpending(); 121 recalc_sigpending();
124 spin_unlock_irq(&current->sighand->siglock); 122 spin_unlock_irq(&current->sighand->siglock);
125 123
126 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax)) 124 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &ax))
127 goto badframe; 125 goto badframe;
128 126
@@ -132,16 +130,17 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
132 return ax; 130 return ax;
133 131
134badframe: 132badframe:
135 signal_fault(regs,frame,"sigreturn"); 133 signal_fault(regs, frame, "sigreturn");
136 return 0; 134 return 0;
137} 135}
138 136
139/* 137/*
140 * Set up a signal frame. 138 * Set up a signal frame.
141 */ 139 */
142 140
143static inline int 141static inline int
144setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, unsigned long mask, struct task_struct *me) 142setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
143 unsigned long mask, struct task_struct *me)
145{ 144{
146 int err = 0; 145 int err = 0;
147 146
@@ -197,7 +196,7 @@ get_stack(struct k_sigaction *ka, struct pt_regs *regs, unsigned long size)
197} 196}
198 197
199static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 198static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
200 sigset_t *set, struct pt_regs * regs) 199 sigset_t *set, struct pt_regs *regs)
201{ 200{
202 struct rt_sigframe __user *frame; 201 struct rt_sigframe __user *frame;
203 void __user *fp = NULL; 202 void __user *fp = NULL;
@@ -210,19 +209,19 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
210 (unsigned long)fp - sizeof(struct rt_sigframe), 16) - 8; 209 (unsigned long)fp - sizeof(struct rt_sigframe), 16) - 8;
211 210
212 if (save_i387_xstate(fp) < 0) 211 if (save_i387_xstate(fp) < 0)
213 err |= -1; 212 err |= -1;
214 } else 213 } else
215 frame = get_stack(ka, regs, sizeof(struct rt_sigframe)) - 8; 214 frame = get_stack(ka, regs, sizeof(struct rt_sigframe)) - 8;
216 215
217 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 216 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
218 goto give_sigsegv; 217 goto give_sigsegv;
219 218
220 if (ka->sa.sa_flags & SA_SIGINFO) { 219 if (ka->sa.sa_flags & SA_SIGINFO) {
221 err |= copy_siginfo_to_user(&frame->info, info); 220 err |= copy_siginfo_to_user(&frame->info, info);
222 if (err) 221 if (err)
223 goto give_sigsegv; 222 goto give_sigsegv;
224 } 223 }
225 224
226 /* Create the ucontext. */ 225 /* Create the ucontext. */
227 if (cpu_has_xsave) 226 if (cpu_has_xsave)
228 err |= __put_user(UC_FP_XSTATE, &frame->uc.uc_flags); 227 err |= __put_user(UC_FP_XSTATE, &frame->uc.uc_flags);
@@ -235,9 +234,9 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
235 err |= __put_user(me->sas_ss_size, &frame->uc.uc_stack.ss_size); 234 err |= __put_user(me->sas_ss_size, &frame->uc.uc_stack.ss_size);
236 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0], me); 235 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0], me);
237 err |= __put_user(fp, &frame->uc.uc_mcontext.fpstate); 236 err |= __put_user(fp, &frame->uc.uc_mcontext.fpstate);
238 if (sizeof(*set) == 16) { 237 if (sizeof(*set) == 16) {
239 __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]); 238 __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]);
240 __put_user(set->sig[1], &frame->uc.uc_sigmask.sig[1]); 239 __put_user(set->sig[1], &frame->uc.uc_sigmask.sig[1]);
241 } else 240 } else
242 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 241 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
243 242
@@ -248,7 +247,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
248 err |= __put_user(ka->sa.sa_restorer, &frame->pretcode); 247 err |= __put_user(ka->sa.sa_restorer, &frame->pretcode);
249 } else { 248 } else {
250 /* could use a vstub here */ 249 /* could use a vstub here */
251 goto give_sigsegv; 250 goto give_sigsegv;
252 } 251 }
253 252
254 if (err) 253 if (err)
@@ -256,7 +255,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
256 255
257 /* Set up registers for signal handler */ 256 /* Set up registers for signal handler */
258 regs->di = sig; 257 regs->di = sig;
259 /* In case the signal handler was declared without prototypes */ 258 /* In case the signal handler was declared without prototypes */
260 regs->ax = 0; 259 regs->ax = 0;
261 260
262 /* This also works for non SA_SIGINFO handlers because they expect the 261 /* This also works for non SA_SIGINFO handlers because they expect the
@@ -279,37 +278,8 @@ give_sigsegv:
279} 278}
280 279
281/* 280/*
282 * Return -1L or the syscall number that @regs is executing.
283 */
284static long current_syscall(struct pt_regs *regs)
285{
286 /*
287 * We always sign-extend a -1 value being set here,
288 * so this is always either -1L or a syscall number.
289 */
290 return regs->orig_ax;
291}
292
293/*
294 * Return a value that is -EFOO if the system call in @regs->orig_ax
295 * returned an error. This only works for @regs from @current.
296 */
297static long current_syscall_ret(struct pt_regs *regs)
298{
299#ifdef CONFIG_IA32_EMULATION
300 if (test_thread_flag(TIF_IA32))
301 /*
302 * Sign-extend the value so (int)-EFOO becomes (long)-EFOO
303 * and will match correctly in comparisons.
304 */
305 return (int) regs->ax;
306#endif
307 return regs->ax;
308}
309
310/*
311 * OK, we're invoking a handler 281 * OK, we're invoking a handler
312 */ 282 */
313 283
314static int 284static int
315handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, 285handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
@@ -318,9 +288,9 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
318 int ret; 288 int ret;
319 289
320 /* Are we from a system call? */ 290 /* Are we from a system call? */
321 if (current_syscall(regs) >= 0) { 291 if (syscall_get_nr(current, regs) >= 0) {
322 /* If so, check system call restarting.. */ 292 /* If so, check system call restarting.. */
323 switch (current_syscall_ret(regs)) { 293 switch (syscall_get_error(current, regs)) {
324 case -ERESTART_RESTARTBLOCK: 294 case -ERESTART_RESTARTBLOCK:
325 case -ERESTARTNOHAND: 295 case -ERESTARTNOHAND:
326 regs->ax = -EINTR; 296 regs->ax = -EINTR;
@@ -353,7 +323,7 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
353 ret = ia32_setup_rt_frame(sig, ka, info, oldset, regs); 323 ret = ia32_setup_rt_frame(sig, ka, info, oldset, regs);
354 else 324 else
355 ret = ia32_setup_frame(sig, ka, oldset, regs); 325 ret = ia32_setup_frame(sig, ka, oldset, regs);
356 } else 326 } else
357#endif 327#endif
358 ret = setup_rt_frame(sig, ka, info, oldset, regs); 328 ret = setup_rt_frame(sig, ka, info, oldset, regs);
359 329
@@ -377,15 +347,16 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
377 * handler too. 347 * handler too.
378 */ 348 */
379 regs->flags &= ~X86_EFLAGS_TF; 349 regs->flags &= ~X86_EFLAGS_TF;
380 if (test_thread_flag(TIF_SINGLESTEP))
381 ptrace_notify(SIGTRAP);
382 350
383 spin_lock_irq(&current->sighand->siglock); 351 spin_lock_irq(&current->sighand->siglock);
384 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 352 sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask);
385 if (!(ka->sa.sa_flags & SA_NODEFER)) 353 if (!(ka->sa.sa_flags & SA_NODEFER))
386 sigaddset(&current->blocked,sig); 354 sigaddset(&current->blocked, sig);
387 recalc_sigpending(); 355 recalc_sigpending();
388 spin_unlock_irq(&current->sighand->siglock); 356 spin_unlock_irq(&current->sighand->siglock);
357
358 tracehook_signal_handler(sig, info, ka, regs,
359 test_thread_flag(TIF_SINGLESTEP));
389 } 360 }
390 361
391 return ret; 362 return ret;
@@ -442,9 +413,9 @@ static void do_signal(struct pt_regs *regs)
442 } 413 }
443 414
444 /* Did we come from a system call? */ 415 /* Did we come from a system call? */
445 if (current_syscall(regs) >= 0) { 416 if (syscall_get_nr(current, regs) >= 0) {
446 /* Restart the system call - no handlers present */ 417 /* Restart the system call - no handlers present */
447 switch (current_syscall_ret(regs)) { 418 switch (syscall_get_error(current, regs)) {
448 case -ERESTARTNOHAND: 419 case -ERESTARTNOHAND:
449 case -ERESTARTSYS: 420 case -ERESTARTSYS:
450 case -ERESTARTNOINTR: 421 case -ERESTARTNOINTR:
@@ -482,17 +453,23 @@ void do_notify_resume(struct pt_regs *regs, void *unused,
482 /* deal with pending signal delivery */ 453 /* deal with pending signal delivery */
483 if (thread_info_flags & _TIF_SIGPENDING) 454 if (thread_info_flags & _TIF_SIGPENDING)
484 do_signal(regs); 455 do_signal(regs);
456
457 if (thread_info_flags & _TIF_NOTIFY_RESUME) {
458 clear_thread_flag(TIF_NOTIFY_RESUME);
459 tracehook_notify_resume(regs);
460 }
485} 461}
486 462
487void signal_fault(struct pt_regs *regs, void __user *frame, char *where) 463void signal_fault(struct pt_regs *regs, void __user *frame, char *where)
488{ 464{
489 struct task_struct *me = current; 465 struct task_struct *me = current;
490 if (show_unhandled_signals && printk_ratelimit()) { 466 if (show_unhandled_signals && printk_ratelimit()) {
491 printk("%s[%d] bad frame in %s frame:%p ip:%lx sp:%lx orax:%lx", 467 printk("%s[%d] bad frame in %s frame:%p ip:%lx sp:%lx orax:%lx",
492 me->comm,me->pid,where,frame,regs->ip,regs->sp,regs->orig_ax); 468 me->comm, me->pid, where, frame, regs->ip,
469 regs->sp, regs->orig_ax);
493 print_vma_addr(" in ", regs->ip); 470 print_vma_addr(" in ", regs->ip);
494 printk("\n"); 471 printk("\n");
495 } 472 }
496 473
497 force_sig(SIGSEGV, me); 474 force_sig(SIGSEGV, me);
498} 475}
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index aa804c64b167..2ff0bbcd5bd1 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1313,16 +1313,13 @@ __init void prefill_possible_map(void)
1313 if (!num_processors) 1313 if (!num_processors)
1314 num_processors = 1; 1314 num_processors = 1;
1315 1315
1316#ifdef CONFIG_HOTPLUG_CPU
1317 if (additional_cpus == -1) { 1316 if (additional_cpus == -1) {
1318 if (disabled_cpus > 0) 1317 if (disabled_cpus > 0)
1319 additional_cpus = disabled_cpus; 1318 additional_cpus = disabled_cpus;
1320 else 1319 else
1321 additional_cpus = 0; 1320 additional_cpus = 0;
1322 } 1321 }
1323#else 1322
1324 additional_cpus = 0;
1325#endif
1326 possible = num_processors + additional_cpus; 1323 possible = num_processors + additional_cpus;
1327 if (possible > NR_CPUS) 1324 if (possible > NR_CPUS)
1328 possible = NR_CPUS; 1325 possible = NR_CPUS;
diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c
index c9288c883e20..6bc211accf08 100644
--- a/arch/x86/kernel/sys_x86_64.c
+++ b/arch/x86/kernel/sys_x86_64.c
@@ -13,16 +13,17 @@
13#include <linux/utsname.h> 13#include <linux/utsname.h>
14#include <linux/personality.h> 14#include <linux/personality.h>
15#include <linux/random.h> 15#include <linux/random.h>
16#include <linux/uaccess.h>
16 17
17#include <asm/uaccess.h>
18#include <asm/ia32.h> 18#include <asm/ia32.h>
19#include <asm/syscalls.h> 19#include <asm/syscalls.h>
20 20
21asmlinkage long sys_mmap(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, 21asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
22 unsigned long fd, unsigned long off) 22 unsigned long prot, unsigned long flags,
23 unsigned long fd, unsigned long off)
23{ 24{
24 long error; 25 long error;
25 struct file * file; 26 struct file *file;
26 27
27 error = -EINVAL; 28 error = -EINVAL;
28 if (off & ~PAGE_MASK) 29 if (off & ~PAGE_MASK)
@@ -57,9 +58,9 @@ static void find_start_end(unsigned long flags, unsigned long *begin,
57 unmapped base down for this case. This can give 58 unmapped base down for this case. This can give
58 conflicts with the heap, but we assume that glibc 59 conflicts with the heap, but we assume that glibc
59 malloc knows how to fall back to mmap. Give it 1GB 60 malloc knows how to fall back to mmap. Give it 1GB
60 of playground for now. -AK */ 61 of playground for now. -AK */
61 *begin = 0x40000000; 62 *begin = 0x40000000;
62 *end = 0x80000000; 63 *end = 0x80000000;
63 if (current->flags & PF_RANDOMIZE) { 64 if (current->flags & PF_RANDOMIZE) {
64 new_begin = randomize_range(*begin, *begin + 0x02000000, 0); 65 new_begin = randomize_range(*begin, *begin + 0x02000000, 0);
65 if (new_begin) 66 if (new_begin)
@@ -67,9 +68,9 @@ static void find_start_end(unsigned long flags, unsigned long *begin,
67 } 68 }
68 } else { 69 } else {
69 *begin = TASK_UNMAPPED_BASE; 70 *begin = TASK_UNMAPPED_BASE;
70 *end = TASK_SIZE; 71 *end = TASK_SIZE;
71 } 72 }
72} 73}
73 74
74unsigned long 75unsigned long
75arch_get_unmapped_area(struct file *filp, unsigned long addr, 76arch_get_unmapped_area(struct file *filp, unsigned long addr,
@@ -79,11 +80,11 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
79 struct vm_area_struct *vma; 80 struct vm_area_struct *vma;
80 unsigned long start_addr; 81 unsigned long start_addr;
81 unsigned long begin, end; 82 unsigned long begin, end;
82 83
83 if (flags & MAP_FIXED) 84 if (flags & MAP_FIXED)
84 return addr; 85 return addr;
85 86
86 find_start_end(flags, &begin, &end); 87 find_start_end(flags, &begin, &end);
87 88
88 if (len > end) 89 if (len > end)
89 return -ENOMEM; 90 return -ENOMEM;
@@ -97,12 +98,12 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
97 } 98 }
98 if (((flags & MAP_32BIT) || test_thread_flag(TIF_IA32)) 99 if (((flags & MAP_32BIT) || test_thread_flag(TIF_IA32))
99 && len <= mm->cached_hole_size) { 100 && len <= mm->cached_hole_size) {
100 mm->cached_hole_size = 0; 101 mm->cached_hole_size = 0;
101 mm->free_area_cache = begin; 102 mm->free_area_cache = begin;
102 } 103 }
103 addr = mm->free_area_cache; 104 addr = mm->free_area_cache;
104 if (addr < begin) 105 if (addr < begin)
105 addr = begin; 106 addr = begin;
106 start_addr = addr; 107 start_addr = addr;
107 108
108full_search: 109full_search:
@@ -128,7 +129,7 @@ full_search:
128 return addr; 129 return addr;
129 } 130 }
130 if (addr + mm->cached_hole_size < vma->vm_start) 131 if (addr + mm->cached_hole_size < vma->vm_start)
131 mm->cached_hole_size = vma->vm_start - addr; 132 mm->cached_hole_size = vma->vm_start - addr;
132 133
133 addr = vma->vm_end; 134 addr = vma->vm_end;
134 } 135 }
@@ -178,7 +179,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
178 vma = find_vma(mm, addr-len); 179 vma = find_vma(mm, addr-len);
179 if (!vma || addr <= vma->vm_start) 180 if (!vma || addr <= vma->vm_start)
180 /* remember the address as a hint for next time */ 181 /* remember the address as a hint for next time */
181 return (mm->free_area_cache = addr-len); 182 return mm->free_area_cache = addr-len;
182 } 183 }
183 184
184 if (mm->mmap_base < len) 185 if (mm->mmap_base < len)
@@ -195,7 +196,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
195 vma = find_vma(mm, addr); 196 vma = find_vma(mm, addr);
196 if (!vma || addr+len <= vma->vm_start) 197 if (!vma || addr+len <= vma->vm_start)
197 /* remember the address as a hint for next time */ 198 /* remember the address as a hint for next time */
198 return (mm->free_area_cache = addr); 199 return mm->free_area_cache = addr;
199 200
200 /* remember the largest hole we saw so far */ 201 /* remember the largest hole we saw so far */
201 if (addr + mm->cached_hole_size < vma->vm_start) 202 if (addr + mm->cached_hole_size < vma->vm_start)
@@ -225,13 +226,13 @@ bottomup:
225} 226}
226 227
227 228
228asmlinkage long sys_uname(struct new_utsname __user * name) 229asmlinkage long sys_uname(struct new_utsname __user *name)
229{ 230{
230 int err; 231 int err;
231 down_read(&uts_sem); 232 down_read(&uts_sem);
232 err = copy_to_user(name, utsname(), sizeof (*name)); 233 err = copy_to_user(name, utsname(), sizeof(*name));
233 up_read(&uts_sem); 234 up_read(&uts_sem);
234 if (personality(current->personality) == PER_LINUX32) 235 if (personality(current->personality) == PER_LINUX32)
235 err |= copy_to_user(&name->machine, "i686", 5); 236 err |= copy_to_user(&name->machine, "i686", 5);
236 return err ? -EFAULT : 0; 237 return err ? -EFAULT : 0;
237} 238}
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c
index b42068fb7b76..2887a789e38f 100644
--- a/arch/x86/kernel/traps_64.c
+++ b/arch/x86/kernel/traps_64.c
@@ -32,6 +32,8 @@
32#include <linux/bug.h> 32#include <linux/bug.h>
33#include <linux/nmi.h> 33#include <linux/nmi.h>
34#include <linux/mm.h> 34#include <linux/mm.h>
35#include <linux/smp.h>
36#include <linux/io.h>
35 37
36#if defined(CONFIG_EDAC) 38#if defined(CONFIG_EDAC)
37#include <linux/edac.h> 39#include <linux/edac.h>
@@ -45,9 +47,6 @@
45#include <asm/unwind.h> 47#include <asm/unwind.h>
46#include <asm/desc.h> 48#include <asm/desc.h>
47#include <asm/i387.h> 49#include <asm/i387.h>
48#include <asm/nmi.h>
49#include <asm/smp.h>
50#include <asm/io.h>
51#include <asm/pgalloc.h> 50#include <asm/pgalloc.h>
52#include <asm/proto.h> 51#include <asm/proto.h>
53#include <asm/pda.h> 52#include <asm/pda.h>
@@ -85,7 +84,8 @@ static inline void preempt_conditional_cli(struct pt_regs *regs)
85 84
86void printk_address(unsigned long address, int reliable) 85void printk_address(unsigned long address, int reliable)
87{ 86{
88 printk(" [<%016lx>] %s%pS\n", address, reliable ? "": "? ", (void *) address); 87 printk(" [<%016lx>] %s%pS\n",
88 address, reliable ? "" : "? ", (void *) address);
89} 89}
90 90
91static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, 91static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
@@ -98,7 +98,8 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
98 [STACKFAULT_STACK - 1] = "#SS", 98 [STACKFAULT_STACK - 1] = "#SS",
99 [MCE_STACK - 1] = "#MC", 99 [MCE_STACK - 1] = "#MC",
100#if DEBUG_STKSZ > EXCEPTION_STKSZ 100#if DEBUG_STKSZ > EXCEPTION_STKSZ
101 [N_EXCEPTION_STACKS ... N_EXCEPTION_STACKS + DEBUG_STKSZ / EXCEPTION_STKSZ - 2] = "#DB[?]" 101 [N_EXCEPTION_STACKS ...
102 N_EXCEPTION_STACKS + DEBUG_STKSZ / EXCEPTION_STKSZ - 2] = "#DB[?]"
102#endif 103#endif
103 }; 104 };
104 unsigned k; 105 unsigned k;
@@ -163,7 +164,7 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
163} 164}
164 165
165/* 166/*
166 * x86-64 can have up to three kernel stacks: 167 * x86-64 can have up to three kernel stacks:
167 * process stack 168 * process stack
168 * interrupt stack 169 * interrupt stack
169 * severe exception (double fault, nmi, stack fault, debug, mce) hardware stack 170 * severe exception (double fault, nmi, stack fault, debug, mce) hardware stack
@@ -219,7 +220,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
219 const struct stacktrace_ops *ops, void *data) 220 const struct stacktrace_ops *ops, void *data)
220{ 221{
221 const unsigned cpu = get_cpu(); 222 const unsigned cpu = get_cpu();
222 unsigned long *irqstack_end = (unsigned long*)cpu_pda(cpu)->irqstackptr; 223 unsigned long *irqstack_end = (unsigned long *)cpu_pda(cpu)->irqstackptr;
223 unsigned used = 0; 224 unsigned used = 0;
224 struct thread_info *tinfo; 225 struct thread_info *tinfo;
225 226
@@ -237,7 +238,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
237 if (!bp) { 238 if (!bp) {
238 if (task == current) { 239 if (task == current) {
239 /* Grab bp right from our regs */ 240 /* Grab bp right from our regs */
240 asm("movq %%rbp, %0" : "=r" (bp) :); 241 asm("movq %%rbp, %0" : "=r" (bp) : );
241 } else { 242 } else {
242 /* bp is the last reg pushed by switch_to */ 243 /* bp is the last reg pushed by switch_to */
243 bp = *(unsigned long *) task->thread.sp; 244 bp = *(unsigned long *) task->thread.sp;
@@ -356,11 +357,15 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
356 unsigned long *stack; 357 unsigned long *stack;
357 int i; 358 int i;
358 const int cpu = smp_processor_id(); 359 const int cpu = smp_processor_id();
359 unsigned long *irqstack_end = (unsigned long *) (cpu_pda(cpu)->irqstackptr); 360 unsigned long *irqstack_end =
360 unsigned long *irqstack = (unsigned long *) (cpu_pda(cpu)->irqstackptr - IRQSTACKSIZE); 361 (unsigned long *) (cpu_pda(cpu)->irqstackptr);
362 unsigned long *irqstack =
363 (unsigned long *) (cpu_pda(cpu)->irqstackptr - IRQSTACKSIZE);
361 364
362 // debugging aid: "show_stack(NULL, NULL);" prints the 365 /*
363 // back trace for this cpu. 366 * debugging aid: "show_stack(NULL, NULL);" prints the
367 * back trace for this cpu.
368 */
364 369
365 if (sp == NULL) { 370 if (sp == NULL) {
366 if (task) 371 if (task)
@@ -404,7 +409,7 @@ void dump_stack(void)
404 409
405#ifdef CONFIG_FRAME_POINTER 410#ifdef CONFIG_FRAME_POINTER
406 if (!bp) 411 if (!bp)
407 asm("movq %%rbp, %0" : "=r" (bp):); 412 asm("movq %%rbp, %0" : "=r" (bp) : );
408#endif 413#endif
409 414
410 printk("Pid: %d, comm: %.20s %s %s %.*s\n", 415 printk("Pid: %d, comm: %.20s %s %s %.*s\n",
@@ -414,7 +419,6 @@ void dump_stack(void)
414 init_utsname()->version); 419 init_utsname()->version);
415 show_trace(NULL, NULL, &stack, bp); 420 show_trace(NULL, NULL, &stack, bp);
416} 421}
417
418EXPORT_SYMBOL(dump_stack); 422EXPORT_SYMBOL(dump_stack);
419 423
420void show_registers(struct pt_regs *regs) 424void show_registers(struct pt_regs *regs)
@@ -492,7 +496,7 @@ unsigned __kprobes long oops_begin(void)
492 raw_local_irq_save(flags); 496 raw_local_irq_save(flags);
493 cpu = smp_processor_id(); 497 cpu = smp_processor_id();
494 if (!__raw_spin_trylock(&die_lock)) { 498 if (!__raw_spin_trylock(&die_lock)) {
495 if (cpu == die_owner) 499 if (cpu == die_owner)
496 /* nested oops. should stop eventually */; 500 /* nested oops. should stop eventually */;
497 else 501 else
498 __raw_spin_lock(&die_lock); 502 __raw_spin_lock(&die_lock);
@@ -637,7 +641,7 @@ kernel_trap:
637} 641}
638 642
639#define DO_ERROR(trapnr, signr, str, name) \ 643#define DO_ERROR(trapnr, signr, str, name) \
640asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ 644asmlinkage void do_##name(struct pt_regs *regs, long error_code) \
641{ \ 645{ \
642 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \ 646 if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
643 == NOTIFY_STOP) \ 647 == NOTIFY_STOP) \
@@ -647,7 +651,7 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
647} 651}
648 652
649#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \ 653#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \
650asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ 654asmlinkage void do_##name(struct pt_regs *regs, long error_code) \
651{ \ 655{ \
652 siginfo_t info; \ 656 siginfo_t info; \
653 info.si_signo = signr; \ 657 info.si_signo = signr; \
@@ -682,7 +686,7 @@ asmlinkage void do_stack_segment(struct pt_regs *regs, long error_code)
682 preempt_conditional_cli(regs); 686 preempt_conditional_cli(regs);
683} 687}
684 688
685asmlinkage void do_double_fault(struct pt_regs * regs, long error_code) 689asmlinkage void do_double_fault(struct pt_regs *regs, long error_code)
686{ 690{
687 static const char str[] = "double fault"; 691 static const char str[] = "double fault";
688 struct task_struct *tsk = current; 692 struct task_struct *tsk = current;
@@ -777,9 +781,10 @@ io_check_error(unsigned char reason, struct pt_regs *regs)
777} 781}
778 782
779static notrace __kprobes void 783static notrace __kprobes void
780unknown_nmi_error(unsigned char reason, struct pt_regs * regs) 784unknown_nmi_error(unsigned char reason, struct pt_regs *regs)
781{ 785{
782 if (notify_die(DIE_NMIUNKNOWN, "nmi", regs, reason, 2, SIGINT) == NOTIFY_STOP) 786 if (notify_die(DIE_NMIUNKNOWN, "nmi", regs, reason, 2, SIGINT) ==
787 NOTIFY_STOP)
783 return; 788 return;
784 printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x.\n", 789 printk(KERN_EMERG "Uhhuh. NMI received for unknown reason %02x.\n",
785 reason); 790 reason);
@@ -881,7 +886,7 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
881 else if (user_mode(eregs)) 886 else if (user_mode(eregs))
882 regs = task_pt_regs(current); 887 regs = task_pt_regs(current);
883 /* Exception from kernel and interrupts are enabled. Move to 888 /* Exception from kernel and interrupts are enabled. Move to
884 kernel process stack. */ 889 kernel process stack. */
885 else if (eregs->flags & X86_EFLAGS_IF) 890 else if (eregs->flags & X86_EFLAGS_IF)
886 regs = (struct pt_regs *)(eregs->sp -= sizeof(struct pt_regs)); 891 regs = (struct pt_regs *)(eregs->sp -= sizeof(struct pt_regs));
887 if (eregs != regs) 892 if (eregs != regs)
@@ -890,7 +895,7 @@ asmlinkage __kprobes struct pt_regs *sync_regs(struct pt_regs *eregs)
890} 895}
891 896
892/* runs on IST stack. */ 897/* runs on IST stack. */
893asmlinkage void __kprobes do_debug(struct pt_regs * regs, 898asmlinkage void __kprobes do_debug(struct pt_regs *regs,
894 unsigned long error_code) 899 unsigned long error_code)
895{ 900{
896 struct task_struct *tsk = current; 901 struct task_struct *tsk = current;
@@ -1034,7 +1039,7 @@ asmlinkage void do_coprocessor_error(struct pt_regs *regs)
1034 1039
1035asmlinkage void bad_intr(void) 1040asmlinkage void bad_intr(void)
1036{ 1041{
1037 printk("bad interrupt"); 1042 printk("bad interrupt");
1038} 1043}
1039 1044
1040asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs) 1045asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs)
@@ -1046,7 +1051,7 @@ asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs)
1046 1051
1047 conditional_sti(regs); 1052 conditional_sti(regs);
1048 if (!user_mode(regs) && 1053 if (!user_mode(regs) &&
1049 kernel_math_error(regs, "kernel simd math error", 19)) 1054 kernel_math_error(regs, "kernel simd math error", 19))
1050 return; 1055 return;
1051 1056
1052 /* 1057 /*
@@ -1091,7 +1096,7 @@ asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs)
1091 force_sig_info(SIGFPE, &info, task); 1096 force_sig_info(SIGFPE, &info, task);
1092} 1097}
1093 1098
1094asmlinkage void do_spurious_interrupt_bug(struct pt_regs * regs) 1099asmlinkage void do_spurious_interrupt_bug(struct pt_regs *regs)
1095{ 1100{
1096} 1101}
1097 1102
@@ -1148,8 +1153,10 @@ void __init trap_init(void)
1148 set_intr_gate(0, &divide_error); 1153 set_intr_gate(0, &divide_error);
1149 set_intr_gate_ist(1, &debug, DEBUG_STACK); 1154 set_intr_gate_ist(1, &debug, DEBUG_STACK);
1150 set_intr_gate_ist(2, &nmi, NMI_STACK); 1155 set_intr_gate_ist(2, &nmi, NMI_STACK);
1151 set_system_gate_ist(3, &int3, DEBUG_STACK); /* int3 can be called from all */ 1156 /* int3 can be called from all */
1152 set_system_gate(4, &overflow); /* int4 can be called from all */ 1157 set_system_gate_ist(3, &int3, DEBUG_STACK);
1158 /* int4 can be called from all */
1159 set_system_gate(4, &overflow);
1153 set_intr_gate(5, &bounds); 1160 set_intr_gate(5, &bounds);
1154 set_intr_gate(6, &invalid_op); 1161 set_intr_gate(6, &invalid_op);
1155 set_intr_gate(7, &device_not_available); 1162 set_intr_gate(7, &device_not_available);
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 8f98e9de1b82..161bb850fc47 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -104,7 +104,7 @@ __setup("notsc", notsc_setup);
104/* 104/*
105 * Read TSC and the reference counters. Take care of SMI disturbance 105 * Read TSC and the reference counters. Take care of SMI disturbance
106 */ 106 */
107static u64 tsc_read_refs(u64 *pm, u64 *hpet) 107static u64 tsc_read_refs(u64 *p, int hpet)
108{ 108{
109 u64 t1, t2; 109 u64 t1, t2;
110 int i; 110 int i;
@@ -112,9 +112,9 @@ static u64 tsc_read_refs(u64 *pm, u64 *hpet)
112 for (i = 0; i < MAX_RETRIES; i++) { 112 for (i = 0; i < MAX_RETRIES; i++) {
113 t1 = get_cycles(); 113 t1 = get_cycles();
114 if (hpet) 114 if (hpet)
115 *hpet = hpet_readl(HPET_COUNTER) & 0xFFFFFFFF; 115 *p = hpet_readl(HPET_COUNTER) & 0xFFFFFFFF;
116 else 116 else
117 *pm = acpi_pm_read_early(); 117 *p = acpi_pm_read_early();
118 t2 = get_cycles(); 118 t2 = get_cycles();
119 if ((t2 - t1) < SMI_TRESHOLD) 119 if ((t2 - t1) < SMI_TRESHOLD)
120 return t2; 120 return t2;
@@ -123,13 +123,59 @@ static u64 tsc_read_refs(u64 *pm, u64 *hpet)
123} 123}
124 124
125/* 125/*
126 * Calculate the TSC frequency from HPET reference
127 */
128static unsigned long calc_hpet_ref(u64 deltatsc, u64 hpet1, u64 hpet2)
129{
130 u64 tmp;
131
132 if (hpet2 < hpet1)
133 hpet2 += 0x100000000ULL;
134 hpet2 -= hpet1;
135 tmp = ((u64)hpet2 * hpet_readl(HPET_PERIOD));
136 do_div(tmp, 1000000);
137 do_div(deltatsc, tmp);
138
139 return (unsigned long) deltatsc;
140}
141
142/*
143 * Calculate the TSC frequency from PMTimer reference
144 */
145static unsigned long calc_pmtimer_ref(u64 deltatsc, u64 pm1, u64 pm2)
146{
147 u64 tmp;
148
149 if (!pm1 && !pm2)
150 return ULONG_MAX;
151
152 if (pm2 < pm1)
153 pm2 += (u64)ACPI_PM_OVRRUN;
154 pm2 -= pm1;
155 tmp = pm2 * 1000000000LL;
156 do_div(tmp, PMTMR_TICKS_PER_SEC);
157 do_div(deltatsc, tmp);
158
159 return (unsigned long) deltatsc;
160}
161
162#define CAL_MS 10
163#define CAL_LATCH (CLOCK_TICK_RATE / (1000 / CAL_MS))
164#define CAL_PIT_LOOPS 1000
165
166#define CAL2_MS 50
167#define CAL2_LATCH (CLOCK_TICK_RATE / (1000 / CAL2_MS))
168#define CAL2_PIT_LOOPS 5000
169
170
171/*
126 * Try to calibrate the TSC against the Programmable 172 * Try to calibrate the TSC against the Programmable
127 * Interrupt Timer and return the frequency of the TSC 173 * Interrupt Timer and return the frequency of the TSC
128 * in kHz. 174 * in kHz.
129 * 175 *
130 * Return ULONG_MAX on failure to calibrate. 176 * Return ULONG_MAX on failure to calibrate.
131 */ 177 */
132static unsigned long pit_calibrate_tsc(void) 178static unsigned long pit_calibrate_tsc(u32 latch, unsigned long ms, int loopmin)
133{ 179{
134 u64 tsc, t1, t2, delta; 180 u64 tsc, t1, t2, delta;
135 unsigned long tscmin, tscmax; 181 unsigned long tscmin, tscmax;
@@ -144,8 +190,8 @@ static unsigned long pit_calibrate_tsc(void)
144 * (LSB then MSB) to begin countdown. 190 * (LSB then MSB) to begin countdown.
145 */ 191 */
146 outb(0xb0, 0x43); 192 outb(0xb0, 0x43);
147 outb((CLOCK_TICK_RATE / (1000 / 50)) & 0xff, 0x42); 193 outb(latch & 0xff, 0x42);
148 outb((CLOCK_TICK_RATE / (1000 / 50)) >> 8, 0x42); 194 outb(latch >> 8, 0x42);
149 195
150 tsc = t1 = t2 = get_cycles(); 196 tsc = t1 = t2 = get_cycles();
151 197
@@ -166,31 +212,154 @@ static unsigned long pit_calibrate_tsc(void)
166 /* 212 /*
167 * Sanity checks: 213 * Sanity checks:
168 * 214 *
169 * If we were not able to read the PIT more than 5000 215 * If we were not able to read the PIT more than loopmin
170 * times, then we have been hit by a massive SMI 216 * times, then we have been hit by a massive SMI
171 * 217 *
172 * If the maximum is 10 times larger than the minimum, 218 * If the maximum is 10 times larger than the minimum,
173 * then we got hit by an SMI as well. 219 * then we got hit by an SMI as well.
174 */ 220 */
175 if (pitcnt < 5000 || tscmax > 10 * tscmin) 221 if (pitcnt < loopmin || tscmax > 10 * tscmin)
176 return ULONG_MAX; 222 return ULONG_MAX;
177 223
178 /* Calculate the PIT value */ 224 /* Calculate the PIT value */
179 delta = t2 - t1; 225 delta = t2 - t1;
180 do_div(delta, 50); 226 do_div(delta, ms);
181 return delta; 227 return delta;
182} 228}
183 229
230/*
231 * This reads the current MSB of the PIT counter, and
232 * checks if we are running on sufficiently fast and
233 * non-virtualized hardware.
234 *
235 * Our expectations are:
236 *
237 * - the PIT is running at roughly 1.19MHz
238 *
239 * - each IO is going to take about 1us on real hardware,
240 * but we allow it to be much faster (by a factor of 10) or
241 * _slightly_ slower (ie we allow up to a 2us read+counter
242 * update - anything else implies a unacceptably slow CPU
243 * or PIT for the fast calibration to work.
244 *
245 * - with 256 PIT ticks to read the value, we have 214us to
246 * see the same MSB (and overhead like doing a single TSC
247 * read per MSB value etc).
248 *
249 * - We're doing 2 reads per loop (LSB, MSB), and we expect
250 * them each to take about a microsecond on real hardware.
251 * So we expect a count value of around 100. But we'll be
252 * generous, and accept anything over 50.
253 *
254 * - if the PIT is stuck, and we see *many* more reads, we
255 * return early (and the next caller of pit_expect_msb()
256 * then consider it a failure when they don't see the
257 * next expected value).
258 *
259 * These expectations mean that we know that we have seen the
260 * transition from one expected value to another with a fairly
261 * high accuracy, and we didn't miss any events. We can thus
262 * use the TSC value at the transitions to calculate a pretty
263 * good value for the TSC frequencty.
264 */
265static inline int pit_expect_msb(unsigned char val)
266{
267 int count = 0;
268
269 for (count = 0; count < 50000; count++) {
270 /* Ignore LSB */
271 inb(0x42);
272 if (inb(0x42) != val)
273 break;
274 }
275 return count > 50;
276}
277
278/*
279 * How many MSB values do we want to see? We aim for a
280 * 15ms calibration, which assuming a 2us counter read
281 * error should give us roughly 150 ppm precision for
282 * the calibration.
283 */
284#define QUICK_PIT_MS 15
285#define QUICK_PIT_ITERATIONS (QUICK_PIT_MS * PIT_TICK_RATE / 1000 / 256)
286
287static unsigned long quick_pit_calibrate(void)
288{
289 /* Set the Gate high, disable speaker */
290 outb((inb(0x61) & ~0x02) | 0x01, 0x61);
291
292 /*
293 * Counter 2, mode 0 (one-shot), binary count
294 *
295 * NOTE! Mode 2 decrements by two (and then the
296 * output is flipped each time, giving the same
297 * final output frequency as a decrement-by-one),
298 * so mode 0 is much better when looking at the
299 * individual counts.
300 */
301 outb(0xb0, 0x43);
302
303 /* Start at 0xffff */
304 outb(0xff, 0x42);
305 outb(0xff, 0x42);
306
307 if (pit_expect_msb(0xff)) {
308 int i;
309 u64 t1, t2, delta;
310 unsigned char expect = 0xfe;
311
312 t1 = get_cycles();
313 for (i = 0; i < QUICK_PIT_ITERATIONS; i++, expect--) {
314 if (!pit_expect_msb(expect))
315 goto failed;
316 }
317 t2 = get_cycles();
318
319 /*
320 * Make sure we can rely on the second TSC timestamp:
321 */
322 if (!pit_expect_msb(expect))
323 goto failed;
324
325 /*
326 * Ok, if we get here, then we've seen the
327 * MSB of the PIT decrement QUICK_PIT_ITERATIONS
328 * times, and each MSB had many hits, so we never
329 * had any sudden jumps.
330 *
331 * As a result, we can depend on there not being
332 * any odd delays anywhere, and the TSC reads are
333 * reliable.
334 *
335 * kHz = ticks / time-in-seconds / 1000;
336 * kHz = (t2 - t1) / (QPI * 256 / PIT_TICK_RATE) / 1000
337 * kHz = ((t2 - t1) * PIT_TICK_RATE) / (QPI * 256 * 1000)
338 */
339 delta = (t2 - t1)*PIT_TICK_RATE;
340 do_div(delta, QUICK_PIT_ITERATIONS*256*1000);
341 printk("Fast TSC calibration using PIT\n");
342 return delta;
343 }
344failed:
345 return 0;
346}
184 347
185/** 348/**
186 * native_calibrate_tsc - calibrate the tsc on boot 349 * native_calibrate_tsc - calibrate the tsc on boot
187 */ 350 */
188unsigned long native_calibrate_tsc(void) 351unsigned long native_calibrate_tsc(void)
189{ 352{
190 u64 tsc1, tsc2, delta, pm1, pm2, hpet1, hpet2; 353 u64 tsc1, tsc2, delta, ref1, ref2;
191 unsigned long tsc_pit_min = ULONG_MAX, tsc_ref_min = ULONG_MAX; 354 unsigned long tsc_pit_min = ULONG_MAX, tsc_ref_min = ULONG_MAX;
192 unsigned long flags; 355 unsigned long flags, latch, ms, fast_calibrate;
193 int hpet = is_hpet_enabled(), i; 356 int hpet = is_hpet_enabled(), i, loopmin;
357
358 local_irq_save(flags);
359 fast_calibrate = quick_pit_calibrate();
360 local_irq_restore(flags);
361 if (fast_calibrate)
362 return fast_calibrate;
194 363
195 /* 364 /*
196 * Run 5 calibration loops to get the lowest frequency value 365 * Run 5 calibration loops to get the lowest frequency value
@@ -216,7 +385,13 @@ unsigned long native_calibrate_tsc(void)
216 * calibration delay loop as we have to wait for a certain 385 * calibration delay loop as we have to wait for a certain
217 * amount of time anyway. 386 * amount of time anyway.
218 */ 387 */
219 for (i = 0; i < 5; i++) { 388
389 /* Preset PIT loop values */
390 latch = CAL_LATCH;
391 ms = CAL_MS;
392 loopmin = CAL_PIT_LOOPS;
393
394 for (i = 0; i < 3; i++) {
220 unsigned long tsc_pit_khz; 395 unsigned long tsc_pit_khz;
221 396
222 /* 397 /*
@@ -226,16 +401,16 @@ unsigned long native_calibrate_tsc(void)
226 * read the end value. 401 * read the end value.
227 */ 402 */
228 local_irq_save(flags); 403 local_irq_save(flags);
229 tsc1 = tsc_read_refs(&pm1, hpet ? &hpet1 : NULL); 404 tsc1 = tsc_read_refs(&ref1, hpet);
230 tsc_pit_khz = pit_calibrate_tsc(); 405 tsc_pit_khz = pit_calibrate_tsc(latch, ms, loopmin);
231 tsc2 = tsc_read_refs(&pm2, hpet ? &hpet2 : NULL); 406 tsc2 = tsc_read_refs(&ref2, hpet);
232 local_irq_restore(flags); 407 local_irq_restore(flags);
233 408
234 /* Pick the lowest PIT TSC calibration so far */ 409 /* Pick the lowest PIT TSC calibration so far */
235 tsc_pit_min = min(tsc_pit_min, tsc_pit_khz); 410 tsc_pit_min = min(tsc_pit_min, tsc_pit_khz);
236 411
237 /* hpet or pmtimer available ? */ 412 /* hpet or pmtimer available ? */
238 if (!hpet && !pm1 && !pm2) 413 if (!hpet && !ref1 && !ref2)
239 continue; 414 continue;
240 415
241 /* Check, whether the sampling was disturbed by an SMI */ 416 /* Check, whether the sampling was disturbed by an SMI */
@@ -243,23 +418,41 @@ unsigned long native_calibrate_tsc(void)
243 continue; 418 continue;
244 419
245 tsc2 = (tsc2 - tsc1) * 1000000LL; 420 tsc2 = (tsc2 - tsc1) * 1000000LL;
421 if (hpet)
422 tsc2 = calc_hpet_ref(tsc2, ref1, ref2);
423 else
424 tsc2 = calc_pmtimer_ref(tsc2, ref1, ref2);
246 425
247 if (hpet) { 426 tsc_ref_min = min(tsc_ref_min, (unsigned long) tsc2);
248 if (hpet2 < hpet1) 427
249 hpet2 += 0x100000000ULL; 428 /* Check the reference deviation */
250 hpet2 -= hpet1; 429 delta = ((u64) tsc_pit_min) * 100;
251 tsc1 = ((u64)hpet2 * hpet_readl(HPET_PERIOD)); 430 do_div(delta, tsc_ref_min);
252 do_div(tsc1, 1000000); 431
253 } else { 432 /*
254 if (pm2 < pm1) 433 * If both calibration results are inside a 10% window
255 pm2 += (u64)ACPI_PM_OVRRUN; 434 * then we can be sure, that the calibration
256 pm2 -= pm1; 435 * succeeded. We break out of the loop right away. We
257 tsc1 = pm2 * 1000000000LL; 436 * use the reference value, as it is more precise.
258 do_div(tsc1, PMTMR_TICKS_PER_SEC); 437 */
438 if (delta >= 90 && delta <= 110) {
439 printk(KERN_INFO
440 "TSC: PIT calibration matches %s. %d loops\n",
441 hpet ? "HPET" : "PMTIMER", i + 1);
442 return tsc_ref_min;
259 } 443 }
260 444
261 do_div(tsc2, tsc1); 445 /*
262 tsc_ref_min = min(tsc_ref_min, (unsigned long) tsc2); 446 * Check whether PIT failed more than once. This
447 * happens in virtualized environments. We need to
448 * give the virtual PC a slightly longer timeframe for
449 * the HPET/PMTIMER to make the result precise.
450 */
451 if (i == 1 && tsc_pit_min == ULONG_MAX) {
452 latch = CAL2_LATCH;
453 ms = CAL2_MS;
454 loopmin = CAL2_PIT_LOOPS;
455 }
263 } 456 }
264 457
265 /* 458 /*
@@ -270,7 +463,7 @@ unsigned long native_calibrate_tsc(void)
270 printk(KERN_WARNING "TSC: Unable to calibrate against PIT\n"); 463 printk(KERN_WARNING "TSC: Unable to calibrate against PIT\n");
271 464
272 /* We don't have an alternative source, disable TSC */ 465 /* We don't have an alternative source, disable TSC */
273 if (!hpet && !pm1 && !pm2) { 466 if (!hpet && !ref1 && !ref2) {
274 printk("TSC: No reference (HPET/PMTIMER) available\n"); 467 printk("TSC: No reference (HPET/PMTIMER) available\n");
275 return 0; 468 return 0;
276 } 469 }
@@ -278,7 +471,7 @@ unsigned long native_calibrate_tsc(void)
278 /* The alternative source failed as well, disable TSC */ 471 /* The alternative source failed as well, disable TSC */
279 if (tsc_ref_min == ULONG_MAX) { 472 if (tsc_ref_min == ULONG_MAX) {
280 printk(KERN_WARNING "TSC: HPET/PMTIMER calibration " 473 printk(KERN_WARNING "TSC: HPET/PMTIMER calibration "
281 "failed due to SMI disturbance.\n"); 474 "failed.\n");
282 return 0; 475 return 0;
283 } 476 }
284 477
@@ -290,44 +483,25 @@ unsigned long native_calibrate_tsc(void)
290 } 483 }
291 484
292 /* We don't have an alternative source, use the PIT calibration value */ 485 /* We don't have an alternative source, use the PIT calibration value */
293 if (!hpet && !pm1 && !pm2) { 486 if (!hpet && !ref1 && !ref2) {
294 printk(KERN_INFO "TSC: Using PIT calibration value\n"); 487 printk(KERN_INFO "TSC: Using PIT calibration value\n");
295 return tsc_pit_min; 488 return tsc_pit_min;
296 } 489 }
297 490
298 /* The alternative source failed, use the PIT calibration value */ 491 /* The alternative source failed, use the PIT calibration value */
299 if (tsc_ref_min == ULONG_MAX) { 492 if (tsc_ref_min == ULONG_MAX) {
300 printk(KERN_WARNING "TSC: HPET/PMTIMER calibration failed due " 493 printk(KERN_WARNING "TSC: HPET/PMTIMER calibration failed. "
301 "to SMI disturbance. Using PIT calibration\n"); 494 "Using PIT calibration\n");
302 return tsc_pit_min; 495 return tsc_pit_min;
303 } 496 }
304 497
305 /* Check the reference deviation */
306 delta = ((u64) tsc_pit_min) * 100;
307 do_div(delta, tsc_ref_min);
308
309 /*
310 * If both calibration results are inside a 5% window, the we
311 * use the lower frequency of those as it is probably the
312 * closest estimate.
313 */
314 if (delta >= 95 && delta <= 105) {
315 printk(KERN_INFO "TSC: PIT calibration confirmed by %s.\n",
316 hpet ? "HPET" : "PMTIMER");
317 printk(KERN_INFO "TSC: using %s calibration value\n",
318 tsc_pit_min <= tsc_ref_min ? "PIT" :
319 hpet ? "HPET" : "PMTIMER");
320 return tsc_pit_min <= tsc_ref_min ? tsc_pit_min : tsc_ref_min;
321 }
322
323 printk(KERN_WARNING "TSC: PIT calibration deviates from %s: %lu %lu.\n",
324 hpet ? "HPET" : "PMTIMER", tsc_pit_min, tsc_ref_min);
325
326 /* 498 /*
327 * The calibration values differ too much. In doubt, we use 499 * The calibration values differ too much. In doubt, we use
328 * the PIT value as we know that there are PMTIMERs around 500 * the PIT value as we know that there are PMTIMERs around
329 * running at double speed. 501 * running at double speed. At least we let the user know:
330 */ 502 */
503 printk(KERN_WARNING "TSC: PIT calibration deviates from %s: %lu %lu.\n",
504 hpet ? "HPET" : "PMTIMER", tsc_pit_min, tsc_ref_min);
331 printk(KERN_INFO "TSC: Using PIT calibration value\n"); 505 printk(KERN_INFO "TSC: Using PIT calibration value\n");
332 return tsc_pit_min; 506 return tsc_pit_min;
333} 507}
diff --git a/arch/x86/kernel/visws_quirks.c b/arch/x86/kernel/visws_quirks.c
index 594ef47f0a63..61a97e616f70 100644
--- a/arch/x86/kernel/visws_quirks.c
+++ b/arch/x86/kernel/visws_quirks.c
@@ -25,45 +25,31 @@
25#include <asm/visws/cobalt.h> 25#include <asm/visws/cobalt.h>
26#include <asm/visws/piix4.h> 26#include <asm/visws/piix4.h>
27#include <asm/arch_hooks.h> 27#include <asm/arch_hooks.h>
28#include <asm/io_apic.h>
28#include <asm/fixmap.h> 29#include <asm/fixmap.h>
29#include <asm/reboot.h> 30#include <asm/reboot.h>
30#include <asm/setup.h> 31#include <asm/setup.h>
31#include <asm/e820.h> 32#include <asm/e820.h>
32#include <asm/smp.h>
33#include <asm/io.h> 33#include <asm/io.h>
34 34
35#include <mach_ipi.h> 35#include <mach_ipi.h>
36 36
37#include "mach_apic.h" 37#include "mach_apic.h"
38 38
39#include <linux/init.h>
40#include <linux/smp.h>
41
42#include <linux/kernel_stat.h> 39#include <linux/kernel_stat.h>
43#include <linux/interrupt.h>
44#include <linux/init.h>
45 40
46#include <asm/io.h>
47#include <asm/apic.h>
48#include <asm/i8259.h> 41#include <asm/i8259.h>
49#include <asm/irq_vectors.h> 42#include <asm/irq_vectors.h>
50#include <asm/visws/cobalt.h>
51#include <asm/visws/lithium.h> 43#include <asm/visws/lithium.h>
52#include <asm/visws/piix4.h>
53 44
54#include <linux/sched.h> 45#include <linux/sched.h>
55#include <linux/kernel.h> 46#include <linux/kernel.h>
56#include <linux/init.h>
57#include <linux/pci.h> 47#include <linux/pci.h>
58#include <linux/pci_ids.h> 48#include <linux/pci_ids.h>
59 49
60extern int no_broadcast; 50extern int no_broadcast;
61 51
62#include <asm/io.h>
63#include <asm/apic.h> 52#include <asm/apic.h>
64#include <asm/arch_hooks.h>
65#include <asm/visws/cobalt.h>
66#include <asm/visws/lithium.h>
67 53
68char visws_board_type = -1; 54char visws_board_type = -1;
69char visws_board_rev = -1; 55char visws_board_rev = -1;
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c
index 61531d5c9507..8b6c393ab9fd 100644
--- a/arch/x86/kernel/vmi_32.c
+++ b/arch/x86/kernel/vmi_32.c
@@ -235,7 +235,7 @@ static void vmi_write_ldt_entry(struct desc_struct *dt, int entry,
235 const void *desc) 235 const void *desc)
236{ 236{
237 u32 *ldt_entry = (u32 *)desc; 237 u32 *ldt_entry = (u32 *)desc;
238 vmi_ops.write_idt_entry(dt, entry, ldt_entry[0], ldt_entry[1]); 238 vmi_ops.write_ldt_entry(dt, entry, ldt_entry[0], ldt_entry[1]);
239} 239}
240 240
241static void vmi_load_sp0(struct tss_struct *tss, 241static void vmi_load_sp0(struct tss_struct *tss,
@@ -393,13 +393,13 @@ static void *vmi_kmap_atomic_pte(struct page *page, enum km_type type)
393} 393}
394#endif 394#endif
395 395
396static void vmi_allocate_pte(struct mm_struct *mm, u32 pfn) 396static void vmi_allocate_pte(struct mm_struct *mm, unsigned long pfn)
397{ 397{
398 vmi_set_page_type(pfn, VMI_PAGE_L1); 398 vmi_set_page_type(pfn, VMI_PAGE_L1);
399 vmi_ops.allocate_page(pfn, VMI_PAGE_L1, 0, 0, 0); 399 vmi_ops.allocate_page(pfn, VMI_PAGE_L1, 0, 0, 0);
400} 400}
401 401
402static void vmi_allocate_pmd(struct mm_struct *mm, u32 pfn) 402static void vmi_allocate_pmd(struct mm_struct *mm, unsigned long pfn)
403{ 403{
404 /* 404 /*
405 * This call comes in very early, before mem_map is setup. 405 * This call comes in very early, before mem_map is setup.
@@ -410,20 +410,20 @@ static void vmi_allocate_pmd(struct mm_struct *mm, u32 pfn)
410 vmi_ops.allocate_page(pfn, VMI_PAGE_L2, 0, 0, 0); 410 vmi_ops.allocate_page(pfn, VMI_PAGE_L2, 0, 0, 0);
411} 411}
412 412
413static void vmi_allocate_pmd_clone(u32 pfn, u32 clonepfn, u32 start, u32 count) 413static void vmi_allocate_pmd_clone(unsigned long pfn, unsigned long clonepfn, unsigned long start, unsigned long count)
414{ 414{
415 vmi_set_page_type(pfn, VMI_PAGE_L2 | VMI_PAGE_CLONE); 415 vmi_set_page_type(pfn, VMI_PAGE_L2 | VMI_PAGE_CLONE);
416 vmi_check_page_type(clonepfn, VMI_PAGE_L2); 416 vmi_check_page_type(clonepfn, VMI_PAGE_L2);
417 vmi_ops.allocate_page(pfn, VMI_PAGE_L2 | VMI_PAGE_CLONE, clonepfn, start, count); 417 vmi_ops.allocate_page(pfn, VMI_PAGE_L2 | VMI_PAGE_CLONE, clonepfn, start, count);
418} 418}
419 419
420static void vmi_release_pte(u32 pfn) 420static void vmi_release_pte(unsigned long pfn)
421{ 421{
422 vmi_ops.release_page(pfn, VMI_PAGE_L1); 422 vmi_ops.release_page(pfn, VMI_PAGE_L1);
423 vmi_set_page_type(pfn, VMI_PAGE_NORMAL); 423 vmi_set_page_type(pfn, VMI_PAGE_NORMAL);
424} 424}
425 425
426static void vmi_release_pmd(u32 pfn) 426static void vmi_release_pmd(unsigned long pfn)
427{ 427{
428 vmi_ops.release_page(pfn, VMI_PAGE_L2); 428 vmi_ops.release_page(pfn, VMI_PAGE_L2);
429 vmi_set_page_type(pfn, VMI_PAGE_NORMAL); 429 vmi_set_page_type(pfn, VMI_PAGE_NORMAL);
diff --git a/arch/x86/kernel/vsmp_64.c b/arch/x86/kernel/vsmp_64.c
index 0c029e8959c7..7766d36983fc 100644
--- a/arch/x86/kernel/vsmp_64.c
+++ b/arch/x86/kernel/vsmp_64.c
@@ -61,7 +61,7 @@ static void vsmp_irq_enable(void)
61 native_restore_fl((flags | X86_EFLAGS_IF) & (~X86_EFLAGS_AC)); 61 native_restore_fl((flags | X86_EFLAGS_IF) & (~X86_EFLAGS_AC));
62} 62}
63 63
64static unsigned __init vsmp_patch(u8 type, u16 clobbers, void *ibuf, 64static unsigned __init_or_module vsmp_patch(u8 type, u16 clobbers, void *ibuf,
65 unsigned long addr, unsigned len) 65 unsigned long addr, unsigned len)
66{ 66{
67 switch (type) { 67 switch (type) {
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 0bfe2bd305eb..3da2508eb22a 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -711,6 +711,10 @@ static int kvm_age_rmapp(struct kvm *kvm, unsigned long *rmapp)
711 u64 *spte; 711 u64 *spte;
712 int young = 0; 712 int young = 0;
713 713
714 /* always return old for EPT */
715 if (!shadow_accessed_mask)
716 return 0;
717
714 spte = rmap_next(kvm, rmapp, NULL); 718 spte = rmap_next(kvm, rmapp, NULL);
715 while (spte) { 719 while (spte) {
716 int _young; 720 int _young;
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index e2ee264740c7..8233b86c778c 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -62,6 +62,7 @@ static int npt = 1;
62module_param(npt, int, S_IRUGO); 62module_param(npt, int, S_IRUGO);
63 63
64static void kvm_reput_irq(struct vcpu_svm *svm); 64static void kvm_reput_irq(struct vcpu_svm *svm);
65static void svm_flush_tlb(struct kvm_vcpu *vcpu);
65 66
66static inline struct vcpu_svm *to_svm(struct kvm_vcpu *vcpu) 67static inline struct vcpu_svm *to_svm(struct kvm_vcpu *vcpu)
67{ 68{
@@ -878,6 +879,10 @@ set:
878static void svm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) 879static void svm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
879{ 880{
880 unsigned long host_cr4_mce = read_cr4() & X86_CR4_MCE; 881 unsigned long host_cr4_mce = read_cr4() & X86_CR4_MCE;
882 unsigned long old_cr4 = to_svm(vcpu)->vmcb->save.cr4;
883
884 if (npt_enabled && ((old_cr4 ^ cr4) & X86_CR4_PGE))
885 force_new_asid(vcpu);
881 886
882 vcpu->arch.cr4 = cr4; 887 vcpu->arch.cr4 = cr4;
883 if (!npt_enabled) 888 if (!npt_enabled)
@@ -1027,6 +1032,13 @@ static int pf_interception(struct vcpu_svm *svm, struct kvm_run *kvm_run)
1027 KVMTRACE_3D(TDP_FAULT, &svm->vcpu, error_code, 1032 KVMTRACE_3D(TDP_FAULT, &svm->vcpu, error_code,
1028 (u32)fault_address, (u32)(fault_address >> 32), 1033 (u32)fault_address, (u32)(fault_address >> 32),
1029 handler); 1034 handler);
1035 /*
1036 * FIXME: Tis shouldn't be necessary here, but there is a flush
1037 * missing in the MMU code. Until we find this bug, flush the
1038 * complete TLB here on an NPF
1039 */
1040 if (npt_enabled)
1041 svm_flush_tlb(&svm->vcpu);
1030 1042
1031 if (event_injection) 1043 if (event_injection)
1032 kvm_mmu_unprotect_page_virt(&svm->vcpu, fault_address); 1044 kvm_mmu_unprotect_page_virt(&svm->vcpu, fault_address);
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 2a69773e3b26..7041cc52b562 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -3301,8 +3301,7 @@ static int __init vmx_init(void)
3301 kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK | 3301 kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK |
3302 VMX_EPT_WRITABLE_MASK | 3302 VMX_EPT_WRITABLE_MASK |
3303 VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT); 3303 VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT);
3304 kvm_mmu_set_mask_ptes(0ull, VMX_EPT_FAKE_ACCESSED_MASK, 3304 kvm_mmu_set_mask_ptes(0ull, 0ull, 0ull, 0ull,
3305 VMX_EPT_FAKE_DIRTY_MASK, 0ull,
3306 VMX_EPT_EXECUTABLE_MASK); 3305 VMX_EPT_EXECUTABLE_MASK);
3307 kvm_enable_tdp(); 3306 kvm_enable_tdp();
3308 } else 3307 } else
diff --git a/arch/x86/kvm/vmx.h b/arch/x86/kvm/vmx.h
index b32d4e5b123d..17e25995b65b 100644
--- a/arch/x86/kvm/vmx.h
+++ b/arch/x86/kvm/vmx.h
@@ -355,8 +355,6 @@ enum vmcs_field {
355#define VMX_EPT_READABLE_MASK 0x1ull 355#define VMX_EPT_READABLE_MASK 0x1ull
356#define VMX_EPT_WRITABLE_MASK 0x2ull 356#define VMX_EPT_WRITABLE_MASK 0x2ull
357#define VMX_EPT_EXECUTABLE_MASK 0x4ull 357#define VMX_EPT_EXECUTABLE_MASK 0x4ull
358#define VMX_EPT_FAKE_ACCESSED_MASK (1ull << 62)
359#define VMX_EPT_FAKE_DIRTY_MASK (1ull << 63)
360 358
361#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfffbc000ul 359#define VMX_EPT_IDENTITY_PAGETABLE_ADDR 0xfffbc000ul
362 360
diff --git a/arch/x86/lib/msr-on-cpu.c b/arch/x86/lib/msr-on-cpu.c
index 01b868ba82f8..321cf720dbb6 100644
--- a/arch/x86/lib/msr-on-cpu.c
+++ b/arch/x86/lib/msr-on-cpu.c
@@ -16,37 +16,46 @@ static void __rdmsr_on_cpu(void *info)
16 rdmsr(rv->msr_no, rv->l, rv->h); 16 rdmsr(rv->msr_no, rv->l, rv->h);
17} 17}
18 18
19static void __rdmsr_safe_on_cpu(void *info) 19static void __wrmsr_on_cpu(void *info)
20{ 20{
21 struct msr_info *rv = info; 21 struct msr_info *rv = info;
22 22
23 rv->err = rdmsr_safe(rv->msr_no, &rv->l, &rv->h); 23 wrmsr(rv->msr_no, rv->l, rv->h);
24} 24}
25 25
26static int _rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h, int safe) 26int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
27{ 27{
28 int err = 0; 28 int err;
29 struct msr_info rv; 29 struct msr_info rv;
30 30
31 rv.msr_no = msr_no; 31 rv.msr_no = msr_no;
32 if (safe) { 32 err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1);
33 err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu,
34 &rv, 1);
35 err = err ? err : rv.err;
36 } else {
37 err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1);
38 }
39 *l = rv.l; 33 *l = rv.l;
40 *h = rv.h; 34 *h = rv.h;
41 35
42 return err; 36 return err;
43} 37}
44 38
45static void __wrmsr_on_cpu(void *info) 39int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
40{
41 int err;
42 struct msr_info rv;
43
44 rv.msr_no = msr_no;
45 rv.l = l;
46 rv.h = h;
47 err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1);
48
49 return err;
50}
51
52/* These "safe" variants are slower and should be used when the target MSR
53 may not actually exist. */
54static void __rdmsr_safe_on_cpu(void *info)
46{ 55{
47 struct msr_info *rv = info; 56 struct msr_info *rv = info;
48 57
49 wrmsr(rv->msr_no, rv->l, rv->h); 58 rv->err = rdmsr_safe(rv->msr_no, &rv->l, &rv->h);
50} 59}
51 60
52static void __wrmsr_safe_on_cpu(void *info) 61static void __wrmsr_safe_on_cpu(void *info)
@@ -56,45 +65,30 @@ static void __wrmsr_safe_on_cpu(void *info)
56 rv->err = wrmsr_safe(rv->msr_no, rv->l, rv->h); 65 rv->err = wrmsr_safe(rv->msr_no, rv->l, rv->h);
57} 66}
58 67
59static int _wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h, int safe) 68int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
60{ 69{
61 int err = 0; 70 int err;
62 struct msr_info rv; 71 struct msr_info rv;
63 72
64 rv.msr_no = msr_no; 73 rv.msr_no = msr_no;
65 rv.l = l; 74 err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1);
66 rv.h = h; 75 *l = rv.l;
67 if (safe) { 76 *h = rv.h;
68 err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu,
69 &rv, 1);
70 err = err ? err : rv.err;
71 } else {
72 err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1);
73 }
74
75 return err;
76}
77 77
78int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) 78 return err ? err : rv.err;
79{
80 return _wrmsr_on_cpu(cpu, msr_no, l, h, 0);
81} 79}
82 80
83int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
84{
85 return _rdmsr_on_cpu(cpu, msr_no, l, h, 0);
86}
87
88/* These "safe" variants are slower and should be used when the target MSR
89 may not actually exist. */
90int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h) 81int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
91{ 82{
92 return _wrmsr_on_cpu(cpu, msr_no, l, h, 1); 83 int err;
93} 84 struct msr_info rv;
94 85
95int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h) 86 rv.msr_no = msr_no;
96{ 87 rv.l = l;
97 return _rdmsr_on_cpu(cpu, msr_no, l, h, 1); 88 rv.h = h;
89 err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 1);
90
91 return err ? err : rv.err;
98} 92}
99 93
100EXPORT_SYMBOL(rdmsr_on_cpu); 94EXPORT_SYMBOL(rdmsr_on_cpu);
diff --git a/arch/x86/lib/string_32.c b/arch/x86/lib/string_32.c
index 94972e7c094d..82004d2bf05e 100644
--- a/arch/x86/lib/string_32.c
+++ b/arch/x86/lib/string_32.c
@@ -22,7 +22,7 @@ char *strcpy(char *dest, const char *src)
22 "testb %%al,%%al\n\t" 22 "testb %%al,%%al\n\t"
23 "jne 1b" 23 "jne 1b"
24 : "=&S" (d0), "=&D" (d1), "=&a" (d2) 24 : "=&S" (d0), "=&D" (d1), "=&a" (d2)
25 :"0" (src), "1" (dest) : "memory"); 25 : "0" (src), "1" (dest) : "memory");
26 return dest; 26 return dest;
27} 27}
28EXPORT_SYMBOL(strcpy); 28EXPORT_SYMBOL(strcpy);
@@ -42,7 +42,7 @@ char *strncpy(char *dest, const char *src, size_t count)
42 "stosb\n" 42 "stosb\n"
43 "2:" 43 "2:"
44 : "=&S" (d0), "=&D" (d1), "=&c" (d2), "=&a" (d3) 44 : "=&S" (d0), "=&D" (d1), "=&c" (d2), "=&a" (d3)
45 :"0" (src), "1" (dest), "2" (count) : "memory"); 45 : "0" (src), "1" (dest), "2" (count) : "memory");
46 return dest; 46 return dest;
47} 47}
48EXPORT_SYMBOL(strncpy); 48EXPORT_SYMBOL(strncpy);
@@ -60,7 +60,7 @@ char *strcat(char *dest, const char *src)
60 "testb %%al,%%al\n\t" 60 "testb %%al,%%al\n\t"
61 "jne 1b" 61 "jne 1b"
62 : "=&S" (d0), "=&D" (d1), "=&a" (d2), "=&c" (d3) 62 : "=&S" (d0), "=&D" (d1), "=&a" (d2), "=&c" (d3)
63 : "0" (src), "1" (dest), "2" (0), "3" (0xffffffffu): "memory"); 63 : "0" (src), "1" (dest), "2" (0), "3" (0xffffffffu) : "memory");
64 return dest; 64 return dest;
65} 65}
66EXPORT_SYMBOL(strcat); 66EXPORT_SYMBOL(strcat);
@@ -105,9 +105,9 @@ int strcmp(const char *cs, const char *ct)
105 "2:\tsbbl %%eax,%%eax\n\t" 105 "2:\tsbbl %%eax,%%eax\n\t"
106 "orb $1,%%al\n" 106 "orb $1,%%al\n"
107 "3:" 107 "3:"
108 :"=a" (res), "=&S" (d0), "=&D" (d1) 108 : "=a" (res), "=&S" (d0), "=&D" (d1)
109 :"1" (cs), "2" (ct) 109 : "1" (cs), "2" (ct)
110 :"memory"); 110 : "memory");
111 return res; 111 return res;
112} 112}
113EXPORT_SYMBOL(strcmp); 113EXPORT_SYMBOL(strcmp);
@@ -130,9 +130,9 @@ int strncmp(const char *cs, const char *ct, size_t count)
130 "3:\tsbbl %%eax,%%eax\n\t" 130 "3:\tsbbl %%eax,%%eax\n\t"
131 "orb $1,%%al\n" 131 "orb $1,%%al\n"
132 "4:" 132 "4:"
133 :"=a" (res), "=&S" (d0), "=&D" (d1), "=&c" (d2) 133 : "=a" (res), "=&S" (d0), "=&D" (d1), "=&c" (d2)
134 :"1" (cs), "2" (ct), "3" (count) 134 : "1" (cs), "2" (ct), "3" (count)
135 :"memory"); 135 : "memory");
136 return res; 136 return res;
137} 137}
138EXPORT_SYMBOL(strncmp); 138EXPORT_SYMBOL(strncmp);
@@ -152,9 +152,9 @@ char *strchr(const char *s, int c)
152 "movl $1,%1\n" 152 "movl $1,%1\n"
153 "2:\tmovl %1,%0\n\t" 153 "2:\tmovl %1,%0\n\t"
154 "decl %0" 154 "decl %0"
155 :"=a" (res), "=&S" (d0) 155 : "=a" (res), "=&S" (d0)
156 :"1" (s), "0" (c) 156 : "1" (s), "0" (c)
157 :"memory"); 157 : "memory");
158 return res; 158 return res;
159} 159}
160EXPORT_SYMBOL(strchr); 160EXPORT_SYMBOL(strchr);
@@ -169,9 +169,9 @@ size_t strlen(const char *s)
169 "scasb\n\t" 169 "scasb\n\t"
170 "notl %0\n\t" 170 "notl %0\n\t"
171 "decl %0" 171 "decl %0"
172 :"=c" (res), "=&D" (d0) 172 : "=c" (res), "=&D" (d0)
173 :"1" (s), "a" (0), "0" (0xffffffffu) 173 : "1" (s), "a" (0), "0" (0xffffffffu)
174 :"memory"); 174 : "memory");
175 return res; 175 return res;
176} 176}
177EXPORT_SYMBOL(strlen); 177EXPORT_SYMBOL(strlen);
@@ -189,9 +189,9 @@ void *memchr(const void *cs, int c, size_t count)
189 "je 1f\n\t" 189 "je 1f\n\t"
190 "movl $1,%0\n" 190 "movl $1,%0\n"
191 "1:\tdecl %0" 191 "1:\tdecl %0"
192 :"=D" (res), "=&c" (d0) 192 : "=D" (res), "=&c" (d0)
193 :"a" (c), "0" (cs), "1" (count) 193 : "a" (c), "0" (cs), "1" (count)
194 :"memory"); 194 : "memory");
195 return res; 195 return res;
196} 196}
197EXPORT_SYMBOL(memchr); 197EXPORT_SYMBOL(memchr);
@@ -228,9 +228,9 @@ size_t strnlen(const char *s, size_t count)
228 "cmpl $-1,%1\n\t" 228 "cmpl $-1,%1\n\t"
229 "jne 1b\n" 229 "jne 1b\n"
230 "3:\tsubl %2,%0" 230 "3:\tsubl %2,%0"
231 :"=a" (res), "=&d" (d0) 231 : "=a" (res), "=&d" (d0)
232 :"c" (s), "1" (count) 232 : "c" (s), "1" (count)
233 :"memory"); 233 : "memory");
234 return res; 234 return res;
235} 235}
236EXPORT_SYMBOL(strnlen); 236EXPORT_SYMBOL(strnlen);
diff --git a/arch/x86/lib/strstr_32.c b/arch/x86/lib/strstr_32.c
index 42e8a50303f3..8e2d55f754bf 100644
--- a/arch/x86/lib/strstr_32.c
+++ b/arch/x86/lib/strstr_32.c
@@ -23,9 +23,9 @@ __asm__ __volatile__(
23 "jne 1b\n\t" 23 "jne 1b\n\t"
24 "xorl %%eax,%%eax\n\t" 24 "xorl %%eax,%%eax\n\t"
25 "2:" 25 "2:"
26 :"=a" (__res), "=&c" (d0), "=&S" (d1) 26 : "=a" (__res), "=&c" (d0), "=&S" (d1)
27 :"0" (0), "1" (0xffffffff), "2" (cs), "g" (ct) 27 : "0" (0), "1" (0xffffffff), "2" (cs), "g" (ct)
28 :"dx", "di"); 28 : "dx", "di");
29return __res; 29return __res;
30} 30}
31 31
diff --git a/arch/x86/mm/discontig_32.c b/arch/x86/mm/discontig_32.c
index 62fa440678d8..847c164725f4 100644
--- a/arch/x86/mm/discontig_32.c
+++ b/arch/x86/mm/discontig_32.c
@@ -328,7 +328,7 @@ void __init initmem_init(unsigned long start_pfn,
328 328
329 get_memcfg_numa(); 329 get_memcfg_numa();
330 330
331 kva_pages = round_up(calculate_numa_remap_pages(), PTRS_PER_PTE); 331 kva_pages = roundup(calculate_numa_remap_pages(), PTRS_PER_PTE);
332 332
333 kva_target_pfn = round_down(max_low_pfn - kva_pages, PTRS_PER_PTE); 333 kva_target_pfn = round_down(max_low_pfn - kva_pages, PTRS_PER_PTE);
334 do { 334 do {
diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
index a20d1fa64b4e..e7277cbcfb40 100644
--- a/arch/x86/mm/dump_pagetables.c
+++ b/arch/x86/mm/dump_pagetables.c
@@ -148,8 +148,8 @@ static void note_page(struct seq_file *m, struct pg_state *st,
148 * we have now. "break" is either changing perms, levels or 148 * we have now. "break" is either changing perms, levels or
149 * address space marker. 149 * address space marker.
150 */ 150 */
151 prot = pgprot_val(new_prot) & ~(PTE_PFN_MASK); 151 prot = pgprot_val(new_prot) & PTE_FLAGS_MASK;
152 cur = pgprot_val(st->current_prot) & ~(PTE_PFN_MASK); 152 cur = pgprot_val(st->current_prot) & PTE_FLAGS_MASK;
153 153
154 if (!st->level) { 154 if (!st->level) {
155 /* First entry */ 155 /* First entry */
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 4974e97dedfe..c3789bb19308 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -195,11 +195,30 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base,
195 pgd_t *pgd; 195 pgd_t *pgd;
196 pmd_t *pmd; 196 pmd_t *pmd;
197 pte_t *pte; 197 pte_t *pte;
198 unsigned pages_2m = 0, pages_4k = 0; 198 unsigned pages_2m, pages_4k;
199 int mapping_iter;
200
201 /*
202 * First iteration will setup identity mapping using large/small pages
203 * based on use_pse, with other attributes same as set by
204 * the early code in head_32.S
205 *
206 * Second iteration will setup the appropriate attributes (NX, GLOBAL..)
207 * as desired for the kernel identity mapping.
208 *
209 * This two pass mechanism conforms to the TLB app note which says:
210 *
211 * "Software should not write to a paging-structure entry in a way
212 * that would change, for any linear address, both the page size
213 * and either the page frame or attributes."
214 */
215 mapping_iter = 1;
199 216
200 if (!cpu_has_pse) 217 if (!cpu_has_pse)
201 use_pse = 0; 218 use_pse = 0;
202 219
220repeat:
221 pages_2m = pages_4k = 0;
203 pfn = start_pfn; 222 pfn = start_pfn;
204 pgd_idx = pgd_index((pfn<<PAGE_SHIFT) + PAGE_OFFSET); 223 pgd_idx = pgd_index((pfn<<PAGE_SHIFT) + PAGE_OFFSET);
205 pgd = pgd_base + pgd_idx; 224 pgd = pgd_base + pgd_idx;
@@ -225,6 +244,13 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base,
225 if (use_pse) { 244 if (use_pse) {
226 unsigned int addr2; 245 unsigned int addr2;
227 pgprot_t prot = PAGE_KERNEL_LARGE; 246 pgprot_t prot = PAGE_KERNEL_LARGE;
247 /*
248 * first pass will use the same initial
249 * identity mapping attribute + _PAGE_PSE.
250 */
251 pgprot_t init_prot =
252 __pgprot(PTE_IDENT_ATTR |
253 _PAGE_PSE);
228 254
229 addr2 = (pfn + PTRS_PER_PTE-1) * PAGE_SIZE + 255 addr2 = (pfn + PTRS_PER_PTE-1) * PAGE_SIZE +
230 PAGE_OFFSET + PAGE_SIZE-1; 256 PAGE_OFFSET + PAGE_SIZE-1;
@@ -234,7 +260,10 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base,
234 prot = PAGE_KERNEL_LARGE_EXEC; 260 prot = PAGE_KERNEL_LARGE_EXEC;
235 261
236 pages_2m++; 262 pages_2m++;
237 set_pmd(pmd, pfn_pmd(pfn, prot)); 263 if (mapping_iter == 1)
264 set_pmd(pmd, pfn_pmd(pfn, init_prot));
265 else
266 set_pmd(pmd, pfn_pmd(pfn, prot));
238 267
239 pfn += PTRS_PER_PTE; 268 pfn += PTRS_PER_PTE;
240 continue; 269 continue;
@@ -246,17 +275,43 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base,
246 for (; pte_ofs < PTRS_PER_PTE && pfn < end_pfn; 275 for (; pte_ofs < PTRS_PER_PTE && pfn < end_pfn;
247 pte++, pfn++, pte_ofs++, addr += PAGE_SIZE) { 276 pte++, pfn++, pte_ofs++, addr += PAGE_SIZE) {
248 pgprot_t prot = PAGE_KERNEL; 277 pgprot_t prot = PAGE_KERNEL;
278 /*
279 * first pass will use the same initial
280 * identity mapping attribute.
281 */
282 pgprot_t init_prot = __pgprot(PTE_IDENT_ATTR);
249 283
250 if (is_kernel_text(addr)) 284 if (is_kernel_text(addr))
251 prot = PAGE_KERNEL_EXEC; 285 prot = PAGE_KERNEL_EXEC;
252 286
253 pages_4k++; 287 pages_4k++;
254 set_pte(pte, pfn_pte(pfn, prot)); 288 if (mapping_iter == 1)
289 set_pte(pte, pfn_pte(pfn, init_prot));
290 else
291 set_pte(pte, pfn_pte(pfn, prot));
255 } 292 }
256 } 293 }
257 } 294 }
258 update_page_count(PG_LEVEL_2M, pages_2m); 295 if (mapping_iter == 1) {
259 update_page_count(PG_LEVEL_4K, pages_4k); 296 /*
297 * update direct mapping page count only in the first
298 * iteration.
299 */
300 update_page_count(PG_LEVEL_2M, pages_2m);
301 update_page_count(PG_LEVEL_4K, pages_4k);
302
303 /*
304 * local global flush tlb, which will flush the previous
305 * mappings present in both small and large page TLB's.
306 */
307 __flush_tlb_all();
308
309 /*
310 * Second iteration will set the actual desired PTE attributes.
311 */
312 mapping_iter = 2;
313 goto repeat;
314 }
260} 315}
261 316
262/* 317/*
@@ -459,11 +514,7 @@ static void __init pagetable_init(void)
459{ 514{
460 pgd_t *pgd_base = swapper_pg_dir; 515 pgd_t *pgd_base = swapper_pg_dir;
461 516
462 paravirt_pagetable_setup_start(pgd_base);
463
464 permanent_kmaps_init(pgd_base); 517 permanent_kmaps_init(pgd_base);
465
466 paravirt_pagetable_setup_done(pgd_base);
467} 518}
468 519
469#ifdef CONFIG_ACPI_SLEEP 520#ifdef CONFIG_ACPI_SLEEP
@@ -723,7 +774,7 @@ void __init setup_bootmem_allocator(void)
723 after_init_bootmem = 1; 774 after_init_bootmem = 1;
724} 775}
725 776
726static void __init find_early_table_space(unsigned long end) 777static void __init find_early_table_space(unsigned long end, int use_pse)
727{ 778{
728 unsigned long puds, pmds, ptes, tables, start; 779 unsigned long puds, pmds, ptes, tables, start;
729 780
@@ -733,7 +784,7 @@ static void __init find_early_table_space(unsigned long end)
733 pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT; 784 pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
734 tables += PAGE_ALIGN(pmds * sizeof(pmd_t)); 785 tables += PAGE_ALIGN(pmds * sizeof(pmd_t));
735 786
736 if (cpu_has_pse) { 787 if (use_pse) {
737 unsigned long extra; 788 unsigned long extra;
738 789
739 extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT); 790 extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT);
@@ -773,12 +824,22 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
773 pgd_t *pgd_base = swapper_pg_dir; 824 pgd_t *pgd_base = swapper_pg_dir;
774 unsigned long start_pfn, end_pfn; 825 unsigned long start_pfn, end_pfn;
775 unsigned long big_page_start; 826 unsigned long big_page_start;
827#ifdef CONFIG_DEBUG_PAGEALLOC
828 /*
829 * For CONFIG_DEBUG_PAGEALLOC, identity mapping will use small pages.
830 * This will simplify cpa(), which otherwise needs to support splitting
831 * large pages into small in interrupt context, etc.
832 */
833 int use_pse = 0;
834#else
835 int use_pse = cpu_has_pse;
836#endif
776 837
777 /* 838 /*
778 * Find space for the kernel direct mapping tables. 839 * Find space for the kernel direct mapping tables.
779 */ 840 */
780 if (!after_init_bootmem) 841 if (!after_init_bootmem)
781 find_early_table_space(end); 842 find_early_table_space(end, use_pse);
782 843
783#ifdef CONFIG_X86_PAE 844#ifdef CONFIG_X86_PAE
784 set_nx(); 845 set_nx();
@@ -824,7 +885,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
824 end_pfn = (end>>PMD_SHIFT) << (PMD_SHIFT - PAGE_SHIFT); 885 end_pfn = (end>>PMD_SHIFT) << (PMD_SHIFT - PAGE_SHIFT);
825 if (start_pfn < end_pfn) 886 if (start_pfn < end_pfn)
826 kernel_physical_mapping_init(pgd_base, start_pfn, end_pfn, 887 kernel_physical_mapping_init(pgd_base, start_pfn, end_pfn,
827 cpu_has_pse); 888 use_pse);
828 889
829 /* tail is not big page alignment ? */ 890 /* tail is not big page alignment ? */
830 start_pfn = end_pfn; 891 start_pfn = end_pfn;
@@ -987,7 +1048,6 @@ void __init mem_init(void)
987 if (boot_cpu_data.wp_works_ok < 0) 1048 if (boot_cpu_data.wp_works_ok < 0)
988 test_wp_bit(); 1049 test_wp_bit();
989 1050
990 cpa_init();
991 save_pg_dir(); 1051 save_pg_dir();
992 zap_low_mappings(); 1052 zap_low_mappings();
993} 1053}
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 1f6806b62eb8..83e13f2d53d2 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -281,7 +281,7 @@ void __init init_extra_mapping_uc(unsigned long phys, unsigned long size)
281void __init cleanup_highmap(void) 281void __init cleanup_highmap(void)
282{ 282{
283 unsigned long vaddr = __START_KERNEL_map; 283 unsigned long vaddr = __START_KERNEL_map;
284 unsigned long end = round_up((unsigned long)_end, PMD_SIZE) - 1; 284 unsigned long end = roundup((unsigned long)_end, PMD_SIZE) - 1;
285 pmd_t *pmd = level2_kernel_pgt; 285 pmd_t *pmd = level2_kernel_pgt;
286 pmd_t *last_pmd = pmd + PTRS_PER_PMD; 286 pmd_t *last_pmd = pmd + PTRS_PER_PMD;
287 287
@@ -327,7 +327,8 @@ static __ref void unmap_low_page(void *adr)
327} 327}
328 328
329static unsigned long __meminit 329static unsigned long __meminit
330phys_pte_init(pte_t *pte_page, unsigned long addr, unsigned long end) 330phys_pte_init(pte_t *pte_page, unsigned long addr, unsigned long end,
331 pgprot_t prot)
331{ 332{
332 unsigned pages = 0; 333 unsigned pages = 0;
333 unsigned long last_map_addr = end; 334 unsigned long last_map_addr = end;
@@ -345,36 +346,43 @@ phys_pte_init(pte_t *pte_page, unsigned long addr, unsigned long end)
345 break; 346 break;
346 } 347 }
347 348
349 /*
350 * We will re-use the existing mapping.
351 * Xen for example has some special requirements, like mapping
352 * pagetable pages as RO. So assume someone who pre-setup
353 * these mappings are more intelligent.
354 */
348 if (pte_val(*pte)) 355 if (pte_val(*pte))
349 continue; 356 continue;
350 357
351 if (0) 358 if (0)
352 printk(" pte=%p addr=%lx pte=%016lx\n", 359 printk(" pte=%p addr=%lx pte=%016lx\n",
353 pte, addr, pfn_pte(addr >> PAGE_SHIFT, PAGE_KERNEL).pte); 360 pte, addr, pfn_pte(addr >> PAGE_SHIFT, PAGE_KERNEL).pte);
354 set_pte(pte, pfn_pte(addr >> PAGE_SHIFT, PAGE_KERNEL));
355 last_map_addr = (addr & PAGE_MASK) + PAGE_SIZE;
356 pages++; 361 pages++;
362 set_pte(pte, pfn_pte(addr >> PAGE_SHIFT, prot));
363 last_map_addr = (addr & PAGE_MASK) + PAGE_SIZE;
357 } 364 }
365
358 update_page_count(PG_LEVEL_4K, pages); 366 update_page_count(PG_LEVEL_4K, pages);
359 367
360 return last_map_addr; 368 return last_map_addr;
361} 369}
362 370
363static unsigned long __meminit 371static unsigned long __meminit
364phys_pte_update(pmd_t *pmd, unsigned long address, unsigned long end) 372phys_pte_update(pmd_t *pmd, unsigned long address, unsigned long end,
373 pgprot_t prot)
365{ 374{
366 pte_t *pte = (pte_t *)pmd_page_vaddr(*pmd); 375 pte_t *pte = (pte_t *)pmd_page_vaddr(*pmd);
367 376
368 return phys_pte_init(pte, address, end); 377 return phys_pte_init(pte, address, end, prot);
369} 378}
370 379
371static unsigned long __meminit 380static unsigned long __meminit
372phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end, 381phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,
373 unsigned long page_size_mask) 382 unsigned long page_size_mask, pgprot_t prot)
374{ 383{
375 unsigned long pages = 0; 384 unsigned long pages = 0;
376 unsigned long last_map_addr = end; 385 unsigned long last_map_addr = end;
377 unsigned long start = address;
378 386
379 int i = pmd_index(address); 387 int i = pmd_index(address);
380 388
@@ -382,6 +390,7 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,
382 unsigned long pte_phys; 390 unsigned long pte_phys;
383 pmd_t *pmd = pmd_page + pmd_index(address); 391 pmd_t *pmd = pmd_page + pmd_index(address);
384 pte_t *pte; 392 pte_t *pte;
393 pgprot_t new_prot = prot;
385 394
386 if (address >= end) { 395 if (address >= end) {
387 if (!after_bootmem) { 396 if (!after_bootmem) {
@@ -395,27 +404,40 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,
395 if (!pmd_large(*pmd)) { 404 if (!pmd_large(*pmd)) {
396 spin_lock(&init_mm.page_table_lock); 405 spin_lock(&init_mm.page_table_lock);
397 last_map_addr = phys_pte_update(pmd, address, 406 last_map_addr = phys_pte_update(pmd, address,
398 end); 407 end, prot);
399 spin_unlock(&init_mm.page_table_lock); 408 spin_unlock(&init_mm.page_table_lock);
409 continue;
400 } 410 }
401 /* Count entries we're using from level2_ident_pgt */ 411 /*
402 if (start == 0) 412 * If we are ok with PG_LEVEL_2M mapping, then we will
403 pages++; 413 * use the existing mapping,
404 continue; 414 *
415 * Otherwise, we will split the large page mapping but
416 * use the same existing protection bits except for
417 * large page, so that we don't violate Intel's TLB
418 * Application note (317080) which says, while changing
419 * the page sizes, new and old translations should
420 * not differ with respect to page frame and
421 * attributes.
422 */
423 if (page_size_mask & (1 << PG_LEVEL_2M))
424 continue;
425 new_prot = pte_pgprot(pte_clrhuge(*(pte_t *)pmd));
405 } 426 }
406 427
407 if (page_size_mask & (1<<PG_LEVEL_2M)) { 428 if (page_size_mask & (1<<PG_LEVEL_2M)) {
408 pages++; 429 pages++;
409 spin_lock(&init_mm.page_table_lock); 430 spin_lock(&init_mm.page_table_lock);
410 set_pte((pte_t *)pmd, 431 set_pte((pte_t *)pmd,
411 pfn_pte(address >> PAGE_SHIFT, PAGE_KERNEL_LARGE)); 432 pfn_pte(address >> PAGE_SHIFT,
433 __pgprot(pgprot_val(prot) | _PAGE_PSE)));
412 spin_unlock(&init_mm.page_table_lock); 434 spin_unlock(&init_mm.page_table_lock);
413 last_map_addr = (address & PMD_MASK) + PMD_SIZE; 435 last_map_addr = (address & PMD_MASK) + PMD_SIZE;
414 continue; 436 continue;
415 } 437 }
416 438
417 pte = alloc_low_page(&pte_phys); 439 pte = alloc_low_page(&pte_phys);
418 last_map_addr = phys_pte_init(pte, address, end); 440 last_map_addr = phys_pte_init(pte, address, end, new_prot);
419 unmap_low_page(pte); 441 unmap_low_page(pte);
420 442
421 spin_lock(&init_mm.page_table_lock); 443 spin_lock(&init_mm.page_table_lock);
@@ -428,12 +450,12 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,
428 450
429static unsigned long __meminit 451static unsigned long __meminit
430phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end, 452phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end,
431 unsigned long page_size_mask) 453 unsigned long page_size_mask, pgprot_t prot)
432{ 454{
433 pmd_t *pmd = pmd_offset(pud, 0); 455 pmd_t *pmd = pmd_offset(pud, 0);
434 unsigned long last_map_addr; 456 unsigned long last_map_addr;
435 457
436 last_map_addr = phys_pmd_init(pmd, address, end, page_size_mask); 458 last_map_addr = phys_pmd_init(pmd, address, end, page_size_mask, prot);
437 __flush_tlb_all(); 459 __flush_tlb_all();
438 return last_map_addr; 460 return last_map_addr;
439} 461}
@@ -450,6 +472,7 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
450 unsigned long pmd_phys; 472 unsigned long pmd_phys;
451 pud_t *pud = pud_page + pud_index(addr); 473 pud_t *pud = pud_page + pud_index(addr);
452 pmd_t *pmd; 474 pmd_t *pmd;
475 pgprot_t prot = PAGE_KERNEL;
453 476
454 if (addr >= end) 477 if (addr >= end)
455 break; 478 break;
@@ -461,10 +484,26 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
461 } 484 }
462 485
463 if (pud_val(*pud)) { 486 if (pud_val(*pud)) {
464 if (!pud_large(*pud)) 487 if (!pud_large(*pud)) {
465 last_map_addr = phys_pmd_update(pud, addr, end, 488 last_map_addr = phys_pmd_update(pud, addr, end,
466 page_size_mask); 489 page_size_mask, prot);
467 continue; 490 continue;
491 }
492 /*
493 * If we are ok with PG_LEVEL_1G mapping, then we will
494 * use the existing mapping.
495 *
496 * Otherwise, we will split the gbpage mapping but use
497 * the same existing protection bits except for large
498 * page, so that we don't violate Intel's TLB
499 * Application note (317080) which says, while changing
500 * the page sizes, new and old translations should
501 * not differ with respect to page frame and
502 * attributes.
503 */
504 if (page_size_mask & (1 << PG_LEVEL_1G))
505 continue;
506 prot = pte_pgprot(pte_clrhuge(*(pte_t *)pud));
468 } 507 }
469 508
470 if (page_size_mask & (1<<PG_LEVEL_1G)) { 509 if (page_size_mask & (1<<PG_LEVEL_1G)) {
@@ -478,7 +517,8 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
478 } 517 }
479 518
480 pmd = alloc_low_page(&pmd_phys); 519 pmd = alloc_low_page(&pmd_phys);
481 last_map_addr = phys_pmd_init(pmd, addr, end, page_size_mask); 520 last_map_addr = phys_pmd_init(pmd, addr, end, page_size_mask,
521 prot);
482 unmap_low_page(pmd); 522 unmap_low_page(pmd);
483 523
484 spin_lock(&init_mm.page_table_lock); 524 spin_lock(&init_mm.page_table_lock);
@@ -486,6 +526,7 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
486 spin_unlock(&init_mm.page_table_lock); 526 spin_unlock(&init_mm.page_table_lock);
487 } 527 }
488 __flush_tlb_all(); 528 __flush_tlb_all();
529
489 update_page_count(PG_LEVEL_1G, pages); 530 update_page_count(PG_LEVEL_1G, pages);
490 531
491 return last_map_addr; 532 return last_map_addr;
@@ -502,27 +543,28 @@ phys_pud_update(pgd_t *pgd, unsigned long addr, unsigned long end,
502 return phys_pud_init(pud, addr, end, page_size_mask); 543 return phys_pud_init(pud, addr, end, page_size_mask);
503} 544}
504 545
505static void __init find_early_table_space(unsigned long end) 546static void __init find_early_table_space(unsigned long end, int use_pse,
547 int use_gbpages)
506{ 548{
507 unsigned long puds, pmds, ptes, tables, start; 549 unsigned long puds, pmds, ptes, tables, start;
508 550
509 puds = (end + PUD_SIZE - 1) >> PUD_SHIFT; 551 puds = (end + PUD_SIZE - 1) >> PUD_SHIFT;
510 tables = round_up(puds * sizeof(pud_t), PAGE_SIZE); 552 tables = roundup(puds * sizeof(pud_t), PAGE_SIZE);
511 if (direct_gbpages) { 553 if (use_gbpages) {
512 unsigned long extra; 554 unsigned long extra;
513 extra = end - ((end>>PUD_SHIFT) << PUD_SHIFT); 555 extra = end - ((end>>PUD_SHIFT) << PUD_SHIFT);
514 pmds = (extra + PMD_SIZE - 1) >> PMD_SHIFT; 556 pmds = (extra + PMD_SIZE - 1) >> PMD_SHIFT;
515 } else 557 } else
516 pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT; 558 pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
517 tables += round_up(pmds * sizeof(pmd_t), PAGE_SIZE); 559 tables += roundup(pmds * sizeof(pmd_t), PAGE_SIZE);
518 560
519 if (cpu_has_pse) { 561 if (use_pse) {
520 unsigned long extra; 562 unsigned long extra;
521 extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT); 563 extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT);
522 ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT; 564 ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT;
523 } else 565 } else
524 ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT; 566 ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT;
525 tables += round_up(ptes * sizeof(pte_t), PAGE_SIZE); 567 tables += roundup(ptes * sizeof(pte_t), PAGE_SIZE);
526 568
527 /* 569 /*
528 * RED-PEN putting page tables only on node 0 could 570 * RED-PEN putting page tables only on node 0 could
@@ -584,6 +626,7 @@ static unsigned long __init kernel_physical_mapping_init(unsigned long start,
584 pgd_populate(&init_mm, pgd, __va(pud_phys)); 626 pgd_populate(&init_mm, pgd, __va(pud_phys));
585 spin_unlock(&init_mm.page_table_lock); 627 spin_unlock(&init_mm.page_table_lock);
586 } 628 }
629 __flush_tlb_all();
587 630
588 return last_map_addr; 631 return last_map_addr;
589} 632}
@@ -627,6 +670,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
627 670
628 struct map_range mr[NR_RANGE_MR]; 671 struct map_range mr[NR_RANGE_MR];
629 int nr_range, i; 672 int nr_range, i;
673 int use_pse, use_gbpages;
630 674
631 printk(KERN_INFO "init_memory_mapping\n"); 675 printk(KERN_INFO "init_memory_mapping\n");
632 676
@@ -640,9 +684,21 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
640 if (!after_bootmem) 684 if (!after_bootmem)
641 init_gbpages(); 685 init_gbpages();
642 686
643 if (direct_gbpages) 687#ifdef CONFIG_DEBUG_PAGEALLOC
688 /*
689 * For CONFIG_DEBUG_PAGEALLOC, identity mapping will use small pages.
690 * This will simplify cpa(), which otherwise needs to support splitting
691 * large pages into small in interrupt context, etc.
692 */
693 use_pse = use_gbpages = 0;
694#else
695 use_pse = cpu_has_pse;
696 use_gbpages = direct_gbpages;
697#endif
698
699 if (use_gbpages)
644 page_size_mask |= 1 << PG_LEVEL_1G; 700 page_size_mask |= 1 << PG_LEVEL_1G;
645 if (cpu_has_pse) 701 if (use_pse)
646 page_size_mask |= 1 << PG_LEVEL_2M; 702 page_size_mask |= 1 << PG_LEVEL_2M;
647 703
648 memset(mr, 0, sizeof(mr)); 704 memset(mr, 0, sizeof(mr));
@@ -703,7 +759,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
703 (mr[i].page_size_mask & (1<<PG_LEVEL_2M))?"2M":"4k")); 759 (mr[i].page_size_mask & (1<<PG_LEVEL_2M))?"2M":"4k"));
704 760
705 if (!after_bootmem) 761 if (!after_bootmem)
706 find_early_table_space(end); 762 find_early_table_space(end, use_pse, use_gbpages);
707 763
708 for (i = 0; i < nr_range; i++) 764 for (i = 0; i < nr_range; i++)
709 last_map_addr = kernel_physical_mapping_init( 765 last_map_addr = kernel_physical_mapping_init(
@@ -862,8 +918,6 @@ void __init mem_init(void)
862 reservedpages << (PAGE_SHIFT-10), 918 reservedpages << (PAGE_SHIFT-10),
863 datasize >> 10, 919 datasize >> 10,
864 initsize >> 10); 920 initsize >> 10);
865
866 cpa_init();
867} 921}
868 922
869void free_init_pages(char *what, unsigned long begin, unsigned long end) 923void free_init_pages(char *what, unsigned long begin, unsigned long end)
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index cac6da54203b..6ab3196d12b4 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -83,6 +83,25 @@ int page_is_ram(unsigned long pagenr)
83 return 0; 83 return 0;
84} 84}
85 85
86int pagerange_is_ram(unsigned long start, unsigned long end)
87{
88 int ram_page = 0, not_rampage = 0;
89 unsigned long page_nr;
90
91 for (page_nr = (start >> PAGE_SHIFT); page_nr < (end >> PAGE_SHIFT);
92 ++page_nr) {
93 if (page_is_ram(page_nr))
94 ram_page = 1;
95 else
96 not_rampage = 1;
97
98 if (ram_page == not_rampage)
99 return -1;
100 }
101
102 return ram_page;
103}
104
86/* 105/*
87 * Fix up the linear direct mapping of the kernel to avoid cache attribute 106 * Fix up the linear direct mapping of the kernel to avoid cache attribute
88 * conflicts. 107 * conflicts.
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index a4dd793d6003..cebcbf152d46 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -79,7 +79,7 @@ static int __init allocate_cachealigned_memnodemap(void)
79 return 0; 79 return 0;
80 80
81 addr = 0x8000; 81 addr = 0x8000;
82 nodemap_size = round_up(sizeof(s16) * memnodemapsize, L1_CACHE_BYTES); 82 nodemap_size = roundup(sizeof(s16) * memnodemapsize, L1_CACHE_BYTES);
83 nodemap_addr = find_e820_area(addr, max_pfn<<PAGE_SHIFT, 83 nodemap_addr = find_e820_area(addr, max_pfn<<PAGE_SHIFT,
84 nodemap_size, L1_CACHE_BYTES); 84 nodemap_size, L1_CACHE_BYTES);
85 if (nodemap_addr == -1UL) { 85 if (nodemap_addr == -1UL) {
@@ -176,10 +176,10 @@ void __init setup_node_bootmem(int nodeid, unsigned long start,
176 unsigned long start_pfn, last_pfn, bootmap_pages, bootmap_size; 176 unsigned long start_pfn, last_pfn, bootmap_pages, bootmap_size;
177 unsigned long bootmap_start, nodedata_phys; 177 unsigned long bootmap_start, nodedata_phys;
178 void *bootmap; 178 void *bootmap;
179 const int pgdat_size = round_up(sizeof(pg_data_t), PAGE_SIZE); 179 const int pgdat_size = roundup(sizeof(pg_data_t), PAGE_SIZE);
180 int nid; 180 int nid;
181 181
182 start = round_up(start, ZONE_ALIGN); 182 start = roundup(start, ZONE_ALIGN);
183 183
184 printk(KERN_INFO "Bootmem setup node %d %016lx-%016lx\n", nodeid, 184 printk(KERN_INFO "Bootmem setup node %d %016lx-%016lx\n", nodeid,
185 start, end); 185 start, end);
@@ -210,9 +210,9 @@ void __init setup_node_bootmem(int nodeid, unsigned long start,
210 bootmap_pages = bootmem_bootmap_pages(last_pfn - start_pfn); 210 bootmap_pages = bootmem_bootmap_pages(last_pfn - start_pfn);
211 nid = phys_to_nid(nodedata_phys); 211 nid = phys_to_nid(nodedata_phys);
212 if (nid == nodeid) 212 if (nid == nodeid)
213 bootmap_start = round_up(nodedata_phys + pgdat_size, PAGE_SIZE); 213 bootmap_start = roundup(nodedata_phys + pgdat_size, PAGE_SIZE);
214 else 214 else
215 bootmap_start = round_up(start, PAGE_SIZE); 215 bootmap_start = roundup(start, PAGE_SIZE);
216 /* 216 /*
217 * SMP_CACHE_BYTES could be enough, but init_bootmem_node like 217 * SMP_CACHE_BYTES could be enough, but init_bootmem_node like
218 * to use that to align to PAGE_SIZE 218 * to use that to align to PAGE_SIZE
diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c
index d4aa503caaa2..e1d106909218 100644
--- a/arch/x86/mm/pageattr-test.c
+++ b/arch/x86/mm/pageattr-test.c
@@ -32,7 +32,7 @@ enum {
32 GPS = (1<<30) 32 GPS = (1<<30)
33}; 33};
34 34
35#define PAGE_TESTBIT __pgprot(_PAGE_UNUSED1) 35#define PAGE_CPA_TEST __pgprot(_PAGE_CPA_TEST)
36 36
37static int pte_testbit(pte_t pte) 37static int pte_testbit(pte_t pte)
38{ 38{
@@ -118,6 +118,7 @@ static int pageattr_test(void)
118 unsigned int level; 118 unsigned int level;
119 int i, k; 119 int i, k;
120 int err; 120 int err;
121 unsigned long test_addr;
121 122
122 if (print) 123 if (print)
123 printk(KERN_INFO "CPA self-test:\n"); 124 printk(KERN_INFO "CPA self-test:\n");
@@ -172,7 +173,8 @@ static int pageattr_test(void)
172 continue; 173 continue;
173 } 174 }
174 175
175 err = change_page_attr_set(addr[i], len[i], PAGE_TESTBIT); 176 test_addr = addr[i];
177 err = change_page_attr_set(&test_addr, len[i], PAGE_CPA_TEST, 0);
176 if (err < 0) { 178 if (err < 0) {
177 printk(KERN_ERR "CPA %d failed %d\n", i, err); 179 printk(KERN_ERR "CPA %d failed %d\n", i, err);
178 failed++; 180 failed++;
@@ -204,7 +206,8 @@ static int pageattr_test(void)
204 failed++; 206 failed++;
205 continue; 207 continue;
206 } 208 }
207 err = change_page_attr_clear(addr[i], len[i], PAGE_TESTBIT); 209 test_addr = addr[i];
210 err = change_page_attr_clear(&test_addr, len[i], PAGE_CPA_TEST, 0);
208 if (err < 0) { 211 if (err < 0) {
209 printk(KERN_ERR "CPA reverting failed: %d\n", err); 212 printk(KERN_ERR "CPA reverting failed: %d\n", err);
210 failed++; 213 failed++;
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 43e2f8483e4f..a9ec89c3fbca 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -25,15 +25,27 @@
25 * The current flushing context - we pass it instead of 5 arguments: 25 * The current flushing context - we pass it instead of 5 arguments:
26 */ 26 */
27struct cpa_data { 27struct cpa_data {
28 unsigned long vaddr; 28 unsigned long *vaddr;
29 pgprot_t mask_set; 29 pgprot_t mask_set;
30 pgprot_t mask_clr; 30 pgprot_t mask_clr;
31 int numpages; 31 int numpages;
32 int flushtlb; 32 int flags;
33 unsigned long pfn; 33 unsigned long pfn;
34 unsigned force_split : 1; 34 unsigned force_split : 1;
35 int curpage;
35}; 36};
36 37
38/*
39 * Serialize cpa() (for !DEBUG_PAGEALLOC which uses large identity mappings)
40 * using cpa_lock. So that we don't allow any other cpu, with stale large tlb
41 * entries change the page attribute in parallel to some other cpu
42 * splitting a large page entry along with changing the attribute.
43 */
44static DEFINE_SPINLOCK(cpa_lock);
45
46#define CPA_FLUSHTLB 1
47#define CPA_ARRAY 2
48
37#ifdef CONFIG_PROC_FS 49#ifdef CONFIG_PROC_FS
38static unsigned long direct_pages_count[PG_LEVEL_NUM]; 50static unsigned long direct_pages_count[PG_LEVEL_NUM];
39 51
@@ -84,7 +96,7 @@ static inline unsigned long highmap_start_pfn(void)
84 96
85static inline unsigned long highmap_end_pfn(void) 97static inline unsigned long highmap_end_pfn(void)
86{ 98{
87 return __pa(round_up((unsigned long)_end, PMD_SIZE)) >> PAGE_SHIFT; 99 return __pa(roundup((unsigned long)_end, PMD_SIZE)) >> PAGE_SHIFT;
88} 100}
89 101
90#endif 102#endif
@@ -190,6 +202,41 @@ static void cpa_flush_range(unsigned long start, int numpages, int cache)
190 } 202 }
191} 203}
192 204
205static void cpa_flush_array(unsigned long *start, int numpages, int cache)
206{
207 unsigned int i, level;
208 unsigned long *addr;
209
210 BUG_ON(irqs_disabled());
211
212 on_each_cpu(__cpa_flush_range, NULL, 1);
213
214 if (!cache)
215 return;
216
217 /* 4M threshold */
218 if (numpages >= 1024) {
219 if (boot_cpu_data.x86_model >= 4)
220 wbinvd();
221 return;
222 }
223 /*
224 * We only need to flush on one CPU,
225 * clflush is a MESI-coherent instruction that
226 * will cause all other CPUs to flush the same
227 * cachelines:
228 */
229 for (i = 0, addr = start; i < numpages; i++, addr++) {
230 pte_t *pte = lookup_address(*addr, &level);
231
232 /*
233 * Only flush present addresses:
234 */
235 if (pte && (pte_val(*pte) & _PAGE_PRESENT))
236 clflush_cache_range((void *) *addr, PAGE_SIZE);
237 }
238}
239
193/* 240/*
194 * Certain areas of memory on x86 require very specific protection flags, 241 * Certain areas of memory on x86 require very specific protection flags,
195 * for example the BIOS area or kernel text. Callers don't always get this 242 * for example the BIOS area or kernel text. Callers don't always get this
@@ -398,7 +445,7 @@ try_preserve_large_page(pte_t *kpte, unsigned long address,
398 */ 445 */
399 new_pte = pfn_pte(pte_pfn(old_pte), canon_pgprot(new_prot)); 446 new_pte = pfn_pte(pte_pfn(old_pte), canon_pgprot(new_prot));
400 __set_pmd_pte(kpte, address, new_pte); 447 __set_pmd_pte(kpte, address, new_pte);
401 cpa->flushtlb = 1; 448 cpa->flags |= CPA_FLUSHTLB;
402 do_split = 0; 449 do_split = 0;
403 } 450 }
404 451
@@ -408,84 +455,6 @@ out_unlock:
408 return do_split; 455 return do_split;
409} 456}
410 457
411static LIST_HEAD(page_pool);
412static unsigned long pool_size, pool_pages, pool_low;
413static unsigned long pool_used, pool_failed;
414
415static void cpa_fill_pool(struct page **ret)
416{
417 gfp_t gfp = GFP_KERNEL;
418 unsigned long flags;
419 struct page *p;
420
421 /*
422 * Avoid recursion (on debug-pagealloc) and also signal
423 * our priority to get to these pagetables:
424 */
425 if (current->flags & PF_MEMALLOC)
426 return;
427 current->flags |= PF_MEMALLOC;
428
429 /*
430 * Allocate atomically from atomic contexts:
431 */
432 if (in_atomic() || irqs_disabled() || debug_pagealloc)
433 gfp = GFP_ATOMIC | __GFP_NORETRY | __GFP_NOWARN;
434
435 while (pool_pages < pool_size || (ret && !*ret)) {
436 p = alloc_pages(gfp, 0);
437 if (!p) {
438 pool_failed++;
439 break;
440 }
441 /*
442 * If the call site needs a page right now, provide it:
443 */
444 if (ret && !*ret) {
445 *ret = p;
446 continue;
447 }
448 spin_lock_irqsave(&pgd_lock, flags);
449 list_add(&p->lru, &page_pool);
450 pool_pages++;
451 spin_unlock_irqrestore(&pgd_lock, flags);
452 }
453
454 current->flags &= ~PF_MEMALLOC;
455}
456
457#define SHIFT_MB (20 - PAGE_SHIFT)
458#define ROUND_MB_GB ((1 << 10) - 1)
459#define SHIFT_MB_GB 10
460#define POOL_PAGES_PER_GB 16
461
462void __init cpa_init(void)
463{
464 struct sysinfo si;
465 unsigned long gb;
466
467 si_meminfo(&si);
468 /*
469 * Calculate the number of pool pages:
470 *
471 * Convert totalram (nr of pages) to MiB and round to the next
472 * GiB. Shift MiB to Gib and multiply the result by
473 * POOL_PAGES_PER_GB:
474 */
475 if (debug_pagealloc) {
476 gb = ((si.totalram >> SHIFT_MB) + ROUND_MB_GB) >> SHIFT_MB_GB;
477 pool_size = POOL_PAGES_PER_GB * gb;
478 } else {
479 pool_size = 1;
480 }
481 pool_low = pool_size;
482
483 cpa_fill_pool(NULL);
484 printk(KERN_DEBUG
485 "CPA: page pool initialized %lu of %lu pages preallocated\n",
486 pool_pages, pool_size);
487}
488
489static int split_large_page(pte_t *kpte, unsigned long address) 458static int split_large_page(pte_t *kpte, unsigned long address)
490{ 459{
491 unsigned long flags, pfn, pfninc = 1; 460 unsigned long flags, pfn, pfninc = 1;
@@ -494,28 +463,15 @@ static int split_large_page(pte_t *kpte, unsigned long address)
494 pgprot_t ref_prot; 463 pgprot_t ref_prot;
495 struct page *base; 464 struct page *base;
496 465
497 /* 466 if (!debug_pagealloc)
498 * Get a page from the pool. The pool list is protected by the 467 spin_unlock(&cpa_lock);
499 * pgd_lock, which we have to take anyway for the split 468 base = alloc_pages(GFP_KERNEL, 0);
500 * operation: 469 if (!debug_pagealloc)
501 */ 470 spin_lock(&cpa_lock);
502 spin_lock_irqsave(&pgd_lock, flags); 471 if (!base)
503 if (list_empty(&page_pool)) { 472 return -ENOMEM;
504 spin_unlock_irqrestore(&pgd_lock, flags);
505 base = NULL;
506 cpa_fill_pool(&base);
507 if (!base)
508 return -ENOMEM;
509 spin_lock_irqsave(&pgd_lock, flags);
510 } else {
511 base = list_first_entry(&page_pool, struct page, lru);
512 list_del(&base->lru);
513 pool_pages--;
514
515 if (pool_pages < pool_low)
516 pool_low = pool_pages;
517 }
518 473
474 spin_lock_irqsave(&pgd_lock, flags);
519 /* 475 /*
520 * Check for races, another CPU might have split this page 476 * Check for races, another CPU might have split this page
521 * up for us already: 477 * up for us already:
@@ -572,11 +528,8 @@ out_unlock:
572 * If we dropped out via the lookup_address check under 528 * If we dropped out via the lookup_address check under
573 * pgd_lock then stick the page back into the pool: 529 * pgd_lock then stick the page back into the pool:
574 */ 530 */
575 if (base) { 531 if (base)
576 list_add(&base->lru, &page_pool); 532 __free_page(base);
577 pool_pages++;
578 } else
579 pool_used++;
580 spin_unlock_irqrestore(&pgd_lock, flags); 533 spin_unlock_irqrestore(&pgd_lock, flags);
581 534
582 return 0; 535 return 0;
@@ -584,11 +537,16 @@ out_unlock:
584 537
585static int __change_page_attr(struct cpa_data *cpa, int primary) 538static int __change_page_attr(struct cpa_data *cpa, int primary)
586{ 539{
587 unsigned long address = cpa->vaddr; 540 unsigned long address;
588 int do_split, err; 541 int do_split, err;
589 unsigned int level; 542 unsigned int level;
590 pte_t *kpte, old_pte; 543 pte_t *kpte, old_pte;
591 544
545 if (cpa->flags & CPA_ARRAY)
546 address = cpa->vaddr[cpa->curpage];
547 else
548 address = *cpa->vaddr;
549
592repeat: 550repeat:
593 kpte = lookup_address(address, &level); 551 kpte = lookup_address(address, &level);
594 if (!kpte) 552 if (!kpte)
@@ -600,7 +558,7 @@ repeat:
600 return 0; 558 return 0;
601 WARN(1, KERN_WARNING "CPA: called for zero pte. " 559 WARN(1, KERN_WARNING "CPA: called for zero pte. "
602 "vaddr = %lx cpa->vaddr = %lx\n", address, 560 "vaddr = %lx cpa->vaddr = %lx\n", address,
603 cpa->vaddr); 561 *cpa->vaddr);
604 return -EINVAL; 562 return -EINVAL;
605 } 563 }
606 564
@@ -626,7 +584,7 @@ repeat:
626 */ 584 */
627 if (pte_val(old_pte) != pte_val(new_pte)) { 585 if (pte_val(old_pte) != pte_val(new_pte)) {
628 set_pte_atomic(kpte, new_pte); 586 set_pte_atomic(kpte, new_pte);
629 cpa->flushtlb = 1; 587 cpa->flags |= CPA_FLUSHTLB;
630 } 588 }
631 cpa->numpages = 1; 589 cpa->numpages = 1;
632 return 0; 590 return 0;
@@ -650,7 +608,25 @@ repeat:
650 */ 608 */
651 err = split_large_page(kpte, address); 609 err = split_large_page(kpte, address);
652 if (!err) { 610 if (!err) {
653 cpa->flushtlb = 1; 611 /*
612 * Do a global flush tlb after splitting the large page
613 * and before we do the actual change page attribute in the PTE.
614 *
615 * With out this, we violate the TLB application note, that says
616 * "The TLBs may contain both ordinary and large-page
617 * translations for a 4-KByte range of linear addresses. This
618 * may occur if software modifies the paging structures so that
619 * the page size used for the address range changes. If the two
620 * translations differ with respect to page frame or attributes
621 * (e.g., permissions), processor behavior is undefined and may
622 * be implementation-specific."
623 *
624 * We do this global tlb flush inside the cpa_lock, so that we
625 * don't allow any other cpu, with stale tlb entries change the
626 * page attribute in parallel, that also falls into the
627 * just split large page entry.
628 */
629 flush_tlb_all();
654 goto repeat; 630 goto repeat;
655 } 631 }
656 632
@@ -663,6 +639,7 @@ static int cpa_process_alias(struct cpa_data *cpa)
663{ 639{
664 struct cpa_data alias_cpa; 640 struct cpa_data alias_cpa;
665 int ret = 0; 641 int ret = 0;
642 unsigned long temp_cpa_vaddr, vaddr;
666 643
667 if (cpa->pfn >= max_pfn_mapped) 644 if (cpa->pfn >= max_pfn_mapped)
668 return 0; 645 return 0;
@@ -675,16 +652,24 @@ static int cpa_process_alias(struct cpa_data *cpa)
675 * No need to redo, when the primary call touched the direct 652 * No need to redo, when the primary call touched the direct
676 * mapping already: 653 * mapping already:
677 */ 654 */
678 if (!(within(cpa->vaddr, PAGE_OFFSET, 655 if (cpa->flags & CPA_ARRAY)
656 vaddr = cpa->vaddr[cpa->curpage];
657 else
658 vaddr = *cpa->vaddr;
659
660 if (!(within(vaddr, PAGE_OFFSET,
679 PAGE_OFFSET + (max_low_pfn_mapped << PAGE_SHIFT)) 661 PAGE_OFFSET + (max_low_pfn_mapped << PAGE_SHIFT))
680#ifdef CONFIG_X86_64 662#ifdef CONFIG_X86_64
681 || within(cpa->vaddr, PAGE_OFFSET + (1UL<<32), 663 || within(vaddr, PAGE_OFFSET + (1UL<<32),
682 PAGE_OFFSET + (max_pfn_mapped << PAGE_SHIFT)) 664 PAGE_OFFSET + (max_pfn_mapped << PAGE_SHIFT))
683#endif 665#endif
684 )) { 666 )) {
685 667
686 alias_cpa = *cpa; 668 alias_cpa = *cpa;
687 alias_cpa.vaddr = (unsigned long) __va(cpa->pfn << PAGE_SHIFT); 669 temp_cpa_vaddr = (unsigned long) __va(cpa->pfn << PAGE_SHIFT);
670 alias_cpa.vaddr = &temp_cpa_vaddr;
671 alias_cpa.flags &= ~CPA_ARRAY;
672
688 673
689 ret = __change_page_attr_set_clr(&alias_cpa, 0); 674 ret = __change_page_attr_set_clr(&alias_cpa, 0);
690 } 675 }
@@ -696,7 +681,7 @@ static int cpa_process_alias(struct cpa_data *cpa)
696 * No need to redo, when the primary call touched the high 681 * No need to redo, when the primary call touched the high
697 * mapping already: 682 * mapping already:
698 */ 683 */
699 if (within(cpa->vaddr, (unsigned long) _text, (unsigned long) _end)) 684 if (within(vaddr, (unsigned long) _text, (unsigned long) _end))
700 return 0; 685 return 0;
701 686
702 /* 687 /*
@@ -707,8 +692,9 @@ static int cpa_process_alias(struct cpa_data *cpa)
707 return 0; 692 return 0;
708 693
709 alias_cpa = *cpa; 694 alias_cpa = *cpa;
710 alias_cpa.vaddr = 695 temp_cpa_vaddr = (cpa->pfn << PAGE_SHIFT) + __START_KERNEL_map - phys_base;
711 (cpa->pfn << PAGE_SHIFT) + __START_KERNEL_map - phys_base; 696 alias_cpa.vaddr = &temp_cpa_vaddr;
697 alias_cpa.flags &= ~CPA_ARRAY;
712 698
713 /* 699 /*
714 * The high mapping range is imprecise, so ignore the return value. 700 * The high mapping range is imprecise, so ignore the return value.
@@ -728,8 +714,15 @@ static int __change_page_attr_set_clr(struct cpa_data *cpa, int checkalias)
728 * preservation check. 714 * preservation check.
729 */ 715 */
730 cpa->numpages = numpages; 716 cpa->numpages = numpages;
717 /* for array changes, we can't use large page */
718 if (cpa->flags & CPA_ARRAY)
719 cpa->numpages = 1;
731 720
721 if (!debug_pagealloc)
722 spin_lock(&cpa_lock);
732 ret = __change_page_attr(cpa, checkalias); 723 ret = __change_page_attr(cpa, checkalias);
724 if (!debug_pagealloc)
725 spin_unlock(&cpa_lock);
733 if (ret) 726 if (ret)
734 return ret; 727 return ret;
735 728
@@ -746,7 +739,11 @@ static int __change_page_attr_set_clr(struct cpa_data *cpa, int checkalias)
746 */ 739 */
747 BUG_ON(cpa->numpages > numpages); 740 BUG_ON(cpa->numpages > numpages);
748 numpages -= cpa->numpages; 741 numpages -= cpa->numpages;
749 cpa->vaddr += cpa->numpages * PAGE_SIZE; 742 if (cpa->flags & CPA_ARRAY)
743 cpa->curpage++;
744 else
745 *cpa->vaddr += cpa->numpages * PAGE_SIZE;
746
750 } 747 }
751 return 0; 748 return 0;
752} 749}
@@ -757,9 +754,9 @@ static inline int cache_attr(pgprot_t attr)
757 (_PAGE_PAT | _PAGE_PAT_LARGE | _PAGE_PWT | _PAGE_PCD); 754 (_PAGE_PAT | _PAGE_PAT_LARGE | _PAGE_PWT | _PAGE_PCD);
758} 755}
759 756
760static int change_page_attr_set_clr(unsigned long addr, int numpages, 757static int change_page_attr_set_clr(unsigned long *addr, int numpages,
761 pgprot_t mask_set, pgprot_t mask_clr, 758 pgprot_t mask_set, pgprot_t mask_clr,
762 int force_split) 759 int force_split, int array)
763{ 760{
764 struct cpa_data cpa; 761 struct cpa_data cpa;
765 int ret, cache, checkalias; 762 int ret, cache, checkalias;
@@ -774,21 +771,38 @@ static int change_page_attr_set_clr(unsigned long addr, int numpages,
774 return 0; 771 return 0;
775 772
776 /* Ensure we are PAGE_SIZE aligned */ 773 /* Ensure we are PAGE_SIZE aligned */
777 if (addr & ~PAGE_MASK) { 774 if (!array) {
778 addr &= PAGE_MASK; 775 if (*addr & ~PAGE_MASK) {
779 /* 776 *addr &= PAGE_MASK;
780 * People should not be passing in unaligned addresses: 777 /*
781 */ 778 * People should not be passing in unaligned addresses:
782 WARN_ON_ONCE(1); 779 */
780 WARN_ON_ONCE(1);
781 }
782 } else {
783 int i;
784 for (i = 0; i < numpages; i++) {
785 if (addr[i] & ~PAGE_MASK) {
786 addr[i] &= PAGE_MASK;
787 WARN_ON_ONCE(1);
788 }
789 }
783 } 790 }
784 791
792 /* Must avoid aliasing mappings in the highmem code */
793 kmap_flush_unused();
794
785 cpa.vaddr = addr; 795 cpa.vaddr = addr;
786 cpa.numpages = numpages; 796 cpa.numpages = numpages;
787 cpa.mask_set = mask_set; 797 cpa.mask_set = mask_set;
788 cpa.mask_clr = mask_clr; 798 cpa.mask_clr = mask_clr;
789 cpa.flushtlb = 0; 799 cpa.flags = 0;
800 cpa.curpage = 0;
790 cpa.force_split = force_split; 801 cpa.force_split = force_split;
791 802
803 if (array)
804 cpa.flags |= CPA_ARRAY;
805
792 /* No alias checking for _NX bit modifications */ 806 /* No alias checking for _NX bit modifications */
793 checkalias = (pgprot_val(mask_set) | pgprot_val(mask_clr)) != _PAGE_NX; 807 checkalias = (pgprot_val(mask_set) | pgprot_val(mask_clr)) != _PAGE_NX;
794 808
@@ -797,7 +811,7 @@ static int change_page_attr_set_clr(unsigned long addr, int numpages,
797 /* 811 /*
798 * Check whether we really changed something: 812 * Check whether we really changed something:
799 */ 813 */
800 if (!cpa.flushtlb) 814 if (!(cpa.flags & CPA_FLUSHTLB))
801 goto out; 815 goto out;
802 816
803 /* 817 /*
@@ -812,27 +826,30 @@ static int change_page_attr_set_clr(unsigned long addr, int numpages,
812 * error case we fall back to cpa_flush_all (which uses 826 * error case we fall back to cpa_flush_all (which uses
813 * wbindv): 827 * wbindv):
814 */ 828 */
815 if (!ret && cpu_has_clflush) 829 if (!ret && cpu_has_clflush) {
816 cpa_flush_range(addr, numpages, cache); 830 if (cpa.flags & CPA_ARRAY)
817 else 831 cpa_flush_array(addr, numpages, cache);
832 else
833 cpa_flush_range(*addr, numpages, cache);
834 } else
818 cpa_flush_all(cache); 835 cpa_flush_all(cache);
819 836
820out: 837out:
821 cpa_fill_pool(NULL);
822
823 return ret; 838 return ret;
824} 839}
825 840
826static inline int change_page_attr_set(unsigned long addr, int numpages, 841static inline int change_page_attr_set(unsigned long *addr, int numpages,
827 pgprot_t mask) 842 pgprot_t mask, int array)
828{ 843{
829 return change_page_attr_set_clr(addr, numpages, mask, __pgprot(0), 0); 844 return change_page_attr_set_clr(addr, numpages, mask, __pgprot(0), 0,
845 array);
830} 846}
831 847
832static inline int change_page_attr_clear(unsigned long addr, int numpages, 848static inline int change_page_attr_clear(unsigned long *addr, int numpages,
833 pgprot_t mask) 849 pgprot_t mask, int array)
834{ 850{
835 return change_page_attr_set_clr(addr, numpages, __pgprot(0), mask, 0); 851 return change_page_attr_set_clr(addr, numpages, __pgprot(0), mask, 0,
852 array);
836} 853}
837 854
838int _set_memory_uc(unsigned long addr, int numpages) 855int _set_memory_uc(unsigned long addr, int numpages)
@@ -840,8 +857,8 @@ int _set_memory_uc(unsigned long addr, int numpages)
840 /* 857 /*
841 * for now UC MINUS. see comments in ioremap_nocache() 858 * for now UC MINUS. see comments in ioremap_nocache()
842 */ 859 */
843 return change_page_attr_set(addr, numpages, 860 return change_page_attr_set(&addr, numpages,
844 __pgprot(_PAGE_CACHE_UC_MINUS)); 861 __pgprot(_PAGE_CACHE_UC_MINUS), 0);
845} 862}
846 863
847int set_memory_uc(unsigned long addr, int numpages) 864int set_memory_uc(unsigned long addr, int numpages)
@@ -857,10 +874,48 @@ int set_memory_uc(unsigned long addr, int numpages)
857} 874}
858EXPORT_SYMBOL(set_memory_uc); 875EXPORT_SYMBOL(set_memory_uc);
859 876
877int set_memory_array_uc(unsigned long *addr, int addrinarray)
878{
879 unsigned long start;
880 unsigned long end;
881 int i;
882 /*
883 * for now UC MINUS. see comments in ioremap_nocache()
884 */
885 for (i = 0; i < addrinarray; i++) {
886 start = __pa(addr[i]);
887 for (end = start + PAGE_SIZE; i < addrinarray - 1; end += PAGE_SIZE) {
888 if (end != __pa(addr[i + 1]))
889 break;
890 i++;
891 }
892 if (reserve_memtype(start, end, _PAGE_CACHE_UC_MINUS, NULL))
893 goto out;
894 }
895
896 return change_page_attr_set(addr, addrinarray,
897 __pgprot(_PAGE_CACHE_UC_MINUS), 1);
898out:
899 for (i = 0; i < addrinarray; i++) {
900 unsigned long tmp = __pa(addr[i]);
901
902 if (tmp == start)
903 break;
904 for (end = tmp + PAGE_SIZE; i < addrinarray - 1; end += PAGE_SIZE) {
905 if (end != __pa(addr[i + 1]))
906 break;
907 i++;
908 }
909 free_memtype(tmp, end);
910 }
911 return -EINVAL;
912}
913EXPORT_SYMBOL(set_memory_array_uc);
914
860int _set_memory_wc(unsigned long addr, int numpages) 915int _set_memory_wc(unsigned long addr, int numpages)
861{ 916{
862 return change_page_attr_set(addr, numpages, 917 return change_page_attr_set(&addr, numpages,
863 __pgprot(_PAGE_CACHE_WC)); 918 __pgprot(_PAGE_CACHE_WC), 0);
864} 919}
865 920
866int set_memory_wc(unsigned long addr, int numpages) 921int set_memory_wc(unsigned long addr, int numpages)
@@ -878,8 +933,8 @@ EXPORT_SYMBOL(set_memory_wc);
878 933
879int _set_memory_wb(unsigned long addr, int numpages) 934int _set_memory_wb(unsigned long addr, int numpages)
880{ 935{
881 return change_page_attr_clear(addr, numpages, 936 return change_page_attr_clear(&addr, numpages,
882 __pgprot(_PAGE_CACHE_MASK)); 937 __pgprot(_PAGE_CACHE_MASK), 0);
883} 938}
884 939
885int set_memory_wb(unsigned long addr, int numpages) 940int set_memory_wb(unsigned long addr, int numpages)
@@ -890,37 +945,59 @@ int set_memory_wb(unsigned long addr, int numpages)
890} 945}
891EXPORT_SYMBOL(set_memory_wb); 946EXPORT_SYMBOL(set_memory_wb);
892 947
948int set_memory_array_wb(unsigned long *addr, int addrinarray)
949{
950 int i;
951
952 for (i = 0; i < addrinarray; i++) {
953 unsigned long start = __pa(addr[i]);
954 unsigned long end;
955
956 for (end = start + PAGE_SIZE; i < addrinarray - 1; end += PAGE_SIZE) {
957 if (end != __pa(addr[i + 1]))
958 break;
959 i++;
960 }
961 free_memtype(start, end);
962 }
963 return change_page_attr_clear(addr, addrinarray,
964 __pgprot(_PAGE_CACHE_MASK), 1);
965}
966EXPORT_SYMBOL(set_memory_array_wb);
967
893int set_memory_x(unsigned long addr, int numpages) 968int set_memory_x(unsigned long addr, int numpages)
894{ 969{
895 return change_page_attr_clear(addr, numpages, __pgprot(_PAGE_NX)); 970 return change_page_attr_clear(&addr, numpages, __pgprot(_PAGE_NX), 0);
896} 971}
897EXPORT_SYMBOL(set_memory_x); 972EXPORT_SYMBOL(set_memory_x);
898 973
899int set_memory_nx(unsigned long addr, int numpages) 974int set_memory_nx(unsigned long addr, int numpages)
900{ 975{
901 return change_page_attr_set(addr, numpages, __pgprot(_PAGE_NX)); 976 return change_page_attr_set(&addr, numpages, __pgprot(_PAGE_NX), 0);
902} 977}
903EXPORT_SYMBOL(set_memory_nx); 978EXPORT_SYMBOL(set_memory_nx);
904 979
905int set_memory_ro(unsigned long addr, int numpages) 980int set_memory_ro(unsigned long addr, int numpages)
906{ 981{
907 return change_page_attr_clear(addr, numpages, __pgprot(_PAGE_RW)); 982 return change_page_attr_clear(&addr, numpages, __pgprot(_PAGE_RW), 0);
908} 983}
984EXPORT_SYMBOL_GPL(set_memory_ro);
909 985
910int set_memory_rw(unsigned long addr, int numpages) 986int set_memory_rw(unsigned long addr, int numpages)
911{ 987{
912 return change_page_attr_set(addr, numpages, __pgprot(_PAGE_RW)); 988 return change_page_attr_set(&addr, numpages, __pgprot(_PAGE_RW), 0);
913} 989}
990EXPORT_SYMBOL_GPL(set_memory_rw);
914 991
915int set_memory_np(unsigned long addr, int numpages) 992int set_memory_np(unsigned long addr, int numpages)
916{ 993{
917 return change_page_attr_clear(addr, numpages, __pgprot(_PAGE_PRESENT)); 994 return change_page_attr_clear(&addr, numpages, __pgprot(_PAGE_PRESENT), 0);
918} 995}
919 996
920int set_memory_4k(unsigned long addr, int numpages) 997int set_memory_4k(unsigned long addr, int numpages)
921{ 998{
922 return change_page_attr_set_clr(addr, numpages, __pgprot(0), 999 return change_page_attr_set_clr(&addr, numpages, __pgprot(0),
923 __pgprot(0), 1); 1000 __pgprot(0), 1, 0);
924} 1001}
925 1002
926int set_pages_uc(struct page *page, int numpages) 1003int set_pages_uc(struct page *page, int numpages)
@@ -973,22 +1050,38 @@ int set_pages_rw(struct page *page, int numpages)
973 1050
974static int __set_pages_p(struct page *page, int numpages) 1051static int __set_pages_p(struct page *page, int numpages)
975{ 1052{
976 struct cpa_data cpa = { .vaddr = (unsigned long) page_address(page), 1053 unsigned long tempaddr = (unsigned long) page_address(page);
1054 struct cpa_data cpa = { .vaddr = &tempaddr,
977 .numpages = numpages, 1055 .numpages = numpages,
978 .mask_set = __pgprot(_PAGE_PRESENT | _PAGE_RW), 1056 .mask_set = __pgprot(_PAGE_PRESENT | _PAGE_RW),
979 .mask_clr = __pgprot(0)}; 1057 .mask_clr = __pgprot(0),
1058 .flags = 0};
980 1059
981 return __change_page_attr_set_clr(&cpa, 1); 1060 /*
1061 * No alias checking needed for setting present flag. otherwise,
1062 * we may need to break large pages for 64-bit kernel text
1063 * mappings (this adds to complexity if we want to do this from
1064 * atomic context especially). Let's keep it simple!
1065 */
1066 return __change_page_attr_set_clr(&cpa, 0);
982} 1067}
983 1068
984static int __set_pages_np(struct page *page, int numpages) 1069static int __set_pages_np(struct page *page, int numpages)
985{ 1070{
986 struct cpa_data cpa = { .vaddr = (unsigned long) page_address(page), 1071 unsigned long tempaddr = (unsigned long) page_address(page);
1072 struct cpa_data cpa = { .vaddr = &tempaddr,
987 .numpages = numpages, 1073 .numpages = numpages,
988 .mask_set = __pgprot(0), 1074 .mask_set = __pgprot(0),
989 .mask_clr = __pgprot(_PAGE_PRESENT | _PAGE_RW)}; 1075 .mask_clr = __pgprot(_PAGE_PRESENT | _PAGE_RW),
1076 .flags = 0};
990 1077
991 return __change_page_attr_set_clr(&cpa, 1); 1078 /*
1079 * No alias checking needed for setting not present flag. otherwise,
1080 * we may need to break large pages for 64-bit kernel text
1081 * mappings (this adds to complexity if we want to do this from
1082 * atomic context especially). Let's keep it simple!
1083 */
1084 return __change_page_attr_set_clr(&cpa, 0);
992} 1085}
993 1086
994void kernel_map_pages(struct page *page, int numpages, int enable) 1087void kernel_map_pages(struct page *page, int numpages, int enable)
@@ -1008,11 +1101,8 @@ void kernel_map_pages(struct page *page, int numpages, int enable)
1008 1101
1009 /* 1102 /*
1010 * The return value is ignored as the calls cannot fail. 1103 * The return value is ignored as the calls cannot fail.
1011 * Large pages are kept enabled at boot time, and are 1104 * Large pages for identity mappings are not used at boot time
1012 * split up quickly with DEBUG_PAGEALLOC. If a splitup 1105 * and hence no memory allocations during large page split.
1013 * fails here (due to temporary memory shortage) no damage
1014 * is done because we just keep the largepage intact up
1015 * to the next attempt when it will likely be split up:
1016 */ 1106 */
1017 if (enable) 1107 if (enable)
1018 __set_pages_p(page, numpages); 1108 __set_pages_p(page, numpages);
@@ -1024,53 +1114,8 @@ void kernel_map_pages(struct page *page, int numpages, int enable)
1024 * but that can deadlock->flush only current cpu: 1114 * but that can deadlock->flush only current cpu:
1025 */ 1115 */
1026 __flush_tlb_all(); 1116 __flush_tlb_all();
1027
1028 /*
1029 * Try to refill the page pool here. We can do this only after
1030 * the tlb flush.
1031 */
1032 cpa_fill_pool(NULL);
1033} 1117}
1034 1118
1035#ifdef CONFIG_DEBUG_FS
1036static int dpa_show(struct seq_file *m, void *v)
1037{
1038 seq_puts(m, "DEBUG_PAGEALLOC\n");
1039 seq_printf(m, "pool_size : %lu\n", pool_size);
1040 seq_printf(m, "pool_pages : %lu\n", pool_pages);
1041 seq_printf(m, "pool_low : %lu\n", pool_low);
1042 seq_printf(m, "pool_used : %lu\n", pool_used);
1043 seq_printf(m, "pool_failed : %lu\n", pool_failed);
1044
1045 return 0;
1046}
1047
1048static int dpa_open(struct inode *inode, struct file *filp)
1049{
1050 return single_open(filp, dpa_show, NULL);
1051}
1052
1053static const struct file_operations dpa_fops = {
1054 .open = dpa_open,
1055 .read = seq_read,
1056 .llseek = seq_lseek,
1057 .release = single_release,
1058};
1059
1060static int __init debug_pagealloc_proc_init(void)
1061{
1062 struct dentry *de;
1063
1064 de = debugfs_create_file("debug_pagealloc", 0600, NULL, NULL,
1065 &dpa_fops);
1066 if (!de)
1067 return -ENOMEM;
1068
1069 return 0;
1070}
1071__initcall(debug_pagealloc_proc_init);
1072#endif
1073
1074#ifdef CONFIG_HIBERNATION 1119#ifdef CONFIG_HIBERNATION
1075 1120
1076bool kernel_page_present(struct page *page) 1121bool kernel_page_present(struct page *page)
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index 2a50e0fa64a5..738fd0f24958 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -7,24 +7,24 @@
7 * Loosely based on earlier PAT patchset from Eric Biederman and Andi Kleen. 7 * Loosely based on earlier PAT patchset from Eric Biederman and Andi Kleen.
8 */ 8 */
9 9
10#include <linux/mm.h> 10#include <linux/seq_file.h>
11#include <linux/bootmem.h>
12#include <linux/debugfs.h>
11#include <linux/kernel.h> 13#include <linux/kernel.h>
12#include <linux/gfp.h> 14#include <linux/gfp.h>
15#include <linux/mm.h>
13#include <linux/fs.h> 16#include <linux/fs.h>
14#include <linux/bootmem.h>
15#include <linux/debugfs.h>
16#include <linux/seq_file.h>
17 17
18#include <asm/msr.h> 18#include <asm/cacheflush.h>
19#include <asm/tlbflush.h>
20#include <asm/processor.h> 19#include <asm/processor.h>
21#include <asm/page.h> 20#include <asm/tlbflush.h>
22#include <asm/pgtable.h> 21#include <asm/pgtable.h>
23#include <asm/pat.h>
24#include <asm/e820.h>
25#include <asm/cacheflush.h>
26#include <asm/fcntl.h> 22#include <asm/fcntl.h>
23#include <asm/e820.h>
27#include <asm/mtrr.h> 24#include <asm/mtrr.h>
25#include <asm/page.h>
26#include <asm/msr.h>
27#include <asm/pat.h>
28#include <asm/io.h> 28#include <asm/io.h>
29 29
30#ifdef CONFIG_X86_PAT 30#ifdef CONFIG_X86_PAT
@@ -46,6 +46,7 @@ early_param("nopat", nopat);
46 46
47 47
48static int debug_enable; 48static int debug_enable;
49
49static int __init pat_debug_setup(char *str) 50static int __init pat_debug_setup(char *str)
50{ 51{
51 debug_enable = 1; 52 debug_enable = 1;
@@ -145,14 +146,14 @@ static char *cattr_name(unsigned long flags)
145 */ 146 */
146 147
147struct memtype { 148struct memtype {
148 u64 start; 149 u64 start;
149 u64 end; 150 u64 end;
150 unsigned long type; 151 unsigned long type;
151 struct list_head nd; 152 struct list_head nd;
152}; 153};
153 154
154static LIST_HEAD(memtype_list); 155static LIST_HEAD(memtype_list);
155static DEFINE_SPINLOCK(memtype_lock); /* protects memtype list */ 156static DEFINE_SPINLOCK(memtype_lock); /* protects memtype list */
156 157
157/* 158/*
158 * Does intersection of PAT memory type and MTRR memory type and returns 159 * Does intersection of PAT memory type and MTRR memory type and returns
@@ -180,8 +181,8 @@ static unsigned long pat_x_mtrr_type(u64 start, u64 end, unsigned long req_type)
180 return req_type; 181 return req_type;
181} 182}
182 183
183static int chk_conflict(struct memtype *new, struct memtype *entry, 184static int
184 unsigned long *type) 185chk_conflict(struct memtype *new, struct memtype *entry, unsigned long *type)
185{ 186{
186 if (new->type != entry->type) { 187 if (new->type != entry->type) {
187 if (type) { 188 if (type) {
@@ -211,6 +212,66 @@ static struct memtype *cached_entry;
211static u64 cached_start; 212static u64 cached_start;
212 213
213/* 214/*
215 * For RAM pages, mark the pages as non WB memory type using
216 * PageNonWB (PG_arch_1). We allow only one set_memory_uc() or
217 * set_memory_wc() on a RAM page at a time before marking it as WB again.
218 * This is ok, because only one driver will be owning the page and
219 * doing set_memory_*() calls.
220 *
221 * For now, we use PageNonWB to track that the RAM page is being mapped
222 * as non WB. In future, we will have to use one more flag
223 * (or some other mechanism in page_struct) to distinguish between
224 * UC and WC mapping.
225 */
226static int reserve_ram_pages_type(u64 start, u64 end, unsigned long req_type,
227 unsigned long *new_type)
228{
229 struct page *page;
230 u64 pfn, end_pfn;
231
232 for (pfn = (start >> PAGE_SHIFT); pfn < (end >> PAGE_SHIFT); ++pfn) {
233 page = pfn_to_page(pfn);
234 if (page_mapped(page) || PageNonWB(page))
235 goto out;
236
237 SetPageNonWB(page);
238 }
239 return 0;
240
241out:
242 end_pfn = pfn;
243 for (pfn = (start >> PAGE_SHIFT); pfn < end_pfn; ++pfn) {
244 page = pfn_to_page(pfn);
245 ClearPageNonWB(page);
246 }
247
248 return -EINVAL;
249}
250
251static int free_ram_pages_type(u64 start, u64 end)
252{
253 struct page *page;
254 u64 pfn, end_pfn;
255
256 for (pfn = (start >> PAGE_SHIFT); pfn < (end >> PAGE_SHIFT); ++pfn) {
257 page = pfn_to_page(pfn);
258 if (page_mapped(page) || !PageNonWB(page))
259 goto out;
260
261 ClearPageNonWB(page);
262 }
263 return 0;
264
265out:
266 end_pfn = pfn;
267 for (pfn = (start >> PAGE_SHIFT); pfn < end_pfn; ++pfn) {
268 page = pfn_to_page(pfn);
269 SetPageNonWB(page);
270 }
271 return -EINVAL;
272}
273
274/*
214 * req_type typically has one of the: 275 * req_type typically has one of the:
215 * - _PAGE_CACHE_WB 276 * - _PAGE_CACHE_WB
216 * - _PAGE_CACHE_WC 277 * - _PAGE_CACHE_WC
@@ -226,14 +287,15 @@ static u64 cached_start;
226 * it will return a negative return value. 287 * it will return a negative return value.
227 */ 288 */
228int reserve_memtype(u64 start, u64 end, unsigned long req_type, 289int reserve_memtype(u64 start, u64 end, unsigned long req_type,
229 unsigned long *new_type) 290 unsigned long *new_type)
230{ 291{
231 struct memtype *new, *entry; 292 struct memtype *new, *entry;
232 unsigned long actual_type; 293 unsigned long actual_type;
233 struct list_head *where; 294 struct list_head *where;
295 int is_range_ram;
234 int err = 0; 296 int err = 0;
235 297
236 BUG_ON(start >= end); /* end is exclusive */ 298 BUG_ON(start >= end); /* end is exclusive */
237 299
238 if (!pat_enabled) { 300 if (!pat_enabled) {
239 /* This is identical to page table setting without PAT */ 301 /* This is identical to page table setting without PAT */
@@ -266,17 +328,24 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
266 actual_type = _PAGE_CACHE_WB; 328 actual_type = _PAGE_CACHE_WB;
267 else 329 else
268 actual_type = _PAGE_CACHE_UC_MINUS; 330 actual_type = _PAGE_CACHE_UC_MINUS;
269 } else 331 } else {
270 actual_type = pat_x_mtrr_type(start, end, 332 actual_type = pat_x_mtrr_type(start, end,
271 req_type & _PAGE_CACHE_MASK); 333 req_type & _PAGE_CACHE_MASK);
334 }
335
336 is_range_ram = pagerange_is_ram(start, end);
337 if (is_range_ram == 1)
338 return reserve_ram_pages_type(start, end, req_type, new_type);
339 else if (is_range_ram < 0)
340 return -EINVAL;
272 341
273 new = kmalloc(sizeof(struct memtype), GFP_KERNEL); 342 new = kmalloc(sizeof(struct memtype), GFP_KERNEL);
274 if (!new) 343 if (!new)
275 return -ENOMEM; 344 return -ENOMEM;
276 345
277 new->start = start; 346 new->start = start;
278 new->end = end; 347 new->end = end;
279 new->type = actual_type; 348 new->type = actual_type;
280 349
281 if (new_type) 350 if (new_type)
282 *new_type = actual_type; 351 *new_type = actual_type;
@@ -335,6 +404,7 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
335 start, end, cattr_name(new->type), cattr_name(req_type)); 404 start, end, cattr_name(new->type), cattr_name(req_type));
336 kfree(new); 405 kfree(new);
337 spin_unlock(&memtype_lock); 406 spin_unlock(&memtype_lock);
407
338 return err; 408 return err;
339 } 409 }
340 410
@@ -358,6 +428,7 @@ int free_memtype(u64 start, u64 end)
358{ 428{
359 struct memtype *entry; 429 struct memtype *entry;
360 int err = -EINVAL; 430 int err = -EINVAL;
431 int is_range_ram;
361 432
362 if (!pat_enabled) 433 if (!pat_enabled)
363 return 0; 434 return 0;
@@ -366,6 +437,12 @@ int free_memtype(u64 start, u64 end)
366 if (is_ISA_range(start, end - 1)) 437 if (is_ISA_range(start, end - 1))
367 return 0; 438 return 0;
368 439
440 is_range_ram = pagerange_is_ram(start, end);
441 if (is_range_ram == 1)
442 return free_ram_pages_type(start, end);
443 else if (is_range_ram < 0)
444 return -EINVAL;
445
369 spin_lock(&memtype_lock); 446 spin_lock(&memtype_lock);
370 list_for_each_entry(entry, &memtype_list, nd) { 447 list_for_each_entry(entry, &memtype_list, nd) {
371 if (entry->start == start && entry->end == end) { 448 if (entry->start == start && entry->end == end) {
@@ -386,6 +463,7 @@ int free_memtype(u64 start, u64 end)
386 } 463 }
387 464
388 dprintk("free_memtype request 0x%Lx-0x%Lx\n", start, end); 465 dprintk("free_memtype request 0x%Lx-0x%Lx\n", start, end);
466
389 return err; 467 return err;
390} 468}
391 469
@@ -492,9 +570,9 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
492 570
493void map_devmem(unsigned long pfn, unsigned long size, pgprot_t vma_prot) 571void map_devmem(unsigned long pfn, unsigned long size, pgprot_t vma_prot)
494{ 572{
573 unsigned long want_flags = (pgprot_val(vma_prot) & _PAGE_CACHE_MASK);
495 u64 addr = (u64)pfn << PAGE_SHIFT; 574 u64 addr = (u64)pfn << PAGE_SHIFT;
496 unsigned long flags; 575 unsigned long flags;
497 unsigned long want_flags = (pgprot_val(vma_prot) & _PAGE_CACHE_MASK);
498 576
499 reserve_memtype(addr, addr + size, want_flags, &flags); 577 reserve_memtype(addr, addr + size, want_flags, &flags);
500 if (flags != want_flags) { 578 if (flags != want_flags) {
@@ -514,7 +592,7 @@ void unmap_devmem(unsigned long pfn, unsigned long size, pgprot_t vma_prot)
514 free_memtype(addr, addr + size); 592 free_memtype(addr, addr + size);
515} 593}
516 594
517#if defined(CONFIG_DEBUG_FS) 595#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_X86_PAT)
518 596
519/* get Nth element of the linked list */ 597/* get Nth element of the linked list */
520static struct memtype *memtype_get_idx(loff_t pos) 598static struct memtype *memtype_get_idx(loff_t pos)
@@ -537,6 +615,7 @@ static struct memtype *memtype_get_idx(loff_t pos)
537 } 615 }
538 spin_unlock(&memtype_lock); 616 spin_unlock(&memtype_lock);
539 kfree(print_entry); 617 kfree(print_entry);
618
540 return NULL; 619 return NULL;
541} 620}
542 621
@@ -567,6 +646,7 @@ static int memtype_seq_show(struct seq_file *seq, void *v)
567 seq_printf(seq, "%s @ 0x%Lx-0x%Lx\n", cattr_name(print_entry->type), 646 seq_printf(seq, "%s @ 0x%Lx-0x%Lx\n", cattr_name(print_entry->type),
568 print_entry->start, print_entry->end); 647 print_entry->start, print_entry->end);
569 kfree(print_entry); 648 kfree(print_entry);
649
570 return 0; 650 return 0;
571} 651}
572 652
@@ -598,4 +678,4 @@ static int __init pat_memtype_list_init(void)
598 678
599late_initcall(pat_memtype_list_init); 679late_initcall(pat_memtype_list_init);
600 680
601#endif /* CONFIG_DEBUG_FS */ 681#endif /* CONFIG_DEBUG_FS && CONFIG_X86_PAT */
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
index d50302774fe2..86f2ffc43c3d 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -63,10 +63,8 @@ static inline void pgd_list_del(pgd_t *pgd)
63#define UNSHARED_PTRS_PER_PGD \ 63#define UNSHARED_PTRS_PER_PGD \
64 (SHARED_KERNEL_PMD ? KERNEL_PGD_BOUNDARY : PTRS_PER_PGD) 64 (SHARED_KERNEL_PMD ? KERNEL_PGD_BOUNDARY : PTRS_PER_PGD)
65 65
66static void pgd_ctor(void *p) 66static void pgd_ctor(pgd_t *pgd)
67{ 67{
68 pgd_t *pgd = p;
69
70 /* If the pgd points to a shared pagetable level (either the 68 /* If the pgd points to a shared pagetable level (either the
71 ptes in non-PAE, or shared PMD in PAE), then just copy the 69 ptes in non-PAE, or shared PMD in PAE), then just copy the
72 references from swapper_pg_dir. */ 70 references from swapper_pg_dir. */
@@ -87,7 +85,7 @@ static void pgd_ctor(void *p)
87 pgd_list_add(pgd); 85 pgd_list_add(pgd);
88} 86}
89 87
90static void pgd_dtor(void *pgd) 88static void pgd_dtor(pgd_t *pgd)
91{ 89{
92 unsigned long flags; /* can be called from interrupt context */ 90 unsigned long flags; /* can be called from interrupt context */
93 91
diff --git a/arch/x86/mm/pgtable_32.c b/arch/x86/mm/pgtable_32.c
index cab0abbd1ebe..0951db9ee519 100644
--- a/arch/x86/mm/pgtable_32.c
+++ b/arch/x86/mm/pgtable_32.c
@@ -123,7 +123,8 @@ static int __init parse_vmalloc(char *arg)
123 if (!arg) 123 if (!arg)
124 return -EINVAL; 124 return -EINVAL;
125 125
126 __VMALLOC_RESERVE = memparse(arg, &arg); 126 /* Add VMALLOC_OFFSET to the parsed value due to vm area guard hole*/
127 __VMALLOC_RESERVE = memparse(arg, &arg) + VMALLOC_OFFSET;
127 return 0; 128 return 0;
128} 129}
129early_param("vmalloc", parse_vmalloc); 130early_param("vmalloc", parse_vmalloc);
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index 0227694f7dab..8a5f1614a3d5 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -295,10 +295,12 @@ static void nmi_cpu_shutdown(void *dummy)
295 295
296static void nmi_shutdown(void) 296static void nmi_shutdown(void)
297{ 297{
298 struct op_msrs *msrs = &get_cpu_var(cpu_msrs); 298 struct op_msrs *msrs;
299
299 nmi_enabled = 0; 300 nmi_enabled = 0;
300 on_each_cpu(nmi_cpu_shutdown, NULL, 1); 301 on_each_cpu(nmi_cpu_shutdown, NULL, 1);
301 unregister_die_notifier(&profile_exceptions_nb); 302 unregister_die_notifier(&profile_exceptions_nb);
303 msrs = &get_cpu_var(cpu_msrs);
302 model->shutdown(msrs); 304 model->shutdown(msrs);
303 free_msrs(); 305 free_msrs();
304 put_cpu_var(cpu_msrs); 306 put_cpu_var(cpu_msrs);
diff --git a/arch/x86/oprofile/op_model_p4.c b/arch/x86/oprofile/op_model_p4.c
index 56b4757a1f47..43ac5af338d8 100644
--- a/arch/x86/oprofile/op_model_p4.c
+++ b/arch/x86/oprofile/op_model_p4.c
@@ -10,11 +10,12 @@
10 10
11#include <linux/oprofile.h> 11#include <linux/oprofile.h>
12#include <linux/smp.h> 12#include <linux/smp.h>
13#include <linux/ptrace.h>
14#include <linux/nmi.h>
13#include <asm/msr.h> 15#include <asm/msr.h>
14#include <asm/ptrace.h>
15#include <asm/fixmap.h> 16#include <asm/fixmap.h>
16#include <asm/apic.h> 17#include <asm/apic.h>
17#include <asm/nmi.h> 18
18 19
19#include "op_x86_model.h" 20#include "op_x86_model.h"
20#include "op_counter.h" 21#include "op_counter.h"
@@ -40,7 +41,7 @@ static unsigned int num_controls = NUM_CONTROLS_NON_HT;
40static inline void setup_num_counters(void) 41static inline void setup_num_counters(void)
41{ 42{
42#ifdef CONFIG_SMP 43#ifdef CONFIG_SMP
43 if (smp_num_siblings == 2){ 44 if (smp_num_siblings == 2) {
44 num_counters = NUM_COUNTERS_HT2; 45 num_counters = NUM_COUNTERS_HT2;
45 num_controls = NUM_CONTROLS_HT2; 46 num_controls = NUM_CONTROLS_HT2;
46 } 47 }
@@ -86,7 +87,7 @@ struct p4_event_binding {
86#define CTR_FLAME_2 (1 << 6) 87#define CTR_FLAME_2 (1 << 6)
87#define CTR_IQ_5 (1 << 7) 88#define CTR_IQ_5 (1 << 7)
88 89
89static struct p4_counter_binding p4_counters [NUM_COUNTERS_NON_HT] = { 90static struct p4_counter_binding p4_counters[NUM_COUNTERS_NON_HT] = {
90 { CTR_BPU_0, MSR_P4_BPU_PERFCTR0, MSR_P4_BPU_CCCR0 }, 91 { CTR_BPU_0, MSR_P4_BPU_PERFCTR0, MSR_P4_BPU_CCCR0 },
91 { CTR_MS_0, MSR_P4_MS_PERFCTR0, MSR_P4_MS_CCCR0 }, 92 { CTR_MS_0, MSR_P4_MS_PERFCTR0, MSR_P4_MS_CCCR0 },
92 { CTR_FLAME_0, MSR_P4_FLAME_PERFCTR0, MSR_P4_FLAME_CCCR0 }, 93 { CTR_FLAME_0, MSR_P4_FLAME_PERFCTR0, MSR_P4_FLAME_CCCR0 },
@@ -97,32 +98,32 @@ static struct p4_counter_binding p4_counters [NUM_COUNTERS_NON_HT] = {
97 { CTR_IQ_5, MSR_P4_IQ_PERFCTR5, MSR_P4_IQ_CCCR5 } 98 { CTR_IQ_5, MSR_P4_IQ_PERFCTR5, MSR_P4_IQ_CCCR5 }
98}; 99};
99 100
100#define NUM_UNUSED_CCCRS NUM_CCCRS_NON_HT - NUM_COUNTERS_NON_HT 101#define NUM_UNUSED_CCCRS (NUM_CCCRS_NON_HT - NUM_COUNTERS_NON_HT)
101 102
102/* p4 event codes in libop/op_event.h are indices into this table. */ 103/* p4 event codes in libop/op_event.h are indices into this table. */
103 104
104static struct p4_event_binding p4_events[NUM_EVENTS] = { 105static struct p4_event_binding p4_events[NUM_EVENTS] = {
105 106
106 { /* BRANCH_RETIRED */ 107 { /* BRANCH_RETIRED */
107 0x05, 0x06, 108 0x05, 0x06,
108 { {CTR_IQ_4, MSR_P4_CRU_ESCR2}, 109 { {CTR_IQ_4, MSR_P4_CRU_ESCR2},
109 {CTR_IQ_5, MSR_P4_CRU_ESCR3} } 110 {CTR_IQ_5, MSR_P4_CRU_ESCR3} }
110 }, 111 },
111 112
112 { /* MISPRED_BRANCH_RETIRED */ 113 { /* MISPRED_BRANCH_RETIRED */
113 0x04, 0x03, 114 0x04, 0x03,
114 { { CTR_IQ_4, MSR_P4_CRU_ESCR0}, 115 { { CTR_IQ_4, MSR_P4_CRU_ESCR0},
115 { CTR_IQ_5, MSR_P4_CRU_ESCR1} } 116 { CTR_IQ_5, MSR_P4_CRU_ESCR1} }
116 }, 117 },
117 118
118 { /* TC_DELIVER_MODE */ 119 { /* TC_DELIVER_MODE */
119 0x01, 0x01, 120 0x01, 0x01,
120 { { CTR_MS_0, MSR_P4_TC_ESCR0}, 121 { { CTR_MS_0, MSR_P4_TC_ESCR0},
121 { CTR_MS_2, MSR_P4_TC_ESCR1} } 122 { CTR_MS_2, MSR_P4_TC_ESCR1} }
122 }, 123 },
123 124
124 { /* BPU_FETCH_REQUEST */ 125 { /* BPU_FETCH_REQUEST */
125 0x00, 0x03, 126 0x00, 0x03,
126 { { CTR_BPU_0, MSR_P4_BPU_ESCR0}, 127 { { CTR_BPU_0, MSR_P4_BPU_ESCR0},
127 { CTR_BPU_2, MSR_P4_BPU_ESCR1} } 128 { CTR_BPU_2, MSR_P4_BPU_ESCR1} }
128 }, 129 },
@@ -146,7 +147,7 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = {
146 }, 147 },
147 148
148 { /* LOAD_PORT_REPLAY */ 149 { /* LOAD_PORT_REPLAY */
149 0x02, 0x04, 150 0x02, 0x04,
150 { { CTR_FLAME_0, MSR_P4_SAAT_ESCR0}, 151 { { CTR_FLAME_0, MSR_P4_SAAT_ESCR0},
151 { CTR_FLAME_2, MSR_P4_SAAT_ESCR1} } 152 { CTR_FLAME_2, MSR_P4_SAAT_ESCR1} }
152 }, 153 },
@@ -170,43 +171,43 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = {
170 }, 171 },
171 172
172 { /* BSQ_CACHE_REFERENCE */ 173 { /* BSQ_CACHE_REFERENCE */
173 0x07, 0x0c, 174 0x07, 0x0c,
174 { { CTR_BPU_0, MSR_P4_BSU_ESCR0}, 175 { { CTR_BPU_0, MSR_P4_BSU_ESCR0},
175 { CTR_BPU_2, MSR_P4_BSU_ESCR1} } 176 { CTR_BPU_2, MSR_P4_BSU_ESCR1} }
176 }, 177 },
177 178
178 { /* IOQ_ALLOCATION */ 179 { /* IOQ_ALLOCATION */
179 0x06, 0x03, 180 0x06, 0x03,
180 { { CTR_BPU_0, MSR_P4_FSB_ESCR0}, 181 { { CTR_BPU_0, MSR_P4_FSB_ESCR0},
181 { 0, 0 } } 182 { 0, 0 } }
182 }, 183 },
183 184
184 { /* IOQ_ACTIVE_ENTRIES */ 185 { /* IOQ_ACTIVE_ENTRIES */
185 0x06, 0x1a, 186 0x06, 0x1a,
186 { { CTR_BPU_2, MSR_P4_FSB_ESCR1}, 187 { { CTR_BPU_2, MSR_P4_FSB_ESCR1},
187 { 0, 0 } } 188 { 0, 0 } }
188 }, 189 },
189 190
190 { /* FSB_DATA_ACTIVITY */ 191 { /* FSB_DATA_ACTIVITY */
191 0x06, 0x17, 192 0x06, 0x17,
192 { { CTR_BPU_0, MSR_P4_FSB_ESCR0}, 193 { { CTR_BPU_0, MSR_P4_FSB_ESCR0},
193 { CTR_BPU_2, MSR_P4_FSB_ESCR1} } 194 { CTR_BPU_2, MSR_P4_FSB_ESCR1} }
194 }, 195 },
195 196
196 { /* BSQ_ALLOCATION */ 197 { /* BSQ_ALLOCATION */
197 0x07, 0x05, 198 0x07, 0x05,
198 { { CTR_BPU_0, MSR_P4_BSU_ESCR0}, 199 { { CTR_BPU_0, MSR_P4_BSU_ESCR0},
199 { 0, 0 } } 200 { 0, 0 } }
200 }, 201 },
201 202
202 { /* BSQ_ACTIVE_ENTRIES */ 203 { /* BSQ_ACTIVE_ENTRIES */
203 0x07, 0x06, 204 0x07, 0x06,
204 { { CTR_BPU_2, MSR_P4_BSU_ESCR1 /* guess */}, 205 { { CTR_BPU_2, MSR_P4_BSU_ESCR1 /* guess */},
205 { 0, 0 } } 206 { 0, 0 } }
206 }, 207 },
207 208
208 { /* X87_ASSIST */ 209 { /* X87_ASSIST */
209 0x05, 0x03, 210 0x05, 0x03,
210 { { CTR_IQ_4, MSR_P4_CRU_ESCR2}, 211 { { CTR_IQ_4, MSR_P4_CRU_ESCR2},
211 { CTR_IQ_5, MSR_P4_CRU_ESCR3} } 212 { CTR_IQ_5, MSR_P4_CRU_ESCR3} }
212 }, 213 },
@@ -216,21 +217,21 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = {
216 { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0}, 217 { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0},
217 { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} } 218 { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} }
218 }, 219 },
219 220
220 { /* PACKED_SP_UOP */ 221 { /* PACKED_SP_UOP */
221 0x01, 0x08, 222 0x01, 0x08,
222 { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0}, 223 { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0},
223 { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} } 224 { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} }
224 }, 225 },
225 226
226 { /* PACKED_DP_UOP */ 227 { /* PACKED_DP_UOP */
227 0x01, 0x0c, 228 0x01, 0x0c,
228 { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0}, 229 { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0},
229 { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} } 230 { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} }
230 }, 231 },
231 232
232 { /* SCALAR_SP_UOP */ 233 { /* SCALAR_SP_UOP */
233 0x01, 0x0a, 234 0x01, 0x0a,
234 { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0}, 235 { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0},
235 { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} } 236 { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} }
236 }, 237 },
@@ -242,31 +243,31 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = {
242 }, 243 },
243 244
244 { /* 64BIT_MMX_UOP */ 245 { /* 64BIT_MMX_UOP */
245 0x01, 0x02, 246 0x01, 0x02,
246 { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0}, 247 { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0},
247 { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} } 248 { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} }
248 }, 249 },
249 250
250 { /* 128BIT_MMX_UOP */ 251 { /* 128BIT_MMX_UOP */
251 0x01, 0x1a, 252 0x01, 0x1a,
252 { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0}, 253 { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0},
253 { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} } 254 { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} }
254 }, 255 },
255 256
256 { /* X87_FP_UOP */ 257 { /* X87_FP_UOP */
257 0x01, 0x04, 258 0x01, 0x04,
258 { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0}, 259 { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0},
259 { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} } 260 { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} }
260 }, 261 },
261 262
262 { /* X87_SIMD_MOVES_UOP */ 263 { /* X87_SIMD_MOVES_UOP */
263 0x01, 0x2e, 264 0x01, 0x2e,
264 { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0}, 265 { { CTR_FLAME_0, MSR_P4_FIRM_ESCR0},
265 { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} } 266 { CTR_FLAME_2, MSR_P4_FIRM_ESCR1} }
266 }, 267 },
267 268
268 { /* MACHINE_CLEAR */ 269 { /* MACHINE_CLEAR */
269 0x05, 0x02, 270 0x05, 0x02,
270 { { CTR_IQ_4, MSR_P4_CRU_ESCR2}, 271 { { CTR_IQ_4, MSR_P4_CRU_ESCR2},
271 { CTR_IQ_5, MSR_P4_CRU_ESCR3} } 272 { CTR_IQ_5, MSR_P4_CRU_ESCR3} }
272 }, 273 },
@@ -276,9 +277,9 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = {
276 { { CTR_BPU_0, MSR_P4_FSB_ESCR0}, 277 { { CTR_BPU_0, MSR_P4_FSB_ESCR0},
277 { CTR_BPU_2, MSR_P4_FSB_ESCR1} } 278 { CTR_BPU_2, MSR_P4_FSB_ESCR1} }
278 }, 279 },
279 280
280 { /* TC_MS_XFER */ 281 { /* TC_MS_XFER */
281 0x00, 0x05, 282 0x00, 0x05,
282 { { CTR_MS_0, MSR_P4_MS_ESCR0}, 283 { { CTR_MS_0, MSR_P4_MS_ESCR0},
283 { CTR_MS_2, MSR_P4_MS_ESCR1} } 284 { CTR_MS_2, MSR_P4_MS_ESCR1} }
284 }, 285 },
@@ -308,7 +309,7 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = {
308 }, 309 },
309 310
310 { /* INSTR_RETIRED */ 311 { /* INSTR_RETIRED */
311 0x04, 0x02, 312 0x04, 0x02,
312 { { CTR_IQ_4, MSR_P4_CRU_ESCR0}, 313 { { CTR_IQ_4, MSR_P4_CRU_ESCR0},
313 { CTR_IQ_5, MSR_P4_CRU_ESCR1} } 314 { CTR_IQ_5, MSR_P4_CRU_ESCR1} }
314 }, 315 },
@@ -319,14 +320,14 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = {
319 { CTR_IQ_5, MSR_P4_CRU_ESCR1} } 320 { CTR_IQ_5, MSR_P4_CRU_ESCR1} }
320 }, 321 },
321 322
322 { /* UOP_TYPE */ 323 { /* UOP_TYPE */
323 0x02, 0x02, 324 0x02, 0x02,
324 { { CTR_IQ_4, MSR_P4_RAT_ESCR0}, 325 { { CTR_IQ_4, MSR_P4_RAT_ESCR0},
325 { CTR_IQ_5, MSR_P4_RAT_ESCR1} } 326 { CTR_IQ_5, MSR_P4_RAT_ESCR1} }
326 }, 327 },
327 328
328 { /* RETIRED_MISPRED_BRANCH_TYPE */ 329 { /* RETIRED_MISPRED_BRANCH_TYPE */
329 0x02, 0x05, 330 0x02, 0x05,
330 { { CTR_MS_0, MSR_P4_TBPU_ESCR0}, 331 { { CTR_MS_0, MSR_P4_TBPU_ESCR0},
331 { CTR_MS_2, MSR_P4_TBPU_ESCR1} } 332 { CTR_MS_2, MSR_P4_TBPU_ESCR1} }
332 }, 333 },
@@ -349,8 +350,8 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = {
349#define ESCR_SET_OS_1(escr, os) ((escr) |= (((os) & 1) << 1)) 350#define ESCR_SET_OS_1(escr, os) ((escr) |= (((os) & 1) << 1))
350#define ESCR_SET_EVENT_SELECT(escr, sel) ((escr) |= (((sel) & 0x3f) << 25)) 351#define ESCR_SET_EVENT_SELECT(escr, sel) ((escr) |= (((sel) & 0x3f) << 25))
351#define ESCR_SET_EVENT_MASK(escr, mask) ((escr) |= (((mask) & 0xffff) << 9)) 352#define ESCR_SET_EVENT_MASK(escr, mask) ((escr) |= (((mask) & 0xffff) << 9))
352#define ESCR_READ(escr,high,ev,i) do {rdmsr(ev->bindings[(i)].escr_address, (escr), (high));} while (0) 353#define ESCR_READ(escr, high, ev, i) do {rdmsr(ev->bindings[(i)].escr_address, (escr), (high)); } while (0)
353#define ESCR_WRITE(escr,high,ev,i) do {wrmsr(ev->bindings[(i)].escr_address, (escr), (high));} while (0) 354#define ESCR_WRITE(escr, high, ev, i) do {wrmsr(ev->bindings[(i)].escr_address, (escr), (high)); } while (0)
354 355
355#define CCCR_RESERVED_BITS 0x38030FFF 356#define CCCR_RESERVED_BITS 0x38030FFF
356#define CCCR_CLEAR(cccr) ((cccr) &= CCCR_RESERVED_BITS) 357#define CCCR_CLEAR(cccr) ((cccr) &= CCCR_RESERVED_BITS)
@@ -360,15 +361,15 @@ static struct p4_event_binding p4_events[NUM_EVENTS] = {
360#define CCCR_SET_PMI_OVF_1(cccr) ((cccr) |= (1<<27)) 361#define CCCR_SET_PMI_OVF_1(cccr) ((cccr) |= (1<<27))
361#define CCCR_SET_ENABLE(cccr) ((cccr) |= (1<<12)) 362#define CCCR_SET_ENABLE(cccr) ((cccr) |= (1<<12))
362#define CCCR_SET_DISABLE(cccr) ((cccr) &= ~(1<<12)) 363#define CCCR_SET_DISABLE(cccr) ((cccr) &= ~(1<<12))
363#define CCCR_READ(low, high, i) do {rdmsr(p4_counters[(i)].cccr_address, (low), (high));} while (0) 364#define CCCR_READ(low, high, i) do {rdmsr(p4_counters[(i)].cccr_address, (low), (high)); } while (0)
364#define CCCR_WRITE(low, high, i) do {wrmsr(p4_counters[(i)].cccr_address, (low), (high));} while (0) 365#define CCCR_WRITE(low, high, i) do {wrmsr(p4_counters[(i)].cccr_address, (low), (high)); } while (0)
365#define CCCR_OVF_P(cccr) ((cccr) & (1U<<31)) 366#define CCCR_OVF_P(cccr) ((cccr) & (1U<<31))
366#define CCCR_CLEAR_OVF(cccr) ((cccr) &= (~(1U<<31))) 367#define CCCR_CLEAR_OVF(cccr) ((cccr) &= (~(1U<<31)))
367 368
368#define CTRL_IS_RESERVED(msrs,c) (msrs->controls[(c)].addr ? 1 : 0) 369#define CTRL_IS_RESERVED(msrs, c) (msrs->controls[(c)].addr ? 1 : 0)
369#define CTR_IS_RESERVED(msrs,c) (msrs->counters[(c)].addr ? 1 : 0) 370#define CTR_IS_RESERVED(msrs, c) (msrs->counters[(c)].addr ? 1 : 0)
370#define CTR_READ(l,h,i) do {rdmsr(p4_counters[(i)].counter_address, (l), (h));} while (0) 371#define CTR_READ(l, h, i) do {rdmsr(p4_counters[(i)].counter_address, (l), (h)); } while (0)
371#define CTR_WRITE(l,i) do {wrmsr(p4_counters[(i)].counter_address, -(u32)(l), -1);} while (0) 372#define CTR_WRITE(l, i) do {wrmsr(p4_counters[(i)].counter_address, -(u32)(l), -1); } while (0)
372#define CTR_OVERFLOW_P(ctr) (!((ctr) & 0x80000000)) 373#define CTR_OVERFLOW_P(ctr) (!((ctr) & 0x80000000))
373 374
374 375
@@ -380,7 +381,7 @@ static unsigned int get_stagger(void)
380#ifdef CONFIG_SMP 381#ifdef CONFIG_SMP
381 int cpu = smp_processor_id(); 382 int cpu = smp_processor_id();
382 return (cpu != first_cpu(per_cpu(cpu_sibling_map, cpu))); 383 return (cpu != first_cpu(per_cpu(cpu_sibling_map, cpu)));
383#endif 384#endif
384 return 0; 385 return 0;
385} 386}
386 387
@@ -395,25 +396,23 @@ static unsigned long reset_value[NUM_COUNTERS_NON_HT];
395 396
396static void p4_fill_in_addresses(struct op_msrs * const msrs) 397static void p4_fill_in_addresses(struct op_msrs * const msrs)
397{ 398{
398 unsigned int i; 399 unsigned int i;
399 unsigned int addr, cccraddr, stag; 400 unsigned int addr, cccraddr, stag;
400 401
401 setup_num_counters(); 402 setup_num_counters();
402 stag = get_stagger(); 403 stag = get_stagger();
403 404
404 /* initialize some registers */ 405 /* initialize some registers */
405 for (i = 0; i < num_counters; ++i) { 406 for (i = 0; i < num_counters; ++i)
406 msrs->counters[i].addr = 0; 407 msrs->counters[i].addr = 0;
407 } 408 for (i = 0; i < num_controls; ++i)
408 for (i = 0; i < num_controls; ++i) {
409 msrs->controls[i].addr = 0; 409 msrs->controls[i].addr = 0;
410 } 410
411
412 /* the counter & cccr registers we pay attention to */ 411 /* the counter & cccr registers we pay attention to */
413 for (i = 0; i < num_counters; ++i) { 412 for (i = 0; i < num_counters; ++i) {
414 addr = p4_counters[VIRT_CTR(stag, i)].counter_address; 413 addr = p4_counters[VIRT_CTR(stag, i)].counter_address;
415 cccraddr = p4_counters[VIRT_CTR(stag, i)].cccr_address; 414 cccraddr = p4_counters[VIRT_CTR(stag, i)].cccr_address;
416 if (reserve_perfctr_nmi(addr)){ 415 if (reserve_perfctr_nmi(addr)) {
417 msrs->counters[i].addr = addr; 416 msrs->counters[i].addr = addr;
418 msrs->controls[i].addr = cccraddr; 417 msrs->controls[i].addr = cccraddr;
419 } 418 }
@@ -447,22 +446,22 @@ static void p4_fill_in_addresses(struct op_msrs * const msrs)
447 if (reserve_evntsel_nmi(addr)) 446 if (reserve_evntsel_nmi(addr))
448 msrs->controls[i].addr = addr; 447 msrs->controls[i].addr = addr;
449 } 448 }
450 449
451 for (addr = MSR_P4_MS_ESCR0 + stag; 450 for (addr = MSR_P4_MS_ESCR0 + stag;
452 addr <= MSR_P4_TC_ESCR1; ++i, addr += addr_increment()) { 451 addr <= MSR_P4_TC_ESCR1; ++i, addr += addr_increment()) {
453 if (reserve_evntsel_nmi(addr)) 452 if (reserve_evntsel_nmi(addr))
454 msrs->controls[i].addr = addr; 453 msrs->controls[i].addr = addr;
455 } 454 }
456 455
457 for (addr = MSR_P4_IX_ESCR0 + stag; 456 for (addr = MSR_P4_IX_ESCR0 + stag;
458 addr <= MSR_P4_CRU_ESCR3; ++i, addr += addr_increment()) { 457 addr <= MSR_P4_CRU_ESCR3; ++i, addr += addr_increment()) {
459 if (reserve_evntsel_nmi(addr)) 458 if (reserve_evntsel_nmi(addr))
460 msrs->controls[i].addr = addr; 459 msrs->controls[i].addr = addr;
461 } 460 }
462 461
463 /* there are 2 remaining non-contiguously located ESCRs */ 462 /* there are 2 remaining non-contiguously located ESCRs */
464 463
465 if (num_counters == NUM_COUNTERS_NON_HT) { 464 if (num_counters == NUM_COUNTERS_NON_HT) {
466 /* standard non-HT CPUs handle both remaining ESCRs*/ 465 /* standard non-HT CPUs handle both remaining ESCRs*/
467 if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR5)) 466 if (reserve_evntsel_nmi(MSR_P4_CRU_ESCR5))
468 msrs->controls[i++].addr = MSR_P4_CRU_ESCR5; 467 msrs->controls[i++].addr = MSR_P4_CRU_ESCR5;
@@ -498,20 +497,20 @@ static void pmc_setup_one_p4_counter(unsigned int ctr)
498 unsigned int stag; 497 unsigned int stag;
499 498
500 stag = get_stagger(); 499 stag = get_stagger();
501 500
502 /* convert from counter *number* to counter *bit* */ 501 /* convert from counter *number* to counter *bit* */
503 counter_bit = 1 << VIRT_CTR(stag, ctr); 502 counter_bit = 1 << VIRT_CTR(stag, ctr);
504 503
505 /* find our event binding structure. */ 504 /* find our event binding structure. */
506 if (counter_config[ctr].event <= 0 || counter_config[ctr].event > NUM_EVENTS) { 505 if (counter_config[ctr].event <= 0 || counter_config[ctr].event > NUM_EVENTS) {
507 printk(KERN_ERR 506 printk(KERN_ERR
508 "oprofile: P4 event code 0x%lx out of range\n", 507 "oprofile: P4 event code 0x%lx out of range\n",
509 counter_config[ctr].event); 508 counter_config[ctr].event);
510 return; 509 return;
511 } 510 }
512 511
513 ev = &(p4_events[counter_config[ctr].event - 1]); 512 ev = &(p4_events[counter_config[ctr].event - 1]);
514 513
515 for (i = 0; i < maxbind; i++) { 514 for (i = 0; i < maxbind; i++) {
516 if (ev->bindings[i].virt_counter & counter_bit) { 515 if (ev->bindings[i].virt_counter & counter_bit) {
517 516
@@ -526,25 +525,24 @@ static void pmc_setup_one_p4_counter(unsigned int ctr)
526 ESCR_SET_OS_1(escr, counter_config[ctr].kernel); 525 ESCR_SET_OS_1(escr, counter_config[ctr].kernel);
527 } 526 }
528 ESCR_SET_EVENT_SELECT(escr, ev->event_select); 527 ESCR_SET_EVENT_SELECT(escr, ev->event_select);
529 ESCR_SET_EVENT_MASK(escr, counter_config[ctr].unit_mask); 528 ESCR_SET_EVENT_MASK(escr, counter_config[ctr].unit_mask);
530 ESCR_WRITE(escr, high, ev, i); 529 ESCR_WRITE(escr, high, ev, i);
531 530
532 /* modify CCCR */ 531 /* modify CCCR */
533 CCCR_READ(cccr, high, VIRT_CTR(stag, ctr)); 532 CCCR_READ(cccr, high, VIRT_CTR(stag, ctr));
534 CCCR_CLEAR(cccr); 533 CCCR_CLEAR(cccr);
535 CCCR_SET_REQUIRED_BITS(cccr); 534 CCCR_SET_REQUIRED_BITS(cccr);
536 CCCR_SET_ESCR_SELECT(cccr, ev->escr_select); 535 CCCR_SET_ESCR_SELECT(cccr, ev->escr_select);
537 if (stag == 0) { 536 if (stag == 0)
538 CCCR_SET_PMI_OVF_0(cccr); 537 CCCR_SET_PMI_OVF_0(cccr);
539 } else { 538 else
540 CCCR_SET_PMI_OVF_1(cccr); 539 CCCR_SET_PMI_OVF_1(cccr);
541 }
542 CCCR_WRITE(cccr, high, VIRT_CTR(stag, ctr)); 540 CCCR_WRITE(cccr, high, VIRT_CTR(stag, ctr));
543 return; 541 return;
544 } 542 }
545 } 543 }
546 544
547 printk(KERN_ERR 545 printk(KERN_ERR
548 "oprofile: P4 event code 0x%lx no binding, stag %d ctr %d\n", 546 "oprofile: P4 event code 0x%lx no binding, stag %d ctr %d\n",
549 counter_config[ctr].event, stag, ctr); 547 counter_config[ctr].event, stag, ctr);
550} 548}
@@ -559,14 +557,14 @@ static void p4_setup_ctrs(struct op_msrs const * const msrs)
559 stag = get_stagger(); 557 stag = get_stagger();
560 558
561 rdmsr(MSR_IA32_MISC_ENABLE, low, high); 559 rdmsr(MSR_IA32_MISC_ENABLE, low, high);
562 if (! MISC_PMC_ENABLED_P(low)) { 560 if (!MISC_PMC_ENABLED_P(low)) {
563 printk(KERN_ERR "oprofile: P4 PMC not available\n"); 561 printk(KERN_ERR "oprofile: P4 PMC not available\n");
564 return; 562 return;
565 } 563 }
566 564
567 /* clear the cccrs we will use */ 565 /* clear the cccrs we will use */
568 for (i = 0 ; i < num_counters ; i++) { 566 for (i = 0 ; i < num_counters ; i++) {
569 if (unlikely(!CTRL_IS_RESERVED(msrs,i))) 567 if (unlikely(!CTRL_IS_RESERVED(msrs, i)))
570 continue; 568 continue;
571 rdmsr(p4_counters[VIRT_CTR(stag, i)].cccr_address, low, high); 569 rdmsr(p4_counters[VIRT_CTR(stag, i)].cccr_address, low, high);
572 CCCR_CLEAR(low); 570 CCCR_CLEAR(low);
@@ -576,14 +574,14 @@ static void p4_setup_ctrs(struct op_msrs const * const msrs)
576 574
577 /* clear all escrs (including those outside our concern) */ 575 /* clear all escrs (including those outside our concern) */
578 for (i = num_counters; i < num_controls; i++) { 576 for (i = num_counters; i < num_controls; i++) {
579 if (unlikely(!CTRL_IS_RESERVED(msrs,i))) 577 if (unlikely(!CTRL_IS_RESERVED(msrs, i)))
580 continue; 578 continue;
581 wrmsr(msrs->controls[i].addr, 0, 0); 579 wrmsr(msrs->controls[i].addr, 0, 0);
582 } 580 }
583 581
584 /* setup all counters */ 582 /* setup all counters */
585 for (i = 0 ; i < num_counters ; ++i) { 583 for (i = 0 ; i < num_counters ; ++i) {
586 if ((counter_config[i].enabled) && (CTRL_IS_RESERVED(msrs,i))) { 584 if ((counter_config[i].enabled) && (CTRL_IS_RESERVED(msrs, i))) {
587 reset_value[i] = counter_config[i].count; 585 reset_value[i] = counter_config[i].count;
588 pmc_setup_one_p4_counter(i); 586 pmc_setup_one_p4_counter(i);
589 CTR_WRITE(counter_config[i].count, VIRT_CTR(stag, i)); 587 CTR_WRITE(counter_config[i].count, VIRT_CTR(stag, i));
@@ -603,11 +601,11 @@ static int p4_check_ctrs(struct pt_regs * const regs,
603 stag = get_stagger(); 601 stag = get_stagger();
604 602
605 for (i = 0; i < num_counters; ++i) { 603 for (i = 0; i < num_counters; ++i) {
606 604
607 if (!reset_value[i]) 605 if (!reset_value[i])
608 continue; 606 continue;
609 607
610 /* 608 /*
611 * there is some eccentricity in the hardware which 609 * there is some eccentricity in the hardware which
612 * requires that we perform 2 extra corrections: 610 * requires that we perform 2 extra corrections:
613 * 611 *
@@ -616,24 +614,24 @@ static int p4_check_ctrs(struct pt_regs * const regs,
616 * 614 *
617 * - write the counter back twice to ensure it gets 615 * - write the counter back twice to ensure it gets
618 * updated properly. 616 * updated properly.
619 * 617 *
620 * the former seems to be related to extra NMIs happening 618 * the former seems to be related to extra NMIs happening
621 * during the current NMI; the latter is reported as errata 619 * during the current NMI; the latter is reported as errata
622 * N15 in intel doc 249199-029, pentium 4 specification 620 * N15 in intel doc 249199-029, pentium 4 specification
623 * update, though their suggested work-around does not 621 * update, though their suggested work-around does not
624 * appear to solve the problem. 622 * appear to solve the problem.
625 */ 623 */
626 624
627 real = VIRT_CTR(stag, i); 625 real = VIRT_CTR(stag, i);
628 626
629 CCCR_READ(low, high, real); 627 CCCR_READ(low, high, real);
630 CTR_READ(ctr, high, real); 628 CTR_READ(ctr, high, real);
631 if (CCCR_OVF_P(low) || CTR_OVERFLOW_P(ctr)) { 629 if (CCCR_OVF_P(low) || CTR_OVERFLOW_P(ctr)) {
632 oprofile_add_sample(regs, i); 630 oprofile_add_sample(regs, i);
633 CTR_WRITE(reset_value[i], real); 631 CTR_WRITE(reset_value[i], real);
634 CCCR_CLEAR_OVF(low); 632 CCCR_CLEAR_OVF(low);
635 CCCR_WRITE(low, high, real); 633 CCCR_WRITE(low, high, real);
636 CTR_WRITE(reset_value[i], real); 634 CTR_WRITE(reset_value[i], real);
637 } 635 }
638 } 636 }
639 637
@@ -683,15 +681,16 @@ static void p4_shutdown(struct op_msrs const * const msrs)
683 int i; 681 int i;
684 682
685 for (i = 0 ; i < num_counters ; ++i) { 683 for (i = 0 ; i < num_counters ; ++i) {
686 if (CTR_IS_RESERVED(msrs,i)) 684 if (CTR_IS_RESERVED(msrs, i))
687 release_perfctr_nmi(msrs->counters[i].addr); 685 release_perfctr_nmi(msrs->counters[i].addr);
688 } 686 }
689 /* some of the control registers are specially reserved in 687 /*
688 * some of the control registers are specially reserved in
690 * conjunction with the counter registers (hence the starting offset). 689 * conjunction with the counter registers (hence the starting offset).
691 * This saves a few bits. 690 * This saves a few bits.
692 */ 691 */
693 for (i = num_counters ; i < num_controls ; ++i) { 692 for (i = num_counters ; i < num_controls ; ++i) {
694 if (CTRL_IS_RESERVED(msrs,i)) 693 if (CTRL_IS_RESERVED(msrs, i))
695 release_evntsel_nmi(msrs->controls[i].addr); 694 release_evntsel_nmi(msrs->controls[i].addr);
696 } 695 }
697} 696}
diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
index 6a0fca78c362..22e057665e55 100644
--- a/arch/x86/pci/amd_bus.c
+++ b/arch/x86/pci/amd_bus.c
@@ -580,7 +580,7 @@ static int __cpuinit amd_cpu_notify(struct notifier_block *self,
580 unsigned long action, void *hcpu) 580 unsigned long action, void *hcpu)
581{ 581{
582 int cpu = (long)hcpu; 582 int cpu = (long)hcpu;
583 switch(action) { 583 switch (action) {
584 case CPU_ONLINE: 584 case CPU_ONLINE:
585 case CPU_ONLINE_FROZEN: 585 case CPU_ONLINE_FROZEN:
586 smp_call_function_single(cpu, enable_pci_io_ecs, NULL, 0); 586 smp_call_function_single(cpu, enable_pci_io_ecs, NULL, 0);
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index 8e077185e185..006599db0dc7 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -1043,35 +1043,44 @@ static void __init pcibios_fixup_irqs(void)
1043 if (io_apic_assign_pci_irqs) { 1043 if (io_apic_assign_pci_irqs) {
1044 int irq; 1044 int irq;
1045 1045
1046 if (pin) { 1046 if (!pin)
1047 /* 1047 continue;
1048 * interrupt pins are numbered starting 1048
1049 * from 1 1049 /*
1050 */ 1050 * interrupt pins are numbered starting from 1
1051 pin--; 1051 */
1052 irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, 1052 pin--;
1053 PCI_SLOT(dev->devfn), pin); 1053 irq = IO_APIC_get_PCI_irq_vector(dev->bus->number,
1054 /* 1054 PCI_SLOT(dev->devfn), pin);
1055 * Busses behind bridges are typically not listed in the MP-table. 1055 /*
1056 * In this case we have to look up the IRQ based on the parent bus, 1056 * Busses behind bridges are typically not listed in the
1057 * parent slot, and pin number. The SMP code detects such bridged 1057 * MP-table. In this case we have to look up the IRQ
1058 * busses itself so we should get into this branch reliably. 1058 * based on the parent bus, parent slot, and pin number.
1059 */ 1059 * The SMP code detects such bridged busses itself so we
1060 if (irq < 0 && dev->bus->parent) { /* go back to the bridge */ 1060 * should get into this branch reliably.
1061 struct pci_dev *bridge = dev->bus->self; 1061 */
1062 1062 if (irq < 0 && dev->bus->parent) {
1063 pin = (pin + PCI_SLOT(dev->devfn)) % 4; 1063 /* go back to the bridge */
1064 irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, 1064 struct pci_dev *bridge = dev->bus->self;
1065 PCI_SLOT(bridge->devfn), pin); 1065 int bus;
1066 if (irq >= 0) 1066
1067 dev_warn(&dev->dev, "using bridge %s INT %c to get IRQ %d\n", 1067 pin = (pin + PCI_SLOT(dev->devfn)) % 4;
1068 pci_name(bridge), 1068 bus = bridge->bus->number;
1069 'A' + pin, irq); 1069 irq = IO_APIC_get_PCI_irq_vector(bus,
1070 } 1070 PCI_SLOT(bridge->devfn), pin);
1071 if (irq >= 0) { 1071 if (irq >= 0)
1072 dev_info(&dev->dev, "PCI->APIC IRQ transform: INT %c -> IRQ %d\n", 'A' + pin, irq); 1072 dev_warn(&dev->dev,
1073 dev->irq = irq; 1073 "using bridge %s INT %c to "
1074 } 1074 "get IRQ %d\n",
1075 pci_name(bridge),
1076 'A' + pin, irq);
1077 }
1078 if (irq >= 0) {
1079 dev_info(&dev->dev,
1080 "PCI->APIC IRQ transform: INT %c "
1081 "-> IRQ %d\n",
1082 'A' + pin, irq);
1083 dev->irq = irq;
1075 } 1084 }
1076 } 1085 }
1077#endif 1086#endif
diff --git a/arch/x86/power/hibernate_asm_32.S b/arch/x86/power/hibernate_asm_32.S
index 4fc7e872c85e..d1e9b53f9d33 100644
--- a/arch/x86/power/hibernate_asm_32.S
+++ b/arch/x86/power/hibernate_asm_32.S
@@ -1,5 +1,3 @@
1.text
2
3/* 1/*
4 * This may not use any stack, nor any variable that is not "NoSave": 2 * This may not use any stack, nor any variable that is not "NoSave":
5 * 3 *
@@ -12,17 +10,18 @@
12#include <asm/segment.h> 10#include <asm/segment.h>
13#include <asm/page.h> 11#include <asm/page.h>
14#include <asm/asm-offsets.h> 12#include <asm/asm-offsets.h>
13#include <asm/processor-flags.h>
15 14
16 .text 15.text
17 16
18ENTRY(swsusp_arch_suspend) 17ENTRY(swsusp_arch_suspend)
19
20 movl %esp, saved_context_esp 18 movl %esp, saved_context_esp
21 movl %ebx, saved_context_ebx 19 movl %ebx, saved_context_ebx
22 movl %ebp, saved_context_ebp 20 movl %ebp, saved_context_ebp
23 movl %esi, saved_context_esi 21 movl %esi, saved_context_esi
24 movl %edi, saved_context_edi 22 movl %edi, saved_context_edi
25 pushfl ; popl saved_context_eflags 23 pushfl
24 popl saved_context_eflags
26 25
27 call swsusp_save 26 call swsusp_save
28 ret 27 ret
@@ -59,7 +58,7 @@ done:
59 movl mmu_cr4_features, %ecx 58 movl mmu_cr4_features, %ecx
60 jecxz 1f # cr4 Pentium and higher, skip if zero 59 jecxz 1f # cr4 Pentium and higher, skip if zero
61 movl %ecx, %edx 60 movl %ecx, %edx
62 andl $~(1<<7), %edx; # PGE 61 andl $~(X86_CR4_PGE), %edx
63 movl %edx, %cr4; # turn off PGE 62 movl %edx, %cr4; # turn off PGE
641: 631:
65 movl %cr3, %eax; # flush TLB 64 movl %cr3, %eax; # flush TLB
@@ -74,7 +73,8 @@ done:
74 movl saved_context_esi, %esi 73 movl saved_context_esi, %esi
75 movl saved_context_edi, %edi 74 movl saved_context_edi, %edi
76 75
77 pushl saved_context_eflags ; popfl 76 pushl saved_context_eflags
77 popfl
78 78
79 xorl %eax, %eax 79 xorl %eax, %eax
80 80
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 7b3508952b9c..a27d562a9744 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -844,7 +844,7 @@ static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
844 844
845/* Early in boot, while setting up the initial pagetable, assume 845/* Early in boot, while setting up the initial pagetable, assume
846 everything is pinned. */ 846 everything is pinned. */
847static __init void xen_alloc_pte_init(struct mm_struct *mm, u32 pfn) 847static __init void xen_alloc_pte_init(struct mm_struct *mm, unsigned long pfn)
848{ 848{
849#ifdef CONFIG_FLATMEM 849#ifdef CONFIG_FLATMEM
850 BUG_ON(mem_map); /* should only be used early */ 850 BUG_ON(mem_map); /* should only be used early */
@@ -854,7 +854,7 @@ static __init void xen_alloc_pte_init(struct mm_struct *mm, u32 pfn)
854 854
855/* Early release_pte assumes that all pts are pinned, since there's 855/* Early release_pte assumes that all pts are pinned, since there's
856 only init_mm and anything attached to that is pinned. */ 856 only init_mm and anything attached to that is pinned. */
857static void xen_release_pte_init(u32 pfn) 857static void xen_release_pte_init(unsigned long pfn)
858{ 858{
859 make_lowmem_page_readwrite(__va(PFN_PHYS(pfn))); 859 make_lowmem_page_readwrite(__va(PFN_PHYS(pfn)));
860} 860}
@@ -870,7 +870,7 @@ static void pin_pagetable_pfn(unsigned cmd, unsigned long pfn)
870 870
871/* This needs to make sure the new pte page is pinned iff its being 871/* This needs to make sure the new pte page is pinned iff its being
872 attached to a pinned pagetable. */ 872 attached to a pinned pagetable. */
873static void xen_alloc_ptpage(struct mm_struct *mm, u32 pfn, unsigned level) 873static void xen_alloc_ptpage(struct mm_struct *mm, unsigned long pfn, unsigned level)
874{ 874{
875 struct page *page = pfn_to_page(pfn); 875 struct page *page = pfn_to_page(pfn);
876 876
@@ -888,12 +888,12 @@ static void xen_alloc_ptpage(struct mm_struct *mm, u32 pfn, unsigned level)
888 } 888 }
889} 889}
890 890
891static void xen_alloc_pte(struct mm_struct *mm, u32 pfn) 891static void xen_alloc_pte(struct mm_struct *mm, unsigned long pfn)
892{ 892{
893 xen_alloc_ptpage(mm, pfn, PT_PTE); 893 xen_alloc_ptpage(mm, pfn, PT_PTE);
894} 894}
895 895
896static void xen_alloc_pmd(struct mm_struct *mm, u32 pfn) 896static void xen_alloc_pmd(struct mm_struct *mm, unsigned long pfn)
897{ 897{
898 xen_alloc_ptpage(mm, pfn, PT_PMD); 898 xen_alloc_ptpage(mm, pfn, PT_PMD);
899} 899}
@@ -941,7 +941,7 @@ static void xen_pgd_free(struct mm_struct *mm, pgd_t *pgd)
941} 941}
942 942
943/* This should never happen until we're OK to use struct page */ 943/* This should never happen until we're OK to use struct page */
944static void xen_release_ptpage(u32 pfn, unsigned level) 944static void xen_release_ptpage(unsigned long pfn, unsigned level)
945{ 945{
946 struct page *page = pfn_to_page(pfn); 946 struct page *page = pfn_to_page(pfn);
947 947
@@ -955,23 +955,23 @@ static void xen_release_ptpage(u32 pfn, unsigned level)
955 } 955 }
956} 956}
957 957
958static void xen_release_pte(u32 pfn) 958static void xen_release_pte(unsigned long pfn)
959{ 959{
960 xen_release_ptpage(pfn, PT_PTE); 960 xen_release_ptpage(pfn, PT_PTE);
961} 961}
962 962
963static void xen_release_pmd(u32 pfn) 963static void xen_release_pmd(unsigned long pfn)
964{ 964{
965 xen_release_ptpage(pfn, PT_PMD); 965 xen_release_ptpage(pfn, PT_PMD);
966} 966}
967 967
968#if PAGETABLE_LEVELS == 4 968#if PAGETABLE_LEVELS == 4
969static void xen_alloc_pud(struct mm_struct *mm, u32 pfn) 969static void xen_alloc_pud(struct mm_struct *mm, unsigned long pfn)
970{ 970{
971 xen_alloc_ptpage(mm, pfn, PT_PUD); 971 xen_alloc_ptpage(mm, pfn, PT_PUD);
972} 972}
973 973
974static void xen_release_pud(u32 pfn) 974static void xen_release_pud(unsigned long pfn)
975{ 975{
976 xen_release_ptpage(pfn, PT_PUD); 976 xen_release_ptpage(pfn, PT_PUD);
977} 977}
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index b6acc3a0af46..d67901083888 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -42,7 +42,7 @@ char * __init xen_memory_setup(void)
42 42
43 e820.nr_map = 0; 43 e820.nr_map = 0;
44 44
45 e820_add_region(0, PFN_PHYS(max_pfn), E820_RAM); 45 e820_add_region(0, PFN_PHYS((u64)max_pfn), E820_RAM);
46 46
47 /* 47 /*
48 * Even though this is normal, usable memory under Xen, reserve 48 * Even though this is normal, usable memory under Xen, reserve
diff --git a/block/cmd-filter.c b/block/cmd-filter.c
index 228b6447e89f..79c14996ac11 100644
--- a/block/cmd-filter.c
+++ b/block/cmd-filter.c
@@ -49,6 +49,7 @@ int blk_verify_command(struct blk_cmd_filter *filter,
49} 49}
50EXPORT_SYMBOL(blk_verify_command); 50EXPORT_SYMBOL(blk_verify_command);
51 51
52#if 0
52/* and now, the sysfs stuff */ 53/* and now, the sysfs stuff */
53static ssize_t rcf_cmds_show(struct blk_cmd_filter *filter, char *page, 54static ssize_t rcf_cmds_show(struct blk_cmd_filter *filter, char *page,
54 int rw) 55 int rw)
@@ -233,3 +234,4 @@ void blk_unregister_filter(struct gendisk *disk)
233 kobject_put(disk->holder_dir->parent); 234 kobject_put(disk->holder_dir->parent);
234} 235}
235EXPORT_SYMBOL(blk_unregister_filter); 236EXPORT_SYMBOL(blk_unregister_filter);
237#endif
diff --git a/drivers/accessibility/braille/braille_console.c b/drivers/accessibility/braille/braille_console.c
index 0a5f6b2114c5..d672cfe7ca59 100644
--- a/drivers/accessibility/braille/braille_console.c
+++ b/drivers/accessibility/braille/braille_console.c
@@ -376,6 +376,8 @@ int braille_register_console(struct console *console, int index,
376 console->flags |= CON_ENABLED; 376 console->flags |= CON_ENABLED;
377 console->index = index; 377 console->index = index;
378 braille_co = console; 378 braille_co = console;
379 register_keyboard_notifier(&keyboard_notifier_block);
380 register_vt_notifier(&vt_notifier_block);
379 return 0; 381 return 0;
380} 382}
381 383
@@ -383,15 +385,8 @@ int braille_unregister_console(struct console *console)
383{ 385{
384 if (braille_co != console) 386 if (braille_co != console)
385 return -EINVAL; 387 return -EINVAL;
388 unregister_keyboard_notifier(&keyboard_notifier_block);
389 unregister_vt_notifier(&vt_notifier_block);
386 braille_co = NULL; 390 braille_co = NULL;
387 return 0; 391 return 0;
388} 392}
389
390static int __init braille_init(void)
391{
392 register_keyboard_notifier(&keyboard_notifier_block);
393 register_vt_notifier(&vt_notifier_block);
394 return 0;
395}
396
397console_initcall(braille_init);
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index 084109507c9f..8dd3336efd7e 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -165,8 +165,11 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle)
165 "firmware_node"); 165 "firmware_node");
166 ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, 166 ret = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj,
167 "physical_node"); 167 "physical_node");
168 if (acpi_dev->wakeup.flags.valid) 168 if (acpi_dev->wakeup.flags.valid) {
169 device_set_wakeup_capable(dev, true); 169 device_set_wakeup_capable(dev, true);
170 device_set_wakeup_enable(dev,
171 acpi_dev->wakeup.state.enabled);
172 }
170 } 173 }
171 174
172 return 0; 175 return 0;
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c
index 4ebbba2b6b19..bf5b04de02d1 100644
--- a/drivers/acpi/sleep/proc.c
+++ b/drivers/acpi/sleep/proc.c
@@ -377,6 +377,14 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
377 return 0; 377 return 0;
378} 378}
379 379
380static void physical_device_enable_wakeup(struct acpi_device *adev)
381{
382 struct device *dev = acpi_get_physical_device(adev->handle);
383
384 if (dev && device_can_wakeup(dev))
385 device_set_wakeup_enable(dev, adev->wakeup.state.enabled);
386}
387
380static ssize_t 388static ssize_t
381acpi_system_write_wakeup_device(struct file *file, 389acpi_system_write_wakeup_device(struct file *file,
382 const char __user * buffer, 390 const char __user * buffer,
@@ -411,6 +419,7 @@ acpi_system_write_wakeup_device(struct file *file,
411 } 419 }
412 } 420 }
413 if (found_dev) { 421 if (found_dev) {
422 physical_device_enable_wakeup(found_dev);
414 list_for_each_safe(node, next, &acpi_wakeup_device_list) { 423 list_for_each_safe(node, next, &acpi_wakeup_device_list) {
415 struct acpi_device *dev = container_of(node, 424 struct acpi_device *dev = container_of(node,
416 struct 425 struct
@@ -428,6 +437,7 @@ acpi_system_write_wakeup_device(struct file *file,
428 dev->pnp.bus_id, found_dev->pnp.bus_id); 437 dev->pnp.bus_id, found_dev->pnp.bus_id);
429 dev->wakeup.state.enabled = 438 dev->wakeup.state.enabled =
430 found_dev->wakeup.state.enabled; 439 found_dev->wakeup.state.enabled;
440 physical_device_enable_wakeup(dev);
431 } 441 }
432 } 442 }
433 } 443 }
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 11c8c19f0fb7..f17cd4b572f8 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -663,7 +663,7 @@ config HAVE_PATA_PLATFORM
663 663
664config PATA_PLATFORM 664config PATA_PLATFORM
665 tristate "Generic platform device PATA support" 665 tristate "Generic platform device PATA support"
666 depends on EMBEDDED || ARCH_RPC || PPC || HAVE_PATA_PLATFORM 666 depends on EMBEDDED || PPC || HAVE_PATA_PLATFORM
667 help 667 help
668 This option enables support for generic directly connected ATA 668 This option enables support for generic directly connected ATA
669 devices commonly found on embedded systems. 669 devices commonly found on embedded systems.
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 2e1a7cb2ed5f..aeadd00411a1 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -267,8 +267,8 @@ struct ahci_port_priv {
267 * per PM slot */ 267 * per PM slot */
268}; 268};
269 269
270static int ahci_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); 270static int ahci_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
271static int ahci_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); 271static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val);
272static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 272static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
273static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc); 273static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc);
274static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc); 274static bool ahci_qc_fill_rtf(struct ata_queued_cmd *qc);
@@ -316,6 +316,7 @@ static struct device_attribute *ahci_shost_attrs[] = {
316 316
317static struct device_attribute *ahci_sdev_attrs[] = { 317static struct device_attribute *ahci_sdev_attrs[] = {
318 &dev_attr_sw_activity, 318 &dev_attr_sw_activity,
319 &dev_attr_unload_heads,
319 NULL 320 NULL
320}; 321};
321 322
@@ -820,10 +821,10 @@ static unsigned ahci_scr_offset(struct ata_port *ap, unsigned int sc_reg)
820 return 0; 821 return 0;
821} 822}
822 823
823static int ahci_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) 824static int ahci_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val)
824{ 825{
825 void __iomem *port_mmio = ahci_port_base(ap); 826 void __iomem *port_mmio = ahci_port_base(link->ap);
826 int offset = ahci_scr_offset(ap, sc_reg); 827 int offset = ahci_scr_offset(link->ap, sc_reg);
827 828
828 if (offset) { 829 if (offset) {
829 *val = readl(port_mmio + offset); 830 *val = readl(port_mmio + offset);
@@ -832,10 +833,10 @@ static int ahci_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
832 return -EINVAL; 833 return -EINVAL;
833} 834}
834 835
835static int ahci_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) 836static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
836{ 837{
837 void __iomem *port_mmio = ahci_port_base(ap); 838 void __iomem *port_mmio = ahci_port_base(link->ap);
838 int offset = ahci_scr_offset(ap, sc_reg); 839 int offset = ahci_scr_offset(link->ap, sc_reg);
839 840
840 if (offset) { 841 if (offset) {
841 writel(val, port_mmio + offset); 842 writel(val, port_mmio + offset);
@@ -973,7 +974,7 @@ static void ahci_disable_alpm(struct ata_port *ap)
973 writel(PORT_IRQ_PHYRDY, port_mmio + PORT_IRQ_STAT); 974 writel(PORT_IRQ_PHYRDY, port_mmio + PORT_IRQ_STAT);
974 975
975 /* go ahead and clean out PhyRdy Change from Serror too */ 976 /* go ahead and clean out PhyRdy Change from Serror too */
976 ahci_scr_write(ap, SCR_ERROR, ((1 << 16) | (1 << 18))); 977 ahci_scr_write(&ap->link, SCR_ERROR, ((1 << 16) | (1 << 18)));
977 978
978 /* 979 /*
979 * Clear flag to indicate that we should ignore all PhyRdy 980 * Clear flag to indicate that we should ignore all PhyRdy
@@ -1937,8 +1938,8 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)
1937 ata_ehi_push_desc(host_ehi, "irq_stat 0x%08x", irq_stat); 1938 ata_ehi_push_desc(host_ehi, "irq_stat 0x%08x", irq_stat);
1938 1939
1939 /* AHCI needs SError cleared; otherwise, it might lock up */ 1940 /* AHCI needs SError cleared; otherwise, it might lock up */
1940 ahci_scr_read(ap, SCR_ERROR, &serror); 1941 ahci_scr_read(&ap->link, SCR_ERROR, &serror);
1941 ahci_scr_write(ap, SCR_ERROR, serror); 1942 ahci_scr_write(&ap->link, SCR_ERROR, serror);
1942 host_ehi->serror |= serror; 1943 host_ehi->serror |= serror;
1943 1944
1944 /* some controllers set IRQ_IF_ERR on device errors, ignore it */ 1945 /* some controllers set IRQ_IF_ERR on device errors, ignore it */
@@ -2027,7 +2028,7 @@ static void ahci_port_intr(struct ata_port *ap)
2027 if ((hpriv->flags & AHCI_HFLAG_NO_HOTPLUG) && 2028 if ((hpriv->flags & AHCI_HFLAG_NO_HOTPLUG) &&
2028 (status & PORT_IRQ_PHYRDY)) { 2029 (status & PORT_IRQ_PHYRDY)) {
2029 status &= ~PORT_IRQ_PHYRDY; 2030 status &= ~PORT_IRQ_PHYRDY;
2030 ahci_scr_write(ap, SCR_ERROR, ((1 << 16) | (1 << 18))); 2031 ahci_scr_write(&ap->link, SCR_ERROR, ((1 << 16) | (1 << 18)));
2031 } 2032 }
2032 2033
2033 if (unlikely(status & PORT_IRQ_ERROR)) { 2034 if (unlikely(status & PORT_IRQ_ERROR)) {
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index b1d08a8f5003..e9e32ed6b1a3 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -165,8 +165,10 @@ static void piix_set_dmamode(struct ata_port *ap, struct ata_device *adev);
165static void ich_set_dmamode(struct ata_port *ap, struct ata_device *adev); 165static void ich_set_dmamode(struct ata_port *ap, struct ata_device *adev);
166static int ich_pata_cable_detect(struct ata_port *ap); 166static int ich_pata_cable_detect(struct ata_port *ap);
167static u8 piix_vmw_bmdma_status(struct ata_port *ap); 167static u8 piix_vmw_bmdma_status(struct ata_port *ap);
168static int piix_sidpr_scr_read(struct ata_port *ap, unsigned int reg, u32 *val); 168static int piix_sidpr_scr_read(struct ata_link *link,
169static int piix_sidpr_scr_write(struct ata_port *ap, unsigned int reg, u32 val); 169 unsigned int reg, u32 *val);
170static int piix_sidpr_scr_write(struct ata_link *link,
171 unsigned int reg, u32 val);
170#ifdef CONFIG_PM 172#ifdef CONFIG_PM
171static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); 173static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
172static int piix_pci_device_resume(struct pci_dev *pdev); 174static int piix_pci_device_resume(struct pci_dev *pdev);
@@ -278,12 +280,15 @@ static const struct pci_device_id piix_pci_tbl[] = {
278 /* SATA Controller IDE (PCH) */ 280 /* SATA Controller IDE (PCH) */
279 { 0x8086, 0x3b20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, 281 { 0x8086, 0x3b20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata },
280 /* SATA Controller IDE (PCH) */ 282 /* SATA Controller IDE (PCH) */
283 { 0x8086, 0x3b21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
284 /* SATA Controller IDE (PCH) */
281 { 0x8086, 0x3b26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, 285 { 0x8086, 0x3b26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
282 /* SATA Controller IDE (PCH) */ 286 /* SATA Controller IDE (PCH) */
287 { 0x8086, 0x3b28, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata },
288 /* SATA Controller IDE (PCH) */
283 { 0x8086, 0x3b2d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, 289 { 0x8086, 0x3b2d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
284 /* SATA Controller IDE (PCH) */ 290 /* SATA Controller IDE (PCH) */
285 { 0x8086, 0x3b2e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata }, 291 { 0x8086, 0x3b2e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata },
286
287 { } /* terminate list */ 292 { } /* terminate list */
288}; 293};
289 294
@@ -582,6 +587,7 @@ static const struct ich_laptop ich_laptop[] = {
582 { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */ 587 { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */
583 { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ 588 { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */
584 { 0x27DF, 0x103C, 0x30A1 }, /* ICH7 on HP Compaq nc2400 */ 589 { 0x27DF, 0x103C, 0x30A1 }, /* ICH7 on HP Compaq nc2400 */
590 { 0x27DF, 0x1071, 0xD221 }, /* ICH7 on Hercules EC-900 */
585 { 0x24CA, 0x1025, 0x0061 }, /* ICH4 on ACER Aspire 2023WLMi */ 591 { 0x24CA, 0x1025, 0x0061 }, /* ICH4 on ACER Aspire 2023WLMi */
586 { 0x24CA, 0x1025, 0x003d }, /* ICH4 on ACER TM290 */ 592 { 0x24CA, 0x1025, 0x003d }, /* ICH4 on ACER TM290 */
587 { 0x266F, 0x1025, 0x0066 }, /* ICH6 on ACER Aspire 1694WLMi */ 593 { 0x266F, 0x1025, 0x0066 }, /* ICH6 on ACER Aspire 1694WLMi */
@@ -885,23 +891,9 @@ static void ich_set_dmamode(struct ata_port *ap, struct ata_device *adev)
885 * Serial ATA Index/Data Pair Superset Registers access 891 * Serial ATA Index/Data Pair Superset Registers access
886 * 892 *
887 * Beginning from ICH8, there's a sane way to access SCRs using index 893 * Beginning from ICH8, there's a sane way to access SCRs using index
888 * and data register pair located at BAR5. This creates an 894 * and data register pair located at BAR5 which means that we have
889 * interesting problem of mapping two SCRs to one port. 895 * separate SCRs for master and slave. This is handled using libata
890 * 896 * slave_link facility.
891 * Although they have separate SCRs, the master and slave aren't
892 * independent enough to be treated as separate links - e.g. softreset
893 * resets both. Also, there's no protocol defined for hard resetting
894 * singled device sharing the virtual port (no defined way to acquire
895 * device signature). This is worked around by merging the SCR values
896 * into one sensible value and requesting follow-up SRST after
897 * hardreset.
898 *
899 * SCR merging is perfomed in nibbles which is the unit contents in
900 * SCRs are organized. If two values are equal, the value is used.
901 * When they differ, merge table which lists precedence of possible
902 * values is consulted and the first match or the last entry when
903 * nothing matches is used. When there's no merge table for the
904 * specific nibble, value from the first port is used.
905 */ 897 */
906static const int piix_sidx_map[] = { 898static const int piix_sidx_map[] = {
907 [SCR_STATUS] = 0, 899 [SCR_STATUS] = 0,
@@ -909,120 +901,38 @@ static const int piix_sidx_map[] = {
909 [SCR_CONTROL] = 1, 901 [SCR_CONTROL] = 1,
910}; 902};
911 903
912static void piix_sidpr_sel(struct ata_device *dev, unsigned int reg) 904static void piix_sidpr_sel(struct ata_link *link, unsigned int reg)
913{ 905{
914 struct ata_port *ap = dev->link->ap; 906 struct ata_port *ap = link->ap;
915 struct piix_host_priv *hpriv = ap->host->private_data; 907 struct piix_host_priv *hpriv = ap->host->private_data;
916 908
917 iowrite32(((ap->port_no * 2 + dev->devno) << 8) | piix_sidx_map[reg], 909 iowrite32(((ap->port_no * 2 + link->pmp) << 8) | piix_sidx_map[reg],
918 hpriv->sidpr + PIIX_SIDPR_IDX); 910 hpriv->sidpr + PIIX_SIDPR_IDX);
919} 911}
920 912
921static int piix_sidpr_read(struct ata_device *dev, unsigned int reg) 913static int piix_sidpr_scr_read(struct ata_link *link,
922{ 914 unsigned int reg, u32 *val)
923 struct piix_host_priv *hpriv = dev->link->ap->host->private_data;
924
925 piix_sidpr_sel(dev, reg);
926 return ioread32(hpriv->sidpr + PIIX_SIDPR_DATA);
927}
928
929static void piix_sidpr_write(struct ata_device *dev, unsigned int reg, u32 val)
930{
931 struct piix_host_priv *hpriv = dev->link->ap->host->private_data;
932
933 piix_sidpr_sel(dev, reg);
934 iowrite32(val, hpriv->sidpr + PIIX_SIDPR_DATA);
935}
936
937static u32 piix_merge_scr(u32 val0, u32 val1, const int * const *merge_tbl)
938{
939 u32 val = 0;
940 int i, mi;
941
942 for (i = 0, mi = 0; i < 32 / 4; i++) {
943 u8 c0 = (val0 >> (i * 4)) & 0xf;
944 u8 c1 = (val1 >> (i * 4)) & 0xf;
945 u8 merged = c0;
946 const int *cur;
947
948 /* if no merge preference, assume the first value */
949 cur = merge_tbl[mi];
950 if (!cur)
951 goto done;
952 mi++;
953
954 /* if two values equal, use it */
955 if (c0 == c1)
956 goto done;
957
958 /* choose the first match or the last from the merge table */
959 while (*cur != -1) {
960 if (c0 == *cur || c1 == *cur)
961 break;
962 cur++;
963 }
964 if (*cur == -1)
965 cur--;
966 merged = *cur;
967 done:
968 val |= merged << (i * 4);
969 }
970
971 return val;
972}
973
974static int piix_sidpr_scr_read(struct ata_port *ap, unsigned int reg, u32 *val)
975{ 915{
976 const int * const sstatus_merge_tbl[] = { 916 struct piix_host_priv *hpriv = link->ap->host->private_data;
977 /* DET */ (const int []){ 1, 3, 0, 4, 3, -1 },
978 /* SPD */ (const int []){ 2, 1, 0, -1 },
979 /* IPM */ (const int []){ 6, 2, 1, 0, -1 },
980 NULL,
981 };
982 const int * const scontrol_merge_tbl[] = {
983 /* DET */ (const int []){ 1, 0, 4, 0, -1 },
984 /* SPD */ (const int []){ 0, 2, 1, 0, -1 },
985 /* IPM */ (const int []){ 0, 1, 2, 3, 0, -1 },
986 NULL,
987 };
988 u32 v0, v1;
989 917
990 if (reg >= ARRAY_SIZE(piix_sidx_map)) 918 if (reg >= ARRAY_SIZE(piix_sidx_map))
991 return -EINVAL; 919 return -EINVAL;
992 920
993 if (!(ap->flags & ATA_FLAG_SLAVE_POSS)) { 921 piix_sidpr_sel(link, reg);
994 *val = piix_sidpr_read(&ap->link.device[0], reg); 922 *val = ioread32(hpriv->sidpr + PIIX_SIDPR_DATA);
995 return 0;
996 }
997
998 v0 = piix_sidpr_read(&ap->link.device[0], reg);
999 v1 = piix_sidpr_read(&ap->link.device[1], reg);
1000
1001 switch (reg) {
1002 case SCR_STATUS:
1003 *val = piix_merge_scr(v0, v1, sstatus_merge_tbl);
1004 break;
1005 case SCR_ERROR:
1006 *val = v0 | v1;
1007 break;
1008 case SCR_CONTROL:
1009 *val = piix_merge_scr(v0, v1, scontrol_merge_tbl);
1010 break;
1011 }
1012
1013 return 0; 923 return 0;
1014} 924}
1015 925
1016static int piix_sidpr_scr_write(struct ata_port *ap, unsigned int reg, u32 val) 926static int piix_sidpr_scr_write(struct ata_link *link,
927 unsigned int reg, u32 val)
1017{ 928{
929 struct piix_host_priv *hpriv = link->ap->host->private_data;
930
1018 if (reg >= ARRAY_SIZE(piix_sidx_map)) 931 if (reg >= ARRAY_SIZE(piix_sidx_map))
1019 return -EINVAL; 932 return -EINVAL;
1020 933
1021 piix_sidpr_write(&ap->link.device[0], reg, val); 934 piix_sidpr_sel(link, reg);
1022 935 iowrite32(val, hpriv->sidpr + PIIX_SIDPR_DATA);
1023 if (ap->flags & ATA_FLAG_SLAVE_POSS)
1024 piix_sidpr_write(&ap->link.device[1], reg, val);
1025
1026 return 0; 936 return 0;
1027} 937}
1028 938
@@ -1363,28 +1273,28 @@ static const int *__devinit piix_init_sata_map(struct pci_dev *pdev,
1363 return map; 1273 return map;
1364} 1274}
1365 1275
1366static void __devinit piix_init_sidpr(struct ata_host *host) 1276static int __devinit piix_init_sidpr(struct ata_host *host)
1367{ 1277{
1368 struct pci_dev *pdev = to_pci_dev(host->dev); 1278 struct pci_dev *pdev = to_pci_dev(host->dev);
1369 struct piix_host_priv *hpriv = host->private_data; 1279 struct piix_host_priv *hpriv = host->private_data;
1370 struct ata_device *dev0 = &host->ports[0]->link.device[0]; 1280 struct ata_link *link0 = &host->ports[0]->link;
1371 u32 scontrol; 1281 u32 scontrol;
1372 int i; 1282 int i, rc;
1373 1283
1374 /* check for availability */ 1284 /* check for availability */
1375 for (i = 0; i < 4; i++) 1285 for (i = 0; i < 4; i++)
1376 if (hpriv->map[i] == IDE) 1286 if (hpriv->map[i] == IDE)
1377 return; 1287 return 0;
1378 1288
1379 if (!(host->ports[0]->flags & PIIX_FLAG_SIDPR)) 1289 if (!(host->ports[0]->flags & PIIX_FLAG_SIDPR))
1380 return; 1290 return 0;
1381 1291
1382 if (pci_resource_start(pdev, PIIX_SIDPR_BAR) == 0 || 1292 if (pci_resource_start(pdev, PIIX_SIDPR_BAR) == 0 ||
1383 pci_resource_len(pdev, PIIX_SIDPR_BAR) != PIIX_SIDPR_LEN) 1293 pci_resource_len(pdev, PIIX_SIDPR_BAR) != PIIX_SIDPR_LEN)
1384 return; 1294 return 0;
1385 1295
1386 if (pcim_iomap_regions(pdev, 1 << PIIX_SIDPR_BAR, DRV_NAME)) 1296 if (pcim_iomap_regions(pdev, 1 << PIIX_SIDPR_BAR, DRV_NAME))
1387 return; 1297 return 0;
1388 1298
1389 hpriv->sidpr = pcim_iomap_table(pdev)[PIIX_SIDPR_BAR]; 1299 hpriv->sidpr = pcim_iomap_table(pdev)[PIIX_SIDPR_BAR];
1390 1300
@@ -1392,7 +1302,7 @@ static void __devinit piix_init_sidpr(struct ata_host *host)
1392 * Give it a test drive by inhibiting power save modes which 1302 * Give it a test drive by inhibiting power save modes which
1393 * we'll do anyway. 1303 * we'll do anyway.
1394 */ 1304 */
1395 scontrol = piix_sidpr_read(dev0, SCR_CONTROL); 1305 piix_sidpr_scr_read(link0, SCR_CONTROL, &scontrol);
1396 1306
1397 /* if IPM is already 3, SCR access is probably working. Don't 1307 /* if IPM is already 3, SCR access is probably working. Don't
1398 * un-inhibit power save modes as BIOS might have inhibited 1308 * un-inhibit power save modes as BIOS might have inhibited
@@ -1400,18 +1310,30 @@ static void __devinit piix_init_sidpr(struct ata_host *host)
1400 */ 1310 */
1401 if ((scontrol & 0xf00) != 0x300) { 1311 if ((scontrol & 0xf00) != 0x300) {
1402 scontrol |= 0x300; 1312 scontrol |= 0x300;
1403 piix_sidpr_write(dev0, SCR_CONTROL, scontrol); 1313 piix_sidpr_scr_write(link0, SCR_CONTROL, scontrol);
1404 scontrol = piix_sidpr_read(dev0, SCR_CONTROL); 1314 piix_sidpr_scr_read(link0, SCR_CONTROL, &scontrol);
1405 1315
1406 if ((scontrol & 0xf00) != 0x300) { 1316 if ((scontrol & 0xf00) != 0x300) {
1407 dev_printk(KERN_INFO, host->dev, "SCR access via " 1317 dev_printk(KERN_INFO, host->dev, "SCR access via "
1408 "SIDPR is available but doesn't work\n"); 1318 "SIDPR is available but doesn't work\n");
1409 return; 1319 return 0;
1410 } 1320 }
1411 } 1321 }
1412 1322
1413 host->ports[0]->ops = &piix_sidpr_sata_ops; 1323 /* okay, SCRs available, set ops and ask libata for slave_link */
1414 host->ports[1]->ops = &piix_sidpr_sata_ops; 1324 for (i = 0; i < 2; i++) {
1325 struct ata_port *ap = host->ports[i];
1326
1327 ap->ops = &piix_sidpr_sata_ops;
1328
1329 if (ap->flags & ATA_FLAG_SLAVE_POSS) {
1330 rc = ata_slave_link_init(ap);
1331 if (rc)
1332 return rc;
1333 }
1334 }
1335
1336 return 0;
1415} 1337}
1416 1338
1417static void piix_iocfg_bit18_quirk(struct pci_dev *pdev) 1339static void piix_iocfg_bit18_quirk(struct pci_dev *pdev)
@@ -1499,7 +1421,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev,
1499 * off. 1421 * off.
1500 */ 1422 */
1501 if (pdev->vendor == PCI_VENDOR_ID_INTEL && pdev->device == 0x2652) { 1423 if (pdev->vendor == PCI_VENDOR_ID_INTEL && pdev->device == 0x2652) {
1502 int rc = piix_disable_ahci(pdev); 1424 rc = piix_disable_ahci(pdev);
1503 if (rc) 1425 if (rc)
1504 return rc; 1426 return rc;
1505 } 1427 }
@@ -1521,7 +1443,9 @@ static int __devinit piix_init_one(struct pci_dev *pdev,
1521 /* initialize controller */ 1443 /* initialize controller */
1522 if (port_flags & ATA_FLAG_SATA) { 1444 if (port_flags & ATA_FLAG_SATA) {
1523 piix_init_pcs(host, piix_map_db_table[ent->driver_data]); 1445 piix_init_pcs(host, piix_map_db_table[ent->driver_data]);
1524 piix_init_sidpr(host); 1446 rc = piix_init_sidpr(host);
1447 if (rc)
1448 return rc;
1525 } 1449 }
1526 1450
1527 /* apply IOCFG bit18 quirk */ 1451 /* apply IOCFG bit18 quirk */
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 79e3a8e7a84a..1ee9499bd343 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -163,6 +163,67 @@ MODULE_LICENSE("GPL");
163MODULE_VERSION(DRV_VERSION); 163MODULE_VERSION(DRV_VERSION);
164 164
165 165
166/*
167 * Iterator helpers. Don't use directly.
168 *
169 * LOCKING:
170 * Host lock or EH context.
171 */
172struct ata_link *__ata_port_next_link(struct ata_port *ap,
173 struct ata_link *link, bool dev_only)
174{
175 /* NULL link indicates start of iteration */
176 if (!link) {
177 if (dev_only && sata_pmp_attached(ap))
178 return ap->pmp_link;
179 return &ap->link;
180 }
181
182 /* we just iterated over the host master link, what's next? */
183 if (link == &ap->link) {
184 if (!sata_pmp_attached(ap)) {
185 if (unlikely(ap->slave_link) && !dev_only)
186 return ap->slave_link;
187 return NULL;
188 }
189 return ap->pmp_link;
190 }
191
192 /* slave_link excludes PMP */
193 if (unlikely(link == ap->slave_link))
194 return NULL;
195
196 /* iterate to the next PMP link */
197 if (++link < ap->pmp_link + ap->nr_pmp_links)
198 return link;
199 return NULL;
200}
201
202/**
203 * ata_dev_phys_link - find physical link for a device
204 * @dev: ATA device to look up physical link for
205 *
206 * Look up physical link which @dev is attached to. Note that
207 * this is different from @dev->link only when @dev is on slave
208 * link. For all other cases, it's the same as @dev->link.
209 *
210 * LOCKING:
211 * Don't care.
212 *
213 * RETURNS:
214 * Pointer to the found physical link.
215 */
216struct ata_link *ata_dev_phys_link(struct ata_device *dev)
217{
218 struct ata_port *ap = dev->link->ap;
219
220 if (!ap->slave_link)
221 return dev->link;
222 if (!dev->devno)
223 return &ap->link;
224 return ap->slave_link;
225}
226
166/** 227/**
167 * ata_force_cbl - force cable type according to libata.force 228 * ata_force_cbl - force cable type according to libata.force
168 * @ap: ATA port of interest 229 * @ap: ATA port of interest
@@ -206,7 +267,8 @@ void ata_force_cbl(struct ata_port *ap)
206 * the host link and all fan-out ports connected via PMP. If the 267 * the host link and all fan-out ports connected via PMP. If the
207 * device part is specified as 0 (e.g. 1.00:), it specifies the 268 * device part is specified as 0 (e.g. 1.00:), it specifies the
208 * first fan-out link not the host link. Device number 15 always 269 * first fan-out link not the host link. Device number 15 always
209 * points to the host link whether PMP is attached or not. 270 * points to the host link whether PMP is attached or not. If the
271 * controller has slave link, device number 16 points to it.
210 * 272 *
211 * LOCKING: 273 * LOCKING:
212 * EH context. 274 * EH context.
@@ -214,12 +276,11 @@ void ata_force_cbl(struct ata_port *ap)
214static void ata_force_link_limits(struct ata_link *link) 276static void ata_force_link_limits(struct ata_link *link)
215{ 277{
216 bool did_spd = false; 278 bool did_spd = false;
217 int linkno, i; 279 int linkno = link->pmp;
280 int i;
218 281
219 if (ata_is_host_link(link)) 282 if (ata_is_host_link(link))
220 linkno = 15; 283 linkno += 15;
221 else
222 linkno = link->pmp;
223 284
224 for (i = ata_force_tbl_size - 1; i >= 0; i--) { 285 for (i = ata_force_tbl_size - 1; i >= 0; i--) {
225 const struct ata_force_ent *fe = &ata_force_tbl[i]; 286 const struct ata_force_ent *fe = &ata_force_tbl[i];
@@ -266,9 +327,9 @@ static void ata_force_xfermask(struct ata_device *dev)
266 int alt_devno = devno; 327 int alt_devno = devno;
267 int i; 328 int i;
268 329
269 /* allow n.15 for the first device attached to host port */ 330 /* allow n.15/16 for devices attached to host port */
270 if (ata_is_host_link(dev->link) && devno == 0) 331 if (ata_is_host_link(dev->link))
271 alt_devno = 15; 332 alt_devno += 15;
272 333
273 for (i = ata_force_tbl_size - 1; i >= 0; i--) { 334 for (i = ata_force_tbl_size - 1; i >= 0; i--) {
274 const struct ata_force_ent *fe = &ata_force_tbl[i]; 335 const struct ata_force_ent *fe = &ata_force_tbl[i];
@@ -320,9 +381,9 @@ static void ata_force_horkage(struct ata_device *dev)
320 int alt_devno = devno; 381 int alt_devno = devno;
321 int i; 382 int i;
322 383
323 /* allow n.15 for the first device attached to host port */ 384 /* allow n.15/16 for devices attached to host port */
324 if (ata_is_host_link(dev->link) && devno == 0) 385 if (ata_is_host_link(dev->link))
325 alt_devno = 15; 386 alt_devno += 15;
326 387
327 for (i = 0; i < ata_force_tbl_size; i++) { 388 for (i = 0; i < ata_force_tbl_size; i++) {
328 const struct ata_force_ent *fe = &ata_force_tbl[i]; 389 const struct ata_force_ent *fe = &ata_force_tbl[i];
@@ -2681,7 +2742,7 @@ static void sata_print_link_status(struct ata_link *link)
2681 return; 2742 return;
2682 sata_scr_read(link, SCR_CONTROL, &scontrol); 2743 sata_scr_read(link, SCR_CONTROL, &scontrol);
2683 2744
2684 if (ata_link_online(link)) { 2745 if (ata_phys_link_online(link)) {
2685 tmp = (sstatus >> 4) & 0xf; 2746 tmp = (sstatus >> 4) & 0xf;
2686 ata_link_printk(link, KERN_INFO, 2747 ata_link_printk(link, KERN_INFO,
2687 "SATA link up %s (SStatus %X SControl %X)\n", 2748 "SATA link up %s (SStatus %X SControl %X)\n",
@@ -3372,6 +3433,12 @@ int ata_wait_ready(struct ata_link *link, unsigned long deadline,
3372 unsigned long nodev_deadline = ata_deadline(start, ATA_TMOUT_FF_WAIT); 3433 unsigned long nodev_deadline = ata_deadline(start, ATA_TMOUT_FF_WAIT);
3373 int warned = 0; 3434 int warned = 0;
3374 3435
3436 /* Slave readiness can't be tested separately from master. On
3437 * M/S emulation configuration, this function should be called
3438 * only on the master and it will handle both master and slave.
3439 */
3440 WARN_ON(link == link->ap->slave_link);
3441
3375 if (time_after(nodev_deadline, deadline)) 3442 if (time_after(nodev_deadline, deadline))
3376 nodev_deadline = deadline; 3443 nodev_deadline = deadline;
3377 3444
@@ -3593,7 +3660,7 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline)
3593 } 3660 }
3594 3661
3595 /* no point in trying softreset on offline link */ 3662 /* no point in trying softreset on offline link */
3596 if (ata_link_offline(link)) 3663 if (ata_phys_link_offline(link))
3597 ehc->i.action &= ~ATA_EH_SOFTRESET; 3664 ehc->i.action &= ~ATA_EH_SOFTRESET;
3598 3665
3599 return 0; 3666 return 0;
@@ -3671,7 +3738,7 @@ int sata_link_hardreset(struct ata_link *link, const unsigned long *timing,
3671 if (rc) 3738 if (rc)
3672 goto out; 3739 goto out;
3673 /* if link is offline nothing more to do */ 3740 /* if link is offline nothing more to do */
3674 if (ata_link_offline(link)) 3741 if (ata_phys_link_offline(link))
3675 goto out; 3742 goto out;
3676 3743
3677 /* Link is online. From this point, -ENODEV too is an error. */ 3744 /* Link is online. From this point, -ENODEV too is an error. */
@@ -4868,10 +4935,8 @@ int sata_scr_valid(struct ata_link *link)
4868int sata_scr_read(struct ata_link *link, int reg, u32 *val) 4935int sata_scr_read(struct ata_link *link, int reg, u32 *val)
4869{ 4936{
4870 if (ata_is_host_link(link)) { 4937 if (ata_is_host_link(link)) {
4871 struct ata_port *ap = link->ap;
4872
4873 if (sata_scr_valid(link)) 4938 if (sata_scr_valid(link))
4874 return ap->ops->scr_read(ap, reg, val); 4939 return link->ap->ops->scr_read(link, reg, val);
4875 return -EOPNOTSUPP; 4940 return -EOPNOTSUPP;
4876 } 4941 }
4877 4942
@@ -4897,10 +4962,8 @@ int sata_scr_read(struct ata_link *link, int reg, u32 *val)
4897int sata_scr_write(struct ata_link *link, int reg, u32 val) 4962int sata_scr_write(struct ata_link *link, int reg, u32 val)
4898{ 4963{
4899 if (ata_is_host_link(link)) { 4964 if (ata_is_host_link(link)) {
4900 struct ata_port *ap = link->ap;
4901
4902 if (sata_scr_valid(link)) 4965 if (sata_scr_valid(link))
4903 return ap->ops->scr_write(ap, reg, val); 4966 return link->ap->ops->scr_write(link, reg, val);
4904 return -EOPNOTSUPP; 4967 return -EOPNOTSUPP;
4905 } 4968 }
4906 4969
@@ -4925,13 +4988,12 @@ int sata_scr_write(struct ata_link *link, int reg, u32 val)
4925int sata_scr_write_flush(struct ata_link *link, int reg, u32 val) 4988int sata_scr_write_flush(struct ata_link *link, int reg, u32 val)
4926{ 4989{
4927 if (ata_is_host_link(link)) { 4990 if (ata_is_host_link(link)) {
4928 struct ata_port *ap = link->ap;
4929 int rc; 4991 int rc;
4930 4992
4931 if (sata_scr_valid(link)) { 4993 if (sata_scr_valid(link)) {
4932 rc = ap->ops->scr_write(ap, reg, val); 4994 rc = link->ap->ops->scr_write(link, reg, val);
4933 if (rc == 0) 4995 if (rc == 0)
4934 rc = ap->ops->scr_read(ap, reg, &val); 4996 rc = link->ap->ops->scr_read(link, reg, &val);
4935 return rc; 4997 return rc;
4936 } 4998 }
4937 return -EOPNOTSUPP; 4999 return -EOPNOTSUPP;
@@ -4941,7 +5003,7 @@ int sata_scr_write_flush(struct ata_link *link, int reg, u32 val)
4941} 5003}
4942 5004
4943/** 5005/**
4944 * ata_link_online - test whether the given link is online 5006 * ata_phys_link_online - test whether the given link is online
4945 * @link: ATA link to test 5007 * @link: ATA link to test
4946 * 5008 *
4947 * Test whether @link is online. Note that this function returns 5009 * Test whether @link is online. Note that this function returns
@@ -4952,20 +5014,20 @@ int sata_scr_write_flush(struct ata_link *link, int reg, u32 val)
4952 * None. 5014 * None.
4953 * 5015 *
4954 * RETURNS: 5016 * RETURNS:
4955 * 1 if the port online status is available and online. 5017 * True if the port online status is available and online.
4956 */ 5018 */
4957int ata_link_online(struct ata_link *link) 5019bool ata_phys_link_online(struct ata_link *link)
4958{ 5020{
4959 u32 sstatus; 5021 u32 sstatus;
4960 5022
4961 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 && 5023 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 &&
4962 (sstatus & 0xf) == 0x3) 5024 (sstatus & 0xf) == 0x3)
4963 return 1; 5025 return true;
4964 return 0; 5026 return false;
4965} 5027}
4966 5028
4967/** 5029/**
4968 * ata_link_offline - test whether the given link is offline 5030 * ata_phys_link_offline - test whether the given link is offline
4969 * @link: ATA link to test 5031 * @link: ATA link to test
4970 * 5032 *
4971 * Test whether @link is offline. Note that this function 5033 * Test whether @link is offline. Note that this function
@@ -4976,16 +5038,68 @@ int ata_link_online(struct ata_link *link)
4976 * None. 5038 * None.
4977 * 5039 *
4978 * RETURNS: 5040 * RETURNS:
4979 * 1 if the port offline status is available and offline. 5041 * True if the port offline status is available and offline.
4980 */ 5042 */
4981int ata_link_offline(struct ata_link *link) 5043bool ata_phys_link_offline(struct ata_link *link)
4982{ 5044{
4983 u32 sstatus; 5045 u32 sstatus;
4984 5046
4985 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 && 5047 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 &&
4986 (sstatus & 0xf) != 0x3) 5048 (sstatus & 0xf) != 0x3)
4987 return 1; 5049 return true;
4988 return 0; 5050 return false;
5051}
5052
5053/**
5054 * ata_link_online - test whether the given link is online
5055 * @link: ATA link to test
5056 *
5057 * Test whether @link is online. This is identical to
5058 * ata_phys_link_online() when there's no slave link. When
5059 * there's a slave link, this function should only be called on
5060 * the master link and will return true if any of M/S links is
5061 * online.
5062 *
5063 * LOCKING:
5064 * None.
5065 *
5066 * RETURNS:
5067 * True if the port online status is available and online.
5068 */
5069bool ata_link_online(struct ata_link *link)
5070{
5071 struct ata_link *slave = link->ap->slave_link;
5072
5073 WARN_ON(link == slave); /* shouldn't be called on slave link */
5074
5075 return ata_phys_link_online(link) ||
5076 (slave && ata_phys_link_online(slave));
5077}
5078
5079/**
5080 * ata_link_offline - test whether the given link is offline
5081 * @link: ATA link to test
5082 *
5083 * Test whether @link is offline. This is identical to
5084 * ata_phys_link_offline() when there's no slave link. When
5085 * there's a slave link, this function should only be called on
5086 * the master link and will return true if both M/S links are
5087 * offline.
5088 *
5089 * LOCKING:
5090 * None.
5091 *
5092 * RETURNS:
5093 * True if the port offline status is available and offline.
5094 */
5095bool ata_link_offline(struct ata_link *link)
5096{
5097 struct ata_link *slave = link->ap->slave_link;
5098
5099 WARN_ON(link == slave); /* shouldn't be called on slave link */
5100
5101 return ata_phys_link_offline(link) &&
5102 (!slave || ata_phys_link_offline(slave));
4989} 5103}
4990 5104
4991#ifdef CONFIG_PM 5105#ifdef CONFIG_PM
@@ -5127,11 +5241,11 @@ int ata_port_start(struct ata_port *ap)
5127 */ 5241 */
5128void ata_dev_init(struct ata_device *dev) 5242void ata_dev_init(struct ata_device *dev)
5129{ 5243{
5130 struct ata_link *link = dev->link; 5244 struct ata_link *link = ata_dev_phys_link(dev);
5131 struct ata_port *ap = link->ap; 5245 struct ata_port *ap = link->ap;
5132 unsigned long flags; 5246 unsigned long flags;
5133 5247
5134 /* SATA spd limit is bound to the first device */ 5248 /* SATA spd limit is bound to the attached device, reset together */
5135 link->sata_spd_limit = link->hw_sata_spd_limit; 5249 link->sata_spd_limit = link->hw_sata_spd_limit;
5136 link->sata_spd = 0; 5250 link->sata_spd = 0;
5137 5251
@@ -5264,6 +5378,7 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
5264 INIT_WORK(&ap->scsi_rescan_task, ata_scsi_dev_rescan); 5378 INIT_WORK(&ap->scsi_rescan_task, ata_scsi_dev_rescan);
5265 INIT_LIST_HEAD(&ap->eh_done_q); 5379 INIT_LIST_HEAD(&ap->eh_done_q);
5266 init_waitqueue_head(&ap->eh_wait_q); 5380 init_waitqueue_head(&ap->eh_wait_q);
5381 init_completion(&ap->park_req_pending);
5267 init_timer_deferrable(&ap->fastdrain_timer); 5382 init_timer_deferrable(&ap->fastdrain_timer);
5268 ap->fastdrain_timer.function = ata_eh_fastdrain_timerfn; 5383 ap->fastdrain_timer.function = ata_eh_fastdrain_timerfn;
5269 ap->fastdrain_timer.data = (unsigned long)ap; 5384 ap->fastdrain_timer.data = (unsigned long)ap;
@@ -5294,6 +5409,7 @@ static void ata_host_release(struct device *gendev, void *res)
5294 scsi_host_put(ap->scsi_host); 5409 scsi_host_put(ap->scsi_host);
5295 5410
5296 kfree(ap->pmp_link); 5411 kfree(ap->pmp_link);
5412 kfree(ap->slave_link);
5297 kfree(ap); 5413 kfree(ap);
5298 host->ports[i] = NULL; 5414 host->ports[i] = NULL;
5299 } 5415 }
@@ -5414,6 +5530,68 @@ struct ata_host *ata_host_alloc_pinfo(struct device *dev,
5414 return host; 5530 return host;
5415} 5531}
5416 5532
5533/**
5534 * ata_slave_link_init - initialize slave link
5535 * @ap: port to initialize slave link for
5536 *
5537 * Create and initialize slave link for @ap. This enables slave
5538 * link handling on the port.
5539 *
5540 * In libata, a port contains links and a link contains devices.
5541 * There is single host link but if a PMP is attached to it,
5542 * there can be multiple fan-out links. On SATA, there's usually
5543 * a single device connected to a link but PATA and SATA
5544 * controllers emulating TF based interface can have two - master
5545 * and slave.
5546 *
5547 * However, there are a few controllers which don't fit into this
5548 * abstraction too well - SATA controllers which emulate TF
5549 * interface with both master and slave devices but also have
5550 * separate SCR register sets for each device. These controllers
5551 * need separate links for physical link handling
5552 * (e.g. onlineness, link speed) but should be treated like a
5553 * traditional M/S controller for everything else (e.g. command
5554 * issue, softreset).
5555 *
5556 * slave_link is libata's way of handling this class of
5557 * controllers without impacting core layer too much. For
5558 * anything other than physical link handling, the default host
5559 * link is used for both master and slave. For physical link
5560 * handling, separate @ap->slave_link is used. All dirty details
5561 * are implemented inside libata core layer. From LLD's POV, the
5562 * only difference is that prereset, hardreset and postreset are
5563 * called once more for the slave link, so the reset sequence
5564 * looks like the following.
5565 *
5566 * prereset(M) -> prereset(S) -> hardreset(M) -> hardreset(S) ->
5567 * softreset(M) -> postreset(M) -> postreset(S)
5568 *
5569 * Note that softreset is called only for the master. Softreset
5570 * resets both M/S by definition, so SRST on master should handle
5571 * both (the standard method will work just fine).
5572 *
5573 * LOCKING:
5574 * Should be called before host is registered.
5575 *
5576 * RETURNS:
5577 * 0 on success, -errno on failure.
5578 */
5579int ata_slave_link_init(struct ata_port *ap)
5580{
5581 struct ata_link *link;
5582
5583 WARN_ON(ap->slave_link);
5584 WARN_ON(ap->flags & ATA_FLAG_PMP);
5585
5586 link = kzalloc(sizeof(*link), GFP_KERNEL);
5587 if (!link)
5588 return -ENOMEM;
5589
5590 ata_link_init(ap, link, 1);
5591 ap->slave_link = link;
5592 return 0;
5593}
5594
5417static void ata_host_stop(struct device *gendev, void *res) 5595static void ata_host_stop(struct device *gendev, void *res)
5418{ 5596{
5419 struct ata_host *host = dev_get_drvdata(gendev); 5597 struct ata_host *host = dev_get_drvdata(gendev);
@@ -5640,6 +5818,8 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
5640 5818
5641 /* init sata_spd_limit to the current value */ 5819 /* init sata_spd_limit to the current value */
5642 sata_link_init_spd(&ap->link); 5820 sata_link_init_spd(&ap->link);
5821 if (ap->slave_link)
5822 sata_link_init_spd(ap->slave_link);
5643 5823
5644 /* print per-port info to dmesg */ 5824 /* print per-port info to dmesg */
5645 xfer_mask = ata_pack_xfermask(ap->pio_mask, ap->mwdma_mask, 5825 xfer_mask = ata_pack_xfermask(ap->pio_mask, ap->mwdma_mask,
@@ -6260,10 +6440,12 @@ EXPORT_SYMBOL_GPL(ata_base_port_ops);
6260EXPORT_SYMBOL_GPL(sata_port_ops); 6440EXPORT_SYMBOL_GPL(sata_port_ops);
6261EXPORT_SYMBOL_GPL(ata_dummy_port_ops); 6441EXPORT_SYMBOL_GPL(ata_dummy_port_ops);
6262EXPORT_SYMBOL_GPL(ata_dummy_port_info); 6442EXPORT_SYMBOL_GPL(ata_dummy_port_info);
6443EXPORT_SYMBOL_GPL(__ata_port_next_link);
6263EXPORT_SYMBOL_GPL(ata_std_bios_param); 6444EXPORT_SYMBOL_GPL(ata_std_bios_param);
6264EXPORT_SYMBOL_GPL(ata_host_init); 6445EXPORT_SYMBOL_GPL(ata_host_init);
6265EXPORT_SYMBOL_GPL(ata_host_alloc); 6446EXPORT_SYMBOL_GPL(ata_host_alloc);
6266EXPORT_SYMBOL_GPL(ata_host_alloc_pinfo); 6447EXPORT_SYMBOL_GPL(ata_host_alloc_pinfo);
6448EXPORT_SYMBOL_GPL(ata_slave_link_init);
6267EXPORT_SYMBOL_GPL(ata_host_start); 6449EXPORT_SYMBOL_GPL(ata_host_start);
6268EXPORT_SYMBOL_GPL(ata_host_register); 6450EXPORT_SYMBOL_GPL(ata_host_register);
6269EXPORT_SYMBOL_GPL(ata_host_activate); 6451EXPORT_SYMBOL_GPL(ata_host_activate);
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index c1db2f234d2e..f2dd99122bd6 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -79,6 +79,8 @@ enum {
79 */ 79 */
80 ATA_EH_PRERESET_TIMEOUT = 10000, 80 ATA_EH_PRERESET_TIMEOUT = 10000,
81 ATA_EH_FASTDRAIN_INTERVAL = 3000, 81 ATA_EH_FASTDRAIN_INTERVAL = 3000,
82
83 ATA_EH_UA_TRIES = 5,
82}; 84};
83 85
84/* The following table determines how we sequence resets. Each entry 86/* The following table determines how we sequence resets. Each entry
@@ -1357,6 +1359,37 @@ static int ata_eh_read_log_10h(struct ata_device *dev,
1357} 1359}
1358 1360
1359/** 1361/**
1362 * atapi_eh_tur - perform ATAPI TEST_UNIT_READY
1363 * @dev: target ATAPI device
1364 * @r_sense_key: out parameter for sense_key
1365 *
1366 * Perform ATAPI TEST_UNIT_READY.
1367 *
1368 * LOCKING:
1369 * EH context (may sleep).
1370 *
1371 * RETURNS:
1372 * 0 on success, AC_ERR_* mask on failure.
1373 */
1374static unsigned int atapi_eh_tur(struct ata_device *dev, u8 *r_sense_key)
1375{
1376 u8 cdb[ATAPI_CDB_LEN] = { TEST_UNIT_READY, 0, 0, 0, 0, 0 };
1377 struct ata_taskfile tf;
1378 unsigned int err_mask;
1379
1380 ata_tf_init(dev, &tf);
1381
1382 tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
1383 tf.command = ATA_CMD_PACKET;
1384 tf.protocol = ATAPI_PROT_NODATA;
1385
1386 err_mask = ata_exec_internal(dev, &tf, cdb, DMA_NONE, NULL, 0, 0);
1387 if (err_mask == AC_ERR_DEV)
1388 *r_sense_key = tf.feature >> 4;
1389 return err_mask;
1390}
1391
1392/**
1360 * atapi_eh_request_sense - perform ATAPI REQUEST_SENSE 1393 * atapi_eh_request_sense - perform ATAPI REQUEST_SENSE
1361 * @dev: device to perform REQUEST_SENSE to 1394 * @dev: device to perform REQUEST_SENSE to
1362 * @sense_buf: result sense data buffer (SCSI_SENSE_BUFFERSIZE bytes long) 1395 * @sense_buf: result sense data buffer (SCSI_SENSE_BUFFERSIZE bytes long)
@@ -1756,7 +1789,7 @@ static unsigned int ata_eh_speed_down_verdict(struct ata_device *dev)
1756static unsigned int ata_eh_speed_down(struct ata_device *dev, 1789static unsigned int ata_eh_speed_down(struct ata_device *dev,
1757 unsigned int eflags, unsigned int err_mask) 1790 unsigned int eflags, unsigned int err_mask)
1758{ 1791{
1759 struct ata_link *link = dev->link; 1792 struct ata_link *link = ata_dev_phys_link(dev);
1760 int xfer_ok = 0; 1793 int xfer_ok = 0;
1761 unsigned int verdict; 1794 unsigned int verdict;
1762 unsigned int action = 0; 1795 unsigned int action = 0;
@@ -1880,7 +1913,8 @@ static void ata_eh_link_autopsy(struct ata_link *link)
1880 for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { 1913 for (tag = 0; tag < ATA_MAX_QUEUE; tag++) {
1881 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); 1914 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag);
1882 1915
1883 if (!(qc->flags & ATA_QCFLAG_FAILED) || qc->dev->link != link) 1916 if (!(qc->flags & ATA_QCFLAG_FAILED) ||
1917 ata_dev_phys_link(qc->dev) != link)
1884 continue; 1918 continue;
1885 1919
1886 /* inherit upper level err_mask */ 1920 /* inherit upper level err_mask */
@@ -1967,6 +2001,23 @@ void ata_eh_autopsy(struct ata_port *ap)
1967 ata_port_for_each_link(link, ap) 2001 ata_port_for_each_link(link, ap)
1968 ata_eh_link_autopsy(link); 2002 ata_eh_link_autopsy(link);
1969 2003
2004 /* Handle the frigging slave link. Autopsy is done similarly
2005 * but actions and flags are transferred over to the master
2006 * link and handled from there.
2007 */
2008 if (ap->slave_link) {
2009 struct ata_eh_context *mehc = &ap->link.eh_context;
2010 struct ata_eh_context *sehc = &ap->slave_link->eh_context;
2011
2012 ata_eh_link_autopsy(ap->slave_link);
2013
2014 ata_eh_about_to_do(ap->slave_link, NULL, ATA_EH_ALL_ACTIONS);
2015 mehc->i.action |= sehc->i.action;
2016 mehc->i.dev_action[1] |= sehc->i.dev_action[1];
2017 mehc->i.flags |= sehc->i.flags;
2018 ata_eh_done(ap->slave_link, NULL, ATA_EH_ALL_ACTIONS);
2019 }
2020
1970 /* Autopsy of fanout ports can affect host link autopsy. 2021 /* Autopsy of fanout ports can affect host link autopsy.
1971 * Perform host link autopsy last. 2022 * Perform host link autopsy last.
1972 */ 2023 */
@@ -2001,7 +2052,8 @@ static void ata_eh_link_report(struct ata_link *link)
2001 for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { 2052 for (tag = 0; tag < ATA_MAX_QUEUE; tag++) {
2002 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); 2053 struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag);
2003 2054
2004 if (!(qc->flags & ATA_QCFLAG_FAILED) || qc->dev->link != link || 2055 if (!(qc->flags & ATA_QCFLAG_FAILED) ||
2056 ata_dev_phys_link(qc->dev) != link ||
2005 ((qc->flags & ATA_QCFLAG_QUIET) && 2057 ((qc->flags & ATA_QCFLAG_QUIET) &&
2006 qc->err_mask == AC_ERR_DEV)) 2058 qc->err_mask == AC_ERR_DEV))
2007 continue; 2059 continue;
@@ -2068,7 +2120,7 @@ static void ata_eh_link_report(struct ata_link *link)
2068 char cdb_buf[70] = ""; 2120 char cdb_buf[70] = "";
2069 2121
2070 if (!(qc->flags & ATA_QCFLAG_FAILED) || 2122 if (!(qc->flags & ATA_QCFLAG_FAILED) ||
2071 qc->dev->link != link || !qc->err_mask) 2123 ata_dev_phys_link(qc->dev) != link || !qc->err_mask)
2072 continue; 2124 continue;
2073 2125
2074 if (qc->dma_dir != DMA_NONE) { 2126 if (qc->dma_dir != DMA_NONE) {
@@ -2160,12 +2212,14 @@ void ata_eh_report(struct ata_port *ap)
2160} 2212}
2161 2213
2162static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset, 2214static int ata_do_reset(struct ata_link *link, ata_reset_fn_t reset,
2163 unsigned int *classes, unsigned long deadline) 2215 unsigned int *classes, unsigned long deadline,
2216 bool clear_classes)
2164{ 2217{
2165 struct ata_device *dev; 2218 struct ata_device *dev;
2166 2219
2167 ata_link_for_each_dev(dev, link) 2220 if (clear_classes)
2168 classes[dev->devno] = ATA_DEV_UNKNOWN; 2221 ata_link_for_each_dev(dev, link)
2222 classes[dev->devno] = ATA_DEV_UNKNOWN;
2169 2223
2170 return reset(link, classes, deadline); 2224 return reset(link, classes, deadline);
2171} 2225}
@@ -2187,17 +2241,20 @@ int ata_eh_reset(struct ata_link *link, int classify,
2187 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset) 2241 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset)
2188{ 2242{
2189 struct ata_port *ap = link->ap; 2243 struct ata_port *ap = link->ap;
2244 struct ata_link *slave = ap->slave_link;
2190 struct ata_eh_context *ehc = &link->eh_context; 2245 struct ata_eh_context *ehc = &link->eh_context;
2246 struct ata_eh_context *sehc = &slave->eh_context;
2191 unsigned int *classes = ehc->classes; 2247 unsigned int *classes = ehc->classes;
2192 unsigned int lflags = link->flags; 2248 unsigned int lflags = link->flags;
2193 int verbose = !(ehc->i.flags & ATA_EHI_QUIET); 2249 int verbose = !(ehc->i.flags & ATA_EHI_QUIET);
2194 int max_tries = 0, try = 0; 2250 int max_tries = 0, try = 0;
2251 struct ata_link *failed_link;
2195 struct ata_device *dev; 2252 struct ata_device *dev;
2196 unsigned long deadline, now; 2253 unsigned long deadline, now;
2197 ata_reset_fn_t reset; 2254 ata_reset_fn_t reset;
2198 unsigned long flags; 2255 unsigned long flags;
2199 u32 sstatus; 2256 u32 sstatus;
2200 int nr_known, rc; 2257 int nr_unknown, rc;
2201 2258
2202 /* 2259 /*
2203 * Prepare to reset 2260 * Prepare to reset
@@ -2252,8 +2309,30 @@ int ata_eh_reset(struct ata_link *link, int classify,
2252 } 2309 }
2253 2310
2254 if (prereset) { 2311 if (prereset) {
2255 rc = prereset(link, 2312 unsigned long deadline = ata_deadline(jiffies,
2256 ata_deadline(jiffies, ATA_EH_PRERESET_TIMEOUT)); 2313 ATA_EH_PRERESET_TIMEOUT);
2314
2315 if (slave) {
2316 sehc->i.action &= ~ATA_EH_RESET;
2317 sehc->i.action |= ehc->i.action;
2318 }
2319
2320 rc = prereset(link, deadline);
2321
2322 /* If present, do prereset on slave link too. Reset
2323 * is skipped iff both master and slave links report
2324 * -ENOENT or clear ATA_EH_RESET.
2325 */
2326 if (slave && (rc == 0 || rc == -ENOENT)) {
2327 int tmp;
2328
2329 tmp = prereset(slave, deadline);
2330 if (tmp != -ENOENT)
2331 rc = tmp;
2332
2333 ehc->i.action |= sehc->i.action;
2334 }
2335
2257 if (rc) { 2336 if (rc) {
2258 if (rc == -ENOENT) { 2337 if (rc == -ENOENT) {
2259 ata_link_printk(link, KERN_DEBUG, 2338 ata_link_printk(link, KERN_DEBUG,
@@ -2302,25 +2381,51 @@ int ata_eh_reset(struct ata_link *link, int classify,
2302 else 2381 else
2303 ehc->i.flags |= ATA_EHI_DID_SOFTRESET; 2382 ehc->i.flags |= ATA_EHI_DID_SOFTRESET;
2304 2383
2305 rc = ata_do_reset(link, reset, classes, deadline); 2384 rc = ata_do_reset(link, reset, classes, deadline, true);
2306 if (rc && rc != -EAGAIN) 2385 if (rc && rc != -EAGAIN) {
2386 failed_link = link;
2307 goto fail; 2387 goto fail;
2388 }
2389
2390 /* hardreset slave link if existent */
2391 if (slave && reset == hardreset) {
2392 int tmp;
2393
2394 if (verbose)
2395 ata_link_printk(slave, KERN_INFO,
2396 "hard resetting link\n");
2308 2397
2398 ata_eh_about_to_do(slave, NULL, ATA_EH_RESET);
2399 tmp = ata_do_reset(slave, reset, classes, deadline,
2400 false);
2401 switch (tmp) {
2402 case -EAGAIN:
2403 rc = -EAGAIN;
2404 case 0:
2405 break;
2406 default:
2407 failed_link = slave;
2408 rc = tmp;
2409 goto fail;
2410 }
2411 }
2412
2413 /* perform follow-up SRST if necessary */
2309 if (reset == hardreset && 2414 if (reset == hardreset &&
2310 ata_eh_followup_srst_needed(link, rc, classes)) { 2415 ata_eh_followup_srst_needed(link, rc, classes)) {
2311 /* okay, let's do follow-up softreset */
2312 reset = softreset; 2416 reset = softreset;
2313 2417
2314 if (!reset) { 2418 if (!reset) {
2315 ata_link_printk(link, KERN_ERR, 2419 ata_link_printk(link, KERN_ERR,
2316 "follow-up softreset required " 2420 "follow-up softreset required "
2317 "but no softreset avaliable\n"); 2421 "but no softreset avaliable\n");
2422 failed_link = link;
2318 rc = -EINVAL; 2423 rc = -EINVAL;
2319 goto fail; 2424 goto fail;
2320 } 2425 }
2321 2426
2322 ata_eh_about_to_do(link, NULL, ATA_EH_RESET); 2427 ata_eh_about_to_do(link, NULL, ATA_EH_RESET);
2323 rc = ata_do_reset(link, reset, classes, deadline); 2428 rc = ata_do_reset(link, reset, classes, deadline, true);
2324 } 2429 }
2325 } else { 2430 } else {
2326 if (verbose) 2431 if (verbose)
@@ -2341,7 +2446,7 @@ int ata_eh_reset(struct ata_link *link, int classify,
2341 dev->pio_mode = XFER_PIO_0; 2446 dev->pio_mode = XFER_PIO_0;
2342 dev->flags &= ~ATA_DFLAG_SLEEPING; 2447 dev->flags &= ~ATA_DFLAG_SLEEPING;
2343 2448
2344 if (ata_link_offline(link)) 2449 if (ata_phys_link_offline(ata_dev_phys_link(dev)))
2345 continue; 2450 continue;
2346 2451
2347 /* apply class override */ 2452 /* apply class override */
@@ -2354,6 +2459,8 @@ int ata_eh_reset(struct ata_link *link, int classify,
2354 /* record current link speed */ 2459 /* record current link speed */
2355 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0) 2460 if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0)
2356 link->sata_spd = (sstatus >> 4) & 0xf; 2461 link->sata_spd = (sstatus >> 4) & 0xf;
2462 if (slave && sata_scr_read(slave, SCR_STATUS, &sstatus) == 0)
2463 slave->sata_spd = (sstatus >> 4) & 0xf;
2357 2464
2358 /* thaw the port */ 2465 /* thaw the port */
2359 if (ata_is_host_link(link)) 2466 if (ata_is_host_link(link))
@@ -2366,12 +2473,17 @@ int ata_eh_reset(struct ata_link *link, int classify,
2366 * reset and here. This race is mediated by cross checking 2473 * reset and here. This race is mediated by cross checking
2367 * link onlineness and classification result later. 2474 * link onlineness and classification result later.
2368 */ 2475 */
2369 if (postreset) 2476 if (postreset) {
2370 postreset(link, classes); 2477 postreset(link, classes);
2478 if (slave)
2479 postreset(slave, classes);
2480 }
2371 2481
2372 /* clear cached SError */ 2482 /* clear cached SError */
2373 spin_lock_irqsave(link->ap->lock, flags); 2483 spin_lock_irqsave(link->ap->lock, flags);
2374 link->eh_info.serror = 0; 2484 link->eh_info.serror = 0;
2485 if (slave)
2486 slave->eh_info.serror = 0;
2375 spin_unlock_irqrestore(link->ap->lock, flags); 2487 spin_unlock_irqrestore(link->ap->lock, flags);
2376 2488
2377 /* Make sure onlineness and classification result correspond. 2489 /* Make sure onlineness and classification result correspond.
@@ -2381,19 +2493,21 @@ int ata_eh_reset(struct ata_link *link, int classify,
2381 * link onlineness and classification result, those conditions 2493 * link onlineness and classification result, those conditions
2382 * can be reliably detected and retried. 2494 * can be reliably detected and retried.
2383 */ 2495 */
2384 nr_known = 0; 2496 nr_unknown = 0;
2385 ata_link_for_each_dev(dev, link) { 2497 ata_link_for_each_dev(dev, link) {
2386 /* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */ 2498 /* convert all ATA_DEV_UNKNOWN to ATA_DEV_NONE */
2387 if (classes[dev->devno] == ATA_DEV_UNKNOWN) 2499 if (classes[dev->devno] == ATA_DEV_UNKNOWN) {
2388 classes[dev->devno] = ATA_DEV_NONE; 2500 classes[dev->devno] = ATA_DEV_NONE;
2389 else 2501 if (ata_phys_link_online(ata_dev_phys_link(dev)))
2390 nr_known++; 2502 nr_unknown++;
2503 }
2391 } 2504 }
2392 2505
2393 if (classify && !nr_known && ata_link_online(link)) { 2506 if (classify && nr_unknown) {
2394 if (try < max_tries) { 2507 if (try < max_tries) {
2395 ata_link_printk(link, KERN_WARNING, "link online but " 2508 ata_link_printk(link, KERN_WARNING, "link online but "
2396 "device misclassified, retrying\n"); 2509 "device misclassified, retrying\n");
2510 failed_link = link;
2397 rc = -EAGAIN; 2511 rc = -EAGAIN;
2398 goto fail; 2512 goto fail;
2399 } 2513 }
@@ -2404,6 +2518,8 @@ int ata_eh_reset(struct ata_link *link, int classify,
2404 2518
2405 /* reset successful, schedule revalidation */ 2519 /* reset successful, schedule revalidation */
2406 ata_eh_done(link, NULL, ATA_EH_RESET); 2520 ata_eh_done(link, NULL, ATA_EH_RESET);
2521 if (slave)
2522 ata_eh_done(slave, NULL, ATA_EH_RESET);
2407 ehc->last_reset = jiffies; 2523 ehc->last_reset = jiffies;
2408 ehc->i.action |= ATA_EH_REVALIDATE; 2524 ehc->i.action |= ATA_EH_REVALIDATE;
2409 2525
@@ -2411,6 +2527,8 @@ int ata_eh_reset(struct ata_link *link, int classify,
2411 out: 2527 out:
2412 /* clear hotplug flag */ 2528 /* clear hotplug flag */
2413 ehc->i.flags &= ~ATA_EHI_HOTPLUGGED; 2529 ehc->i.flags &= ~ATA_EHI_HOTPLUGGED;
2530 if (slave)
2531 sehc->i.flags &= ~ATA_EHI_HOTPLUGGED;
2414 2532
2415 spin_lock_irqsave(ap->lock, flags); 2533 spin_lock_irqsave(ap->lock, flags);
2416 ap->pflags &= ~ATA_PFLAG_RESETTING; 2534 ap->pflags &= ~ATA_PFLAG_RESETTING;
@@ -2431,7 +2549,7 @@ int ata_eh_reset(struct ata_link *link, int classify,
2431 if (time_before(now, deadline)) { 2549 if (time_before(now, deadline)) {
2432 unsigned long delta = deadline - now; 2550 unsigned long delta = deadline - now;
2433 2551
2434 ata_link_printk(link, KERN_WARNING, 2552 ata_link_printk(failed_link, KERN_WARNING,
2435 "reset failed (errno=%d), retrying in %u secs\n", 2553 "reset failed (errno=%d), retrying in %u secs\n",
2436 rc, DIV_ROUND_UP(jiffies_to_msecs(delta), 1000)); 2554 rc, DIV_ROUND_UP(jiffies_to_msecs(delta), 1000));
2437 2555
@@ -2439,13 +2557,92 @@ int ata_eh_reset(struct ata_link *link, int classify,
2439 delta = schedule_timeout_uninterruptible(delta); 2557 delta = schedule_timeout_uninterruptible(delta);
2440 } 2558 }
2441 2559
2442 if (rc == -EPIPE || try == max_tries - 1) 2560 if (try == max_tries - 1) {
2443 sata_down_spd_limit(link); 2561 sata_down_spd_limit(link);
2562 if (slave)
2563 sata_down_spd_limit(slave);
2564 } else if (rc == -EPIPE)
2565 sata_down_spd_limit(failed_link);
2566
2444 if (hardreset) 2567 if (hardreset)
2445 reset = hardreset; 2568 reset = hardreset;
2446 goto retry; 2569 goto retry;
2447} 2570}
2448 2571
2572static inline void ata_eh_pull_park_action(struct ata_port *ap)
2573{
2574 struct ata_link *link;
2575 struct ata_device *dev;
2576 unsigned long flags;
2577
2578 /*
2579 * This function can be thought of as an extended version of
2580 * ata_eh_about_to_do() specially crafted to accommodate the
2581 * requirements of ATA_EH_PARK handling. Since the EH thread
2582 * does not leave the do {} while () loop in ata_eh_recover as
2583 * long as the timeout for a park request to *one* device on
2584 * the port has not expired, and since we still want to pick
2585 * up park requests to other devices on the same port or
2586 * timeout updates for the same device, we have to pull
2587 * ATA_EH_PARK actions from eh_info into eh_context.i
2588 * ourselves at the beginning of each pass over the loop.
2589 *
2590 * Additionally, all write accesses to &ap->park_req_pending
2591 * through INIT_COMPLETION() (see below) or complete_all()
2592 * (see ata_scsi_park_store()) are protected by the host lock.
2593 * As a result we have that park_req_pending.done is zero on
2594 * exit from this function, i.e. when ATA_EH_PARK actions for
2595 * *all* devices on port ap have been pulled into the
2596 * respective eh_context structs. If, and only if,
2597 * park_req_pending.done is non-zero by the time we reach
2598 * wait_for_completion_timeout(), another ATA_EH_PARK action
2599 * has been scheduled for at least one of the devices on port
2600 * ap and we have to cycle over the do {} while () loop in
2601 * ata_eh_recover() again.
2602 */
2603
2604 spin_lock_irqsave(ap->lock, flags);
2605 INIT_COMPLETION(ap->park_req_pending);
2606 ata_port_for_each_link(link, ap) {
2607 ata_link_for_each_dev(dev, link) {
2608 struct ata_eh_info *ehi = &link->eh_info;
2609
2610 link->eh_context.i.dev_action[dev->devno] |=
2611 ehi->dev_action[dev->devno] & ATA_EH_PARK;
2612 ata_eh_clear_action(link, dev, ehi, ATA_EH_PARK);
2613 }
2614 }
2615 spin_unlock_irqrestore(ap->lock, flags);
2616}
2617
2618static void ata_eh_park_issue_cmd(struct ata_device *dev, int park)
2619{
2620 struct ata_eh_context *ehc = &dev->link->eh_context;
2621 struct ata_taskfile tf;
2622 unsigned int err_mask;
2623
2624 ata_tf_init(dev, &tf);
2625 if (park) {
2626 ehc->unloaded_mask |= 1 << dev->devno;
2627 tf.command = ATA_CMD_IDLEIMMEDIATE;
2628 tf.feature = 0x44;
2629 tf.lbal = 0x4c;
2630 tf.lbam = 0x4e;
2631 tf.lbah = 0x55;
2632 } else {
2633 ehc->unloaded_mask &= ~(1 << dev->devno);
2634 tf.command = ATA_CMD_CHK_POWER;
2635 }
2636
2637 tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
2638 tf.protocol |= ATA_PROT_NODATA;
2639 err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
2640 if (park && (err_mask || tf.lbal != 0xc4)) {
2641 ata_dev_printk(dev, KERN_ERR, "head unload failed!\n");
2642 ehc->unloaded_mask &= ~(1 << dev->devno);
2643 }
2644}
2645
2449static int ata_eh_revalidate_and_attach(struct ata_link *link, 2646static int ata_eh_revalidate_and_attach(struct ata_link *link,
2450 struct ata_device **r_failed_dev) 2647 struct ata_device **r_failed_dev)
2451{ 2648{
@@ -2472,7 +2669,7 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
2472 if ((action & ATA_EH_REVALIDATE) && ata_dev_enabled(dev)) { 2669 if ((action & ATA_EH_REVALIDATE) && ata_dev_enabled(dev)) {
2473 WARN_ON(dev->class == ATA_DEV_PMP); 2670 WARN_ON(dev->class == ATA_DEV_PMP);
2474 2671
2475 if (ata_link_offline(link)) { 2672 if (ata_phys_link_offline(ata_dev_phys_link(dev))) {
2476 rc = -EIO; 2673 rc = -EIO;
2477 goto err; 2674 goto err;
2478 } 2675 }
@@ -2610,6 +2807,53 @@ int ata_set_mode(struct ata_link *link, struct ata_device **r_failed_dev)
2610 return rc; 2807 return rc;
2611} 2808}
2612 2809
2810/**
2811 * atapi_eh_clear_ua - Clear ATAPI UNIT ATTENTION after reset
2812 * @dev: ATAPI device to clear UA for
2813 *
2814 * Resets and other operations can make an ATAPI device raise
2815 * UNIT ATTENTION which causes the next operation to fail. This
2816 * function clears UA.
2817 *
2818 * LOCKING:
2819 * EH context (may sleep).
2820 *
2821 * RETURNS:
2822 * 0 on success, -errno on failure.
2823 */
2824static int atapi_eh_clear_ua(struct ata_device *dev)
2825{
2826 int i;
2827
2828 for (i = 0; i < ATA_EH_UA_TRIES; i++) {
2829 u8 sense_buffer[SCSI_SENSE_BUFFERSIZE];
2830 u8 sense_key = 0;
2831 unsigned int err_mask;
2832
2833 err_mask = atapi_eh_tur(dev, &sense_key);
2834 if (err_mask != 0 && err_mask != AC_ERR_DEV) {
2835 ata_dev_printk(dev, KERN_WARNING, "TEST_UNIT_READY "
2836 "failed (err_mask=0x%x)\n", err_mask);
2837 return -EIO;
2838 }
2839
2840 if (!err_mask || sense_key != UNIT_ATTENTION)
2841 return 0;
2842
2843 err_mask = atapi_eh_request_sense(dev, sense_buffer, sense_key);
2844 if (err_mask) {
2845 ata_dev_printk(dev, KERN_WARNING, "failed to clear "
2846 "UNIT ATTENTION (err_mask=0x%x)\n", err_mask);
2847 return -EIO;
2848 }
2849 }
2850
2851 ata_dev_printk(dev, KERN_WARNING,
2852 "UNIT ATTENTION persists after %d tries\n", ATA_EH_UA_TRIES);
2853
2854 return 0;
2855}
2856
2613static int ata_link_nr_enabled(struct ata_link *link) 2857static int ata_link_nr_enabled(struct ata_link *link)
2614{ 2858{
2615 struct ata_device *dev; 2859 struct ata_device *dev;
@@ -2697,7 +2941,7 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err)
2697 /* This is the last chance, better to slow 2941 /* This is the last chance, better to slow
2698 * down than lose it. 2942 * down than lose it.
2699 */ 2943 */
2700 sata_down_spd_limit(dev->link); 2944 sata_down_spd_limit(ata_dev_phys_link(dev));
2701 ata_down_xfermask_limit(dev, ATA_DNXFER_PIO); 2945 ata_down_xfermask_limit(dev, ATA_DNXFER_PIO);
2702 } 2946 }
2703 } 2947 }
@@ -2707,7 +2951,7 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err)
2707 ata_dev_disable(dev); 2951 ata_dev_disable(dev);
2708 2952
2709 /* detach if offline */ 2953 /* detach if offline */
2710 if (ata_link_offline(dev->link)) 2954 if (ata_phys_link_offline(ata_dev_phys_link(dev)))
2711 ata_eh_detach_dev(dev); 2955 ata_eh_detach_dev(dev);
2712 2956
2713 /* schedule probe if necessary */ 2957 /* schedule probe if necessary */
@@ -2755,7 +2999,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
2755 struct ata_device *dev; 2999 struct ata_device *dev;
2756 int nr_failed_devs; 3000 int nr_failed_devs;
2757 int rc; 3001 int rc;
2758 unsigned long flags; 3002 unsigned long flags, deadline;
2759 3003
2760 DPRINTK("ENTER\n"); 3004 DPRINTK("ENTER\n");
2761 3005
@@ -2829,6 +3073,56 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
2829 } 3073 }
2830 } 3074 }
2831 3075
3076 do {
3077 unsigned long now;
3078
3079 /*
3080 * clears ATA_EH_PARK in eh_info and resets
3081 * ap->park_req_pending
3082 */
3083 ata_eh_pull_park_action(ap);
3084
3085 deadline = jiffies;
3086 ata_port_for_each_link(link, ap) {
3087 ata_link_for_each_dev(dev, link) {
3088 struct ata_eh_context *ehc = &link->eh_context;
3089 unsigned long tmp;
3090
3091 if (dev->class != ATA_DEV_ATA)
3092 continue;
3093 if (!(ehc->i.dev_action[dev->devno] &
3094 ATA_EH_PARK))
3095 continue;
3096 tmp = dev->unpark_deadline;
3097 if (time_before(deadline, tmp))
3098 deadline = tmp;
3099 else if (time_before_eq(tmp, jiffies))
3100 continue;
3101 if (ehc->unloaded_mask & (1 << dev->devno))
3102 continue;
3103
3104 ata_eh_park_issue_cmd(dev, 1);
3105 }
3106 }
3107
3108 now = jiffies;
3109 if (time_before_eq(deadline, now))
3110 break;
3111
3112 deadline = wait_for_completion_timeout(&ap->park_req_pending,
3113 deadline - now);
3114 } while (deadline);
3115 ata_port_for_each_link(link, ap) {
3116 ata_link_for_each_dev(dev, link) {
3117 if (!(link->eh_context.unloaded_mask &
3118 (1 << dev->devno)))
3119 continue;
3120
3121 ata_eh_park_issue_cmd(dev, 0);
3122 ata_eh_done(link, dev, ATA_EH_PARK);
3123 }
3124 }
3125
2832 /* the rest */ 3126 /* the rest */
2833 ata_port_for_each_link(link, ap) { 3127 ata_port_for_each_link(link, ap) {
2834 struct ata_eh_context *ehc = &link->eh_context; 3128 struct ata_eh_context *ehc = &link->eh_context;
@@ -2852,6 +3146,20 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
2852 ehc->i.flags &= ~ATA_EHI_SETMODE; 3146 ehc->i.flags &= ~ATA_EHI_SETMODE;
2853 } 3147 }
2854 3148
3149 /* If reset has been issued, clear UA to avoid
3150 * disrupting the current users of the device.
3151 */
3152 if (ehc->i.flags & ATA_EHI_DID_RESET) {
3153 ata_link_for_each_dev(dev, link) {
3154 if (dev->class != ATA_DEV_ATAPI)
3155 continue;
3156 rc = atapi_eh_clear_ua(dev);
3157 if (rc)
3158 goto dev_fail;
3159 }
3160 }
3161
3162 /* configure link power saving */
2855 if (ehc->i.action & ATA_EH_LPM) 3163 if (ehc->i.action & ATA_EH_LPM)
2856 ata_link_for_each_dev(dev, link) 3164 ata_link_for_each_dev(dev, link)
2857 ata_dev_enable_pm(dev, ap->pm_policy); 3165 ata_dev_enable_pm(dev, ap->pm_policy);
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index b9d3ba423cb2..fccd5e496c62 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -183,6 +183,105 @@ DEVICE_ATTR(link_power_management_policy, S_IRUGO | S_IWUSR,
183 ata_scsi_lpm_show, ata_scsi_lpm_put); 183 ata_scsi_lpm_show, ata_scsi_lpm_put);
184EXPORT_SYMBOL_GPL(dev_attr_link_power_management_policy); 184EXPORT_SYMBOL_GPL(dev_attr_link_power_management_policy);
185 185
186static ssize_t ata_scsi_park_show(struct device *device,
187 struct device_attribute *attr, char *buf)
188{
189 struct scsi_device *sdev = to_scsi_device(device);
190 struct ata_port *ap;
191 struct ata_link *link;
192 struct ata_device *dev;
193 unsigned long flags;
194 unsigned int uninitialized_var(msecs);
195 int rc = 0;
196
197 ap = ata_shost_to_port(sdev->host);
198
199 spin_lock_irqsave(ap->lock, flags);
200 dev = ata_scsi_find_dev(ap, sdev);
201 if (!dev) {
202 rc = -ENODEV;
203 goto unlock;
204 }
205 if (dev->flags & ATA_DFLAG_NO_UNLOAD) {
206 rc = -EOPNOTSUPP;
207 goto unlock;
208 }
209
210 link = dev->link;
211 if (ap->pflags & ATA_PFLAG_EH_IN_PROGRESS &&
212 link->eh_context.unloaded_mask & (1 << dev->devno) &&
213 time_after(dev->unpark_deadline, jiffies))
214 msecs = jiffies_to_msecs(dev->unpark_deadline - jiffies);
215 else
216 msecs = 0;
217
218unlock:
219 spin_unlock_irq(ap->lock);
220
221 return rc ? rc : snprintf(buf, 20, "%u\n", msecs);
222}
223
224static ssize_t ata_scsi_park_store(struct device *device,
225 struct device_attribute *attr,
226 const char *buf, size_t len)
227{
228 struct scsi_device *sdev = to_scsi_device(device);
229 struct ata_port *ap;
230 struct ata_device *dev;
231 long int input;
232 unsigned long flags;
233 int rc;
234
235 rc = strict_strtol(buf, 10, &input);
236 if (rc || input < -2)
237 return -EINVAL;
238 if (input > ATA_TMOUT_MAX_PARK) {
239 rc = -EOVERFLOW;
240 input = ATA_TMOUT_MAX_PARK;
241 }
242
243 ap = ata_shost_to_port(sdev->host);
244
245 spin_lock_irqsave(ap->lock, flags);
246 dev = ata_scsi_find_dev(ap, sdev);
247 if (unlikely(!dev)) {
248 rc = -ENODEV;
249 goto unlock;
250 }
251 if (dev->class != ATA_DEV_ATA) {
252 rc = -EOPNOTSUPP;
253 goto unlock;
254 }
255
256 if (input >= 0) {
257 if (dev->flags & ATA_DFLAG_NO_UNLOAD) {
258 rc = -EOPNOTSUPP;
259 goto unlock;
260 }
261
262 dev->unpark_deadline = ata_deadline(jiffies, input);
263 dev->link->eh_info.dev_action[dev->devno] |= ATA_EH_PARK;
264 ata_port_schedule_eh(ap);
265 complete(&ap->park_req_pending);
266 } else {
267 switch (input) {
268 case -1:
269 dev->flags &= ~ATA_DFLAG_NO_UNLOAD;
270 break;
271 case -2:
272 dev->flags |= ATA_DFLAG_NO_UNLOAD;
273 break;
274 }
275 }
276unlock:
277 spin_unlock_irqrestore(ap->lock, flags);
278
279 return rc ? rc : len;
280}
281DEVICE_ATTR(unload_heads, S_IRUGO | S_IWUSR,
282 ata_scsi_park_show, ata_scsi_park_store);
283EXPORT_SYMBOL_GPL(dev_attr_unload_heads);
284
186static void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq) 285static void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq)
187{ 286{
188 cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; 287 cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION;
@@ -269,6 +368,12 @@ DEVICE_ATTR(sw_activity, S_IWUGO | S_IRUGO, ata_scsi_activity_show,
269 ata_scsi_activity_store); 368 ata_scsi_activity_store);
270EXPORT_SYMBOL_GPL(dev_attr_sw_activity); 369EXPORT_SYMBOL_GPL(dev_attr_sw_activity);
271 370
371struct device_attribute *ata_common_sdev_attrs[] = {
372 &dev_attr_unload_heads,
373 NULL
374};
375EXPORT_SYMBOL_GPL(ata_common_sdev_attrs);
376
272static void ata_scsi_invalid_field(struct scsi_cmnd *cmd, 377static void ata_scsi_invalid_field(struct scsi_cmnd *cmd,
273 void (*done)(struct scsi_cmnd *)) 378 void (*done)(struct scsi_cmnd *))
274{ 379{
@@ -954,6 +1059,9 @@ static int atapi_drain_needed(struct request *rq)
954static int ata_scsi_dev_config(struct scsi_device *sdev, 1059static int ata_scsi_dev_config(struct scsi_device *sdev,
955 struct ata_device *dev) 1060 struct ata_device *dev)
956{ 1061{
1062 if (!ata_id_has_unload(dev->id))
1063 dev->flags |= ATA_DFLAG_NO_UNLOAD;
1064
957 /* configure max sectors */ 1065 /* configure max sectors */
958 blk_queue_max_sectors(sdev->request_queue, dev->max_sectors); 1066 blk_queue_max_sectors(sdev->request_queue, dev->max_sectors);
959 1067
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index ade5c75b6144..e96de96e3020 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -70,6 +70,7 @@ extern int atapi_passthru16;
70extern int libata_fua; 70extern int libata_fua;
71extern int libata_noacpi; 71extern int libata_noacpi;
72extern int libata_allow_tpm; 72extern int libata_allow_tpm;
73extern struct ata_link *ata_dev_phys_link(struct ata_device *dev);
73extern void ata_force_cbl(struct ata_port *ap); 74extern void ata_force_cbl(struct ata_port *ap);
74extern u64 ata_tf_to_lba(const struct ata_taskfile *tf); 75extern u64 ata_tf_to_lba(const struct ata_taskfile *tf);
75extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf); 76extern u64 ata_tf_to_lba48(const struct ata_taskfile *tf);
@@ -107,6 +108,8 @@ extern void ata_qc_issue(struct ata_queued_cmd *qc);
107extern void __ata_qc_complete(struct ata_queued_cmd *qc); 108extern void __ata_qc_complete(struct ata_queued_cmd *qc);
108extern int atapi_check_dma(struct ata_queued_cmd *qc); 109extern int atapi_check_dma(struct ata_queued_cmd *qc);
109extern void swap_buf_le16(u16 *buf, unsigned int buf_words); 110extern void swap_buf_le16(u16 *buf, unsigned int buf_words);
111extern bool ata_phys_link_online(struct ata_link *link);
112extern bool ata_phys_link_offline(struct ata_link *link);
110extern void ata_dev_init(struct ata_device *dev); 113extern void ata_dev_init(struct ata_device *dev);
111extern void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp); 114extern void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp);
112extern int sata_link_init_spd(struct ata_link *link); 115extern int sata_link_init_spd(struct ata_link *link);
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c
index d3932901a3b3..1266924c11f9 100644
--- a/drivers/ata/pata_bf54x.c
+++ b/drivers/ata/pata_bf54x.c
@@ -1632,6 +1632,8 @@ static int __devinit bfin_atapi_probe(struct platform_device *pdev)
1632 return -ENODEV; 1632 return -ENODEV;
1633 } 1633 }
1634 1634
1635 dev_set_drvdata(&pdev->dev, host);
1636
1635 return 0; 1637 return 0;
1636} 1638}
1637 1639
@@ -1648,6 +1650,7 @@ static int __devexit bfin_atapi_remove(struct platform_device *pdev)
1648 struct ata_host *host = dev_get_drvdata(dev); 1650 struct ata_host *host = dev_get_drvdata(dev);
1649 1651
1650 ata_host_detach(host); 1652 ata_host_detach(host);
1653 dev_set_drvdata(&pdev->dev, NULL);
1651 1654
1652 peripheral_free_list(atapi_io_port); 1655 peripheral_free_list(atapi_io_port);
1653 1656
@@ -1655,27 +1658,44 @@ static int __devexit bfin_atapi_remove(struct platform_device *pdev)
1655} 1658}
1656 1659
1657#ifdef CONFIG_PM 1660#ifdef CONFIG_PM
1658int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state) 1661static int bfin_atapi_suspend(struct platform_device *pdev, pm_message_t state)
1659{ 1662{
1660 return 0; 1663 struct ata_host *host = dev_get_drvdata(&pdev->dev);
1664 if (host)
1665 return ata_host_suspend(host, state);
1666 else
1667 return 0;
1661} 1668}
1662 1669
1663int bfin_atapi_resume(struct platform_device *pdev) 1670static int bfin_atapi_resume(struct platform_device *pdev)
1664{ 1671{
1672 struct ata_host *host = dev_get_drvdata(&pdev->dev);
1673 int ret;
1674
1675 if (host) {
1676 ret = bfin_reset_controller(host);
1677 if (ret) {
1678 printk(KERN_ERR DRV_NAME ": Error during HW init\n");
1679 return ret;
1680 }
1681 ata_host_resume(host);
1682 }
1683
1665 return 0; 1684 return 0;
1666} 1685}
1686#else
1687#define bfin_atapi_suspend NULL
1688#define bfin_atapi_resume NULL
1667#endif 1689#endif
1668 1690
1669static struct platform_driver bfin_atapi_driver = { 1691static struct platform_driver bfin_atapi_driver = {
1670 .probe = bfin_atapi_probe, 1692 .probe = bfin_atapi_probe,
1671 .remove = __devexit_p(bfin_atapi_remove), 1693 .remove = __devexit_p(bfin_atapi_remove),
1694 .suspend = bfin_atapi_suspend,
1695 .resume = bfin_atapi_resume,
1672 .driver = { 1696 .driver = {
1673 .name = DRV_NAME, 1697 .name = DRV_NAME,
1674 .owner = THIS_MODULE, 1698 .owner = THIS_MODULE,
1675#ifdef CONFIG_PM
1676 .suspend = bfin_atapi_suspend,
1677 .resume = bfin_atapi_resume,
1678#endif
1679 }, 1699 },
1680}; 1700};
1681 1701
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c
index e970b227fbce..a598bb36aafc 100644
--- a/drivers/ata/pata_sil680.c
+++ b/drivers/ata/pata_sil680.c
@@ -230,7 +230,7 @@ static u8 sil680_init_chip(struct pci_dev *pdev, int *try_mmio)
230 tmpbyte & 1, tmpbyte & 0x30); 230 tmpbyte & 1, tmpbyte & 0x30);
231 231
232 *try_mmio = 0; 232 *try_mmio = 0;
233#ifdef CONFIG_PPC_MERGE 233#ifdef CONFIG_PPC
234 if (machine_is(cell)) 234 if (machine_is(cell))
235 *try_mmio = (tmpbyte & 1) || pci_resource_start(pdev, 5); 235 *try_mmio = (tmpbyte & 1) || pci_resource_start(pdev, 5);
236#endif 236#endif
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index 3924e7209a44..1a56db92ff7a 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -469,10 +469,10 @@ static bool sata_fsl_qc_fill_rtf(struct ata_queued_cmd *qc)
469 return true; 469 return true;
470} 470}
471 471
472static int sata_fsl_scr_write(struct ata_port *ap, unsigned int sc_reg_in, 472static int sata_fsl_scr_write(struct ata_link *link,
473 u32 val) 473 unsigned int sc_reg_in, u32 val)
474{ 474{
475 struct sata_fsl_host_priv *host_priv = ap->host->private_data; 475 struct sata_fsl_host_priv *host_priv = link->ap->host->private_data;
476 void __iomem *ssr_base = host_priv->ssr_base; 476 void __iomem *ssr_base = host_priv->ssr_base;
477 unsigned int sc_reg; 477 unsigned int sc_reg;
478 478
@@ -493,10 +493,10 @@ static int sata_fsl_scr_write(struct ata_port *ap, unsigned int sc_reg_in,
493 return 0; 493 return 0;
494} 494}
495 495
496static int sata_fsl_scr_read(struct ata_port *ap, unsigned int sc_reg_in, 496static int sata_fsl_scr_read(struct ata_link *link,
497 u32 *val) 497 unsigned int sc_reg_in, u32 *val)
498{ 498{
499 struct sata_fsl_host_priv *host_priv = ap->host->private_data; 499 struct sata_fsl_host_priv *host_priv = link->ap->host->private_data;
500 void __iomem *ssr_base = host_priv->ssr_base; 500 void __iomem *ssr_base = host_priv->ssr_base;
501 unsigned int sc_reg; 501 unsigned int sc_reg;
502 502
@@ -645,12 +645,12 @@ static int sata_fsl_port_start(struct ata_port *ap)
645 * Workaround for 8315DS board 3gbps link-up issue, 645 * Workaround for 8315DS board 3gbps link-up issue,
646 * currently limit SATA port to GEN1 speed 646 * currently limit SATA port to GEN1 speed
647 */ 647 */
648 sata_fsl_scr_read(ap, SCR_CONTROL, &temp); 648 sata_fsl_scr_read(&ap->link, SCR_CONTROL, &temp);
649 temp &= ~(0xF << 4); 649 temp &= ~(0xF << 4);
650 temp |= (0x1 << 4); 650 temp |= (0x1 << 4);
651 sata_fsl_scr_write(ap, SCR_CONTROL, temp); 651 sata_fsl_scr_write(&ap->link, SCR_CONTROL, temp);
652 652
653 sata_fsl_scr_read(ap, SCR_CONTROL, &temp); 653 sata_fsl_scr_read(&ap->link, SCR_CONTROL, &temp);
654 dev_printk(KERN_WARNING, dev, "scr_control, speed limited to %x\n", 654 dev_printk(KERN_WARNING, dev, "scr_control, speed limited to %x\n",
655 temp); 655 temp);
656#endif 656#endif
@@ -868,7 +868,7 @@ issue_srst:
868 ioread32(CQ + hcr_base), 868 ioread32(CQ + hcr_base),
869 ioread32(CA + hcr_base), ioread32(CC + hcr_base)); 869 ioread32(CA + hcr_base), ioread32(CC + hcr_base));
870 870
871 sata_fsl_scr_read(ap, SCR_ERROR, &Serror); 871 sata_fsl_scr_read(&ap->link, SCR_ERROR, &Serror);
872 872
873 DPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS)); 873 DPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
874 DPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL)); 874 DPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
@@ -972,9 +972,9 @@ static void sata_fsl_error_intr(struct ata_port *ap)
972 * Handle & Clear SError 972 * Handle & Clear SError
973 */ 973 */
974 974
975 sata_fsl_scr_read(ap, SCR_ERROR, &SError); 975 sata_fsl_scr_read(&ap->link, SCR_ERROR, &SError);
976 if (unlikely(SError & 0xFFFF0000)) { 976 if (unlikely(SError & 0xFFFF0000)) {
977 sata_fsl_scr_write(ap, SCR_ERROR, SError); 977 sata_fsl_scr_write(&ap->link, SCR_ERROR, SError);
978 } 978 }
979 979
980 DPRINTK("error_intr,hStat=0x%x,CE=0x%x,DE =0x%x,SErr=0x%x\n", 980 DPRINTK("error_intr,hStat=0x%x,CE=0x%x,DE =0x%x,SErr=0x%x\n",
@@ -1091,7 +1091,7 @@ static void sata_fsl_host_intr(struct ata_port *ap)
1091 1091
1092 hstatus = ioread32(hcr_base + HSTATUS); 1092 hstatus = ioread32(hcr_base + HSTATUS);
1093 1093
1094 sata_fsl_scr_read(ap, SCR_ERROR, &SError); 1094 sata_fsl_scr_read(&ap->link, SCR_ERROR, &SError);
1095 1095
1096 if (unlikely(SError & 0xFFFF0000)) { 1096 if (unlikely(SError & 0xFFFF0000)) {
1097 DPRINTK("serror @host_intr : 0x%x\n", SError); 1097 DPRINTK("serror @host_intr : 0x%x\n", SError);
diff --git a/drivers/ata/sata_inic162x.c b/drivers/ata/sata_inic162x.c
index 3ead02fe379e..fbbd87c96f10 100644
--- a/drivers/ata/sata_inic162x.c
+++ b/drivers/ata/sata_inic162x.c
@@ -96,6 +96,7 @@ enum {
96 PORT_SCR = 0x20, 96 PORT_SCR = 0x20,
97 97
98 /* HOST_CTL bits */ 98 /* HOST_CTL bits */
99 HCTL_LEDEN = (1 << 3), /* enable LED operation */
99 HCTL_IRQOFF = (1 << 8), /* global IRQ off */ 100 HCTL_IRQOFF = (1 << 8), /* global IRQ off */
100 HCTL_FTHD0 = (1 << 10), /* fifo threshold 0 */ 101 HCTL_FTHD0 = (1 << 10), /* fifo threshold 0 */
101 HCTL_FTHD1 = (1 << 11), /* fifo threshold 1*/ 102 HCTL_FTHD1 = (1 << 11), /* fifo threshold 1*/
@@ -268,9 +269,9 @@ static void inic_reset_port(void __iomem *port_base)
268 writeb(0xff, port_base + PORT_IRQ_STAT); 269 writeb(0xff, port_base + PORT_IRQ_STAT);
269} 270}
270 271
271static int inic_scr_read(struct ata_port *ap, unsigned sc_reg, u32 *val) 272static int inic_scr_read(struct ata_link *link, unsigned sc_reg, u32 *val)
272{ 273{
273 void __iomem *scr_addr = inic_port_base(ap) + PORT_SCR; 274 void __iomem *scr_addr = inic_port_base(link->ap) + PORT_SCR;
274 void __iomem *addr; 275 void __iomem *addr;
275 276
276 if (unlikely(sc_reg >= ARRAY_SIZE(scr_map))) 277 if (unlikely(sc_reg >= ARRAY_SIZE(scr_map)))
@@ -285,9 +286,9 @@ static int inic_scr_read(struct ata_port *ap, unsigned sc_reg, u32 *val)
285 return 0; 286 return 0;
286} 287}
287 288
288static int inic_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val) 289static int inic_scr_write(struct ata_link *link, unsigned sc_reg, u32 val)
289{ 290{
290 void __iomem *scr_addr = inic_port_base(ap) + PORT_SCR; 291 void __iomem *scr_addr = inic_port_base(link->ap) + PORT_SCR;
291 292
292 if (unlikely(sc_reg >= ARRAY_SIZE(scr_map))) 293 if (unlikely(sc_reg >= ARRAY_SIZE(scr_map)))
293 return -EINVAL; 294 return -EINVAL;
@@ -540,7 +541,7 @@ static unsigned int inic_qc_issue(struct ata_queued_cmd *qc)
540 void __iomem *port_base = inic_port_base(ap); 541 void __iomem *port_base = inic_port_base(ap);
541 542
542 /* fire up the ADMA engine */ 543 /* fire up the ADMA engine */
543 writew(HCTL_FTHD0, port_base + HOST_CTL); 544 writew(HCTL_FTHD0 | HCTL_LEDEN, port_base + HOST_CTL);
544 writew(IDMA_CTL_GO, port_base + PORT_IDMA_CTL); 545 writew(IDMA_CTL_GO, port_base + PORT_IDMA_CTL);
545 writeb(0, port_base + PORT_CPB_PTQFIFO); 546 writeb(0, port_base + PORT_CPB_PTQFIFO);
546 547
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index c815f8ecf6e6..2b24ae58b52e 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -493,10 +493,10 @@ struct mv_hw_ops {
493 void (*reset_bus)(struct ata_host *host, void __iomem *mmio); 493 void (*reset_bus)(struct ata_host *host, void __iomem *mmio);
494}; 494};
495 495
496static int mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val); 496static int mv_scr_read(struct ata_link *link, unsigned int sc_reg_in, u32 *val);
497static int mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); 497static int mv_scr_write(struct ata_link *link, unsigned int sc_reg_in, u32 val);
498static int mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val); 498static int mv5_scr_read(struct ata_link *link, unsigned int sc_reg_in, u32 *val);
499static int mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); 499static int mv5_scr_write(struct ata_link *link, unsigned int sc_reg_in, u32 val);
500static int mv_port_start(struct ata_port *ap); 500static int mv_port_start(struct ata_port *ap);
501static void mv_port_stop(struct ata_port *ap); 501static void mv_port_stop(struct ata_port *ap);
502static int mv_qc_defer(struct ata_queued_cmd *qc); 502static int mv_qc_defer(struct ata_queued_cmd *qc);
@@ -1070,23 +1070,23 @@ static unsigned int mv_scr_offset(unsigned int sc_reg_in)
1070 return ofs; 1070 return ofs;
1071} 1071}
1072 1072
1073static int mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val) 1073static int mv_scr_read(struct ata_link *link, unsigned int sc_reg_in, u32 *val)
1074{ 1074{
1075 unsigned int ofs = mv_scr_offset(sc_reg_in); 1075 unsigned int ofs = mv_scr_offset(sc_reg_in);
1076 1076
1077 if (ofs != 0xffffffffU) { 1077 if (ofs != 0xffffffffU) {
1078 *val = readl(mv_ap_base(ap) + ofs); 1078 *val = readl(mv_ap_base(link->ap) + ofs);
1079 return 0; 1079 return 0;
1080 } else 1080 } else
1081 return -EINVAL; 1081 return -EINVAL;
1082} 1082}
1083 1083
1084static int mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val) 1084static int mv_scr_write(struct ata_link *link, unsigned int sc_reg_in, u32 val)
1085{ 1085{
1086 unsigned int ofs = mv_scr_offset(sc_reg_in); 1086 unsigned int ofs = mv_scr_offset(sc_reg_in);
1087 1087
1088 if (ofs != 0xffffffffU) { 1088 if (ofs != 0xffffffffU) {
1089 writelfl(val, mv_ap_base(ap) + ofs); 1089 writelfl(val, mv_ap_base(link->ap) + ofs);
1090 return 0; 1090 return 0;
1091 } else 1091 } else
1092 return -EINVAL; 1092 return -EINVAL;
@@ -2251,11 +2251,11 @@ static unsigned int mv5_scr_offset(unsigned int sc_reg_in)
2251 return ofs; 2251 return ofs;
2252} 2252}
2253 2253
2254static int mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val) 2254static int mv5_scr_read(struct ata_link *link, unsigned int sc_reg_in, u32 *val)
2255{ 2255{
2256 struct mv_host_priv *hpriv = ap->host->private_data; 2256 struct mv_host_priv *hpriv = link->ap->host->private_data;
2257 void __iomem *mmio = hpriv->base; 2257 void __iomem *mmio = hpriv->base;
2258 void __iomem *addr = mv5_phy_base(mmio, ap->port_no); 2258 void __iomem *addr = mv5_phy_base(mmio, link->ap->port_no);
2259 unsigned int ofs = mv5_scr_offset(sc_reg_in); 2259 unsigned int ofs = mv5_scr_offset(sc_reg_in);
2260 2260
2261 if (ofs != 0xffffffffU) { 2261 if (ofs != 0xffffffffU) {
@@ -2265,11 +2265,11 @@ static int mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in, u32 *val)
2265 return -EINVAL; 2265 return -EINVAL;
2266} 2266}
2267 2267
2268static int mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val) 2268static int mv5_scr_write(struct ata_link *link, unsigned int sc_reg_in, u32 val)
2269{ 2269{
2270 struct mv_host_priv *hpriv = ap->host->private_data; 2270 struct mv_host_priv *hpriv = link->ap->host->private_data;
2271 void __iomem *mmio = hpriv->base; 2271 void __iomem *mmio = hpriv->base;
2272 void __iomem *addr = mv5_phy_base(mmio, ap->port_no); 2272 void __iomem *addr = mv5_phy_base(mmio, link->ap->port_no);
2273 unsigned int ofs = mv5_scr_offset(sc_reg_in); 2273 unsigned int ofs = mv5_scr_offset(sc_reg_in);
2274 2274
2275 if (ofs != 0xffffffffU) { 2275 if (ofs != 0xffffffffU) {
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 1e1f3f3757ae..fae3841de0d8 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -302,13 +302,15 @@ static void nv_ck804_host_stop(struct ata_host *host);
302static irqreturn_t nv_generic_interrupt(int irq, void *dev_instance); 302static irqreturn_t nv_generic_interrupt(int irq, void *dev_instance);
303static irqreturn_t nv_nf2_interrupt(int irq, void *dev_instance); 303static irqreturn_t nv_nf2_interrupt(int irq, void *dev_instance);
304static irqreturn_t nv_ck804_interrupt(int irq, void *dev_instance); 304static irqreturn_t nv_ck804_interrupt(int irq, void *dev_instance);
305static int nv_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); 305static int nv_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
306static int nv_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); 306static int nv_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val);
307 307
308static void nv_nf2_freeze(struct ata_port *ap); 308static void nv_nf2_freeze(struct ata_port *ap);
309static void nv_nf2_thaw(struct ata_port *ap); 309static void nv_nf2_thaw(struct ata_port *ap);
310static void nv_ck804_freeze(struct ata_port *ap); 310static void nv_ck804_freeze(struct ata_port *ap);
311static void nv_ck804_thaw(struct ata_port *ap); 311static void nv_ck804_thaw(struct ata_port *ap);
312static int nv_hardreset(struct ata_link *link, unsigned int *class,
313 unsigned long deadline);
312static int nv_adma_slave_config(struct scsi_device *sdev); 314static int nv_adma_slave_config(struct scsi_device *sdev);
313static int nv_adma_check_atapi_dma(struct ata_queued_cmd *qc); 315static int nv_adma_check_atapi_dma(struct ata_queued_cmd *qc);
314static void nv_adma_qc_prep(struct ata_queued_cmd *qc); 316static void nv_adma_qc_prep(struct ata_queued_cmd *qc);
@@ -403,28 +405,45 @@ static struct scsi_host_template nv_swncq_sht = {
403 .slave_configure = nv_swncq_slave_config, 405 .slave_configure = nv_swncq_slave_config,
404}; 406};
405 407
406static struct ata_port_operations nv_generic_ops = { 408/* OSDL bz3352 reports that some nv controllers can't determine device
409 * signature reliably and nv_hardreset is implemented to work around
410 * the problem. This was reported on nf3 and it's unclear whether any
411 * other controllers are affected. However, the workaround has been
412 * applied to all variants and there isn't much to gain by trying to
413 * find out exactly which ones are affected at this point especially
414 * because NV has moved over to ahci for newer controllers.
415 */
416static struct ata_port_operations nv_common_ops = {
407 .inherits = &ata_bmdma_port_ops, 417 .inherits = &ata_bmdma_port_ops,
408 .hardreset = ATA_OP_NULL, 418 .hardreset = nv_hardreset,
409 .scr_read = nv_scr_read, 419 .scr_read = nv_scr_read,
410 .scr_write = nv_scr_write, 420 .scr_write = nv_scr_write,
411}; 421};
412 422
423/* OSDL bz11195 reports that link doesn't come online after hardreset
424 * on generic nv's and there have been several other similar reports
425 * on linux-ide. Disable hardreset for generic nv's.
426 */
427static struct ata_port_operations nv_generic_ops = {
428 .inherits = &nv_common_ops,
429 .hardreset = ATA_OP_NULL,
430};
431
413static struct ata_port_operations nv_nf2_ops = { 432static struct ata_port_operations nv_nf2_ops = {
414 .inherits = &nv_generic_ops, 433 .inherits = &nv_common_ops,
415 .freeze = nv_nf2_freeze, 434 .freeze = nv_nf2_freeze,
416 .thaw = nv_nf2_thaw, 435 .thaw = nv_nf2_thaw,
417}; 436};
418 437
419static struct ata_port_operations nv_ck804_ops = { 438static struct ata_port_operations nv_ck804_ops = {
420 .inherits = &nv_generic_ops, 439 .inherits = &nv_common_ops,
421 .freeze = nv_ck804_freeze, 440 .freeze = nv_ck804_freeze,
422 .thaw = nv_ck804_thaw, 441 .thaw = nv_ck804_thaw,
423 .host_stop = nv_ck804_host_stop, 442 .host_stop = nv_ck804_host_stop,
424}; 443};
425 444
426static struct ata_port_operations nv_adma_ops = { 445static struct ata_port_operations nv_adma_ops = {
427 .inherits = &nv_generic_ops, 446 .inherits = &nv_common_ops,
428 447
429 .check_atapi_dma = nv_adma_check_atapi_dma, 448 .check_atapi_dma = nv_adma_check_atapi_dma,
430 .sff_tf_read = nv_adma_tf_read, 449 .sff_tf_read = nv_adma_tf_read,
@@ -448,7 +467,7 @@ static struct ata_port_operations nv_adma_ops = {
448}; 467};
449 468
450static struct ata_port_operations nv_swncq_ops = { 469static struct ata_port_operations nv_swncq_ops = {
451 .inherits = &nv_generic_ops, 470 .inherits = &nv_common_ops,
452 471
453 .qc_defer = ata_std_qc_defer, 472 .qc_defer = ata_std_qc_defer,
454 .qc_prep = nv_swncq_qc_prep, 473 .qc_prep = nv_swncq_qc_prep,
@@ -1492,21 +1511,21 @@ static irqreturn_t nv_ck804_interrupt(int irq, void *dev_instance)
1492 return ret; 1511 return ret;
1493} 1512}
1494 1513
1495static int nv_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) 1514static int nv_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val)
1496{ 1515{
1497 if (sc_reg > SCR_CONTROL) 1516 if (sc_reg > SCR_CONTROL)
1498 return -EINVAL; 1517 return -EINVAL;
1499 1518
1500 *val = ioread32(ap->ioaddr.scr_addr + (sc_reg * 4)); 1519 *val = ioread32(link->ap->ioaddr.scr_addr + (sc_reg * 4));
1501 return 0; 1520 return 0;
1502} 1521}
1503 1522
1504static int nv_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) 1523static int nv_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
1505{ 1524{
1506 if (sc_reg > SCR_CONTROL) 1525 if (sc_reg > SCR_CONTROL)
1507 return -EINVAL; 1526 return -EINVAL;
1508 1527
1509 iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4)); 1528 iowrite32(val, link->ap->ioaddr.scr_addr + (sc_reg * 4));
1510 return 0; 1529 return 0;
1511} 1530}
1512 1531
@@ -1586,6 +1605,21 @@ static void nv_mcp55_thaw(struct ata_port *ap)
1586 ata_sff_thaw(ap); 1605 ata_sff_thaw(ap);
1587} 1606}
1588 1607
1608static int nv_hardreset(struct ata_link *link, unsigned int *class,
1609 unsigned long deadline)
1610{
1611 int rc;
1612
1613 /* SATA hardreset fails to retrieve proper device signature on
1614 * some controllers. Request follow up SRST. For more info,
1615 * see http://bugzilla.kernel.org/show_bug.cgi?id=3352
1616 */
1617 rc = sata_sff_hardreset(link, class, deadline);
1618 if (rc)
1619 return rc;
1620 return -EAGAIN;
1621}
1622
1589static void nv_adma_error_handler(struct ata_port *ap) 1623static void nv_adma_error_handler(struct ata_port *ap)
1590{ 1624{
1591 struct nv_adma_port_priv *pp = ap->private_data; 1625 struct nv_adma_port_priv *pp = ap->private_data;
@@ -2184,9 +2218,9 @@ static void nv_swncq_host_interrupt(struct ata_port *ap, u16 fis)
2184 if (!pp->qc_active) 2218 if (!pp->qc_active)
2185 return; 2219 return;
2186 2220
2187 if (ap->ops->scr_read(ap, SCR_ERROR, &serror)) 2221 if (ap->ops->scr_read(&ap->link, SCR_ERROR, &serror))
2188 return; 2222 return;
2189 ap->ops->scr_write(ap, SCR_ERROR, serror); 2223 ap->ops->scr_write(&ap->link, SCR_ERROR, serror);
2190 2224
2191 if (ata_stat & ATA_ERR) { 2225 if (ata_stat & ATA_ERR) {
2192 ata_ehi_clear_desc(ehi); 2226 ata_ehi_clear_desc(ehi);
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index 030665ba76b7..750d8cdc00cd 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -137,8 +137,8 @@ struct pdc_port_priv {
137 dma_addr_t pkt_dma; 137 dma_addr_t pkt_dma;
138}; 138};
139 139
140static int pdc_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); 140static int pdc_sata_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
141static int pdc_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); 141static int pdc_sata_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val);
142static int pdc_ata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 142static int pdc_ata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
143static int pdc_common_port_start(struct ata_port *ap); 143static int pdc_common_port_start(struct ata_port *ap);
144static int pdc_sata_port_start(struct ata_port *ap); 144static int pdc_sata_port_start(struct ata_port *ap);
@@ -386,19 +386,21 @@ static int pdc_sata_cable_detect(struct ata_port *ap)
386 return ATA_CBL_SATA; 386 return ATA_CBL_SATA;
387} 387}
388 388
389static int pdc_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) 389static int pdc_sata_scr_read(struct ata_link *link,
390 unsigned int sc_reg, u32 *val)
390{ 391{
391 if (sc_reg > SCR_CONTROL) 392 if (sc_reg > SCR_CONTROL)
392 return -EINVAL; 393 return -EINVAL;
393 *val = readl(ap->ioaddr.scr_addr + (sc_reg * 4)); 394 *val = readl(link->ap->ioaddr.scr_addr + (sc_reg * 4));
394 return 0; 395 return 0;
395} 396}
396 397
397static int pdc_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) 398static int pdc_sata_scr_write(struct ata_link *link,
399 unsigned int sc_reg, u32 val)
398{ 400{
399 if (sc_reg > SCR_CONTROL) 401 if (sc_reg > SCR_CONTROL)
400 return -EINVAL; 402 return -EINVAL;
401 writel(val, ap->ioaddr.scr_addr + (sc_reg * 4)); 403 writel(val, link->ap->ioaddr.scr_addr + (sc_reg * 4));
402 return 0; 404 return 0;
403} 405}
404 406
@@ -731,7 +733,7 @@ static void pdc_error_intr(struct ata_port *ap, struct ata_queued_cmd *qc,
731 if (sata_scr_valid(&ap->link)) { 733 if (sata_scr_valid(&ap->link)) {
732 u32 serror; 734 u32 serror;
733 735
734 pdc_sata_scr_read(ap, SCR_ERROR, &serror); 736 pdc_sata_scr_read(&ap->link, SCR_ERROR, &serror);
735 ehi->serror |= serror; 737 ehi->serror |= serror;
736 } 738 }
737 739
diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c
index 1600107047cf..a000c86ac859 100644
--- a/drivers/ata/sata_qstor.c
+++ b/drivers/ata/sata_qstor.c
@@ -111,8 +111,8 @@ struct qs_port_priv {
111 qs_state_t state; 111 qs_state_t state;
112}; 112};
113 113
114static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); 114static int qs_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
115static int qs_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); 115static int qs_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val);
116static int qs_ata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 116static int qs_ata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
117static int qs_port_start(struct ata_port *ap); 117static int qs_port_start(struct ata_port *ap);
118static void qs_host_stop(struct ata_host *host); 118static void qs_host_stop(struct ata_host *host);
@@ -242,11 +242,11 @@ static int qs_prereset(struct ata_link *link, unsigned long deadline)
242 return ata_sff_prereset(link, deadline); 242 return ata_sff_prereset(link, deadline);
243} 243}
244 244
245static int qs_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) 245static int qs_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val)
246{ 246{
247 if (sc_reg > SCR_CONTROL) 247 if (sc_reg > SCR_CONTROL)
248 return -EINVAL; 248 return -EINVAL;
249 *val = readl(ap->ioaddr.scr_addr + (sc_reg * 8)); 249 *val = readl(link->ap->ioaddr.scr_addr + (sc_reg * 8));
250 return 0; 250 return 0;
251} 251}
252 252
@@ -256,11 +256,11 @@ static void qs_error_handler(struct ata_port *ap)
256 ata_std_error_handler(ap); 256 ata_std_error_handler(ap);
257} 257}
258 258
259static int qs_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) 259static int qs_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
260{ 260{
261 if (sc_reg > SCR_CONTROL) 261 if (sc_reg > SCR_CONTROL)
262 return -EINVAL; 262 return -EINVAL;
263 writel(val, ap->ioaddr.scr_addr + (sc_reg * 8)); 263 writel(val, link->ap->ioaddr.scr_addr + (sc_reg * 8));
264 return 0; 264 return 0;
265} 265}
266 266
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index 88bf4212590f..031d7b7dee34 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -115,8 +115,8 @@ static int sil_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
115static int sil_pci_device_resume(struct pci_dev *pdev); 115static int sil_pci_device_resume(struct pci_dev *pdev);
116#endif 116#endif
117static void sil_dev_config(struct ata_device *dev); 117static void sil_dev_config(struct ata_device *dev);
118static int sil_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); 118static int sil_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
119static int sil_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); 119static int sil_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val);
120static int sil_set_mode(struct ata_link *link, struct ata_device **r_failed); 120static int sil_set_mode(struct ata_link *link, struct ata_device **r_failed);
121static void sil_freeze(struct ata_port *ap); 121static void sil_freeze(struct ata_port *ap);
122static void sil_thaw(struct ata_port *ap); 122static void sil_thaw(struct ata_port *ap);
@@ -317,9 +317,9 @@ static inline void __iomem *sil_scr_addr(struct ata_port *ap,
317 return NULL; 317 return NULL;
318} 318}
319 319
320static int sil_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) 320static int sil_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val)
321{ 321{
322 void __iomem *mmio = sil_scr_addr(ap, sc_reg); 322 void __iomem *mmio = sil_scr_addr(link->ap, sc_reg);
323 323
324 if (mmio) { 324 if (mmio) {
325 *val = readl(mmio); 325 *val = readl(mmio);
@@ -328,9 +328,9 @@ static int sil_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
328 return -EINVAL; 328 return -EINVAL;
329} 329}
330 330
331static int sil_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) 331static int sil_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
332{ 332{
333 void __iomem *mmio = sil_scr_addr(ap, sc_reg); 333 void __iomem *mmio = sil_scr_addr(link->ap, sc_reg);
334 334
335 if (mmio) { 335 if (mmio) {
336 writel(val, mmio); 336 writel(val, mmio);
@@ -352,8 +352,8 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
352 * controllers continue to assert IRQ as long as 352 * controllers continue to assert IRQ as long as
353 * SError bits are pending. Clear SError immediately. 353 * SError bits are pending. Clear SError immediately.
354 */ 354 */
355 sil_scr_read(ap, SCR_ERROR, &serror); 355 sil_scr_read(&ap->link, SCR_ERROR, &serror);
356 sil_scr_write(ap, SCR_ERROR, serror); 356 sil_scr_write(&ap->link, SCR_ERROR, serror);
357 357
358 /* Sometimes spurious interrupts occur, double check 358 /* Sometimes spurious interrupts occur, double check
359 * it's PHYRDY CHG. 359 * it's PHYRDY CHG.
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c
index 84ffcc26a74b..4621807a1a6a 100644
--- a/drivers/ata/sata_sil24.c
+++ b/drivers/ata/sata_sil24.c
@@ -340,8 +340,8 @@ struct sil24_port_priv {
340}; 340};
341 341
342static void sil24_dev_config(struct ata_device *dev); 342static void sil24_dev_config(struct ata_device *dev);
343static int sil24_scr_read(struct ata_port *ap, unsigned sc_reg, u32 *val); 343static int sil24_scr_read(struct ata_link *link, unsigned sc_reg, u32 *val);
344static int sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val); 344static int sil24_scr_write(struct ata_link *link, unsigned sc_reg, u32 val);
345static int sil24_qc_defer(struct ata_queued_cmd *qc); 345static int sil24_qc_defer(struct ata_queued_cmd *qc);
346static void sil24_qc_prep(struct ata_queued_cmd *qc); 346static void sil24_qc_prep(struct ata_queued_cmd *qc);
347static unsigned int sil24_qc_issue(struct ata_queued_cmd *qc); 347static unsigned int sil24_qc_issue(struct ata_queued_cmd *qc);
@@ -504,9 +504,9 @@ static int sil24_scr_map[] = {
504 [SCR_ACTIVE] = 3, 504 [SCR_ACTIVE] = 3,
505}; 505};
506 506
507static int sil24_scr_read(struct ata_port *ap, unsigned sc_reg, u32 *val) 507static int sil24_scr_read(struct ata_link *link, unsigned sc_reg, u32 *val)
508{ 508{
509 void __iomem *scr_addr = sil24_port_base(ap) + PORT_SCONTROL; 509 void __iomem *scr_addr = sil24_port_base(link->ap) + PORT_SCONTROL;
510 510
511 if (sc_reg < ARRAY_SIZE(sil24_scr_map)) { 511 if (sc_reg < ARRAY_SIZE(sil24_scr_map)) {
512 void __iomem *addr; 512 void __iomem *addr;
@@ -517,9 +517,9 @@ static int sil24_scr_read(struct ata_port *ap, unsigned sc_reg, u32 *val)
517 return -EINVAL; 517 return -EINVAL;
518} 518}
519 519
520static int sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val) 520static int sil24_scr_write(struct ata_link *link, unsigned sc_reg, u32 val)
521{ 521{
522 void __iomem *scr_addr = sil24_port_base(ap) + PORT_SCONTROL; 522 void __iomem *scr_addr = sil24_port_base(link->ap) + PORT_SCONTROL;
523 523
524 if (sc_reg < ARRAY_SIZE(sil24_scr_map)) { 524 if (sc_reg < ARRAY_SIZE(sil24_scr_map)) {
525 void __iomem *addr; 525 void __iomem *addr;
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c
index 1010b3069bd5..9c43b4e7c4a6 100644
--- a/drivers/ata/sata_sis.c
+++ b/drivers/ata/sata_sis.c
@@ -64,8 +64,8 @@ enum {
64}; 64};
65 65
66static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 66static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
67static int sis_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); 67static int sis_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
68static int sis_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); 68static int sis_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val);
69 69
70static const struct pci_device_id sis_pci_tbl[] = { 70static const struct pci_device_id sis_pci_tbl[] = {
71 { PCI_VDEVICE(SI, 0x0180), sis_180 }, /* SiS 964/180 */ 71 { PCI_VDEVICE(SI, 0x0180), sis_180 }, /* SiS 964/180 */
@@ -134,10 +134,11 @@ static unsigned int get_scr_cfg_addr(struct ata_port *ap, unsigned int sc_reg)
134 return addr; 134 return addr;
135} 135}
136 136
137static u32 sis_scr_cfg_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) 137static u32 sis_scr_cfg_read(struct ata_link *link,
138 unsigned int sc_reg, u32 *val)
138{ 139{
139 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 140 struct pci_dev *pdev = to_pci_dev(link->ap->host->dev);
140 unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); 141 unsigned int cfg_addr = get_scr_cfg_addr(link->ap, sc_reg);
141 u32 val2 = 0; 142 u32 val2 = 0;
142 u8 pmr; 143 u8 pmr;
143 144
@@ -158,10 +159,11 @@ static u32 sis_scr_cfg_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
158 return 0; 159 return 0;
159} 160}
160 161
161static int sis_scr_cfg_write(struct ata_port *ap, unsigned int sc_reg, u32 val) 162static int sis_scr_cfg_write(struct ata_link *link,
163 unsigned int sc_reg, u32 val)
162{ 164{
163 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 165 struct pci_dev *pdev = to_pci_dev(link->ap->host->dev);
164 unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); 166 unsigned int cfg_addr = get_scr_cfg_addr(link->ap, sc_reg);
165 u8 pmr; 167 u8 pmr;
166 168
167 if (sc_reg == SCR_ERROR) /* doesn't exist in PCI cfg space */ 169 if (sc_reg == SCR_ERROR) /* doesn't exist in PCI cfg space */
@@ -178,8 +180,9 @@ static int sis_scr_cfg_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
178 return 0; 180 return 0;
179} 181}
180 182
181static int sis_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) 183static int sis_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val)
182{ 184{
185 struct ata_port *ap = link->ap;
183 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 186 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
184 u8 pmr; 187 u8 pmr;
185 188
@@ -187,7 +190,7 @@ static int sis_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
187 return -EINVAL; 190 return -EINVAL;
188 191
189 if (ap->flags & SIS_FLAG_CFGSCR) 192 if (ap->flags & SIS_FLAG_CFGSCR)
190 return sis_scr_cfg_read(ap, sc_reg, val); 193 return sis_scr_cfg_read(link, sc_reg, val);
191 194
192 pci_read_config_byte(pdev, SIS_PMR, &pmr); 195 pci_read_config_byte(pdev, SIS_PMR, &pmr);
193 196
@@ -202,8 +205,9 @@ static int sis_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
202 return 0; 205 return 0;
203} 206}
204 207
205static int sis_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) 208static int sis_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
206{ 209{
210 struct ata_port *ap = link->ap;
207 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 211 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
208 u8 pmr; 212 u8 pmr;
209 213
@@ -213,7 +217,7 @@ static int sis_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
213 pci_read_config_byte(pdev, SIS_PMR, &pmr); 217 pci_read_config_byte(pdev, SIS_PMR, &pmr);
214 218
215 if (ap->flags & SIS_FLAG_CFGSCR) 219 if (ap->flags & SIS_FLAG_CFGSCR)
216 return sis_scr_cfg_write(ap, sc_reg, val); 220 return sis_scr_cfg_write(link, sc_reg, val);
217 else { 221 else {
218 iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4)); 222 iowrite32(val, ap->ioaddr.scr_addr + (sc_reg * 4));
219 if ((pdev->device == 0x0182) || (pdev->device == 0x0183) || 223 if ((pdev->device == 0x0182) || (pdev->device == 0x0183) ||
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
index fb13b82aacba..609d147813ae 100644
--- a/drivers/ata/sata_svw.c
+++ b/drivers/ata/sata_svw.c
@@ -123,20 +123,22 @@ static int k2_sata_check_atapi_dma(struct ata_queued_cmd *qc)
123 } 123 }
124} 124}
125 125
126static int k2_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) 126static int k2_sata_scr_read(struct ata_link *link,
127 unsigned int sc_reg, u32 *val)
127{ 128{
128 if (sc_reg > SCR_CONTROL) 129 if (sc_reg > SCR_CONTROL)
129 return -EINVAL; 130 return -EINVAL;
130 *val = readl(ap->ioaddr.scr_addr + (sc_reg * 4)); 131 *val = readl(link->ap->ioaddr.scr_addr + (sc_reg * 4));
131 return 0; 132 return 0;
132} 133}
133 134
134 135
135static int k2_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) 136static int k2_sata_scr_write(struct ata_link *link,
137 unsigned int sc_reg, u32 val)
136{ 138{
137 if (sc_reg > SCR_CONTROL) 139 if (sc_reg > SCR_CONTROL)
138 return -EINVAL; 140 return -EINVAL;
139 writel(val, ap->ioaddr.scr_addr + (sc_reg * 4)); 141 writel(val, link->ap->ioaddr.scr_addr + (sc_reg * 4));
140 return 0; 142 return 0;
141} 143}
142 144
diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c
index db529b849948..019575bb3e08 100644
--- a/drivers/ata/sata_uli.c
+++ b/drivers/ata/sata_uli.c
@@ -57,8 +57,8 @@ struct uli_priv {
57}; 57};
58 58
59static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 59static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
60static int uli_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); 60static int uli_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
61static int uli_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); 61static int uli_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val);
62 62
63static const struct pci_device_id uli_pci_tbl[] = { 63static const struct pci_device_id uli_pci_tbl[] = {
64 { PCI_VDEVICE(AL, 0x5289), uli_5289 }, 64 { PCI_VDEVICE(AL, 0x5289), uli_5289 },
@@ -107,39 +107,39 @@ static unsigned int get_scr_cfg_addr(struct ata_port *ap, unsigned int sc_reg)
107 return hpriv->scr_cfg_addr[ap->port_no] + (4 * sc_reg); 107 return hpriv->scr_cfg_addr[ap->port_no] + (4 * sc_reg);
108} 108}
109 109
110static u32 uli_scr_cfg_read(struct ata_port *ap, unsigned int sc_reg) 110static u32 uli_scr_cfg_read(struct ata_link *link, unsigned int sc_reg)
111{ 111{
112 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 112 struct pci_dev *pdev = to_pci_dev(link->ap->host->dev);
113 unsigned int cfg_addr = get_scr_cfg_addr(ap, sc_reg); 113 unsigned int cfg_addr = get_scr_cfg_addr(link->ap, sc_reg);
114 u32 val; 114 u32 val;
115 115
116 pci_read_config_dword(pdev, cfg_addr, &val); 116 pci_read_config_dword(pdev, cfg_addr, &val);
117 return val; 117 return val;
118} 118}
119 119
120static void uli_scr_cfg_write(struct ata_port *ap, unsigned int scr, u32 val) 120static void uli_scr_cfg_write(struct ata_link *link, unsigned int scr, u32 val)
121{ 121{
122 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 122 struct pci_dev *pdev = to_pci_dev(link->ap->host->dev);
123 unsigned int cfg_addr = get_scr_cfg_addr(ap, scr); 123 unsigned int cfg_addr = get_scr_cfg_addr(link->ap, scr);
124 124
125 pci_write_config_dword(pdev, cfg_addr, val); 125 pci_write_config_dword(pdev, cfg_addr, val);
126} 126}
127 127
128static int uli_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) 128static int uli_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val)
129{ 129{
130 if (sc_reg > SCR_CONTROL) 130 if (sc_reg > SCR_CONTROL)
131 return -EINVAL; 131 return -EINVAL;
132 132
133 *val = uli_scr_cfg_read(ap, sc_reg); 133 *val = uli_scr_cfg_read(link, sc_reg);
134 return 0; 134 return 0;
135} 135}
136 136
137static int uli_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) 137static int uli_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
138{ 138{
139 if (sc_reg > SCR_CONTROL) //SCR_CONTROL=2, SCR_ERROR=1, SCR_STATUS=0 139 if (sc_reg > SCR_CONTROL) //SCR_CONTROL=2, SCR_ERROR=1, SCR_STATUS=0
140 return -EINVAL; 140 return -EINVAL;
141 141
142 uli_scr_cfg_write(ap, sc_reg, val); 142 uli_scr_cfg_write(link, sc_reg, val);
143 return 0; 143 return 0;
144} 144}
145 145
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c
index 96deeb354e16..1cfa74535d91 100644
--- a/drivers/ata/sata_via.c
+++ b/drivers/ata/sata_via.c
@@ -68,8 +68,8 @@ enum {
68}; 68};
69 69
70static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); 70static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
71static int svia_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val); 71static int svia_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val);
72static int svia_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val); 72static int svia_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val);
73static void svia_noop_freeze(struct ata_port *ap); 73static void svia_noop_freeze(struct ata_port *ap);
74static int vt6420_prereset(struct ata_link *link, unsigned long deadline); 74static int vt6420_prereset(struct ata_link *link, unsigned long deadline);
75static int vt6421_pata_cable_detect(struct ata_port *ap); 75static int vt6421_pata_cable_detect(struct ata_port *ap);
@@ -152,19 +152,19 @@ MODULE_LICENSE("GPL");
152MODULE_DEVICE_TABLE(pci, svia_pci_tbl); 152MODULE_DEVICE_TABLE(pci, svia_pci_tbl);
153MODULE_VERSION(DRV_VERSION); 153MODULE_VERSION(DRV_VERSION);
154 154
155static int svia_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) 155static int svia_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val)
156{ 156{
157 if (sc_reg > SCR_CONTROL) 157 if (sc_reg > SCR_CONTROL)
158 return -EINVAL; 158 return -EINVAL;
159 *val = ioread32(ap->ioaddr.scr_addr + (4 * sc_reg)); 159 *val = ioread32(link->ap->ioaddr.scr_addr + (4 * sc_reg));
160 return 0; 160 return 0;
161} 161}
162 162
163static int svia_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) 163static int svia_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
164{ 164{
165 if (sc_reg > SCR_CONTROL) 165 if (sc_reg > SCR_CONTROL)
166 return -EINVAL; 166 return -EINVAL;
167 iowrite32(val, ap->ioaddr.scr_addr + (4 * sc_reg)); 167 iowrite32(val, link->ap->ioaddr.scr_addr + (4 * sc_reg));
168 return 0; 168 return 0;
169} 169}
170 170
@@ -210,20 +210,20 @@ static int vt6420_prereset(struct ata_link *link, unsigned long deadline)
210 goto skip_scr; 210 goto skip_scr;
211 211
212 /* Resume phy. This is the old SATA resume sequence */ 212 /* Resume phy. This is the old SATA resume sequence */
213 svia_scr_write(ap, SCR_CONTROL, 0x300); 213 svia_scr_write(link, SCR_CONTROL, 0x300);
214 svia_scr_read(ap, SCR_CONTROL, &scontrol); /* flush */ 214 svia_scr_read(link, SCR_CONTROL, &scontrol); /* flush */
215 215
216 /* wait for phy to become ready, if necessary */ 216 /* wait for phy to become ready, if necessary */
217 do { 217 do {
218 msleep(200); 218 msleep(200);
219 svia_scr_read(ap, SCR_STATUS, &sstatus); 219 svia_scr_read(link, SCR_STATUS, &sstatus);
220 if ((sstatus & 0xf) != 1) 220 if ((sstatus & 0xf) != 1)
221 break; 221 break;
222 } while (time_before(jiffies, timeout)); 222 } while (time_before(jiffies, timeout));
223 223
224 /* open code sata_print_link_status() */ 224 /* open code sata_print_link_status() */
225 svia_scr_read(ap, SCR_STATUS, &sstatus); 225 svia_scr_read(link, SCR_STATUS, &sstatus);
226 svia_scr_read(ap, SCR_CONTROL, &scontrol); 226 svia_scr_read(link, SCR_CONTROL, &scontrol);
227 227
228 online = (sstatus & 0xf) == 0x3; 228 online = (sstatus & 0xf) == 0x3;
229 229
@@ -232,7 +232,7 @@ static int vt6420_prereset(struct ata_link *link, unsigned long deadline)
232 online ? "up" : "down", sstatus, scontrol); 232 online ? "up" : "down", sstatus, scontrol);
233 233
234 /* SStatus is read one more time */ 234 /* SStatus is read one more time */
235 svia_scr_read(ap, SCR_STATUS, &sstatus); 235 svia_scr_read(link, SCR_STATUS, &sstatus);
236 236
237 if (!online) { 237 if (!online) {
238 /* tell EH to bail */ 238 /* tell EH to bail */
diff --git a/drivers/ata/sata_vsc.c b/drivers/ata/sata_vsc.c
index f3d635c0a2e9..c57cdff9e6bd 100644
--- a/drivers/ata/sata_vsc.c
+++ b/drivers/ata/sata_vsc.c
@@ -98,20 +98,22 @@ enum {
98 VSC_SATA_INT_PHY_CHANGE), 98 VSC_SATA_INT_PHY_CHANGE),
99}; 99};
100 100
101static int vsc_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val) 101static int vsc_sata_scr_read(struct ata_link *link,
102 unsigned int sc_reg, u32 *val)
102{ 103{
103 if (sc_reg > SCR_CONTROL) 104 if (sc_reg > SCR_CONTROL)
104 return -EINVAL; 105 return -EINVAL;
105 *val = readl(ap->ioaddr.scr_addr + (sc_reg * 4)); 106 *val = readl(link->ap->ioaddr.scr_addr + (sc_reg * 4));
106 return 0; 107 return 0;
107} 108}
108 109
109 110
110static int vsc_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val) 111static int vsc_sata_scr_write(struct ata_link *link,
112 unsigned int sc_reg, u32 val)
111{ 113{
112 if (sc_reg > SCR_CONTROL) 114 if (sc_reg > SCR_CONTROL)
113 return -EINVAL; 115 return -EINVAL;
114 writel(val, ap->ioaddr.scr_addr + (sc_reg * 4)); 116 writel(val, link->ap->ioaddr.scr_addr + (sc_reg * 4));
115 return 0; 117 return 0;
116} 118}
117 119
diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c
index 1e55a658e6ce..32f3a8ed8d3d 100644
--- a/drivers/bluetooth/bpa10x.c
+++ b/drivers/bluetooth/bpa10x.c
@@ -256,7 +256,6 @@ static inline int bpa10x_submit_intr_urb(struct hci_dev *hdev)
256 BT_ERR("%s urb %p submission failed (%d)", 256 BT_ERR("%s urb %p submission failed (%d)",
257 hdev->name, urb, -err); 257 hdev->name, urb, -err);
258 usb_unanchor_urb(urb); 258 usb_unanchor_urb(urb);
259 kfree(buf);
260 } 259 }
261 260
262 usb_free_urb(urb); 261 usb_free_urb(urb);
@@ -298,7 +297,6 @@ static inline int bpa10x_submit_bulk_urb(struct hci_dev *hdev)
298 BT_ERR("%s urb %p submission failed (%d)", 297 BT_ERR("%s urb %p submission failed (%d)",
299 hdev->name, urb, -err); 298 hdev->name, urb, -err);
300 usb_unanchor_urb(urb); 299 usb_unanchor_urb(urb);
301 kfree(buf);
302 } 300 }
303 301
304 usb_free_urb(urb); 302 usb_free_urb(urb);
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 6a010681ecf3..af472e052732 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -102,14 +102,19 @@ static struct usb_device_id blacklist_table[] = {
102 { USB_DEVICE(0x0a5c, 0x2101), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, 102 { USB_DEVICE(0x0a5c, 0x2101), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU },
103 103
104 /* Broadcom BCM2046 */ 104 /* Broadcom BCM2046 */
105 { USB_DEVICE(0x0a5c, 0x2146), .driver_info = BTUSB_RESET },
105 { USB_DEVICE(0x0a5c, 0x2151), .driver_info = BTUSB_RESET }, 106 { USB_DEVICE(0x0a5c, 0x2151), .driver_info = BTUSB_RESET },
106 107
108 /* Apple MacBook Pro with Broadcom chip */
109 { USB_DEVICE(0x05ac, 0x820f), .driver_info = BTUSB_RESET },
110
107 /* IBM/Lenovo ThinkPad with Broadcom chip */ 111 /* IBM/Lenovo ThinkPad with Broadcom chip */
108 { USB_DEVICE(0x0a5c, 0x201e), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, 112 { USB_DEVICE(0x0a5c, 0x201e), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU },
109 { USB_DEVICE(0x0a5c, 0x2110), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, 113 { USB_DEVICE(0x0a5c, 0x2110), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU },
110 114
111 /* Targus ACB10US */ 115 /* Targus ACB10US */
112 { USB_DEVICE(0x0a5c, 0x2100), .driver_info = BTUSB_RESET }, 116 { USB_DEVICE(0x0a5c, 0x2100), .driver_info = BTUSB_RESET },
117 { USB_DEVICE(0x0a5c, 0x2154), .driver_info = BTUSB_RESET },
113 118
114 /* ANYCOM Bluetooth USB-200 and USB-250 */ 119 /* ANYCOM Bluetooth USB-200 and USB-250 */
115 { USB_DEVICE(0x0a5c, 0x2111), .driver_info = BTUSB_RESET }, 120 { USB_DEVICE(0x0a5c, 0x2111), .driver_info = BTUSB_RESET },
@@ -147,6 +152,9 @@ static struct usb_device_id blacklist_table[] = {
147 { USB_DEVICE(0x050d, 0x0012), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, 152 { USB_DEVICE(0x050d, 0x0012), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU },
148 { USB_DEVICE(0x050d, 0x0013), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU }, 153 { USB_DEVICE(0x050d, 0x0013), .driver_info = BTUSB_RESET | BTUSB_WRONG_SCO_MTU },
149 154
155 /* Belkin F8T016 device */
156 { USB_DEVICE(0x050d, 0x016a), .driver_info = BTUSB_RESET },
157
150 /* Digianswer devices */ 158 /* Digianswer devices */
151 { USB_DEVICE(0x08fd, 0x0001), .driver_info = BTUSB_DIGIANSWER }, 159 { USB_DEVICE(0x08fd, 0x0001), .driver_info = BTUSB_DIGIANSWER },
152 { USB_DEVICE(0x08fd, 0x0002), .driver_info = BTUSB_IGNORE }, 160 { USB_DEVICE(0x08fd, 0x0002), .driver_info = BTUSB_IGNORE },
@@ -169,6 +177,7 @@ static struct usb_device_id blacklist_table[] = {
169struct btusb_data { 177struct btusb_data {
170 struct hci_dev *hdev; 178 struct hci_dev *hdev;
171 struct usb_device *udev; 179 struct usb_device *udev;
180 struct usb_interface *intf;
172 struct usb_interface *isoc; 181 struct usb_interface *isoc;
173 182
174 spinlock_t lock; 183 spinlock_t lock;
@@ -267,7 +276,6 @@ static int btusb_submit_intr_urb(struct hci_dev *hdev)
267 BT_ERR("%s urb %p submission failed (%d)", 276 BT_ERR("%s urb %p submission failed (%d)",
268 hdev->name, urb, -err); 277 hdev->name, urb, -err);
269 usb_unanchor_urb(urb); 278 usb_unanchor_urb(urb);
270 kfree(buf);
271 } 279 }
272 280
273 usb_free_urb(urb); 281 usb_free_urb(urb);
@@ -350,7 +358,6 @@ static int btusb_submit_bulk_urb(struct hci_dev *hdev)
350 BT_ERR("%s urb %p submission failed (%d)", 358 BT_ERR("%s urb %p submission failed (%d)",
351 hdev->name, urb, -err); 359 hdev->name, urb, -err);
352 usb_unanchor_urb(urb); 360 usb_unanchor_urb(urb);
353 kfree(buf);
354 } 361 }
355 362
356 usb_free_urb(urb); 363 usb_free_urb(urb);
@@ -471,7 +478,6 @@ static int btusb_submit_isoc_urb(struct hci_dev *hdev)
471 BT_ERR("%s urb %p submission failed (%d)", 478 BT_ERR("%s urb %p submission failed (%d)",
472 hdev->name, urb, -err); 479 hdev->name, urb, -err);
473 usb_unanchor_urb(urb); 480 usb_unanchor_urb(urb);
474 kfree(buf);
475 } 481 }
476 482
477 usb_free_urb(urb); 483 usb_free_urb(urb);
@@ -516,7 +522,7 @@ static int btusb_open(struct hci_dev *hdev)
516 522
517 err = btusb_submit_intr_urb(hdev); 523 err = btusb_submit_intr_urb(hdev);
518 if (err < 0) { 524 if (err < 0) {
519 clear_bit(BTUSB_INTR_RUNNING, &hdev->flags); 525 clear_bit(BTUSB_INTR_RUNNING, &data->flags);
520 clear_bit(HCI_RUNNING, &hdev->flags); 526 clear_bit(HCI_RUNNING, &hdev->flags);
521 } 527 }
522 528
@@ -532,8 +538,10 @@ static int btusb_close(struct hci_dev *hdev)
532 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags)) 538 if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
533 return 0; 539 return 0;
534 540
541 cancel_work_sync(&data->work);
542
535 clear_bit(BTUSB_ISOC_RUNNING, &data->flags); 543 clear_bit(BTUSB_ISOC_RUNNING, &data->flags);
536 usb_kill_anchored_urbs(&data->intr_anchor); 544 usb_kill_anchored_urbs(&data->isoc_anchor);
537 545
538 clear_bit(BTUSB_BULK_RUNNING, &data->flags); 546 clear_bit(BTUSB_BULK_RUNNING, &data->flags);
539 usb_kill_anchored_urbs(&data->bulk_anchor); 547 usb_kill_anchored_urbs(&data->bulk_anchor);
@@ -821,6 +829,7 @@ static int btusb_probe(struct usb_interface *intf,
821 } 829 }
822 830
823 data->udev = interface_to_usbdev(intf); 831 data->udev = interface_to_usbdev(intf);
832 data->intf = intf;
824 833
825 spin_lock_init(&data->lock); 834 spin_lock_init(&data->lock);
826 835
@@ -889,7 +898,7 @@ static int btusb_probe(struct usb_interface *intf,
889 898
890 if (data->isoc) { 899 if (data->isoc) {
891 err = usb_driver_claim_interface(&btusb_driver, 900 err = usb_driver_claim_interface(&btusb_driver,
892 data->isoc, NULL); 901 data->isoc, data);
893 if (err < 0) { 902 if (err < 0) {
894 hci_free_dev(hdev); 903 hci_free_dev(hdev);
895 kfree(data); 904 kfree(data);
@@ -921,13 +930,22 @@ static void btusb_disconnect(struct usb_interface *intf)
921 930
922 hdev = data->hdev; 931 hdev = data->hdev;
923 932
924 if (data->isoc) 933 __hci_dev_hold(hdev);
925 usb_driver_release_interface(&btusb_driver, data->isoc);
926 934
927 usb_set_intfdata(intf, NULL); 935 usb_set_intfdata(data->intf, NULL);
936
937 if (data->isoc)
938 usb_set_intfdata(data->isoc, NULL);
928 939
929 hci_unregister_dev(hdev); 940 hci_unregister_dev(hdev);
930 941
942 if (intf == data->isoc)
943 usb_driver_release_interface(&btusb_driver, data->intf);
944 else if (data->isoc)
945 usb_driver_release_interface(&btusb_driver, data->isoc);
946
947 __hci_dev_put(hdev);
948
931 hci_free_dev(hdev); 949 hci_free_dev(hdev);
932} 950}
933 951
diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h
index 4bada0e8b812..46f507531177 100644
--- a/drivers/char/agp/agp.h
+++ b/drivers/char/agp/agp.h
@@ -116,7 +116,9 @@ struct agp_bridge_driver {
116 struct agp_memory *(*alloc_by_type) (size_t, int); 116 struct agp_memory *(*alloc_by_type) (size_t, int);
117 void (*free_by_type)(struct agp_memory *); 117 void (*free_by_type)(struct agp_memory *);
118 void *(*agp_alloc_page)(struct agp_bridge_data *); 118 void *(*agp_alloc_page)(struct agp_bridge_data *);
119 int (*agp_alloc_pages)(struct agp_bridge_data *, struct agp_memory *, size_t);
119 void (*agp_destroy_page)(void *, int flags); 120 void (*agp_destroy_page)(void *, int flags);
121 void (*agp_destroy_pages)(struct agp_memory *);
120 int (*agp_type_to_mask_type) (struct agp_bridge_data *, int); 122 int (*agp_type_to_mask_type) (struct agp_bridge_data *, int);
121 void (*chipset_flush)(struct agp_bridge_data *); 123 void (*chipset_flush)(struct agp_bridge_data *);
122}; 124};
@@ -277,7 +279,10 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type);
277struct agp_memory *agp_generic_alloc_by_type(size_t page_count, int type); 279struct agp_memory *agp_generic_alloc_by_type(size_t page_count, int type);
278void agp_generic_free_by_type(struct agp_memory *curr); 280void agp_generic_free_by_type(struct agp_memory *curr);
279void *agp_generic_alloc_page(struct agp_bridge_data *bridge); 281void *agp_generic_alloc_page(struct agp_bridge_data *bridge);
282int agp_generic_alloc_pages(struct agp_bridge_data *agp_bridge,
283 struct agp_memory *memory, size_t page_count);
280void agp_generic_destroy_page(void *addr, int flags); 284void agp_generic_destroy_page(void *addr, int flags);
285void agp_generic_destroy_pages(struct agp_memory *memory);
281void agp_free_key(int key); 286void agp_free_key(int key);
282int agp_num_entries(void); 287int agp_num_entries(void);
283u32 agp_collect_device_status(struct agp_bridge_data *bridge, u32 mode, u32 command); 288u32 agp_collect_device_status(struct agp_bridge_data *bridge, u32 mode, u32 command);
diff --git a/drivers/char/agp/alpha-agp.c b/drivers/char/agp/alpha-agp.c
index 5da89f6c6c25..5ea4da8e9954 100644
--- a/drivers/char/agp/alpha-agp.c
+++ b/drivers/char/agp/alpha-agp.c
@@ -143,7 +143,9 @@ struct agp_bridge_driver alpha_core_agp_driver = {
143 .alloc_by_type = agp_generic_alloc_by_type, 143 .alloc_by_type = agp_generic_alloc_by_type,
144 .free_by_type = agp_generic_free_by_type, 144 .free_by_type = agp_generic_free_by_type,
145 .agp_alloc_page = agp_generic_alloc_page, 145 .agp_alloc_page = agp_generic_alloc_page,
146 .agp_alloc_pages = agp_generic_alloc_pages,
146 .agp_destroy_page = agp_generic_destroy_page, 147 .agp_destroy_page = agp_generic_destroy_page,
148 .agp_destroy_pages = agp_generic_destroy_pages,
147 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 149 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
148}; 150};
149 151
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
index e280531843be..603a986e96af 100644
--- a/drivers/char/agp/amd-k7-agp.c
+++ b/drivers/char/agp/amd-k7-agp.c
@@ -386,7 +386,9 @@ static const struct agp_bridge_driver amd_irongate_driver = {
386 .alloc_by_type = agp_generic_alloc_by_type, 386 .alloc_by_type = agp_generic_alloc_by_type,
387 .free_by_type = agp_generic_free_by_type, 387 .free_by_type = agp_generic_free_by_type,
388 .agp_alloc_page = agp_generic_alloc_page, 388 .agp_alloc_page = agp_generic_alloc_page,
389 .agp_alloc_pages = agp_generic_alloc_pages,
389 .agp_destroy_page = agp_generic_destroy_page, 390 .agp_destroy_page = agp_generic_destroy_page,
391 .agp_destroy_pages = agp_generic_destroy_pages,
390 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 392 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
391}; 393};
392 394
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
index 7495c522d8e4..2812ee2b165a 100644
--- a/drivers/char/agp/amd64-agp.c
+++ b/drivers/char/agp/amd64-agp.c
@@ -224,7 +224,9 @@ static const struct agp_bridge_driver amd_8151_driver = {
224 .alloc_by_type = agp_generic_alloc_by_type, 224 .alloc_by_type = agp_generic_alloc_by_type,
225 .free_by_type = agp_generic_free_by_type, 225 .free_by_type = agp_generic_free_by_type,
226 .agp_alloc_page = agp_generic_alloc_page, 226 .agp_alloc_page = agp_generic_alloc_page,
227 .agp_alloc_pages = agp_generic_alloc_pages,
227 .agp_destroy_page = agp_generic_destroy_page, 228 .agp_destroy_page = agp_generic_destroy_page,
229 .agp_destroy_pages = agp_generic_destroy_pages,
228 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 230 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
229}; 231};
230 232
diff --git a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
index 6ecbcafb34b1..ae2791b926b9 100644
--- a/drivers/char/agp/ati-agp.c
+++ b/drivers/char/agp/ati-agp.c
@@ -418,7 +418,9 @@ static const struct agp_bridge_driver ati_generic_bridge = {
418 .alloc_by_type = agp_generic_alloc_by_type, 418 .alloc_by_type = agp_generic_alloc_by_type,
419 .free_by_type = agp_generic_free_by_type, 419 .free_by_type = agp_generic_free_by_type,
420 .agp_alloc_page = agp_generic_alloc_page, 420 .agp_alloc_page = agp_generic_alloc_page,
421 .agp_alloc_pages = agp_generic_alloc_pages,
421 .agp_destroy_page = agp_generic_destroy_page, 422 .agp_destroy_page = agp_generic_destroy_page,
423 .agp_destroy_pages = agp_generic_destroy_pages,
422 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 424 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
423}; 425};
424 426
diff --git a/drivers/char/agp/efficeon-agp.c b/drivers/char/agp/efficeon-agp.c
index 8ca6f262ef85..453543a1f293 100644
--- a/drivers/char/agp/efficeon-agp.c
+++ b/drivers/char/agp/efficeon-agp.c
@@ -335,7 +335,9 @@ static const struct agp_bridge_driver efficeon_driver = {
335 .alloc_by_type = agp_generic_alloc_by_type, 335 .alloc_by_type = agp_generic_alloc_by_type,
336 .free_by_type = agp_generic_free_by_type, 336 .free_by_type = agp_generic_free_by_type,
337 .agp_alloc_page = agp_generic_alloc_page, 337 .agp_alloc_page = agp_generic_alloc_page,
338 .agp_alloc_pages = agp_generic_alloc_pages,
338 .agp_destroy_page = agp_generic_destroy_page, 339 .agp_destroy_page = agp_generic_destroy_page,
340 .agp_destroy_pages = agp_generic_destroy_pages,
339 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 341 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
340}; 342};
341 343
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
index 118dbde25dc7..10d6cbd7c05e 100644
--- a/drivers/char/agp/generic.c
+++ b/drivers/char/agp/generic.c
@@ -201,14 +201,22 @@ void agp_free_memory(struct agp_memory *curr)
201 return; 201 return;
202 } 202 }
203 if (curr->page_count != 0) { 203 if (curr->page_count != 0) {
204 for (i = 0; i < curr->page_count; i++) { 204 if (curr->bridge->driver->agp_destroy_pages) {
205 curr->memory[i] = (unsigned long)gart_to_virt(curr->memory[i]); 205 curr->bridge->driver->agp_destroy_pages(curr);
206 curr->bridge->driver->agp_destroy_page((void *)curr->memory[i], 206 } else {
207 AGP_PAGE_DESTROY_UNMAP); 207
208 } 208 for (i = 0; i < curr->page_count; i++) {
209 for (i = 0; i < curr->page_count; i++) { 209 curr->memory[i] = (unsigned long)gart_to_virt(
210 curr->bridge->driver->agp_destroy_page((void *)curr->memory[i], 210 curr->memory[i]);
211 AGP_PAGE_DESTROY_FREE); 211 curr->bridge->driver->agp_destroy_page(
212 (void *)curr->memory[i],
213 AGP_PAGE_DESTROY_UNMAP);
214 }
215 for (i = 0; i < curr->page_count; i++) {
216 curr->bridge->driver->agp_destroy_page(
217 (void *)curr->memory[i],
218 AGP_PAGE_DESTROY_FREE);
219 }
212 } 220 }
213 } 221 }
214 agp_free_key(curr->key); 222 agp_free_key(curr->key);
@@ -264,6 +272,15 @@ struct agp_memory *agp_allocate_memory(struct agp_bridge_data *bridge,
264 if (new == NULL) 272 if (new == NULL)
265 return NULL; 273 return NULL;
266 274
275 if (bridge->driver->agp_alloc_pages) {
276 if (bridge->driver->agp_alloc_pages(bridge, new, page_count)) {
277 agp_free_memory(new);
278 return NULL;
279 }
280 new->bridge = bridge;
281 return new;
282 }
283
267 for (i = 0; i < page_count; i++) { 284 for (i = 0; i < page_count; i++) {
268 void *addr = bridge->driver->agp_alloc_page(bridge); 285 void *addr = bridge->driver->agp_alloc_page(bridge);
269 286
@@ -1203,6 +1220,39 @@ EXPORT_SYMBOL(agp_generic_alloc_user);
1203 * against a maximum value. 1220 * against a maximum value.
1204 */ 1221 */
1205 1222
1223int agp_generic_alloc_pages(struct agp_bridge_data *bridge, struct agp_memory *mem, size_t num_pages)
1224{
1225 struct page * page;
1226 int i, ret = -ENOMEM;
1227
1228 for (i = 0; i < num_pages; i++) {
1229 page = alloc_page(GFP_KERNEL | GFP_DMA32);
1230 /* agp_free_memory() needs gart address */
1231 if (page == NULL)
1232 goto out;
1233
1234#ifndef CONFIG_X86
1235 map_page_into_agp(page);
1236#endif
1237 get_page(page);
1238 atomic_inc(&agp_bridge->current_memory_agp);
1239
1240 /* set_memory_array_uc() needs virtual address */
1241 mem->memory[i] = (unsigned long)page_address(page);
1242 mem->page_count++;
1243 }
1244
1245#ifdef CONFIG_X86
1246 set_memory_array_uc(mem->memory, num_pages);
1247#endif
1248 ret = 0;
1249out:
1250 for (i = 0; i < mem->page_count; i++)
1251 mem->memory[i] = virt_to_gart((void *)mem->memory[i]);
1252 return ret;
1253}
1254EXPORT_SYMBOL(agp_generic_alloc_pages);
1255
1206void *agp_generic_alloc_page(struct agp_bridge_data *bridge) 1256void *agp_generic_alloc_page(struct agp_bridge_data *bridge)
1207{ 1257{
1208 struct page * page; 1258 struct page * page;
@@ -1219,6 +1269,37 @@ void *agp_generic_alloc_page(struct agp_bridge_data *bridge)
1219} 1269}
1220EXPORT_SYMBOL(agp_generic_alloc_page); 1270EXPORT_SYMBOL(agp_generic_alloc_page);
1221 1271
1272void agp_generic_destroy_pages(struct agp_memory *mem)
1273{
1274 int i;
1275 void *addr;
1276 struct page *page;
1277
1278 if (!mem)
1279 return;
1280
1281 for (i = 0; i < mem->page_count; i++)
1282 mem->memory[i] = (unsigned long)gart_to_virt(mem->memory[i]);
1283
1284#ifdef CONFIG_X86
1285 set_memory_array_wb(mem->memory, mem->page_count);
1286#endif
1287
1288 for (i = 0; i < mem->page_count; i++) {
1289 addr = (void *)mem->memory[i];
1290 page = virt_to_page(addr);
1291
1292#ifndef CONFIG_X86
1293 unmap_page_from_agp(page);
1294#endif
1295
1296 put_page(page);
1297 free_page((unsigned long)addr);
1298 atomic_dec(&agp_bridge->current_memory_agp);
1299 mem->memory[i] = 0;
1300 }
1301}
1302EXPORT_SYMBOL(agp_generic_destroy_pages);
1222 1303
1223void agp_generic_destroy_page(void *addr, int flags) 1304void agp_generic_destroy_page(void *addr, int flags)
1224{ 1305{
diff --git a/drivers/char/agp/hp-agp.c b/drivers/char/agp/hp-agp.c
index 80d7317f85c9..183ac3fe44fb 100644
--- a/drivers/char/agp/hp-agp.c
+++ b/drivers/char/agp/hp-agp.c
@@ -435,7 +435,9 @@ const struct agp_bridge_driver hp_zx1_driver = {
435 .alloc_by_type = agp_generic_alloc_by_type, 435 .alloc_by_type = agp_generic_alloc_by_type,
436 .free_by_type = agp_generic_free_by_type, 436 .free_by_type = agp_generic_free_by_type,
437 .agp_alloc_page = agp_generic_alloc_page, 437 .agp_alloc_page = agp_generic_alloc_page,
438 .agp_alloc_pages = agp_generic_alloc_pages,
438 .agp_destroy_page = agp_generic_destroy_page, 439 .agp_destroy_page = agp_generic_destroy_page,
440 .agp_destroy_pages = agp_generic_destroy_pages,
439 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 441 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
440 .cant_use_aperture = true, 442 .cant_use_aperture = true,
441}; 443};
diff --git a/drivers/char/agp/i460-agp.c b/drivers/char/agp/i460-agp.c
index e587eebebc67..10da687d131a 100644
--- a/drivers/char/agp/i460-agp.c
+++ b/drivers/char/agp/i460-agp.c
@@ -575,7 +575,9 @@ const struct agp_bridge_driver intel_i460_driver = {
575 .insert_memory = i460_insert_memory_small_io_page, 575 .insert_memory = i460_insert_memory_small_io_page,
576 .remove_memory = i460_remove_memory_small_io_page, 576 .remove_memory = i460_remove_memory_small_io_page,
577 .agp_alloc_page = agp_generic_alloc_page, 577 .agp_alloc_page = agp_generic_alloc_page,
578 .agp_alloc_pages = agp_generic_alloc_pages,
578 .agp_destroy_page = agp_generic_destroy_page, 579 .agp_destroy_page = agp_generic_destroy_page,
580 .agp_destroy_pages = agp_generic_destroy_pages,
579#endif 581#endif
580 .alloc_by_type = agp_generic_alloc_by_type, 582 .alloc_by_type = agp_generic_alloc_by_type,
581 .free_by_type = agp_generic_free_by_type, 583 .free_by_type = agp_generic_free_by_type,
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
index 016fdf0623a4..043e36628d6d 100644
--- a/drivers/char/agp/intel-agp.c
+++ b/drivers/char/agp/intel-agp.c
@@ -1711,7 +1711,9 @@ static const struct agp_bridge_driver intel_generic_driver = {
1711 .alloc_by_type = agp_generic_alloc_by_type, 1711 .alloc_by_type = agp_generic_alloc_by_type,
1712 .free_by_type = agp_generic_free_by_type, 1712 .free_by_type = agp_generic_free_by_type,
1713 .agp_alloc_page = agp_generic_alloc_page, 1713 .agp_alloc_page = agp_generic_alloc_page,
1714 .agp_alloc_pages = agp_generic_alloc_pages,
1714 .agp_destroy_page = agp_generic_destroy_page, 1715 .agp_destroy_page = agp_generic_destroy_page,
1716 .agp_destroy_pages = agp_generic_destroy_pages,
1715 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1717 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1716}; 1718};
1717 1719
@@ -1736,7 +1738,9 @@ static const struct agp_bridge_driver intel_810_driver = {
1736 .alloc_by_type = intel_i810_alloc_by_type, 1738 .alloc_by_type = intel_i810_alloc_by_type,
1737 .free_by_type = intel_i810_free_by_type, 1739 .free_by_type = intel_i810_free_by_type,
1738 .agp_alloc_page = agp_generic_alloc_page, 1740 .agp_alloc_page = agp_generic_alloc_page,
1741 .agp_alloc_pages = agp_generic_alloc_pages,
1739 .agp_destroy_page = agp_generic_destroy_page, 1742 .agp_destroy_page = agp_generic_destroy_page,
1743 .agp_destroy_pages = agp_generic_destroy_pages,
1740 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1744 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1741}; 1745};
1742 1746
@@ -1760,7 +1764,9 @@ static const struct agp_bridge_driver intel_815_driver = {
1760 .alloc_by_type = agp_generic_alloc_by_type, 1764 .alloc_by_type = agp_generic_alloc_by_type,
1761 .free_by_type = agp_generic_free_by_type, 1765 .free_by_type = agp_generic_free_by_type,
1762 .agp_alloc_page = agp_generic_alloc_page, 1766 .agp_alloc_page = agp_generic_alloc_page,
1767 .agp_alloc_pages = agp_generic_alloc_pages,
1763 .agp_destroy_page = agp_generic_destroy_page, 1768 .agp_destroy_page = agp_generic_destroy_page,
1769 .agp_destroy_pages = agp_generic_destroy_pages,
1764 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1770 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1765}; 1771};
1766 1772
@@ -1785,7 +1791,9 @@ static const struct agp_bridge_driver intel_830_driver = {
1785 .alloc_by_type = intel_i830_alloc_by_type, 1791 .alloc_by_type = intel_i830_alloc_by_type,
1786 .free_by_type = intel_i810_free_by_type, 1792 .free_by_type = intel_i810_free_by_type,
1787 .agp_alloc_page = agp_generic_alloc_page, 1793 .agp_alloc_page = agp_generic_alloc_page,
1794 .agp_alloc_pages = agp_generic_alloc_pages,
1788 .agp_destroy_page = agp_generic_destroy_page, 1795 .agp_destroy_page = agp_generic_destroy_page,
1796 .agp_destroy_pages = agp_generic_destroy_pages,
1789 .agp_type_to_mask_type = intel_i830_type_to_mask_type, 1797 .agp_type_to_mask_type = intel_i830_type_to_mask_type,
1790 .chipset_flush = intel_i830_chipset_flush, 1798 .chipset_flush = intel_i830_chipset_flush,
1791}; 1799};
@@ -1810,7 +1818,9 @@ static const struct agp_bridge_driver intel_820_driver = {
1810 .alloc_by_type = agp_generic_alloc_by_type, 1818 .alloc_by_type = agp_generic_alloc_by_type,
1811 .free_by_type = agp_generic_free_by_type, 1819 .free_by_type = agp_generic_free_by_type,
1812 .agp_alloc_page = agp_generic_alloc_page, 1820 .agp_alloc_page = agp_generic_alloc_page,
1821 .agp_alloc_pages = agp_generic_alloc_pages,
1813 .agp_destroy_page = agp_generic_destroy_page, 1822 .agp_destroy_page = agp_generic_destroy_page,
1823 .agp_destroy_pages = agp_generic_destroy_pages,
1814 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1824 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1815}; 1825};
1816 1826
@@ -1834,7 +1844,9 @@ static const struct agp_bridge_driver intel_830mp_driver = {
1834 .alloc_by_type = agp_generic_alloc_by_type, 1844 .alloc_by_type = agp_generic_alloc_by_type,
1835 .free_by_type = agp_generic_free_by_type, 1845 .free_by_type = agp_generic_free_by_type,
1836 .agp_alloc_page = agp_generic_alloc_page, 1846 .agp_alloc_page = agp_generic_alloc_page,
1847 .agp_alloc_pages = agp_generic_alloc_pages,
1837 .agp_destroy_page = agp_generic_destroy_page, 1848 .agp_destroy_page = agp_generic_destroy_page,
1849 .agp_destroy_pages = agp_generic_destroy_pages,
1838 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1850 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1839}; 1851};
1840 1852
@@ -1858,7 +1870,9 @@ static const struct agp_bridge_driver intel_840_driver = {
1858 .alloc_by_type = agp_generic_alloc_by_type, 1870 .alloc_by_type = agp_generic_alloc_by_type,
1859 .free_by_type = agp_generic_free_by_type, 1871 .free_by_type = agp_generic_free_by_type,
1860 .agp_alloc_page = agp_generic_alloc_page, 1872 .agp_alloc_page = agp_generic_alloc_page,
1873 .agp_alloc_pages = agp_generic_alloc_pages,
1861 .agp_destroy_page = agp_generic_destroy_page, 1874 .agp_destroy_page = agp_generic_destroy_page,
1875 .agp_destroy_pages = agp_generic_destroy_pages,
1862 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1876 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1863}; 1877};
1864 1878
@@ -1882,7 +1896,9 @@ static const struct agp_bridge_driver intel_845_driver = {
1882 .alloc_by_type = agp_generic_alloc_by_type, 1896 .alloc_by_type = agp_generic_alloc_by_type,
1883 .free_by_type = agp_generic_free_by_type, 1897 .free_by_type = agp_generic_free_by_type,
1884 .agp_alloc_page = agp_generic_alloc_page, 1898 .agp_alloc_page = agp_generic_alloc_page,
1899 .agp_alloc_pages = agp_generic_alloc_pages,
1885 .agp_destroy_page = agp_generic_destroy_page, 1900 .agp_destroy_page = agp_generic_destroy_page,
1901 .agp_destroy_pages = agp_generic_destroy_pages,
1886 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1902 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1887 .chipset_flush = intel_i830_chipset_flush, 1903 .chipset_flush = intel_i830_chipset_flush,
1888}; 1904};
@@ -1907,7 +1923,9 @@ static const struct agp_bridge_driver intel_850_driver = {
1907 .alloc_by_type = agp_generic_alloc_by_type, 1923 .alloc_by_type = agp_generic_alloc_by_type,
1908 .free_by_type = agp_generic_free_by_type, 1924 .free_by_type = agp_generic_free_by_type,
1909 .agp_alloc_page = agp_generic_alloc_page, 1925 .agp_alloc_page = agp_generic_alloc_page,
1926 .agp_alloc_pages = agp_generic_alloc_pages,
1910 .agp_destroy_page = agp_generic_destroy_page, 1927 .agp_destroy_page = agp_generic_destroy_page,
1928 .agp_destroy_pages = agp_generic_destroy_pages,
1911 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1929 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1912}; 1930};
1913 1931
@@ -1931,7 +1949,9 @@ static const struct agp_bridge_driver intel_860_driver = {
1931 .alloc_by_type = agp_generic_alloc_by_type, 1949 .alloc_by_type = agp_generic_alloc_by_type,
1932 .free_by_type = agp_generic_free_by_type, 1950 .free_by_type = agp_generic_free_by_type,
1933 .agp_alloc_page = agp_generic_alloc_page, 1951 .agp_alloc_page = agp_generic_alloc_page,
1952 .agp_alloc_pages = agp_generic_alloc_pages,
1934 .agp_destroy_page = agp_generic_destroy_page, 1953 .agp_destroy_page = agp_generic_destroy_page,
1954 .agp_destroy_pages = agp_generic_destroy_pages,
1935 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 1955 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
1936}; 1956};
1937 1957
@@ -1956,7 +1976,9 @@ static const struct agp_bridge_driver intel_915_driver = {
1956 .alloc_by_type = intel_i830_alloc_by_type, 1976 .alloc_by_type = intel_i830_alloc_by_type,
1957 .free_by_type = intel_i810_free_by_type, 1977 .free_by_type = intel_i810_free_by_type,
1958 .agp_alloc_page = agp_generic_alloc_page, 1978 .agp_alloc_page = agp_generic_alloc_page,
1979 .agp_alloc_pages = agp_generic_alloc_pages,
1959 .agp_destroy_page = agp_generic_destroy_page, 1980 .agp_destroy_page = agp_generic_destroy_page,
1981 .agp_destroy_pages = agp_generic_destroy_pages,
1960 .agp_type_to_mask_type = intel_i830_type_to_mask_type, 1982 .agp_type_to_mask_type = intel_i830_type_to_mask_type,
1961 .chipset_flush = intel_i915_chipset_flush, 1983 .chipset_flush = intel_i915_chipset_flush,
1962}; 1984};
@@ -1982,7 +2004,9 @@ static const struct agp_bridge_driver intel_i965_driver = {
1982 .alloc_by_type = intel_i830_alloc_by_type, 2004 .alloc_by_type = intel_i830_alloc_by_type,
1983 .free_by_type = intel_i810_free_by_type, 2005 .free_by_type = intel_i810_free_by_type,
1984 .agp_alloc_page = agp_generic_alloc_page, 2006 .agp_alloc_page = agp_generic_alloc_page,
2007 .agp_alloc_pages = agp_generic_alloc_pages,
1985 .agp_destroy_page = agp_generic_destroy_page, 2008 .agp_destroy_page = agp_generic_destroy_page,
2009 .agp_destroy_pages = agp_generic_destroy_pages,
1986 .agp_type_to_mask_type = intel_i830_type_to_mask_type, 2010 .agp_type_to_mask_type = intel_i830_type_to_mask_type,
1987 .chipset_flush = intel_i915_chipset_flush, 2011 .chipset_flush = intel_i915_chipset_flush,
1988}; 2012};
@@ -2007,7 +2031,9 @@ static const struct agp_bridge_driver intel_7505_driver = {
2007 .alloc_by_type = agp_generic_alloc_by_type, 2031 .alloc_by_type = agp_generic_alloc_by_type,
2008 .free_by_type = agp_generic_free_by_type, 2032 .free_by_type = agp_generic_free_by_type,
2009 .agp_alloc_page = agp_generic_alloc_page, 2033 .agp_alloc_page = agp_generic_alloc_page,
2034 .agp_alloc_pages = agp_generic_alloc_pages,
2010 .agp_destroy_page = agp_generic_destroy_page, 2035 .agp_destroy_page = agp_generic_destroy_page,
2036 .agp_destroy_pages = agp_generic_destroy_pages,
2011 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 2037 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
2012}; 2038};
2013 2039
@@ -2032,7 +2058,9 @@ static const struct agp_bridge_driver intel_g33_driver = {
2032 .alloc_by_type = intel_i830_alloc_by_type, 2058 .alloc_by_type = intel_i830_alloc_by_type,
2033 .free_by_type = intel_i810_free_by_type, 2059 .free_by_type = intel_i810_free_by_type,
2034 .agp_alloc_page = agp_generic_alloc_page, 2060 .agp_alloc_page = agp_generic_alloc_page,
2061 .agp_alloc_pages = agp_generic_alloc_pages,
2035 .agp_destroy_page = agp_generic_destroy_page, 2062 .agp_destroy_page = agp_generic_destroy_page,
2063 .agp_destroy_pages = agp_generic_destroy_pages,
2036 .agp_type_to_mask_type = intel_i830_type_to_mask_type, 2064 .agp_type_to_mask_type = intel_i830_type_to_mask_type,
2037 .chipset_flush = intel_i915_chipset_flush, 2065 .chipset_flush = intel_i915_chipset_flush,
2038}; 2066};
diff --git a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c
index eaceb61ba2dc..dc70d3771811 100644
--- a/drivers/char/agp/nvidia-agp.c
+++ b/drivers/char/agp/nvidia-agp.c
@@ -312,7 +312,9 @@ static const struct agp_bridge_driver nvidia_driver = {
312 .alloc_by_type = agp_generic_alloc_by_type, 312 .alloc_by_type = agp_generic_alloc_by_type,
313 .free_by_type = agp_generic_free_by_type, 313 .free_by_type = agp_generic_free_by_type,
314 .agp_alloc_page = agp_generic_alloc_page, 314 .agp_alloc_page = agp_generic_alloc_page,
315 .agp_alloc_pages = agp_generic_alloc_pages,
315 .agp_destroy_page = agp_generic_destroy_page, 316 .agp_destroy_page = agp_generic_destroy_page,
317 .agp_destroy_pages = agp_generic_destroy_pages,
316 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 318 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
317}; 319};
318 320
diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c
index 8c42dcc5958c..f2492ecf0824 100644
--- a/drivers/char/agp/parisc-agp.c
+++ b/drivers/char/agp/parisc-agp.c
@@ -224,7 +224,9 @@ static const struct agp_bridge_driver parisc_agp_driver = {
224 .alloc_by_type = agp_generic_alloc_by_type, 224 .alloc_by_type = agp_generic_alloc_by_type,
225 .free_by_type = agp_generic_free_by_type, 225 .free_by_type = agp_generic_free_by_type,
226 .agp_alloc_page = agp_generic_alloc_page, 226 .agp_alloc_page = agp_generic_alloc_page,
227 .agp_alloc_pages = agp_generic_alloc_pages,
227 .agp_destroy_page = agp_generic_destroy_page, 228 .agp_destroy_page = agp_generic_destroy_page,
229 .agp_destroy_pages = agp_generic_destroy_pages,
228 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 230 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
229 .cant_use_aperture = true, 231 .cant_use_aperture = true,
230}; 232};
diff --git a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c
index 2587ef96a960..6c3837a0184d 100644
--- a/drivers/char/agp/sis-agp.c
+++ b/drivers/char/agp/sis-agp.c
@@ -140,7 +140,9 @@ static struct agp_bridge_driver sis_driver = {
140 .alloc_by_type = agp_generic_alloc_by_type, 140 .alloc_by_type = agp_generic_alloc_by_type,
141 .free_by_type = agp_generic_free_by_type, 141 .free_by_type = agp_generic_free_by_type,
142 .agp_alloc_page = agp_generic_alloc_page, 142 .agp_alloc_page = agp_generic_alloc_page,
143 .agp_alloc_pages = agp_generic_alloc_pages,
143 .agp_destroy_page = agp_generic_destroy_page, 144 .agp_destroy_page = agp_generic_destroy_page,
145 .agp_destroy_pages = agp_generic_destroy_pages,
144 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 146 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
145}; 147};
146 148
diff --git a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c
index 2fb27fe4c10c..6224df8b7f0a 100644
--- a/drivers/char/agp/sworks-agp.c
+++ b/drivers/char/agp/sworks-agp.c
@@ -437,7 +437,9 @@ static const struct agp_bridge_driver sworks_driver = {
437 .alloc_by_type = agp_generic_alloc_by_type, 437 .alloc_by_type = agp_generic_alloc_by_type,
438 .free_by_type = agp_generic_free_by_type, 438 .free_by_type = agp_generic_free_by_type,
439 .agp_alloc_page = agp_generic_alloc_page, 439 .agp_alloc_page = agp_generic_alloc_page,
440 .agp_alloc_pages = agp_generic_alloc_pages,
440 .agp_destroy_page = agp_generic_destroy_page, 441 .agp_destroy_page = agp_generic_destroy_page,
442 .agp_destroy_pages = agp_generic_destroy_pages,
441 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 443 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
442}; 444};
443 445
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
index eef72709ec53..0f004b65ec03 100644
--- a/drivers/char/agp/uninorth-agp.c
+++ b/drivers/char/agp/uninorth-agp.c
@@ -509,7 +509,9 @@ const struct agp_bridge_driver uninorth_agp_driver = {
509 .alloc_by_type = agp_generic_alloc_by_type, 509 .alloc_by_type = agp_generic_alloc_by_type,
510 .free_by_type = agp_generic_free_by_type, 510 .free_by_type = agp_generic_free_by_type,
511 .agp_alloc_page = agp_generic_alloc_page, 511 .agp_alloc_page = agp_generic_alloc_page,
512 .agp_alloc_pages = agp_generic_alloc_pages,
512 .agp_destroy_page = agp_generic_destroy_page, 513 .agp_destroy_page = agp_generic_destroy_page,
514 .agp_destroy_pages = agp_generic_destroy_pages,
513 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 515 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
514 .cant_use_aperture = true, 516 .cant_use_aperture = true,
515}; 517};
@@ -534,7 +536,9 @@ const struct agp_bridge_driver u3_agp_driver = {
534 .alloc_by_type = agp_generic_alloc_by_type, 536 .alloc_by_type = agp_generic_alloc_by_type,
535 .free_by_type = agp_generic_free_by_type, 537 .free_by_type = agp_generic_free_by_type,
536 .agp_alloc_page = agp_generic_alloc_page, 538 .agp_alloc_page = agp_generic_alloc_page,
539 .agp_alloc_pages = agp_generic_alloc_pages,
537 .agp_destroy_page = agp_generic_destroy_page, 540 .agp_destroy_page = agp_generic_destroy_page,
541 .agp_destroy_pages = agp_generic_destroy_pages,
538 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 542 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
539 .cant_use_aperture = true, 543 .cant_use_aperture = true,
540 .needs_scratch_page = true, 544 .needs_scratch_page = true,
diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c
index 7b36476dff41..9f4d49e1b59a 100644
--- a/drivers/char/agp/via-agp.c
+++ b/drivers/char/agp/via-agp.c
@@ -190,7 +190,9 @@ static const struct agp_bridge_driver via_agp3_driver = {
190 .alloc_by_type = agp_generic_alloc_by_type, 190 .alloc_by_type = agp_generic_alloc_by_type,
191 .free_by_type = agp_generic_free_by_type, 191 .free_by_type = agp_generic_free_by_type,
192 .agp_alloc_page = agp_generic_alloc_page, 192 .agp_alloc_page = agp_generic_alloc_page,
193 .agp_alloc_pages = agp_generic_alloc_pages,
193 .agp_destroy_page = agp_generic_destroy_page, 194 .agp_destroy_page = agp_generic_destroy_page,
195 .agp_destroy_pages = agp_generic_destroy_pages,
194 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 196 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
195}; 197};
196 198
@@ -214,7 +216,9 @@ static const struct agp_bridge_driver via_driver = {
214 .alloc_by_type = agp_generic_alloc_by_type, 216 .alloc_by_type = agp_generic_alloc_by_type,
215 .free_by_type = agp_generic_free_by_type, 217 .free_by_type = agp_generic_free_by_type,
216 .agp_alloc_page = agp_generic_alloc_page, 218 .agp_alloc_page = agp_generic_alloc_page,
219 .agp_alloc_pages = agp_generic_alloc_pages,
217 .agp_destroy_page = agp_generic_destroy_page, 220 .agp_destroy_page = agp_generic_destroy_page,
221 .agp_destroy_pages = agp_generic_destroy_pages,
218 .agp_type_to_mask_type = agp_generic_type_to_mask_type, 222 .agp_type_to_mask_type = agp_generic_type_to_mask_type,
219}; 223};
220 224
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index daeb8f766971..e4dce8709541 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -695,13 +695,23 @@ struct tty_driver *tty_find_polling_driver(char *name, int *line)
695{ 695{
696 struct tty_driver *p, *res = NULL; 696 struct tty_driver *p, *res = NULL;
697 int tty_line = 0; 697 int tty_line = 0;
698 int len;
698 char *str; 699 char *str;
699 700
701 for (str = name; *str; str++)
702 if ((*str >= '0' && *str <= '9') || *str == ',')
703 break;
704 if (!*str)
705 return NULL;
706
707 len = str - name;
708 tty_line = simple_strtoul(str, &str, 10);
709
700 mutex_lock(&tty_mutex); 710 mutex_lock(&tty_mutex);
701 /* Search through the tty devices to look for a match */ 711 /* Search through the tty devices to look for a match */
702 list_for_each_entry(p, &tty_drivers, tty_drivers) { 712 list_for_each_entry(p, &tty_drivers, tty_drivers) {
703 str = name + strlen(p->name); 713 if (strncmp(name, p->name, len) != 0)
704 tty_line = simple_strtoul(str, &str, 10); 714 continue;
705 if (*str == ',') 715 if (*str == ',')
706 str++; 716 str++;
707 if (*str == '\0') 717 if (*str == '\0')
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c
index 4eee533f3f4a..71d2ac4e3f46 100644
--- a/drivers/clocksource/acpi_pm.c
+++ b/drivers/clocksource/acpi_pm.c
@@ -178,11 +178,13 @@ static int verify_pmtmr_rate(void)
178 178
179/* Number of monotonicity checks to perform during initialization */ 179/* Number of monotonicity checks to perform during initialization */
180#define ACPI_PM_MONOTONICITY_CHECKS 10 180#define ACPI_PM_MONOTONICITY_CHECKS 10
181/* Number of reads we try to get two different values */
182#define ACPI_PM_READ_CHECKS 10000
181 183
182static int __init init_acpi_pm_clocksource(void) 184static int __init init_acpi_pm_clocksource(void)
183{ 185{
184 cycle_t value1, value2; 186 cycle_t value1, value2;
185 unsigned int i, j, good = 0; 187 unsigned int i, j = 0;
186 188
187 if (!pmtmr_ioport) 189 if (!pmtmr_ioport)
188 return -ENODEV; 190 return -ENODEV;
@@ -192,29 +194,26 @@ static int __init init_acpi_pm_clocksource(void)
192 194
193 /* "verify" this timing source: */ 195 /* "verify" this timing source: */
194 for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) { 196 for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) {
197 udelay(100 * j);
195 value1 = clocksource_acpi_pm.read(); 198 value1 = clocksource_acpi_pm.read();
196 for (i = 0; i < 10000; i++) { 199 for (i = 0; i < ACPI_PM_READ_CHECKS; i++) {
197 value2 = clocksource_acpi_pm.read(); 200 value2 = clocksource_acpi_pm.read();
198 if (value2 == value1) 201 if (value2 == value1)
199 continue; 202 continue;
200 if (value2 > value1) 203 if (value2 > value1)
201 good++;
202 break; 204 break;
203 if ((value2 < value1) && ((value2) < 0xFFF)) 205 if ((value2 < value1) && ((value2) < 0xFFF))
204 good++;
205 break; 206 break;
206 printk(KERN_INFO "PM-Timer had inconsistent results:" 207 printk(KERN_INFO "PM-Timer had inconsistent results:"
207 " 0x%#llx, 0x%#llx - aborting.\n", 208 " 0x%#llx, 0x%#llx - aborting.\n",
208 value1, value2); 209 value1, value2);
209 return -EINVAL; 210 return -EINVAL;
210 } 211 }
211 udelay(300 * i); 212 if (i == ACPI_PM_READ_CHECKS) {
212 } 213 printk(KERN_INFO "PM-Timer failed consistency check "
213 214 " (0x%#llx) - aborting.\n", value1);
214 if (good != ACPI_PM_MONOTONICITY_CHECKS) { 215 return -ENODEV;
215 printk(KERN_INFO "PM-Timer failed consistency check " 216 }
216 " (0x%#llx) - aborting.\n", value1);
217 return -ENODEV;
218 } 217 }
219 218
220 if (verify_pmtmr_rate() != 0) 219 if (verify_pmtmr_rate() != 0)
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index ee827a7f7c6a..b6ad3ac5916e 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -1157,6 +1157,8 @@ static int aead_authenc_givencrypt(
1157 edesc->desc.hdr = ctx->desc_hdr_template | DESC_HDR_MODE0_ENCRYPT; 1157 edesc->desc.hdr = ctx->desc_hdr_template | DESC_HDR_MODE0_ENCRYPT;
1158 1158
1159 memcpy(req->giv, ctx->iv, crypto_aead_ivsize(authenc)); 1159 memcpy(req->giv, ctx->iv, crypto_aead_ivsize(authenc));
1160 /* avoid consecutive packets going out with same IV */
1161 *(__be64 *)req->giv ^= cpu_to_be64(req->seq);
1160 1162
1161 return ipsec_esp(edesc, areq, req->giv, req->seq, 1163 return ipsec_esp(edesc, areq, req->giv, req->seq,
1162 ipsec_esp_encrypt_done); 1164 ipsec_esp_encrypt_done);
@@ -1449,6 +1451,8 @@ static int talitos_probe(struct of_device *ofdev,
1449 1451
1450 priv->ofdev = ofdev; 1452 priv->ofdev = ofdev;
1451 1453
1454 INIT_LIST_HEAD(&priv->alg_list);
1455
1452 tasklet_init(&priv->done_task, talitos_done, (unsigned long)dev); 1456 tasklet_init(&priv->done_task, talitos_done, (unsigned long)dev);
1453 tasklet_init(&priv->error_task, talitos_error, (unsigned long)dev); 1457 tasklet_init(&priv->error_task, talitos_error, (unsigned long)dev);
1454 1458
@@ -1575,8 +1579,6 @@ static int talitos_probe(struct of_device *ofdev,
1575 } 1579 }
1576 1580
1577 /* register crypto algorithms the device supports */ 1581 /* register crypto algorithms the device supports */
1578 INIT_LIST_HEAD(&priv->alg_list);
1579
1580 for (i = 0; i < ARRAY_SIZE(driver_algs); i++) { 1582 for (i = 0; i < ARRAY_SIZE(driver_algs); i++) {
1581 if (hw_supports(dev, driver_algs[i].desc_hdr_template)) { 1583 if (hw_supports(dev, driver_algs[i].desc_hdr_template)) {
1582 struct talitos_crypto_alg *t_alg; 1584 struct talitos_crypto_alg *t_alg;
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 94df91771243..0778d99aea7c 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -364,7 +364,7 @@ static void dw_dma_tasklet(unsigned long data)
364 int i; 364 int i;
365 365
366 status_block = dma_readl(dw, RAW.BLOCK); 366 status_block = dma_readl(dw, RAW.BLOCK);
367 status_xfer = dma_readl(dw, RAW.BLOCK); 367 status_xfer = dma_readl(dw, RAW.XFER);
368 status_err = dma_readl(dw, RAW.ERROR); 368 status_err = dma_readl(dw, RAW.ERROR);
369 369
370 dev_vdbg(dw->dma.dev, "tasklet: status_block=%x status_err=%x\n", 370 dev_vdbg(dw->dma.dev, "tasklet: status_block=%x status_err=%x\n",
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c
index d568c65c1370..d9e7a49d6cbf 100644
--- a/drivers/hwmon/abituguru3.c
+++ b/drivers/hwmon/abituguru3.c
@@ -279,7 +279,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
279 { "OTES1 Fan", 36, 2, 60, 1, 0 }, 279 { "OTES1 Fan", 36, 2, 60, 1, 0 },
280 { NULL, 0, 0, 0, 0, 0 } } 280 { NULL, 0, 0, 0, 0, 0 } }
281 }, 281 },
282 { 0x0011, NULL /* Abit AT8 32X, need DMI string */, { 282 { 0x0011, "AT8 32X(ATI RD580-ULI M1575)", {
283 { "CPU Core", 0, 0, 10, 1, 0 }, 283 { "CPU Core", 0, 0, 10, 1, 0 },
284 { "DDR", 1, 0, 20, 1, 0 }, 284 { "DDR", 1, 0, 20, 1, 0 },
285 { "DDR VTT", 2, 0, 10, 1, 0 }, 285 { "DDR VTT", 2, 0, 10, 1, 0 },
@@ -303,6 +303,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = {
303 { "SYS Fan", 34, 2, 60, 1, 0 }, 303 { "SYS Fan", 34, 2, 60, 1, 0 },
304 { "AUX1 Fan", 35, 2, 60, 1, 0 }, 304 { "AUX1 Fan", 35, 2, 60, 1, 0 },
305 { "AUX2 Fan", 36, 2, 60, 1, 0 }, 305 { "AUX2 Fan", 36, 2, 60, 1, 0 },
306 { "AUX3 Fan", 37, 2, 60, 1, 0 },
306 { NULL, 0, 0, 0, 0, 0 } } 307 { NULL, 0, 0, 0, 0, 0 } }
307 }, 308 },
308 { 0x0012, NULL /* Abit AN8 32X, need DMI string */, { 309 { 0x0012, NULL /* Abit AN8 32X, need DMI string */, {
diff --git a/drivers/hwmon/ad7414.c b/drivers/hwmon/ad7414.c
index ce8d94fbfd7e..bfda8c80ef24 100644
--- a/drivers/hwmon/ad7414.c
+++ b/drivers/hwmon/ad7414.c
@@ -69,7 +69,7 @@ static inline int ad7414_write(struct i2c_client *client, u8 reg, u8 value)
69 return i2c_smbus_write_byte_data(client, reg, value); 69 return i2c_smbus_write_byte_data(client, reg, value);
70} 70}
71 71
72struct ad7414_data *ad7414_update_device(struct device *dev) 72static struct ad7414_data *ad7414_update_device(struct device *dev)
73{ 73{
74 struct i2c_client *client = to_i2c_client(dev); 74 struct i2c_client *client = to_i2c_client(dev);
75 struct ad7414_data *data = i2c_get_clientdata(client); 75 struct ad7414_data *data = i2c_get_clientdata(client);
diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c
index d191118ba0cb..d6b490d3e36f 100644
--- a/drivers/hwmon/atxp1.c
+++ b/drivers/hwmon/atxp1.c
@@ -31,7 +31,7 @@
31 31
32MODULE_LICENSE("GPL"); 32MODULE_LICENSE("GPL");
33MODULE_DESCRIPTION("System voltages control via Attansic ATXP1"); 33MODULE_DESCRIPTION("System voltages control via Attansic ATXP1");
34MODULE_VERSION("0.6.2"); 34MODULE_VERSION("0.6.3");
35MODULE_AUTHOR("Sebastian Witt <se.witt@gmx.net>"); 35MODULE_AUTHOR("Sebastian Witt <se.witt@gmx.net>");
36 36
37#define ATXP1_VID 0x00 37#define ATXP1_VID 0x00
@@ -289,16 +289,16 @@ static int atxp1_detect(struct i2c_client *new_client, int kind,
289 if (!((i2c_smbus_read_byte_data(new_client, 0x3e) == 0) && 289 if (!((i2c_smbus_read_byte_data(new_client, 0x3e) == 0) &&
290 (i2c_smbus_read_byte_data(new_client, 0x3f) == 0) && 290 (i2c_smbus_read_byte_data(new_client, 0x3f) == 0) &&
291 (i2c_smbus_read_byte_data(new_client, 0xfe) == 0) && 291 (i2c_smbus_read_byte_data(new_client, 0xfe) == 0) &&
292 (i2c_smbus_read_byte_data(new_client, 0xff) == 0) )) { 292 (i2c_smbus_read_byte_data(new_client, 0xff) == 0)))
293 return -ENODEV;
293 294
294 /* No vendor ID, now checking if registers 0x10,0x11 (non-existent) 295 /* No vendor ID, now checking if registers 0x10,0x11 (non-existent)
295 * showing the same as register 0x00 */ 296 * showing the same as register 0x00 */
296 temp = i2c_smbus_read_byte_data(new_client, 0x00); 297 temp = i2c_smbus_read_byte_data(new_client, 0x00);
297 298
298 if (!((i2c_smbus_read_byte_data(new_client, 0x10) == temp) && 299 if (!((i2c_smbus_read_byte_data(new_client, 0x10) == temp) &&
299 (i2c_smbus_read_byte_data(new_client, 0x11) == temp) )) 300 (i2c_smbus_read_byte_data(new_client, 0x11) == temp)))
300 return -ENODEV; 301 return -ENODEV;
301 }
302 302
303 /* Get VRM */ 303 /* Get VRM */
304 temp = vid_which_vrm(); 304 temp = vid_which_vrm();
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
index 30cdb0956779..d793cc011990 100644
--- a/drivers/hwmon/it87.c
+++ b/drivers/hwmon/it87.c
@@ -46,6 +46,8 @@
46#include <linux/err.h> 46#include <linux/err.h>
47#include <linux/mutex.h> 47#include <linux/mutex.h>
48#include <linux/sysfs.h> 48#include <linux/sysfs.h>
49#include <linux/string.h>
50#include <linux/dmi.h>
49#include <asm/io.h> 51#include <asm/io.h>
50 52
51#define DRVNAME "it87" 53#define DRVNAME "it87"
@@ -236,6 +238,8 @@ struct it87_sio_data {
236 /* Values read from Super-I/O config space */ 238 /* Values read from Super-I/O config space */
237 u8 revision; 239 u8 revision;
238 u8 vid_value; 240 u8 vid_value;
241 /* Values set based on DMI strings */
242 u8 skip_pwm;
239}; 243};
240 244
241/* For each registered chip, we need to keep some data in memory. 245/* For each registered chip, we need to keep some data in memory.
@@ -273,10 +277,10 @@ struct it87_data {
273static inline int has_16bit_fans(const struct it87_data *data) 277static inline int has_16bit_fans(const struct it87_data *data)
274{ 278{
275 /* IT8705F Datasheet 0.4.1, 3h == Version G. 279 /* IT8705F Datasheet 0.4.1, 3h == Version G.
276 IT8712F Datasheet 0.9.1, section 8.3.5 indicates 7h == Version I. 280 IT8712F Datasheet 0.9.1, section 8.3.5 indicates 8h == Version J.
277 These are the first revisions with 16bit tachometer support. */ 281 These are the first revisions with 16bit tachometer support. */
278 return (data->type == it87 && data->revision >= 0x03) 282 return (data->type == it87 && data->revision >= 0x03)
279 || (data->type == it8712 && data->revision >= 0x07) 283 || (data->type == it8712 && data->revision >= 0x08)
280 || data->type == it8716 284 || data->type == it8716
281 || data->type == it8718; 285 || data->type == it8718;
282} 286}
@@ -964,6 +968,7 @@ static int __init it87_find(unsigned short *address,
964{ 968{
965 int err = -ENODEV; 969 int err = -ENODEV;
966 u16 chip_type; 970 u16 chip_type;
971 const char *board_vendor, *board_name;
967 972
968 superio_enter(); 973 superio_enter();
969 chip_type = force_id ? force_id : superio_inw(DEVID); 974 chip_type = force_id ? force_id : superio_inw(DEVID);
@@ -1022,6 +1027,24 @@ static int __init it87_find(unsigned short *address,
1022 pr_info("it87: in7 is VCCH (+5V Stand-By)\n"); 1027 pr_info("it87: in7 is VCCH (+5V Stand-By)\n");
1023 } 1028 }
1024 1029
1030 /* Disable specific features based on DMI strings */
1031 board_vendor = dmi_get_system_info(DMI_BOARD_VENDOR);
1032 board_name = dmi_get_system_info(DMI_BOARD_NAME);
1033 if (board_vendor && board_name) {
1034 if (strcmp(board_vendor, "nVIDIA") == 0
1035 && strcmp(board_name, "FN68PT") == 0) {
1036 /* On the Shuttle SN68PT, FAN_CTL2 is apparently not
1037 connected to a fan, but to something else. One user
1038 has reported instant system power-off when changing
1039 the PWM2 duty cycle, so we disable it.
1040 I use the board name string as the trigger in case
1041 the same board is ever used in other systems. */
1042 pr_info("it87: Disabling pwm2 due to "
1043 "hardware constraints\n");
1044 sio_data->skip_pwm = (1 << 1);
1045 }
1046 }
1047
1025exit: 1048exit:
1026 superio_exit(); 1049 superio_exit();
1027 return err; 1050 return err;
@@ -1168,25 +1191,33 @@ static int __devinit it87_probe(struct platform_device *pdev)
1168 } 1191 }
1169 1192
1170 if (enable_pwm_interface) { 1193 if (enable_pwm_interface) {
1171 if ((err = device_create_file(dev, 1194 if (!(sio_data->skip_pwm & (1 << 0))) {
1172 &sensor_dev_attr_pwm1_enable.dev_attr)) 1195 if ((err = device_create_file(dev,
1173 || (err = device_create_file(dev, 1196 &sensor_dev_attr_pwm1_enable.dev_attr))
1174 &sensor_dev_attr_pwm2_enable.dev_attr)) 1197 || (err = device_create_file(dev,
1175 || (err = device_create_file(dev, 1198 &sensor_dev_attr_pwm1.dev_attr))
1176 &sensor_dev_attr_pwm3_enable.dev_attr)) 1199 || (err = device_create_file(dev,
1177 || (err = device_create_file(dev, 1200 &dev_attr_pwm1_freq)))
1178 &sensor_dev_attr_pwm1.dev_attr)) 1201 goto ERROR4;
1179 || (err = device_create_file(dev, 1202 }
1180 &sensor_dev_attr_pwm2.dev_attr)) 1203 if (!(sio_data->skip_pwm & (1 << 1))) {
1181 || (err = device_create_file(dev, 1204 if ((err = device_create_file(dev,
1182 &sensor_dev_attr_pwm3.dev_attr)) 1205 &sensor_dev_attr_pwm2_enable.dev_attr))
1183 || (err = device_create_file(dev, 1206 || (err = device_create_file(dev,
1184 &dev_attr_pwm1_freq)) 1207 &sensor_dev_attr_pwm2.dev_attr))
1185 || (err = device_create_file(dev, 1208 || (err = device_create_file(dev,
1186 &dev_attr_pwm2_freq)) 1209 &dev_attr_pwm2_freq)))
1187 || (err = device_create_file(dev, 1210 goto ERROR4;
1188 &dev_attr_pwm3_freq))) 1211 }
1189 goto ERROR4; 1212 if (!(sio_data->skip_pwm & (1 << 2))) {
1213 if ((err = device_create_file(dev,
1214 &sensor_dev_attr_pwm3_enable.dev_attr))
1215 || (err = device_create_file(dev,
1216 &sensor_dev_attr_pwm3.dev_attr))
1217 || (err = device_create_file(dev,
1218 &dev_attr_pwm3_freq)))
1219 goto ERROR4;
1220 }
1190 } 1221 }
1191 1222
1192 if (data->type == it8712 || data->type == it8716 1223 if (data->type == it8712 || data->type == it8716
@@ -1546,6 +1577,7 @@ static int __init sm_it87_init(void)
1546 unsigned short isa_address=0; 1577 unsigned short isa_address=0;
1547 struct it87_sio_data sio_data; 1578 struct it87_sio_data sio_data;
1548 1579
1580 memset(&sio_data, 0, sizeof(struct it87_sio_data));
1549 err = it87_find(&isa_address, &sio_data); 1581 err = it87_find(&isa_address, &sio_data);
1550 if (err) 1582 if (err)
1551 return err; 1583 return err;
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c
index 22f6d5c00d80..0e7b1c6724aa 100644
--- a/drivers/i2c/busses/i2c-powermac.c
+++ b/drivers/i2c/busses/i2c-powermac.c
@@ -180,7 +180,7 @@ static const struct i2c_algorithm i2c_powermac_algorithm = {
180}; 180};
181 181
182 182
183static int i2c_powermac_remove(struct platform_device *dev) 183static int __devexit i2c_powermac_remove(struct platform_device *dev)
184{ 184{
185 struct i2c_adapter *adapter = platform_get_drvdata(dev); 185 struct i2c_adapter *adapter = platform_get_drvdata(dev);
186 struct pmac_i2c_bus *bus = i2c_get_adapdata(adapter); 186 struct pmac_i2c_bus *bus = i2c_get_adapdata(adapter);
@@ -200,7 +200,7 @@ static int i2c_powermac_remove(struct platform_device *dev)
200} 200}
201 201
202 202
203static int __devexit i2c_powermac_probe(struct platform_device *dev) 203static int __devinit i2c_powermac_probe(struct platform_device *dev)
204{ 204{
205 struct pmac_i2c_bus *bus = dev->dev.platform_data; 205 struct pmac_i2c_bus *bus = dev->dev.platform_data;
206 struct device_node *parent = NULL; 206 struct device_node *parent = NULL;
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index af4491fa7e34..307d976c9b69 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -583,8 +583,10 @@ static int __init i2c_dev_init(void)
583 goto out; 583 goto out;
584 584
585 i2c_dev_class = class_create(THIS_MODULE, "i2c-dev"); 585 i2c_dev_class = class_create(THIS_MODULE, "i2c-dev");
586 if (IS_ERR(i2c_dev_class)) 586 if (IS_ERR(i2c_dev_class)) {
587 res = PTR_ERR(i2c_dev_class);
587 goto out_unreg_chrdev; 588 goto out_unreg_chrdev;
589 }
588 590
589 res = i2c_add_driver(&i2cdev_driver); 591 res = i2c_add_driver(&i2cdev_driver);
590 if (res) 592 if (res)
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index fc735ab08ff4..052879a6f853 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -292,6 +292,20 @@ config IDE_GENERIC
292 tristate "generic/default IDE chipset support" 292 tristate "generic/default IDE chipset support"
293 depends on ALPHA || X86 || IA64 || M32R || MIPS 293 depends on ALPHA || X86 || IA64 || M32R || MIPS
294 help 294 help
295 This is the generic IDE driver. This driver attaches to the
296 fixed legacy ports (e.g. on PCs 0x1f0/0x170, 0x1e8/0x168 and
297 so on). Please note that if this driver is built into the
298 kernel or loaded before other ATA (IDE or libata) drivers
299 and the controller is located at legacy ports, this driver
300 may grab those ports and thus can prevent the controller
301 specific driver from attaching.
302
303 Also, currently, IDE generic doesn't allow IRQ sharing
304 meaning that the IRQs it grabs won't be available to other
305 controllers sharing those IRQs which usually makes drivers
306 for those controllers fail. Generally, it's not a good idea
307 to load IDE generic driver on modern systems.
308
295 If unsure, say N. 309 If unsure, say N.
296 310
297config BLK_DEV_PLATFORM 311config BLK_DEV_PLATFORM
@@ -766,10 +780,6 @@ config BLK_DEV_IDEDMA_PMAC
766 to transfer data to and from memory. Saying Y is safe and improves 780 to transfer data to and from memory. Saying Y is safe and improves
767 performance. 781 performance.
768 782
769config BLK_DEV_IDE_SWARM
770 tristate "IDE for Sibyte evaluation boards"
771 depends on SIBYTE_SB1xxx_SOC
772
773config BLK_DEV_IDE_AU1XXX 783config BLK_DEV_IDE_AU1XXX
774 bool "IDE for AMD Alchemy Au1200" 784 bool "IDE for AMD Alchemy Au1200"
775 depends on SOC_AU1200 785 depends on SOC_AU1200
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index f1489999cf91..f16bb4667238 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1661,7 +1661,9 @@ static int ide_cdrom_probe_capabilities(ide_drive_t *drive)
1661 cdi->mask &= ~CDC_PLAY_AUDIO; 1661 cdi->mask &= ~CDC_PLAY_AUDIO;
1662 1662
1663 mechtype = buf[8 + 6] >> 5; 1663 mechtype = buf[8 + 6] >> 5;
1664 if (mechtype == mechtype_caddy || mechtype == mechtype_popup) 1664 if (mechtype == mechtype_caddy ||
1665 mechtype == mechtype_popup ||
1666 (drive->atapi_flags & IDE_AFLAG_NO_AUTOCLOSE))
1665 cdi->mask |= CDC_CLOSE_TRAY; 1667 cdi->mask |= CDC_CLOSE_TRAY;
1666 1668
1667 if (cdi->sanyo_slot > 0) { 1669 if (cdi->sanyo_slot > 0) {
@@ -1859,6 +1861,8 @@ static const struct cd_list_entry ide_cd_quirks_list[] = {
1859 { "MATSHITADVD-ROM SR-8176", NULL, IDE_AFLAG_PLAY_AUDIO_OK }, 1861 { "MATSHITADVD-ROM SR-8176", NULL, IDE_AFLAG_PLAY_AUDIO_OK },
1860 { "MATSHITADVD-ROM SR-8174", NULL, IDE_AFLAG_PLAY_AUDIO_OK }, 1862 { "MATSHITADVD-ROM SR-8174", NULL, IDE_AFLAG_PLAY_AUDIO_OK },
1861 { "Optiarc DVD RW AD-5200A", NULL, IDE_AFLAG_PLAY_AUDIO_OK }, 1863 { "Optiarc DVD RW AD-5200A", NULL, IDE_AFLAG_PLAY_AUDIO_OK },
1864 { "Optiarc DVD RW AD-7200A", NULL, IDE_AFLAG_PLAY_AUDIO_OK },
1865 { "Optiarc DVD RW AD-7543A", NULL, IDE_AFLAG_NO_AUTOCLOSE },
1862 { NULL, NULL, 0 } 1866 { NULL, NULL, 0 }
1863}; 1867};
1864 1868
@@ -1933,7 +1937,6 @@ static void ide_cd_remove(ide_drive_t *drive)
1933 1937
1934 ide_proc_unregister_driver(drive, info->driver); 1938 ide_proc_unregister_driver(drive, info->driver);
1935 1939
1936 blk_unregister_filter(info->disk);
1937 del_gendisk(info->disk); 1940 del_gendisk(info->disk);
1938 1941
1939 ide_cd_put(info); 1942 ide_cd_put(info);
@@ -2159,7 +2162,6 @@ static int ide_cd_probe(ide_drive_t *drive)
2159 g->fops = &idecd_ops; 2162 g->fops = &idecd_ops;
2160 g->flags |= GENHD_FL_REMOVABLE; 2163 g->flags |= GENHD_FL_REMOVABLE;
2161 add_disk(g); 2164 add_disk(g);
2162 blk_register_filter(g);
2163 return 0; 2165 return 0;
2164 2166
2165out_free_cd: 2167out_free_cd:
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index adc682755857..3fa07c0aeaa4 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -211,7 +211,7 @@ int ide_build_dmatable (ide_drive_t *drive, struct request *rq)
211 xcount = bcount & 0xffff; 211 xcount = bcount & 0xffff;
212 if (is_trm290) 212 if (is_trm290)
213 xcount = ((xcount >> 2) - 1) << 16; 213 xcount = ((xcount >> 2) - 1) << 16;
214 if (xcount == 0x0000) { 214 else if (xcount == 0x0000) {
215 /* 215 /*
216 * Most chipsets correctly interpret a length of 0x0000 as 64KB, 216 * Most chipsets correctly interpret a length of 0x0000 as 64KB,
217 * but at least one (e.g. CS5530) misinterprets it as zero (!). 217 * but at least one (e.g. CS5530) misinterprets it as zero (!).
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 994e41099b42..a51a30e9eab3 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1492,7 +1492,7 @@ static struct device_attribute *ide_port_attrs[] = {
1492 1492
1493static int ide_sysfs_register_port(ide_hwif_t *hwif) 1493static int ide_sysfs_register_port(ide_hwif_t *hwif)
1494{ 1494{
1495 int i, rc; 1495 int i, uninitialized_var(rc);
1496 1496
1497 for (i = 0; ide_port_attrs[i]; i++) { 1497 for (i = 0; ide_port_attrs[i]; i++) {
1498 rc = device_create_file(hwif->portdev, ide_port_attrs[i]); 1498 rc = device_create_file(hwif->portdev, ide_port_attrs[i]);
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 1bce84b56630..3833189144ed 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -2338,7 +2338,7 @@ static void idetape_get_inquiry_results(ide_drive_t *drive)
2338{ 2338{
2339 idetape_tape_t *tape = drive->driver_data; 2339 idetape_tape_t *tape = drive->driver_data;
2340 struct ide_atapi_pc pc; 2340 struct ide_atapi_pc pc;
2341 char fw_rev[6], vendor_id[10], product_id[18]; 2341 char fw_rev[4], vendor_id[8], product_id[16];
2342 2342
2343 idetape_create_inquiry_cmd(&pc); 2343 idetape_create_inquiry_cmd(&pc);
2344 if (idetape_queue_pc_tail(drive, &pc)) { 2344 if (idetape_queue_pc_tail(drive, &pc)) {
@@ -2350,11 +2350,11 @@ static void idetape_get_inquiry_results(ide_drive_t *drive)
2350 memcpy(product_id, &pc.buf[16], 16); 2350 memcpy(product_id, &pc.buf[16], 16);
2351 memcpy(fw_rev, &pc.buf[32], 4); 2351 memcpy(fw_rev, &pc.buf[32], 4);
2352 2352
2353 ide_fixstring(vendor_id, 10, 0); 2353 ide_fixstring(vendor_id, 8, 0);
2354 ide_fixstring(product_id, 18, 0); 2354 ide_fixstring(product_id, 16, 0);
2355 ide_fixstring(fw_rev, 6, 0); 2355 ide_fixstring(fw_rev, 4, 0);
2356 2356
2357 printk(KERN_INFO "ide-tape: %s <-> %s: %s %s rev %s\n", 2357 printk(KERN_INFO "ide-tape: %s <-> %s: %.8s %.16s rev %.4s\n",
2358 drive->name, tape->name, vendor_id, product_id, fw_rev); 2358 drive->name, tape->name, vendor_id, product_id, fw_rev);
2359} 2359}
2360 2360
diff --git a/drivers/ide/mips/Makefile b/drivers/ide/mips/Makefile
index 677c7b2bac92..5873fa0b8769 100644
--- a/drivers/ide/mips/Makefile
+++ b/drivers/ide/mips/Makefile
@@ -1,4 +1,3 @@
1obj-$(CONFIG_BLK_DEV_IDE_SWARM) += swarm.o
2obj-$(CONFIG_BLK_DEV_IDE_AU1XXX) += au1xxx-ide.o 1obj-$(CONFIG_BLK_DEV_IDE_AU1XXX) += au1xxx-ide.o
3 2
4EXTRA_CFLAGS := -Idrivers/ide 3EXTRA_CFLAGS := -Idrivers/ide
diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c
deleted file mode 100644
index badf79fc9e3a..000000000000
--- a/drivers/ide/mips/swarm.c
+++ /dev/null
@@ -1,196 +0,0 @@
1/*
2 * Copyright (C) 2001, 2002, 2003 Broadcom Corporation
3 * Copyright (C) 2004 MontaVista Software Inc.
4 * Author: Manish Lachwani, mlachwani@mvista.com
5 * Copyright (C) 2004 MIPS Technologies, Inc. All rights reserved.
6 * Author: Maciej W. Rozycki <macro@mips.com>
7 * Copyright (c) 2006, 2008 Maciej W. Rozycki
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24/*
25 * Derived loosely from ide-pmac.c, so:
26 * Copyright (C) 1998 Paul Mackerras.
27 * Copyright (C) 1995-1998 Mark Lord
28 */
29
30/*
31 * Boards with SiByte processors so far have supported IDE devices via
32 * the Generic Bus, PCI bus, and built-in PCMCIA interface. In all
33 * cases, byte-swapping must be avoided for these devices (whereas
34 * other PCI devices, for example, will require swapping). Any
35 * SiByte-targetted kernel including IDE support will include this
36 * file. Probing of a Generic Bus for an IDE device is controlled by
37 * the definition of "SIBYTE_HAVE_IDE", which is provided by
38 * <asm/sibyte/board.h> for Broadcom boards.
39 */
40
41#include <linux/ide.h>
42#include <linux/ioport.h>
43#include <linux/kernel.h>
44#include <linux/types.h>
45#include <linux/platform_device.h>
46
47#include <asm/io.h>
48
49#include <asm/sibyte/board.h>
50#include <asm/sibyte/sb1250_genbus.h>
51#include <asm/sibyte/sb1250_regs.h>
52
53#define DRV_NAME "ide-swarm"
54
55static char swarm_ide_string[] = DRV_NAME;
56
57static struct resource swarm_ide_resource = {
58 .name = "SWARM GenBus IDE",
59 .flags = IORESOURCE_MEM,
60};
61
62static struct platform_device *swarm_ide_dev;
63
64static const struct ide_port_info swarm_port_info = {
65 .name = DRV_NAME,
66 .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
67};
68
69/*
70 * swarm_ide_probe - if the board header indicates the existence of
71 * Generic Bus IDE, allocate a HWIF for it.
72 */
73static int __devinit swarm_ide_probe(struct device *dev)
74{
75 u8 __iomem *base;
76 struct ide_host *host;
77 phys_t offset, size;
78 int i, rc;
79 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
80
81 if (!SIBYTE_HAVE_IDE)
82 return -ENODEV;
83
84 base = ioremap(A_IO_EXT_BASE, 0x800);
85 offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS));
86 size = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_MULT_SIZE, IDE_CS));
87 iounmap(base);
88
89 offset = G_IO_START_ADDR(offset) << S_IO_ADDRBASE;
90 size = (G_IO_MULT_SIZE(size) + 1) << S_IO_REGSIZE;
91 if (offset < A_PHYS_GENBUS || offset >= A_PHYS_GENBUS_END) {
92 printk(KERN_INFO DRV_NAME
93 ": IDE interface at GenBus disabled\n");
94 return -EBUSY;
95 }
96
97 printk(KERN_INFO DRV_NAME ": IDE interface at GenBus slot %i\n",
98 IDE_CS);
99
100 swarm_ide_resource.start = offset;
101 swarm_ide_resource.end = offset + size - 1;
102 if (request_resource(&iomem_resource, &swarm_ide_resource)) {
103 printk(KERN_ERR DRV_NAME
104 ": can't request I/O memory resource\n");
105 return -EBUSY;
106 }
107
108 base = ioremap(offset, size);
109
110 for (i = 0; i <= 7; i++)
111 hw.io_ports_array[i] =
112 (unsigned long)(base + ((0x1f0 + i) << 5));
113 hw.io_ports.ctl_addr =
114 (unsigned long)(base + (0x3f6 << 5));
115 hw.irq = K_INT_GB_IDE;
116 hw.chipset = ide_generic;
117
118 rc = ide_host_add(&swarm_port_info, hws, &host);
119 if (rc)
120 goto err;
121
122 dev_set_drvdata(dev, host);
123
124 return 0;
125err:
126 release_resource(&swarm_ide_resource);
127 iounmap(base);
128 return rc;
129}
130
131static struct device_driver swarm_ide_driver = {
132 .name = swarm_ide_string,
133 .bus = &platform_bus_type,
134 .probe = swarm_ide_probe,
135};
136
137static void swarm_ide_platform_release(struct device *device)
138{
139 struct platform_device *pldev;
140
141 /* free device */
142 pldev = to_platform_device(device);
143 kfree(pldev);
144}
145
146static int __devinit swarm_ide_init_module(void)
147{
148 struct platform_device *pldev;
149 int err;
150
151 printk(KERN_INFO "SWARM IDE driver\n");
152
153 if (driver_register(&swarm_ide_driver)) {
154 printk(KERN_ERR "Driver registration failed\n");
155 err = -ENODEV;
156 goto out;
157 }
158
159 if (!(pldev = kzalloc(sizeof (*pldev), GFP_KERNEL))) {
160 err = -ENOMEM;
161 goto out_unregister_driver;
162 }
163
164 pldev->name = swarm_ide_string;
165 pldev->id = 0;
166 pldev->dev.release = swarm_ide_platform_release;
167
168 if (platform_device_register(pldev)) {
169 err = -ENODEV;
170 goto out_free_pldev;
171 }
172
173 if (!pldev->dev.driver) {
174 /*
175 * The driver was not bound to this device, there was
176 * no hardware at this address. Unregister it, as the
177 * release fuction will take care of freeing the
178 * allocated structure
179 */
180 platform_device_unregister (pldev);
181 }
182
183 swarm_ide_dev = pldev;
184
185 return 0;
186
187out_free_pldev:
188 kfree(pldev);
189
190out_unregister_driver:
191 driver_unregister(&swarm_ide_driver);
192out:
193 return err;
194}
195
196module_init(swarm_ide_init_module);
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index eb107eef0dbc..c37ab1743819 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -613,6 +613,14 @@ static int check_in_drive_list(ide_drive_t *drive, const char **list)
613 return 0; 613 return 0;
614} 614}
615 615
616static struct hpt_info *hpt3xx_get_info(struct device *dev)
617{
618 struct ide_host *host = dev_get_drvdata(dev);
619 struct hpt_info *info = (struct hpt_info *)host->host_priv;
620
621 return dev == host->dev[1] ? info + 1 : info;
622}
623
616/* 624/*
617 * The Marvell bridge chips used on the HighPoint SATA cards do not seem 625 * The Marvell bridge chips used on the HighPoint SATA cards do not seem
618 * to support the UltraDMA modes 1, 2, and 3 as well as any MWDMA modes... 626 * to support the UltraDMA modes 1, 2, and 3 as well as any MWDMA modes...
@@ -621,9 +629,7 @@ static int check_in_drive_list(ide_drive_t *drive, const char **list)
621static u8 hpt3xx_udma_filter(ide_drive_t *drive) 629static u8 hpt3xx_udma_filter(ide_drive_t *drive)
622{ 630{
623 ide_hwif_t *hwif = HWIF(drive); 631 ide_hwif_t *hwif = HWIF(drive);
624 struct pci_dev *dev = to_pci_dev(hwif->dev); 632 struct hpt_info *info = hpt3xx_get_info(hwif->dev);
625 struct ide_host *host = pci_get_drvdata(dev);
626 struct hpt_info *info = host->host_priv + (hwif->dev == host->dev[1]);
627 u8 mask = hwif->ultra_mask; 633 u8 mask = hwif->ultra_mask;
628 634
629 switch (info->chip_type) { 635 switch (info->chip_type) {
@@ -662,9 +668,7 @@ static u8 hpt3xx_udma_filter(ide_drive_t *drive)
662static u8 hpt3xx_mdma_filter(ide_drive_t *drive) 668static u8 hpt3xx_mdma_filter(ide_drive_t *drive)
663{ 669{
664 ide_hwif_t *hwif = HWIF(drive); 670 ide_hwif_t *hwif = HWIF(drive);
665 struct pci_dev *dev = to_pci_dev(hwif->dev); 671 struct hpt_info *info = hpt3xx_get_info(hwif->dev);
666 struct ide_host *host = pci_get_drvdata(dev);
667 struct hpt_info *info = host->host_priv + (hwif->dev == host->dev[1]);
668 672
669 switch (info->chip_type) { 673 switch (info->chip_type) {
670 case HPT372 : 674 case HPT372 :
@@ -700,8 +704,7 @@ static void hpt3xx_set_mode(ide_drive_t *drive, const u8 speed)
700{ 704{
701 ide_hwif_t *hwif = drive->hwif; 705 ide_hwif_t *hwif = drive->hwif;
702 struct pci_dev *dev = to_pci_dev(hwif->dev); 706 struct pci_dev *dev = to_pci_dev(hwif->dev);
703 struct ide_host *host = pci_get_drvdata(dev); 707 struct hpt_info *info = hpt3xx_get_info(hwif->dev);
704 struct hpt_info *info = host->host_priv + (hwif->dev == host->dev[1]);
705 struct hpt_timings *t = info->timings; 708 struct hpt_timings *t = info->timings;
706 u8 itr_addr = 0x40 + (drive->dn * 4); 709 u8 itr_addr = 0x40 + (drive->dn * 4);
707 u32 old_itr = 0; 710 u32 old_itr = 0;
@@ -744,8 +747,7 @@ static void hpt3xx_maskproc(ide_drive_t *drive, int mask)
744{ 747{
745 ide_hwif_t *hwif = HWIF(drive); 748 ide_hwif_t *hwif = HWIF(drive);
746 struct pci_dev *dev = to_pci_dev(hwif->dev); 749 struct pci_dev *dev = to_pci_dev(hwif->dev);
747 struct ide_host *host = pci_get_drvdata(dev); 750 struct hpt_info *info = hpt3xx_get_info(hwif->dev);
748 struct hpt_info *info = host->host_priv + (hwif->dev == host->dev[1]);
749 751
750 if (drive->quirk_list) { 752 if (drive->quirk_list) {
751 if (info->chip_type >= HPT370) { 753 if (info->chip_type >= HPT370) {
@@ -973,8 +975,7 @@ static int __devinit hpt37x_calibrate_dpll(struct pci_dev *dev, u16 f_low, u16 f
973static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev) 975static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev)
974{ 976{
975 unsigned long io_base = pci_resource_start(dev, 4); 977 unsigned long io_base = pci_resource_start(dev, 4);
976 struct ide_host *host = pci_get_drvdata(dev); 978 struct hpt_info *info = hpt3xx_get_info(&dev->dev);
977 struct hpt_info *info = host->host_priv + (&dev->dev == host->dev[1]);
978 const char *name = DRV_NAME; 979 const char *name = DRV_NAME;
979 u8 pci_clk, dpll_clk = 0; /* PCI and DPLL clock in MHz */ 980 u8 pci_clk, dpll_clk = 0; /* PCI and DPLL clock in MHz */
980 u8 chip_type; 981 u8 chip_type;
@@ -1217,8 +1218,7 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev)
1217static u8 hpt3xx_cable_detect(ide_hwif_t *hwif) 1218static u8 hpt3xx_cable_detect(ide_hwif_t *hwif)
1218{ 1219{
1219 struct pci_dev *dev = to_pci_dev(hwif->dev); 1220 struct pci_dev *dev = to_pci_dev(hwif->dev);
1220 struct ide_host *host = pci_get_drvdata(dev); 1221 struct hpt_info *info = hpt3xx_get_info(hwif->dev);
1221 struct hpt_info *info = host->host_priv + (hwif->dev == host->dev[1]);
1222 u8 chip_type = info->chip_type; 1222 u8 chip_type = info->chip_type;
1223 u8 scr1 = 0, ata66 = hwif->channel ? 0x01 : 0x02; 1223 u8 scr1 = 0, ata66 = hwif->channel ? 0x01 : 0x02;
1224 1224
@@ -1262,8 +1262,7 @@ static u8 hpt3xx_cable_detect(ide_hwif_t *hwif)
1262static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) 1262static void __devinit init_hwif_hpt366(ide_hwif_t *hwif)
1263{ 1263{
1264 struct pci_dev *dev = to_pci_dev(hwif->dev); 1264 struct pci_dev *dev = to_pci_dev(hwif->dev);
1265 struct ide_host *host = pci_get_drvdata(dev); 1265 struct hpt_info *info = hpt3xx_get_info(hwif->dev);
1266 struct hpt_info *info = host->host_priv + (hwif->dev == host->dev[1]);
1267 int serialize = HPT_SERIALIZE_IO; 1266 int serialize = HPT_SERIALIZE_IO;
1268 u8 chip_type = info->chip_type; 1267 u8 chip_type = info->chip_type;
1269 u8 new_mcr, old_mcr = 0; 1268 u8 new_mcr, old_mcr = 0;
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index f29dbb767e87..9559248f265b 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1342,6 +1342,12 @@ static __be32 convert_access(int acc)
1342static void set_fmr_seg(struct mlx4_wqe_fmr_seg *fseg, struct ib_send_wr *wr) 1342static void set_fmr_seg(struct mlx4_wqe_fmr_seg *fseg, struct ib_send_wr *wr)
1343{ 1343{
1344 struct mlx4_ib_fast_reg_page_list *mfrpl = to_mfrpl(wr->wr.fast_reg.page_list); 1344 struct mlx4_ib_fast_reg_page_list *mfrpl = to_mfrpl(wr->wr.fast_reg.page_list);
1345 int i;
1346
1347 for (i = 0; i < wr->wr.fast_reg.page_list_len; ++i)
1348 wr->wr.fast_reg.page_list->page_list[i] =
1349 cpu_to_be64(wr->wr.fast_reg.page_list->page_list[i] |
1350 MLX4_MTT_FLAG_PRESENT);
1345 1351
1346 fseg->flags = convert_access(wr->wr.fast_reg.access_flags); 1352 fseg->flags = convert_access(wr->wr.fast_reg.access_flags);
1347 fseg->mem_key = cpu_to_be32(wr->wr.fast_reg.rkey); 1353 fseg->mem_key = cpu_to_be32(wr->wr.fast_reg.rkey);
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index 9f0b964b2c99..499d3cf83e1f 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -1956,13 +1956,6 @@ static int mini_cm_reject(struct nes_cm_core *cm_core,
1956 return ret; 1956 return ret;
1957 cleanup_retrans_entry(cm_node); 1957 cleanup_retrans_entry(cm_node);
1958 cm_node->state = NES_CM_STATE_CLOSED; 1958 cm_node->state = NES_CM_STATE_CLOSED;
1959 ret = send_fin(cm_node, NULL);
1960
1961 if (cm_node->accept_pend) {
1962 BUG_ON(!cm_node->listener);
1963 atomic_dec(&cm_node->listener->pend_accepts_cnt);
1964 BUG_ON(atomic_read(&cm_node->listener->pend_accepts_cnt) < 0);
1965 }
1966 1959
1967 ret = send_reset(cm_node, NULL); 1960 ret = send_reset(cm_node, NULL);
1968 return ret; 1961 return ret;
@@ -2383,6 +2376,7 @@ static int nes_cm_disconn_true(struct nes_qp *nesqp)
2383 atomic_inc(&cm_disconnects); 2376 atomic_inc(&cm_disconnects);
2384 cm_event.event = IW_CM_EVENT_DISCONNECT; 2377 cm_event.event = IW_CM_EVENT_DISCONNECT;
2385 if (last_ae == NES_AEQE_AEID_LLP_CONNECTION_RESET) { 2378 if (last_ae == NES_AEQE_AEID_LLP_CONNECTION_RESET) {
2379 issued_disconnect_reset = 1;
2386 cm_event.status = IW_CM_EVENT_STATUS_RESET; 2380 cm_event.status = IW_CM_EVENT_STATUS_RESET;
2387 nes_debug(NES_DBG_CM, "Generating a CM " 2381 nes_debug(NES_DBG_CM, "Generating a CM "
2388 "Disconnect Event (status reset) for " 2382 "Disconnect Event (status reset) for "
@@ -2508,7 +2502,6 @@ static int nes_disconnect(struct nes_qp *nesqp, int abrupt)
2508 nes_debug(NES_DBG_CM, "Call close API\n"); 2502 nes_debug(NES_DBG_CM, "Call close API\n");
2509 2503
2510 g_cm_core->api->close(g_cm_core, nesqp->cm_node); 2504 g_cm_core->api->close(g_cm_core, nesqp->cm_node);
2511 nesqp->cm_node = NULL;
2512 } 2505 }
2513 2506
2514 return ret; 2507 return ret;
@@ -2837,6 +2830,7 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
2837 cm_node->apbvt_set = 1; 2830 cm_node->apbvt_set = 1;
2838 nesqp->cm_node = cm_node; 2831 nesqp->cm_node = cm_node;
2839 cm_node->nesqp = nesqp; 2832 cm_node->nesqp = nesqp;
2833 nes_add_ref(&nesqp->ibqp);
2840 2834
2841 return 0; 2835 return 0;
2842} 2836}
@@ -3167,7 +3161,6 @@ static void cm_event_connect_error(struct nes_cm_event *event)
3167 if (ret) 3161 if (ret)
3168 printk(KERN_ERR "%s[%u] OFA CM event_handler returned, " 3162 printk(KERN_ERR "%s[%u] OFA CM event_handler returned, "
3169 "ret=%d\n", __func__, __LINE__, ret); 3163 "ret=%d\n", __func__, __LINE__, ret);
3170 nes_rem_ref(&nesqp->ibqp);
3171 cm_id->rem_ref(cm_id); 3164 cm_id->rem_ref(cm_id);
3172 3165
3173 rem_ref_cm_node(event->cm_node->cm_core, event->cm_node); 3166 rem_ref_cm_node(event->cm_node->cm_core, event->cm_node);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index b0ffc9abe8c0..05eb41b8ab63 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -293,6 +293,7 @@ struct ipoib_dev_priv {
293 293
294 struct delayed_work pkey_poll_task; 294 struct delayed_work pkey_poll_task;
295 struct delayed_work mcast_task; 295 struct delayed_work mcast_task;
296 struct work_struct carrier_on_task;
296 struct work_struct flush_light; 297 struct work_struct flush_light;
297 struct work_struct flush_normal; 298 struct work_struct flush_normal;
298 struct work_struct flush_heavy; 299 struct work_struct flush_heavy;
@@ -464,6 +465,7 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port);
464void ipoib_dev_cleanup(struct net_device *dev); 465void ipoib_dev_cleanup(struct net_device *dev);
465 466
466void ipoib_mcast_join_task(struct work_struct *work); 467void ipoib_mcast_join_task(struct work_struct *work);
468void ipoib_mcast_carrier_on_task(struct work_struct *work);
467void ipoib_mcast_send(struct net_device *dev, void *mgid, struct sk_buff *skb); 469void ipoib_mcast_send(struct net_device *dev, void *mgid, struct sk_buff *skb);
468 470
469void ipoib_mcast_restart_task(struct work_struct *work); 471void ipoib_mcast_restart_task(struct work_struct *work);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 7e9e218738fa..e9ca3cb57d52 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -404,7 +404,7 @@ static void path_rec_completion(int status,
404 struct net_device *dev = path->dev; 404 struct net_device *dev = path->dev;
405 struct ipoib_dev_priv *priv = netdev_priv(dev); 405 struct ipoib_dev_priv *priv = netdev_priv(dev);
406 struct ipoib_ah *ah = NULL; 406 struct ipoib_ah *ah = NULL;
407 struct ipoib_ah *old_ah; 407 struct ipoib_ah *old_ah = NULL;
408 struct ipoib_neigh *neigh, *tn; 408 struct ipoib_neigh *neigh, *tn;
409 struct sk_buff_head skqueue; 409 struct sk_buff_head skqueue;
410 struct sk_buff *skb; 410 struct sk_buff *skb;
@@ -428,12 +428,12 @@ static void path_rec_completion(int status,
428 428
429 spin_lock_irqsave(&priv->lock, flags); 429 spin_lock_irqsave(&priv->lock, flags);
430 430
431 old_ah = path->ah;
432 path->ah = ah;
433
434 if (ah) { 431 if (ah) {
435 path->pathrec = *pathrec; 432 path->pathrec = *pathrec;
436 433
434 old_ah = path->ah;
435 path->ah = ah;
436
437 ipoib_dbg(priv, "created address handle %p for LID 0x%04x, SL %d\n", 437 ipoib_dbg(priv, "created address handle %p for LID 0x%04x, SL %d\n",
438 ah, be16_to_cpu(pathrec->dlid), pathrec->sl); 438 ah, be16_to_cpu(pathrec->dlid), pathrec->sl);
439 439
@@ -1075,6 +1075,7 @@ static void ipoib_setup(struct net_device *dev)
1075 1075
1076 INIT_DELAYED_WORK(&priv->pkey_poll_task, ipoib_pkey_poll); 1076 INIT_DELAYED_WORK(&priv->pkey_poll_task, ipoib_pkey_poll);
1077 INIT_DELAYED_WORK(&priv->mcast_task, ipoib_mcast_join_task); 1077 INIT_DELAYED_WORK(&priv->mcast_task, ipoib_mcast_join_task);
1078 INIT_WORK(&priv->carrier_on_task, ipoib_mcast_carrier_on_task);
1078 INIT_WORK(&priv->flush_light, ipoib_ib_dev_flush_light); 1079 INIT_WORK(&priv->flush_light, ipoib_ib_dev_flush_light);
1079 INIT_WORK(&priv->flush_normal, ipoib_ib_dev_flush_normal); 1080 INIT_WORK(&priv->flush_normal, ipoib_ib_dev_flush_normal);
1080 INIT_WORK(&priv->flush_heavy, ipoib_ib_dev_flush_heavy); 1081 INIT_WORK(&priv->flush_heavy, ipoib_ib_dev_flush_heavy);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
index ac33c8f3ea85..aae28620a6e5 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -366,6 +366,21 @@ static int ipoib_mcast_sendonly_join(struct ipoib_mcast *mcast)
366 return ret; 366 return ret;
367} 367}
368 368
369void ipoib_mcast_carrier_on_task(struct work_struct *work)
370{
371 struct ipoib_dev_priv *priv = container_of(work, struct ipoib_dev_priv,
372 carrier_on_task);
373
374 /*
375 * Take rtnl_lock to avoid racing with ipoib_stop() and
376 * turning the carrier back on while a device is being
377 * removed.
378 */
379 rtnl_lock();
380 netif_carrier_on(priv->dev);
381 rtnl_unlock();
382}
383
369static int ipoib_mcast_join_complete(int status, 384static int ipoib_mcast_join_complete(int status,
370 struct ib_sa_multicast *multicast) 385 struct ib_sa_multicast *multicast)
371{ 386{
@@ -392,16 +407,12 @@ static int ipoib_mcast_join_complete(int status,
392 &priv->mcast_task, 0); 407 &priv->mcast_task, 0);
393 mutex_unlock(&mcast_mutex); 408 mutex_unlock(&mcast_mutex);
394 409
395 if (mcast == priv->broadcast) { 410 /*
396 /* 411 * Defer carrier on work to ipoib_workqueue to avoid a
397 * Take RTNL lock here to avoid racing with 412 * deadlock on rtnl_lock here.
398 * ipoib_stop() and turning the carrier back 413 */
399 * on while a device is being removed. 414 if (mcast == priv->broadcast)
400 */ 415 queue_work(ipoib_workqueue, &priv->carrier_on_task);
401 rtnl_lock();
402 netif_carrier_on(dev);
403 rtnl_unlock();
404 }
405 416
406 return 0; 417 return 0;
407 } 418 }
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index 18f4d7f6ce6d..2998a6ac9ae4 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -351,8 +351,9 @@ static int report_tp_state(struct bcm5974 *dev, int size)
351#define BCM5974_WELLSPRING_MODE_REQUEST_VALUE 0x300 351#define BCM5974_WELLSPRING_MODE_REQUEST_VALUE 0x300
352#define BCM5974_WELLSPRING_MODE_REQUEST_INDEX 0 352#define BCM5974_WELLSPRING_MODE_REQUEST_INDEX 0
353#define BCM5974_WELLSPRING_MODE_VENDOR_VALUE 0x01 353#define BCM5974_WELLSPRING_MODE_VENDOR_VALUE 0x01
354#define BCM5974_WELLSPRING_MODE_NORMAL_VALUE 0x08
354 355
355static int bcm5974_wellspring_mode(struct bcm5974 *dev) 356static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on)
356{ 357{
357 char *data = kmalloc(8, GFP_KERNEL); 358 char *data = kmalloc(8, GFP_KERNEL);
358 int retval = 0, size; 359 int retval = 0, size;
@@ -377,7 +378,9 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev)
377 } 378 }
378 379
379 /* apply the mode switch */ 380 /* apply the mode switch */
380 data[0] = BCM5974_WELLSPRING_MODE_VENDOR_VALUE; 381 data[0] = on ?
382 BCM5974_WELLSPRING_MODE_VENDOR_VALUE :
383 BCM5974_WELLSPRING_MODE_NORMAL_VALUE;
381 384
382 /* write configuration */ 385 /* write configuration */
383 size = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), 386 size = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
@@ -392,7 +395,8 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev)
392 goto out; 395 goto out;
393 } 396 }
394 397
395 dprintk(2, "bcm5974: switched to wellspring mode.\n"); 398 dprintk(2, "bcm5974: switched to %s mode.\n",
399 on ? "wellspring" : "normal");
396 400
397 out: 401 out:
398 kfree(data); 402 kfree(data);
@@ -481,7 +485,7 @@ exit:
481 */ 485 */
482static int bcm5974_start_traffic(struct bcm5974 *dev) 486static int bcm5974_start_traffic(struct bcm5974 *dev)
483{ 487{
484 if (bcm5974_wellspring_mode(dev)) { 488 if (bcm5974_wellspring_mode(dev, true)) {
485 dprintk(1, "bcm5974: mode switch failed\n"); 489 dprintk(1, "bcm5974: mode switch failed\n");
486 goto error; 490 goto error;
487 } 491 }
@@ -504,6 +508,7 @@ static void bcm5974_pause_traffic(struct bcm5974 *dev)
504{ 508{
505 usb_kill_urb(dev->tp_urb); 509 usb_kill_urb(dev->tp_urb);
506 usb_kill_urb(dev->bt_urb); 510 usb_kill_urb(dev->bt_urb);
511 bcm5974_wellspring_mode(dev, false);
507} 512}
508 513
509/* 514/*
diff --git a/drivers/input/touchscreen/jornada720_ts.c b/drivers/input/touchscreen/jornada720_ts.c
index bf44f9d68342..c8b7e8a45c4d 100644
--- a/drivers/input/touchscreen/jornada720_ts.c
+++ b/drivers/input/touchscreen/jornada720_ts.c
@@ -119,8 +119,8 @@ static int __devinit jornada720_ts_probe(struct platform_device *pdev)
119 input_dev->id.bustype = BUS_HOST; 119 input_dev->id.bustype = BUS_HOST;
120 input_dev->dev.parent = &pdev->dev; 120 input_dev->dev.parent = &pdev->dev;
121 121
122 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); 122 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
123 input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); 123 input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
124 input_set_abs_params(input_dev, ABS_X, 270, 3900, 0, 0); 124 input_set_abs_params(input_dev, ABS_X, 270, 3900, 0, 0);
125 input_set_abs_params(input_dev, ABS_Y, 180, 3700, 0, 0); 125 input_set_abs_params(input_dev, ABS_Y, 180, 3700, 0, 0);
126 126
diff --git a/drivers/leds/leds-fsg.c b/drivers/leds/leds-fsg.c
index be0e12144b8b..34935155c1c0 100644
--- a/drivers/leds/leds-fsg.c
+++ b/drivers/leds/leds-fsg.c
@@ -161,6 +161,16 @@ static int fsg_led_probe(struct platform_device *pdev)
161{ 161{
162 int ret; 162 int ret;
163 163
164 /* Map the LED chip select address space */
165 latch_address = (unsigned short *) ioremap(IXP4XX_EXP_BUS_BASE(2), 512);
166 if (!latch_address) {
167 ret = -ENOMEM;
168 goto failremap;
169 }
170
171 latch_value = 0xffff;
172 *latch_address = latch_value;
173
164 ret = led_classdev_register(&pdev->dev, &fsg_wlan_led); 174 ret = led_classdev_register(&pdev->dev, &fsg_wlan_led);
165 if (ret < 0) 175 if (ret < 0)
166 goto failwlan; 176 goto failwlan;
@@ -185,20 +195,8 @@ static int fsg_led_probe(struct platform_device *pdev)
185 if (ret < 0) 195 if (ret < 0)
186 goto failring; 196 goto failring;
187 197
188 /* Map the LED chip select address space */
189 latch_address = (unsigned short *) ioremap(IXP4XX_EXP_BUS_BASE(2), 512);
190 if (!latch_address) {
191 ret = -ENOMEM;
192 goto failremap;
193 }
194
195 latch_value = 0xffff;
196 *latch_address = latch_value;
197
198 return ret; 198 return ret;
199 199
200 failremap:
201 led_classdev_unregister(&fsg_ring_led);
202 failring: 200 failring:
203 led_classdev_unregister(&fsg_sync_led); 201 led_classdev_unregister(&fsg_sync_led);
204 failsync: 202 failsync:
@@ -210,14 +208,14 @@ static int fsg_led_probe(struct platform_device *pdev)
210 failwan: 208 failwan:
211 led_classdev_unregister(&fsg_wlan_led); 209 led_classdev_unregister(&fsg_wlan_led);
212 failwlan: 210 failwlan:
211 iounmap(latch_address);
212 failremap:
213 213
214 return ret; 214 return ret;
215} 215}
216 216
217static int fsg_led_remove(struct platform_device *pdev) 217static int fsg_led_remove(struct platform_device *pdev)
218{ 218{
219 iounmap(latch_address);
220
221 led_classdev_unregister(&fsg_wlan_led); 219 led_classdev_unregister(&fsg_wlan_led);
222 led_classdev_unregister(&fsg_wan_led); 220 led_classdev_unregister(&fsg_wan_led);
223 led_classdev_unregister(&fsg_sata_led); 221 led_classdev_unregister(&fsg_sata_led);
@@ -225,6 +223,8 @@ static int fsg_led_remove(struct platform_device *pdev)
225 led_classdev_unregister(&fsg_sync_led); 223 led_classdev_unregister(&fsg_sync_led);
226 led_classdev_unregister(&fsg_ring_led); 224 led_classdev_unregister(&fsg_ring_led);
227 225
226 iounmap(latch_address);
227
228 return 0; 228 return 0;
229} 229}
230 230
diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c
index 146c06972863..f508729123b5 100644
--- a/drivers/leds/leds-pca955x.c
+++ b/drivers/leds/leds-pca955x.c
@@ -248,11 +248,10 @@ static int __devinit pca955x_probe(struct i2c_client *client,
248 const struct i2c_device_id *id) 248 const struct i2c_device_id *id)
249{ 249{
250 struct pca955x_led *pca955x; 250 struct pca955x_led *pca955x;
251 int i;
252 int err = -ENODEV;
253 struct pca955x_chipdef *chip; 251 struct pca955x_chipdef *chip;
254 struct i2c_adapter *adapter; 252 struct i2c_adapter *adapter;
255 struct led_platform_data *pdata; 253 struct led_platform_data *pdata;
254 int i, err;
256 255
257 chip = &pca955x_chipdefs[id->driver_data]; 256 chip = &pca955x_chipdefs[id->driver_data];
258 adapter = to_i2c_adapter(client->dev.parent); 257 adapter = to_i2c_adapter(client->dev.parent);
@@ -282,43 +281,41 @@ static int __devinit pca955x_probe(struct i2c_client *client,
282 } 281 }
283 } 282 }
284 283
284 pca955x = kzalloc(sizeof(*pca955x) * chip->bits, GFP_KERNEL);
285 if (!pca955x)
286 return -ENOMEM;
287
288 i2c_set_clientdata(client, pca955x);
289
285 for (i = 0; i < chip->bits; i++) { 290 for (i = 0; i < chip->bits; i++) {
286 pca955x = kzalloc(sizeof(struct pca955x_led), GFP_KERNEL); 291 pca955x[i].chipdef = chip;
287 if (!pca955x) { 292 pca955x[i].client = client;
288 err = -ENOMEM; 293 pca955x[i].led_num = i;
289 goto exit;
290 }
291 294
292 pca955x->chipdef = chip;
293 pca955x->client = client;
294 pca955x->led_num = i;
295 /* Platform data can specify LED names and default triggers */ 295 /* Platform data can specify LED names and default triggers */
296 if (pdata) { 296 if (pdata) {
297 if (pdata->leds[i].name) 297 if (pdata->leds[i].name)
298 snprintf(pca955x->name, 32, "pca955x:%s", 298 snprintf(pca955x[i].name,
299 pdata->leds[i].name); 299 sizeof(pca955x[i].name), "pca955x:%s",
300 pdata->leds[i].name);
300 if (pdata->leds[i].default_trigger) 301 if (pdata->leds[i].default_trigger)
301 pca955x->led_cdev.default_trigger = 302 pca955x[i].led_cdev.default_trigger =
302 pdata->leds[i].default_trigger; 303 pdata->leds[i].default_trigger;
303 } else { 304 } else {
304 snprintf(pca955x->name, 32, "pca955x:%d", i); 305 snprintf(pca955x[i].name, sizeof(pca955x[i].name),
306 "pca955x:%d", i);
305 } 307 }
306 spin_lock_init(&pca955x->lock);
307 308
308 pca955x->led_cdev.name = pca955x->name; 309 spin_lock_init(&pca955x[i].lock);
309 pca955x->led_cdev.brightness_set =
310 pca955x_led_set;
311 310
312 /* 311 pca955x[i].led_cdev.name = pca955x[i].name;
313 * Client data is a pointer to the _first_ pca955x_led 312 pca955x[i].led_cdev.brightness_set = pca955x_led_set;
314 * struct
315 */
316 if (i == 0)
317 i2c_set_clientdata(client, pca955x);
318 313
319 INIT_WORK(&(pca955x->work), pca955x_led_work); 314 INIT_WORK(&pca955x[i].work, pca955x_led_work);
320 315
321 led_classdev_register(&client->dev, &(pca955x->led_cdev)); 316 err = led_classdev_register(&client->dev, &pca955x[i].led_cdev);
317 if (err < 0)
318 goto exit;
322 } 319 }
323 320
324 /* Turn off LEDs */ 321 /* Turn off LEDs */
@@ -336,23 +333,32 @@ static int __devinit pca955x_probe(struct i2c_client *client,
336 pca955x_write_psc(client, 1, 0); 333 pca955x_write_psc(client, 1, 0);
337 334
338 return 0; 335 return 0;
336
339exit: 337exit:
338 while (i--) {
339 led_classdev_unregister(&pca955x[i].led_cdev);
340 cancel_work_sync(&pca955x[i].work);
341 }
342
343 kfree(pca955x);
344 i2c_set_clientdata(client, NULL);
345
340 return err; 346 return err;
341} 347}
342 348
343static int __devexit pca955x_remove(struct i2c_client *client) 349static int __devexit pca955x_remove(struct i2c_client *client)
344{ 350{
345 struct pca955x_led *pca955x = i2c_get_clientdata(client); 351 struct pca955x_led *pca955x = i2c_get_clientdata(client);
346 int leds = pca955x->chipdef->bits;
347 int i; 352 int i;
348 353
349 for (i = 0; i < leds; i++) { 354 for (i = 0; i < pca955x->chipdef->bits; i++) {
350 led_classdev_unregister(&(pca955x->led_cdev)); 355 led_classdev_unregister(&pca955x[i].led_cdev);
351 cancel_work_sync(&(pca955x->work)); 356 cancel_work_sync(&pca955x[i].work);
352 kfree(pca955x);
353 pca955x = pca955x + 1;
354 } 357 }
355 358
359 kfree(pca955x);
360 i2c_set_clientdata(client, NULL);
361
356 return 0; 362 return 0;
357} 363}
358 364
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 71dd65aa31b6..c2fcf28b4c70 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -63,6 +63,7 @@ struct multipath {
63 63
64 const char *hw_handler_name; 64 const char *hw_handler_name;
65 struct work_struct activate_path; 65 struct work_struct activate_path;
66 struct pgpath *pgpath_to_activate;
66 unsigned nr_priority_groups; 67 unsigned nr_priority_groups;
67 struct list_head priority_groups; 68 struct list_head priority_groups;
68 unsigned pg_init_required; /* pg_init needs calling? */ 69 unsigned pg_init_required; /* pg_init needs calling? */
@@ -146,6 +147,7 @@ static struct priority_group *alloc_priority_group(void)
146 147
147static void free_pgpaths(struct list_head *pgpaths, struct dm_target *ti) 148static void free_pgpaths(struct list_head *pgpaths, struct dm_target *ti)
148{ 149{
150 unsigned long flags;
149 struct pgpath *pgpath, *tmp; 151 struct pgpath *pgpath, *tmp;
150 struct multipath *m = ti->private; 152 struct multipath *m = ti->private;
151 153
@@ -154,6 +156,10 @@ static void free_pgpaths(struct list_head *pgpaths, struct dm_target *ti)
154 if (m->hw_handler_name) 156 if (m->hw_handler_name)
155 scsi_dh_detach(bdev_get_queue(pgpath->path.dev->bdev)); 157 scsi_dh_detach(bdev_get_queue(pgpath->path.dev->bdev));
156 dm_put_device(ti, pgpath->path.dev); 158 dm_put_device(ti, pgpath->path.dev);
159 spin_lock_irqsave(&m->lock, flags);
160 if (m->pgpath_to_activate == pgpath)
161 m->pgpath_to_activate = NULL;
162 spin_unlock_irqrestore(&m->lock, flags);
157 free_pgpath(pgpath); 163 free_pgpath(pgpath);
158 } 164 }
159} 165}
@@ -421,6 +427,7 @@ static void process_queued_ios(struct work_struct *work)
421 __choose_pgpath(m); 427 __choose_pgpath(m);
422 428
423 pgpath = m->current_pgpath; 429 pgpath = m->current_pgpath;
430 m->pgpath_to_activate = m->current_pgpath;
424 431
425 if ((pgpath && !m->queue_io) || 432 if ((pgpath && !m->queue_io) ||
426 (!pgpath && !m->queue_if_no_path)) 433 (!pgpath && !m->queue_if_no_path))
@@ -1093,8 +1100,15 @@ static void activate_path(struct work_struct *work)
1093 int ret; 1100 int ret;
1094 struct multipath *m = 1101 struct multipath *m =
1095 container_of(work, struct multipath, activate_path); 1102 container_of(work, struct multipath, activate_path);
1096 struct dm_path *path = &m->current_pgpath->path; 1103 struct dm_path *path;
1104 unsigned long flags;
1097 1105
1106 spin_lock_irqsave(&m->lock, flags);
1107 path = &m->pgpath_to_activate->path;
1108 m->pgpath_to_activate = NULL;
1109 spin_unlock_irqrestore(&m->lock, flags);
1110 if (!path)
1111 return;
1098 ret = scsi_dh_activate(bdev_get_queue(path->dev->bdev)); 1112 ret = scsi_dh_activate(bdev_get_queue(path->dev->bdev));
1099 pg_init_done(path, ret); 1113 pg_init_done(path, ret);
1100} 1114}
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index bca448e11878..ace998ce59f6 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -837,12 +837,14 @@ static int dm_merge_bvec(struct request_queue *q,
837 struct dm_table *map = dm_get_table(md); 837 struct dm_table *map = dm_get_table(md);
838 struct dm_target *ti; 838 struct dm_target *ti;
839 sector_t max_sectors; 839 sector_t max_sectors;
840 int max_size; 840 int max_size = 0;
841 841
842 if (unlikely(!map)) 842 if (unlikely(!map))
843 return 0; 843 goto out;
844 844
845 ti = dm_table_find_target(map, bvm->bi_sector); 845 ti = dm_table_find_target(map, bvm->bi_sector);
846 if (!dm_target_is_valid(ti))
847 goto out_table;
846 848
847 /* 849 /*
848 * Find maximum amount of I/O that won't need splitting 850 * Find maximum amount of I/O that won't need splitting
@@ -861,14 +863,16 @@ static int dm_merge_bvec(struct request_queue *q,
861 if (max_size && ti->type->merge) 863 if (max_size && ti->type->merge)
862 max_size = ti->type->merge(ti, bvm, biovec, max_size); 864 max_size = ti->type->merge(ti, bvm, biovec, max_size);
863 865
866out_table:
867 dm_table_put(map);
868
869out:
864 /* 870 /*
865 * Always allow an entire first page 871 * Always allow an entire first page
866 */ 872 */
867 if (max_size <= biovec->bv_len && !(bvm->bi_size >> SECTOR_SHIFT)) 873 if (max_size <= biovec->bv_len && !(bvm->bi_size >> SECTOR_SHIFT))
868 max_size = biovec->bv_len; 874 max_size = biovec->bv_len;
869 875
870 dm_table_put(map);
871
872 return max_size; 876 return max_size;
873} 877}
874 878
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 4790c83d78d0..deeac4b44173 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5761,7 +5761,11 @@ void md_do_sync(mddev_t *mddev)
5761 * time 'round when curr_resync == 2 5761 * time 'round when curr_resync == 2
5762 */ 5762 */
5763 continue; 5763 continue;
5764 prepare_to_wait(&resync_wait, &wq, TASK_UNINTERRUPTIBLE); 5764 /* We need to wait 'interruptible' so as not to
5765 * contribute to the load average, and not to
5766 * be caught by 'softlockup'
5767 */
5768 prepare_to_wait(&resync_wait, &wq, TASK_INTERRUPTIBLE);
5765 if (!kthread_should_stop() && 5769 if (!kthread_should_stop() &&
5766 mddev2->curr_resync >= mddev->curr_resync) { 5770 mddev2->curr_resync >= mddev->curr_resync) {
5767 printk(KERN_INFO "md: delaying %s of %s" 5771 printk(KERN_INFO "md: delaying %s of %s"
@@ -5769,6 +5773,8 @@ void md_do_sync(mddev_t *mddev)
5769 " share one or more physical units)\n", 5773 " share one or more physical units)\n",
5770 desc, mdname(mddev), mdname(mddev2)); 5774 desc, mdname(mddev), mdname(mddev2));
5771 mddev_put(mddev2); 5775 mddev_put(mddev2);
5776 if (signal_pending(current))
5777 flush_signals(current);
5772 schedule(); 5778 schedule();
5773 finish_wait(&resync_wait, &wq); 5779 finish_wait(&resync_wait, &wq);
5774 goto try_again; 5780 goto try_again;
diff --git a/drivers/media/common/tuners/tuner-xc2028.h b/drivers/media/common/tuners/tuner-xc2028.h
index 216025cf5d4b..2c5b6282b569 100644
--- a/drivers/media/common/tuners/tuner-xc2028.h
+++ b/drivers/media/common/tuners/tuner-xc2028.h
@@ -10,6 +10,7 @@
10#include "dvb_frontend.h" 10#include "dvb_frontend.h"
11 11
12#define XC2028_DEFAULT_FIRMWARE "xc3028-v27.fw" 12#define XC2028_DEFAULT_FIRMWARE "xc3028-v27.fw"
13#define XC3028L_DEFAULT_FIRMWARE "xc3028L-v36.fw"
13 14
14/* Dmoduler IF (kHz) */ 15/* Dmoduler IF (kHz) */
15#define XC3028_FE_DEFAULT 0 /* Don't load SCODE */ 16#define XC3028_FE_DEFAULT 0 /* Don't load SCODE */
diff --git a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
index 4eed783f4bce..a127a4175c40 100644
--- a/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
+++ b/drivers/media/dvb/b2c2/flexcop-fe-tuner.c
@@ -491,6 +491,7 @@ static struct s5h1420_config skystar2_rev2_7_s5h1420_config = {
491 .demod_address = 0x53, 491 .demod_address = 0x53,
492 .invert = 1, 492 .invert = 1,
493 .repeated_start_workaround = 1, 493 .repeated_start_workaround = 1,
494 .serial_mpeg = 1,
494}; 495};
495 496
496static struct itd1000_config skystar2_rev2_7_itd1000_config = { 497static struct itd1000_config skystar2_rev2_7_itd1000_config = {
diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c
index 069d847ba887..0c733c66a441 100644
--- a/drivers/media/dvb/dvb-core/dmxdev.c
+++ b/drivers/media/dvb/dvb-core/dmxdev.c
@@ -364,15 +364,16 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len,
364 enum dmx_success success) 364 enum dmx_success success)
365{ 365{
366 struct dmxdev_filter *dmxdevfilter = filter->priv; 366 struct dmxdev_filter *dmxdevfilter = filter->priv;
367 unsigned long flags;
367 int ret; 368 int ret;
368 369
369 if (dmxdevfilter->buffer.error) { 370 if (dmxdevfilter->buffer.error) {
370 wake_up(&dmxdevfilter->buffer.queue); 371 wake_up(&dmxdevfilter->buffer.queue);
371 return 0; 372 return 0;
372 } 373 }
373 spin_lock(&dmxdevfilter->dev->lock); 374 spin_lock_irqsave(&dmxdevfilter->dev->lock, flags);
374 if (dmxdevfilter->state != DMXDEV_STATE_GO) { 375 if (dmxdevfilter->state != DMXDEV_STATE_GO) {
375 spin_unlock(&dmxdevfilter->dev->lock); 376 spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags);
376 return 0; 377 return 0;
377 } 378 }
378 del_timer(&dmxdevfilter->timer); 379 del_timer(&dmxdevfilter->timer);
@@ -391,7 +392,7 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len,
391 } 392 }
392 if (dmxdevfilter->params.sec.flags & DMX_ONESHOT) 393 if (dmxdevfilter->params.sec.flags & DMX_ONESHOT)
393 dmxdevfilter->state = DMXDEV_STATE_DONE; 394 dmxdevfilter->state = DMXDEV_STATE_DONE;
394 spin_unlock(&dmxdevfilter->dev->lock); 395 spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags);
395 wake_up(&dmxdevfilter->buffer.queue); 396 wake_up(&dmxdevfilter->buffer.queue);
396 return 0; 397 return 0;
397} 398}
@@ -403,11 +404,12 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len,
403{ 404{
404 struct dmxdev_filter *dmxdevfilter = feed->priv; 405 struct dmxdev_filter *dmxdevfilter = feed->priv;
405 struct dvb_ringbuffer *buffer; 406 struct dvb_ringbuffer *buffer;
407 unsigned long flags;
406 int ret; 408 int ret;
407 409
408 spin_lock(&dmxdevfilter->dev->lock); 410 spin_lock_irqsave(&dmxdevfilter->dev->lock, flags);
409 if (dmxdevfilter->params.pes.output == DMX_OUT_DECODER) { 411 if (dmxdevfilter->params.pes.output == DMX_OUT_DECODER) {
410 spin_unlock(&dmxdevfilter->dev->lock); 412 spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags);
411 return 0; 413 return 0;
412 } 414 }
413 415
@@ -417,7 +419,7 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len,
417 else 419 else
418 buffer = &dmxdevfilter->dev->dvr_buffer; 420 buffer = &dmxdevfilter->dev->dvr_buffer;
419 if (buffer->error) { 421 if (buffer->error) {
420 spin_unlock(&dmxdevfilter->dev->lock); 422 spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags);
421 wake_up(&buffer->queue); 423 wake_up(&buffer->queue);
422 return 0; 424 return 0;
423 } 425 }
@@ -428,7 +430,7 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len,
428 dvb_ringbuffer_flush(buffer); 430 dvb_ringbuffer_flush(buffer);
429 buffer->error = ret; 431 buffer->error = ret;
430 } 432 }
431 spin_unlock(&dmxdevfilter->dev->lock); 433 spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags);
432 wake_up(&buffer->queue); 434 wake_up(&buffer->queue);
433 return 0; 435 return 0;
434} 436}
diff --git a/drivers/media/dvb/dvb-core/dvb_demux.c b/drivers/media/dvb/dvb-core/dvb_demux.c
index e2eca0b1fe7c..a2c1fd5d2f67 100644
--- a/drivers/media/dvb/dvb-core/dvb_demux.c
+++ b/drivers/media/dvb/dvb-core/dvb_demux.c
@@ -399,7 +399,9 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
399void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, 399void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf,
400 size_t count) 400 size_t count)
401{ 401{
402 spin_lock(&demux->lock); 402 unsigned long flags;
403
404 spin_lock_irqsave(&demux->lock, flags);
403 405
404 while (count--) { 406 while (count--) {
405 if (buf[0] == 0x47) 407 if (buf[0] == 0x47)
@@ -407,16 +409,17 @@ void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf,
407 buf += 188; 409 buf += 188;
408 } 410 }
409 411
410 spin_unlock(&demux->lock); 412 spin_unlock_irqrestore(&demux->lock, flags);
411} 413}
412 414
413EXPORT_SYMBOL(dvb_dmx_swfilter_packets); 415EXPORT_SYMBOL(dvb_dmx_swfilter_packets);
414 416
415void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count) 417void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count)
416{ 418{
419 unsigned long flags;
417 int p = 0, i, j; 420 int p = 0, i, j;
418 421
419 spin_lock(&demux->lock); 422 spin_lock_irqsave(&demux->lock, flags);
420 423
421 if (demux->tsbufp) { 424 if (demux->tsbufp) {
422 i = demux->tsbufp; 425 i = demux->tsbufp;
@@ -449,17 +452,18 @@ void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count)
449 } 452 }
450 453
451bailout: 454bailout:
452 spin_unlock(&demux->lock); 455 spin_unlock_irqrestore(&demux->lock, flags);
453} 456}
454 457
455EXPORT_SYMBOL(dvb_dmx_swfilter); 458EXPORT_SYMBOL(dvb_dmx_swfilter);
456 459
457void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count) 460void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count)
458{ 461{
462 unsigned long flags;
459 int p = 0, i, j; 463 int p = 0, i, j;
460 u8 tmppack[188]; 464 u8 tmppack[188];
461 465
462 spin_lock(&demux->lock); 466 spin_lock_irqsave(&demux->lock, flags);
463 467
464 if (demux->tsbufp) { 468 if (demux->tsbufp) {
465 i = demux->tsbufp; 469 i = demux->tsbufp;
@@ -500,7 +504,7 @@ void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count)
500 } 504 }
501 505
502bailout: 506bailout:
503 spin_unlock(&demux->lock); 507 spin_unlock_irqrestore(&demux->lock, flags);
504} 508}
505 509
506EXPORT_SYMBOL(dvb_dmx_swfilter_204); 510EXPORT_SYMBOL(dvb_dmx_swfilter_204);
diff --git a/drivers/media/dvb/frontends/s5h1420.c b/drivers/media/dvb/frontends/s5h1420.c
index 747d3fa2e5e5..2e9fd2893ede 100644
--- a/drivers/media/dvb/frontends/s5h1420.c
+++ b/drivers/media/dvb/frontends/s5h1420.c
@@ -59,7 +59,7 @@ struct s5h1420_state {
59 * it does not support repeated-start, workaround: write addr-1 59 * it does not support repeated-start, workaround: write addr-1
60 * and then read 60 * and then read
61 */ 61 */
62 u8 shadow[255]; 62 u8 shadow[256];
63}; 63};
64 64
65static u32 s5h1420_getsymbolrate(struct s5h1420_state* state); 65static u32 s5h1420_getsymbolrate(struct s5h1420_state* state);
@@ -94,8 +94,11 @@ static u8 s5h1420_readreg(struct s5h1420_state *state, u8 reg)
94 if (ret != 3) 94 if (ret != 3)
95 return ret; 95 return ret;
96 } else { 96 } else {
97 ret = i2c_transfer(state->i2c, &msg[1], 2); 97 ret = i2c_transfer(state->i2c, &msg[1], 1);
98 if (ret != 2) 98 if (ret != 1)
99 return ret;
100 ret = i2c_transfer(state->i2c, &msg[2], 1);
101 if (ret != 1)
99 return ret; 102 return ret;
100 } 103 }
101 104
@@ -823,7 +826,7 @@ static int s5h1420_init (struct dvb_frontend* fe)
823 struct s5h1420_state* state = fe->demodulator_priv; 826 struct s5h1420_state* state = fe->demodulator_priv;
824 827
825 /* disable power down and do reset */ 828 /* disable power down and do reset */
826 state->CON_1_val = 0x10; 829 state->CON_1_val = state->config->serial_mpeg << 4;
827 s5h1420_writereg(state, 0x02, state->CON_1_val); 830 s5h1420_writereg(state, 0x02, state->CON_1_val);
828 msleep(10); 831 msleep(10);
829 s5h1420_reset(state); 832 s5h1420_reset(state);
diff --git a/drivers/media/dvb/frontends/s5h1420.h b/drivers/media/dvb/frontends/s5h1420.h
index 4c913f142bc4..ff308136d865 100644
--- a/drivers/media/dvb/frontends/s5h1420.h
+++ b/drivers/media/dvb/frontends/s5h1420.h
@@ -32,10 +32,12 @@ struct s5h1420_config
32 u8 demod_address; 32 u8 demod_address;
33 33
34 /* does the inversion require inversion? */ 34 /* does the inversion require inversion? */
35 u8 invert : 1; 35 u8 invert:1;
36 36
37 u8 repeated_start_workaround : 1; 37 u8 repeated_start_workaround:1;
38 u8 cdclk_polarity : 1; /* 1 == falling edge, 0 == raising edge */ 38 u8 cdclk_polarity:1; /* 1 == falling edge, 0 == raising edge */
39
40 u8 serial_mpeg:1;
39}; 41};
40 42
41#if defined(CONFIG_DVB_S5H1420) || (defined(CONFIG_DVB_S5H1420_MODULE) && defined(MODULE)) 43#if defined(CONFIG_DVB_S5H1420) || (defined(CONFIG_DVB_S5H1420_MODULE) && defined(MODULE))
diff --git a/drivers/media/dvb/siano/sms-cards.c b/drivers/media/dvb/siano/sms-cards.c
index cc5efb643f33..9da260fe3fd1 100644
--- a/drivers/media/dvb/siano/sms-cards.c
+++ b/drivers/media/dvb/siano/sms-cards.c
@@ -40,6 +40,8 @@ struct usb_device_id smsusb_id_table[] = {
40 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B }, 40 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_OKEMO_B },
41 { USB_DEVICE(0x2040, 0x5500), 41 { USB_DEVICE(0x2040, 0x5500),
42 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, 42 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
43 { USB_DEVICE(0x2040, 0x5510),
44 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
43 { USB_DEVICE(0x2040, 0x5580), 45 { USB_DEVICE(0x2040, 0x5580),
44 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, 46 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
45 { USB_DEVICE(0x2040, 0x5590), 47 { USB_DEVICE(0x2040, 0x5590),
@@ -87,7 +89,7 @@ static struct sms_board sms_boards[] = {
87 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-b-dvbt-01.fw", 89 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-nova-b-dvbt-01.fw",
88 }, 90 },
89 [SMS1XXX_BOARD_HAUPPAUGE_WINDHAM] = { 91 [SMS1XXX_BOARD_HAUPPAUGE_WINDHAM] = {
90 .name = "Hauppauge WinTV-Nova-T-MiniStick", 92 .name = "Hauppauge WinTV MiniStick",
91 .type = SMS_NOVA_B0, 93 .type = SMS_NOVA_B0,
92 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-01.fw", 94 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-01.fw",
93 }, 95 },
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index ecbfa1b39b70..3e9e0dcd217e 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -968,7 +968,7 @@ config VIDEO_PXA27x
968 968
969config VIDEO_SH_MOBILE_CEU 969config VIDEO_SH_MOBILE_CEU
970 tristate "SuperH Mobile CEU Interface driver" 970 tristate "SuperH Mobile CEU Interface driver"
971 depends on VIDEO_DEV 971 depends on VIDEO_DEV && HAS_DMA
972 select SOC_CAMERA 972 select SOC_CAMERA
973 select VIDEOBUF_DMA_CONTIG 973 select VIDEOBUF_DMA_CONTIG
974 ---help--- 974 ---help---
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 6ae4cc860efe..933eaef41ead 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -3431,7 +3431,7 @@ static int radio_open(struct inode *inode, struct file *file)
3431 dprintk("bttv: open minor=%d\n",minor); 3431 dprintk("bttv: open minor=%d\n",minor);
3432 3432
3433 for (i = 0; i < bttv_num; i++) { 3433 for (i = 0; i < bttv_num; i++) {
3434 if (bttvs[i].radio_dev->minor == minor) { 3434 if (bttvs[i].radio_dev && bttvs[i].radio_dev->minor == minor) {
3435 btv = &bttvs[i]; 3435 btv = &bttvs[i];
3436 break; 3436 break;
3437 } 3437 }
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
index c149b7d712e5..5405c30dbb04 100644
--- a/drivers/media/video/cafe_ccic.c
+++ b/drivers/media/video/cafe_ccic.c
@@ -19,6 +19,7 @@
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/fs.h> 21#include <linux/fs.h>
22#include <linux/mm.h>
22#include <linux/pci.h> 23#include <linux/pci.h>
23#include <linux/i2c.h> 24#include <linux/i2c.h>
24#include <linux/interrupt.h> 25#include <linux/interrupt.h>
diff --git a/drivers/media/video/cpia2/cpia2_usb.c b/drivers/media/video/cpia2/cpia2_usb.c
index a4574740350d..a8a199047cbd 100644
--- a/drivers/media/video/cpia2/cpia2_usb.c
+++ b/drivers/media/video/cpia2/cpia2_usb.c
@@ -632,7 +632,7 @@ int cpia2_usb_transfer_cmd(struct camera_data *cam,
632static int submit_urbs(struct camera_data *cam) 632static int submit_urbs(struct camera_data *cam)
633{ 633{
634 struct urb *urb; 634 struct urb *urb;
635 int fx, err, i; 635 int fx, err, i, j;
636 636
637 for(i=0; i<NUM_SBUF; ++i) { 637 for(i=0; i<NUM_SBUF; ++i) {
638 if (cam->sbuf[i].data) 638 if (cam->sbuf[i].data)
@@ -657,6 +657,9 @@ static int submit_urbs(struct camera_data *cam)
657 } 657 }
658 urb = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL); 658 urb = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL);
659 if (!urb) { 659 if (!urb) {
660 ERR("%s: usb_alloc_urb error!\n", __func__);
661 for (j = 0; j < i; j++)
662 usb_free_urb(cam->sbuf[j].urb);
660 return -ENOMEM; 663 return -ENOMEM;
661 } 664 }
662 665
diff --git a/drivers/media/video/cx18/cx18-cards.c b/drivers/media/video/cx18/cx18-cards.c
index 8fe5f38c4d7c..3cb9734ec07b 100644
--- a/drivers/media/video/cx18/cx18-cards.c
+++ b/drivers/media/video/cx18/cx18-cards.c
@@ -163,7 +163,7 @@ static const struct cx18_card cx18_card_h900 = {
163 }, 163 },
164 .audio_inputs = { 164 .audio_inputs = {
165 { CX18_CARD_INPUT_AUD_TUNER, 165 { CX18_CARD_INPUT_AUD_TUNER,
166 CX18_AV_AUDIO8, 0 }, 166 CX18_AV_AUDIO5, 0 },
167 { CX18_CARD_INPUT_LINE_IN1, 167 { CX18_CARD_INPUT_LINE_IN1,
168 CX18_AV_AUDIO_SERIAL1, 0 }, 168 CX18_AV_AUDIO_SERIAL1, 0 },
169 }, 169 },
diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c
index 3c006103c1eb..ac3292d7646c 100644
--- a/drivers/media/video/em28xx/em28xx-audio.c
+++ b/drivers/media/video/em28xx/em28xx-audio.c
@@ -117,10 +117,10 @@ static void em28xx_audio_isocirq(struct urb *urb)
117 117
118 if (oldptr + length >= runtime->buffer_size) { 118 if (oldptr + length >= runtime->buffer_size) {
119 unsigned int cnt = 119 unsigned int cnt =
120 runtime->buffer_size - oldptr - 1; 120 runtime->buffer_size - oldptr;
121 memcpy(runtime->dma_area + oldptr * stride, cp, 121 memcpy(runtime->dma_area + oldptr * stride, cp,
122 cnt * stride); 122 cnt * stride);
123 memcpy(runtime->dma_area, cp + cnt, 123 memcpy(runtime->dma_area, cp + cnt * stride,
124 length * stride - cnt * stride); 124 length * stride - cnt * stride);
125 } else { 125 } else {
126 memcpy(runtime->dma_area + oldptr * stride, cp, 126 memcpy(runtime->dma_area + oldptr * stride, cp,
@@ -161,8 +161,14 @@ static int em28xx_init_audio_isoc(struct em28xx *dev)
161 161
162 memset(dev->adev->transfer_buffer[i], 0x80, sb_size); 162 memset(dev->adev->transfer_buffer[i], 0x80, sb_size);
163 urb = usb_alloc_urb(EM28XX_NUM_AUDIO_PACKETS, GFP_ATOMIC); 163 urb = usb_alloc_urb(EM28XX_NUM_AUDIO_PACKETS, GFP_ATOMIC);
164 if (!urb) 164 if (!urb) {
165 em28xx_errdev("usb_alloc_urb failed!\n");
166 for (j = 0; j < i; j++) {
167 usb_free_urb(dev->adev->urb[j]);
168 kfree(dev->adev->transfer_buffer[j]);
169 }
165 return -ENOMEM; 170 return -ENOMEM;
171 }
166 172
167 urb->dev = dev->udev; 173 urb->dev = dev->udev;
168 urb->context = dev; 174 urb->context = dev;
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 452da70e719f..de943cf6c169 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -93,28 +93,6 @@ struct em28xx_board em28xx_boards[] = {
93 .amux = 0, 93 .amux = 0,
94 } }, 94 } },
95 }, 95 },
96 [EM2800_BOARD_KWORLD_USB2800] = {
97 .name = "Kworld USB2800",
98 .valid = EM28XX_BOARD_NOT_VALIDATED,
99 .is_em2800 = 1,
100 .vchannels = 3,
101 .tuner_type = TUNER_PHILIPS_FCV1236D,
102 .tda9887_conf = TDA9887_PRESENT,
103 .decoder = EM28XX_SAA7113,
104 .input = { {
105 .type = EM28XX_VMUX_TELEVISION,
106 .vmux = SAA7115_COMPOSITE2,
107 .amux = 0,
108 }, {
109 .type = EM28XX_VMUX_COMPOSITE1,
110 .vmux = SAA7115_COMPOSITE0,
111 .amux = 1,
112 }, {
113 .type = EM28XX_VMUX_SVIDEO,
114 .vmux = SAA7115_SVIDEO3,
115 .amux = 1,
116 } },
117 },
118 [EM2820_BOARD_KWORLD_PVRTV2800RF] = { 96 [EM2820_BOARD_KWORLD_PVRTV2800RF] = {
119 .name = "Kworld PVR TV 2800 RF", 97 .name = "Kworld PVR TV 2800 RF",
120 .is_em2800 = 0, 98 .is_em2800 = 0,
@@ -599,7 +577,7 @@ struct em28xx_board em28xx_boards[] = {
599 }, { 577 }, {
600 .type = EM28XX_VMUX_COMPOSITE1, 578 .type = EM28XX_VMUX_COMPOSITE1,
601 .vmux = TVP5150_COMPOSITE1, 579 .vmux = TVP5150_COMPOSITE1,
602 .amux = 1, 580 .amux = 3,
603 }, { 581 }, {
604 .type = EM28XX_VMUX_SVIDEO, 582 .type = EM28XX_VMUX_SVIDEO,
605 .vmux = TVP5150_SVIDEO, 583 .vmux = TVP5150_SVIDEO,
@@ -952,22 +930,23 @@ struct em28xx_board em28xx_boards[] = {
952 }, 930 },
953 [EM2880_BOARD_KWORLD_DVB_310U] = { 931 [EM2880_BOARD_KWORLD_DVB_310U] = {
954 .name = "KWorld DVB-T 310U", 932 .name = "KWorld DVB-T 310U",
955 .valid = EM28XX_BOARD_NOT_VALIDATED,
956 .vchannels = 3, 933 .vchannels = 3,
957 .tuner_type = TUNER_XC2028, 934 .tuner_type = TUNER_XC2028,
935 .has_dvb = 1,
936 .mts_firmware = 1,
958 .decoder = EM28XX_TVP5150, 937 .decoder = EM28XX_TVP5150,
959 .input = { { 938 .input = { {
960 .type = EM28XX_VMUX_TELEVISION, 939 .type = EM28XX_VMUX_TELEVISION,
961 .vmux = TVP5150_COMPOSITE0, 940 .vmux = TVP5150_COMPOSITE0,
962 .amux = 0, 941 .amux = EM28XX_AMUX_VIDEO,
963 }, { 942 }, {
964 .type = EM28XX_VMUX_COMPOSITE1, 943 .type = EM28XX_VMUX_COMPOSITE1,
965 .vmux = TVP5150_COMPOSITE1, 944 .vmux = TVP5150_COMPOSITE1,
966 .amux = 1, 945 .amux = EM28XX_AMUX_AC97_LINE_IN,
967 }, { 946 }, { /* S-video has not been tested yet */
968 .type = EM28XX_VMUX_SVIDEO, 947 .type = EM28XX_VMUX_SVIDEO,
969 .vmux = TVP5150_SVIDEO, 948 .vmux = TVP5150_SVIDEO,
970 .amux = 1, 949 .amux = EM28XX_AMUX_AC97_LINE_IN,
971 } }, 950 } },
972 }, 951 },
973 [EM2881_BOARD_DNT_DA2_HYBRID] = { 952 [EM2881_BOARD_DNT_DA2_HYBRID] = {
@@ -1282,6 +1261,7 @@ static struct em28xx_reg_seq em2882_terratec_hybrid_xs_digital[] = {
1282static struct em28xx_hash_table em28xx_eeprom_hash [] = { 1261static struct em28xx_hash_table em28xx_eeprom_hash [] = {
1283 /* P/N: SA 60002070465 Tuner: TVF7533-MF */ 1262 /* P/N: SA 60002070465 Tuner: TVF7533-MF */
1284 {0x6ce05a8f, EM2820_BOARD_PROLINK_PLAYTV_USB2, TUNER_YMEC_TVF_5533MF}, 1263 {0x6ce05a8f, EM2820_BOARD_PROLINK_PLAYTV_USB2, TUNER_YMEC_TVF_5533MF},
1264 {0x966a0441, EM2880_BOARD_KWORLD_DVB_310U, TUNER_XC2028},
1285}; 1265};
1286 1266
1287/* I2C devicelist hash table for devices with generic USB IDs */ 1267/* I2C devicelist hash table for devices with generic USB IDs */
@@ -1552,9 +1532,12 @@ static void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
1552 /* djh - Not sure which demod we need here */ 1532 /* djh - Not sure which demod we need here */
1553 ctl->demod = XC3028_FE_DEFAULT; 1533 ctl->demod = XC3028_FE_DEFAULT;
1554 break; 1534 break;
1535 case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
1536 ctl->demod = XC3028_FE_DEFAULT;
1537 ctl->fname = XC3028L_DEFAULT_FIRMWARE;
1538 break;
1555 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950: 1539 case EM2883_BOARD_HAUPPAUGE_WINTV_HVR_950:
1556 case EM2880_BOARD_PINNACLE_PCTV_HD_PRO: 1540 case EM2880_BOARD_PINNACLE_PCTV_HD_PRO:
1557 case EM2880_BOARD_AMD_ATI_TV_WONDER_HD_600:
1558 /* FIXME: Better to specify the needed IF */ 1541 /* FIXME: Better to specify the needed IF */
1559 ctl->demod = XC3028_FE_DEFAULT; 1542 ctl->demod = XC3028_FE_DEFAULT;
1560 break; 1543 break;
@@ -1764,6 +1747,20 @@ void em28xx_card_setup(struct em28xx *dev)
1764 break; 1747 break;
1765 case EM2820_BOARD_UNKNOWN: 1748 case EM2820_BOARD_UNKNOWN:
1766 case EM2800_BOARD_UNKNOWN: 1749 case EM2800_BOARD_UNKNOWN:
1750 /*
1751 * The K-WORLD DVB-T 310U is detected as an MSI Digivox AD.
1752 *
1753 * This occurs because they share identical USB vendor and
1754 * product IDs.
1755 *
1756 * What we do here is look up the EEPROM hash of the K-WORLD
1757 * and if it is found then we decide that we do not have
1758 * a DIGIVOX and reset the device to the K-WORLD instead.
1759 *
1760 * This solution is only valid if they do not share eeprom
1761 * hash identities which has not been determined as yet.
1762 */
1763 case EM2880_BOARD_MSI_DIGIVOX_AD:
1767 if (!em28xx_hint_board(dev)) 1764 if (!em28xx_hint_board(dev))
1768 em28xx_set_model(dev); 1765 em28xx_set_model(dev);
1769 break; 1766 break;
diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c
index 4b992bc0083c..d2b1a1a52689 100644
--- a/drivers/media/video/em28xx/em28xx-dvb.c
+++ b/drivers/media/video/em28xx/em28xx-dvb.c
@@ -452,6 +452,15 @@ static int dvb_init(struct em28xx *dev)
452 goto out_free; 452 goto out_free;
453 } 453 }
454 break; 454 break;
455 case EM2880_BOARD_KWORLD_DVB_310U:
456 dvb->frontend = dvb_attach(zl10353_attach,
457 &em28xx_zl10353_with_xc3028,
458 &dev->i2c_adap);
459 if (attach_xc3028(0x61, dev) < 0) {
460 result = -EINVAL;
461 goto out_free;
462 }
463 break;
455 default: 464 default:
456 printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card" 465 printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card"
457 " isn't supported yet\n", 466 " isn't supported yet\n",
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 7be69284da03..ac95c55887df 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -459,6 +459,7 @@ static int create_urbs(struct gspca_dev *gspca_dev,
459 urb = usb_alloc_urb(npkt, GFP_KERNEL); 459 urb = usb_alloc_urb(npkt, GFP_KERNEL);
460 if (!urb) { 460 if (!urb) {
461 err("usb_alloc_urb failed"); 461 err("usb_alloc_urb failed");
462 destroy_urbs(gspca_dev);
462 return -ENOMEM; 463 return -ENOMEM;
463 } 464 }
464 urb->transfer_buffer = usb_buffer_alloc(gspca_dev->dev, 465 urb->transfer_buffer = usb_buffer_alloc(gspca_dev->dev,
@@ -468,8 +469,8 @@ static int create_urbs(struct gspca_dev *gspca_dev,
468 469
469 if (urb->transfer_buffer == NULL) { 470 if (urb->transfer_buffer == NULL) {
470 usb_free_urb(urb); 471 usb_free_urb(urb);
471 destroy_urbs(gspca_dev);
472 err("usb_buffer_urb failed"); 472 err("usb_buffer_urb failed");
473 destroy_urbs(gspca_dev);
473 return -ENOMEM; 474 return -ENOMEM;
474 } 475 }
475 gspca_dev->urb[n] = urb; 476 gspca_dev->urb[n] = urb;
diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c
index d4be51843286..ba865b7f1ed8 100644
--- a/drivers/media/video/gspca/pac7311.c
+++ b/drivers/media/video/gspca/pac7311.c
@@ -1063,6 +1063,7 @@ static __devinitdata struct usb_device_id device_table[] = {
1063 {USB_DEVICE(0x093a, 0x2621), .driver_info = SENSOR_PAC7302}, 1063 {USB_DEVICE(0x093a, 0x2621), .driver_info = SENSOR_PAC7302},
1064 {USB_DEVICE(0x093a, 0x2624), .driver_info = SENSOR_PAC7302}, 1064 {USB_DEVICE(0x093a, 0x2624), .driver_info = SENSOR_PAC7302},
1065 {USB_DEVICE(0x093a, 0x2626), .driver_info = SENSOR_PAC7302}, 1065 {USB_DEVICE(0x093a, 0x2626), .driver_info = SENSOR_PAC7302},
1066 {USB_DEVICE(0x093a, 0x262a), .driver_info = SENSOR_PAC7302},
1066 {} 1067 {}
1067}; 1068};
1068MODULE_DEVICE_TABLE(usb, device_table); 1069MODULE_DEVICE_TABLE(usb, device_table);
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c
index 5dd78c6766ea..12b81ae526b7 100644
--- a/drivers/media/video/gspca/sonixb.c
+++ b/drivers/media/video/gspca/sonixb.c
@@ -232,7 +232,7 @@ static struct ctrl sd_ctrls[] = {
232static struct v4l2_pix_format vga_mode[] = { 232static struct v4l2_pix_format vga_mode[] = {
233 {160, 120, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE, 233 {160, 120, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE,
234 .bytesperline = 160, 234 .bytesperline = 160,
235 .sizeimage = 160 * 120 * 5 / 4, 235 .sizeimage = 160 * 120,
236 .colorspace = V4L2_COLORSPACE_SRGB, 236 .colorspace = V4L2_COLORSPACE_SRGB,
237 .priv = 2 | MODE_RAW}, 237 .priv = 2 | MODE_RAW},
238 {160, 120, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE, 238 {160, 120, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE,
@@ -264,7 +264,7 @@ static struct v4l2_pix_format sif_mode[] = {
264 .priv = 1 | MODE_REDUCED_SIF}, 264 .priv = 1 | MODE_REDUCED_SIF},
265 {176, 144, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE, 265 {176, 144, V4L2_PIX_FMT_SBGGR8, V4L2_FIELD_NONE,
266 .bytesperline = 176, 266 .bytesperline = 176,
267 .sizeimage = 176 * 144 * 5 / 4, 267 .sizeimage = 176 * 144,
268 .colorspace = V4L2_COLORSPACE_SRGB, 268 .colorspace = V4L2_COLORSPACE_SRGB,
269 .priv = 1 | MODE_RAW}, 269 .priv = 1 | MODE_RAW},
270 {176, 144, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE, 270 {176, 144, V4L2_PIX_FMT_SN9C10X, V4L2_FIELD_NONE,
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index d75b1d20b318..572b0f363b64 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -707,6 +707,7 @@ static void i2c_w8(struct gspca_dev *gspca_dev,
707 0x08, 0, /* value, index */ 707 0x08, 0, /* value, index */
708 gspca_dev->usb_buf, 8, 708 gspca_dev->usb_buf, 8,
709 500); 709 500);
710 msleep(2);
710} 711}
711 712
712/* read 5 bytes in gspca_dev->usb_buf */ 713/* read 5 bytes in gspca_dev->usb_buf */
@@ -976,13 +977,13 @@ static int sd_init(struct gspca_dev *gspca_dev)
976 case BRIDGE_SN9C105: 977 case BRIDGE_SN9C105:
977 if (regF1 != 0x11) 978 if (regF1 != 0x11)
978 return -ENODEV; 979 return -ENODEV;
979 reg_w(gspca_dev, 0x02, regGpio, 2); 980 reg_w(gspca_dev, 0x01, regGpio, 2);
980 break; 981 break;
981 case BRIDGE_SN9C120: 982 case BRIDGE_SN9C120:
982 if (regF1 != 0x12) 983 if (regF1 != 0x12)
983 return -ENODEV; 984 return -ENODEV;
984 regGpio[1] = 0x70; 985 regGpio[1] = 0x70;
985 reg_w(gspca_dev, 0x02, regGpio, 2); 986 reg_w(gspca_dev, 0x01, regGpio, 2);
986 break; 987 break;
987 default: 988 default:
988/* case BRIDGE_SN9C110: */ 989/* case BRIDGE_SN9C110: */
@@ -1183,7 +1184,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
1183 static const __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; 1184 static const __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec };
1184 static const __u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd }; /* MI0360 */ 1185 static const __u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd }; /* MI0360 */
1185 static const __u8 CE_ov76xx[] = 1186 static const __u8 CE_ov76xx[] =
1186 { 0x32, 0xdd, 0x32, 0xdd }; /* OV7630/48 */ 1187 { 0x32, 0xdd, 0x32, 0xdd };
1187 1188
1188 sn9c1xx = sn_tb[(int) sd->sensor]; 1189 sn9c1xx = sn_tb[(int) sd->sensor];
1189 configure_gpio(gspca_dev, sn9c1xx); 1190 configure_gpio(gspca_dev, sn9c1xx);
@@ -1223,8 +1224,15 @@ static void sd_start(struct gspca_dev *gspca_dev)
1223 reg_w(gspca_dev, 0x20, gamma_def, sizeof gamma_def); 1224 reg_w(gspca_dev, 0x20, gamma_def, sizeof gamma_def);
1224 for (i = 0; i < 8; i++) 1225 for (i = 0; i < 8; i++)
1225 reg_w(gspca_dev, 0x84, reg84, sizeof reg84); 1226 reg_w(gspca_dev, 0x84, reg84, sizeof reg84);
1227 switch (sd->sensor) {
1228 case SENSOR_OV7660:
1229 reg_w1(gspca_dev, 0x9a, 0x05);
1230 break;
1231 default:
1226 reg_w1(gspca_dev, 0x9a, 0x08); 1232 reg_w1(gspca_dev, 0x9a, 0x08);
1227 reg_w1(gspca_dev, 0x99, 0x59); 1233 reg_w1(gspca_dev, 0x99, 0x59);
1234 break;
1235 }
1228 1236
1229 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; 1237 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
1230 if (mode) 1238 if (mode)
@@ -1275,8 +1283,8 @@ static void sd_start(struct gspca_dev *gspca_dev)
1275/* reg1 = 0x44; */ 1283/* reg1 = 0x44; */
1276/* reg1 = 0x46; (done) */ 1284/* reg1 = 0x46; (done) */
1277 } else { 1285 } else {
1278 reg17 = 0x22; /* 640 MCKSIZE */ 1286 reg17 = 0xa2; /* 640 */
1279 reg1 = 0x06; 1287 reg1 = 0x44;
1280 } 1288 }
1281 break; 1289 break;
1282 } 1290 }
@@ -1285,6 +1293,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
1285 switch (sd->sensor) { 1293 switch (sd->sensor) {
1286 case SENSOR_OV7630: 1294 case SENSOR_OV7630:
1287 case SENSOR_OV7648: 1295 case SENSOR_OV7648:
1296 case SENSOR_OV7660:
1288 reg_w(gspca_dev, 0xce, CE_ov76xx, 4); 1297 reg_w(gspca_dev, 0xce, CE_ov76xx, 4);
1289 break; 1298 break;
1290 default: 1299 default:
diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c
index cfbc9ebc5c5d..95fcfcb9e31b 100644
--- a/drivers/media/video/gspca/spca561.c
+++ b/drivers/media/video/gspca/spca561.c
@@ -225,7 +225,7 @@ static int i2c_read(struct gspca_dev *gspca_dev, __u16 reg, __u8 mode)
225 reg_w_val(gspca_dev->dev, 0x8802, (mode | 0x01)); 225 reg_w_val(gspca_dev->dev, 0x8802, (mode | 0x01));
226 do { 226 do {
227 reg_r(gspca_dev, 0x8803, 1); 227 reg_r(gspca_dev, 0x8803, 1);
228 if (!gspca_dev->usb_buf) 228 if (!gspca_dev->usb_buf[0])
229 break; 229 break;
230 } while (--retry); 230 } while (--retry);
231 if (retry == 0) 231 if (retry == 0)
diff --git a/drivers/media/video/gspca/zc3xx.c b/drivers/media/video/gspca/zc3xx.c
index 8d7c27e6ac77..d61ef727e0c2 100644
--- a/drivers/media/video/gspca/zc3xx.c
+++ b/drivers/media/video/gspca/zc3xx.c
@@ -6576,8 +6576,8 @@ static int setlightfreq(struct gspca_dev *gspca_dev)
6576 cs2102_60HZ, cs2102_60HZScale}, 6576 cs2102_60HZ, cs2102_60HZScale},
6577/* SENSOR_CS2102K 1 */ 6577/* SENSOR_CS2102K 1 */
6578 {cs2102_NoFliker, cs2102_NoFlikerScale, 6578 {cs2102_NoFliker, cs2102_NoFlikerScale,
6579 cs2102_50HZ, cs2102_50HZScale, 6579 NULL, NULL, /* currently disabled */
6580 cs2102_60HZ, cs2102_60HZScale}, 6580 NULL, NULL},
6581/* SENSOR_GC0305 2 */ 6581/* SENSOR_GC0305 2 */
6582 {gc0305_NoFliker, gc0305_NoFliker, 6582 {gc0305_NoFliker, gc0305_NoFliker,
6583 gc0305_50HZ, gc0305_50HZ, 6583 gc0305_50HZ, gc0305_50HZ,
diff --git a/drivers/media/video/ov511.c b/drivers/media/video/ov511.c
index 3d3c48db45d9..c6852402c5e9 100644
--- a/drivers/media/video/ov511.c
+++ b/drivers/media/video/ov511.c
@@ -3591,7 +3591,7 @@ static int
3591ov51x_init_isoc(struct usb_ov511 *ov) 3591ov51x_init_isoc(struct usb_ov511 *ov)
3592{ 3592{
3593 struct urb *urb; 3593 struct urb *urb;
3594 int fx, err, n, size; 3594 int fx, err, n, i, size;
3595 3595
3596 PDEBUG(3, "*** Initializing capture ***"); 3596 PDEBUG(3, "*** Initializing capture ***");
3597 3597
@@ -3662,6 +3662,8 @@ ov51x_init_isoc(struct usb_ov511 *ov)
3662 urb = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL); 3662 urb = usb_alloc_urb(FRAMES_PER_DESC, GFP_KERNEL);
3663 if (!urb) { 3663 if (!urb) {
3664 err("init isoc: usb_alloc_urb ret. NULL"); 3664 err("init isoc: usb_alloc_urb ret. NULL");
3665 for (i = 0; i < n; i++)
3666 usb_free_urb(ov->sbuf[i].urb);
3665 return -ENOMEM; 3667 return -ENOMEM;
3666 } 3668 }
3667 ov->sbuf[n].urb = urb; 3669 ov->sbuf[n].urb = urb;
@@ -5651,7 +5653,7 @@ static ssize_t show_exposure(struct device *cd,
5651 if (!ov->dev) 5653 if (!ov->dev)
5652 return -ENODEV; 5654 return -ENODEV;
5653 sensor_get_exposure(ov, &exp); 5655 sensor_get_exposure(ov, &exp);
5654 return sprintf(buf, "%d\n", exp >> 8); 5656 return sprintf(buf, "%d\n", exp);
5655} 5657}
5656static DEVICE_ATTR(exposure, S_IRUGO, show_exposure, NULL); 5658static DEVICE_ATTR(exposure, S_IRUGO, show_exposure, NULL);
5657 5659
diff --git a/drivers/media/video/pvrusb2/pvrusb2-devattr.c b/drivers/media/video/pvrusb2/pvrusb2-devattr.c
index 88e175168438..cbe2a3417851 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-devattr.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-devattr.c
@@ -489,6 +489,8 @@ static const struct pvr2_device_desc pvr2_device_751xx = {
489struct usb_device_id pvr2_device_table[] = { 489struct usb_device_id pvr2_device_table[] = {
490 { USB_DEVICE(0x2040, 0x2900), 490 { USB_DEVICE(0x2040, 0x2900),
491 .driver_info = (kernel_ulong_t)&pvr2_device_29xxx}, 491 .driver_info = (kernel_ulong_t)&pvr2_device_29xxx},
492 { USB_DEVICE(0x2040, 0x2950), /* Logically identical to 2900 */
493 .driver_info = (kernel_ulong_t)&pvr2_device_29xxx},
492 { USB_DEVICE(0x2040, 0x2400), 494 { USB_DEVICE(0x2040, 0x2400),
493 .driver_info = (kernel_ulong_t)&pvr2_device_24xxx}, 495 .driver_info = (kernel_ulong_t)&pvr2_device_24xxx},
494 { USB_DEVICE(0x1164, 0x0622), 496 { USB_DEVICE(0x1164, 0x0622),
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c
index b1d09d8e2b85..92b83feae366 100644
--- a/drivers/media/video/s2255drv.c
+++ b/drivers/media/video/s2255drv.c
@@ -669,7 +669,7 @@ static void s2255_fillbuff(struct s2255_dev *dev, struct s2255_buffer *buf,
669 (unsigned long)vbuf, pos); 669 (unsigned long)vbuf, pos);
670 /* tell v4l buffer was filled */ 670 /* tell v4l buffer was filled */
671 671
672 buf->vb.field_count++; 672 buf->vb.field_count = dev->frame_count[chn] * 2;
673 do_gettimeofday(&ts); 673 do_gettimeofday(&ts);
674 buf->vb.ts = ts; 674 buf->vb.ts = ts;
675 buf->vb.state = VIDEOBUF_DONE; 675 buf->vb.state = VIDEOBUF_DONE;
@@ -1268,6 +1268,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
1268 dev->last_frame[chn] = -1; 1268 dev->last_frame[chn] = -1;
1269 dev->bad_payload[chn] = 0; 1269 dev->bad_payload[chn] = 0;
1270 dev->cur_frame[chn] = 0; 1270 dev->cur_frame[chn] = 0;
1271 dev->frame_count[chn] = 0;
1271 for (j = 0; j < SYS_FRAMES; j++) { 1272 for (j = 0; j < SYS_FRAMES; j++) {
1272 dev->buffer[chn].frame[j].ulState = 0; 1273 dev->buffer[chn].frame[j].ulState = 0;
1273 dev->buffer[chn].frame[j].cur_size = 0; 1274 dev->buffer[chn].frame[j].cur_size = 0;
diff --git a/drivers/media/video/uvc/uvc_ctrl.c b/drivers/media/video/uvc/uvc_ctrl.c
index 6ef3e5297de8..feab12aa2c7b 100644
--- a/drivers/media/video/uvc/uvc_ctrl.c
+++ b/drivers/media/video/uvc/uvc_ctrl.c
@@ -592,7 +592,7 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
592 if (ctrl == NULL) 592 if (ctrl == NULL)
593 return -EINVAL; 593 return -EINVAL;
594 594
595 data = kmalloc(8, GFP_KERNEL); 595 data = kmalloc(ctrl->info->size, GFP_KERNEL);
596 if (data == NULL) 596 if (data == NULL)
597 return -ENOMEM; 597 return -ENOMEM;
598 598
diff --git a/drivers/media/video/w9968cf.c b/drivers/media/video/w9968cf.c
index 168baabe4659..11edf79f57be 100644
--- a/drivers/media/video/w9968cf.c
+++ b/drivers/media/video/w9968cf.c
@@ -911,7 +911,6 @@ static int w9968cf_start_transfer(struct w9968cf_device* cam)
911 911
912 for (i = 0; i < W9968CF_URBS; i++) { 912 for (i = 0; i < W9968CF_URBS; i++) {
913 urb = usb_alloc_urb(W9968CF_ISO_PACKETS, GFP_KERNEL); 913 urb = usb_alloc_urb(W9968CF_ISO_PACKETS, GFP_KERNEL);
914 cam->urb[i] = urb;
915 if (!urb) { 914 if (!urb) {
916 for (j = 0; j < i; j++) 915 for (j = 0; j < i; j++)
917 usb_free_urb(cam->urb[j]); 916 usb_free_urb(cam->urb[j]);
@@ -919,6 +918,7 @@ static int w9968cf_start_transfer(struct w9968cf_device* cam)
919 return -ENOMEM; 918 return -ENOMEM;
920 } 919 }
921 920
921 cam->urb[i] = urb;
922 urb->dev = udev; 922 urb->dev = udev;
923 urb->context = (void*)cam; 923 urb->context = (void*)cam;
924 urb->pipe = usb_rcvisocpipe(udev, 1); 924 urb->pipe = usb_rcvisocpipe(udev, 1);
diff --git a/drivers/media/video/wm8739.c b/drivers/media/video/wm8739.c
index 95c79ad80487..54ac3fe26ec2 100644
--- a/drivers/media/video/wm8739.c
+++ b/drivers/media/video/wm8739.c
@@ -274,10 +274,8 @@ static int wm8739_probe(struct i2c_client *client,
274 client->addr << 1, client->adapter->name); 274 client->addr << 1, client->adapter->name);
275 275
276 state = kmalloc(sizeof(struct wm8739_state), GFP_KERNEL); 276 state = kmalloc(sizeof(struct wm8739_state), GFP_KERNEL);
277 if (state == NULL) { 277 if (state == NULL)
278 kfree(client);
279 return -ENOMEM; 278 return -ENOMEM;
280 }
281 state->vol_l = 0x17; /* 0dB */ 279 state->vol_l = 0x17; /* 0dB */
282 state->vol_r = 0x17; /* 0dB */ 280 state->vol_r = 0x17; /* 0dB */
283 state->muted = 0; 281 state->muted = 0;
diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c
index d842a7cb99d2..3282be730298 100644
--- a/drivers/media/video/zoran_card.c
+++ b/drivers/media/video/zoran_card.c
@@ -988,7 +988,7 @@ zoran_open_init_params (struct zoran *zr)
988 zr->v4l_grab_seq = 0; 988 zr->v4l_grab_seq = 0;
989 zr->v4l_settings.width = 192; 989 zr->v4l_settings.width = 192;
990 zr->v4l_settings.height = 144; 990 zr->v4l_settings.height = 144;
991 zr->v4l_settings.format = &zoran_formats[4]; /* YUY2 - YUV-4:2:2 packed */ 991 zr->v4l_settings.format = &zoran_formats[7]; /* YUY2 - YUV-4:2:2 packed */
992 zr->v4l_settings.bytesperline = 992 zr->v4l_settings.bytesperline =
993 zr->v4l_settings.width * 993 zr->v4l_settings.width *
994 ((zr->v4l_settings.format->depth + 7) / 8); 994 ((zr->v4l_settings.format->depth + 7) / 8);
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c
index ec6f59674b10..2dab9eea4def 100644
--- a/drivers/media/video/zoran_driver.c
+++ b/drivers/media/video/zoran_driver.c
@@ -134,7 +134,7 @@ const struct zoran_format zoran_formats[] = {
134 }, { 134 }, {
135 .name = "16-bit RGB BE", 135 .name = "16-bit RGB BE",
136 ZFMT(-1, 136 ZFMT(-1,
137 V4L2_PIX_FMT_RGB565, V4L2_COLORSPACE_SRGB), 137 V4L2_PIX_FMT_RGB565X, V4L2_COLORSPACE_SRGB),
138 .depth = 16, 138 .depth = 16,
139 .flags = ZORAN_FORMAT_CAPTURE | 139 .flags = ZORAN_FORMAT_CAPTURE |
140 ZORAN_FORMAT_OVERLAY, 140 ZORAN_FORMAT_OVERLAY,
@@ -2737,7 +2737,8 @@ zoran_do_ioctl (struct inode *inode,
2737 fh->v4l_settings.format->fourcc; 2737 fh->v4l_settings.format->fourcc;
2738 fmt->fmt.pix.colorspace = 2738 fmt->fmt.pix.colorspace =
2739 fh->v4l_settings.format->colorspace; 2739 fh->v4l_settings.format->colorspace;
2740 fmt->fmt.pix.bytesperline = 0; 2740 fmt->fmt.pix.bytesperline =
2741 fh->v4l_settings.bytesperline;
2741 if (BUZ_MAX_HEIGHT < 2742 if (BUZ_MAX_HEIGHT <
2742 (fh->v4l_settings.height * 2)) 2743 (fh->v4l_settings.height * 2))
2743 fmt->fmt.pix.field = 2744 fmt->fmt.pix.field =
@@ -2833,13 +2834,6 @@ zoran_do_ioctl (struct inode *inode,
2833 fmt->fmt.pix.pixelformat, 2834 fmt->fmt.pix.pixelformat,
2834 (char *) &printformat); 2835 (char *) &printformat);
2835 2836
2836 if (fmt->fmt.pix.bytesperline > 0) {
2837 dprintk(5,
2838 KERN_ERR "%s: bpl not supported\n",
2839 ZR_DEVNAME(zr));
2840 return -EINVAL;
2841 }
2842
2843 /* we can be requested to do JPEG/raw playback/capture */ 2837 /* we can be requested to do JPEG/raw playback/capture */
2844 if (! 2838 if (!
2845 (fmt->type == V4L2_BUF_TYPE_VIDEO_CAPTURE || 2839 (fmt->type == V4L2_BUF_TYPE_VIDEO_CAPTURE ||
@@ -2923,6 +2917,7 @@ zoran_do_ioctl (struct inode *inode,
2923 fh->jpg_buffers.buffer_size = 2917 fh->jpg_buffers.buffer_size =
2924 zoran_v4l2_calc_bufsize(&fh-> 2918 zoran_v4l2_calc_bufsize(&fh->
2925 jpg_settings); 2919 jpg_settings);
2920 fmt->fmt.pix.bytesperline = 0;
2926 fmt->fmt.pix.sizeimage = 2921 fmt->fmt.pix.sizeimage =
2927 fh->jpg_buffers.buffer_size; 2922 fh->jpg_buffers.buffer_size;
2928 2923
@@ -2979,6 +2974,8 @@ zoran_do_ioctl (struct inode *inode,
2979 2974
2980 /* tell the user the 2975 /* tell the user the
2981 * results/missing stuff */ 2976 * results/missing stuff */
2977 fmt->fmt.pix.bytesperline =
2978 fh->v4l_settings.bytesperline;
2982 fmt->fmt.pix.sizeimage = 2979 fmt->fmt.pix.sizeimage =
2983 fh->v4l_settings.height * 2980 fh->v4l_settings.height *
2984 fh->v4l_settings.bytesperline; 2981 fh->v4l_settings.bytesperline;
diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c
index a38005008a20..cea46906408e 100644
--- a/drivers/memstick/core/memstick.c
+++ b/drivers/memstick/core/memstick.c
@@ -185,7 +185,7 @@ static void memstick_free(struct device *dev)
185} 185}
186 186
187static struct class memstick_host_class = { 187static struct class memstick_host_class = {
188 .name = "memstick_host", 188 .name = "memstick_host",
189 .dev_release = memstick_free 189 .dev_release = memstick_free
190}; 190};
191 191
@@ -264,7 +264,7 @@ EXPORT_SYMBOL(memstick_new_req);
264 * @sg - TPC argument 264 * @sg - TPC argument
265 */ 265 */
266void memstick_init_req_sg(struct memstick_request *mrq, unsigned char tpc, 266void memstick_init_req_sg(struct memstick_request *mrq, unsigned char tpc,
267 struct scatterlist *sg) 267 const struct scatterlist *sg)
268{ 268{
269 mrq->tpc = tpc; 269 mrq->tpc = tpc;
270 if (tpc & 8) 270 if (tpc & 8)
@@ -294,7 +294,7 @@ EXPORT_SYMBOL(memstick_init_req_sg);
294 * user supplied buffer. 294 * user supplied buffer.
295 */ 295 */
296void memstick_init_req(struct memstick_request *mrq, unsigned char tpc, 296void memstick_init_req(struct memstick_request *mrq, unsigned char tpc,
297 void *buf, size_t length) 297 const void *buf, size_t length)
298{ 298{
299 mrq->tpc = tpc; 299 mrq->tpc = tpc;
300 if (tpc & 8) 300 if (tpc & 8)
@@ -439,7 +439,7 @@ static void memstick_check(struct work_struct *work)
439 if (!host->card) { 439 if (!host->card) {
440 if (memstick_power_on(host)) 440 if (memstick_power_on(host))
441 goto out_power_off; 441 goto out_power_off;
442 } else 442 } else if (host->card->stop)
443 host->card->stop(host->card); 443 host->card->stop(host->card);
444 444
445 card = memstick_alloc_card(host); 445 card = memstick_alloc_card(host);
@@ -458,7 +458,7 @@ static void memstick_check(struct work_struct *work)
458 || !(host->card->check(host->card))) { 458 || !(host->card->check(host->card))) {
459 device_unregister(&host->card->dev); 459 device_unregister(&host->card->dev);
460 host->card = NULL; 460 host->card = NULL;
461 } else 461 } else if (host->card->start)
462 host->card->start(host->card); 462 host->card->start(host->card);
463 } 463 }
464 464
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c
index 44b1817f2f2f..d2d2318dafa4 100644
--- a/drivers/memstick/core/mspro_block.c
+++ b/drivers/memstick/core/mspro_block.c
@@ -30,6 +30,8 @@ module_param(major, int, 0644);
30#define MSPRO_BLOCK_SIGNATURE 0xa5c3 30#define MSPRO_BLOCK_SIGNATURE 0xa5c3
31#define MSPRO_BLOCK_MAX_ATTRIBUTES 41 31#define MSPRO_BLOCK_MAX_ATTRIBUTES 41
32 32
33#define MSPRO_BLOCK_PART_SHIFT 3
34
33enum { 35enum {
34 MSPRO_BLOCK_ID_SYSINFO = 0x10, 36 MSPRO_BLOCK_ID_SYSINFO = 0x10,
35 MSPRO_BLOCK_ID_MODELNAME = 0x15, 37 MSPRO_BLOCK_ID_MODELNAME = 0x15,
@@ -195,7 +197,7 @@ static int mspro_block_bd_open(struct inode *inode, struct file *filp)
195static int mspro_block_disk_release(struct gendisk *disk) 197static int mspro_block_disk_release(struct gendisk *disk)
196{ 198{
197 struct mspro_block_data *msb = disk->private_data; 199 struct mspro_block_data *msb = disk->private_data;
198 int disk_id = disk->first_minor >> MEMSTICK_PART_SHIFT; 200 int disk_id = disk->first_minor >> MSPRO_BLOCK_PART_SHIFT;
199 201
200 mutex_lock(&mspro_block_disk_lock); 202 mutex_lock(&mspro_block_disk_lock);
201 203
@@ -877,6 +879,7 @@ static int mspro_block_switch_interface(struct memstick_dev *card)
877 struct mspro_block_data *msb = memstick_get_drvdata(card); 879 struct mspro_block_data *msb = memstick_get_drvdata(card);
878 int rc = 0; 880 int rc = 0;
879 881
882try_again:
880 if (msb->caps & MEMSTICK_CAP_PAR4) 883 if (msb->caps & MEMSTICK_CAP_PAR4)
881 rc = mspro_block_set_interface(card, MEMSTICK_SYS_PAR4); 884 rc = mspro_block_set_interface(card, MEMSTICK_SYS_PAR4);
882 else 885 else
@@ -930,6 +933,18 @@ static int mspro_block_switch_interface(struct memstick_dev *card)
930 rc = memstick_set_rw_addr(card); 933 rc = memstick_set_rw_addr(card);
931 if (!rc) 934 if (!rc)
932 rc = mspro_block_set_interface(card, msb->system); 935 rc = mspro_block_set_interface(card, msb->system);
936
937 if (!rc) {
938 msleep(150);
939 rc = mspro_block_wait_for_ced(card);
940 if (rc)
941 return rc;
942
943 if (msb->caps & MEMSTICK_CAP_PAR8) {
944 msb->caps &= ~MEMSTICK_CAP_PAR8;
945 goto try_again;
946 }
947 }
933 } 948 }
934 return rc; 949 return rc;
935} 950}
@@ -1117,14 +1132,16 @@ static int mspro_block_init_card(struct memstick_dev *card)
1117 return -EIO; 1132 return -EIO;
1118 1133
1119 msb->caps = host->caps; 1134 msb->caps = host->caps;
1120 rc = mspro_block_switch_interface(card); 1135
1136 msleep(150);
1137 rc = mspro_block_wait_for_ced(card);
1121 if (rc) 1138 if (rc)
1122 return rc; 1139 return rc;
1123 1140
1124 msleep(200); 1141 rc = mspro_block_switch_interface(card);
1125 rc = mspro_block_wait_for_ced(card);
1126 if (rc) 1142 if (rc)
1127 return rc; 1143 return rc;
1144
1128 dev_dbg(&card->dev, "card activated\n"); 1145 dev_dbg(&card->dev, "card activated\n");
1129 if (msb->system != MEMSTICK_SYS_SERIAL) 1146 if (msb->system != MEMSTICK_SYS_SERIAL)
1130 msb->caps |= MEMSTICK_CAP_AUTO_GET_INT; 1147 msb->caps |= MEMSTICK_CAP_AUTO_GET_INT;
@@ -1192,12 +1209,12 @@ static int mspro_block_init_disk(struct memstick_dev *card)
1192 if (rc) 1209 if (rc)
1193 return rc; 1210 return rc;
1194 1211
1195 if ((disk_id << MEMSTICK_PART_SHIFT) > 255) { 1212 if ((disk_id << MSPRO_BLOCK_PART_SHIFT) > 255) {
1196 rc = -ENOSPC; 1213 rc = -ENOSPC;
1197 goto out_release_id; 1214 goto out_release_id;
1198 } 1215 }
1199 1216
1200 msb->disk = alloc_disk(1 << MEMSTICK_PART_SHIFT); 1217 msb->disk = alloc_disk(1 << MSPRO_BLOCK_PART_SHIFT);
1201 if (!msb->disk) { 1218 if (!msb->disk) {
1202 rc = -ENOMEM; 1219 rc = -ENOMEM;
1203 goto out_release_id; 1220 goto out_release_id;
@@ -1220,7 +1237,7 @@ static int mspro_block_init_disk(struct memstick_dev *card)
1220 MSPRO_BLOCK_MAX_PAGES * msb->page_size); 1237 MSPRO_BLOCK_MAX_PAGES * msb->page_size);
1221 1238
1222 msb->disk->major = major; 1239 msb->disk->major = major;
1223 msb->disk->first_minor = disk_id << MEMSTICK_PART_SHIFT; 1240 msb->disk->first_minor = disk_id << MSPRO_BLOCK_PART_SHIFT;
1224 msb->disk->fops = &ms_block_bdops; 1241 msb->disk->fops = &ms_block_bdops;
1225 msb->usage_count = 1; 1242 msb->usage_count = 1;
1226 msb->disk->private_data = msb; 1243 msb->disk->private_data = msb;
@@ -1416,7 +1433,7 @@ out_unlock:
1416 1433
1417static struct memstick_device_id mspro_block_id_tbl[] = { 1434static struct memstick_device_id mspro_block_id_tbl[] = {
1418 {MEMSTICK_MATCH_ALL, MEMSTICK_TYPE_PRO, MEMSTICK_CATEGORY_STORAGE_DUO, 1435 {MEMSTICK_MATCH_ALL, MEMSTICK_TYPE_PRO, MEMSTICK_CATEGORY_STORAGE_DUO,
1419 MEMSTICK_CLASS_GENERIC_DUO}, 1436 MEMSTICK_CLASS_DUO},
1420 {} 1437 {}
1421}; 1438};
1422 1439
diff --git a/drivers/memstick/host/jmb38x_ms.c b/drivers/memstick/host/jmb38x_ms.c
index 3485c63d20b0..2fb95a5b72eb 100644
--- a/drivers/memstick/host/jmb38x_ms.c
+++ b/drivers/memstick/host/jmb38x_ms.c
@@ -81,6 +81,8 @@ struct jmb38x_ms {
81#define TPC_CODE_SZ_MASK 0x00000700 81#define TPC_CODE_SZ_MASK 0x00000700
82#define TPC_DATA_SZ_MASK 0x00000007 82#define TPC_DATA_SZ_MASK 0x00000007
83 83
84#define HOST_CONTROL_TDELAY_EN 0x00040000
85#define HOST_CONTROL_HW_OC_P 0x00010000
84#define HOST_CONTROL_RESET_REQ 0x00008000 86#define HOST_CONTROL_RESET_REQ 0x00008000
85#define HOST_CONTROL_REI 0x00004000 87#define HOST_CONTROL_REI 0x00004000
86#define HOST_CONTROL_LED 0x00000400 88#define HOST_CONTROL_LED 0x00000400
@@ -88,6 +90,7 @@ struct jmb38x_ms {
88#define HOST_CONTROL_RESET 0x00000100 90#define HOST_CONTROL_RESET 0x00000100
89#define HOST_CONTROL_POWER_EN 0x00000080 91#define HOST_CONTROL_POWER_EN 0x00000080
90#define HOST_CONTROL_CLOCK_EN 0x00000040 92#define HOST_CONTROL_CLOCK_EN 0x00000040
93#define HOST_CONTROL_REO 0x00000008
91#define HOST_CONTROL_IF_SHIFT 4 94#define HOST_CONTROL_IF_SHIFT 4
92 95
93#define HOST_CONTROL_IF_SERIAL 0x0 96#define HOST_CONTROL_IF_SERIAL 0x0
@@ -133,11 +136,15 @@ struct jmb38x_ms {
133#define PAD_PU_PD_ON_MS_SOCK1 0x0f0f0000 136#define PAD_PU_PD_ON_MS_SOCK1 0x0f0f0000
134 137
135#define CLOCK_CONTROL_40MHZ 0x00000001 138#define CLOCK_CONTROL_40MHZ 0x00000001
136#define CLOCK_CONTROL_50MHZ 0x00000002 139#define CLOCK_CONTROL_50MHZ 0x0000000a
137#define CLOCK_CONTROL_60MHZ 0x00000008 140#define CLOCK_CONTROL_60MHZ 0x00000008
138#define CLOCK_CONTROL_62_5MHZ 0x0000000c 141#define CLOCK_CONTROL_62_5MHZ 0x0000000c
139#define CLOCK_CONTROL_OFF 0x00000000 142#define CLOCK_CONTROL_OFF 0x00000000
140 143
144#define PCI_CTL_CLOCK_DLY_ADDR 0x000000b0
145#define PCI_CTL_CLOCK_DLY_MASK_A 0x00000f00
146#define PCI_CTL_CLOCK_DLY_MASK_B 0x0000f000
147
141enum { 148enum {
142 CMD_READY = 0x01, 149 CMD_READY = 0x01,
143 FIFO_READY = 0x02, 150 FIFO_READY = 0x02,
@@ -367,8 +374,7 @@ static int jmb38x_ms_issue_cmd(struct memstick_host *msh)
367 return host->req->error; 374 return host->req->error;
368 } 375 }
369 376
370 dev_dbg(&msh->dev, "control %08x\n", 377 dev_dbg(&msh->dev, "control %08x\n", readl(host->addr + HOST_CONTROL));
371 readl(host->addr + HOST_CONTROL));
372 dev_dbg(&msh->dev, "status %08x\n", readl(host->addr + INT_STATUS)); 378 dev_dbg(&msh->dev, "status %08x\n", readl(host->addr + INT_STATUS));
373 dev_dbg(&msh->dev, "hstatus %08x\n", readl(host->addr + STATUS)); 379 dev_dbg(&msh->dev, "hstatus %08x\n", readl(host->addr + STATUS));
374 380
@@ -637,7 +643,7 @@ static int jmb38x_ms_reset(struct jmb38x_ms_host *host)
637 ndelay(20); 643 ndelay(20);
638 } 644 }
639 dev_dbg(&host->chip->pdev->dev, "reset_req timeout\n"); 645 dev_dbg(&host->chip->pdev->dev, "reset_req timeout\n");
640 return -EIO; 646 /* return -EIO; */
641 647
642reset_next: 648reset_next:
643 writel(HOST_CONTROL_RESET | HOST_CONTROL_CLOCK_EN 649 writel(HOST_CONTROL_RESET | HOST_CONTROL_CLOCK_EN
@@ -680,7 +686,9 @@ static int jmb38x_ms_set_param(struct memstick_host *msh,
680 686
681 host_ctl = 7; 687 host_ctl = 7;
682 host_ctl |= HOST_CONTROL_POWER_EN 688 host_ctl |= HOST_CONTROL_POWER_EN
683 | HOST_CONTROL_CLOCK_EN; 689 | HOST_CONTROL_CLOCK_EN
690 | HOST_CONTROL_HW_OC_P
691 | HOST_CONTROL_TDELAY_EN;
684 writel(host_ctl, host->addr + HOST_CONTROL); 692 writel(host_ctl, host->addr + HOST_CONTROL);
685 693
686 writel(host->id ? PAD_PU_PD_ON_MS_SOCK1 694 writel(host->id ? PAD_PU_PD_ON_MS_SOCK1
@@ -704,33 +712,40 @@ static int jmb38x_ms_set_param(struct memstick_host *msh,
704 break; 712 break;
705 case MEMSTICK_INTERFACE: 713 case MEMSTICK_INTERFACE:
706 host_ctl &= ~(3 << HOST_CONTROL_IF_SHIFT); 714 host_ctl &= ~(3 << HOST_CONTROL_IF_SHIFT);
715 pci_read_config_dword(host->chip->pdev,
716 PCI_CTL_CLOCK_DLY_ADDR,
717 &clock_delay);
718 clock_delay &= host->id ? ~PCI_CTL_CLOCK_DLY_MASK_B
719 : ~PCI_CTL_CLOCK_DLY_MASK_A;
707 720
708 if (value == MEMSTICK_SERIAL) { 721 if (value == MEMSTICK_SERIAL) {
709 host_ctl &= ~HOST_CONTROL_FAST_CLK; 722 host_ctl &= ~HOST_CONTROL_FAST_CLK;
723 host_ctl &= ~HOST_CONTROL_REO;
710 host_ctl |= HOST_CONTROL_IF_SERIAL 724 host_ctl |= HOST_CONTROL_IF_SERIAL
711 << HOST_CONTROL_IF_SHIFT; 725 << HOST_CONTROL_IF_SHIFT;
712 host_ctl |= HOST_CONTROL_REI; 726 host_ctl |= HOST_CONTROL_REI;
713 clock_ctl = CLOCK_CONTROL_40MHZ; 727 clock_ctl = CLOCK_CONTROL_40MHZ;
714 clock_delay = 0;
715 } else if (value == MEMSTICK_PAR4) { 728 } else if (value == MEMSTICK_PAR4) {
716 host_ctl |= HOST_CONTROL_FAST_CLK; 729 host_ctl |= HOST_CONTROL_FAST_CLK | HOST_CONTROL_REO;
717 host_ctl |= HOST_CONTROL_IF_PAR4 730 host_ctl |= HOST_CONTROL_IF_PAR4
718 << HOST_CONTROL_IF_SHIFT; 731 << HOST_CONTROL_IF_SHIFT;
719 host_ctl &= ~HOST_CONTROL_REI; 732 host_ctl &= ~HOST_CONTROL_REI;
720 clock_ctl = CLOCK_CONTROL_40MHZ; 733 clock_ctl = CLOCK_CONTROL_40MHZ;
721 clock_delay = 4; 734 clock_delay |= host->id ? (4 << 12) : (4 << 8);
722 } else if (value == MEMSTICK_PAR8) { 735 } else if (value == MEMSTICK_PAR8) {
723 host_ctl |= HOST_CONTROL_FAST_CLK; 736 host_ctl |= HOST_CONTROL_FAST_CLK;
724 host_ctl |= HOST_CONTROL_IF_PAR8 737 host_ctl |= HOST_CONTROL_IF_PAR8
725 << HOST_CONTROL_IF_SHIFT; 738 << HOST_CONTROL_IF_SHIFT;
726 host_ctl &= ~HOST_CONTROL_REI; 739 host_ctl &= ~(HOST_CONTROL_REI | HOST_CONTROL_REO);
727 clock_ctl = CLOCK_CONTROL_60MHZ; 740 clock_ctl = CLOCK_CONTROL_50MHZ;
728 clock_delay = 0;
729 } else 741 } else
730 return -EINVAL; 742 return -EINVAL;
743
731 writel(host_ctl, host->addr + HOST_CONTROL); 744 writel(host_ctl, host->addr + HOST_CONTROL);
732 writel(clock_ctl, host->addr + CLOCK_CONTROL); 745 writel(clock_ctl, host->addr + CLOCK_CONTROL);
733 writel(clock_delay, host->addr + CLOCK_DELAY); 746 pci_write_config_dword(host->chip->pdev,
747 PCI_CTL_CLOCK_DLY_ADDR,
748 clock_delay);
734 break; 749 break;
735 }; 750 };
736 return 0; 751 return 0;
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 10c44d3fe01a..68dc8d9eb24e 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -21,7 +21,7 @@ config MFD_SM501
21 21
22config MFD_SM501_GPIO 22config MFD_SM501_GPIO
23 bool "Export GPIO via GPIO layer" 23 bool "Export GPIO via GPIO layer"
24 depends on MFD_SM501 && HAVE_GPIO_LIB 24 depends on MFD_SM501 && GPIOLIB
25 ---help--- 25 ---help---
26 This option uses the gpio library layer to export the 64 GPIO 26 This option uses the gpio library layer to export the 64 GPIO
27 lines on the SM501. The platform data is used to supply the 27 lines on the SM501. The platform data is used to supply the
@@ -29,7 +29,7 @@ config MFD_SM501_GPIO
29 29
30config MFD_ASIC3 30config MFD_ASIC3
31 bool "Support for Compaq ASIC3" 31 bool "Support for Compaq ASIC3"
32 depends on GENERIC_HARDIRQS && HAVE_GPIO_LIB && ARM 32 depends on GENERIC_HARDIRQS && GPIOLIB && ARM
33 ---help--- 33 ---help---
34 This driver supports the ASIC3 multifunction chip found on many 34 This driver supports the ASIC3 multifunction chip found on many
35 PDAs (mainly iPAQ and HTC based ones) 35 PDAs (mainly iPAQ and HTC based ones)
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
index bc2a807f210d..ba5aa2008273 100644
--- a/drivers/mfd/asic3.c
+++ b/drivers/mfd/asic3.c
@@ -312,7 +312,6 @@ static int __init asic3_irq_probe(struct platform_device *pdev)
312 struct asic3 *asic = platform_get_drvdata(pdev); 312 struct asic3 *asic = platform_get_drvdata(pdev);
313 unsigned long clksel = 0; 313 unsigned long clksel = 0;
314 unsigned int irq, irq_base; 314 unsigned int irq, irq_base;
315 int map_size;
316 int ret; 315 int ret;
317 316
318 ret = platform_get_irq(pdev, 0); 317 ret = platform_get_irq(pdev, 0);
@@ -534,6 +533,7 @@ static int __init asic3_probe(struct platform_device *pdev)
534 struct asic3 *asic; 533 struct asic3 *asic;
535 struct resource *mem; 534 struct resource *mem;
536 unsigned long clksel; 535 unsigned long clksel;
536 int map_size;
537 int ret = 0; 537 int ret = 0;
538 538
539 asic = kzalloc(sizeof(struct asic3), GFP_KERNEL); 539 asic = kzalloc(sizeof(struct asic3), GFP_KERNEL);
diff --git a/drivers/misc/eeepc-laptop.c b/drivers/misc/eeepc-laptop.c
index facdb9893c84..1ee8501e90f1 100644
--- a/drivers/misc/eeepc-laptop.c
+++ b/drivers/misc/eeepc-laptop.c
@@ -450,12 +450,14 @@ static int eeepc_get_fan_pwm(void)
450 int value = 0; 450 int value = 0;
451 451
452 read_acpi_int(NULL, EEEPC_EC_FAN_PWM, &value); 452 read_acpi_int(NULL, EEEPC_EC_FAN_PWM, &value);
453 value = value * 255 / 100;
453 return (value); 454 return (value);
454} 455}
455 456
456static void eeepc_set_fan_pwm(int value) 457static void eeepc_set_fan_pwm(int value)
457{ 458{
458 value = SENSORS_LIMIT(value, 0, 100); 459 value = SENSORS_LIMIT(value, 0, 255);
460 value = value * 100 / 255;
459 ec_write(EEEPC_EC_SC02, value); 461 ec_write(EEEPC_EC_SC02, value);
460} 462}
461 463
@@ -520,15 +522,23 @@ static ssize_t show_sys_hwmon(int (*get)(void), char *buf)
520 static SENSOR_DEVICE_ATTR(_name, _mode, show_##_name, store_##_name, 0); 522 static SENSOR_DEVICE_ATTR(_name, _mode, show_##_name, store_##_name, 0);
521 523
522EEEPC_CREATE_SENSOR_ATTR(fan1_input, S_IRUGO, eeepc_get_fan_rpm, NULL); 524EEEPC_CREATE_SENSOR_ATTR(fan1_input, S_IRUGO, eeepc_get_fan_rpm, NULL);
523EEEPC_CREATE_SENSOR_ATTR(fan1_pwm, S_IRUGO | S_IWUSR, 525EEEPC_CREATE_SENSOR_ATTR(pwm1, S_IRUGO | S_IWUSR,
524 eeepc_get_fan_pwm, eeepc_set_fan_pwm); 526 eeepc_get_fan_pwm, eeepc_set_fan_pwm);
525EEEPC_CREATE_SENSOR_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, 527EEEPC_CREATE_SENSOR_ATTR(pwm1_enable, S_IRUGO | S_IWUSR,
526 eeepc_get_fan_ctrl, eeepc_set_fan_ctrl); 528 eeepc_get_fan_ctrl, eeepc_set_fan_ctrl);
527 529
530static ssize_t
531show_name(struct device *dev, struct device_attribute *attr, char *buf)
532{
533 return sprintf(buf, "eeepc\n");
534}
535static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0);
536
528static struct attribute *hwmon_attributes[] = { 537static struct attribute *hwmon_attributes[] = {
529 &sensor_dev_attr_fan1_pwm.dev_attr.attr, 538 &sensor_dev_attr_pwm1.dev_attr.attr,
530 &sensor_dev_attr_fan1_input.dev_attr.attr, 539 &sensor_dev_attr_fan1_input.dev_attr.attr,
531 &sensor_dev_attr_pwm1_enable.dev_attr.attr, 540 &sensor_dev_attr_pwm1_enable.dev_attr.attr,
541 &sensor_dev_attr_name.dev_attr.attr,
532 NULL 542 NULL
533}; 543};
534 544
diff --git a/drivers/misc/sgi-gru/grufile.c b/drivers/misc/sgi-gru/grufile.c
index 23c91f5f6b61..d61cee796efd 100644
--- a/drivers/misc/sgi-gru/grufile.c
+++ b/drivers/misc/sgi-gru/grufile.c
@@ -445,6 +445,9 @@ static void __exit gru_exit(void)
445 int order = get_order(sizeof(struct gru_state) * 445 int order = get_order(sizeof(struct gru_state) *
446 GRU_CHIPLETS_PER_BLADE); 446 GRU_CHIPLETS_PER_BLADE);
447 447
448 if (!IS_UV())
449 return;
450
448 for (i = 0; i < GRU_CHIPLETS_PER_BLADE; i++) 451 for (i = 0; i < GRU_CHIPLETS_PER_BLADE; i++)
449 free_irq(IRQ_GRU + i, NULL); 452 free_irq(IRQ_GRU + i, NULL);
450 453
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 6986f3926244..ebc8b9d77613 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -615,14 +615,19 @@ static struct mmc_driver mmc_driver = {
615 615
616static int __init mmc_blk_init(void) 616static int __init mmc_blk_init(void)
617{ 617{
618 int res = -ENOMEM; 618 int res;
619 619
620 res = register_blkdev(MMC_BLOCK_MAJOR, "mmc"); 620 res = register_blkdev(MMC_BLOCK_MAJOR, "mmc");
621 if (res) 621 if (res)
622 goto out; 622 goto out;
623 623
624 return mmc_register_driver(&mmc_driver); 624 res = mmc_register_driver(&mmc_driver);
625 if (res)
626 goto out2;
625 627
628 return 0;
629 out2:
630 unregister_blkdev(MMC_BLOCK_MAJOR, "mmc");
626 out: 631 out:
627 return res; 632 return res;
628} 633}
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index f26b01d811ae..b92b172074ee 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -1040,7 +1040,7 @@ static const struct mmc_test_case mmc_test_cases[] = {
1040 1040
1041}; 1041};
1042 1042
1043static struct mutex mmc_test_lock; 1043static DEFINE_MUTEX(mmc_test_lock);
1044 1044
1045static void mmc_test_run(struct mmc_test_card *test, int testcase) 1045static void mmc_test_run(struct mmc_test_card *test, int testcase)
1046{ 1046{
@@ -1171,8 +1171,6 @@ static int mmc_test_probe(struct mmc_card *card)
1171 if ((card->type != MMC_TYPE_MMC) && (card->type != MMC_TYPE_SD)) 1171 if ((card->type != MMC_TYPE_MMC) && (card->type != MMC_TYPE_SD))
1172 return -ENODEV; 1172 return -ENODEV;
1173 1173
1174 mutex_init(&mmc_test_lock);
1175
1176 ret = device_create_file(&card->dev, &dev_attr_test); 1174 ret = device_create_file(&card->dev, &dev_attr_test);
1177 if (ret) 1175 if (ret)
1178 return ret; 1176 return ret;
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index 0bd06f5bd62f..00008967ef7a 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -195,7 +195,9 @@ static int atmci_regs_show(struct seq_file *s, void *v)
195 195
196 /* Grab a more or less consistent snapshot */ 196 /* Grab a more or less consistent snapshot */
197 spin_lock_irq(&host->mmc->lock); 197 spin_lock_irq(&host->mmc->lock);
198 clk_enable(host->mck);
198 memcpy_fromio(buf, host->regs, MCI_REGS_SIZE); 199 memcpy_fromio(buf, host->regs, MCI_REGS_SIZE);
200 clk_disable(host->mck);
199 spin_unlock_irq(&host->mmc->lock); 201 spin_unlock_irq(&host->mmc->lock);
200 202
201 seq_printf(s, "MR:\t0x%08x%s%s CLKDIV=%u\n", 203 seq_printf(s, "MR:\t0x%08x%s%s CLKDIV=%u\n",
@@ -216,6 +218,8 @@ static int atmci_regs_show(struct seq_file *s, void *v)
216 atmci_show_status_reg(s, "SR", buf[MCI_SR / 4]); 218 atmci_show_status_reg(s, "SR", buf[MCI_SR / 4]);
217 atmci_show_status_reg(s, "IMR", buf[MCI_IMR / 4]); 219 atmci_show_status_reg(s, "IMR", buf[MCI_IMR / 4]);
218 220
221 kfree(buf);
222
219 return 0; 223 return 0;
220} 224}
221 225
@@ -237,7 +241,6 @@ static void atmci_init_debugfs(struct atmel_mci *host)
237 struct mmc_host *mmc; 241 struct mmc_host *mmc;
238 struct dentry *root; 242 struct dentry *root;
239 struct dentry *node; 243 struct dentry *node;
240 struct resource *res;
241 244
242 mmc = host->mmc; 245 mmc = host->mmc;
243 root = mmc->debugfs_root; 246 root = mmc->debugfs_root;
@@ -251,9 +254,6 @@ static void atmci_init_debugfs(struct atmel_mci *host)
251 if (!node) 254 if (!node)
252 goto err; 255 goto err;
253 256
254 res = platform_get_resource(host->pdev, IORESOURCE_MEM, 0);
255 node->d_inode->i_size = res->end - res->start + 1;
256
257 node = debugfs_create_file("req", S_IRUSR, root, host, &atmci_req_fops); 257 node = debugfs_create_file("req", S_IRUSR, root, host, &atmci_req_fops);
258 if (!node) 258 if (!node)
259 goto err; 259 goto err;
@@ -426,8 +426,6 @@ static u32 atmci_submit_data(struct mmc_host *mmc, struct mmc_data *data)
426 host->sg = NULL; 426 host->sg = NULL;
427 host->data = data; 427 host->data = data;
428 428
429 mci_writel(host, BLKR, MCI_BCNT(data->blocks)
430 | MCI_BLKLEN(data->blksz));
431 dev_vdbg(&mmc->class_dev, "BLKR=0x%08x\n", 429 dev_vdbg(&mmc->class_dev, "BLKR=0x%08x\n",
432 MCI_BCNT(data->blocks) | MCI_BLKLEN(data->blksz)); 430 MCI_BCNT(data->blocks) | MCI_BLKLEN(data->blksz));
433 431
@@ -483,6 +481,10 @@ static void atmci_request(struct mmc_host *mmc, struct mmc_request *mrq)
483 if (data->blocks > 1 && data->blksz & 3) 481 if (data->blocks > 1 && data->blksz & 3)
484 goto fail; 482 goto fail;
485 atmci_set_timeout(host, data); 483 atmci_set_timeout(host, data);
484
485 /* Must set block count/size before sending command */
486 mci_writel(host, BLKR, MCI_BCNT(data->blocks)
487 | MCI_BLKLEN(data->blksz));
486 } 488 }
487 489
488 iflags = MCI_CMDRDY; 490 iflags = MCI_CMDRDY;
@@ -1059,6 +1061,10 @@ static int __init atmci_probe(struct platform_device *pdev)
1059 host->present = !gpio_get_value(host->detect_pin); 1061 host->present = !gpio_get_value(host->detect_pin);
1060 } 1062 }
1061 } 1063 }
1064
1065 if (!gpio_is_valid(host->detect_pin))
1066 mmc->caps |= MMC_CAP_NEEDS_POLL;
1067
1062 if (gpio_is_valid(host->wp_pin)) { 1068 if (gpio_is_valid(host->wp_pin)) {
1063 if (gpio_request(host->wp_pin, "mmc_wp")) { 1069 if (gpio_request(host->wp_pin, "mmc_wp")) {
1064 dev_dbg(&mmc->class_dev, "no WP pin available\n"); 1070 dev_dbg(&mmc->class_dev, "no WP pin available\n");
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 9e647a06054f..ba2b4240a86a 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -159,10 +159,10 @@ static inline void tmio_mmc_kunmap_atomic(struct tmio_mmc_host *host,
159#define STATUS_TO_TEXT(a) \ 159#define STATUS_TO_TEXT(a) \
160 do { \ 160 do { \
161 if (status & TMIO_STAT_##a) \ 161 if (status & TMIO_STAT_##a) \
162 printf(#a); \ 162 printk(#a); \
163 } while (0) 163 } while (0)
164 164
165void debug_status(u32 status) 165void pr_debug_status(u32 status)
166{ 166{
167 printk(KERN_DEBUG "status: %08x = ", status); 167 printk(KERN_DEBUG "status: %08x = ", status);
168 STATUS_TO_TEXT(CARD_REMOVE); 168 STATUS_TO_TEXT(CARD_REMOVE);
diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h
index c3c579f98ed0..dfacd31f7ed0 100644
--- a/drivers/net/bnx2.h
+++ b/drivers/net/bnx2.h
@@ -6597,7 +6597,7 @@ struct flash_spec {
6597 6597
6598struct bnx2_irq { 6598struct bnx2_irq {
6599 irq_handler_t handler; 6599 irq_handler_t handler;
6600 u16 vector; 6600 unsigned int vector;
6601 u8 requested; 6601 u8 requested;
6602 char name[16]; 6602 char name[16];
6603}; 6603};
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 453115acaad2..5cf78d612c45 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2738,9 +2738,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2738 nic->flags |= wol_magic; 2738 nic->flags |= wol_magic;
2739 2739
2740 /* ack any pending wake events, disable PME */ 2740 /* ack any pending wake events, disable PME */
2741 err = pci_enable_wake(pdev, 0, 0); 2741 pci_pme_active(pdev, false);
2742 if (err)
2743 DPRINTK(PROBE, ERR, "Error clearing wake event\n");
2744 2742
2745 strcpy(netdev->name, "eth%d"); 2743 strcpy(netdev->name, "eth%d");
2746 if((err = register_netdev(netdev))) { 2744 if((err = register_netdev(netdev))) {
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
index 9d6edf3e73f9..d04eef53571e 100644
--- a/drivers/net/e1000/e1000_hw.c
+++ b/drivers/net/e1000/e1000_hw.c
@@ -144,6 +144,8 @@ static s32 e1000_host_if_read_cookie(struct e1000_hw *hw, u8 *buffer);
144static u8 e1000_calculate_mng_checksum(char *buffer, u32 length); 144static u8 e1000_calculate_mng_checksum(char *buffer, u32 length);
145static s32 e1000_configure_kmrn_for_10_100(struct e1000_hw *hw, u16 duplex); 145static s32 e1000_configure_kmrn_for_10_100(struct e1000_hw *hw, u16 duplex);
146static s32 e1000_configure_kmrn_for_1000(struct e1000_hw *hw); 146static s32 e1000_configure_kmrn_for_1000(struct e1000_hw *hw);
147static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
148static s32 e1000_do_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
147 149
148/* IGP cable length table */ 150/* IGP cable length table */
149static const 151static const
@@ -168,6 +170,8 @@ u16 e1000_igp_2_cable_length_table[IGP02E1000_AGC_LENGTH_TABLE_SIZE] =
168 83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124, 170 83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124,
169 104, 109, 114, 118, 121, 124}; 171 104, 109, 114, 118, 121, 124};
170 172
173static DEFINE_SPINLOCK(e1000_eeprom_lock);
174
171/****************************************************************************** 175/******************************************************************************
172 * Set the phy type member in the hw struct. 176 * Set the phy type member in the hw struct.
173 * 177 *
@@ -4904,6 +4908,15 @@ static s32 e1000_spi_eeprom_ready(struct e1000_hw *hw)
4904 *****************************************************************************/ 4908 *****************************************************************************/
4905s32 e1000_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) 4909s32 e1000_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
4906{ 4910{
4911 s32 ret;
4912 spin_lock(&e1000_eeprom_lock);
4913 ret = e1000_do_read_eeprom(hw, offset, words, data);
4914 spin_unlock(&e1000_eeprom_lock);
4915 return ret;
4916}
4917
4918static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
4919{
4907 struct e1000_eeprom_info *eeprom = &hw->eeprom; 4920 struct e1000_eeprom_info *eeprom = &hw->eeprom;
4908 u32 i = 0; 4921 u32 i = 0;
4909 4922
@@ -5236,6 +5249,16 @@ s32 e1000_update_eeprom_checksum(struct e1000_hw *hw)
5236 *****************************************************************************/ 5249 *****************************************************************************/
5237s32 e1000_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) 5250s32 e1000_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
5238{ 5251{
5252 s32 ret;
5253 spin_lock(&e1000_eeprom_lock);
5254 ret = e1000_do_write_eeprom(hw, offset, words, data);
5255 spin_unlock(&e1000_eeprom_lock);
5256 return ret;
5257}
5258
5259
5260static s32 e1000_do_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
5261{
5239 struct e1000_eeprom_info *eeprom = &hw->eeprom; 5262 struct e1000_eeprom_info *eeprom = &hw->eeprom;
5240 s32 status = 0; 5263 s32 status = 0;
5241 5264
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
index ac4e506b4f88..5ea6b60fa377 100644
--- a/drivers/net/e1000e/e1000.h
+++ b/drivers/net/e1000e/e1000.h
@@ -257,7 +257,6 @@ struct e1000_adapter {
257 struct net_device *netdev; 257 struct net_device *netdev;
258 struct pci_dev *pdev; 258 struct pci_dev *pdev;
259 struct net_device_stats net_stats; 259 struct net_device_stats net_stats;
260 spinlock_t stats_lock; /* prevent concurrent stats updates */
261 260
262 /* structs defined in e1000_hw.h */ 261 /* structs defined in e1000_hw.h */
263 struct e1000_hw hw; 262 struct e1000_hw hw;
@@ -284,6 +283,8 @@ struct e1000_adapter {
284 unsigned long led_status; 283 unsigned long led_status;
285 284
286 unsigned int flags; 285 unsigned int flags;
286 struct work_struct downshift_task;
287 struct work_struct update_phy_task;
287}; 288};
288 289
289struct e1000_info { 290struct e1000_info {
@@ -305,6 +306,7 @@ struct e1000_info {
305#define FLAG_HAS_CTRLEXT_ON_LOAD (1 << 5) 306#define FLAG_HAS_CTRLEXT_ON_LOAD (1 << 5)
306#define FLAG_HAS_SWSM_ON_LOAD (1 << 6) 307#define FLAG_HAS_SWSM_ON_LOAD (1 << 6)
307#define FLAG_HAS_JUMBO_FRAMES (1 << 7) 308#define FLAG_HAS_JUMBO_FRAMES (1 << 7)
309#define FLAG_READ_ONLY_NVM (1 << 8)
308#define FLAG_IS_ICH (1 << 9) 310#define FLAG_IS_ICH (1 << 9)
309#define FLAG_HAS_SMART_POWER_DOWN (1 << 11) 311#define FLAG_HAS_SMART_POWER_DOWN (1 << 11)
310#define FLAG_IS_QUAD_PORT_A (1 << 12) 312#define FLAG_IS_QUAD_PORT_A (1 << 12)
@@ -385,6 +387,7 @@ extern bool e1000e_enable_mng_pass_thru(struct e1000_hw *hw);
385extern bool e1000e_get_laa_state_82571(struct e1000_hw *hw); 387extern bool e1000e_get_laa_state_82571(struct e1000_hw *hw);
386extern void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state); 388extern void e1000e_set_laa_state_82571(struct e1000_hw *hw, bool state);
387 389
390extern void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw);
388extern void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw, 391extern void e1000e_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw,
389 bool state); 392 bool state);
390extern void e1000e_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw); 393extern void e1000e_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw);
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index e21c9e0f3738..33a3ff17b5d0 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -432,6 +432,10 @@ static void e1000_get_regs(struct net_device *netdev,
432 regs_buff[11] = er32(TIDV); 432 regs_buff[11] = er32(TIDV);
433 433
434 regs_buff[12] = adapter->hw.phy.type; /* PHY type (IGP=1, M88=0) */ 434 regs_buff[12] = adapter->hw.phy.type; /* PHY type (IGP=1, M88=0) */
435
436 /* ethtool doesn't use anything past this point, so all this
437 * code is likely legacy junk for apps that may or may not
438 * exist */
435 if (hw->phy.type == e1000_phy_m88) { 439 if (hw->phy.type == e1000_phy_m88) {
436 e1e_rphy(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); 440 e1e_rphy(hw, M88E1000_PHY_SPEC_STATUS, &phy_data);
437 regs_buff[13] = (u32)phy_data; /* cable length */ 441 regs_buff[13] = (u32)phy_data; /* cable length */
@@ -447,7 +451,7 @@ static void e1000_get_regs(struct net_device *netdev,
447 regs_buff[22] = adapter->phy_stats.receive_errors; 451 regs_buff[22] = adapter->phy_stats.receive_errors;
448 regs_buff[23] = regs_buff[13]; /* mdix mode */ 452 regs_buff[23] = regs_buff[13]; /* mdix mode */
449 } 453 }
450 regs_buff[21] = adapter->phy_stats.idle_errors; /* phy idle errors */ 454 regs_buff[21] = 0; /* was idle_errors */
451 e1e_rphy(hw, PHY_1000T_STATUS, &phy_data); 455 e1e_rphy(hw, PHY_1000T_STATUS, &phy_data);
452 regs_buff[24] = (u32)phy_data; /* phy local receiver status */ 456 regs_buff[24] = (u32)phy_data; /* phy local receiver status */
453 regs_buff[25] = regs_buff[24]; /* phy remote receiver status */ 457 regs_buff[25] = regs_buff[24]; /* phy remote receiver status */
@@ -529,6 +533,9 @@ static int e1000_set_eeprom(struct net_device *netdev,
529 if (eeprom->magic != (adapter->pdev->vendor | (adapter->pdev->device << 16))) 533 if (eeprom->magic != (adapter->pdev->vendor | (adapter->pdev->device << 16)))
530 return -EFAULT; 534 return -EFAULT;
531 535
536 if (adapter->flags & FLAG_READ_ONLY_NVM)
537 return -EINVAL;
538
532 max_len = hw->nvm.word_size * 2; 539 max_len = hw->nvm.word_size * 2;
533 540
534 first_word = eeprom->offset >> 1; 541 first_word = eeprom->offset >> 1;
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index 9e38452a738c..bcd2bc477af2 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -58,6 +58,7 @@
58#define ICH_FLASH_HSFCTL 0x0006 58#define ICH_FLASH_HSFCTL 0x0006
59#define ICH_FLASH_FADDR 0x0008 59#define ICH_FLASH_FADDR 0x0008
60#define ICH_FLASH_FDATA0 0x0010 60#define ICH_FLASH_FDATA0 0x0010
61#define ICH_FLASH_PR0 0x0074
61 62
62#define ICH_FLASH_READ_COMMAND_TIMEOUT 500 63#define ICH_FLASH_READ_COMMAND_TIMEOUT 500
63#define ICH_FLASH_WRITE_COMMAND_TIMEOUT 500 64#define ICH_FLASH_WRITE_COMMAND_TIMEOUT 500
@@ -150,6 +151,19 @@ union ich8_hws_flash_regacc {
150 u16 regval; 151 u16 regval;
151}; 152};
152 153
154/* ICH Flash Protected Region */
155union ich8_flash_protected_range {
156 struct ich8_pr {
157 u32 base:13; /* 0:12 Protected Range Base */
158 u32 reserved1:2; /* 13:14 Reserved */
159 u32 rpe:1; /* 15 Read Protection Enable */
160 u32 limit:13; /* 16:28 Protected Range Limit */
161 u32 reserved2:2; /* 29:30 Reserved */
162 u32 wpe:1; /* 31 Write Protection Enable */
163 } range;
164 u32 regval;
165};
166
153static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw); 167static s32 e1000_setup_link_ich8lan(struct e1000_hw *hw);
154static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw); 168static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw);
155static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw); 169static void e1000_initialize_hw_bits_ich8lan(struct e1000_hw *hw);
@@ -366,6 +380,9 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
366 return 0; 380 return 0;
367} 381}
368 382
383static DEFINE_MUTEX(nvm_mutex);
384static pid_t nvm_owner = -1;
385
369/** 386/**
370 * e1000_acquire_swflag_ich8lan - Acquire software control flag 387 * e1000_acquire_swflag_ich8lan - Acquire software control flag
371 * @hw: pointer to the HW structure 388 * @hw: pointer to the HW structure
@@ -379,6 +396,15 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
379 u32 extcnf_ctrl; 396 u32 extcnf_ctrl;
380 u32 timeout = PHY_CFG_TIMEOUT; 397 u32 timeout = PHY_CFG_TIMEOUT;
381 398
399 might_sleep();
400
401 if (!mutex_trylock(&nvm_mutex)) {
402 WARN(1, KERN_ERR "e1000e mutex contention. Owned by pid %d\n",
403 nvm_owner);
404 mutex_lock(&nvm_mutex);
405 }
406 nvm_owner = current->pid;
407
382 while (timeout) { 408 while (timeout) {
383 extcnf_ctrl = er32(EXTCNF_CTRL); 409 extcnf_ctrl = er32(EXTCNF_CTRL);
384 extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG; 410 extcnf_ctrl |= E1000_EXTCNF_CTRL_SWFLAG;
@@ -393,6 +419,8 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
393 419
394 if (!timeout) { 420 if (!timeout) {
395 hw_dbg(hw, "FW or HW has locked the resource for too long.\n"); 421 hw_dbg(hw, "FW or HW has locked the resource for too long.\n");
422 nvm_owner = -1;
423 mutex_unlock(&nvm_mutex);
396 return -E1000_ERR_CONFIG; 424 return -E1000_ERR_CONFIG;
397 } 425 }
398 426
@@ -414,6 +442,9 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
414 extcnf_ctrl = er32(EXTCNF_CTRL); 442 extcnf_ctrl = er32(EXTCNF_CTRL);
415 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG; 443 extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
416 ew32(EXTCNF_CTRL, extcnf_ctrl); 444 ew32(EXTCNF_CTRL, extcnf_ctrl);
445
446 nvm_owner = -1;
447 mutex_unlock(&nvm_mutex);
417} 448}
418 449
419/** 450/**
@@ -1284,6 +1315,7 @@ static s32 e1000_update_nvm_checksum_ich8lan(struct e1000_hw *hw)
1284 * programming failed. 1315 * programming failed.
1285 */ 1316 */
1286 if (ret_val) { 1317 if (ret_val) {
1318 /* Possibly read-only, see e1000e_write_protect_nvm_ich8lan() */
1287 hw_dbg(hw, "Flash commit failed.\n"); 1319 hw_dbg(hw, "Flash commit failed.\n");
1288 e1000_release_swflag_ich8lan(hw); 1320 e1000_release_swflag_ich8lan(hw);
1289 return ret_val; 1321 return ret_val;
@@ -1374,6 +1406,49 @@ static s32 e1000_validate_nvm_checksum_ich8lan(struct e1000_hw *hw)
1374} 1406}
1375 1407
1376/** 1408/**
1409 * e1000e_write_protect_nvm_ich8lan - Make the NVM read-only
1410 * @hw: pointer to the HW structure
1411 *
1412 * To prevent malicious write/erase of the NVM, set it to be read-only
1413 * so that the hardware ignores all write/erase cycles of the NVM via
1414 * the flash control registers. The shadow-ram copy of the NVM will
1415 * still be updated, however any updates to this copy will not stick
1416 * across driver reloads.
1417 **/
1418void e1000e_write_protect_nvm_ich8lan(struct e1000_hw *hw)
1419{
1420 union ich8_flash_protected_range pr0;
1421 union ich8_hws_flash_status hsfsts;
1422 u32 gfpreg;
1423 s32 ret_val;
1424
1425 ret_val = e1000_acquire_swflag_ich8lan(hw);
1426 if (ret_val)
1427 return;
1428
1429 gfpreg = er32flash(ICH_FLASH_GFPREG);
1430
1431 /* Write-protect GbE Sector of NVM */
1432 pr0.regval = er32flash(ICH_FLASH_PR0);
1433 pr0.range.base = gfpreg & FLASH_GFPREG_BASE_MASK;
1434 pr0.range.limit = ((gfpreg >> 16) & FLASH_GFPREG_BASE_MASK);
1435 pr0.range.wpe = true;
1436 ew32flash(ICH_FLASH_PR0, pr0.regval);
1437
1438 /*
1439 * Lock down a subset of GbE Flash Control Registers, e.g.
1440 * PR0 to prevent the write-protection from being lifted.
1441 * Once FLOCKDN is set, the registers protected by it cannot
1442 * be written until FLOCKDN is cleared by a hardware reset.
1443 */
1444 hsfsts.regval = er16flash(ICH_FLASH_HSFSTS);
1445 hsfsts.hsf_status.flockdn = true;
1446 ew32flash(ICH_FLASH_HSFSTS, hsfsts.regval);
1447
1448 e1000_release_swflag_ich8lan(hw);
1449}
1450
1451/**
1377 * e1000_write_flash_data_ich8lan - Writes bytes to the NVM 1452 * e1000_write_flash_data_ich8lan - Writes bytes to the NVM
1378 * @hw: pointer to the HW structure 1453 * @hw: pointer to the HW structure
1379 * @offset: The offset (in bytes) of the byte/word to read. 1454 * @offset: The offset (in bytes) of the byte/word to read.
@@ -1720,6 +1795,9 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw)
1720 ew32(CTRL, (ctrl | E1000_CTRL_RST)); 1795 ew32(CTRL, (ctrl | E1000_CTRL_RST));
1721 msleep(20); 1796 msleep(20);
1722 1797
1798 /* release the swflag because it is not reset by hardware reset */
1799 e1000_release_swflag_ich8lan(hw);
1800
1723 ret_val = e1000e_get_auto_rd_done(hw); 1801 ret_val = e1000e_get_auto_rd_done(hw);
1724 if (ret_val) { 1802 if (ret_val) {
1725 /* 1803 /*
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index d266510c8a94..b81c4237b5d3 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -47,7 +47,7 @@
47 47
48#include "e1000.h" 48#include "e1000.h"
49 49
50#define DRV_VERSION "0.3.3.3-k2" 50#define DRV_VERSION "0.3.3.3-k6"
51char e1000e_driver_name[] = "e1000e"; 51char e1000e_driver_name[] = "e1000e";
52const char e1000e_driver_version[] = DRV_VERSION; 52const char e1000e_driver_version[] = DRV_VERSION;
53 53
@@ -1115,6 +1115,14 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter)
1115 writel(0, adapter->hw.hw_addr + rx_ring->tail); 1115 writel(0, adapter->hw.hw_addr + rx_ring->tail);
1116} 1116}
1117 1117
1118static void e1000e_downshift_workaround(struct work_struct *work)
1119{
1120 struct e1000_adapter *adapter = container_of(work,
1121 struct e1000_adapter, downshift_task);
1122
1123 e1000e_gig_downshift_workaround_ich8lan(&adapter->hw);
1124}
1125
1118/** 1126/**
1119 * e1000_intr_msi - Interrupt Handler 1127 * e1000_intr_msi - Interrupt Handler
1120 * @irq: interrupt number 1128 * @irq: interrupt number
@@ -1139,7 +1147,7 @@ static irqreturn_t e1000_intr_msi(int irq, void *data)
1139 */ 1147 */
1140 if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) && 1148 if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) &&
1141 (!(er32(STATUS) & E1000_STATUS_LU))) 1149 (!(er32(STATUS) & E1000_STATUS_LU)))
1142 e1000e_gig_downshift_workaround_ich8lan(hw); 1150 schedule_work(&adapter->downshift_task);
1143 1151
1144 /* 1152 /*
1145 * 80003ES2LAN workaround-- For packet buffer work-around on 1153 * 80003ES2LAN workaround-- For packet buffer work-around on
@@ -1205,7 +1213,7 @@ static irqreturn_t e1000_intr(int irq, void *data)
1205 */ 1213 */
1206 if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) && 1214 if ((adapter->flags & FLAG_LSC_GIG_SPEED_DROP) &&
1207 (!(er32(STATUS) & E1000_STATUS_LU))) 1215 (!(er32(STATUS) & E1000_STATUS_LU)))
1208 e1000e_gig_downshift_workaround_ich8lan(hw); 1216 schedule_work(&adapter->downshift_task);
1209 1217
1210 /* 1218 /*
1211 * 80003ES2LAN workaround-- 1219 * 80003ES2LAN workaround--
@@ -2592,8 +2600,6 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
2592 /* Explicitly disable IRQ since the NIC can be in any state. */ 2600 /* Explicitly disable IRQ since the NIC can be in any state. */
2593 e1000_irq_disable(adapter); 2601 e1000_irq_disable(adapter);
2594 2602
2595 spin_lock_init(&adapter->stats_lock);
2596
2597 set_bit(__E1000_DOWN, &adapter->state); 2603 set_bit(__E1000_DOWN, &adapter->state);
2598 return 0; 2604 return 0;
2599 2605
@@ -2912,6 +2918,21 @@ static int e1000_set_mac(struct net_device *netdev, void *p)
2912 return 0; 2918 return 0;
2913} 2919}
2914 2920
2921/**
2922 * e1000e_update_phy_task - work thread to update phy
2923 * @work: pointer to our work struct
2924 *
2925 * this worker thread exists because we must acquire a
2926 * semaphore to read the phy, which we could msleep while
2927 * waiting for it, and we can't msleep in a timer.
2928 **/
2929static void e1000e_update_phy_task(struct work_struct *work)
2930{
2931 struct e1000_adapter *adapter = container_of(work,
2932 struct e1000_adapter, update_phy_task);
2933 e1000_get_phy_info(&adapter->hw);
2934}
2935
2915/* 2936/*
2916 * Need to wait a few seconds after link up to get diagnostic information from 2937 * Need to wait a few seconds after link up to get diagnostic information from
2917 * the phy 2938 * the phy
@@ -2919,7 +2940,7 @@ static int e1000_set_mac(struct net_device *netdev, void *p)
2919static void e1000_update_phy_info(unsigned long data) 2940static void e1000_update_phy_info(unsigned long data)
2920{ 2941{
2921 struct e1000_adapter *adapter = (struct e1000_adapter *) data; 2942 struct e1000_adapter *adapter = (struct e1000_adapter *) data;
2922 e1000_get_phy_info(&adapter->hw); 2943 schedule_work(&adapter->update_phy_task);
2923} 2944}
2924 2945
2925/** 2946/**
@@ -2930,10 +2951,6 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
2930{ 2951{
2931 struct e1000_hw *hw = &adapter->hw; 2952 struct e1000_hw *hw = &adapter->hw;
2932 struct pci_dev *pdev = adapter->pdev; 2953 struct pci_dev *pdev = adapter->pdev;
2933 unsigned long irq_flags;
2934 u16 phy_tmp;
2935
2936#define PHY_IDLE_ERROR_COUNT_MASK 0x00FF
2937 2954
2938 /* 2955 /*
2939 * Prevent stats update while adapter is being reset, or if the pci 2956 * Prevent stats update while adapter is being reset, or if the pci
@@ -2944,14 +2961,6 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
2944 if (pci_channel_offline(pdev)) 2961 if (pci_channel_offline(pdev))
2945 return; 2962 return;
2946 2963
2947 spin_lock_irqsave(&adapter->stats_lock, irq_flags);
2948
2949 /*
2950 * these counters are modified from e1000_adjust_tbi_stats,
2951 * called from the interrupt context, so they must only
2952 * be written while holding adapter->stats_lock
2953 */
2954
2955 adapter->stats.crcerrs += er32(CRCERRS); 2964 adapter->stats.crcerrs += er32(CRCERRS);
2956 adapter->stats.gprc += er32(GPRC); 2965 adapter->stats.gprc += er32(GPRC);
2957 adapter->stats.gorc += er32(GORCL); 2966 adapter->stats.gorc += er32(GORCL);
@@ -3022,21 +3031,10 @@ void e1000e_update_stats(struct e1000_adapter *adapter)
3022 3031
3023 /* Tx Dropped needs to be maintained elsewhere */ 3032 /* Tx Dropped needs to be maintained elsewhere */
3024 3033
3025 /* Phy Stats */
3026 if (hw->phy.media_type == e1000_media_type_copper) {
3027 if ((adapter->link_speed == SPEED_1000) &&
3028 (!e1e_rphy(hw, PHY_1000T_STATUS, &phy_tmp))) {
3029 phy_tmp &= PHY_IDLE_ERROR_COUNT_MASK;
3030 adapter->phy_stats.idle_errors += phy_tmp;
3031 }
3032 }
3033
3034 /* Management Stats */ 3034 /* Management Stats */
3035 adapter->stats.mgptc += er32(MGTPTC); 3035 adapter->stats.mgptc += er32(MGTPTC);
3036 adapter->stats.mgprc += er32(MGTPRC); 3036 adapter->stats.mgprc += er32(MGTPRC);
3037 adapter->stats.mgpdc += er32(MGTPDC); 3037 adapter->stats.mgpdc += er32(MGTPDC);
3038
3039 spin_unlock_irqrestore(&adapter->stats_lock, irq_flags);
3040} 3038}
3041 3039
3042/** 3040/**
@@ -3048,10 +3046,6 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter)
3048 struct e1000_hw *hw = &adapter->hw; 3046 struct e1000_hw *hw = &adapter->hw;
3049 struct e1000_phy_regs *phy = &adapter->phy_regs; 3047 struct e1000_phy_regs *phy = &adapter->phy_regs;
3050 int ret_val; 3048 int ret_val;
3051 unsigned long irq_flags;
3052
3053
3054 spin_lock_irqsave(&adapter->stats_lock, irq_flags);
3055 3049
3056 if ((er32(STATUS) & E1000_STATUS_LU) && 3050 if ((er32(STATUS) & E1000_STATUS_LU) &&
3057 (adapter->hw.phy.media_type == e1000_media_type_copper)) { 3051 (adapter->hw.phy.media_type == e1000_media_type_copper)) {
@@ -3082,8 +3076,6 @@ static void e1000_phy_read_status(struct e1000_adapter *adapter)
3082 phy->stat1000 = 0; 3076 phy->stat1000 = 0;
3083 phy->estatus = (ESTATUS_1000_TFULL | ESTATUS_1000_THALF); 3077 phy->estatus = (ESTATUS_1000_TFULL | ESTATUS_1000_THALF);
3084 } 3078 }
3085
3086 spin_unlock_irqrestore(&adapter->stats_lock, irq_flags);
3087} 3079}
3088 3080
3089static void e1000_print_link_info(struct e1000_adapter *adapter) 3081static void e1000_print_link_info(struct e1000_adapter *adapter)
@@ -4467,6 +4459,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4467 4459
4468 adapter->bd_number = cards_found++; 4460 adapter->bd_number = cards_found++;
4469 4461
4462 e1000e_check_options(adapter);
4463
4470 /* setup adapter struct */ 4464 /* setup adapter struct */
4471 err = e1000_sw_init(adapter); 4465 err = e1000_sw_init(adapter);
4472 if (err) 4466 if (err)
@@ -4482,6 +4476,10 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4482 if (err) 4476 if (err)
4483 goto err_hw_init; 4477 goto err_hw_init;
4484 4478
4479 if ((adapter->flags & FLAG_IS_ICH) &&
4480 (adapter->flags & FLAG_READ_ONLY_NVM))
4481 e1000e_write_protect_nvm_ich8lan(&adapter->hw);
4482
4485 hw->mac.ops.get_bus_info(&adapter->hw); 4483 hw->mac.ops.get_bus_info(&adapter->hw);
4486 4484
4487 adapter->hw.phy.autoneg_wait_to_complete = 0; 4485 adapter->hw.phy.autoneg_wait_to_complete = 0;
@@ -4572,8 +4570,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
4572 4570
4573 INIT_WORK(&adapter->reset_task, e1000_reset_task); 4571 INIT_WORK(&adapter->reset_task, e1000_reset_task);
4574 INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task); 4572 INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task);
4575 4573 INIT_WORK(&adapter->downshift_task, e1000e_downshift_workaround);
4576 e1000e_check_options(adapter); 4574 INIT_WORK(&adapter->update_phy_task, e1000e_update_phy_task);
4577 4575
4578 /* Initialize link parameters. User can change them with ethtool */ 4576 /* Initialize link parameters. User can change them with ethtool */
4579 adapter->hw.mac.autoneg = 1; 4577 adapter->hw.mac.autoneg = 1;
diff --git a/drivers/net/e1000e/param.c b/drivers/net/e1000e/param.c
index ed912e023a72..d91dbf7ba434 100644
--- a/drivers/net/e1000e/param.c
+++ b/drivers/net/e1000e/param.c
@@ -133,6 +133,15 @@ E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down");
133 */ 133 */
134E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround"); 134E1000_PARAM(KumeranLockLoss, "Enable Kumeran lock loss workaround");
135 135
136/*
137 * Write Protect NVM
138 *
139 * Valid Range: 0, 1
140 *
141 * Default Value: 1 (enabled)
142 */
143E1000_PARAM(WriteProtectNVM, "Write-protect NVM [WARNING: disabling this can lead to corrupted NVM]");
144
136struct e1000_option { 145struct e1000_option {
137 enum { enable_option, range_option, list_option } type; 146 enum { enable_option, range_option, list_option } type;
138 const char *name; 147 const char *name;
@@ -388,4 +397,25 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
388 opt.def); 397 opt.def);
389 } 398 }
390 } 399 }
400 { /* Write-protect NVM */
401 const struct e1000_option opt = {
402 .type = enable_option,
403 .name = "Write-protect NVM",
404 .err = "defaulting to Enabled",
405 .def = OPTION_ENABLED
406 };
407
408 if (adapter->flags & FLAG_IS_ICH) {
409 if (num_WriteProtectNVM > bd) {
410 unsigned int write_protect_nvm = WriteProtectNVM[bd];
411 e1000_validate_option(&write_protect_nvm, &opt,
412 adapter);
413 if (write_protect_nvm)
414 adapter->flags |= FLAG_READ_ONLY_NVM;
415 } else {
416 if (opt.def)
417 adapter->flags |= FLAG_READ_ONLY_NVM;
418 }
419 }
420 }
391} 421}
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 0b6ecef9a849..eeb55ed2152d 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -5643,6 +5643,7 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
5643 dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff; 5643 dev->dev_addr[4] = (np->orig_mac[0] >> 8) & 0xff;
5644 dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff; 5644 dev->dev_addr[5] = (np->orig_mac[0] >> 0) & 0xff;
5645 writel(txreg|NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll); 5645 writel(txreg|NVREG_TRANSMITPOLL_MAC_ADDR_REV, base + NvRegTransmitPoll);
5646 printk(KERN_DEBUG "nv_probe: set workaround bit for reversed mac addr\n");
5646 } 5647 }
5647 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); 5648 memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
5648 5649
@@ -5890,14 +5891,12 @@ static void nv_restore_phy(struct net_device *dev)
5890 } 5891 }
5891} 5892}
5892 5893
5893static void __devexit nv_remove(struct pci_dev *pci_dev) 5894static void nv_restore_mac_addr(struct pci_dev *pci_dev)
5894{ 5895{
5895 struct net_device *dev = pci_get_drvdata(pci_dev); 5896 struct net_device *dev = pci_get_drvdata(pci_dev);
5896 struct fe_priv *np = netdev_priv(dev); 5897 struct fe_priv *np = netdev_priv(dev);
5897 u8 __iomem *base = get_hwbase(dev); 5898 u8 __iomem *base = get_hwbase(dev);
5898 5899
5899 unregister_netdev(dev);
5900
5901 /* special op: write back the misordered MAC address - otherwise 5900 /* special op: write back the misordered MAC address - otherwise
5902 * the next nv_probe would see a wrong address. 5901 * the next nv_probe would see a wrong address.
5903 */ 5902 */
@@ -5905,6 +5904,15 @@ static void __devexit nv_remove(struct pci_dev *pci_dev)
5905 writel(np->orig_mac[1], base + NvRegMacAddrB); 5904 writel(np->orig_mac[1], base + NvRegMacAddrB);
5906 writel(readl(base + NvRegTransmitPoll) & ~NVREG_TRANSMITPOLL_MAC_ADDR_REV, 5905 writel(readl(base + NvRegTransmitPoll) & ~NVREG_TRANSMITPOLL_MAC_ADDR_REV,
5907 base + NvRegTransmitPoll); 5906 base + NvRegTransmitPoll);
5907}
5908
5909static void __devexit nv_remove(struct pci_dev *pci_dev)
5910{
5911 struct net_device *dev = pci_get_drvdata(pci_dev);
5912
5913 unregister_netdev(dev);
5914
5915 nv_restore_mac_addr(pci_dev);
5908 5916
5909 /* restore any phy related changes */ 5917 /* restore any phy related changes */
5910 nv_restore_phy(dev); 5918 nv_restore_phy(dev);
@@ -5975,6 +5983,8 @@ static void nv_shutdown(struct pci_dev *pdev)
5975 if (netif_running(dev)) 5983 if (netif_running(dev))
5976 nv_close(dev); 5984 nv_close(dev);
5977 5985
5986 nv_restore_mac_addr(pdev);
5987
5978 pci_disable_device(pdev); 5988 pci_disable_device(pdev);
5979 if (system_state == SYSTEM_POWER_OFF) { 5989 if (system_state == SYSTEM_POWER_OFF) {
5980 if (pci_enable_wake(pdev, PCI_D3cold, np->wolenabled)) 5990 if (pci_enable_wake(pdev, PCI_D3cold, np->wolenabled))
diff --git a/drivers/net/hp-plus.c b/drivers/net/hp-plus.c
index 8239939554bc..fbbd3e660c27 100644
--- a/drivers/net/hp-plus.c
+++ b/drivers/net/hp-plus.c
@@ -139,7 +139,7 @@ static int __init do_hpp_probe(struct net_device *dev)
139#ifndef MODULE 139#ifndef MODULE
140struct net_device * __init hp_plus_probe(int unit) 140struct net_device * __init hp_plus_probe(int unit)
141{ 141{
142 struct net_device *dev = alloc_ei_netdev(); 142 struct net_device *dev = alloc_eip_netdev();
143 int err; 143 int err;
144 144
145 if (!dev) 145 if (!dev)
@@ -284,7 +284,7 @@ hpp_open(struct net_device *dev)
284 int option_reg; 284 int option_reg;
285 int retval; 285 int retval;
286 286
287 if ((retval = request_irq(dev->irq, ei_interrupt, 0, dev->name, dev))) { 287 if ((retval = request_irq(dev->irq, eip_interrupt, 0, dev->name, dev))) {
288 return retval; 288 return retval;
289 } 289 }
290 290
@@ -302,7 +302,7 @@ hpp_open(struct net_device *dev)
302 /* Select the operational page. */ 302 /* Select the operational page. */
303 outw(Perf_Page, ioaddr + HP_PAGING); 303 outw(Perf_Page, ioaddr + HP_PAGING);
304 304
305 ei_open(dev); 305 eip_open(dev);
306 return 0; 306 return 0;
307} 307}
308 308
@@ -313,7 +313,7 @@ hpp_close(struct net_device *dev)
313 int option_reg = inw(ioaddr + HPP_OPTION); 313 int option_reg = inw(ioaddr + HPP_OPTION);
314 314
315 free_irq(dev->irq, dev); 315 free_irq(dev->irq, dev);
316 ei_close(dev); 316 eip_close(dev);
317 outw((option_reg & ~EnableIRQ) | MemDisable | NICReset | ChipReset, 317 outw((option_reg & ~EnableIRQ) | MemDisable | NICReset | ChipReset,
318 ioaddr + HPP_OPTION); 318 ioaddr + HPP_OPTION);
319 319
diff --git a/drivers/net/mlx4/mr.c b/drivers/net/mlx4/mr.c
index 62071d9c4a55..d1dd5b48dbd1 100644
--- a/drivers/net/mlx4/mr.c
+++ b/drivers/net/mlx4/mr.c
@@ -67,11 +67,10 @@ struct mlx4_mpt_entry {
67#define MLX4_MPT_FLAG_PHYSICAL (1 << 9) 67#define MLX4_MPT_FLAG_PHYSICAL (1 << 9)
68#define MLX4_MPT_FLAG_REGION (1 << 8) 68#define MLX4_MPT_FLAG_REGION (1 << 8)
69 69
70#define MLX4_MPT_PD_FLAG_FAST_REG (1 << 26) 70#define MLX4_MPT_PD_FLAG_FAST_REG (1 << 27)
71#define MLX4_MPT_PD_FLAG_RAE (1 << 28)
71#define MLX4_MPT_PD_FLAG_EN_INV (3 << 24) 72#define MLX4_MPT_PD_FLAG_EN_INV (3 << 24)
72 73
73#define MLX4_MTT_FLAG_PRESENT 1
74
75#define MLX4_MPT_STATUS_SW 0xF0 74#define MLX4_MPT_STATUS_SW 0xF0
76#define MLX4_MPT_STATUS_HW 0x00 75#define MLX4_MPT_STATUS_HW 0x00
77 76
@@ -348,7 +347,10 @@ int mlx4_mr_enable(struct mlx4_dev *dev, struct mlx4_mr *mr)
348 if (mr->mtt.order >= 0 && mr->mtt.page_shift == 0) { 347 if (mr->mtt.order >= 0 && mr->mtt.page_shift == 0) {
349 /* fast register MR in free state */ 348 /* fast register MR in free state */
350 mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_FREE); 349 mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_FREE);
351 mpt_entry->pd_flags |= cpu_to_be32(MLX4_MPT_PD_FLAG_FAST_REG); 350 mpt_entry->pd_flags |= cpu_to_be32(MLX4_MPT_PD_FLAG_FAST_REG |
351 MLX4_MPT_PD_FLAG_RAE);
352 mpt_entry->mtt_sz = cpu_to_be32((1 << mr->mtt.order) *
353 MLX4_MTT_ENTRY_PER_SEG);
352 } else { 354 } else {
353 mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_SW_OWNS); 355 mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_SW_OWNS);
354 } 356 }
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index e4765b713aba..e3be81eba8a4 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -5984,6 +5984,56 @@ static void niu_netif_start(struct niu *np)
5984 niu_enable_interrupts(np, 1); 5984 niu_enable_interrupts(np, 1);
5985} 5985}
5986 5986
5987static void niu_reset_buffers(struct niu *np)
5988{
5989 int i, j, k, err;
5990
5991 if (np->rx_rings) {
5992 for (i = 0; i < np->num_rx_rings; i++) {
5993 struct rx_ring_info *rp = &np->rx_rings[i];
5994
5995 for (j = 0, k = 0; j < MAX_RBR_RING_SIZE; j++) {
5996 struct page *page;
5997
5998 page = rp->rxhash[j];
5999 while (page) {
6000 struct page *next =
6001 (struct page *) page->mapping;
6002 u64 base = page->index;
6003 base = base >> RBR_DESCR_ADDR_SHIFT;
6004 rp->rbr[k++] = cpu_to_le32(base);
6005 page = next;
6006 }
6007 }
6008 for (; k < MAX_RBR_RING_SIZE; k++) {
6009 err = niu_rbr_add_page(np, rp, GFP_ATOMIC, k);
6010 if (unlikely(err))
6011 break;
6012 }
6013
6014 rp->rbr_index = rp->rbr_table_size - 1;
6015 rp->rcr_index = 0;
6016 rp->rbr_pending = 0;
6017 rp->rbr_refill_pending = 0;
6018 }
6019 }
6020 if (np->tx_rings) {
6021 for (i = 0; i < np->num_tx_rings; i++) {
6022 struct tx_ring_info *rp = &np->tx_rings[i];
6023
6024 for (j = 0; j < MAX_TX_RING_SIZE; j++) {
6025 if (rp->tx_buffs[j].skb)
6026 (void) release_tx_packet(np, rp, j);
6027 }
6028
6029 rp->pending = MAX_TX_RING_SIZE;
6030 rp->prod = 0;
6031 rp->cons = 0;
6032 rp->wrap_bit = 0;
6033 }
6034 }
6035}
6036
5987static void niu_reset_task(struct work_struct *work) 6037static void niu_reset_task(struct work_struct *work)
5988{ 6038{
5989 struct niu *np = container_of(work, struct niu, reset_task); 6039 struct niu *np = container_of(work, struct niu, reset_task);
@@ -6006,6 +6056,12 @@ static void niu_reset_task(struct work_struct *work)
6006 6056
6007 niu_stop_hw(np); 6057 niu_stop_hw(np);
6008 6058
6059 spin_unlock_irqrestore(&np->lock, flags);
6060
6061 niu_reset_buffers(np);
6062
6063 spin_lock_irqsave(&np->lock, flags);
6064
6009 err = niu_init_hw(np); 6065 err = niu_init_hw(np);
6010 if (!err) { 6066 if (!err) {
6011 np->timer.expires = jiffies + HZ; 6067 np->timer.expires = jiffies + HZ;
diff --git a/drivers/net/wireless/ath9k/beacon.c b/drivers/net/wireless/ath9k/beacon.c
index caf569401a34..00a0eaa08866 100644
--- a/drivers/net/wireless/ath9k/beacon.c
+++ b/drivers/net/wireless/ath9k/beacon.c
@@ -209,6 +209,7 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id)
209 unsigned int curlen; 209 unsigned int curlen;
210 struct ath_txq *cabq; 210 struct ath_txq *cabq;
211 struct ath_txq *mcastq; 211 struct ath_txq *mcastq;
212 struct ieee80211_tx_info *info;
212 avp = sc->sc_vaps[if_id]; 213 avp = sc->sc_vaps[if_id];
213 214
214 mcastq = &avp->av_mcastq; 215 mcastq = &avp->av_mcastq;
@@ -232,6 +233,18 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id)
232 */ 233 */
233 curlen = skb->len; 234 curlen = skb->len;
234 235
236 info = IEEE80211_SKB_CB(skb);
237 if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
238 /*
239 * TODO: make sure the seq# gets assigned properly (vs. other
240 * TX frames)
241 */
242 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
243 sc->seq_no += 0x10;
244 hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
245 hdr->seq_ctrl |= cpu_to_le16(sc->seq_no);
246 }
247
235 /* XXX: spin_lock_bh should not be used here, but sparse bitches 248 /* XXX: spin_lock_bh should not be used here, but sparse bitches
236 * otherwise. We should fix sparse :) */ 249 * otherwise. We should fix sparse :) */
237 spin_lock_bh(&mcastq->axq_lock); 250 spin_lock_bh(&mcastq->axq_lock);
diff --git a/drivers/net/wireless/ath9k/core.c b/drivers/net/wireless/ath9k/core.c
index f6c45288d0e7..87e37bc39145 100644
--- a/drivers/net/wireless/ath9k/core.c
+++ b/drivers/net/wireless/ath9k/core.c
@@ -294,8 +294,6 @@ static int ath_stop(struct ath_softc *sc)
294 * hardware is gone (invalid). 294 * hardware is gone (invalid).
295 */ 295 */
296 296
297 if (!sc->sc_invalid)
298 ath9k_hw_set_interrupts(ah, 0);
299 ath_draintxq(sc, false); 297 ath_draintxq(sc, false);
300 if (!sc->sc_invalid) { 298 if (!sc->sc_invalid) {
301 ath_stoprecv(sc); 299 ath_stoprecv(sc);
@@ -797,6 +795,12 @@ int ath_open(struct ath_softc *sc, struct ath9k_channel *initial_chan)
797 if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) 795 if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT)
798 sc->sc_imask |= ATH9K_INT_CST; 796 sc->sc_imask |= ATH9K_INT_CST;
799 797
798 /* Note: We disable MIB interrupts for now as we don't yet
799 * handle processing ANI, otherwise you will get an interrupt
800 * storm after about 7 hours of usage making the system unusable
801 * with huge latency. Once we do have ANI processing included
802 * we can re-enable this interrupt. */
803#if 0
800 /* 804 /*
801 * Enable MIB interrupts when there are hardware phy counters. 805 * Enable MIB interrupts when there are hardware phy counters.
802 * Note we only do this (at the moment) for station mode. 806 * Note we only do this (at the moment) for station mode.
@@ -804,6 +808,7 @@ int ath_open(struct ath_softc *sc, struct ath9k_channel *initial_chan)
804 if (ath9k_hw_phycounters(ah) && 808 if (ath9k_hw_phycounters(ah) &&
805 ((sc->sc_opmode == ATH9K_M_STA) || (sc->sc_opmode == ATH9K_M_IBSS))) 809 ((sc->sc_opmode == ATH9K_M_STA) || (sc->sc_opmode == ATH9K_M_IBSS)))
806 sc->sc_imask |= ATH9K_INT_MIB; 810 sc->sc_imask |= ATH9K_INT_MIB;
811#endif
807 /* 812 /*
808 * Some hardware processes the TIM IE and fires an 813 * Some hardware processes the TIM IE and fires an
809 * interrupt when the TIM bit is set. For hardware 814 * interrupt when the TIM bit is set. For hardware
@@ -1336,6 +1341,8 @@ void ath_deinit(struct ath_softc *sc)
1336 1341
1337 DPRINTF(sc, ATH_DBG_CONFIG, "%s\n", __func__); 1342 DPRINTF(sc, ATH_DBG_CONFIG, "%s\n", __func__);
1338 1343
1344 tasklet_kill(&sc->intr_tq);
1345 tasklet_kill(&sc->bcon_tasklet);
1339 ath_stop(sc); 1346 ath_stop(sc);
1340 if (!sc->sc_invalid) 1347 if (!sc->sc_invalid)
1341 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE); 1348 ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE);
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h
index 673b3d81133a..2f84093331ee 100644
--- a/drivers/net/wireless/ath9k/core.h
+++ b/drivers/net/wireless/ath9k/core.h
@@ -974,7 +974,6 @@ struct ath_softc {
974 u32 sc_keymax; /* size of key cache */ 974 u32 sc_keymax; /* size of key cache */
975 DECLARE_BITMAP(sc_keymap, ATH_KEYMAX); /* key use bit map */ 975 DECLARE_BITMAP(sc_keymap, ATH_KEYMAX); /* key use bit map */
976 u8 sc_splitmic; /* split TKIP MIC keys */ 976 u8 sc_splitmic; /* split TKIP MIC keys */
977 int sc_keytype;
978 977
979 /* RX */ 978 /* RX */
980 struct list_head sc_rxbuf; 979 struct list_head sc_rxbuf;
@@ -992,6 +991,7 @@ struct ath_softc {
992 u32 sc_txintrperiod; /* tx interrupt batching */ 991 u32 sc_txintrperiod; /* tx interrupt batching */
993 int sc_haltype2q[ATH9K_WME_AC_VO+1]; /* HAL WME AC -> h/w qnum */ 992 int sc_haltype2q[ATH9K_WME_AC_VO+1]; /* HAL WME AC -> h/w qnum */
994 u32 sc_ant_tx[8]; /* recent tx frames/antenna */ 993 u32 sc_ant_tx[8]; /* recent tx frames/antenna */
994 u16 seq_no; /* TX sequence number */
995 995
996 /* Beacon */ 996 /* Beacon */
997 struct ath9k_tx_queue_info sc_beacon_qi; 997 struct ath9k_tx_queue_info sc_beacon_qi;
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index c5107f269f24..acebdf1d20a8 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -206,8 +206,6 @@ static int ath_key_config(struct ath_softc *sc,
206 if (!ret) 206 if (!ret)
207 return -EIO; 207 return -EIO;
208 208
209 if (mac)
210 sc->sc_keytype = hk.kv_type;
211 return 0; 209 return 0;
212} 210}
213 211
@@ -369,6 +367,20 @@ static int ath9k_tx(struct ieee80211_hw *hw,
369{ 367{
370 struct ath_softc *sc = hw->priv; 368 struct ath_softc *sc = hw->priv;
371 int hdrlen, padsize; 369 int hdrlen, padsize;
370 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
371
372 /*
373 * As a temporary workaround, assign seq# here; this will likely need
374 * to be cleaned up to work better with Beacon transmission and virtual
375 * BSSes.
376 */
377 if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
378 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
379 if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
380 sc->seq_no += 0x10;
381 hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
382 hdr->seq_ctrl |= cpu_to_le16(sc->seq_no);
383 }
372 384
373 /* Add the padding after the header if this is not already done */ 385 /* Add the padding after the header if this is not already done */
374 hdrlen = ieee80211_get_hdrlen_from_skb(skb); 386 hdrlen = ieee80211_get_hdrlen_from_skb(skb);
@@ -764,7 +776,6 @@ static int ath9k_set_key(struct ieee80211_hw *hw,
764 case DISABLE_KEY: 776 case DISABLE_KEY:
765 ath_key_delete(sc, key); 777 ath_key_delete(sc, key);
766 clear_bit(key->keyidx, sc->sc_keymap); 778 clear_bit(key->keyidx, sc->sc_keymap);
767 sc->sc_keytype = ATH9K_CIPHER_CLR;
768 break; 779 break;
769 default: 780 default:
770 ret = -EINVAL; 781 ret = -EINVAL;
@@ -1400,10 +1411,17 @@ static void ath_pci_remove(struct pci_dev *pdev)
1400{ 1411{
1401 struct ieee80211_hw *hw = pci_get_drvdata(pdev); 1412 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
1402 struct ath_softc *sc = hw->priv; 1413 struct ath_softc *sc = hw->priv;
1414 enum ath9k_int status;
1403 1415
1404 if (pdev->irq) 1416 if (pdev->irq) {
1417 ath9k_hw_set_interrupts(sc->sc_ah, 0);
1418 /* clear the ISR */
1419 ath9k_hw_getisr(sc->sc_ah, &status);
1420 sc->sc_invalid = 1;
1405 free_irq(pdev->irq, sc); 1421 free_irq(pdev->irq, sc);
1422 }
1406 ath_detach(sc); 1423 ath_detach(sc);
1424
1407 pci_iounmap(pdev, sc->mem); 1425 pci_iounmap(pdev, sc->mem);
1408 pci_release_region(pdev, 0); 1426 pci_release_region(pdev, 0);
1409 pci_disable_device(pdev); 1427 pci_disable_device(pdev);
diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c
index 550129f717e2..8b332e11a656 100644
--- a/drivers/net/wireless/ath9k/xmit.c
+++ b/drivers/net/wireless/ath9k/xmit.c
@@ -315,11 +315,11 @@ static int ath_tx_prepare(struct ath_softc *sc,
315 txctl->keyix = tx_info->control.hw_key->hw_key_idx; 315 txctl->keyix = tx_info->control.hw_key->hw_key_idx;
316 txctl->frmlen += tx_info->control.icv_len; 316 txctl->frmlen += tx_info->control.icv_len;
317 317
318 if (sc->sc_keytype == ATH9K_CIPHER_WEP) 318 if (tx_info->control.hw_key->alg == ALG_WEP)
319 txctl->keytype = ATH9K_KEY_TYPE_WEP; 319 txctl->keytype = ATH9K_KEY_TYPE_WEP;
320 else if (sc->sc_keytype == ATH9K_CIPHER_TKIP) 320 else if (tx_info->control.hw_key->alg == ALG_TKIP)
321 txctl->keytype = ATH9K_KEY_TYPE_TKIP; 321 txctl->keytype = ATH9K_KEY_TYPE_TKIP;
322 else if (sc->sc_keytype == ATH9K_CIPHER_AES_CCM) 322 else if (tx_info->control.hw_key->alg == ALG_CCMP)
323 txctl->keytype = ATH9K_KEY_TYPE_AES; 323 txctl->keytype = ATH9K_KEY_TYPE_AES;
324 } 324 }
325 325
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c
index fec5645944a4..34ae125d5384 100644
--- a/drivers/net/wireless/b43/rfkill.c
+++ b/drivers/net/wireless/b43/rfkill.c
@@ -43,23 +43,6 @@ static bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
43 return 0; 43 return 0;
44} 44}
45 45
46/* Update the rfkill state */
47static void b43_rfkill_update_state(struct b43_wldev *dev)
48{
49 struct b43_rfkill *rfk = &(dev->wl->rfkill);
50
51 if (!dev->radio_hw_enable) {
52 rfk->rfkill->state = RFKILL_STATE_HARD_BLOCKED;
53 return;
54 }
55
56 if (!dev->phy.radio_on)
57 rfk->rfkill->state = RFKILL_STATE_SOFT_BLOCKED;
58 else
59 rfk->rfkill->state = RFKILL_STATE_UNBLOCKED;
60
61}
62
63/* The poll callback for the hardware button. */ 46/* The poll callback for the hardware button. */
64static void b43_rfkill_poll(struct input_polled_dev *poll_dev) 47static void b43_rfkill_poll(struct input_polled_dev *poll_dev)
65{ 48{
@@ -77,7 +60,6 @@ static void b43_rfkill_poll(struct input_polled_dev *poll_dev)
77 if (unlikely(enabled != dev->radio_hw_enable)) { 60 if (unlikely(enabled != dev->radio_hw_enable)) {
78 dev->radio_hw_enable = enabled; 61 dev->radio_hw_enable = enabled;
79 report_change = 1; 62 report_change = 1;
80 b43_rfkill_update_state(dev);
81 b43info(wl, "Radio hardware status changed to %s\n", 63 b43info(wl, "Radio hardware status changed to %s\n",
82 enabled ? "ENABLED" : "DISABLED"); 64 enabled ? "ENABLED" : "DISABLED");
83 } 65 }
diff --git a/drivers/net/wireless/b43legacy/rfkill.c b/drivers/net/wireless/b43legacy/rfkill.c
index 476add97e974..b32bf6a94f19 100644
--- a/drivers/net/wireless/b43legacy/rfkill.c
+++ b/drivers/net/wireless/b43legacy/rfkill.c
@@ -44,23 +44,6 @@ static bool b43legacy_is_hw_radio_enabled(struct b43legacy_wldev *dev)
44 return 0; 44 return 0;
45} 45}
46 46
47/* Update the rfkill state */
48static void b43legacy_rfkill_update_state(struct b43legacy_wldev *dev)
49{
50 struct b43legacy_rfkill *rfk = &(dev->wl->rfkill);
51
52 if (!dev->radio_hw_enable) {
53 rfk->rfkill->state = RFKILL_STATE_HARD_BLOCKED;
54 return;
55 }
56
57 if (!dev->phy.radio_on)
58 rfk->rfkill->state = RFKILL_STATE_SOFT_BLOCKED;
59 else
60 rfk->rfkill->state = RFKILL_STATE_UNBLOCKED;
61
62}
63
64/* The poll callback for the hardware button. */ 47/* The poll callback for the hardware button. */
65static void b43legacy_rfkill_poll(struct input_polled_dev *poll_dev) 48static void b43legacy_rfkill_poll(struct input_polled_dev *poll_dev)
66{ 49{
@@ -78,7 +61,6 @@ static void b43legacy_rfkill_poll(struct input_polled_dev *poll_dev)
78 if (unlikely(enabled != dev->radio_hw_enable)) { 61 if (unlikely(enabled != dev->radio_hw_enable)) {
79 dev->radio_hw_enable = enabled; 62 dev->radio_hw_enable = enabled;
80 report_change = 1; 63 report_change = 1;
81 b43legacy_rfkill_update_state(dev);
82 b43legacyinfo(wl, "Radio hardware status changed to %s\n", 64 b43legacyinfo(wl, "Radio hardware status changed to %s\n",
83 enabled ? "ENABLED" : "DISABLED"); 65 enabled ? "ENABLED" : "DISABLED");
84 } 66 }
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index da8b7433e3a6..a60ae86bd5c9 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -58,6 +58,7 @@ static struct usb_device_id usb_ids[] = {
58 { USB_DEVICE(0x0586, 0x3407), .driver_info = DEVICE_ZD1211 }, 58 { USB_DEVICE(0x0586, 0x3407), .driver_info = DEVICE_ZD1211 },
59 { USB_DEVICE(0x129b, 0x1666), .driver_info = DEVICE_ZD1211 }, 59 { USB_DEVICE(0x129b, 0x1666), .driver_info = DEVICE_ZD1211 },
60 { USB_DEVICE(0x157e, 0x300a), .driver_info = DEVICE_ZD1211 }, 60 { USB_DEVICE(0x157e, 0x300a), .driver_info = DEVICE_ZD1211 },
61 { USB_DEVICE(0x0105, 0x145f), .driver_info = DEVICE_ZD1211 },
61 /* ZD1211B */ 62 /* ZD1211B */
62 { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B }, 63 { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B },
63 { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B }, 64 { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B },
diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c
index 40337a06c18a..146ca9cd1567 100644
--- a/drivers/pci/hotplug/fakephp.c
+++ b/drivers/pci/hotplug/fakephp.c
@@ -320,15 +320,15 @@ static int disable_slot(struct hotplug_slot *slot)
320 return -ENODEV; 320 return -ENODEV;
321 } 321 }
322 322
323 /* remove the device from the pci core */
324 pci_remove_bus_device(dev);
325
323 /* queue work item to blow away this sysfs entry and other 326 /* queue work item to blow away this sysfs entry and other
324 * parts. 327 * parts.
325 */ 328 */
326 INIT_WORK(&dslot->remove_work, remove_slot_worker); 329 INIT_WORK(&dslot->remove_work, remove_slot_worker);
327 queue_work(dummyphp_wq, &dslot->remove_work); 330 queue_work(dummyphp_wq, &dslot->remove_work);
328 331
329 /* blow away this sysfs entry and other parts. */
330 remove_slot(dslot);
331
332 pci_dev_put(dev); 332 pci_dev_put(dev);
333 } 333 }
334 return 0; 334 return 0;
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index ab31f5ba665d..9d934ddee956 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -258,7 +258,7 @@ static int pcie_poll_cmd(struct controller *ctrl)
258 return 1; 258 return 1;
259 } 259 }
260 } 260 }
261 while (timeout > 1000) { 261 while (timeout > 0) {
262 msleep(10); 262 msleep(10);
263 timeout -= 10; 263 timeout -= 10;
264 if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status)) { 264 if (!pciehp_readw(ctrl, SLOTSTATUS, &slot_status)) {
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 9c718583a237..77baff022f71 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -16,6 +16,7 @@
16 16
17 17
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/sched.h>
19#include <linux/pci.h> 20#include <linux/pci.h>
20#include <linux/stat.h> 21#include <linux/stat.h>
21#include <linux/topology.h> 22#include <linux/topology.h>
@@ -484,6 +485,21 @@ pci_mmap_legacy_mem(struct kobject *kobj, struct bin_attribute *attr,
484#endif /* HAVE_PCI_LEGACY */ 485#endif /* HAVE_PCI_LEGACY */
485 486
486#ifdef HAVE_PCI_MMAP 487#ifdef HAVE_PCI_MMAP
488
489static int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma)
490{
491 unsigned long nr, start, size;
492
493 nr = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
494 start = vma->vm_pgoff;
495 size = pci_resource_len(pdev, resno) >> PAGE_SHIFT;
496 if (start < size && size - start >= nr)
497 return 1;
498 WARN(1, "process \"%s\" tried to map 0x%08lx-0x%08lx on %s BAR %d (size 0x%08lx)\n",
499 current->comm, start, start+nr, pci_name(pdev), resno, size);
500 return 0;
501}
502
487/** 503/**
488 * pci_mmap_resource - map a PCI resource into user memory space 504 * pci_mmap_resource - map a PCI resource into user memory space
489 * @kobj: kobject for mapping 505 * @kobj: kobject for mapping
@@ -510,6 +526,9 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
510 if (i >= PCI_ROM_RESOURCE) 526 if (i >= PCI_ROM_RESOURCE)
511 return -ENODEV; 527 return -ENODEV;
512 528
529 if (!pci_mmap_fits(pdev, i, vma))
530 return -EINVAL;
531
513 /* pci_mmap_page_range() expects the same kind of entry as coming 532 /* pci_mmap_page_range() expects the same kind of entry as coming
514 * from /proc/bus/pci/ which is a "user visible" value. If this is 533 * from /proc/bus/pci/ which is a "user visible" value. If this is
515 * different from the resource itself, arch will do necessary fixup. 534 * different from the resource itself, arch will do necessary fixup.
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 9a7c9e1408a4..851f5b83cdbc 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -527,7 +527,7 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev)
527 */ 527 */
528 pci_read_config_dword(child_dev, child_pos + PCI_EXP_DEVCAP, 528 pci_read_config_dword(child_dev, child_pos + PCI_EXP_DEVCAP,
529 &reg32); 529 &reg32);
530 if (!(reg32 & PCI_EXP_DEVCAP_RBER && !aspm_force)) { 530 if (!(reg32 & PCI_EXP_DEVCAP_RBER) && !aspm_force) {
531 printk("Pre-1.1 PCIe device detected, " 531 printk("Pre-1.1 PCIe device detected, "
532 "disable ASPM for %s. It can be enabled forcedly" 532 "disable ASPM for %s. It can be enabled forcedly"
533 " with 'pcie_aspm=force'\n", pci_name(pdev)); 533 " with 'pcie_aspm=force'\n", pci_name(pdev));
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index cce2f4cb1fbf..36698e57b97f 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -304,6 +304,9 @@ static int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
304 } else { 304 } else {
305 res->start = l64; 305 res->start = l64;
306 res->end = l64 + sz64; 306 res->end = l64 + sz64;
307 printk(KERN_DEBUG "PCI: %s reg %x 64bit mmio: [%llx, %llx]\n",
308 pci_name(dev), pos, (unsigned long long)res->start,
309 (unsigned long long)res->end);
307 } 310 }
308 } else { 311 } else {
309 sz = pci_size(l, sz, mask); 312 sz = pci_size(l, sz, mask);
@@ -313,6 +316,9 @@ static int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
313 316
314 res->start = l; 317 res->start = l;
315 res->end = l + sz; 318 res->end = l + sz;
319 printk(KERN_DEBUG "PCI: %s reg %x %s: [%llx, %llx]\n", pci_name(dev),
320 pos, (res->flags & IORESOURCE_IO) ? "io port":"32bit mmio",
321 (unsigned long long)res->start, (unsigned long long)res->end);
316 } 322 }
317 323
318 out: 324 out:
@@ -383,7 +389,9 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
383 res->start = base; 389 res->start = base;
384 if (!res->end) 390 if (!res->end)
385 res->end = limit + 0xfff; 391 res->end = limit + 0xfff;
386 printk(KERN_INFO "PCI: bridge %s io port: [%llx, %llx]\n", pci_name(dev), res->start, res->end); 392 printk(KERN_DEBUG "PCI: bridge %s io port: [%llx, %llx]\n",
393 pci_name(dev), (unsigned long long) res->start,
394 (unsigned long long) res->end);
387 } 395 }
388 396
389 res = child->resource[1]; 397 res = child->resource[1];
@@ -395,7 +403,9 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
395 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM; 403 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM;
396 res->start = base; 404 res->start = base;
397 res->end = limit + 0xfffff; 405 res->end = limit + 0xfffff;
398 printk(KERN_INFO "PCI: bridge %s 32bit mmio: [%llx, %llx]\n", pci_name(dev), res->start, res->end); 406 printk(KERN_DEBUG "PCI: bridge %s 32bit mmio: [%llx, %llx]\n",
407 pci_name(dev), (unsigned long long) res->start,
408 (unsigned long long) res->end);
399 } 409 }
400 410
401 res = child->resource[2]; 411 res = child->resource[2];
@@ -431,7 +441,9 @@ void __devinit pci_read_bridge_bases(struct pci_bus *child)
431 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH; 441 res->flags = (mem_base_lo & PCI_MEMORY_RANGE_TYPE_MASK) | IORESOURCE_MEM | IORESOURCE_PREFETCH;
432 res->start = base; 442 res->start = base;
433 res->end = limit + 0xfffff; 443 res->end = limit + 0xfffff;
434 printk(KERN_INFO "PCI: bridge %s %sbit mmio pref: [%llx, %llx]\n", pci_name(dev), (res->flags & PCI_PREF_RANGE_TYPE_64)?"64":"32",res->start, res->end); 444 printk(KERN_DEBUG "PCI: bridge %s %sbit mmio pref: [%llx, %llx]\n",
445 pci_name(dev), (res->flags & PCI_PREF_RANGE_TYPE_64) ? "64" : "32",
446 (unsigned long long) res->start, (unsigned long long) res->end);
435 } 447 }
436} 448}
437 449
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index 3b3b5f178797..4edfc4731bd4 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -162,7 +162,7 @@ EXPORT_SYMBOL(pci_find_slot);
162 * time. 162 * time.
163 */ 163 */
164struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device, 164struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device,
165 const struct pci_dev *from) 165 struct pci_dev *from)
166{ 166{
167 struct pci_dev *pdev; 167 struct pci_dev *pdev;
168 168
@@ -263,7 +263,7 @@ static int match_pci_dev_by_id(struct device *dev, void *data)
263 * this file. 263 * this file.
264 */ 264 */
265static struct pci_dev *pci_get_dev_by_id(const struct pci_device_id *id, 265static struct pci_dev *pci_get_dev_by_id(const struct pci_device_id *id,
266 const struct pci_dev *from) 266 struct pci_dev *from)
267{ 267{
268 struct device *dev; 268 struct device *dev;
269 struct device *dev_start = NULL; 269 struct device *dev_start = NULL;
@@ -303,7 +303,7 @@ static struct pci_dev *pci_get_dev_by_id(const struct pci_device_id *id,
303 */ 303 */
304struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, 304struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
305 unsigned int ss_vendor, unsigned int ss_device, 305 unsigned int ss_vendor, unsigned int ss_device,
306 const struct pci_dev *from) 306 struct pci_dev *from)
307{ 307{
308 struct pci_dev *pdev; 308 struct pci_dev *pdev;
309 struct pci_device_id *id; 309 struct pci_device_id *id;
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 1aad599816f7..3abbfad9ddab 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -540,7 +540,11 @@ static void pci_bus_dump_res(struct pci_bus *bus)
540 if (!res) 540 if (!res)
541 continue; 541 continue;
542 542
543 printk(KERN_INFO "bus: %02x index %x %s: [%llx, %llx]\n", bus->number, i, (res->flags & IORESOURCE_IO)? "io port":"mmio", res->start, res->end); 543 printk(KERN_INFO "bus: %02x index %x %s: [%llx, %llx]\n",
544 bus->number, i,
545 (res->flags & IORESOURCE_IO) ? "io port" : "mmio",
546 (unsigned long long) res->start,
547 (unsigned long long) res->end);
544 } 548 }
545} 549}
546 550
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 4174d9656e35..34c83d3ca0fa 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -427,6 +427,18 @@ static int pcmcia_device_probe(struct device * dev)
427 p_drv = to_pcmcia_drv(dev->driver); 427 p_drv = to_pcmcia_drv(dev->driver);
428 s = p_dev->socket; 428 s = p_dev->socket;
429 429
430 /* The PCMCIA code passes the match data in via dev->driver_data
431 * which is an ugly hack. Once the driver probe is called it may
432 * and often will overwrite the match data so we must save it first
433 *
434 * handle pseudo multifunction devices:
435 * there are at most two pseudo multifunction devices.
436 * if we're matching against the first, schedule a
437 * call which will then check whether there are two
438 * pseudo devices, and if not, add the second one.
439 */
440 did = p_dev->dev.driver_data;
441
430 ds_dbg(1, "trying to bind %s to %s\n", p_dev->dev.bus_id, 442 ds_dbg(1, "trying to bind %s to %s\n", p_dev->dev.bus_id,
431 p_drv->drv.name); 443 p_drv->drv.name);
432 444
@@ -455,21 +467,14 @@ static int pcmcia_device_probe(struct device * dev)
455 goto put_module; 467 goto put_module;
456 } 468 }
457 469
458 /* handle pseudo multifunction devices:
459 * there are at most two pseudo multifunction devices.
460 * if we're matching against the first, schedule a
461 * call which will then check whether there are two
462 * pseudo devices, and if not, add the second one.
463 */
464 did = p_dev->dev.driver_data;
465 if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) && 470 if (did && (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) &&
466 (p_dev->socket->device_count == 1) && (p_dev->device_no == 0)) 471 (p_dev->socket->device_count == 1) && (p_dev->device_no == 0))
467 pcmcia_add_device_later(p_dev->socket, 0); 472 pcmcia_add_device_later(p_dev->socket, 0);
468 473
469 put_module: 474put_module:
470 if (ret) 475 if (ret)
471 module_put(p_drv->owner); 476 module_put(p_drv->owner);
472 put_dev: 477put_dev:
473 if (ret) 478 if (ret)
474 put_device(dev); 479 put_device(dev);
475 return (ret); 480 return (ret);
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c
index c48f3f69bdaf..da3972153226 100644
--- a/drivers/pcmcia/soc_common.c
+++ b/drivers/pcmcia/soc_common.c
@@ -748,7 +748,9 @@ int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops
748 748
749 add_timer(&skt->poll_timer); 749 add_timer(&skt->poll_timer);
750 750
751 device_create_file(&skt->socket.dev, &dev_attr_status); 751 ret = device_create_file(&skt->socket.dev, &dev_attr_status);
752 if (ret)
753 goto out_err_8;
752 } 754 }
753 755
754 dev_set_drvdata(dev, sinfo); 756 dev_set_drvdata(dev, sinfo);
@@ -758,6 +760,8 @@ int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops
758 do { 760 do {
759 skt = &sinfo->skt[i]; 761 skt = &sinfo->skt[i];
760 762
763 device_remove_file(&skt->socket.dev, &dev_attr_status);
764 out_err_8:
761 del_timer_sync(&skt->poll_timer); 765 del_timer_sync(&skt->poll_timer);
762 pcmcia_unregister_socket(&skt->socket); 766 pcmcia_unregister_socket(&skt->socket);
763 767
diff --git a/drivers/pnp/Makefile b/drivers/pnp/Makefile
index 26f5abc9c3f7..e83f34f1b5ba 100644
--- a/drivers/pnp/Makefile
+++ b/drivers/pnp/Makefile
@@ -2,12 +2,15 @@
2# Makefile for the Linux Plug-and-Play Support. 2# Makefile for the Linux Plug-and-Play Support.
3# 3#
4 4
5obj-y := core.o card.o driver.o resource.o manager.o support.o interface.o quirks.o system.o 5obj-y := core.o card.o driver.o resource.o manager.o support.o interface.o quirks.o
6 6
7obj-$(CONFIG_PNPACPI) += pnpacpi/ 7obj-$(CONFIG_PNPACPI) += pnpacpi/
8obj-$(CONFIG_PNPBIOS) += pnpbios/ 8obj-$(CONFIG_PNPBIOS) += pnpbios/
9obj-$(CONFIG_ISAPNP) += isapnp/ 9obj-$(CONFIG_ISAPNP) += isapnp/
10 10
11# pnp_system_init goes after pnpacpi/pnpbios init
12obj-y += system.o
13
11ifeq ($(CONFIG_PNP_DEBUG),y) 14ifeq ($(CONFIG_PNP_DEBUG),y)
12EXTRA_CFLAGS += -DDEBUG 15EXTRA_CFLAGS += -DDEBUG
13endif 16endif
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index c1b9ea34977b..53561d72b4ee 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -268,7 +268,7 @@ static int __init pnpacpi_init(void)
268 return 0; 268 return 0;
269} 269}
270 270
271subsys_initcall(pnpacpi_init); 271fs_initcall(pnpacpi_init);
272 272
273static int __init pnpacpi_setup(char *str) 273static int __init pnpacpi_setup(char *str)
274{ 274{
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index 19a4be1a9a31..662dfcddedc6 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -571,7 +571,7 @@ static int __init pnpbios_init(void)
571 return 0; 571 return 0;
572} 572}
573 573
574subsys_initcall(pnpbios_init); 574fs_initcall(pnpbios_init);
575 575
576static int __init pnpbios_thread_init(void) 576static int __init pnpbios_thread_init(void)
577{ 577{
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c
index f118252f3a9f..52e2743b04ec 100644
--- a/drivers/rtc/rtc-dev.c
+++ b/drivers/rtc/rtc-dev.c
@@ -422,6 +422,12 @@ done:
422 return err; 422 return err;
423} 423}
424 424
425static int rtc_dev_fasync(int fd, struct file *file, int on)
426{
427 struct rtc_device *rtc = file->private_data;
428 return fasync_helper(fd, file, on, &rtc->async_queue);
429}
430
425static int rtc_dev_release(struct inode *inode, struct file *file) 431static int rtc_dev_release(struct inode *inode, struct file *file)
426{ 432{
427 struct rtc_device *rtc = file->private_data; 433 struct rtc_device *rtc = file->private_data;
@@ -434,16 +440,13 @@ static int rtc_dev_release(struct inode *inode, struct file *file)
434 if (rtc->ops->release) 440 if (rtc->ops->release)
435 rtc->ops->release(rtc->dev.parent); 441 rtc->ops->release(rtc->dev.parent);
436 442
443 if (file->f_flags & FASYNC)
444 rtc_dev_fasync(-1, file, 0);
445
437 clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags); 446 clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags);
438 return 0; 447 return 0;
439} 448}
440 449
441static int rtc_dev_fasync(int fd, struct file *file, int on)
442{
443 struct rtc_device *rtc = file->private_data;
444 return fasync_helper(fd, file, on, &rtc->async_queue);
445}
446
447static const struct file_operations rtc_dev_fops = { 450static const struct file_operations rtc_dev_fops = {
448 .owner = THIS_MODULE, 451 .owner = THIS_MODULE,
449 .llseek = no_llseek, 452 .llseek = no_llseek,
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index e0ce65fca4e7..9a50f245774b 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -113,7 +113,8 @@ ccwgroup_release (struct device *dev)
113 113
114 for (i = 0; i < gdev->count; i++) { 114 for (i = 0; i < gdev->count; i++) {
115 if (gdev->cdev[i]) { 115 if (gdev->cdev[i]) {
116 dev_set_drvdata(&gdev->cdev[i]->dev, NULL); 116 if (dev_get_drvdata(&gdev->cdev[i]->dev) == gdev)
117 dev_set_drvdata(&gdev->cdev[i]->dev, NULL);
117 put_device(&gdev->cdev[i]->dev); 118 put_device(&gdev->cdev[i]->dev);
118 } 119 }
119 } 120 }
@@ -296,6 +297,7 @@ error:
296 if (dev_get_drvdata(&gdev->cdev[i]->dev) == gdev) 297 if (dev_get_drvdata(&gdev->cdev[i]->dev) == gdev)
297 dev_set_drvdata(&gdev->cdev[i]->dev, NULL); 298 dev_set_drvdata(&gdev->cdev[i]->dev, NULL);
298 put_device(&gdev->cdev[i]->dev); 299 put_device(&gdev->cdev[i]->dev);
300 gdev->cdev[i] = NULL;
299 } 301 }
300 mutex_unlock(&gdev->reg_mutex); 302 mutex_unlock(&gdev->reg_mutex);
301 put_device(&gdev->dev); 303 put_device(&gdev->dev);
diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c
index 5954b905e3ca..326f4cc7f92c 100644
--- a/drivers/s390/cio/cio.c
+++ b/drivers/s390/cio/cio.c
@@ -174,6 +174,7 @@ cio_start_key (struct subchannel *sch, /* subchannel structure */
174 CIO_TRACE_EVENT(4, sch->dev.bus_id); 174 CIO_TRACE_EVENT(4, sch->dev.bus_id);
175 175
176 orb = &to_io_private(sch)->orb; 176 orb = &to_io_private(sch)->orb;
177 memset(orb, 0, sizeof(union orb));
177 /* sch is always under 2G. */ 178 /* sch is always under 2G. */
178 orb->cmd.intparm = (u32)(addr_t)sch; 179 orb->cmd.intparm = (u32)(addr_t)sch;
179 orb->cmd.fmt = 1; 180 orb->cmd.fmt = 1;
diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c
index 1679e2f91c94..a0b6b46e7466 100644
--- a/drivers/s390/cio/qdio_setup.c
+++ b/drivers/s390/cio/qdio_setup.c
@@ -447,51 +447,36 @@ void qdio_print_subchannel_info(struct qdio_irq *irq_ptr,
447{ 447{
448 char s[80]; 448 char s[80];
449 449
450 sprintf(s, "%s sc:%x ", cdev->dev.bus_id, irq_ptr->schid.sch_no); 450 sprintf(s, "qdio: %s ", dev_name(&cdev->dev));
451
452 switch (irq_ptr->qib.qfmt) { 451 switch (irq_ptr->qib.qfmt) {
453 case QDIO_QETH_QFMT: 452 case QDIO_QETH_QFMT:
454 sprintf(s + strlen(s), "OSADE "); 453 sprintf(s + strlen(s), "OSA ");
455 break; 454 break;
456 case QDIO_ZFCP_QFMT: 455 case QDIO_ZFCP_QFMT:
457 sprintf(s + strlen(s), "ZFCP "); 456 sprintf(s + strlen(s), "ZFCP ");
458 break; 457 break;
459 case QDIO_IQDIO_QFMT: 458 case QDIO_IQDIO_QFMT:
460 sprintf(s + strlen(s), "HiperSockets "); 459 sprintf(s + strlen(s), "HS ");
461 break; 460 break;
462 } 461 }
463 sprintf(s + strlen(s), "using: "); 462 sprintf(s + strlen(s), "on SC %x using ", irq_ptr->schid.sch_no);
464 463 sprintf(s + strlen(s), "AI:%d ", is_thinint_irq(irq_ptr));
465 if (!is_thinint_irq(irq_ptr)) 464 sprintf(s + strlen(s), "QEBSM:%d ", (irq_ptr->sch_token) ? 1 : 0);
466 sprintf(s + strlen(s), "no"); 465 sprintf(s + strlen(s), "PCI:%d ",
467 sprintf(s + strlen(s), "AdapterInterrupts "); 466 (irq_ptr->qib.ac & QIB_AC_OUTBOUND_PCI_SUPPORTED) ? 1 : 0);
468 if (!(irq_ptr->sch_token != 0)) 467 sprintf(s + strlen(s), "TDD:%d ", css_general_characteristics.aif_tdd);
469 sprintf(s + strlen(s), "no"); 468 sprintf(s + strlen(s), "SIGA:");
470 sprintf(s + strlen(s), "QEBSM "); 469 sprintf(s + strlen(s), "%s", (irq_ptr->siga_flag.input) ? "R" : " ");
471 if (!(irq_ptr->qib.ac & QIB_AC_OUTBOUND_PCI_SUPPORTED)) 470 sprintf(s + strlen(s), "%s", (irq_ptr->siga_flag.output) ? "W" : " ");
472 sprintf(s + strlen(s), "no"); 471 sprintf(s + strlen(s), "%s", (irq_ptr->siga_flag.sync) ? "S" : " ");
473 sprintf(s + strlen(s), "OutboundPCI "); 472 sprintf(s + strlen(s), "%s",
474 if (!css_general_characteristics.aif_tdd) 473 (!irq_ptr->siga_flag.no_sync_ti) ? "A" : " ");
475 sprintf(s + strlen(s), "no"); 474 sprintf(s + strlen(s), "%s",
476 sprintf(s + strlen(s), "TDD\n"); 475 (!irq_ptr->siga_flag.no_sync_out_ti) ? "O" : " ");
477 printk(KERN_INFO "qdio: %s", s); 476 sprintf(s + strlen(s), "%s",
478 477 (!irq_ptr->siga_flag.no_sync_out_pci) ? "P" : " ");
479 memset(s, 0, sizeof(s));
480 sprintf(s, "%s SIGA required: ", cdev->dev.bus_id);
481 if (irq_ptr->siga_flag.input)
482 sprintf(s + strlen(s), "Read ");
483 if (irq_ptr->siga_flag.output)
484 sprintf(s + strlen(s), "Write ");
485 if (irq_ptr->siga_flag.sync)
486 sprintf(s + strlen(s), "Sync ");
487 if (!irq_ptr->siga_flag.no_sync_ti)
488 sprintf(s + strlen(s), "SyncAI ");
489 if (!irq_ptr->siga_flag.no_sync_out_ti)
490 sprintf(s + strlen(s), "SyncOutAI ");
491 if (!irq_ptr->siga_flag.no_sync_out_pci)
492 sprintf(s + strlen(s), "SyncOutPCI");
493 sprintf(s + strlen(s), "\n"); 478 sprintf(s + strlen(s), "\n");
494 printk(KERN_INFO "qdio: %s", s); 479 printk(KERN_INFO "%s", s);
495} 480}
496 481
497int __init qdio_setup_init(void) 482int __init qdio_setup_init(void)
diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c
index 391dd29749f8..51b6a05f4d12 100644
--- a/drivers/s390/scsi/zfcp_ccw.c
+++ b/drivers/s390/scsi/zfcp_ccw.c
@@ -152,10 +152,8 @@ static int zfcp_ccw_set_offline(struct ccw_device *ccw_device)
152 */ 152 */
153static int zfcp_ccw_notify(struct ccw_device *ccw_device, int event) 153static int zfcp_ccw_notify(struct ccw_device *ccw_device, int event)
154{ 154{
155 struct zfcp_adapter *adapter; 155 struct zfcp_adapter *adapter = dev_get_drvdata(&ccw_device->dev);
156 156
157 down(&zfcp_data.config_sema);
158 adapter = dev_get_drvdata(&ccw_device->dev);
159 switch (event) { 157 switch (event) {
160 case CIO_GONE: 158 case CIO_GONE:
161 dev_warn(&adapter->ccw_device->dev, "device gone\n"); 159 dev_warn(&adapter->ccw_device->dev, "device gone\n");
@@ -174,8 +172,6 @@ static int zfcp_ccw_notify(struct ccw_device *ccw_device, int event)
174 89, NULL); 172 89, NULL);
175 break; 173 break;
176 } 174 }
177 zfcp_erp_wait(adapter);
178 up(&zfcp_data.config_sema);
179 return 1; 175 return 1;
180} 176}
181 177
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
index e984469bb98b..56196c98c07b 100644
--- a/drivers/s390/scsi/zfcp_fc.c
+++ b/drivers/s390/scsi/zfcp_fc.c
@@ -39,18 +39,6 @@ struct zfcp_gpn_ft {
39 struct scatterlist sg_resp[ZFCP_GPN_FT_BUFFERS]; 39 struct scatterlist sg_resp[ZFCP_GPN_FT_BUFFERS];
40}; 40};
41 41
42static struct zfcp_port *zfcp_get_port_by_did(struct zfcp_adapter *adapter,
43 u32 d_id)
44{
45 struct zfcp_port *port;
46
47 list_for_each_entry(port, &adapter->port_list_head, list)
48 if ((port->d_id == d_id) &&
49 !atomic_test_mask(ZFCP_STATUS_COMMON_REMOVE, &port->status))
50 return port;
51 return NULL;
52}
53
54static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range, 42static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range,
55 struct fcp_rscn_element *elem) 43 struct fcp_rscn_element *elem)
56{ 44{
@@ -341,12 +329,13 @@ void zfcp_test_link(struct zfcp_port *port)
341 329
342 zfcp_port_get(port); 330 zfcp_port_get(port);
343 retval = zfcp_fc_adisc(port); 331 retval = zfcp_fc_adisc(port);
344 if (retval == 0 || retval == -EBUSY) 332 if (retval == 0)
345 return; 333 return;
346 334
347 /* send of ADISC was not possible */ 335 /* send of ADISC was not possible */
348 zfcp_port_put(port); 336 zfcp_port_put(port);
349 zfcp_erp_port_forced_reopen(port, 0, 65, NULL); 337 if (retval != -EBUSY)
338 zfcp_erp_port_forced_reopen(port, 0, 65, NULL);
350} 339}
351 340
352static int zfcp_scan_get_nameserver(struct zfcp_adapter *adapter) 341static int zfcp_scan_get_nameserver(struct zfcp_adapter *adapter)
@@ -363,7 +352,6 @@ static int zfcp_scan_get_nameserver(struct zfcp_adapter *adapter)
363 if (ret) 352 if (ret)
364 return ret; 353 return ret;
365 zfcp_erp_wait(adapter); 354 zfcp_erp_wait(adapter);
366 zfcp_port_put(adapter->nameserver_port);
367 } 355 }
368 return !atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED, 356 return !atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED,
369 &adapter->nameserver_port->status); 357 &adapter->nameserver_port->status);
@@ -475,7 +463,7 @@ static int zfcp_scan_eval_gpn_ft(struct zfcp_gpn_ft *gpn_ft)
475 struct zfcp_adapter *adapter = ct->port->adapter; 463 struct zfcp_adapter *adapter = ct->port->adapter;
476 struct zfcp_port *port, *tmp; 464 struct zfcp_port *port, *tmp;
477 u32 d_id; 465 u32 d_id;
478 int ret = 0, x; 466 int ret = 0, x, last = 0;
479 467
480 if (ct->status) 468 if (ct->status)
481 return -EIO; 469 return -EIO;
@@ -492,19 +480,24 @@ static int zfcp_scan_eval_gpn_ft(struct zfcp_gpn_ft *gpn_ft)
492 down(&zfcp_data.config_sema); 480 down(&zfcp_data.config_sema);
493 481
494 /* first entry is the header */ 482 /* first entry is the header */
495 for (x = 1; x < ZFCP_GPN_FT_MAX_ENTRIES; x++) { 483 for (x = 1; x < ZFCP_GPN_FT_MAX_ENTRIES && !last; x++) {
496 if (x % (ZFCP_GPN_FT_ENTRIES + 1)) 484 if (x % (ZFCP_GPN_FT_ENTRIES + 1))
497 acc++; 485 acc++;
498 else 486 else
499 acc = sg_virt(++sg); 487 acc = sg_virt(++sg);
500 488
489 last = acc->control & 0x80;
501 d_id = acc->port_id[0] << 16 | acc->port_id[1] << 8 | 490 d_id = acc->port_id[0] << 16 | acc->port_id[1] << 8 |
502 acc->port_id[2]; 491 acc->port_id[2];
503 492
504 /* skip the adapter's port and known remote ports */ 493 /* skip the adapter's port and known remote ports */
505 if (acc->wwpn == fc_host_port_name(adapter->scsi_host) || 494 if (acc->wwpn == fc_host_port_name(adapter->scsi_host))
506 zfcp_get_port_by_did(adapter, d_id)) 495 continue;
496 port = zfcp_get_port_by_wwpn(adapter, acc->wwpn);
497 if (port) {
498 zfcp_port_get(port);
507 continue; 499 continue;
500 }
508 501
509 port = zfcp_port_enqueue(adapter, acc->wwpn, 502 port = zfcp_port_enqueue(adapter, acc->wwpn,
510 ZFCP_STATUS_PORT_DID_DID | 503 ZFCP_STATUS_PORT_DID_DID |
@@ -513,8 +506,6 @@ static int zfcp_scan_eval_gpn_ft(struct zfcp_gpn_ft *gpn_ft)
513 ret = PTR_ERR(port); 506 ret = PTR_ERR(port);
514 else 507 else
515 zfcp_erp_port_reopen(port, 0, 149, NULL); 508 zfcp_erp_port_reopen(port, 0, 149, NULL);
516 if (acc->control & 0x80) /* last entry */
517 break;
518 } 509 }
519 510
520 zfcp_erp_wait(adapter); 511 zfcp_erp_wait(adapter);
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 19c1ca913874..49dbeb754e5f 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -710,10 +710,10 @@ static void zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *req)
710 710
711static int zfcp_fsf_sbal_check(struct zfcp_qdio_queue *queue) 711static int zfcp_fsf_sbal_check(struct zfcp_qdio_queue *queue)
712{ 712{
713 spin_lock(&queue->lock); 713 spin_lock_bh(&queue->lock);
714 if (atomic_read(&queue->count)) 714 if (atomic_read(&queue->count))
715 return 1; 715 return 1;
716 spin_unlock(&queue->lock); 716 spin_unlock_bh(&queue->lock);
717 return 0; 717 return 0;
718} 718}
719 719
@@ -722,13 +722,13 @@ static int zfcp_fsf_req_sbal_get(struct zfcp_adapter *adapter)
722 long ret; 722 long ret;
723 struct zfcp_qdio_queue *req_q = &adapter->req_q; 723 struct zfcp_qdio_queue *req_q = &adapter->req_q;
724 724
725 spin_unlock(&req_q->lock); 725 spin_unlock_bh(&req_q->lock);
726 ret = wait_event_interruptible_timeout(adapter->request_wq, 726 ret = wait_event_interruptible_timeout(adapter->request_wq,
727 zfcp_fsf_sbal_check(req_q), 5 * HZ); 727 zfcp_fsf_sbal_check(req_q), 5 * HZ);
728 if (ret > 0) 728 if (ret > 0)
729 return 0; 729 return 0;
730 730
731 spin_lock(&req_q->lock); 731 spin_lock_bh(&req_q->lock);
732 return -EIO; 732 return -EIO;
733} 733}
734 734
@@ -870,14 +870,14 @@ int zfcp_fsf_status_read(struct zfcp_adapter *adapter)
870 volatile struct qdio_buffer_element *sbale; 870 volatile struct qdio_buffer_element *sbale;
871 int retval = -EIO; 871 int retval = -EIO;
872 872
873 spin_lock(&adapter->req_q.lock); 873 spin_lock_bh(&adapter->req_q.lock);
874 if (zfcp_fsf_req_sbal_get(adapter)) 874 if (zfcp_fsf_req_sbal_get(adapter))
875 goto out; 875 goto out;
876 876
877 req = zfcp_fsf_req_create(adapter, FSF_QTCB_UNSOLICITED_STATUS, 877 req = zfcp_fsf_req_create(adapter, FSF_QTCB_UNSOLICITED_STATUS,
878 ZFCP_REQ_NO_QTCB, 878 ZFCP_REQ_NO_QTCB,
879 adapter->pool.fsf_req_status_read); 879 adapter->pool.fsf_req_status_read);
880 if (unlikely(IS_ERR(req))) { 880 if (IS_ERR(req)) {
881 retval = PTR_ERR(req); 881 retval = PTR_ERR(req);
882 goto out; 882 goto out;
883 } 883 }
@@ -910,7 +910,7 @@ failed_buf:
910 zfcp_fsf_req_free(req); 910 zfcp_fsf_req_free(req);
911 zfcp_hba_dbf_event_fsf_unsol("fail", adapter, NULL); 911 zfcp_hba_dbf_event_fsf_unsol("fail", adapter, NULL);
912out: 912out:
913 spin_unlock(&adapter->req_q.lock); 913 spin_unlock_bh(&adapter->req_q.lock);
914 return retval; 914 return retval;
915} 915}
916 916
@@ -988,7 +988,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_command(unsigned long old_req_id,
988 goto out; 988 goto out;
989 req = zfcp_fsf_req_create(adapter, FSF_QTCB_ABORT_FCP_CMND, 989 req = zfcp_fsf_req_create(adapter, FSF_QTCB_ABORT_FCP_CMND,
990 req_flags, adapter->pool.fsf_req_abort); 990 req_flags, adapter->pool.fsf_req_abort);
991 if (unlikely(IS_ERR(req))) 991 if (IS_ERR(req))
992 goto out; 992 goto out;
993 993
994 if (unlikely(!(atomic_read(&unit->status) & 994 if (unlikely(!(atomic_read(&unit->status) &
@@ -1106,13 +1106,13 @@ int zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool,
1106 struct zfcp_fsf_req *req; 1106 struct zfcp_fsf_req *req;
1107 int ret = -EIO; 1107 int ret = -EIO;
1108 1108
1109 spin_lock(&adapter->req_q.lock); 1109 spin_lock_bh(&adapter->req_q.lock);
1110 if (zfcp_fsf_req_sbal_get(adapter)) 1110 if (zfcp_fsf_req_sbal_get(adapter))
1111 goto out; 1111 goto out;
1112 1112
1113 req = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_GENERIC, 1113 req = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_GENERIC,
1114 ZFCP_REQ_AUTO_CLEANUP, pool); 1114 ZFCP_REQ_AUTO_CLEANUP, pool);
1115 if (unlikely(IS_ERR(req))) { 1115 if (IS_ERR(req)) {
1116 ret = PTR_ERR(req); 1116 ret = PTR_ERR(req);
1117 goto out; 1117 goto out;
1118 } 1118 }
@@ -1148,7 +1148,7 @@ failed_send:
1148 if (erp_action) 1148 if (erp_action)
1149 erp_action->fsf_req = NULL; 1149 erp_action->fsf_req = NULL;
1150out: 1150out:
1151 spin_unlock(&adapter->req_q.lock); 1151 spin_unlock_bh(&adapter->req_q.lock);
1152 return ret; 1152 return ret;
1153} 1153}
1154 1154
@@ -1223,7 +1223,7 @@ int zfcp_fsf_send_els(struct zfcp_send_els *els)
1223 goto out; 1223 goto out;
1224 req = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_ELS, 1224 req = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_ELS,
1225 ZFCP_REQ_AUTO_CLEANUP, NULL); 1225 ZFCP_REQ_AUTO_CLEANUP, NULL);
1226 if (unlikely(IS_ERR(req))) { 1226 if (IS_ERR(req)) {
1227 ret = PTR_ERR(req); 1227 ret = PTR_ERR(req);
1228 goto out; 1228 goto out;
1229 } 1229 }
@@ -1263,14 +1263,14 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
1263 struct zfcp_adapter *adapter = erp_action->adapter; 1263 struct zfcp_adapter *adapter = erp_action->adapter;
1264 int retval = -EIO; 1264 int retval = -EIO;
1265 1265
1266 spin_lock(&adapter->req_q.lock); 1266 spin_lock_bh(&adapter->req_q.lock);
1267 if (!atomic_read(&adapter->req_q.count)) 1267 if (!atomic_read(&adapter->req_q.count))
1268 goto out; 1268 goto out;
1269 req = zfcp_fsf_req_create(adapter, 1269 req = zfcp_fsf_req_create(adapter,
1270 FSF_QTCB_EXCHANGE_CONFIG_DATA, 1270 FSF_QTCB_EXCHANGE_CONFIG_DATA,
1271 ZFCP_REQ_AUTO_CLEANUP, 1271 ZFCP_REQ_AUTO_CLEANUP,
1272 adapter->pool.fsf_req_erp); 1272 adapter->pool.fsf_req_erp);
1273 if (unlikely(IS_ERR(req))) { 1273 if (IS_ERR(req)) {
1274 retval = PTR_ERR(req); 1274 retval = PTR_ERR(req);
1275 goto out; 1275 goto out;
1276 } 1276 }
@@ -1295,7 +1295,7 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
1295 erp_action->fsf_req = NULL; 1295 erp_action->fsf_req = NULL;
1296 } 1296 }
1297out: 1297out:
1298 spin_unlock(&adapter->req_q.lock); 1298 spin_unlock_bh(&adapter->req_q.lock);
1299 return retval; 1299 return retval;
1300} 1300}
1301 1301
@@ -1306,13 +1306,13 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_adapter *adapter,
1306 struct zfcp_fsf_req *req = NULL; 1306 struct zfcp_fsf_req *req = NULL;
1307 int retval = -EIO; 1307 int retval = -EIO;
1308 1308
1309 spin_lock(&adapter->req_q.lock); 1309 spin_lock_bh(&adapter->req_q.lock);
1310 if (zfcp_fsf_req_sbal_get(adapter)) 1310 if (zfcp_fsf_req_sbal_get(adapter))
1311 goto out; 1311 goto out;
1312 1312
1313 req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_CONFIG_DATA, 1313 req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_CONFIG_DATA,
1314 0, NULL); 1314 0, NULL);
1315 if (unlikely(IS_ERR(req))) { 1315 if (IS_ERR(req)) {
1316 retval = PTR_ERR(req); 1316 retval = PTR_ERR(req);
1317 goto out; 1317 goto out;
1318 } 1318 }
@@ -1334,7 +1334,7 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_adapter *adapter,
1334 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); 1334 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
1335 retval = zfcp_fsf_req_send(req); 1335 retval = zfcp_fsf_req_send(req);
1336out: 1336out:
1337 spin_unlock(&adapter->req_q.lock); 1337 spin_unlock_bh(&adapter->req_q.lock);
1338 if (!retval) 1338 if (!retval)
1339 wait_event(req->completion_wq, 1339 wait_event(req->completion_wq,
1340 req->status & ZFCP_STATUS_FSFREQ_COMPLETED); 1340 req->status & ZFCP_STATUS_FSFREQ_COMPLETED);
@@ -1359,13 +1359,13 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action)
1359 if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) 1359 if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT))
1360 return -EOPNOTSUPP; 1360 return -EOPNOTSUPP;
1361 1361
1362 spin_lock(&adapter->req_q.lock); 1362 spin_lock_bh(&adapter->req_q.lock);
1363 if (!atomic_read(&adapter->req_q.count)) 1363 if (!atomic_read(&adapter->req_q.count))
1364 goto out; 1364 goto out;
1365 req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, 1365 req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA,
1366 ZFCP_REQ_AUTO_CLEANUP, 1366 ZFCP_REQ_AUTO_CLEANUP,
1367 adapter->pool.fsf_req_erp); 1367 adapter->pool.fsf_req_erp);
1368 if (unlikely(IS_ERR(req))) { 1368 if (IS_ERR(req)) {
1369 retval = PTR_ERR(req); 1369 retval = PTR_ERR(req);
1370 goto out; 1370 goto out;
1371 } 1371 }
@@ -1385,7 +1385,7 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action)
1385 erp_action->fsf_req = NULL; 1385 erp_action->fsf_req = NULL;
1386 } 1386 }
1387out: 1387out:
1388 spin_unlock(&adapter->req_q.lock); 1388 spin_unlock_bh(&adapter->req_q.lock);
1389 return retval; 1389 return retval;
1390} 1390}
1391 1391
@@ -1405,13 +1405,13 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_adapter *adapter,
1405 if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) 1405 if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT))
1406 return -EOPNOTSUPP; 1406 return -EOPNOTSUPP;
1407 1407
1408 spin_lock(&adapter->req_q.lock); 1408 spin_lock_bh(&adapter->req_q.lock);
1409 if (!atomic_read(&adapter->req_q.count)) 1409 if (!atomic_read(&adapter->req_q.count))
1410 goto out; 1410 goto out;
1411 1411
1412 req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, 0, 1412 req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, 0,
1413 NULL); 1413 NULL);
1414 if (unlikely(IS_ERR(req))) { 1414 if (IS_ERR(req)) {
1415 retval = PTR_ERR(req); 1415 retval = PTR_ERR(req);
1416 goto out; 1416 goto out;
1417 } 1417 }
@@ -1427,7 +1427,7 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_adapter *adapter,
1427 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); 1427 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
1428 retval = zfcp_fsf_req_send(req); 1428 retval = zfcp_fsf_req_send(req);
1429out: 1429out:
1430 spin_unlock(&adapter->req_q.lock); 1430 spin_unlock_bh(&adapter->req_q.lock);
1431 if (!retval) 1431 if (!retval)
1432 wait_event(req->completion_wq, 1432 wait_event(req->completion_wq,
1433 req->status & ZFCP_STATUS_FSFREQ_COMPLETED); 1433 req->status & ZFCP_STATUS_FSFREQ_COMPLETED);
@@ -1531,7 +1531,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
1531 struct zfcp_fsf_req *req; 1531 struct zfcp_fsf_req *req;
1532 int retval = -EIO; 1532 int retval = -EIO;
1533 1533
1534 spin_lock(&adapter->req_q.lock); 1534 spin_lock_bh(&adapter->req_q.lock);
1535 if (zfcp_fsf_req_sbal_get(adapter)) 1535 if (zfcp_fsf_req_sbal_get(adapter))
1536 goto out; 1536 goto out;
1537 1537
@@ -1539,7 +1539,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
1539 FSF_QTCB_OPEN_PORT_WITH_DID, 1539 FSF_QTCB_OPEN_PORT_WITH_DID,
1540 ZFCP_REQ_AUTO_CLEANUP, 1540 ZFCP_REQ_AUTO_CLEANUP,
1541 adapter->pool.fsf_req_erp); 1541 adapter->pool.fsf_req_erp);
1542 if (unlikely(IS_ERR(req))) { 1542 if (IS_ERR(req)) {
1543 retval = PTR_ERR(req); 1543 retval = PTR_ERR(req);
1544 goto out; 1544 goto out;
1545 } 1545 }
@@ -1562,7 +1562,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
1562 erp_action->fsf_req = NULL; 1562 erp_action->fsf_req = NULL;
1563 } 1563 }
1564out: 1564out:
1565 spin_unlock(&adapter->req_q.lock); 1565 spin_unlock_bh(&adapter->req_q.lock);
1566 return retval; 1566 return retval;
1567} 1567}
1568 1568
@@ -1603,14 +1603,14 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
1603 struct zfcp_fsf_req *req; 1603 struct zfcp_fsf_req *req;
1604 int retval = -EIO; 1604 int retval = -EIO;
1605 1605
1606 spin_lock(&adapter->req_q.lock); 1606 spin_lock_bh(&adapter->req_q.lock);
1607 if (zfcp_fsf_req_sbal_get(adapter)) 1607 if (zfcp_fsf_req_sbal_get(adapter))
1608 goto out; 1608 goto out;
1609 1609
1610 req = zfcp_fsf_req_create(adapter, FSF_QTCB_CLOSE_PORT, 1610 req = zfcp_fsf_req_create(adapter, FSF_QTCB_CLOSE_PORT,
1611 ZFCP_REQ_AUTO_CLEANUP, 1611 ZFCP_REQ_AUTO_CLEANUP,
1612 adapter->pool.fsf_req_erp); 1612 adapter->pool.fsf_req_erp);
1613 if (unlikely(IS_ERR(req))) { 1613 if (IS_ERR(req)) {
1614 retval = PTR_ERR(req); 1614 retval = PTR_ERR(req);
1615 goto out; 1615 goto out;
1616 } 1616 }
@@ -1633,7 +1633,7 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
1633 erp_action->fsf_req = NULL; 1633 erp_action->fsf_req = NULL;
1634 } 1634 }
1635out: 1635out:
1636 spin_unlock(&adapter->req_q.lock); 1636 spin_unlock_bh(&adapter->req_q.lock);
1637 return retval; 1637 return retval;
1638} 1638}
1639 1639
@@ -1700,14 +1700,14 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
1700 struct zfcp_fsf_req *req; 1700 struct zfcp_fsf_req *req;
1701 int retval = -EIO; 1701 int retval = -EIO;
1702 1702
1703 spin_lock(&adapter->req_q.lock); 1703 spin_lock_bh(&adapter->req_q.lock);
1704 if (zfcp_fsf_req_sbal_get(adapter)) 1704 if (zfcp_fsf_req_sbal_get(adapter))
1705 goto out; 1705 goto out;
1706 1706
1707 req = zfcp_fsf_req_create(adapter, FSF_QTCB_CLOSE_PHYSICAL_PORT, 1707 req = zfcp_fsf_req_create(adapter, FSF_QTCB_CLOSE_PHYSICAL_PORT,
1708 ZFCP_REQ_AUTO_CLEANUP, 1708 ZFCP_REQ_AUTO_CLEANUP,
1709 adapter->pool.fsf_req_erp); 1709 adapter->pool.fsf_req_erp);
1710 if (unlikely(IS_ERR(req))) { 1710 if (IS_ERR(req)) {
1711 retval = PTR_ERR(req); 1711 retval = PTR_ERR(req);
1712 goto out; 1712 goto out;
1713 } 1713 }
@@ -1731,7 +1731,7 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
1731 erp_action->fsf_req = NULL; 1731 erp_action->fsf_req = NULL;
1732 } 1732 }
1733out: 1733out:
1734 spin_unlock(&adapter->req_q.lock); 1734 spin_unlock_bh(&adapter->req_q.lock);
1735 return retval; 1735 return retval;
1736} 1736}
1737 1737
@@ -1875,14 +1875,14 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
1875 struct zfcp_fsf_req *req; 1875 struct zfcp_fsf_req *req;
1876 int retval = -EIO; 1876 int retval = -EIO;
1877 1877
1878 spin_lock(&adapter->req_q.lock); 1878 spin_lock_bh(&adapter->req_q.lock);
1879 if (zfcp_fsf_req_sbal_get(adapter)) 1879 if (zfcp_fsf_req_sbal_get(adapter))
1880 goto out; 1880 goto out;
1881 1881
1882 req = zfcp_fsf_req_create(adapter, FSF_QTCB_OPEN_LUN, 1882 req = zfcp_fsf_req_create(adapter, FSF_QTCB_OPEN_LUN,
1883 ZFCP_REQ_AUTO_CLEANUP, 1883 ZFCP_REQ_AUTO_CLEANUP,
1884 adapter->pool.fsf_req_erp); 1884 adapter->pool.fsf_req_erp);
1885 if (unlikely(IS_ERR(req))) { 1885 if (IS_ERR(req)) {
1886 retval = PTR_ERR(req); 1886 retval = PTR_ERR(req);
1887 goto out; 1887 goto out;
1888 } 1888 }
@@ -1910,7 +1910,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
1910 erp_action->fsf_req = NULL; 1910 erp_action->fsf_req = NULL;
1911 } 1911 }
1912out: 1912out:
1913 spin_unlock(&adapter->req_q.lock); 1913 spin_unlock_bh(&adapter->req_q.lock);
1914 return retval; 1914 return retval;
1915} 1915}
1916 1916
@@ -1965,13 +1965,13 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action)
1965 struct zfcp_fsf_req *req; 1965 struct zfcp_fsf_req *req;
1966 int retval = -EIO; 1966 int retval = -EIO;
1967 1967
1968 spin_lock(&adapter->req_q.lock); 1968 spin_lock_bh(&adapter->req_q.lock);
1969 if (zfcp_fsf_req_sbal_get(adapter)) 1969 if (zfcp_fsf_req_sbal_get(adapter))
1970 goto out; 1970 goto out;
1971 req = zfcp_fsf_req_create(adapter, FSF_QTCB_CLOSE_LUN, 1971 req = zfcp_fsf_req_create(adapter, FSF_QTCB_CLOSE_LUN,
1972 ZFCP_REQ_AUTO_CLEANUP, 1972 ZFCP_REQ_AUTO_CLEANUP,
1973 adapter->pool.fsf_req_erp); 1973 adapter->pool.fsf_req_erp);
1974 if (unlikely(IS_ERR(req))) { 1974 if (IS_ERR(req)) {
1975 retval = PTR_ERR(req); 1975 retval = PTR_ERR(req);
1976 goto out; 1976 goto out;
1977 } 1977 }
@@ -1995,7 +1995,7 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action)
1995 erp_action->fsf_req = NULL; 1995 erp_action->fsf_req = NULL;
1996 } 1996 }
1997out: 1997out:
1998 spin_unlock(&adapter->req_q.lock); 1998 spin_unlock_bh(&adapter->req_q.lock);
1999 return retval; 1999 return retval;
2000} 2000}
2001 2001
@@ -2228,7 +2228,7 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *adapter,
2228 goto out; 2228 goto out;
2229 req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags, 2229 req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags,
2230 adapter->pool.fsf_req_scsi); 2230 adapter->pool.fsf_req_scsi);
2231 if (unlikely(IS_ERR(req))) { 2231 if (IS_ERR(req)) {
2232 retval = PTR_ERR(req); 2232 retval = PTR_ERR(req);
2233 goto out; 2233 goto out;
2234 } 2234 }
@@ -2351,7 +2351,7 @@ struct zfcp_fsf_req *zfcp_fsf_send_fcp_ctm(struct zfcp_adapter *adapter,
2351 goto out; 2351 goto out;
2352 req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags, 2352 req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags,
2353 adapter->pool.fsf_req_scsi); 2353 adapter->pool.fsf_req_scsi);
2354 if (unlikely(IS_ERR(req))) 2354 if (IS_ERR(req))
2355 goto out; 2355 goto out;
2356 2356
2357 req->status |= ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT; 2357 req->status |= ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT;
@@ -2417,12 +2417,12 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter,
2417 return ERR_PTR(-EINVAL); 2417 return ERR_PTR(-EINVAL);
2418 } 2418 }
2419 2419
2420 spin_lock(&adapter->req_q.lock); 2420 spin_lock_bh(&adapter->req_q.lock);
2421 if (zfcp_fsf_req_sbal_get(adapter)) 2421 if (zfcp_fsf_req_sbal_get(adapter))
2422 goto out; 2422 goto out;
2423 2423
2424 req = zfcp_fsf_req_create(adapter, fsf_cfdc->command, 0, NULL); 2424 req = zfcp_fsf_req_create(adapter, fsf_cfdc->command, 0, NULL);
2425 if (unlikely(IS_ERR(req))) { 2425 if (IS_ERR(req)) {
2426 retval = -EPERM; 2426 retval = -EPERM;
2427 goto out; 2427 goto out;
2428 } 2428 }
@@ -2447,7 +2447,7 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter,
2447 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); 2447 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
2448 retval = zfcp_fsf_req_send(req); 2448 retval = zfcp_fsf_req_send(req);
2449out: 2449out:
2450 spin_unlock(&adapter->req_q.lock); 2450 spin_unlock_bh(&adapter->req_q.lock);
2451 2451
2452 if (!retval) { 2452 if (!retval) {
2453 wait_event(req->completion_wq, 2453 wait_event(req->completion_wq,
diff --git a/drivers/s390/scsi/zfcp_qdio.c b/drivers/s390/scsi/zfcp_qdio.c
index d6dbd653fde9..69d632d851d9 100644
--- a/drivers/s390/scsi/zfcp_qdio.c
+++ b/drivers/s390/scsi/zfcp_qdio.c
@@ -423,9 +423,9 @@ void zfcp_qdio_close(struct zfcp_adapter *adapter)
423 423
424 /* clear QDIOUP flag, thus do_QDIO is not called during qdio_shutdown */ 424 /* clear QDIOUP flag, thus do_QDIO is not called during qdio_shutdown */
425 req_q = &adapter->req_q; 425 req_q = &adapter->req_q;
426 spin_lock(&req_q->lock); 426 spin_lock_bh(&req_q->lock);
427 atomic_clear_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status); 427 atomic_clear_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status);
428 spin_unlock(&req_q->lock); 428 spin_unlock_bh(&req_q->lock);
429 429
430 qdio_shutdown(adapter->ccw_device, QDIO_FLAG_CLEANUP_USING_CLEAR); 430 qdio_shutdown(adapter->ccw_device, QDIO_FLAG_CLEANUP_USING_CLEAR);
431 431
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index c7f06298bd3c..4e0322b1c1ea 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -63,7 +63,7 @@ comment "SCSI support type (disk, tape, CD-ROM)"
63config BLK_DEV_SD 63config BLK_DEV_SD
64 tristate "SCSI disk support" 64 tristate "SCSI disk support"
65 depends on SCSI 65 depends on SCSI
66 select CRC_T10DIF 66 select CRC_T10DIF if BLK_DEV_INTEGRITY
67 ---help--- 67 ---help---
68 If you want to use SCSI hard disks, Fibre Channel disks, 68 If you want to use SCSI hard disks, Fibre Channel disks,
69 Serial ATA (SATA) or Parallel ATA (PATA) hard disks, 69 Serial ATA (SATA) or Parallel ATA (PATA) hard disks,
diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
index 994da56fffed..708e475896b9 100644
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -425,7 +425,7 @@ static int alua_check_sense(struct scsi_device *sdev,
425 /* 425 /*
426 * LUN Not Accessible - ALUA state transition 426 * LUN Not Accessible - ALUA state transition
427 */ 427 */
428 return NEEDS_RETRY; 428 return ADD_TO_MLQUEUE;
429 if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0b) 429 if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0b)
430 /* 430 /*
431 * LUN Not Accessible -- Target port in standby state 431 * LUN Not Accessible -- Target port in standby state
@@ -447,18 +447,18 @@ static int alua_check_sense(struct scsi_device *sdev,
447 /* 447 /*
448 * Power On, Reset, or Bus Device Reset, just retry. 448 * Power On, Reset, or Bus Device Reset, just retry.
449 */ 449 */
450 return NEEDS_RETRY; 450 return ADD_TO_MLQUEUE;
451 if (sense_hdr->asc == 0x2a && sense_hdr->ascq == 0x06) { 451 if (sense_hdr->asc == 0x2a && sense_hdr->ascq == 0x06) {
452 /* 452 /*
453 * ALUA state changed 453 * ALUA state changed
454 */ 454 */
455 return NEEDS_RETRY; 455 return ADD_TO_MLQUEUE;
456 } 456 }
457 if (sense_hdr->asc == 0x2a && sense_hdr->ascq == 0x07) { 457 if (sense_hdr->asc == 0x2a && sense_hdr->ascq == 0x07) {
458 /* 458 /*
459 * Implicit ALUA state transition failed 459 * Implicit ALUA state transition failed
460 */ 460 */
461 return NEEDS_RETRY; 461 return ADD_TO_MLQUEUE;
462 } 462 }
463 break; 463 break;
464 } 464 }
@@ -490,7 +490,7 @@ static int alua_stpg(struct scsi_device *sdev, int state,
490 if (!err) 490 if (!err)
491 return SCSI_DH_IO; 491 return SCSI_DH_IO;
492 err = alua_check_sense(sdev, &sense_hdr); 492 err = alua_check_sense(sdev, &sense_hdr);
493 if (retry > 0 && err == NEEDS_RETRY) { 493 if (retry > 0 && err == ADD_TO_MLQUEUE) {
494 retry--; 494 retry--;
495 goto retry; 495 goto retry;
496 } 496 }
@@ -535,7 +535,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_dh_data *h)
535 return SCSI_DH_IO; 535 return SCSI_DH_IO;
536 536
537 err = alua_check_sense(sdev, &sense_hdr); 537 err = alua_check_sense(sdev, &sense_hdr);
538 if (err == NEEDS_RETRY) 538 if (err == ADD_TO_MLQUEUE)
539 goto retry; 539 goto retry;
540 sdev_printk(KERN_INFO, sdev, 540 sdev_printk(KERN_INFO, sdev,
541 "%s: rtpg sense code %02x/%02x/%02x\n", 541 "%s: rtpg sense code %02x/%02x/%02x\n",
diff --git a/drivers/scsi/device_handler/scsi_dh_emc.c b/drivers/scsi/device_handler/scsi_dh_emc.c
index b9d23e9e9a44..ef693e8412e9 100644
--- a/drivers/scsi/device_handler/scsi_dh_emc.c
+++ b/drivers/scsi/device_handler/scsi_dh_emc.c
@@ -439,7 +439,7 @@ static int clariion_check_sense(struct scsi_device *sdev,
439 * Unit Attention Code. This is the first IO 439 * Unit Attention Code. This is the first IO
440 * to the new path, so just retry. 440 * to the new path, so just retry.
441 */ 441 */
442 return NEEDS_RETRY; 442 return ADD_TO_MLQUEUE;
443 break; 443 break;
444 } 444 }
445 445
@@ -514,7 +514,7 @@ retry:
514 return SCSI_DH_IO; 514 return SCSI_DH_IO;
515 515
516 err = clariion_check_sense(sdev, &sshdr); 516 err = clariion_check_sense(sdev, &sshdr);
517 if (retry > 0 && err == NEEDS_RETRY) { 517 if (retry > 0 && err == ADD_TO_MLQUEUE) {
518 retry--; 518 retry--;
519 goto retry; 519 goto retry;
520 } 520 }
diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c
index 2dee69da35cf..6e2f130d56de 100644
--- a/drivers/scsi/device_handler/scsi_dh_rdac.c
+++ b/drivers/scsi/device_handler/scsi_dh_rdac.c
@@ -551,7 +551,7 @@ static int rdac_check_sense(struct scsi_device *sdev,
551 * 551 *
552 * Just retry and wait. 552 * Just retry and wait.
553 */ 553 */
554 return NEEDS_RETRY; 554 return ADD_TO_MLQUEUE;
555 break; 555 break;
556 case ILLEGAL_REQUEST: 556 case ILLEGAL_REQUEST:
557 if (sense_hdr->asc == 0x94 && sense_hdr->ascq == 0x01) { 557 if (sense_hdr->asc == 0x94 && sense_hdr->ascq == 0x01) {
@@ -568,7 +568,7 @@ static int rdac_check_sense(struct scsi_device *sdev,
568 /* 568 /*
569 * Power On, Reset, or Bus Device Reset, just retry. 569 * Power On, Reset, or Bus Device Reset, just retry.
570 */ 570 */
571 return NEEDS_RETRY; 571 return ADD_TO_MLQUEUE;
572 break; 572 break;
573 } 573 }
574 /* success just means we do not care what scsi-ml does */ 574 /* success just means we do not care what scsi-ml does */
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 48ee8c7f5bdd..e1872989710a 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -294,10 +294,10 @@ static void sas_ata_post_internal(struct ata_queued_cmd *qc)
294 } 294 }
295} 295}
296 296
297static int sas_ata_scr_write(struct ata_port *ap, unsigned int sc_reg_in, 297static int sas_ata_scr_write(struct ata_link *link, unsigned int sc_reg_in,
298 u32 val) 298 u32 val)
299{ 299{
300 struct domain_device *dev = ap->private_data; 300 struct domain_device *dev = link->ap->private_data;
301 301
302 SAS_DPRINTK("STUB %s\n", __func__); 302 SAS_DPRINTK("STUB %s\n", __func__);
303 switch (sc_reg_in) { 303 switch (sc_reg_in) {
@@ -319,10 +319,10 @@ static int sas_ata_scr_write(struct ata_port *ap, unsigned int sc_reg_in,
319 return 0; 319 return 0;
320} 320}
321 321
322static int sas_ata_scr_read(struct ata_port *ap, unsigned int sc_reg_in, 322static int sas_ata_scr_read(struct ata_link *link, unsigned int sc_reg_in,
323 u32 *val) 323 u32 *val)
324{ 324{
325 struct domain_device *dev = ap->private_data; 325 struct domain_device *dev = link->ap->private_data;
326 326
327 SAS_DPRINTK("STUB %s\n", __func__); 327 SAS_DPRINTK("STUB %s\n", __func__);
328 switch (sc_reg_in) { 328 switch (sc_reg_in) {
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 45a3b93eed57..bf41887cdd65 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -1834,7 +1834,6 @@ clear_risc_ints:
1834 WRT_REG_WORD(&reg->isp.hccr, HCCR_CLR_HOST_INT); 1834 WRT_REG_WORD(&reg->isp.hccr, HCCR_CLR_HOST_INT);
1835 } 1835 }
1836 spin_unlock_irq(&ha->hardware_lock); 1836 spin_unlock_irq(&ha->hardware_lock);
1837 ha->isp_ops->enable_intrs(ha);
1838 1837
1839fail: 1838fail:
1840 return ret; 1839 return ret;
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 26afe44265c7..6d0f0e5f2827 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1740,6 +1740,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1740 if (ret) 1740 if (ret)
1741 goto probe_failed; 1741 goto probe_failed;
1742 1742
1743 ha->isp_ops->enable_intrs(ha);
1744
1743 scsi_scan_host(host); 1745 scsi_scan_host(host);
1744 1746
1745 qla2x00_alloc_sysfs_attr(ha); 1747 qla2x00_alloc_sysfs_attr(ha);
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index 4a1cf6377f6c..905350896725 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -914,6 +914,7 @@ static inline int load_cmd(struct scsi_cmnd *Cmnd, struct Command_Entry *cmd,
914 ds[i].d_count = sg_dma_len(s); 914 ds[i].d_count = sg_dma_len(s);
915 } 915 }
916 sg_count -= n; 916 sg_count -= n;
917 sg = s;
917 } 918 }
918 } else { 919 } else {
919 cmd->dataseg[0].d_base = 0; 920 cmd->dataseg[0].d_base = 0;
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 880051c89bde..39ce3aba1dac 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -391,7 +391,7 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
391 391
392 case HARDWARE_ERROR: 392 case HARDWARE_ERROR:
393 if (scmd->device->retry_hwerror) 393 if (scmd->device->retry_hwerror)
394 return NEEDS_RETRY; 394 return ADD_TO_MLQUEUE;
395 else 395 else
396 return SUCCESS; 396 return SUCCESS;
397 397
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index ff5d56b3ee4d..62307bd794a9 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -852,7 +852,7 @@ static void scsi_end_bidi_request(struct scsi_cmnd *cmd)
852void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) 852void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
853{ 853{
854 int result = cmd->result; 854 int result = cmd->result;
855 int this_count = scsi_bufflen(cmd); 855 int this_count;
856 struct request_queue *q = cmd->device->request_queue; 856 struct request_queue *q = cmd->device->request_queue;
857 struct request *req = cmd->request; 857 struct request *req = cmd->request;
858 int error = 0; 858 int error = 0;
@@ -908,6 +908,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
908 */ 908 */
909 if (scsi_end_request(cmd, error, good_bytes, result == 0) == NULL) 909 if (scsi_end_request(cmd, error, good_bytes, result == 0) == NULL)
910 return; 910 return;
911 this_count = blk_rq_bytes(req);
911 912
912 /* good_bytes = 0, or (inclusive) there were leftovers and 913 /* good_bytes = 0, or (inclusive) there were leftovers and
913 * result = 0, so scsi_end_request couldn't retry. 914 * result = 0, so scsi_end_request couldn't retry.
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 84b4879cff11..34d0de6cd511 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1080,7 +1080,8 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
1080 * PDT=1Fh none (no FDD connected to the requested logical unit) 1080 * PDT=1Fh none (no FDD connected to the requested logical unit)
1081 */ 1081 */
1082 if (((result[0] >> 5) == 1 || starget->pdt_1f_for_no_lun) && 1082 if (((result[0] >> 5) == 1 || starget->pdt_1f_for_no_lun) &&
1083 (result[0] & 0x1f) == 0x1f) { 1083 (result[0] & 0x1f) == 0x1f &&
1084 !scsi_is_wlun(lun)) {
1084 SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO 1085 SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO
1085 "scsi scan: peripheral device type" 1086 "scsi scan: peripheral device type"
1086 " of 31, no device added\n")); 1087 " of 31, no device added\n"));
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 2a2bc89aba83..e5e7d7856454 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1875,7 +1875,6 @@ static int sd_probe(struct device *dev)
1875 1875
1876 dev_set_drvdata(dev, sdkp); 1876 dev_set_drvdata(dev, sdkp);
1877 add_disk(gd); 1877 add_disk(gd);
1878 blk_register_filter(gd);
1879 sd_dif_config_host(sdkp); 1878 sd_dif_config_host(sdkp);
1880 1879
1881 sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n", 1880 sd_printk(KERN_NOTICE, sdkp, "Attached SCSI %sdisk\n",
@@ -1909,7 +1908,6 @@ static int sd_remove(struct device *dev)
1909 struct scsi_disk *sdkp = dev_get_drvdata(dev); 1908 struct scsi_disk *sdkp = dev_get_drvdata(dev);
1910 1909
1911 device_del(&sdkp->dev); 1910 device_del(&sdkp->dev);
1912 blk_unregister_filter(sdkp->disk);
1913 del_gendisk(sdkp->disk); 1911 del_gendisk(sdkp->disk);
1914 sd_shutdown(dev); 1912 sd_shutdown(dev);
1915 1913
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 3292965bfd84..27f5bfd1def3 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -656,7 +656,6 @@ static int sr_probe(struct device *dev)
656 dev_set_drvdata(dev, cd); 656 dev_set_drvdata(dev, cd);
657 disk->flags |= GENHD_FL_REMOVABLE; 657 disk->flags |= GENHD_FL_REMOVABLE;
658 add_disk(disk); 658 add_disk(disk);
659 blk_register_filter(disk);
660 659
661 sdev_printk(KERN_DEBUG, sdev, 660 sdev_printk(KERN_DEBUG, sdev,
662 "Attached scsi CD-ROM %s\n", cd->cdi.name); 661 "Attached scsi CD-ROM %s\n", cd->cdi.name);
@@ -895,7 +894,6 @@ static int sr_remove(struct device *dev)
895{ 894{
896 struct scsi_cd *cd = dev_get_drvdata(dev); 895 struct scsi_cd *cd = dev_get_drvdata(dev);
897 896
898 blk_unregister_filter(cd->disk);
899 del_gendisk(cd->disk); 897 del_gendisk(cd->disk);
900 898
901 mutex_lock(&sr_ref_mutex); 899 mutex_lock(&sr_ref_mutex);
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 3a6da80b081c..61fb8b6d19af 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -131,7 +131,8 @@ struct atmel_uart_char {
131struct atmel_uart_port { 131struct atmel_uart_port {
132 struct uart_port uart; /* uart */ 132 struct uart_port uart; /* uart */
133 struct clk *clk; /* uart clock */ 133 struct clk *clk; /* uart clock */
134 unsigned short suspended; /* is port suspended? */ 134 int may_wakeup; /* cached value of device_may_wakeup for times we need to disable it */
135 u32 backup_imr; /* IMR saved during suspend */
135 int break_active; /* break being received */ 136 int break_active; /* break being received */
136 137
137 short use_dma_rx; /* enable PDC receiver */ 138 short use_dma_rx; /* enable PDC receiver */
@@ -984,8 +985,15 @@ static void atmel_serial_pm(struct uart_port *port, unsigned int state,
984 * This is called on uart_open() or a resume event. 985 * This is called on uart_open() or a resume event.
985 */ 986 */
986 clk_enable(atmel_port->clk); 987 clk_enable(atmel_port->clk);
988
989 /* re-enable interrupts if we disabled some on suspend */
990 UART_PUT_IER(port, atmel_port->backup_imr);
987 break; 991 break;
988 case 3: 992 case 3:
993 /* Back up the interrupt mask and disable all interrupts */
994 atmel_port->backup_imr = UART_GET_IMR(port);
995 UART_PUT_IDR(port, -1);
996
989 /* 997 /*
990 * Disable the peripheral clock for this serial port. 998 * Disable the peripheral clock for this serial port.
991 * This is called on uart_close() or a suspend event. 999 * This is called on uart_close() or a suspend event.
@@ -1475,13 +1483,12 @@ static int atmel_serial_suspend(struct platform_device *pdev,
1475 cpu_relax(); 1483 cpu_relax();
1476 } 1484 }
1477 1485
1478 if (device_may_wakeup(&pdev->dev) 1486 /* we can not wake up if we're running on slow clock */
1479 && !atmel_serial_clk_will_stop()) 1487 atmel_port->may_wakeup = device_may_wakeup(&pdev->dev);
1480 enable_irq_wake(port->irq); 1488 if (atmel_serial_clk_will_stop())
1481 else { 1489 device_set_wakeup_enable(&pdev->dev, 0);
1482 uart_suspend_port(&atmel_uart, port); 1490
1483 atmel_port->suspended = 1; 1491 uart_suspend_port(&atmel_uart, port);
1484 }
1485 1492
1486 return 0; 1493 return 0;
1487} 1494}
@@ -1491,11 +1498,8 @@ static int atmel_serial_resume(struct platform_device *pdev)
1491 struct uart_port *port = platform_get_drvdata(pdev); 1498 struct uart_port *port = platform_get_drvdata(pdev);
1492 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); 1499 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
1493 1500
1494 if (atmel_port->suspended) { 1501 uart_resume_port(&atmel_uart, port);
1495 uart_resume_port(&atmel_uart, port); 1502 device_set_wakeup_enable(&pdev->dev, atmel_port->may_wakeup);
1496 atmel_port->suspended = 0;
1497 } else
1498 disable_irq_wake(port->irq);
1499 1503
1500 return 0; 1504 return 0;
1501} 1505}
@@ -1513,6 +1517,8 @@ static int __devinit atmel_serial_probe(struct platform_device *pdev)
1513 BUILD_BUG_ON(!is_power_of_2(ATMEL_SERIAL_RINGSIZE)); 1517 BUILD_BUG_ON(!is_power_of_2(ATMEL_SERIAL_RINGSIZE));
1514 1518
1515 port = &atmel_ports[pdev->id]; 1519 port = &atmel_ports[pdev->id];
1520 port->backup_imr = 0;
1521
1516 atmel_init_port(port, pdev); 1522 atmel_init_port(port, pdev);
1517 1523
1518 if (!atmel_use_dma_rx(&port->uart)) { 1524 if (!atmel_use_dma_rx(&port->uart)) {
diff --git a/drivers/serial/imx.c b/drivers/serial/imx.c
index 6a29f9330a73..3f90f1bbbbcd 100644
--- a/drivers/serial/imx.c
+++ b/drivers/serial/imx.c
@@ -127,8 +127,13 @@
127#define UCR3_RXDSEN (1<<6) /* Receive status interrupt enable */ 127#define UCR3_RXDSEN (1<<6) /* Receive status interrupt enable */
128#define UCR3_AIRINTEN (1<<5) /* Async IR wake interrupt enable */ 128#define UCR3_AIRINTEN (1<<5) /* Async IR wake interrupt enable */
129#define UCR3_AWAKEN (1<<4) /* Async wake interrupt enable */ 129#define UCR3_AWAKEN (1<<4) /* Async wake interrupt enable */
130#define UCR3_REF25 (1<<3) /* Ref freq 25 MHz */ 130#ifdef CONFIG_ARCH_IMX
131#define UCR3_REF30 (1<<2) /* Ref Freq 30 MHz */ 131#define UCR3_REF25 (1<<3) /* Ref freq 25 MHz, only on mx1 */
132#define UCR3_REF30 (1<<2) /* Ref Freq 30 MHz, only on mx1 */
133#endif
134#if defined CONFIG_ARCH_MX2 || defined CONFIG_ARCH_MX3
135#define UCR3_RXDMUXSEL (1<<2) /* RXD Muxed Input Select, on mx2/mx3 */
136#endif
132#define UCR3_INVT (1<<1) /* Inverted Infrared transmission */ 137#define UCR3_INVT (1<<1) /* Inverted Infrared transmission */
133#define UCR3_BPEN (1<<0) /* Preset registers enable */ 138#define UCR3_BPEN (1<<0) /* Preset registers enable */
134#define UCR4_CTSTL_32 (32<<10) /* CTS trigger level (32 chars) */ 139#define UCR4_CTSTL_32 (32<<10) /* CTS trigger level (32 chars) */
@@ -445,7 +450,7 @@ static irqreturn_t imx_int(int irq, void *dev_id)
445 readl(sport->port.membase + UCR1) & UCR1_TXMPTYEN) 450 readl(sport->port.membase + UCR1) & UCR1_TXMPTYEN)
446 imx_txint(irq, dev_id); 451 imx_txint(irq, dev_id);
447 452
448 if (sts & USR1_RTSS) 453 if (sts & USR1_RTSD)
449 imx_rtsint(irq, dev_id); 454 imx_rtsint(irq, dev_id);
450 455
451 return IRQ_HANDLED; 456 return IRQ_HANDLED;
@@ -598,6 +603,12 @@ static int imx_startup(struct uart_port *port)
598 temp |= (UCR2_RXEN | UCR2_TXEN); 603 temp |= (UCR2_RXEN | UCR2_TXEN);
599 writel(temp, sport->port.membase + UCR2); 604 writel(temp, sport->port.membase + UCR2);
600 605
606#if defined CONFIG_ARCH_MX2 || defined CONFIG_ARCH_MX3
607 temp = readl(sport->port.membase + UCR3);
608 temp |= UCR3_RXDMUXSEL;
609 writel(temp, sport->port.membase + UCR3);
610#endif
611
601 /* 612 /*
602 * Enable modem status interrupts 613 * Enable modem status interrupts
603 */ 614 */
@@ -1133,13 +1144,19 @@ static int serial_imx_probe(struct platform_device *pdev)
1133 if(pdata && (pdata->flags & IMXUART_HAVE_RTSCTS)) 1144 if(pdata && (pdata->flags & IMXUART_HAVE_RTSCTS))
1134 sport->have_rtscts = 1; 1145 sport->have_rtscts = 1;
1135 1146
1136 if (pdata->init) 1147 if (pdata->init) {
1137 pdata->init(pdev); 1148 ret = pdata->init(pdev);
1149 if (ret)
1150 goto clkput;
1151 }
1138 1152
1139 uart_add_one_port(&imx_reg, &sport->port); 1153 uart_add_one_port(&imx_reg, &sport->port);
1140 platform_set_drvdata(pdev, &sport->port); 1154 platform_set_drvdata(pdev, &sport->port);
1141 1155
1142 return 0; 1156 return 0;
1157clkput:
1158 clk_put(sport->clk);
1159 clk_disable(sport->clk);
1143unmap: 1160unmap:
1144 iounmap(sport->port.membase); 1161 iounmap(sport->port.membase);
1145free: 1162free:
diff --git a/drivers/spi/orion_spi.c b/drivers/spi/orion_spi.c
index c4eaacd6e553..b872bfaf4bd2 100644
--- a/drivers/spi/orion_spi.c
+++ b/drivers/spi/orion_spi.c
@@ -427,7 +427,7 @@ static int orion_spi_transfer(struct spi_device *spi, struct spi_message *m)
427 goto msg_rejected; 427 goto msg_rejected;
428 } 428 }
429 429
430 if (t->speed_hz < orion_spi->min_speed) { 430 if (t->speed_hz && t->speed_hz < orion_spi->min_speed) {
431 dev_err(&spi->dev, 431 dev_err(&spi->dev,
432 "message rejected : " 432 "message rejected : "
433 "device min speed (%d Hz) exceeds " 433 "device min speed (%d Hz) exceeds "
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
index 34c7c9875681..d47d3636227f 100644
--- a/drivers/spi/pxa2xx_spi.c
+++ b/drivers/spi/pxa2xx_spi.c
@@ -47,9 +47,10 @@ MODULE_ALIAS("platform:pxa2xx-spi");
47 47
48#define MAX_BUSES 3 48#define MAX_BUSES 3
49 49
50#define DMA_INT_MASK (DCSR_ENDINTR | DCSR_STARTINTR | DCSR_BUSERR) 50#define DMA_INT_MASK (DCSR_ENDINTR | DCSR_STARTINTR | DCSR_BUSERR)
51#define RESET_DMA_CHANNEL (DCSR_NODESC | DMA_INT_MASK) 51#define RESET_DMA_CHANNEL (DCSR_NODESC | DMA_INT_MASK)
52#define IS_DMA_ALIGNED(x) (((u32)(x)&0x07)==0) 52#define IS_DMA_ALIGNED(x) ((((u32)(x)) & 0x07) == 0)
53#define MAX_DMA_LEN 8191
53 54
54/* 55/*
55 * for testing SSCR1 changes that require SSP restart, basically 56 * for testing SSCR1 changes that require SSP restart, basically
@@ -144,7 +145,6 @@ struct driver_data {
144 size_t tx_map_len; 145 size_t tx_map_len;
145 u8 n_bytes; 146 u8 n_bytes;
146 u32 dma_width; 147 u32 dma_width;
147 int cs_change;
148 int (*write)(struct driver_data *drv_data); 148 int (*write)(struct driver_data *drv_data);
149 int (*read)(struct driver_data *drv_data); 149 int (*read)(struct driver_data *drv_data);
150 irqreturn_t (*transfer_handler)(struct driver_data *drv_data); 150 irqreturn_t (*transfer_handler)(struct driver_data *drv_data);
@@ -406,8 +406,45 @@ static void giveback(struct driver_data *drv_data)
406 struct spi_transfer, 406 struct spi_transfer,
407 transfer_list); 407 transfer_list);
408 408
409 /* Delay if requested before any change in chip select */
410 if (last_transfer->delay_usecs)
411 udelay(last_transfer->delay_usecs);
412
413 /* Drop chip select UNLESS cs_change is true or we are returning
414 * a message with an error, or next message is for another chip
415 */
409 if (!last_transfer->cs_change) 416 if (!last_transfer->cs_change)
410 drv_data->cs_control(PXA2XX_CS_DEASSERT); 417 drv_data->cs_control(PXA2XX_CS_DEASSERT);
418 else {
419 struct spi_message *next_msg;
420
421 /* Holding of cs was hinted, but we need to make sure
422 * the next message is for the same chip. Don't waste
423 * time with the following tests unless this was hinted.
424 *
425 * We cannot postpone this until pump_messages, because
426 * after calling msg->complete (below) the driver that
427 * sent the current message could be unloaded, which
428 * could invalidate the cs_control() callback...
429 */
430
431 /* get a pointer to the next message, if any */
432 spin_lock_irqsave(&drv_data->lock, flags);
433 if (list_empty(&drv_data->queue))
434 next_msg = NULL;
435 else
436 next_msg = list_entry(drv_data->queue.next,
437 struct spi_message, queue);
438 spin_unlock_irqrestore(&drv_data->lock, flags);
439
440 /* see if the next and current messages point
441 * to the same chip
442 */
443 if (next_msg && next_msg->spi != msg->spi)
444 next_msg = NULL;
445 if (!next_msg || msg->state == ERROR_STATE)
446 drv_data->cs_control(PXA2XX_CS_DEASSERT);
447 }
411 448
412 msg->state = NULL; 449 msg->state = NULL;
413 if (msg->complete) 450 if (msg->complete)
@@ -490,10 +527,9 @@ static void dma_transfer_complete(struct driver_data *drv_data)
490 msg->actual_length += drv_data->len - 527 msg->actual_length += drv_data->len -
491 (drv_data->rx_end - drv_data->rx); 528 (drv_data->rx_end - drv_data->rx);
492 529
493 /* Release chip select if requested, transfer delays are 530 /* Transfer delays and chip select release are
494 * handled in pump_transfers */ 531 * handled in pump_transfers or giveback
495 if (drv_data->cs_change) 532 */
496 drv_data->cs_control(PXA2XX_CS_DEASSERT);
497 533
498 /* Move to next transfer */ 534 /* Move to next transfer */
499 msg->state = next_transfer(drv_data); 535 msg->state = next_transfer(drv_data);
@@ -602,10 +638,9 @@ static void int_transfer_complete(struct driver_data *drv_data)
602 drv_data->cur_msg->actual_length += drv_data->len - 638 drv_data->cur_msg->actual_length += drv_data->len -
603 (drv_data->rx_end - drv_data->rx); 639 (drv_data->rx_end - drv_data->rx);
604 640
605 /* Release chip select if requested, transfer delays are 641 /* Transfer delays and chip select release are
606 * handled in pump_transfers */ 642 * handled in pump_transfers or giveback
607 if (drv_data->cs_change) 643 */
608 drv_data->cs_control(PXA2XX_CS_DEASSERT);
609 644
610 /* Move to next transfer */ 645 /* Move to next transfer */
611 drv_data->cur_msg->state = next_transfer(drv_data); 646 drv_data->cur_msg->state = next_transfer(drv_data);
@@ -840,23 +875,40 @@ static void pump_transfers(unsigned long data)
840 return; 875 return;
841 } 876 }
842 877
843 /* Delay if requested at end of transfer*/ 878 /* Delay if requested at end of transfer before CS change */
844 if (message->state == RUNNING_STATE) { 879 if (message->state == RUNNING_STATE) {
845 previous = list_entry(transfer->transfer_list.prev, 880 previous = list_entry(transfer->transfer_list.prev,
846 struct spi_transfer, 881 struct spi_transfer,
847 transfer_list); 882 transfer_list);
848 if (previous->delay_usecs) 883 if (previous->delay_usecs)
849 udelay(previous->delay_usecs); 884 udelay(previous->delay_usecs);
885
886 /* Drop chip select only if cs_change is requested */
887 if (previous->cs_change)
888 drv_data->cs_control(PXA2XX_CS_DEASSERT);
850 } 889 }
851 890
852 /* Check transfer length */ 891 /* Check for transfers that need multiple DMA segments */
853 if (transfer->len > 8191) 892 if (transfer->len > MAX_DMA_LEN && chip->enable_dma) {
854 { 893
855 dev_warn(&drv_data->pdev->dev, "pump_transfers: transfer " 894 /* reject already-mapped transfers; PIO won't always work */
856 "length greater than 8191\n"); 895 if (message->is_dma_mapped
857 message->status = -EINVAL; 896 || transfer->rx_dma || transfer->tx_dma) {
858 giveback(drv_data); 897 dev_err(&drv_data->pdev->dev,
859 return; 898 "pump_transfers: mapped transfer length "
899 "of %u is greater than %d\n",
900 transfer->len, MAX_DMA_LEN);
901 message->status = -EINVAL;
902 giveback(drv_data);
903 return;
904 }
905
906 /* warn ... we force this to PIO mode */
907 if (printk_ratelimit())
908 dev_warn(&message->spi->dev, "pump_transfers: "
909 "DMA disabled for transfer length %ld "
910 "greater than %d\n",
911 (long)drv_data->len, MAX_DMA_LEN);
860 } 912 }
861 913
862 /* Setup the transfer state based on the type of transfer */ 914 /* Setup the transfer state based on the type of transfer */
@@ -878,7 +930,6 @@ static void pump_transfers(unsigned long data)
878 drv_data->len = transfer->len & DCMD_LENGTH; 930 drv_data->len = transfer->len & DCMD_LENGTH;
879 drv_data->write = drv_data->tx ? chip->write : null_writer; 931 drv_data->write = drv_data->tx ? chip->write : null_writer;
880 drv_data->read = drv_data->rx ? chip->read : null_reader; 932 drv_data->read = drv_data->rx ? chip->read : null_reader;
881 drv_data->cs_change = transfer->cs_change;
882 933
883 /* Change speed and bit per word on a per transfer */ 934 /* Change speed and bit per word on a per transfer */
884 cr0 = chip->cr0; 935 cr0 = chip->cr0;
@@ -925,7 +976,7 @@ static void pump_transfers(unsigned long data)
925 &dma_thresh)) 976 &dma_thresh))
926 if (printk_ratelimit()) 977 if (printk_ratelimit())
927 dev_warn(&message->spi->dev, 978 dev_warn(&message->spi->dev,
928 "pump_transfer: " 979 "pump_transfers: "
929 "DMA burst size reduced to " 980 "DMA burst size reduced to "
930 "match bits_per_word\n"); 981 "match bits_per_word\n");
931 } 982 }
@@ -939,8 +990,23 @@ static void pump_transfers(unsigned long data)
939 990
940 message->state = RUNNING_STATE; 991 message->state = RUNNING_STATE;
941 992
942 /* Try to map dma buffer and do a dma transfer if successful */ 993 /* Try to map dma buffer and do a dma transfer if successful, but
943 if ((drv_data->dma_mapped = map_dma_buffers(drv_data))) { 994 * only if the length is non-zero and less than MAX_DMA_LEN.
995 *
996 * Zero-length non-descriptor DMA is illegal on PXA2xx; force use
997 * of PIO instead. Care is needed above because the transfer may
998 * have have been passed with buffers that are already dma mapped.
999 * A zero-length transfer in PIO mode will not try to write/read
1000 * to/from the buffers
1001 *
1002 * REVISIT large transfers are exactly where we most want to be
1003 * using DMA. If this happens much, split those transfers into
1004 * multiple DMA segments rather than forcing PIO.
1005 */
1006 drv_data->dma_mapped = 0;
1007 if (drv_data->len > 0 && drv_data->len <= MAX_DMA_LEN)
1008 drv_data->dma_mapped = map_dma_buffers(drv_data);
1009 if (drv_data->dma_mapped) {
944 1010
945 /* Ensure we have the correct interrupt handler */ 1011 /* Ensure we have the correct interrupt handler */
946 drv_data->transfer_handler = dma_transfer; 1012 drv_data->transfer_handler = dma_transfer;
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index 070c6219e2d6..ac0e3e4b3c54 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -267,16 +267,13 @@ int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
267 cs->hw_mode |= SPMODE_LEN(bits_per_word); 267 cs->hw_mode |= SPMODE_LEN(bits_per_word);
268 268
269 if ((mpc83xx_spi->spibrg / hz) > 64) { 269 if ((mpc83xx_spi->spibrg / hz) > 64) {
270 cs->hw_mode |= SPMODE_DIV16;
270 pm = mpc83xx_spi->spibrg / (hz * 64); 271 pm = mpc83xx_spi->spibrg / (hz * 64);
271 if (pm > 16) { 272 if (pm > 16) {
272 cs->hw_mode |= SPMODE_DIV16; 273 dev_err(&spi->dev, "Requested speed is too "
273 pm /= 16; 274 "low: %d Hz. Will use %d Hz instead.\n",
274 if (pm > 16) { 275 hz, mpc83xx_spi->spibrg / 1024);
275 dev_err(&spi->dev, "Requested speed is too " 276 pm = 16;
276 "low: %d Hz. Will use %d Hz instead.\n",
277 hz, mpc83xx_spi->spibrg / 1024);
278 pm = 16;
279 }
280 } 277 }
281 } else 278 } else
282 pm = mpc83xx_spi->spibrg / (hz * 4); 279 pm = mpc83xx_spi->spibrg / (hz * 4);
@@ -315,11 +312,20 @@ static int mpc83xx_spi_bufs(struct spi_device *spi, struct spi_transfer *t)
315 if (t->bits_per_word) 312 if (t->bits_per_word)
316 bits_per_word = t->bits_per_word; 313 bits_per_word = t->bits_per_word;
317 len = t->len; 314 len = t->len;
318 if (bits_per_word > 8) 315 if (bits_per_word > 8) {
316 /* invalid length? */
317 if (len & 1)
318 return -EINVAL;
319 len /= 2; 319 len /= 2;
320 if (bits_per_word > 16) 320 }
321 if (bits_per_word > 16) {
322 /* invalid length? */
323 if (len & 1)
324 return -EINVAL;
321 len /= 2; 325 len /= 2;
326 }
322 mpc83xx_spi->count = len; 327 mpc83xx_spi->count = len;
328
323 INIT_COMPLETION(mpc83xx_spi->done); 329 INIT_COMPLETION(mpc83xx_spi->done);
324 330
325 /* enable rx ints */ 331 /* enable rx ints */
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c
index 98abc73c1a1d..3eb414b84a9d 100644
--- a/drivers/spi/spi_s3c24xx.c
+++ b/drivers/spi/spi_s3c24xx.c
@@ -430,7 +430,7 @@ static int s3c24xx_spi_resume(struct platform_device *pdev)
430#endif 430#endif
431 431
432MODULE_ALIAS("platform:s3c2410-spi"); 432MODULE_ALIAS("platform:s3c2410-spi");
433static struct platform_driver s3c24xx_spidrv = { 433static struct platform_driver s3c24xx_spi_driver = {
434 .remove = __exit_p(s3c24xx_spi_remove), 434 .remove = __exit_p(s3c24xx_spi_remove),
435 .suspend = s3c24xx_spi_suspend, 435 .suspend = s3c24xx_spi_suspend,
436 .resume = s3c24xx_spi_resume, 436 .resume = s3c24xx_spi_resume,
@@ -442,12 +442,12 @@ static struct platform_driver s3c24xx_spidrv = {
442 442
443static int __init s3c24xx_spi_init(void) 443static int __init s3c24xx_spi_init(void)
444{ 444{
445 return platform_driver_probe(&s3c24xx_spidrv, s3c24xx_spi_probe); 445 return platform_driver_probe(&s3c24xx_spi_driver, s3c24xx_spi_probe);
446} 446}
447 447
448static void __exit s3c24xx_spi_exit(void) 448static void __exit s3c24xx_spi_exit(void)
449{ 449{
450 platform_driver_unregister(&s3c24xx_spidrv); 450 platform_driver_unregister(&s3c24xx_spi_driver);
451} 451}
452 452
453module_init(s3c24xx_spi_init); 453module_init(s3c24xx_spi_init);
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index 87ab2443e66d..0ffabf5c0b60 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -471,6 +471,7 @@ static int ssb_devices_register(struct ssb_bus *bus)
471#endif 471#endif
472 break; 472 break;
473 case SSB_BUSTYPE_SSB: 473 case SSB_BUSTYPE_SSB:
474 dev->dma_mask = &dev->coherent_dma_mask;
474 break; 475 break;
475 } 476 }
476 477
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 8abd4e59bf4a..8ab389dca2b9 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1876,7 +1876,8 @@ int usb_add_hcd(struct usb_hcd *hcd,
1876 * with IRQF_SHARED. As usb_hcd_irq() will always disable 1876 * with IRQF_SHARED. As usb_hcd_irq() will always disable
1877 * interrupts we can remove it here. 1877 * interrupts we can remove it here.
1878 */ 1878 */
1879 irqflags &= ~IRQF_DISABLED; 1879 if (irqflags & IRQF_SHARED)
1880 irqflags &= ~IRQF_DISABLED;
1880 1881
1881 snprintf(hcd->irq_descr, sizeof(hcd->irq_descr), "%s:usb%d", 1882 snprintf(hcd->irq_descr, sizeof(hcd->irq_descr), "%s:usb%d",
1882 hcd->driver->description, hcd->self.busnum); 1883 hcd->driver->description, hcd->self.busnum);
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 6a5cb018383d..d99963873e37 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2683,35 +2683,17 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
2683 USB_PORT_STAT_C_ENABLE); 2683 USB_PORT_STAT_C_ENABLE);
2684#endif 2684#endif
2685 2685
2686 /* Try to use the debounce delay for protection against
2687 * port-enable changes caused, for example, by EMI.
2688 */
2689 if (portchange & (USB_PORT_STAT_C_CONNECTION |
2690 USB_PORT_STAT_C_ENABLE)) {
2691 status = hub_port_debounce(hub, port1);
2692 if (status < 0) {
2693 if (printk_ratelimit())
2694 dev_err (hub_dev, "connect-debounce failed, "
2695 "port %d disabled\n", port1);
2696 portstatus &= ~USB_PORT_STAT_CONNECTION;
2697 } else {
2698 portstatus = status;
2699 }
2700 }
2701
2702 /* Try to resuscitate an existing device */ 2686 /* Try to resuscitate an existing device */
2703 udev = hdev->children[port1-1]; 2687 udev = hdev->children[port1-1];
2704 if ((portstatus & USB_PORT_STAT_CONNECTION) && udev && 2688 if ((portstatus & USB_PORT_STAT_CONNECTION) && udev &&
2705 udev->state != USB_STATE_NOTATTACHED) { 2689 udev->state != USB_STATE_NOTATTACHED) {
2706
2707 usb_lock_device(udev); 2690 usb_lock_device(udev);
2708 if (portstatus & USB_PORT_STAT_ENABLE) { 2691 if (portstatus & USB_PORT_STAT_ENABLE) {
2709 status = 0; /* Nothing to do */ 2692 status = 0; /* Nothing to do */
2710 } else if (!udev->persist_enabled) {
2711 status = -ENODEV; /* Mustn't resuscitate */
2712 2693
2713#ifdef CONFIG_USB_SUSPEND 2694#ifdef CONFIG_USB_SUSPEND
2714 } else if (udev->state == USB_STATE_SUSPENDED) { 2695 } else if (udev->state == USB_STATE_SUSPENDED &&
2696 udev->persist_enabled) {
2715 /* For a suspended device, treat this as a 2697 /* For a suspended device, treat this as a
2716 * remote wakeup event. 2698 * remote wakeup event.
2717 */ 2699 */
@@ -2726,7 +2708,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
2726#endif 2708#endif
2727 2709
2728 } else { 2710 } else {
2729 status = usb_reset_device(udev); 2711 status = -ENODEV; /* Don't resuscitate */
2730 } 2712 }
2731 usb_unlock_device(udev); 2713 usb_unlock_device(udev);
2732 2714
@@ -2741,6 +2723,19 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
2741 usb_disconnect(&hdev->children[port1-1]); 2723 usb_disconnect(&hdev->children[port1-1]);
2742 clear_bit(port1, hub->change_bits); 2724 clear_bit(port1, hub->change_bits);
2743 2725
2726 if (portchange & (USB_PORT_STAT_C_CONNECTION |
2727 USB_PORT_STAT_C_ENABLE)) {
2728 status = hub_port_debounce(hub, port1);
2729 if (status < 0) {
2730 if (printk_ratelimit())
2731 dev_err(hub_dev, "connect-debounce failed, "
2732 "port %d disabled\n", port1);
2733 portstatus &= ~USB_PORT_STAT_CONNECTION;
2734 } else {
2735 portstatus = status;
2736 }
2737 }
2738
2744 /* Return now if debouncing failed or nothing is connected */ 2739 /* Return now if debouncing failed or nothing is connected */
2745 if (!(portstatus & USB_PORT_STAT_CONNECTION)) { 2740 if (!(portstatus & USB_PORT_STAT_CONNECTION)) {
2746 2741
@@ -2748,7 +2743,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
2748 if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2 2743 if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2
2749 && !(portstatus & (1 << USB_PORT_FEAT_POWER))) 2744 && !(portstatus & (1 << USB_PORT_FEAT_POWER)))
2750 set_port_feature(hdev, port1, USB_PORT_FEAT_POWER); 2745 set_port_feature(hdev, port1, USB_PORT_FEAT_POWER);
2751 2746
2752 if (portstatus & USB_PORT_STAT_ENABLE) 2747 if (portstatus & USB_PORT_STAT_ENABLE)
2753 goto done; 2748 goto done;
2754 return; 2749 return;
diff --git a/drivers/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c
index 1cfccf102a2d..45ad556169f1 100644
--- a/drivers/usb/gadget/fsl_usb2_udc.c
+++ b/drivers/usb/gadget/fsl_usb2_udc.c
@@ -223,7 +223,7 @@ static int dr_controller_setup(struct fsl_udc *udc)
223 fsl_writel(tmp, &dr_regs->endpointlistaddr); 223 fsl_writel(tmp, &dr_regs->endpointlistaddr);
224 224
225 VDBG("vir[qh_base] is %p phy[qh_base] is 0x%8x reg is 0x%8x", 225 VDBG("vir[qh_base] is %p phy[qh_base] is 0x%8x reg is 0x%8x",
226 (int)udc->ep_qh, (int)tmp, 226 udc->ep_qh, (int)tmp,
227 fsl_readl(&dr_regs->endpointlistaddr)); 227 fsl_readl(&dr_regs->endpointlistaddr));
228 228
229 /* Config PHY interface */ 229 /* Config PHY interface */
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 574c53831a05..bb54cca4c543 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -787,7 +787,7 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel)
787 omap_set_dma_dest_params(ep->lch, 787 omap_set_dma_dest_params(ep->lch,
788 OMAP_DMA_PORT_TIPB, 788 OMAP_DMA_PORT_TIPB,
789 OMAP_DMA_AMODE_CONSTANT, 789 OMAP_DMA_AMODE_CONSTANT,
790 (unsigned long) io_v2p(UDC_DATA_DMA), 790 UDC_DATA_DMA,
791 0, 0); 791 0, 0);
792 } 792 }
793 } else { 793 } else {
@@ -804,7 +804,7 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel)
804 omap_set_dma_src_params(ep->lch, 804 omap_set_dma_src_params(ep->lch,
805 OMAP_DMA_PORT_TIPB, 805 OMAP_DMA_PORT_TIPB,
806 OMAP_DMA_AMODE_CONSTANT, 806 OMAP_DMA_AMODE_CONSTANT,
807 (unsigned long) io_v2p(UDC_DATA_DMA), 807 UDC_DATA_DMA,
808 0, 0); 808 0, 0);
809 /* EMIFF or SDRC */ 809 /* EMIFF or SDRC */
810 omap_set_dma_dest_burst_mode(ep->lch, 810 omap_set_dma_dest_burst_mode(ep->lch,
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index d9d53f289caf..8409e0705d63 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -145,16 +145,6 @@ static int handshake (struct ehci_hcd *ehci, void __iomem *ptr,
145 return -ETIMEDOUT; 145 return -ETIMEDOUT;
146} 146}
147 147
148static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr,
149 u32 mask, u32 done, int usec)
150{
151 int error = handshake(ehci, ptr, mask, done, usec);
152 if (error)
153 ehci_to_hcd(ehci)->state = HC_STATE_HALT;
154
155 return error;
156}
157
158/* force HC to halt state from unknown (EHCI spec section 2.3) */ 148/* force HC to halt state from unknown (EHCI spec section 2.3) */
159static int ehci_halt (struct ehci_hcd *ehci) 149static int ehci_halt (struct ehci_hcd *ehci)
160{ 150{
@@ -173,6 +163,22 @@ static int ehci_halt (struct ehci_hcd *ehci)
173 STS_HALT, STS_HALT, 16 * 125); 163 STS_HALT, STS_HALT, 16 * 125);
174} 164}
175 165
166static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr,
167 u32 mask, u32 done, int usec)
168{
169 int error;
170
171 error = handshake(ehci, ptr, mask, done, usec);
172 if (error) {
173 ehci_halt(ehci);
174 ehci_to_hcd(ehci)->state = HC_STATE_HALT;
175 ehci_err(ehci, "force halt; handhake %p %08x %08x -> %d\n",
176 ptr, mask, done, error);
177 }
178
179 return error;
180}
181
176/* put TDI/ARC silicon into EHCI mode */ 182/* put TDI/ARC silicon into EHCI mode */
177static void tdi_reset (struct ehci_hcd *ehci) 183static void tdi_reset (struct ehci_hcd *ehci)
178{ 184{
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index b7853c8bac0f..4a0c5a78b2ed 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -437,6 +437,9 @@ static int enable_periodic (struct ehci_hcd *ehci)
437 u32 cmd; 437 u32 cmd;
438 int status; 438 int status;
439 439
440 if (ehci->periodic_sched++)
441 return 0;
442
440 /* did clearing PSE did take effect yet? 443 /* did clearing PSE did take effect yet?
441 * takes effect only at frame boundaries... 444 * takes effect only at frame boundaries...
442 */ 445 */
@@ -461,6 +464,9 @@ static int disable_periodic (struct ehci_hcd *ehci)
461 u32 cmd; 464 u32 cmd;
462 int status; 465 int status;
463 466
467 if (--ehci->periodic_sched)
468 return 0;
469
464 /* did setting PSE not take effect yet? 470 /* did setting PSE not take effect yet?
465 * takes effect only at frame boundaries... 471 * takes effect only at frame boundaries...
466 */ 472 */
@@ -544,13 +550,10 @@ static int qh_link_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh)
544 : (qh->usecs * 8); 550 : (qh->usecs * 8);
545 551
546 /* maybe enable periodic schedule processing */ 552 /* maybe enable periodic schedule processing */
547 if (!ehci->periodic_sched++) 553 return enable_periodic(ehci);
548 return enable_periodic (ehci);
549
550 return 0;
551} 554}
552 555
553static void qh_unlink_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh) 556static int qh_unlink_periodic(struct ehci_hcd *ehci, struct ehci_qh *qh)
554{ 557{
555 unsigned i; 558 unsigned i;
556 unsigned period; 559 unsigned period;
@@ -586,9 +589,7 @@ static void qh_unlink_periodic (struct ehci_hcd *ehci, struct ehci_qh *qh)
586 qh_put (qh); 589 qh_put (qh);
587 590
588 /* maybe turn off periodic schedule */ 591 /* maybe turn off periodic schedule */
589 ehci->periodic_sched--; 592 return disable_periodic(ehci);
590 if (!ehci->periodic_sched)
591 (void) disable_periodic (ehci);
592} 593}
593 594
594static void intr_deschedule (struct ehci_hcd *ehci, struct ehci_qh *qh) 595static void intr_deschedule (struct ehci_hcd *ehci, struct ehci_qh *qh)
@@ -1562,9 +1563,7 @@ itd_link_urb (
1562 urb->hcpriv = NULL; 1563 urb->hcpriv = NULL;
1563 1564
1564 timer_action (ehci, TIMER_IO_WATCHDOG); 1565 timer_action (ehci, TIMER_IO_WATCHDOG);
1565 if (unlikely (!ehci->periodic_sched++)) 1566 return enable_periodic(ehci);
1566 return enable_periodic (ehci);
1567 return 0;
1568} 1567}
1569 1568
1570#define ISO_ERRS (EHCI_ISOC_BUF_ERR | EHCI_ISOC_BABBLE | EHCI_ISOC_XACTERR) 1569#define ISO_ERRS (EHCI_ISOC_BUF_ERR | EHCI_ISOC_BABBLE | EHCI_ISOC_XACTERR)
@@ -1642,7 +1641,7 @@ itd_complete (
1642 ehci_urb_done(ehci, urb, 0); 1641 ehci_urb_done(ehci, urb, 0);
1643 retval = true; 1642 retval = true;
1644 urb = NULL; 1643 urb = NULL;
1645 ehci->periodic_sched--; 1644 (void) disable_periodic(ehci);
1646 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; 1645 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--;
1647 1646
1648 if (unlikely (list_empty (&stream->td_list))) { 1647 if (unlikely (list_empty (&stream->td_list))) {
@@ -1951,9 +1950,7 @@ sitd_link_urb (
1951 urb->hcpriv = NULL; 1950 urb->hcpriv = NULL;
1952 1951
1953 timer_action (ehci, TIMER_IO_WATCHDOG); 1952 timer_action (ehci, TIMER_IO_WATCHDOG);
1954 if (!ehci->periodic_sched++) 1953 return enable_periodic(ehci);
1955 return enable_periodic (ehci);
1956 return 0;
1957} 1954}
1958 1955
1959/*-------------------------------------------------------------------------*/ 1956/*-------------------------------------------------------------------------*/
@@ -2019,7 +2016,7 @@ sitd_complete (
2019 ehci_urb_done(ehci, urb, 0); 2016 ehci_urb_done(ehci, urb, 0);
2020 retval = true; 2017 retval = true;
2021 urb = NULL; 2018 urb = NULL;
2022 ehci->periodic_sched--; 2019 (void) disable_periodic(ehci);
2023 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--; 2020 ehci_to_hcd(ehci)->self.bandwidth_isoc_reqs--;
2024 2021
2025 if (list_empty (&stream->td_list)) { 2022 if (list_empty (&stream->td_list)) {
@@ -2243,8 +2240,7 @@ restart:
2243 if (unlikely (modified)) { 2240 if (unlikely (modified)) {
2244 if (likely(ehci->periodic_sched > 0)) 2241 if (likely(ehci->periodic_sched > 0))
2245 goto restart; 2242 goto restart;
2246 /* maybe we can short-circuit this scan! */ 2243 /* short-circuit this scan */
2247 disable_periodic(ehci);
2248 now_uframe = clock; 2244 now_uframe = clock;
2249 break; 2245 break;
2250 } 2246 }
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index a0017486ad4e..58b2b8fc9439 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -9,6 +9,7 @@ comment "Enable Host or Gadget support to see Inventra options"
9# (M)HDRC = (Multipoint) Highspeed Dual-Role Controller 9# (M)HDRC = (Multipoint) Highspeed Dual-Role Controller
10config USB_MUSB_HDRC 10config USB_MUSB_HDRC
11 depends on (USB || USB_GADGET) && HAVE_CLK 11 depends on (USB || USB_GADGET) && HAVE_CLK
12 depends on !SUPERH
12 select TWL4030_USB if MACH_OMAP_3430SDP 13 select TWL4030_USB if MACH_OMAP_3430SDP
13 tristate 'Inventra Highspeed Dual Role Controller (TI, ...)' 14 tristate 'Inventra Highspeed Dual Role Controller (TI, ...)'
14 help 15 help
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index c5b8f0296fcf..128e949db47c 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -100,8 +100,8 @@
100#include <linux/io.h> 100#include <linux/io.h>
101 101
102#ifdef CONFIG_ARM 102#ifdef CONFIG_ARM
103#include <asm/arch/hardware.h> 103#include <mach/hardware.h>
104#include <asm/arch/memory.h> 104#include <mach/memory.h>
105#include <asm/mach-types.h> 105#include <asm/mach-types.h>
106#endif 106#endif
107 107
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 298b22e6ad0d..9d2dcb121c5e 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -35,8 +35,8 @@
35#include <linux/io.h> 35#include <linux/io.h>
36 36
37#include <asm/mach-types.h> 37#include <asm/mach-types.h>
38#include <asm/arch/hardware.h> 38#include <mach/hardware.h>
39#include <asm/arch/mux.h> 39#include <mach/mux.h>
40 40
41#include "musb_core.h" 41#include "musb_core.h"
42#include "omap2430.h" 42#include "omap2430.h"
diff --git a/drivers/usb/musb/omap2430.h b/drivers/usb/musb/omap2430.h
index 786a62071f72..dc7670718cd2 100644
--- a/drivers/usb/musb/omap2430.h
+++ b/drivers/usb/musb/omap2430.h
@@ -11,8 +11,8 @@
11#define __MUSB_OMAP243X_H__ 11#define __MUSB_OMAP243X_H__
12 12
13#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430) 13#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430)
14#include <asm/arch/hardware.h> 14#include <mach/hardware.h>
15#include <asm/arch/usb.h> 15#include <mach/usb.h>
16 16
17/* 17/*
18 * OMAP2430-specific definitions 18 * OMAP2430-specific definitions
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c
index 442cba69cce5..1279553381e3 100644
--- a/drivers/usb/serial/cp2101.c
+++ b/drivers/usb/serial/cp2101.c
@@ -72,6 +72,7 @@ static struct usb_device_id id_table [] = {
72 { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */ 72 { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */
73 { USB_DEVICE(0x10C4, 0x80DD) }, /* Tracient RFID */ 73 { USB_DEVICE(0x10C4, 0x80DD) }, /* Tracient RFID */
74 { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */ 74 { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */
75 { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */
75 { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ 76 { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */
76 { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ 77 { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */
77 { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ 78 { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */
@@ -83,6 +84,7 @@ static struct usb_device_id id_table [] = {
83 { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */ 84 { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */
84 { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */ 85 { USB_DEVICE(0x10C4, 0x8218) }, /* Lipowsky Industrie Elektronik GmbH, HARP-1 */
85 { USB_DEVICE(0x10c4, 0x8293) }, /* Telegesys ETRX2USB */ 86 { USB_DEVICE(0x10c4, 0x8293) }, /* Telegesys ETRX2USB */
87 { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */
86 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ 88 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
87 { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ 89 { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */
88 { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */ 90 { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */
@@ -93,6 +95,7 @@ static struct usb_device_id id_table [] = {
93 { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */ 95 { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */
94 { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */ 96 { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */
95 { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ 97 { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */
98 { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
96 { } /* Terminating Entry */ 99 { } /* Terminating Entry */
97}; 100};
98 101
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 984f6eff4c47..3dc93b542b30 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -654,6 +654,9 @@ static struct usb_device_id id_table_combined [] = {
654 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 654 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
655 { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, 655 { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) },
656 { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) }, 656 { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) },
657 { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO4x4_PID) },
658 { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DGQG_PID) },
659 { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) },
657 { }, /* Optional parameter entry */ 660 { }, /* Optional parameter entry */
658 { } /* Terminating entry */ 661 { } /* Terminating entry */
659}; 662};
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index 382265bba969..8a5b6df3a976 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -750,6 +750,7 @@
750 750
751#define PAPOUCH_VID 0x5050 /* Vendor ID */ 751#define PAPOUCH_VID 0x5050 /* Vendor ID */
752#define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */ 752#define PAPOUCH_TMU_PID 0x0400 /* TMU USB Thermometer */
753#define PAPOUCH_QUIDO4x4_PID 0x0900 /* Quido 4/4 Module */
753 754
754/* 755/*
755 * ACG Identification Technologies GmbH products (http://www.acg.de/). 756 * ACG Identification Technologies GmbH products (http://www.acg.de/).
@@ -838,6 +839,10 @@
838/* Rig Expert Ukraine devices */ 839/* Rig Expert Ukraine devices */
839#define FTDI_REU_TINY_PID 0xED22 /* RigExpert Tiny */ 840#define FTDI_REU_TINY_PID 0xED22 /* RigExpert Tiny */
840 841
842/* Domintell products http://www.domintell.com */
843#define FTDI_DOMINTELL_DGQG_PID 0xEF50 /* Master */
844#define FTDI_DOMINTELL_DUSB_PID 0xEF51 /* DUSB01 module */
845
841/* Commands */ 846/* Commands */
842#define FTDI_SIO_RESET 0 /* Reset the port */ 847#define FTDI_SIO_RESET 0 /* Reset the port */
843#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ 848#define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 9f9cd36455f4..73f8277f88f2 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -218,6 +218,7 @@ static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *po
218/* ZTE PRODUCTS */ 218/* ZTE PRODUCTS */
219#define ZTE_VENDOR_ID 0x19d2 219#define ZTE_VENDOR_ID 0x19d2
220#define ZTE_PRODUCT_MF628 0x0015 220#define ZTE_PRODUCT_MF628 0x0015
221#define ZTE_PRODUCT_CDMA_TECH 0xfffe
221 222
222static struct usb_device_id option_ids[] = { 223static struct usb_device_id option_ids[] = {
223 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, 224 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
@@ -347,6 +348,7 @@ static struct usb_device_id option_ids[] = {
347 { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */ 348 { USB_DEVICE(MAXON_VENDOR_ID, 0x6280) }, /* BP3-USB & BP3-EXT HSDPA */
348 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) }, 349 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) },
349 { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628) }, 350 { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628) },
351 { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) },
350 { } /* Terminating entry */ 352 { } /* Terminating entry */
351}; 353};
352MODULE_DEVICE_TABLE(usb, option_ids); 354MODULE_DEVICE_TABLE(usb, option_ids);
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 706033753adb..ea1a103c99be 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -14,7 +14,7 @@
14 Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org> 14 Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org>
15*/ 15*/
16 16
17#define DRIVER_VERSION "v.1.2.13a" 17#define DRIVER_VERSION "v.1.3.2"
18#define DRIVER_AUTHOR "Kevin Lloyd <klloyd@sierrawireless.com>" 18#define DRIVER_AUTHOR "Kevin Lloyd <klloyd@sierrawireless.com>"
19#define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" 19#define DRIVER_DESC "USB Driver for Sierra Wireless USB modems"
20 20
@@ -30,9 +30,6 @@
30 30
31#define SWIMS_USB_REQUEST_SetPower 0x00 31#define SWIMS_USB_REQUEST_SetPower 0x00
32#define SWIMS_USB_REQUEST_SetNmea 0x07 32#define SWIMS_USB_REQUEST_SetNmea 0x07
33#define SWIMS_USB_REQUEST_SetMode 0x0B
34#define SWIMS_USB_REQUEST_GetSwocInfo 0x0A
35#define SWIMS_SET_MODE_Modem 0x0001
36 33
37/* per port private data */ 34/* per port private data */
38#define N_IN_URB 4 35#define N_IN_URB 4
@@ -163,7 +160,7 @@ static struct usb_device_id id_table [] = {
163 { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */ 160 { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */
164 { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */ 161 { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */
165 { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */ 162 { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */
166 { USB_DEVICE(0x0f30, 0x1b1d) }, /* Sierra Wireless MC5720 */ 163 { USB_DEVICE(0x03f0, 0x1b1d) }, /* HP ev2200 a.k.a MC5720 */
167 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ 164 { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */
168 { USB_DEVICE(0x1199, 0x0024) }, /* Sierra Wireless MC5727 */ 165 { USB_DEVICE(0x1199, 0x0024) }, /* Sierra Wireless MC5727 */
169 { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */ 166 { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */
@@ -175,6 +172,8 @@ static struct usb_device_id id_table [] = {
175 /* Sierra Wireless Device */ 172 /* Sierra Wireless Device */
176 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0025, 0xFF, 0xFF, 0xFF) }, 173 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0025, 0xFF, 0xFF, 0xFF) },
177 { USB_DEVICE(0x1199, 0x0026) }, /* Sierra Wireless Device */ 174 { USB_DEVICE(0x1199, 0x0026) }, /* Sierra Wireless Device */
175 { USB_DEVICE(0x1199, 0x0027) }, /* Sierra Wireless Device */
176 { USB_DEVICE(0x1199, 0x0028) }, /* Sierra Wireless Device */
178 177
179 { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */ 178 { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */
180 { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */ 179 { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */
@@ -187,6 +186,7 @@ static struct usb_device_id id_table [] = {
187 { USB_DEVICE(0x1199, 0x6821) }, /* Sierra Wireless AirCard 875U */ 186 { USB_DEVICE(0x1199, 0x6821) }, /* Sierra Wireless AirCard 875U */
188 { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780 */ 187 { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780 */
189 { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781 */ 188 { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781 */
189 { USB_DEVICE(0x1199, 0x683A) }, /* Sierra Wireless MC8785 */
190 { USB_DEVICE(0x1199, 0x683B) }, /* Sierra Wireless MC8785 Composite */ 190 { USB_DEVICE(0x1199, 0x683B) }, /* Sierra Wireless MC8785 Composite */
191 { USB_DEVICE(0x1199, 0x683C) }, /* Sierra Wireless MC8790 */ 191 { USB_DEVICE(0x1199, 0x683C) }, /* Sierra Wireless MC8790 */
192 { USB_DEVICE(0x1199, 0x683D) }, /* Sierra Wireless MC8790 */ 192 { USB_DEVICE(0x1199, 0x683D) }, /* Sierra Wireless MC8790 */
@@ -204,6 +204,8 @@ static struct usb_device_id id_table [] = {
204 /* Sierra Wireless Device */ 204 /* Sierra Wireless Device */
205 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6890, 0xFF, 0xFF, 0xFF)}, 205 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6890, 0xFF, 0xFF, 0xFF)},
206 /* Sierra Wireless Device */ 206 /* Sierra Wireless Device */
207 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6891, 0xFF, 0xFF, 0xFF)},
208 /* Sierra Wireless Device */
207 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, 209 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)},
208 210
209 { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */ 211 { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index e39c779e4160..9a3e495c769c 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -1744,7 +1744,7 @@ static int ti_download_firmware(struct ti_device *tdev, int type)
1744 if (buffer) { 1744 if (buffer) {
1745 memcpy(buffer, fw_p->data, fw_p->size); 1745 memcpy(buffer, fw_p->data, fw_p->size);
1746 memset(buffer + fw_p->size, 0xff, buffer_size - fw_p->size); 1746 memset(buffer + fw_p->size, 0xff, buffer_size - fw_p->size);
1747 ti_do_download(dev, pipe, buffer, fw_p->size); 1747 status = ti_do_download(dev, pipe, buffer, fw_p->size);
1748 kfree(buffer); 1748 kfree(buffer);
1749 } 1749 }
1750 release_firmware(fw_p); 1750 release_firmware(fw_p);
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index b157c48e8b78..4f7f9e3ae0a4 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -733,7 +733,9 @@ int usb_serial_probe(struct usb_interface *interface,
733 ((le16_to_cpu(dev->descriptor.idVendor) == ATEN_VENDOR_ID) && 733 ((le16_to_cpu(dev->descriptor.idVendor) == ATEN_VENDOR_ID) &&
734 (le16_to_cpu(dev->descriptor.idProduct) == ATEN_PRODUCT_ID)) || 734 (le16_to_cpu(dev->descriptor.idProduct) == ATEN_PRODUCT_ID)) ||
735 ((le16_to_cpu(dev->descriptor.idVendor) == ALCOR_VENDOR_ID) && 735 ((le16_to_cpu(dev->descriptor.idVendor) == ALCOR_VENDOR_ID) &&
736 (le16_to_cpu(dev->descriptor.idProduct) == ALCOR_PRODUCT_ID))) { 736 (le16_to_cpu(dev->descriptor.idProduct) == ALCOR_PRODUCT_ID)) ||
737 ((le16_to_cpu(dev->descriptor.idVendor) == SIEMENS_VENDOR_ID) &&
738 (le16_to_cpu(dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_EF81))) {
737 if (interface != dev->actconfig->interface[0]) { 739 if (interface != dev->actconfig->interface[0]) {
738 /* check out the endpoints of the other interface*/ 740 /* check out the endpoints of the other interface*/
739 iface_desc = dev->actconfig->interface[0]->cur_altsetting; 741 iface_desc = dev->actconfig->interface[0]->cur_altsetting;
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
index c76034672c18..3d9249632ae1 100644
--- a/drivers/usb/storage/Kconfig
+++ b/drivers/usb/storage/Kconfig
@@ -146,18 +146,6 @@ config USB_STORAGE_KARMA
146 on the resulting scsi device node returns the Karma to normal 146 on the resulting scsi device node returns the Karma to normal
147 operation. 147 operation.
148 148
149config USB_STORAGE_SIERRA
150 bool "Sierra Wireless TRU-Install Feature Support"
151 depends on USB_STORAGE
152 help
153 Say Y here to include additional code to support Sierra Wireless
154 products with the TRU-Install feature (e.g., AC597E, AC881U).
155
156 This code switches the Sierra Wireless device from being in
157 Mass Storage mode to Modem mode. It also has the ability to
158 support host software upgrades should full Linux support be added
159 to TRU-Install.
160
161config USB_STORAGE_CYPRESS_ATACB 149config USB_STORAGE_CYPRESS_ATACB
162 bool "SAT emulation on Cypress USB/ATA Bridge with ATACB" 150 bool "SAT emulation on Cypress USB/ATA Bridge with ATACB"
163 depends on USB_STORAGE 151 depends on USB_STORAGE
diff --git a/drivers/usb/storage/Makefile b/drivers/usb/storage/Makefile
index bc3415b475c9..7f8beb5366ae 100644
--- a/drivers/usb/storage/Makefile
+++ b/drivers/usb/storage/Makefile
@@ -21,11 +21,10 @@ usb-storage-obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += jumpshot.o
21usb-storage-obj-$(CONFIG_USB_STORAGE_ALAUDA) += alauda.o 21usb-storage-obj-$(CONFIG_USB_STORAGE_ALAUDA) += alauda.o
22usb-storage-obj-$(CONFIG_USB_STORAGE_ONETOUCH) += onetouch.o 22usb-storage-obj-$(CONFIG_USB_STORAGE_ONETOUCH) += onetouch.o
23usb-storage-obj-$(CONFIG_USB_STORAGE_KARMA) += karma.o 23usb-storage-obj-$(CONFIG_USB_STORAGE_KARMA) += karma.o
24usb-storage-obj-$(CONFIG_USB_STORAGE_SIERRA) += sierra_ms.o
25usb-storage-obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += cypress_atacb.o 24usb-storage-obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += cypress_atacb.o
26 25
27usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \ 26usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \
28 initializers.o $(usb-storage-obj-y) 27 initializers.o sierra_ms.o $(usb-storage-obj-y)
29 28
30ifneq ($(CONFIG_USB_LIBUSUAL),) 29ifneq ($(CONFIG_USB_LIBUSUAL),)
31 obj-$(CONFIG_USB) += libusual.o 30 obj-$(CONFIG_USB) += libusual.o
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index ba412e68d474..cd155475cb6e 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -160,6 +160,13 @@ UNUSUAL_DEV( 0x0421, 0x0019, 0x0592, 0x0592,
160 US_SC_DEVICE, US_PR_DEVICE, NULL, 160 US_SC_DEVICE, US_PR_DEVICE, NULL,
161 US_FL_MAX_SECTORS_64 ), 161 US_FL_MAX_SECTORS_64 ),
162 162
163/* Reported by Filip Joelsson <filip@blueturtle.nu> */
164UNUSUAL_DEV( 0x0421, 0x005d, 0x0001, 0x0600,
165 "Nokia",
166 "Nokia 3110c",
167 US_SC_DEVICE, US_PR_DEVICE, NULL,
168 US_FL_FIX_CAPACITY ),
169
163/* Reported by Mario Rettig <mariorettig@web.de> */ 170/* Reported by Mario Rettig <mariorettig@web.de> */
164UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100, 171UNUSUAL_DEV( 0x0421, 0x042e, 0x0100, 0x0100,
165 "Nokia", 172 "Nokia",
@@ -232,6 +239,20 @@ UNUSUAL_DEV( 0x0421, 0x04b9, 0x0551, 0x0551,
232 US_SC_DEVICE, US_PR_DEVICE, NULL, 239 US_SC_DEVICE, US_PR_DEVICE, NULL,
233 US_FL_FIX_CAPACITY ), 240 US_FL_FIX_CAPACITY ),
234 241
242/* Reported by Richard Nauber <RichardNauber@web.de> */
243UNUSUAL_DEV( 0x0421, 0x04fa, 0x0601, 0x0601,
244 "Nokia",
245 "6300",
246 US_SC_DEVICE, US_PR_DEVICE, NULL,
247 US_FL_FIX_CAPACITY ),
248
249/* Patch for Nokia 5310 capacity */
250UNUSUAL_DEV( 0x0421, 0x006a, 0x0000, 0x0591,
251 "Nokia",
252 "5310",
253 US_SC_DEVICE, US_PR_DEVICE, NULL,
254 US_FL_FIX_CAPACITY ),
255
235/* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */ 256/* Reported by Olaf Hering <olh@suse.de> from novell bug #105878 */
236UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210, 257UNUSUAL_DEV( 0x0424, 0x0fdc, 0x0210, 0x0210,
237 "SMSC", 258 "SMSC",
@@ -987,6 +1008,13 @@ UNUSUAL_DEV( 0x069b, 0x3004, 0x0001, 0x0001,
987 US_SC_DEVICE, US_PR_DEVICE, NULL, 1008 US_SC_DEVICE, US_PR_DEVICE, NULL,
988 US_FL_FIX_CAPACITY ), 1009 US_FL_FIX_CAPACITY ),
989 1010
1011/* Reported by Adrian Pilchowiec <adi1981@epf.pl> */
1012UNUSUAL_DEV( 0x071b, 0x3203, 0x0000, 0x0000,
1013 "RockChip",
1014 "MP3",
1015 US_SC_DEVICE, US_PR_DEVICE, NULL,
1016 US_FL_NO_WP_DETECT | US_FL_MAX_SECTORS_64),
1017
990/* Reported by Massimiliano Ghilardi <massimiliano.ghilardi@gmail.com> 1018/* Reported by Massimiliano Ghilardi <massimiliano.ghilardi@gmail.com>
991 * This USB MP3/AVI player device fails and disconnects if more than 128 1019 * This USB MP3/AVI player device fails and disconnects if more than 128
992 * sectors (64kB) are read/written in a single command, and may be present 1020 * sectors (64kB) are read/written in a single command, and may be present
@@ -1576,7 +1604,6 @@ UNUSUAL_DEV( 0x10d6, 0x2200, 0x0100, 0x0100,
1576 US_SC_DEVICE, US_PR_DEVICE, NULL, 1604 US_SC_DEVICE, US_PR_DEVICE, NULL,
1577 0), 1605 0),
1578 1606
1579#ifdef CONFIG_USB_STORAGE_SIERRA
1580/* Reported by Kevin Lloyd <linux@sierrawireless.com> 1607/* Reported by Kevin Lloyd <linux@sierrawireless.com>
1581 * Entry is needed for the initializer function override, 1608 * Entry is needed for the initializer function override,
1582 * which instructs the device to load as a modem 1609 * which instructs the device to load as a modem
@@ -1587,7 +1614,6 @@ UNUSUAL_DEV( 0x1199, 0x0fff, 0x0000, 0x9999,
1587 "USB MMC Storage", 1614 "USB MMC Storage",
1588 US_SC_DEVICE, US_PR_DEVICE, sierra_ms_init, 1615 US_SC_DEVICE, US_PR_DEVICE, sierra_ms_init,
1589 0), 1616 0),
1590#endif
1591 1617
1592/* Reported by Jaco Kroon <jaco@kroon.co.za> 1618/* Reported by Jaco Kroon <jaco@kroon.co.za>
1593 * The usb-storage module found on the Digitech GNX4 (and supposedly other 1619 * The usb-storage module found on the Digitech GNX4 (and supposedly other
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 73679aa506de..27016fd2cad1 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -102,9 +102,7 @@
102#ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB 102#ifdef CONFIG_USB_STORAGE_CYPRESS_ATACB
103#include "cypress_atacb.h" 103#include "cypress_atacb.h"
104#endif 104#endif
105#ifdef CONFIG_USB_STORAGE_SIERRA
106#include "sierra_ms.h" 105#include "sierra_ms.h"
107#endif
108 106
109/* Some informational data */ 107/* Some informational data */
110MODULE_AUTHOR("Matthew Dharm <mdharm-usb@one-eyed-alien.net>"); 108MODULE_AUTHOR("Matthew Dharm <mdharm-usb@one-eyed-alien.net>");
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index 5a24c6411d34..75dac578104f 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -208,6 +208,36 @@ static unsigned long compute_hozval(unsigned long xres, unsigned long lcdcon2)
208 return value; 208 return value;
209} 209}
210 210
211static void atmel_lcdfb_stop_nowait(struct atmel_lcdfb_info *sinfo)
212{
213 /* Turn off the LCD controller and the DMA controller */
214 lcdc_writel(sinfo, ATMEL_LCDC_PWRCON,
215 sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET);
216
217 /* Wait for the LCDC core to become idle */
218 while (lcdc_readl(sinfo, ATMEL_LCDC_PWRCON) & ATMEL_LCDC_BUSY)
219 msleep(10);
220
221 lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0);
222}
223
224static void atmel_lcdfb_stop(struct atmel_lcdfb_info *sinfo)
225{
226 atmel_lcdfb_stop_nowait(sinfo);
227
228 /* Wait for DMA engine to become idle... */
229 while (lcdc_readl(sinfo, ATMEL_LCDC_DMACON) & ATMEL_LCDC_DMABUSY)
230 msleep(10);
231}
232
233static void atmel_lcdfb_start(struct atmel_lcdfb_info *sinfo)
234{
235 lcdc_writel(sinfo, ATMEL_LCDC_DMACON, sinfo->default_dmacon);
236 lcdc_writel(sinfo, ATMEL_LCDC_PWRCON,
237 (sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET)
238 | ATMEL_LCDC_PWR);
239}
240
211static void atmel_lcdfb_update_dma(struct fb_info *info, 241static void atmel_lcdfb_update_dma(struct fb_info *info,
212 struct fb_var_screeninfo *var) 242 struct fb_var_screeninfo *var)
213{ 243{
@@ -420,26 +450,8 @@ static void atmel_lcdfb_reset(struct atmel_lcdfb_info *sinfo)
420{ 450{
421 might_sleep(); 451 might_sleep();
422 452
423 /* LCD power off */ 453 atmel_lcdfb_stop(sinfo);
424 lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET); 454 atmel_lcdfb_start(sinfo);
425
426 /* wait for the LCDC core to become idle */
427 while (lcdc_readl(sinfo, ATMEL_LCDC_PWRCON) & ATMEL_LCDC_BUSY)
428 msleep(10);
429
430 /* DMA disable */
431 lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0);
432
433 /* wait for DMA engine to become idle */
434 while (lcdc_readl(sinfo, ATMEL_LCDC_DMACON) & ATMEL_LCDC_DMABUSY)
435 msleep(10);
436
437 /* LCD power on */
438 lcdc_writel(sinfo, ATMEL_LCDC_PWRCON,
439 (sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET) | ATMEL_LCDC_PWR);
440
441 /* DMA enable */
442 lcdc_writel(sinfo, ATMEL_LCDC_DMACON, sinfo->default_dmacon);
443} 455}
444 456
445/** 457/**
@@ -471,14 +483,7 @@ static int atmel_lcdfb_set_par(struct fb_info *info)
471 info->var.xres, info->var.yres, 483 info->var.xres, info->var.yres,
472 info->var.xres_virtual, info->var.yres_virtual); 484 info->var.xres_virtual, info->var.yres_virtual);
473 485
474 /* Turn off the LCD controller and the DMA controller */ 486 atmel_lcdfb_stop_nowait(sinfo);
475 lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET);
476
477 /* Wait for the LCDC core to become idle */
478 while (lcdc_readl(sinfo, ATMEL_LCDC_PWRCON) & ATMEL_LCDC_BUSY)
479 msleep(10);
480
481 lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0);
482 487
483 if (info->var.bits_per_pixel == 1) 488 if (info->var.bits_per_pixel == 1)
484 info->fix.visual = FB_VISUAL_MONO01; 489 info->fix.visual = FB_VISUAL_MONO01;
@@ -583,13 +588,7 @@ static int atmel_lcdfb_set_par(struct fb_info *info)
583 while (lcdc_readl(sinfo, ATMEL_LCDC_DMACON) & ATMEL_LCDC_DMABUSY) 588 while (lcdc_readl(sinfo, ATMEL_LCDC_DMACON) & ATMEL_LCDC_DMABUSY)
584 msleep(10); 589 msleep(10);
585 590
586 dev_dbg(info->device, " * re-enable DMA engine\n"); 591 atmel_lcdfb_start(sinfo);
587 /* ...and enable it with updated configuration */
588 lcdc_writel(sinfo, ATMEL_LCDC_DMACON, sinfo->default_dmacon);
589
590 dev_dbg(info->device, " * re-enable LCDC core\n");
591 lcdc_writel(sinfo, ATMEL_LCDC_PWRCON,
592 (sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET) | ATMEL_LCDC_PWR);
593 592
594 dev_dbg(info->device, " * DONE\n"); 593 dev_dbg(info->device, " * DONE\n");
595 594
@@ -1032,11 +1031,20 @@ static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg)
1032 struct fb_info *info = platform_get_drvdata(pdev); 1031 struct fb_info *info = platform_get_drvdata(pdev);
1033 struct atmel_lcdfb_info *sinfo = info->par; 1032 struct atmel_lcdfb_info *sinfo = info->par;
1034 1033
1034 /*
1035 * We don't want to handle interrupts while the clock is
1036 * stopped. It may take forever.
1037 */
1038 lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0UL);
1039
1035 sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL); 1040 sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL);
1036 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0); 1041 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0);
1037 if (sinfo->atmel_lcdfb_power_control) 1042 if (sinfo->atmel_lcdfb_power_control)
1038 sinfo->atmel_lcdfb_power_control(0); 1043 sinfo->atmel_lcdfb_power_control(0);
1044
1045 atmel_lcdfb_stop(sinfo);
1039 atmel_lcdfb_stop_clock(sinfo); 1046 atmel_lcdfb_stop_clock(sinfo);
1047
1040 return 0; 1048 return 0;
1041} 1049}
1042 1050
@@ -1046,9 +1054,15 @@ static int atmel_lcdfb_resume(struct platform_device *pdev)
1046 struct atmel_lcdfb_info *sinfo = info->par; 1054 struct atmel_lcdfb_info *sinfo = info->par;
1047 1055
1048 atmel_lcdfb_start_clock(sinfo); 1056 atmel_lcdfb_start_clock(sinfo);
1057 atmel_lcdfb_start(sinfo);
1049 if (sinfo->atmel_lcdfb_power_control) 1058 if (sinfo->atmel_lcdfb_power_control)
1050 sinfo->atmel_lcdfb_power_control(1); 1059 sinfo->atmel_lcdfb_power_control(1);
1051 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon); 1060 lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon);
1061
1062 /* Enable FIFO & DMA errors */
1063 lcdc_writel(sinfo, ATMEL_LCDC_IER, ATMEL_LCDC_UFLWI
1064 | ATMEL_LCDC_OWRI | ATMEL_LCDC_MERI);
1065
1052 return 0; 1066 return 0;
1053} 1067}
1054 1068
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index c6299e8a041d..9cbff84b787d 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -2400,11 +2400,15 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch)
2400 2400
2401 if (!fbcon_is_inactive(vc, info)) { 2401 if (!fbcon_is_inactive(vc, info)) {
2402 if (ops->blank_state != blank) { 2402 if (ops->blank_state != blank) {
2403 int ret = 1;
2404
2403 ops->blank_state = blank; 2405 ops->blank_state = blank;
2404 fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW); 2406 fbcon_cursor(vc, blank ? CM_ERASE : CM_DRAW);
2405 ops->cursor_flash = (!blank); 2407 ops->cursor_flash = (!blank);
2406 2408
2407 if (fb_blank(info, blank)) 2409 if (info->fbops->fb_blank)
2410 ret = info->fbops->fb_blank(blank, info);
2411 if (ret)
2408 fbcon_generic_blank(vc, info, blank); 2412 fbcon_generic_blank(vc, info, blank);
2409 } 2413 }
2410 2414
diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h
index a6e38e9ea73f..89a346880ec0 100644
--- a/drivers/video/console/fbcon.h
+++ b/drivers/video/console/fbcon.h
@@ -110,7 +110,7 @@ static inline int mono_col(const struct fb_info *info)
110 __u32 max_len; 110 __u32 max_len;
111 max_len = max(info->var.green.length, info->var.red.length); 111 max_len = max(info->var.green.length, info->var.red.length);
112 max_len = max(info->var.blue.length, max_len); 112 max_len = max(info->var.blue.length, max_len);
113 return ~(0xfff << (max_len & 0xff)); 113 return (~(0xfff << max_len)) & 0xff;
114} 114}
115 115
116static inline int attr_col_ec(int shift, struct vc_data *vc, 116static inline int attr_col_ec(int shift, struct vc_data *vc,
diff --git a/drivers/watchdog/geodewdt.c b/drivers/watchdog/geodewdt.c
index 614a5c7017b6..6799a6de66fe 100644
--- a/drivers/watchdog/geodewdt.c
+++ b/drivers/watchdog/geodewdt.c
@@ -130,8 +130,8 @@ static ssize_t geodewdt_write(struct file *file, const char __user *data,
130 return len; 130 return len;
131} 131}
132 132
133static int geodewdt_ioctl(struct inode *inode, struct file *file, 133static long geodewdt_ioctl(struct file *file, unsigned int cmd,
134 unsigned int cmd, unsigned long arg) 134 unsigned long arg)
135{ 135{
136 void __user *argp = (void __user *)arg; 136 void __user *argp = (void __user *)arg;
137 int __user *p = argp; 137 int __user *p = argp;
@@ -198,7 +198,7 @@ static const struct file_operations geodewdt_fops = {
198 .owner = THIS_MODULE, 198 .owner = THIS_MODULE,
199 .llseek = no_llseek, 199 .llseek = no_llseek,
200 .write = geodewdt_write, 200 .write = geodewdt_write,
201 .ioctl = geodewdt_ioctl, 201 .unlocked_ioctl = geodewdt_ioctl,
202 .open = geodewdt_open, 202 .open = geodewdt_open,
203 .release = geodewdt_release, 203 .release = geodewdt_release,
204}; 204};
diff --git a/drivers/watchdog/ibmasr.c b/drivers/watchdog/ibmasr.c
index b82405cfb4cd..89fcefcc8510 100644
--- a/drivers/watchdog/ibmasr.c
+++ b/drivers/watchdog/ibmasr.c
@@ -85,7 +85,6 @@ static void __asr_toggle(void)
85 85
86 outb(reg & ~asr_toggle_mask, asr_write_addr); 86 outb(reg & ~asr_toggle_mask, asr_write_addr);
87 reg = inb(asr_read_addr); 87 reg = inb(asr_read_addr);
88 spin_unlock(&asr_lock);
89} 88}
90 89
91static void asr_toggle(void) 90static void asr_toggle(void)
diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
index 0ed84162437b..6d9f3d4a9987 100644
--- a/drivers/watchdog/pnx4008_wdt.c
+++ b/drivers/watchdog/pnx4008_wdt.c
@@ -173,8 +173,8 @@ static const struct watchdog_info ident = {
173 .identity = "PNX4008 Watchdog", 173 .identity = "PNX4008 Watchdog",
174}; 174};
175 175
176static long pnx4008_wdt_ioctl(struct inode *inode, struct file *file, 176static long pnx4008_wdt_ioctl(struct file *file, unsigned int cmd,
177 unsigned int cmd, unsigned long arg) 177 unsigned long arg)
178{ 178{
179 int ret = -ENOTTY; 179 int ret = -ENOTTY;
180 int time; 180 int time;
diff --git a/drivers/watchdog/rc32434_wdt.c b/drivers/watchdog/rc32434_wdt.c
index 6756bcb009ed..c9c73b69c5e5 100644
--- a/drivers/watchdog/rc32434_wdt.c
+++ b/drivers/watchdog/rc32434_wdt.c
@@ -182,8 +182,8 @@ static ssize_t rc32434_wdt_write(struct file *file, const char *data,
182 return 0; 182 return 0;
183} 183}
184 184
185static int rc32434_wdt_ioctl(struct inode *inode, struct file *file, 185static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd,
186 unsigned int cmd, unsigned long arg) 186 unsigned long arg)
187{ 187{
188 void __user *argp = (void __user *)arg; 188 void __user *argp = (void __user *)arg;
189 int new_timeout; 189 int new_timeout;
@@ -242,7 +242,7 @@ static struct file_operations rc32434_wdt_fops = {
242 .owner = THIS_MODULE, 242 .owner = THIS_MODULE,
243 .llseek = no_llseek, 243 .llseek = no_llseek,
244 .write = rc32434_wdt_write, 244 .write = rc32434_wdt_write,
245 .ioctl = rc32434_wdt_ioctl, 245 .unlocked_ioctl = rc32434_wdt_ioctl,
246 .open = rc32434_wdt_open, 246 .open = rc32434_wdt_open,
247 .release = rc32434_wdt_release, 247 .release = rc32434_wdt_release,
248}; 248};
diff --git a/drivers/watchdog/rdc321x_wdt.c b/drivers/watchdog/rdc321x_wdt.c
index 9108efa73e7d..bf92802f2bbe 100644
--- a/drivers/watchdog/rdc321x_wdt.c
+++ b/drivers/watchdog/rdc321x_wdt.c
@@ -144,8 +144,8 @@ static int rdc321x_wdt_release(struct inode *inode, struct file *file)
144 return 0; 144 return 0;
145} 145}
146 146
147static int rdc321x_wdt_ioctl(struct inode *inode, struct file *file, 147static long rdc321x_wdt_ioctl(struct file *file, unsigned int cmd,
148 unsigned int cmd, unsigned long arg) 148 unsigned long arg)
149{ 149{
150 void __user *argp = (void __user *)arg; 150 void __user *argp = (void __user *)arg;
151 unsigned int value; 151 unsigned int value;
@@ -204,7 +204,7 @@ static ssize_t rdc321x_wdt_write(struct file *file, const char __user *buf,
204static const struct file_operations rdc321x_wdt_fops = { 204static const struct file_operations rdc321x_wdt_fops = {
205 .owner = THIS_MODULE, 205 .owner = THIS_MODULE,
206 .llseek = no_llseek, 206 .llseek = no_llseek,
207 .ioctl = rdc321x_wdt_ioctl, 207 .unlocked_ioctl = rdc321x_wdt_ioctl,
208 .open = rdc321x_wdt_open, 208 .open = rdc321x_wdt_open,
209 .write = rdc321x_wdt_write, 209 .write = rdc321x_wdt_write,
210 .release = rdc321x_wdt_release, 210 .release = rdc321x_wdt_release,
diff --git a/drivers/watchdog/wdt285.c b/drivers/watchdog/wdt285.c
index db362c34958b..191ea6302107 100644
--- a/drivers/watchdog/wdt285.c
+++ b/drivers/watchdog/wdt285.c
@@ -115,8 +115,8 @@ static int watchdog_release(struct inode *inode, struct file *file)
115 return 0; 115 return 0;
116} 116}
117 117
118static ssize_t watchdog_write(struct file *file, const char *data, 118static ssize_t watchdog_write(struct file *file, const char __user *data,
119 size_t len, loff_t *ppos) 119 size_t len, loff_t *ppos)
120{ 120{
121 /* 121 /*
122 * Refresh the timer. 122 * Refresh the timer.
@@ -133,21 +133,22 @@ static const struct watchdog_info ident = {
133}; 133};
134 134
135static long watchdog_ioctl(struct file *file, unsigned int cmd, 135static long watchdog_ioctl(struct file *file, unsigned int cmd,
136 unsigned long arg) 136 unsigned long arg)
137{ 137{
138 unsigned int new_margin; 138 unsigned int new_margin;
139 int __user *int_arg = (int __user *)arg;
139 int ret = -ENOTTY; 140 int ret = -ENOTTY;
140 141
141 switch (cmd) { 142 switch (cmd) {
142 case WDIOC_GETSUPPORT: 143 case WDIOC_GETSUPPORT:
143 ret = 0; 144 ret = 0;
144 if (copy_to_user((void *)arg, &ident, sizeof(ident))) 145 if (copy_to_user((void __user *)arg, &ident, sizeof(ident)))
145 ret = -EFAULT; 146 ret = -EFAULT;
146 break; 147 break;
147 148
148 case WDIOC_GETSTATUS: 149 case WDIOC_GETSTATUS:
149 case WDIOC_GETBOOTSTATUS: 150 case WDIOC_GETBOOTSTATUS:
150 ret = put_user(0, (int *)arg); 151 ret = put_user(0, int_arg);
151 break; 152 break;
152 153
153 case WDIOC_KEEPALIVE: 154 case WDIOC_KEEPALIVE:
@@ -156,7 +157,7 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
156 break; 157 break;
157 158
158 case WDIOC_SETTIMEOUT: 159 case WDIOC_SETTIMEOUT:
159 ret = get_user(new_margin, (int *)arg); 160 ret = get_user(new_margin, int_arg);
160 if (ret) 161 if (ret)
161 break; 162 break;
162 163
@@ -171,7 +172,7 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
171 watchdog_ping(); 172 watchdog_ping();
172 /* Fall */ 173 /* Fall */
173 case WDIOC_GETTIMEOUT: 174 case WDIOC_GETTIMEOUT:
174 ret = put_user(soft_margin, (int *)arg); 175 ret = put_user(soft_margin, int_arg);
175 break; 176 break;
176 } 177 }
177 return ret; 178 return ret;
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index c95295c65045..e83aa5ebe861 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -626,8 +626,7 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
626 return NULL; 626 return NULL;
627 627
628error: 628error:
629 if (fid) 629 p9_client_clunk(fid);
630 p9_client_clunk(fid);
631 630
632 return ERR_PTR(result); 631 return ERR_PTR(result);
633} 632}
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index 87ee5ccee348..ed8feb052df9 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -125,8 +125,8 @@ static int bfs_create(struct inode *dir, struct dentry *dentry, int mode,
125 inode->i_ino); 125 inode->i_ino);
126 if (err) { 126 if (err) {
127 inode_dec_link_count(inode); 127 inode_dec_link_count(inode);
128 iput(inode);
129 mutex_unlock(&info->bfs_lock); 128 mutex_unlock(&info->bfs_lock);
129 iput(inode);
130 return err; 130 return err;
131 } 131 }
132 mutex_unlock(&info->bfs_lock); 132 mutex_unlock(&info->bfs_lock);
diff --git a/fs/dcache.c b/fs/dcache.c
index 80e93956aced..e7a1a99b7464 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1395,6 +1395,10 @@ struct dentry * __d_lookup(struct dentry * parent, struct qstr * name)
1395 if (dentry->d_parent != parent) 1395 if (dentry->d_parent != parent)
1396 goto next; 1396 goto next;
1397 1397
1398 /* non-existing due to RCU? */
1399 if (d_unhashed(dentry))
1400 goto next;
1401
1398 /* 1402 /*
1399 * It is safe to compare names since d_move() cannot 1403 * It is safe to compare names since d_move() cannot
1400 * change the qstr (protected by d_lock). 1404 * change the qstr (protected by d_lock).
@@ -1410,10 +1414,8 @@ struct dentry * __d_lookup(struct dentry * parent, struct qstr * name)
1410 goto next; 1414 goto next;
1411 } 1415 }
1412 1416
1413 if (!d_unhashed(dentry)) { 1417 atomic_inc(&dentry->d_count);
1414 atomic_inc(&dentry->d_count); 1418 found = dentry;
1415 found = dentry;
1416 }
1417 spin_unlock(&dentry->d_lock); 1419 spin_unlock(&dentry->d_lock);
1418 break; 1420 break;
1419next: 1421next:
diff --git a/fs/exec.c b/fs/exec.c
index 32993beecbe9..cecee501ce78 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -752,11 +752,11 @@ static int exec_mmap(struct mm_struct *mm)
752 tsk->active_mm = mm; 752 tsk->active_mm = mm;
753 activate_mm(active_mm, mm); 753 activate_mm(active_mm, mm);
754 task_unlock(tsk); 754 task_unlock(tsk);
755 mm_update_next_owner(old_mm);
756 arch_pick_mmap_layout(mm); 755 arch_pick_mmap_layout(mm);
757 if (old_mm) { 756 if (old_mm) {
758 up_read(&old_mm->mmap_sem); 757 up_read(&old_mm->mmap_sem);
759 BUG_ON(active_mm != old_mm); 758 BUG_ON(active_mm != old_mm);
759 mm_update_next_owner(old_mm);
760 mmput(old_mm); 760 mmput(old_mm);
761 return 0; 761 return 0;
762 } 762 }
diff --git a/fs/inotify_user.c b/fs/inotify_user.c
index 60249429a253..d85c7d931cdf 100644
--- a/fs/inotify_user.c
+++ b/fs/inotify_user.c
@@ -323,7 +323,7 @@ out:
323} 323}
324 324
325/* 325/*
326 * remove_kevent - cleans up and ultimately frees the given kevent 326 * remove_kevent - cleans up the given kevent
327 * 327 *
328 * Caller must hold dev->ev_mutex. 328 * Caller must hold dev->ev_mutex.
329 */ 329 */
@@ -334,7 +334,13 @@ static void remove_kevent(struct inotify_device *dev,
334 334
335 dev->event_count--; 335 dev->event_count--;
336 dev->queue_size -= sizeof(struct inotify_event) + kevent->event.len; 336 dev->queue_size -= sizeof(struct inotify_event) + kevent->event.len;
337}
337 338
339/*
340 * free_kevent - frees the given kevent.
341 */
342static void free_kevent(struct inotify_kernel_event *kevent)
343{
338 kfree(kevent->name); 344 kfree(kevent->name);
339 kmem_cache_free(event_cachep, kevent); 345 kmem_cache_free(event_cachep, kevent);
340} 346}
@@ -350,6 +356,7 @@ static void inotify_dev_event_dequeue(struct inotify_device *dev)
350 struct inotify_kernel_event *kevent; 356 struct inotify_kernel_event *kevent;
351 kevent = inotify_dev_get_event(dev); 357 kevent = inotify_dev_get_event(dev);
352 remove_kevent(dev, kevent); 358 remove_kevent(dev, kevent);
359 free_kevent(kevent);
353 } 360 }
354} 361}
355 362
@@ -433,17 +440,15 @@ static ssize_t inotify_read(struct file *file, char __user *buf,
433 dev = file->private_data; 440 dev = file->private_data;
434 441
435 while (1) { 442 while (1) {
436 int events;
437 443
438 prepare_to_wait(&dev->wq, &wait, TASK_INTERRUPTIBLE); 444 prepare_to_wait(&dev->wq, &wait, TASK_INTERRUPTIBLE);
439 445
440 mutex_lock(&dev->ev_mutex); 446 mutex_lock(&dev->ev_mutex);
441 events = !list_empty(&dev->events); 447 if (!list_empty(&dev->events)) {
442 mutex_unlock(&dev->ev_mutex);
443 if (events) {
444 ret = 0; 448 ret = 0;
445 break; 449 break;
446 } 450 }
451 mutex_unlock(&dev->ev_mutex);
447 452
448 if (file->f_flags & O_NONBLOCK) { 453 if (file->f_flags & O_NONBLOCK) {
449 ret = -EAGAIN; 454 ret = -EAGAIN;
@@ -462,7 +467,6 @@ static ssize_t inotify_read(struct file *file, char __user *buf,
462 if (ret) 467 if (ret)
463 return ret; 468 return ret;
464 469
465 mutex_lock(&dev->ev_mutex);
466 while (1) { 470 while (1) {
467 struct inotify_kernel_event *kevent; 471 struct inotify_kernel_event *kevent;
468 472
@@ -481,6 +485,13 @@ static ssize_t inotify_read(struct file *file, char __user *buf,
481 } 485 }
482 break; 486 break;
483 } 487 }
488 remove_kevent(dev, kevent);
489
490 /*
491 * Must perform the copy_to_user outside the mutex in order
492 * to avoid a lock order reversal with mmap_sem.
493 */
494 mutex_unlock(&dev->ev_mutex);
484 495
485 if (copy_to_user(buf, &kevent->event, event_size)) { 496 if (copy_to_user(buf, &kevent->event, event_size)) {
486 ret = -EFAULT; 497 ret = -EFAULT;
@@ -498,7 +509,9 @@ static ssize_t inotify_read(struct file *file, char __user *buf,
498 count -= kevent->event.len; 509 count -= kevent->event.len;
499 } 510 }
500 511
501 remove_kevent(dev, kevent); 512 free_kevent(kevent);
513
514 mutex_lock(&dev->ev_mutex);
502 } 515 }
503 mutex_unlock(&dev->ev_mutex); 516 mutex_unlock(&dev->ev_mutex);
504 517
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 506c24fb5078..a53da1466277 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -594,7 +594,7 @@ static int ocfs2_direct_IO_get_blocks(struct inode *inode, sector_t iblock,
594 goto bail; 594 goto bail;
595 } 595 }
596 596
597 if (!ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb)) && !p_blkno) { 597 if (!ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb)) && !p_blkno && create) {
598 ocfs2_error(inode->i_sb, 598 ocfs2_error(inode->i_sb,
599 "Inode %llu has a hole at block %llu\n", 599 "Inode %llu has a hole at block %llu\n",
600 (unsigned long long)OCFS2_I(inode)->ip_blkno, 600 (unsigned long long)OCFS2_I(inode)->ip_blkno,
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 7d6b34e201db..ecc3330972e5 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -499,9 +499,9 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
499 if (!size) 499 if (!size)
500 continue; 500 continue;
501 if (from + size > get_capacity(disk)) { 501 if (from + size > get_capacity(disk)) {
502 printk(KERN_ERR " %s: p%d exceeds device capacity\n", 502 printk(KERN_WARNING
503 "%s: p%d exceeds device capacity\n",
503 disk->disk_name, p); 504 disk->disk_name, p);
504 continue;
505 } 505 }
506 res = add_partition(disk, p, from, size, state->parts[p].flags); 506 res = add_partition(disk, p, from, size, state->parts[p].flags);
507 if (res) { 507 if (res) {
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index bca0f81eb687..7821589a17d5 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -547,8 +547,8 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp
547 547
548 for (tmp = dir->subdir; tmp; tmp = tmp->next) 548 for (tmp = dir->subdir; tmp; tmp = tmp->next)
549 if (strcmp(tmp->name, dp->name) == 0) { 549 if (strcmp(tmp->name, dp->name) == 0) {
550 printk(KERN_WARNING "proc_dir_entry '%s' already " 550 printk(KERN_WARNING "proc_dir_entry '%s/%s' already registered\n",
551 "registered\n", dp->name); 551 dir->name, dp->name);
552 dump_stack(); 552 dump_stack();
553 break; 553 break;
554 } 554 }
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 00f10a2dcf12..29e20c6b1f7f 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -183,6 +183,9 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
183 "SReclaimable: %8lu kB\n" 183 "SReclaimable: %8lu kB\n"
184 "SUnreclaim: %8lu kB\n" 184 "SUnreclaim: %8lu kB\n"
185 "PageTables: %8lu kB\n" 185 "PageTables: %8lu kB\n"
186#ifdef CONFIG_QUICKLIST
187 "Quicklists: %8lu kB\n"
188#endif
186 "NFS_Unstable: %8lu kB\n" 189 "NFS_Unstable: %8lu kB\n"
187 "Bounce: %8lu kB\n" 190 "Bounce: %8lu kB\n"
188 "WritebackTmp: %8lu kB\n" 191 "WritebackTmp: %8lu kB\n"
@@ -190,8 +193,7 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
190 "Committed_AS: %8lu kB\n" 193 "Committed_AS: %8lu kB\n"
191 "VmallocTotal: %8lu kB\n" 194 "VmallocTotal: %8lu kB\n"
192 "VmallocUsed: %8lu kB\n" 195 "VmallocUsed: %8lu kB\n"
193 "VmallocChunk: %8lu kB\n" 196 "VmallocChunk: %8lu kB\n",
194 "Quicklists: %8lu kB\n",
195 K(i.totalram), 197 K(i.totalram),
196 K(i.freeram), 198 K(i.freeram),
197 K(i.bufferram), 199 K(i.bufferram),
@@ -216,6 +218,9 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
216 K(global_page_state(NR_SLAB_RECLAIMABLE)), 218 K(global_page_state(NR_SLAB_RECLAIMABLE)),
217 K(global_page_state(NR_SLAB_UNRECLAIMABLE)), 219 K(global_page_state(NR_SLAB_UNRECLAIMABLE)),
218 K(global_page_state(NR_PAGETABLE)), 220 K(global_page_state(NR_PAGETABLE)),
221#ifdef CONFIG_QUICKLIST
222 K(quicklist_total_size()),
223#endif
219 K(global_page_state(NR_UNSTABLE_NFS)), 224 K(global_page_state(NR_UNSTABLE_NFS)),
220 K(global_page_state(NR_BOUNCE)), 225 K(global_page_state(NR_BOUNCE)),
221 K(global_page_state(NR_WRITEBACK_TEMP)), 226 K(global_page_state(NR_WRITEBACK_TEMP)),
@@ -223,8 +228,7 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
223 K(committed), 228 K(committed),
224 (unsigned long)VMALLOC_TOTAL >> 10, 229 (unsigned long)VMALLOC_TOTAL >> 10,
225 vmi.used >> 10, 230 vmi.used >> 10,
226 vmi.largest_chunk >> 10, 231 vmi.largest_chunk >> 10
227 K(quicklist_total_size())
228 ); 232 );
229 233
230 len += hugetlb_report_meminfo(page + len); 234 len += hugetlb_report_meminfo(page + len);
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
index 52312ec93ff4..5145cb9125af 100644
--- a/fs/ramfs/file-nommu.c
+++ b/fs/ramfs/file-nommu.c
@@ -58,7 +58,7 @@ const struct inode_operations ramfs_file_inode_operations = {
58 * size 0 on the assumption that it's going to be used for an mmap of shared 58 * size 0 on the assumption that it's going to be used for an mmap of shared
59 * memory 59 * memory
60 */ 60 */
61static int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize) 61int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)
62{ 62{
63 struct pagevec lru_pvec; 63 struct pagevec lru_pvec;
64 unsigned long npages, xpages, loop, limit; 64 unsigned long npages, xpages, loop, limit;
diff --git a/fs/splice.c b/fs/splice.c
index 1bbc6f4bb09c..a1e701c27156 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -898,6 +898,9 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
898 if (unlikely(!(out->f_mode & FMODE_WRITE))) 898 if (unlikely(!(out->f_mode & FMODE_WRITE)))
899 return -EBADF; 899 return -EBADF;
900 900
901 if (unlikely(out->f_flags & O_APPEND))
902 return -EINVAL;
903
901 ret = rw_verify_area(WRITE, out, ppos, len); 904 ret = rw_verify_area(WRITE, out, ppos, len);
902 if (unlikely(ret < 0)) 905 if (unlikely(ret < 0))
903 return ret; 906 return ret;
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c
index b9cb77473758..d7f7645779f2 100644
--- a/fs/ubifs/debug.c
+++ b/fs/ubifs/debug.c
@@ -538,7 +538,7 @@ void dbg_dump_node(const struct ubifs_info *c, const void *node)
538 printk(KERN_DEBUG "\t%d orphan inode numbers:\n", n); 538 printk(KERN_DEBUG "\t%d orphan inode numbers:\n", n);
539 for (i = 0; i < n; i++) 539 for (i = 0; i < n; i++)
540 printk(KERN_DEBUG "\t ino %llu\n", 540 printk(KERN_DEBUG "\t ino %llu\n",
541 le64_to_cpu(orph->inos[i])); 541 (unsigned long long)le64_to_cpu(orph->inos[i]));
542 break; 542 break;
543 } 543 }
544 default: 544 default:
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 2b267c9a1806..526c01ec8003 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -426,7 +426,7 @@ static int ubifs_readdir(struct file *file, void *dirent, filldir_t filldir)
426 426
427 while (1) { 427 while (1) {
428 dbg_gen("feed '%s', ino %llu, new f_pos %#x", 428 dbg_gen("feed '%s', ino %llu, new f_pos %#x",
429 dent->name, le64_to_cpu(dent->inum), 429 dent->name, (unsigned long long)le64_to_cpu(dent->inum),
430 key_hash_flash(c, &dent->key)); 430 key_hash_flash(c, &dent->key));
431 ubifs_assert(dent->ch.sqnum > ubifs_inode(dir)->creat_sqnum); 431 ubifs_assert(dent->ch.sqnum > ubifs_inode(dir)->creat_sqnum);
432 432
diff --git a/fs/ubifs/find.c b/fs/ubifs/find.c
index e045c8b55423..47814cde2407 100644
--- a/fs/ubifs/find.c
+++ b/fs/ubifs/find.c
@@ -507,7 +507,6 @@ int ubifs_find_free_space(struct ubifs_info *c, int min_space, int *free,
507 rsvd_idx_lebs = 0; 507 rsvd_idx_lebs = 0;
508 lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt - 508 lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt -
509 c->lst.taken_empty_lebs; 509 c->lst.taken_empty_lebs;
510 ubifs_assert(lebs + c->lst.idx_lebs >= c->min_idx_lebs);
511 if (rsvd_idx_lebs < lebs) 510 if (rsvd_idx_lebs < lebs)
512 /* 511 /*
513 * OK to allocate an empty LEB, but we still don't want to go 512 * OK to allocate an empty LEB, but we still don't want to go
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c
index 13f1019c859f..02aba36fe3d4 100644
--- a/fs/ubifs/gc.c
+++ b/fs/ubifs/gc.c
@@ -334,15 +334,15 @@ int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp)
334 334
335 err = move_nodes(c, sleb); 335 err = move_nodes(c, sleb);
336 if (err) 336 if (err)
337 goto out; 337 goto out_inc_seq;
338 338
339 err = gc_sync_wbufs(c); 339 err = gc_sync_wbufs(c);
340 if (err) 340 if (err)
341 goto out; 341 goto out_inc_seq;
342 342
343 err = ubifs_change_one_lp(c, lnum, c->leb_size, 0, 0, 0, 0); 343 err = ubifs_change_one_lp(c, lnum, c->leb_size, 0, 0, 0, 0);
344 if (err) 344 if (err)
345 goto out; 345 goto out_inc_seq;
346 346
347 /* Allow for races with TNC */ 347 /* Allow for races with TNC */
348 c->gced_lnum = lnum; 348 c->gced_lnum = lnum;
@@ -369,6 +369,14 @@ int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp)
369out: 369out:
370 ubifs_scan_destroy(sleb); 370 ubifs_scan_destroy(sleb);
371 return err; 371 return err;
372
373out_inc_seq:
374 /* We may have moved at least some nodes so allow for races with TNC */
375 c->gced_lnum = lnum;
376 smp_wmb();
377 c->gc_seq += 1;
378 smp_wmb();
379 goto out;
372} 380}
373 381
374/** 382/**
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 7562464ac83f..3f4902060c7a 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1024,14 +1024,13 @@ static int mount_ubifs(struct ubifs_info *c)
1024 goto out_dereg; 1024 goto out_dereg;
1025 } 1025 }
1026 1026
1027 sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num, c->vi.vol_id);
1027 if (!mounted_read_only) { 1028 if (!mounted_read_only) {
1028 err = alloc_wbufs(c); 1029 err = alloc_wbufs(c);
1029 if (err) 1030 if (err)
1030 goto out_cbuf; 1031 goto out_cbuf;
1031 1032
1032 /* Create background thread */ 1033 /* Create background thread */
1033 sprintf(c->bgt_name, BGT_NAME_PATTERN, c->vi.ubi_num,
1034 c->vi.vol_id);
1035 c->bgt = kthread_create(ubifs_bg_thread, c, c->bgt_name); 1034 c->bgt = kthread_create(ubifs_bg_thread, c, c->bgt_name);
1036 if (!c->bgt) 1035 if (!c->bgt)
1037 c->bgt = ERR_PTR(-EINVAL); 1036 c->bgt = ERR_PTR(-EINVAL);
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c
index 7da209ab9378..7634c5970887 100644
--- a/fs/ubifs/tnc.c
+++ b/fs/ubifs/tnc.c
@@ -1476,7 +1476,7 @@ again:
1476 } 1476 }
1477 1477
1478 err = fallible_read_node(c, key, &zbr, node); 1478 err = fallible_read_node(c, key, &zbr, node);
1479 if (maybe_leb_gced(c, zbr.lnum, gc_seq1)) { 1479 if (err <= 0 || maybe_leb_gced(c, zbr.lnum, gc_seq1)) {
1480 /* 1480 /*
1481 * The node may have been GC'ed out from under us so try again 1481 * The node may have been GC'ed out from under us so try again
1482 * while keeping the TNC mutex locked. 1482 * while keeping the TNC mutex locked.
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 0ed6e146a0d9..eb91f3b70320 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -211,6 +211,7 @@ const struct file_operations udf_file_operations = {
211 .release = udf_release_file, 211 .release = udf_release_file,
212 .fsync = udf_fsync_file, 212 .fsync = udf_fsync_file,
213 .splice_read = generic_file_splice_read, 213 .splice_read = generic_file_splice_read,
214 .llseek = generic_file_llseek,
214}; 215};
215 216
216const struct inode_operations udf_file_inode_operations = { 217const struct inode_operations udf_file_inode_operations = {
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c
index eb9cfa23dc3d..a4f2b3ce45b0 100644
--- a/fs/udf/ialloc.c
+++ b/fs/udf/ialloc.c
@@ -76,11 +76,24 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
76 *err = -ENOSPC; 76 *err = -ENOSPC;
77 77
78 iinfo = UDF_I(inode); 78 iinfo = UDF_I(inode);
79 iinfo->i_unique = 0; 79 if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) {
80 iinfo->i_lenExtents = 0; 80 iinfo->i_efe = 1;
81 iinfo->i_next_alloc_block = 0; 81 if (UDF_VERS_USE_EXTENDED_FE > sbi->s_udfrev)
82 iinfo->i_next_alloc_goal = 0; 82 sbi->s_udfrev = UDF_VERS_USE_EXTENDED_FE;
83 iinfo->i_strat4096 = 0; 83 iinfo->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize -
84 sizeof(struct extendedFileEntry),
85 GFP_KERNEL);
86 } else {
87 iinfo->i_efe = 0;
88 iinfo->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize -
89 sizeof(struct fileEntry),
90 GFP_KERNEL);
91 }
92 if (!iinfo->i_ext.i_data) {
93 iput(inode);
94 *err = -ENOMEM;
95 return NULL;
96 }
84 97
85 block = udf_new_block(dir->i_sb, NULL, 98 block = udf_new_block(dir->i_sb, NULL,
86 dinfo->i_location.partitionReferenceNum, 99 dinfo->i_location.partitionReferenceNum,
@@ -111,6 +124,7 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
111 lvhd->uniqueID = cpu_to_le64(uniqueID); 124 lvhd->uniqueID = cpu_to_le64(uniqueID);
112 mark_buffer_dirty(sbi->s_lvid_bh); 125 mark_buffer_dirty(sbi->s_lvid_bh);
113 } 126 }
127 mutex_unlock(&sbi->s_alloc_mutex);
114 inode->i_mode = mode; 128 inode->i_mode = mode;
115 inode->i_uid = current->fsuid; 129 inode->i_uid = current->fsuid;
116 if (dir->i_mode & S_ISGID) { 130 if (dir->i_mode & S_ISGID) {
@@ -129,25 +143,6 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
129 iinfo->i_lenEAttr = 0; 143 iinfo->i_lenEAttr = 0;
130 iinfo->i_lenAlloc = 0; 144 iinfo->i_lenAlloc = 0;
131 iinfo->i_use = 0; 145 iinfo->i_use = 0;
132 if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) {
133 iinfo->i_efe = 1;
134 if (UDF_VERS_USE_EXTENDED_FE > sbi->s_udfrev)
135 sbi->s_udfrev = UDF_VERS_USE_EXTENDED_FE;
136 iinfo->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize -
137 sizeof(struct extendedFileEntry),
138 GFP_KERNEL);
139 } else {
140 iinfo->i_efe = 0;
141 iinfo->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize -
142 sizeof(struct fileEntry),
143 GFP_KERNEL);
144 }
145 if (!iinfo->i_ext.i_data) {
146 iput(inode);
147 *err = -ENOMEM;
148 mutex_unlock(&sbi->s_alloc_mutex);
149 return NULL;
150 }
151 if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB)) 146 if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB))
152 iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; 147 iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB;
153 else if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) 148 else if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
@@ -158,7 +153,6 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
158 iinfo->i_crtime = current_fs_time(inode->i_sb); 153 iinfo->i_crtime = current_fs_time(inode->i_sb);
159 insert_inode_hash(inode); 154 insert_inode_hash(inode);
160 mark_inode_dirty(inode); 155 mark_inode_dirty(inode);
161 mutex_unlock(&sbi->s_alloc_mutex);
162 156
163 if (DQUOT_ALLOC_INODE(inode)) { 157 if (DQUOT_ALLOC_INODE(inode)) {
164 DQUOT_DROP(inode); 158 DQUOT_DROP(inode);
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index f42f80a3b1fa..a44d68eb50b5 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -1338,6 +1338,10 @@ __xfs_get_blocks(
1338 offset = (xfs_off_t)iblock << inode->i_blkbits; 1338 offset = (xfs_off_t)iblock << inode->i_blkbits;
1339 ASSERT(bh_result->b_size >= (1 << inode->i_blkbits)); 1339 ASSERT(bh_result->b_size >= (1 << inode->i_blkbits));
1340 size = bh_result->b_size; 1340 size = bh_result->b_size;
1341
1342 if (!create && direct && offset >= i_size_read(inode))
1343 return 0;
1344
1341 error = xfs_iomap(XFS_I(inode), offset, size, 1345 error = xfs_iomap(XFS_I(inode), offset, size,
1342 create ? flags : BMAPI_READ, &iomap, &niomap); 1346 create ? flags : BMAPI_READ, &iomap, &niomap);
1343 if (error) 1347 if (error)
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 73c65f19e549..18d3c8487835 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -1302,9 +1302,29 @@ xfs_fs_remount(
1302 mp->m_flags &= ~XFS_MOUNT_BARRIER; 1302 mp->m_flags &= ~XFS_MOUNT_BARRIER;
1303 break; 1303 break;
1304 default: 1304 default:
1305 /*
1306 * Logically we would return an error here to prevent
1307 * users from believing they might have changed
1308 * mount options using remount which can't be changed.
1309 *
1310 * But unfortunately mount(8) adds all options from
1311 * mtab and fstab to the mount arguments in some cases
1312 * so we can't blindly reject options, but have to
1313 * check for each specified option if it actually
1314 * differs from the currently set option and only
1315 * reject it if that's the case.
1316 *
1317 * Until that is implemented we return success for
1318 * every remount request, and silently ignore all
1319 * options that we can't actually change.
1320 */
1321#if 0
1305 printk(KERN_INFO 1322 printk(KERN_INFO
1306 "XFS: mount option \"%s\" not supported for remount\n", p); 1323 "XFS: mount option \"%s\" not supported for remount\n", p);
1307 return -EINVAL; 1324 return -EINVAL;
1325#else
1326 return 0;
1327#endif
1308 } 1328 }
1309 } 1329 }
1310 1330
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index 608c30c3f76b..002fc2617c8e 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -732,6 +732,7 @@ xfs_buf_item_init(
732 bip->bli_item.li_ops = &xfs_buf_item_ops; 732 bip->bli_item.li_ops = &xfs_buf_item_ops;
733 bip->bli_item.li_mountp = mp; 733 bip->bli_item.li_mountp = mp;
734 bip->bli_buf = bp; 734 bip->bli_buf = bp;
735 xfs_buf_hold(bp);
735 bip->bli_format.blf_type = XFS_LI_BUF; 736 bip->bli_format.blf_type = XFS_LI_BUF;
736 bip->bli_format.blf_blkno = (__int64_t)XFS_BUF_ADDR(bp); 737 bip->bli_format.blf_blkno = (__int64_t)XFS_BUF_ADDR(bp);
737 bip->bli_format.blf_len = (ushort)BTOBB(XFS_BUF_COUNT(bp)); 738 bip->bli_format.blf_len = (ushort)BTOBB(XFS_BUF_COUNT(bp));
@@ -867,6 +868,21 @@ xfs_buf_item_dirty(
867 return (bip->bli_flags & XFS_BLI_DIRTY); 868 return (bip->bli_flags & XFS_BLI_DIRTY);
868} 869}
869 870
871STATIC void
872xfs_buf_item_free(
873 xfs_buf_log_item_t *bip)
874{
875#ifdef XFS_TRANS_DEBUG
876 kmem_free(bip->bli_orig);
877 kmem_free(bip->bli_logged);
878#endif /* XFS_TRANS_DEBUG */
879
880#ifdef XFS_BLI_TRACE
881 ktrace_free(bip->bli_trace);
882#endif
883 kmem_zone_free(xfs_buf_item_zone, bip);
884}
885
870/* 886/*
871 * This is called when the buf log item is no longer needed. It should 887 * This is called when the buf log item is no longer needed. It should
872 * free the buf log item associated with the given buffer and clear 888 * free the buf log item associated with the given buffer and clear
@@ -887,18 +903,8 @@ xfs_buf_item_relse(
887 (XFS_BUF_IODONE_FUNC(bp) != NULL)) { 903 (XFS_BUF_IODONE_FUNC(bp) != NULL)) {
888 XFS_BUF_CLR_IODONE_FUNC(bp); 904 XFS_BUF_CLR_IODONE_FUNC(bp);
889 } 905 }
890 906 xfs_buf_rele(bp);
891#ifdef XFS_TRANS_DEBUG 907 xfs_buf_item_free(bip);
892 kmem_free(bip->bli_orig);
893 bip->bli_orig = NULL;
894 kmem_free(bip->bli_logged);
895 bip->bli_logged = NULL;
896#endif /* XFS_TRANS_DEBUG */
897
898#ifdef XFS_BLI_TRACE
899 ktrace_free(bip->bli_trace);
900#endif
901 kmem_zone_free(xfs_buf_item_zone, bip);
902} 908}
903 909
904 910
@@ -1120,6 +1126,7 @@ xfs_buf_iodone(
1120 1126
1121 ASSERT(bip->bli_buf == bp); 1127 ASSERT(bip->bli_buf == bp);
1122 1128
1129 xfs_buf_rele(bp);
1123 mp = bip->bli_item.li_mountp; 1130 mp = bip->bli_item.li_mountp;
1124 1131
1125 /* 1132 /*
@@ -1136,18 +1143,7 @@ xfs_buf_iodone(
1136 * xfs_trans_delete_ail() drops the AIL lock. 1143 * xfs_trans_delete_ail() drops the AIL lock.
1137 */ 1144 */
1138 xfs_trans_delete_ail(mp, (xfs_log_item_t *)bip); 1145 xfs_trans_delete_ail(mp, (xfs_log_item_t *)bip);
1139 1146 xfs_buf_item_free(bip);
1140#ifdef XFS_TRANS_DEBUG
1141 kmem_free(bip->bli_orig);
1142 bip->bli_orig = NULL;
1143 kmem_free(bip->bli_logged);
1144 bip->bli_logged = NULL;
1145#endif /* XFS_TRANS_DEBUG */
1146
1147#ifdef XFS_BLI_TRACE
1148 ktrace_free(bip->bli_trace);
1149#endif
1150 kmem_zone_free(xfs_buf_item_zone, bip);
1151} 1147}
1152 1148
1153#if defined(XFS_BLI_TRACE) 1149#if defined(XFS_BLI_TRACE)
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
index 760f4c5b5160..75b0cd4da0ea 100644
--- a/fs/xfs/xfs_dfrag.c
+++ b/fs/xfs/xfs_dfrag.c
@@ -149,7 +149,14 @@ xfs_swap_extents(
149 149
150 sbp = &sxp->sx_stat; 150 sbp = &sxp->sx_stat;
151 151
152 xfs_lock_two_inodes(ip, tip, lock_flags); 152 /*
153 * we have to do two separate lock calls here to keep lockdep
154 * happy. If we try to get all the locks in one call, lock will
155 * report false positives when we drop the ILOCK and regain them
156 * below.
157 */
158 xfs_lock_two_inodes(ip, tip, XFS_IOLOCK_EXCL);
159 xfs_lock_two_inodes(ip, tip, XFS_ILOCK_EXCL);
153 locked = 1; 160 locked = 1;
154 161
155 /* Verify that both files have the same format */ 162 /* Verify that both files have the same format */
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 00e80df9dd9d..dbd9cef852ec 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -4118,7 +4118,7 @@ xfs_iext_indirect_to_direct(
4118 ASSERT(nextents <= XFS_LINEAR_EXTS); 4118 ASSERT(nextents <= XFS_LINEAR_EXTS);
4119 size = nextents * sizeof(xfs_bmbt_rec_t); 4119 size = nextents * sizeof(xfs_bmbt_rec_t);
4120 4120
4121 xfs_iext_irec_compact_full(ifp); 4121 xfs_iext_irec_compact_pages(ifp);
4122 ASSERT(ifp->if_real_bytes == XFS_IEXT_BUFSZ); 4122 ASSERT(ifp->if_real_bytes == XFS_IEXT_BUFSZ);
4123 4123
4124 ep = ifp->if_u1.if_ext_irec->er_extbuf; 4124 ep = ifp->if_u1.if_ext_irec->er_extbuf;
@@ -4449,8 +4449,7 @@ xfs_iext_irec_remove(
4449 * compaction policy is as follows: 4449 * compaction policy is as follows:
4450 * 4450 *
4451 * Full Compaction: Extents fit into a single page (or inline buffer) 4451 * Full Compaction: Extents fit into a single page (or inline buffer)
4452 * Full Compaction: Extents occupy less than 10% of allocated space 4452 * Partial Compaction: Extents occupy less than 50% of allocated space
4453 * Partial Compaction: Extents occupy > 10% and < 50% of allocated space
4454 * No Compaction: Extents occupy at least 50% of allocated space 4453 * No Compaction: Extents occupy at least 50% of allocated space
4455 */ 4454 */
4456void 4455void
@@ -4471,8 +4470,6 @@ xfs_iext_irec_compact(
4471 xfs_iext_direct_to_inline(ifp, nextents); 4470 xfs_iext_direct_to_inline(ifp, nextents);
4472 } else if (nextents <= XFS_LINEAR_EXTS) { 4471 } else if (nextents <= XFS_LINEAR_EXTS) {
4473 xfs_iext_indirect_to_direct(ifp); 4472 xfs_iext_indirect_to_direct(ifp);
4474 } else if (nextents < (nlists * XFS_LINEAR_EXTS) >> 3) {
4475 xfs_iext_irec_compact_full(ifp);
4476 } else if (nextents < (nlists * XFS_LINEAR_EXTS) >> 1) { 4473 } else if (nextents < (nlists * XFS_LINEAR_EXTS) >> 1) {
4477 xfs_iext_irec_compact_pages(ifp); 4474 xfs_iext_irec_compact_pages(ifp);
4478 } 4475 }
@@ -4496,7 +4493,7 @@ xfs_iext_irec_compact_pages(
4496 erp_next = erp + 1; 4493 erp_next = erp + 1;
4497 if (erp_next->er_extcount <= 4494 if (erp_next->er_extcount <=
4498 (XFS_LINEAR_EXTS - erp->er_extcount)) { 4495 (XFS_LINEAR_EXTS - erp->er_extcount)) {
4499 memmove(&erp->er_extbuf[erp->er_extcount], 4496 memcpy(&erp->er_extbuf[erp->er_extcount],
4500 erp_next->er_extbuf, erp_next->er_extcount * 4497 erp_next->er_extbuf, erp_next->er_extcount *
4501 sizeof(xfs_bmbt_rec_t)); 4498 sizeof(xfs_bmbt_rec_t));
4502 erp->er_extcount += erp_next->er_extcount; 4499 erp->er_extcount += erp_next->er_extcount;
@@ -4516,91 +4513,6 @@ xfs_iext_irec_compact_pages(
4516} 4513}
4517 4514
4518/* 4515/*
4519 * Fully compact the extent records managed by the indirection array.
4520 */
4521void
4522xfs_iext_irec_compact_full(
4523 xfs_ifork_t *ifp) /* inode fork pointer */
4524{
4525 xfs_bmbt_rec_host_t *ep, *ep_next; /* extent record pointers */
4526 xfs_ext_irec_t *erp, *erp_next; /* extent irec pointers */
4527 int erp_idx = 0; /* extent irec index */
4528 int ext_avail; /* empty entries in ex list */
4529 int ext_diff; /* number of exts to add */
4530 int nlists; /* number of irec's (ex lists) */
4531
4532 ASSERT(ifp->if_flags & XFS_IFEXTIREC);
4533
4534 nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ;
4535 erp = ifp->if_u1.if_ext_irec;
4536 ep = &erp->er_extbuf[erp->er_extcount];
4537 erp_next = erp + 1;
4538 ep_next = erp_next->er_extbuf;
4539
4540 while (erp_idx < nlists - 1) {
4541 /*
4542 * Check how many extent records are available in this irec.
4543 * If there is none skip the whole exercise.
4544 */
4545 ext_avail = XFS_LINEAR_EXTS - erp->er_extcount;
4546 if (ext_avail) {
4547
4548 /*
4549 * Copy over as many as possible extent records into
4550 * the previous page.
4551 */
4552 ext_diff = MIN(ext_avail, erp_next->er_extcount);
4553 memcpy(ep, ep_next, ext_diff * sizeof(xfs_bmbt_rec_t));
4554 erp->er_extcount += ext_diff;
4555 erp_next->er_extcount -= ext_diff;
4556
4557 /*
4558 * If the next irec is empty now we can simply
4559 * remove it.
4560 */
4561 if (erp_next->er_extcount == 0) {
4562 /*
4563 * Free page before removing extent record
4564 * so er_extoffs don't get modified in
4565 * xfs_iext_irec_remove.
4566 */
4567 kmem_free(erp_next->er_extbuf);
4568 erp_next->er_extbuf = NULL;
4569 xfs_iext_irec_remove(ifp, erp_idx + 1);
4570 erp = &ifp->if_u1.if_ext_irec[erp_idx];
4571 nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ;
4572
4573 /*
4574 * If the next irec is not empty move up the content
4575 * that has not been copied to the previous page to
4576 * the beggining of this one.
4577 */
4578 } else {
4579 memmove(erp_next->er_extbuf, &ep_next[ext_diff],
4580 erp_next->er_extcount *
4581 sizeof(xfs_bmbt_rec_t));
4582 ep_next = erp_next->er_extbuf;
4583 memset(&ep_next[erp_next->er_extcount], 0,
4584 (XFS_LINEAR_EXTS -
4585 erp_next->er_extcount) *
4586 sizeof(xfs_bmbt_rec_t));
4587 }
4588 }
4589
4590 if (erp->er_extcount == XFS_LINEAR_EXTS) {
4591 erp_idx++;
4592 if (erp_idx < nlists)
4593 erp = &ifp->if_u1.if_ext_irec[erp_idx];
4594 else
4595 break;
4596 }
4597 ep = &erp->er_extbuf[erp->er_extcount];
4598 erp_next = erp + 1;
4599 ep_next = erp_next->er_extbuf;
4600 }
4601}
4602
4603/*
4604 * This is called to update the er_extoff field in the indirection 4516 * This is called to update the er_extoff field in the indirection
4605 * array when extents have been added or removed from one of the 4517 * array when extents have been added or removed from one of the
4606 * extent lists. erp_idx contains the irec index to begin updating 4518 * extent lists. erp_idx contains the irec index to begin updating
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index ccba14eb9dbe..503ea89e8b9a 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -124,16 +124,27 @@ STATIC void xlog_verify_tail_lsn(xlog_t *log, xlog_in_core_t *iclog,
124STATIC int xlog_iclogs_empty(xlog_t *log); 124STATIC int xlog_iclogs_empty(xlog_t *log);
125 125
126#if defined(XFS_LOG_TRACE) 126#if defined(XFS_LOG_TRACE)
127
128#define XLOG_TRACE_LOGGRANT_SIZE 2048
129#define XLOG_TRACE_ICLOG_SIZE 256
130
131void
132xlog_trace_loggrant_alloc(xlog_t *log)
133{
134 log->l_grant_trace = ktrace_alloc(XLOG_TRACE_LOGGRANT_SIZE, KM_NOFS);
135}
136
137void
138xlog_trace_loggrant_dealloc(xlog_t *log)
139{
140 ktrace_free(log->l_grant_trace);
141}
142
127void 143void
128xlog_trace_loggrant(xlog_t *log, xlog_ticket_t *tic, xfs_caddr_t string) 144xlog_trace_loggrant(xlog_t *log, xlog_ticket_t *tic, xfs_caddr_t string)
129{ 145{
130 unsigned long cnts; 146 unsigned long cnts;
131 147
132 if (!log->l_grant_trace) {
133 log->l_grant_trace = ktrace_alloc(2048, KM_NOSLEEP);
134 if (!log->l_grant_trace)
135 return;
136 }
137 /* ticket counts are 1 byte each */ 148 /* ticket counts are 1 byte each */
138 cnts = ((unsigned long)tic->t_ocnt) | ((unsigned long)tic->t_cnt) << 8; 149 cnts = ((unsigned long)tic->t_ocnt) | ((unsigned long)tic->t_cnt) << 8;
139 150
@@ -157,10 +168,20 @@ xlog_trace_loggrant(xlog_t *log, xlog_ticket_t *tic, xfs_caddr_t string)
157} 168}
158 169
159void 170void
171xlog_trace_iclog_alloc(xlog_in_core_t *iclog)
172{
173 iclog->ic_trace = ktrace_alloc(XLOG_TRACE_ICLOG_SIZE, KM_NOFS);
174}
175
176void
177xlog_trace_iclog_dealloc(xlog_in_core_t *iclog)
178{
179 ktrace_free(iclog->ic_trace);
180}
181
182void
160xlog_trace_iclog(xlog_in_core_t *iclog, uint state) 183xlog_trace_iclog(xlog_in_core_t *iclog, uint state)
161{ 184{
162 if (!iclog->ic_trace)
163 iclog->ic_trace = ktrace_alloc(256, KM_NOFS);
164 ktrace_enter(iclog->ic_trace, 185 ktrace_enter(iclog->ic_trace,
165 (void *)((unsigned long)state), 186 (void *)((unsigned long)state),
166 (void *)((unsigned long)current_pid()), 187 (void *)((unsigned long)current_pid()),
@@ -170,8 +191,15 @@ xlog_trace_iclog(xlog_in_core_t *iclog, uint state)
170 (void *)NULL, (void *)NULL); 191 (void *)NULL, (void *)NULL);
171} 192}
172#else 193#else
194
195#define xlog_trace_loggrant_alloc(log)
196#define xlog_trace_loggrant_dealloc(log)
173#define xlog_trace_loggrant(log,tic,string) 197#define xlog_trace_loggrant(log,tic,string)
198
199#define xlog_trace_iclog_alloc(iclog)
200#define xlog_trace_iclog_dealloc(iclog)
174#define xlog_trace_iclog(iclog,state) 201#define xlog_trace_iclog(iclog,state)
202
175#endif /* XFS_LOG_TRACE */ 203#endif /* XFS_LOG_TRACE */
176 204
177 205
@@ -1009,7 +1037,7 @@ xlog_iodone(xfs_buf_t *bp)
1009 * layer, it means the underlyin device no longer supports 1037 * layer, it means the underlyin device no longer supports
1010 * barrier I/O. Warn loudly and turn off barriers. 1038 * barrier I/O. Warn loudly and turn off barriers.
1011 */ 1039 */
1012 if ((l->l_mp->m_flags & XFS_MOUNT_BARRIER) && !XFS_BUF_ORDERED(bp)) { 1040 if ((l->l_mp->m_flags & XFS_MOUNT_BARRIER) && !XFS_BUF_ISORDERED(bp)) {
1013 l->l_mp->m_flags &= ~XFS_MOUNT_BARRIER; 1041 l->l_mp->m_flags &= ~XFS_MOUNT_BARRIER;
1014 xfs_fs_cmn_err(CE_WARN, l->l_mp, 1042 xfs_fs_cmn_err(CE_WARN, l->l_mp,
1015 "xlog_iodone: Barriers are no longer supported" 1043 "xlog_iodone: Barriers are no longer supported"
@@ -1231,6 +1259,7 @@ xlog_alloc_log(xfs_mount_t *mp,
1231 spin_lock_init(&log->l_grant_lock); 1259 spin_lock_init(&log->l_grant_lock);
1232 sv_init(&log->l_flush_wait, 0, "flush_wait"); 1260 sv_init(&log->l_flush_wait, 0, "flush_wait");
1233 1261
1262 xlog_trace_loggrant_alloc(log);
1234 /* log record size must be multiple of BBSIZE; see xlog_rec_header_t */ 1263 /* log record size must be multiple of BBSIZE; see xlog_rec_header_t */
1235 ASSERT((XFS_BUF_SIZE(bp) & BBMASK) == 0); 1264 ASSERT((XFS_BUF_SIZE(bp) & BBMASK) == 0);
1236 1265
@@ -1285,6 +1314,8 @@ xlog_alloc_log(xfs_mount_t *mp,
1285 sv_init(&iclog->ic_force_wait, SV_DEFAULT, "iclog-force"); 1314 sv_init(&iclog->ic_force_wait, SV_DEFAULT, "iclog-force");
1286 sv_init(&iclog->ic_write_wait, SV_DEFAULT, "iclog-write"); 1315 sv_init(&iclog->ic_write_wait, SV_DEFAULT, "iclog-write");
1287 1316
1317 xlog_trace_iclog_alloc(iclog);
1318
1288 iclogp = &iclog->ic_next; 1319 iclogp = &iclog->ic_next;
1289 } 1320 }
1290 *iclogp = log->l_iclog; /* complete ring */ 1321 *iclogp = log->l_iclog; /* complete ring */
@@ -1565,11 +1596,7 @@ xlog_dealloc_log(xlog_t *log)
1565 sv_destroy(&iclog->ic_force_wait); 1596 sv_destroy(&iclog->ic_force_wait);
1566 sv_destroy(&iclog->ic_write_wait); 1597 sv_destroy(&iclog->ic_write_wait);
1567 xfs_buf_free(iclog->ic_bp); 1598 xfs_buf_free(iclog->ic_bp);
1568#ifdef XFS_LOG_TRACE 1599 xlog_trace_iclog_dealloc(iclog);
1569 if (iclog->ic_trace != NULL) {
1570 ktrace_free(iclog->ic_trace);
1571 }
1572#endif
1573 next_iclog = iclog->ic_next; 1600 next_iclog = iclog->ic_next;
1574 kmem_free(iclog); 1601 kmem_free(iclog);
1575 iclog = next_iclog; 1602 iclog = next_iclog;
@@ -1578,14 +1605,7 @@ xlog_dealloc_log(xlog_t *log)
1578 spinlock_destroy(&log->l_grant_lock); 1605 spinlock_destroy(&log->l_grant_lock);
1579 1606
1580 xfs_buf_free(log->l_xbuf); 1607 xfs_buf_free(log->l_xbuf);
1581#ifdef XFS_LOG_TRACE 1608 xlog_trace_loggrant_dealloc(log);
1582 if (log->l_trace != NULL) {
1583 ktrace_free(log->l_trace);
1584 }
1585 if (log->l_grant_trace != NULL) {
1586 ktrace_free(log->l_grant_trace);
1587 }
1588#endif
1589 log->l_mp->m_log = NULL; 1609 log->l_mp->m_log = NULL;
1590 kmem_free(log); 1610 kmem_free(log);
1591} /* xlog_dealloc_log */ 1611} /* xlog_dealloc_log */
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index c8a5b22ee3e3..e7d8f84443fa 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -448,7 +448,6 @@ typedef struct log {
448 int l_grant_write_bytes; 448 int l_grant_write_bytes;
449 449
450#ifdef XFS_LOG_TRACE 450#ifdef XFS_LOG_TRACE
451 struct ktrace *l_trace;
452 struct ktrace *l_grant_trace; 451 struct ktrace *l_grant_trace;
453#endif 452#endif
454 453
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index aa238c8fbd7a..8b6812f66a15 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -1838,6 +1838,12 @@ again:
1838#endif 1838#endif
1839} 1839}
1840 1840
1841/*
1842 * xfs_lock_two_inodes() can only be used to lock one type of lock
1843 * at a time - the iolock or the ilock, but not both at once. If
1844 * we lock both at once, lockdep will report false positives saying
1845 * we have violated locking orders.
1846 */
1841void 1847void
1842xfs_lock_two_inodes( 1848xfs_lock_two_inodes(
1843 xfs_inode_t *ip0, 1849 xfs_inode_t *ip0,
@@ -1848,6 +1854,8 @@ xfs_lock_two_inodes(
1848 int attempts = 0; 1854 int attempts = 0;
1849 xfs_log_item_t *lp; 1855 xfs_log_item_t *lp;
1850 1856
1857 if (lock_mode & (XFS_IOLOCK_SHARED|XFS_IOLOCK_EXCL))
1858 ASSERT((lock_mode & (XFS_ILOCK_SHARED|XFS_ILOCK_EXCL)) == 0);
1851 ASSERT(ip0->i_ino != ip1->i_ino); 1859 ASSERT(ip0->i_ino != ip1->i_ino);
1852 1860
1853 if (ip0->i_ino > ip1->i_ino) { 1861 if (ip0->i_ino > ip1->i_ino) {
@@ -3152,6 +3160,13 @@ error1: /* Just cancel transaction */
3152/* 3160/*
3153 * Zero file bytes between startoff and endoff inclusive. 3161 * Zero file bytes between startoff and endoff inclusive.
3154 * The iolock is held exclusive and no blocks are buffered. 3162 * The iolock is held exclusive and no blocks are buffered.
3163 *
3164 * This function is used by xfs_free_file_space() to zero
3165 * partial blocks when the range to free is not block aligned.
3166 * When unreserving space with boundaries that are not block
3167 * aligned we round up the start and round down the end
3168 * boundaries and then use this function to zero the parts of
3169 * the blocks that got dropped during the rounding.
3155 */ 3170 */
3156STATIC int 3171STATIC int
3157xfs_zero_remaining_bytes( 3172xfs_zero_remaining_bytes(
@@ -3168,6 +3183,17 @@ xfs_zero_remaining_bytes(
3168 int nimap; 3183 int nimap;
3169 int error = 0; 3184 int error = 0;
3170 3185
3186 /*
3187 * Avoid doing I/O beyond eof - it's not necessary
3188 * since nothing can read beyond eof. The space will
3189 * be zeroed when the file is extended anyway.
3190 */
3191 if (startoff >= ip->i_size)
3192 return 0;
3193
3194 if (endoff > ip->i_size)
3195 endoff = ip->i_size;
3196
3171 bp = xfs_buf_get_noaddr(mp->m_sb.sb_blocksize, 3197 bp = xfs_buf_get_noaddr(mp->m_sb.sb_blocksize,
3172 XFS_IS_REALTIME_INODE(ip) ? 3198 XFS_IS_REALTIME_INODE(ip) ?
3173 mp->m_rtdev_targp : mp->m_ddev_targp); 3199 mp->m_rtdev_targp : mp->m_ddev_targp);
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index a3f738cffdb6..edc6ba82e090 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -97,6 +97,16 @@ extern void warn_slowpath(const char *file, const int line,
97 unlikely(__ret_warn_once); \ 97 unlikely(__ret_warn_once); \
98}) 98})
99 99
100#define WARN_ONCE(condition, format...) ({ \
101 static int __warned; \
102 int __ret_warn_once = !!(condition); \
103 \
104 if (unlikely(__ret_warn_once)) \
105 if (WARN(!__warned, format)) \
106 __warned = 1; \
107 unlikely(__ret_warn_once); \
108})
109
100#define WARN_ON_RATELIMIT(condition, state) \ 110#define WARN_ON_RATELIMIT(condition, state) \
101 WARN_ON((condition) && __ratelimit(state)) 111 WARN_ON((condition) && __ratelimit(state))
102 112
diff --git a/include/asm-mips/cevt-r4k.h b/include/asm-mips/cevt-r4k.h
new file mode 100644
index 000000000000..fa4328f9124f
--- /dev/null
+++ b/include/asm-mips/cevt-r4k.h
@@ -0,0 +1,46 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2008 Kevin D. Kissell
7 */
8
9/*
10 * Definitions used for common event timer implementation
11 * for MIPS 4K-type processors and their MIPS MT variants.
12 * Avoids unsightly extern declarations in C files.
13 */
14#ifndef __ASM_CEVT_R4K_H
15#define __ASM_CEVT_R4K_H
16
17DECLARE_PER_CPU(struct clock_event_device, mips_clockevent_device);
18
19void mips_event_handler(struct clock_event_device *dev);
20int c0_compare_int_usable(void);
21void mips_set_clock_mode(enum clock_event_mode, struct clock_event_device *);
22irqreturn_t c0_compare_interrupt(int, void *);
23
24extern struct irqaction c0_compare_irqaction;
25extern int cp0_timer_irq_installed;
26
27/*
28 * Possibly handle a performance counter interrupt.
29 * Return true if the timer interrupt should not be checked
30 */
31
32static inline int handle_perf_irq(int r2)
33{
34 /*
35 * The performance counter overflow interrupt may be shared with the
36 * timer interrupt (cp0_perfcount_irq < 0). If it is and a
37 * performance counter has overflowed (perf_irq() == IRQ_HANDLED)
38 * and we can't reliably determine if a counter interrupt has also
39 * happened (!r2) then don't check for a timer interrupt.
40 */
41 return (cp0_perfcount_irq < 0) &&
42 perf_irq() == IRQ_HANDLED &&
43 !r2;
44}
45
46#endif /* __ASM_CEVT_R4K_H */
diff --git a/include/asm-mips/irqflags.h b/include/asm-mips/irqflags.h
index 881e8866501d..701ec0ba8fa9 100644
--- a/include/asm-mips/irqflags.h
+++ b/include/asm-mips/irqflags.h
@@ -38,8 +38,17 @@ __asm__(
38 " .set pop \n" 38 " .set pop \n"
39 " .endm"); 39 " .endm");
40 40
41extern void smtc_ipi_replay(void);
42
41static inline void raw_local_irq_enable(void) 43static inline void raw_local_irq_enable(void)
42{ 44{
45#ifdef CONFIG_MIPS_MT_SMTC
46 /*
47 * SMTC kernel needs to do a software replay of queued
48 * IPIs, at the cost of call overhead on each local_irq_enable()
49 */
50 smtc_ipi_replay();
51#endif
43 __asm__ __volatile__( 52 __asm__ __volatile__(
44 "raw_local_irq_enable" 53 "raw_local_irq_enable"
45 : /* no outputs */ 54 : /* no outputs */
@@ -47,6 +56,7 @@ static inline void raw_local_irq_enable(void)
47 : "memory"); 56 : "memory");
48} 57}
49 58
59
50/* 60/*
51 * For cli() we have to insert nops to make sure that the new value 61 * For cli() we have to insert nops to make sure that the new value
52 * has actually arrived in the status register before the end of this 62 * has actually arrived in the status register before the end of this
@@ -185,15 +195,14 @@ __asm__(
185 " .set pop \n" 195 " .set pop \n"
186 " .endm \n"); 196 " .endm \n");
187 197
188extern void smtc_ipi_replay(void);
189 198
190static inline void raw_local_irq_restore(unsigned long flags) 199static inline void raw_local_irq_restore(unsigned long flags)
191{ 200{
192 unsigned long __tmp1; 201 unsigned long __tmp1;
193 202
194#ifdef CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY 203#ifdef CONFIG_MIPS_MT_SMTC
195 /* 204 /*
196 * CONFIG_MIPS_MT_SMTC_INSTANT_REPLAY does prompt replay of deferred 205 * SMTC kernel needs to do a software replay of queued
197 * IPIs, at the cost of branch and call overhead on each 206 * IPIs, at the cost of branch and call overhead on each
198 * local_irq_restore() 207 * local_irq_restore()
199 */ 208 */
@@ -208,6 +217,17 @@ static inline void raw_local_irq_restore(unsigned long flags)
208 : "memory"); 217 : "memory");
209} 218}
210 219
220static inline void __raw_local_irq_restore(unsigned long flags)
221{
222 unsigned long __tmp1;
223
224 __asm__ __volatile__(
225 "raw_local_irq_restore\t%0"
226 : "=r" (__tmp1)
227 : "0" (flags)
228 : "memory");
229}
230
211static inline int raw_irqs_disabled_flags(unsigned long flags) 231static inline int raw_irqs_disabled_flags(unsigned long flags)
212{ 232{
213#ifdef CONFIG_MIPS_MT_SMTC 233#ifdef CONFIG_MIPS_MT_SMTC
diff --git a/include/asm-mips/mipsregs.h b/include/asm-mips/mipsregs.h
index a46f8e258e6b..979866000da4 100644
--- a/include/asm-mips/mipsregs.h
+++ b/include/asm-mips/mipsregs.h
@@ -1462,7 +1462,7 @@ set_c0_##name(unsigned int set) \
1462{ \ 1462{ \
1463 unsigned int res; \ 1463 unsigned int res; \
1464 unsigned int omt; \ 1464 unsigned int omt; \
1465 unsigned int flags; \ 1465 unsigned long flags; \
1466 \ 1466 \
1467 local_irq_save(flags); \ 1467 local_irq_save(flags); \
1468 omt = __dmt(); \ 1468 omt = __dmt(); \
@@ -1480,7 +1480,7 @@ clear_c0_##name(unsigned int clear) \
1480{ \ 1480{ \
1481 unsigned int res; \ 1481 unsigned int res; \
1482 unsigned int omt; \ 1482 unsigned int omt; \
1483 unsigned int flags; \ 1483 unsigned long flags; \
1484 \ 1484 \
1485 local_irq_save(flags); \ 1485 local_irq_save(flags); \
1486 omt = __dmt(); \ 1486 omt = __dmt(); \
@@ -1498,7 +1498,7 @@ change_c0_##name(unsigned int change, unsigned int new) \
1498{ \ 1498{ \
1499 unsigned int res; \ 1499 unsigned int res; \
1500 unsigned int omt; \ 1500 unsigned int omt; \
1501 unsigned int flags; \ 1501 unsigned long flags; \
1502 \ 1502 \
1503 local_irq_save(flags); \ 1503 local_irq_save(flags); \
1504 \ 1504 \
diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h
index 4396e9ffd418..55813d6150c7 100644
--- a/include/asm-mips/pgtable-32.h
+++ b/include/asm-mips/pgtable-32.h
@@ -57,7 +57,7 @@ extern int add_temporary_entry(unsigned long entrylo0, unsigned long entrylo1,
57#define PMD_ORDER 1 57#define PMD_ORDER 1
58#define PTE_ORDER 0 58#define PTE_ORDER 0
59 59
60#define PTRS_PER_PGD ((PAGE_SIZE << PGD_ORDER) / sizeof(pgd_t)) 60#define PTRS_PER_PGD (USER_PTRS_PER_PGD * 2)
61#define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t)) 61#define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t))
62 62
63#define USER_PTRS_PER_PGD (0x80000000UL/PGDIR_SIZE) 63#define USER_PTRS_PER_PGD (0x80000000UL/PGDIR_SIZE)
diff --git a/include/asm-mips/smtc.h b/include/asm-mips/smtc.h
index 3639b28f80db..ea60bf08dcb0 100644
--- a/include/asm-mips/smtc.h
+++ b/include/asm-mips/smtc.h
@@ -6,6 +6,7 @@
6 */ 6 */
7 7
8#include <asm/mips_mt.h> 8#include <asm/mips_mt.h>
9#include <asm/smtc_ipi.h>
9 10
10/* 11/*
11 * System-wide SMTC status information 12 * System-wide SMTC status information
@@ -38,14 +39,15 @@ struct mm_struct;
38struct task_struct; 39struct task_struct;
39 40
40void smtc_get_new_mmu_context(struct mm_struct *mm, unsigned long cpu); 41void smtc_get_new_mmu_context(struct mm_struct *mm, unsigned long cpu);
41 42void self_ipi(struct smtc_ipi *);
42void smtc_flush_tlb_asid(unsigned long asid); 43void smtc_flush_tlb_asid(unsigned long asid);
43extern int mipsmt_build_cpu_map(int startslot); 44extern int smtc_build_cpu_map(int startslot);
44extern void mipsmt_prepare_cpus(void); 45extern void smtc_prepare_cpus(int cpus);
45extern void smtc_smp_finish(void); 46extern void smtc_smp_finish(void);
46extern void smtc_boot_secondary(int cpu, struct task_struct *t); 47extern void smtc_boot_secondary(int cpu, struct task_struct *t);
47extern void smtc_cpus_done(void); 48extern void smtc_cpus_done(void);
48 49
50
49/* 51/*
50 * Sharing the TLB between multiple VPEs means that the 52 * Sharing the TLB between multiple VPEs means that the
51 * "random" index selection function is not allowed to 53 * "random" index selection function is not allowed to
diff --git a/include/asm-mips/sn/mapped_kernel.h b/include/asm-mips/sn/mapped_kernel.h
index c3dd5d0d525f..721496a0bb92 100644
--- a/include/asm-mips/sn/mapped_kernel.h
+++ b/include/asm-mips/sn/mapped_kernel.h
@@ -5,6 +5,8 @@
5#ifndef __ASM_SN_MAPPED_KERNEL_H 5#ifndef __ASM_SN_MAPPED_KERNEL_H
6#define __ASM_SN_MAPPED_KERNEL_H 6#define __ASM_SN_MAPPED_KERNEL_H
7 7
8#include <linux/mmzone.h>
9
8/* 10/*
9 * Note on how mapped kernels work: the text and data section is 11 * Note on how mapped kernels work: the text and data section is
10 * compiled at cksseg segment (LOADADDR = 0xc001c000), and the 12 * compiled at cksseg segment (LOADADDR = 0xc001c000), and the
@@ -29,10 +31,8 @@
29#define MAPPED_ADDR_RO_TO_PHYS(x) (x - REP_BASE) 31#define MAPPED_ADDR_RO_TO_PHYS(x) (x - REP_BASE)
30#define MAPPED_ADDR_RW_TO_PHYS(x) (x - REP_BASE - 16777216) 32#define MAPPED_ADDR_RW_TO_PHYS(x) (x - REP_BASE - 16777216)
31 33
32#define MAPPED_KERN_RO_PHYSBASE(n) \ 34#define MAPPED_KERN_RO_PHYSBASE(n) (hub_data(n)->kern_vars.kv_ro_baseaddr)
33 (PLAT_NODE_DATA(n)->kern_vars.kv_ro_baseaddr) 35#define MAPPED_KERN_RW_PHYSBASE(n) (hub_data(n)->kern_vars.kv_rw_baseaddr)
34#define MAPPED_KERN_RW_PHYSBASE(n) \
35 (PLAT_NODE_DATA(n)->kern_vars.kv_rw_baseaddr)
36 36
37#define MAPPED_KERN_RO_TO_PHYS(x) \ 37#define MAPPED_KERN_RO_TO_PHYS(x) \
38 ((unsigned long)MAPPED_ADDR_RO_TO_PHYS(x) | \ 38 ((unsigned long)MAPPED_ADDR_RO_TO_PHYS(x) | \
diff --git a/include/asm-mips/stackframe.h b/include/asm-mips/stackframe.h
index 051e1af0bb95..4c37c4e5f72e 100644
--- a/include/asm-mips/stackframe.h
+++ b/include/asm-mips/stackframe.h
@@ -297,14 +297,31 @@
297#ifdef CONFIG_MIPS_MT_SMTC 297#ifdef CONFIG_MIPS_MT_SMTC
298 .set mips32r2 298 .set mips32r2
299 /* 299 /*
300 * This may not really be necessary if ints are already 300 * We need to make sure the read-modify-write
301 * inhibited here. 301 * of Status below isn't perturbed by an interrupt
302 * or cross-TC access, so we need to do at least a DMT,
303 * protected by an interrupt-inhibit. But setting IXMT
304 * also creates a few-cycle window where an IPI could
305 * be queued and not be detected before potentially
306 * returning to a WAIT or user-mode loop. It must be
307 * replayed.
308 *
309 * We're in the middle of a context switch, and
310 * we can't dispatch it directly without trashing
311 * some registers, so we'll try to detect this unlikely
312 * case and program a software interrupt in the VPE,
313 * as would be done for a cross-VPE IPI. To accomodate
314 * the handling of that case, we're doing a DVPE instead
315 * of just a DMT here to protect against other threads.
316 * This is a lot of cruft to cover a tiny window.
317 * If you can find a better design, implement it!
318 *
302 */ 319 */
303 mfc0 v0, CP0_TCSTATUS 320 mfc0 v0, CP0_TCSTATUS
304 ori v0, TCSTATUS_IXMT 321 ori v0, TCSTATUS_IXMT
305 mtc0 v0, CP0_TCSTATUS 322 mtc0 v0, CP0_TCSTATUS
306 _ehb 323 _ehb
307 DMT 5 # dmt a1 324 DVPE 5 # dvpe a1
308 jal mips_ihb 325 jal mips_ihb
309#endif /* CONFIG_MIPS_MT_SMTC */ 326#endif /* CONFIG_MIPS_MT_SMTC */
310 mfc0 a0, CP0_STATUS 327 mfc0 a0, CP0_STATUS
@@ -325,17 +342,50 @@
325 */ 342 */
326 LONG_L v1, PT_TCSTATUS(sp) 343 LONG_L v1, PT_TCSTATUS(sp)
327 _ehb 344 _ehb
328 mfc0 v0, CP0_TCSTATUS 345 mfc0 a0, CP0_TCSTATUS
329 andi v1, TCSTATUS_IXMT 346 andi v1, TCSTATUS_IXMT
330 /* We know that TCStatua.IXMT should be set from above */ 347 bnez v1, 0f
331 xori v0, v0, TCSTATUS_IXMT 348
332 or v0, v0, v1 349/*
333 mtc0 v0, CP0_TCSTATUS 350 * We'd like to detect any IPIs queued in the tiny window
334 _ehb 351 * above and request an software interrupt to service them
335 andi a1, a1, VPECONTROL_TE 352 * when we ERET.
353 *
354 * Computing the offset into the IPIQ array of the executing
355 * TC's IPI queue in-line would be tedious. We use part of
356 * the TCContext register to hold 16 bits of offset that we
357 * can add in-line to find the queue head.
358 */
359 mfc0 v0, CP0_TCCONTEXT
360 la a2, IPIQ
361 srl v0, v0, 16
362 addu a2, a2, v0
363 LONG_L v0, 0(a2)
364 beqz v0, 0f
365/*
366 * If we have a queue, provoke dispatch within the VPE by setting C_SW1
367 */
368 mfc0 v0, CP0_CAUSE
369 ori v0, v0, C_SW1
370 mtc0 v0, CP0_CAUSE
3710:
372 /*
373 * This test should really never branch but
374 * let's be prudent here. Having atomized
375 * the shared register modifications, we can
376 * now EVPE, and must do so before interrupts
377 * are potentially re-enabled.
378 */
379 andi a1, a1, MVPCONTROL_EVP
336 beqz a1, 1f 380 beqz a1, 1f
337 emt 381 evpe
3381: 3821:
383 /* We know that TCStatua.IXMT should be set from above */
384 xori a0, a0, TCSTATUS_IXMT
385 or a0, a0, v1
386 mtc0 a0, CP0_TCSTATUS
387 _ehb
388
339 .set mips0 389 .set mips0
340#endif /* CONFIG_MIPS_MT_SMTC */ 390#endif /* CONFIG_MIPS_MT_SMTC */
341 LONG_L v1, PT_EPC(sp) 391 LONG_L v1, PT_EPC(sp)
diff --git a/include/asm-x86/acpi.h b/include/asm-x86/acpi.h
index bd76299586b3..392e17336be1 100644
--- a/include/asm-x86/acpi.h
+++ b/include/asm-x86/acpi.h
@@ -140,6 +140,8 @@ static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate)
140 boot_cpu_data.x86_model <= 0x05 && 140 boot_cpu_data.x86_model <= 0x05 &&
141 boot_cpu_data.x86_mask < 0x0A) 141 boot_cpu_data.x86_mask < 0x0A)
142 return 1; 142 return 1;
143 else if (boot_cpu_has(X86_FEATURE_AMDC1E))
144 return 1;
143 else 145 else
144 return max_cstate; 146 return max_cstate;
145} 147}
diff --git a/include/asm-x86/amd_iommu.h b/include/asm-x86/amd_iommu.h
index 783f43e58052..041d0db7da27 100644
--- a/include/asm-x86/amd_iommu.h
+++ b/include/asm-x86/amd_iommu.h
@@ -20,10 +20,13 @@
20#ifndef ASM_X86__AMD_IOMMU_H 20#ifndef ASM_X86__AMD_IOMMU_H
21#define ASM_X86__AMD_IOMMU_H 21#define ASM_X86__AMD_IOMMU_H
22 22
23#include <linux/irqreturn.h>
24
23#ifdef CONFIG_AMD_IOMMU 25#ifdef CONFIG_AMD_IOMMU
24extern int amd_iommu_init(void); 26extern int amd_iommu_init(void);
25extern int amd_iommu_init_dma_ops(void); 27extern int amd_iommu_init_dma_ops(void);
26extern void amd_iommu_detect(void); 28extern void amd_iommu_detect(void);
29extern irqreturn_t amd_iommu_int_handler(int irq, void *data);
27#else 30#else
28static inline int amd_iommu_init(void) { return -ENODEV; } 31static inline int amd_iommu_init(void) { return -ENODEV; }
29static inline void amd_iommu_detect(void) { } 32static inline void amd_iommu_detect(void) { }
diff --git a/include/asm-x86/amd_iommu_types.h b/include/asm-x86/amd_iommu_types.h
index 1ffa4e53c989..b3085869a17b 100644
--- a/include/asm-x86/amd_iommu_types.h
+++ b/include/asm-x86/amd_iommu_types.h
@@ -37,6 +37,7 @@
37/* Capability offsets used by the driver */ 37/* Capability offsets used by the driver */
38#define MMIO_CAP_HDR_OFFSET 0x00 38#define MMIO_CAP_HDR_OFFSET 0x00
39#define MMIO_RANGE_OFFSET 0x0c 39#define MMIO_RANGE_OFFSET 0x0c
40#define MMIO_MISC_OFFSET 0x10
40 41
41/* Masks, shifts and macros to parse the device range capability */ 42/* Masks, shifts and macros to parse the device range capability */
42#define MMIO_RANGE_LD_MASK 0xff000000 43#define MMIO_RANGE_LD_MASK 0xff000000
@@ -48,6 +49,7 @@
48#define MMIO_GET_LD(x) (((x) & MMIO_RANGE_LD_MASK) >> MMIO_RANGE_LD_SHIFT) 49#define MMIO_GET_LD(x) (((x) & MMIO_RANGE_LD_MASK) >> MMIO_RANGE_LD_SHIFT)
49#define MMIO_GET_FD(x) (((x) & MMIO_RANGE_FD_MASK) >> MMIO_RANGE_FD_SHIFT) 50#define MMIO_GET_FD(x) (((x) & MMIO_RANGE_FD_MASK) >> MMIO_RANGE_FD_SHIFT)
50#define MMIO_GET_BUS(x) (((x) & MMIO_RANGE_BUS_MASK) >> MMIO_RANGE_BUS_SHIFT) 51#define MMIO_GET_BUS(x) (((x) & MMIO_RANGE_BUS_MASK) >> MMIO_RANGE_BUS_SHIFT)
52#define MMIO_MSI_NUM(x) ((x) & 0x1f)
51 53
52/* Flag masks for the AMD IOMMU exclusion range */ 54/* Flag masks for the AMD IOMMU exclusion range */
53#define MMIO_EXCL_ENABLE_MASK 0x01ULL 55#define MMIO_EXCL_ENABLE_MASK 0x01ULL
@@ -69,6 +71,25 @@
69/* MMIO status bits */ 71/* MMIO status bits */
70#define MMIO_STATUS_COM_WAIT_INT_MASK 0x04 72#define MMIO_STATUS_COM_WAIT_INT_MASK 0x04
71 73
74/* event logging constants */
75#define EVENT_ENTRY_SIZE 0x10
76#define EVENT_TYPE_SHIFT 28
77#define EVENT_TYPE_MASK 0xf
78#define EVENT_TYPE_ILL_DEV 0x1
79#define EVENT_TYPE_IO_FAULT 0x2
80#define EVENT_TYPE_DEV_TAB_ERR 0x3
81#define EVENT_TYPE_PAGE_TAB_ERR 0x4
82#define EVENT_TYPE_ILL_CMD 0x5
83#define EVENT_TYPE_CMD_HARD_ERR 0x6
84#define EVENT_TYPE_IOTLB_INV_TO 0x7
85#define EVENT_TYPE_INV_DEV_REQ 0x8
86#define EVENT_DEVID_MASK 0xffff
87#define EVENT_DEVID_SHIFT 0
88#define EVENT_DOMID_MASK 0xffff
89#define EVENT_DOMID_SHIFT 0
90#define EVENT_FLAGS_MASK 0xfff
91#define EVENT_FLAGS_SHIFT 0x10
92
72/* feature control bits */ 93/* feature control bits */
73#define CONTROL_IOMMU_EN 0x00ULL 94#define CONTROL_IOMMU_EN 0x00ULL
74#define CONTROL_HT_TUN_EN 0x01ULL 95#define CONTROL_HT_TUN_EN 0x01ULL
@@ -109,6 +130,8 @@
109#define DEV_ENTRY_NMI_PASS 0xba 130#define DEV_ENTRY_NMI_PASS 0xba
110#define DEV_ENTRY_LINT0_PASS 0xbe 131#define DEV_ENTRY_LINT0_PASS 0xbe
111#define DEV_ENTRY_LINT1_PASS 0xbf 132#define DEV_ENTRY_LINT1_PASS 0xbf
133#define DEV_ENTRY_MODE_MASK 0x07
134#define DEV_ENTRY_MODE_SHIFT 0x09
112 135
113/* constants to configure the command buffer */ 136/* constants to configure the command buffer */
114#define CMD_BUFFER_SIZE 8192 137#define CMD_BUFFER_SIZE 8192
@@ -116,6 +139,10 @@
116#define MMIO_CMD_SIZE_SHIFT 56 139#define MMIO_CMD_SIZE_SHIFT 56
117#define MMIO_CMD_SIZE_512 (0x9ULL << MMIO_CMD_SIZE_SHIFT) 140#define MMIO_CMD_SIZE_512 (0x9ULL << MMIO_CMD_SIZE_SHIFT)
118 141
142/* constants for event buffer handling */
143#define EVT_BUFFER_SIZE 8192 /* 512 entries */
144#define EVT_LEN_MASK (0x9ULL << 56)
145
119#define PAGE_MODE_1_LEVEL 0x01 146#define PAGE_MODE_1_LEVEL 0x01
120#define PAGE_MODE_2_LEVEL 0x02 147#define PAGE_MODE_2_LEVEL 0x02
121#define PAGE_MODE_3_LEVEL 0x03 148#define PAGE_MODE_3_LEVEL 0x03
@@ -134,6 +161,7 @@
134#define IOMMU_MAP_SIZE_L3 (1ULL << 39) 161#define IOMMU_MAP_SIZE_L3 (1ULL << 39)
135 162
136#define IOMMU_PTE_P (1ULL << 0) 163#define IOMMU_PTE_P (1ULL << 0)
164#define IOMMU_PTE_TV (1ULL << 1)
137#define IOMMU_PTE_U (1ULL << 59) 165#define IOMMU_PTE_U (1ULL << 59)
138#define IOMMU_PTE_FC (1ULL << 60) 166#define IOMMU_PTE_FC (1ULL << 60)
139#define IOMMU_PTE_IR (1ULL << 61) 167#define IOMMU_PTE_IR (1ULL << 61)
@@ -159,6 +187,9 @@
159 187
160#define MAX_DOMAIN_ID 65536 188#define MAX_DOMAIN_ID 65536
161 189
190/* FIXME: move this macro to <linux/pci.h> */
191#define PCI_BUS(x) (((x) >> 8) & 0xff)
192
162/* 193/*
163 * This structure contains generic data for IOMMU protection domains 194 * This structure contains generic data for IOMMU protection domains
164 * independent of their use. 195 * independent of their use.
@@ -196,6 +227,15 @@ struct dma_ops_domain {
196 * just calculate its address in constant time. 227 * just calculate its address in constant time.
197 */ 228 */
198 u64 **pte_pages; 229 u64 **pte_pages;
230
231 /* This will be set to true when TLB needs to be flushed */
232 bool need_flush;
233
234 /*
235 * if this is a preallocated domain, keep the device for which it was
236 * preallocated in this variable
237 */
238 u16 target_dev;
199}; 239};
200 240
201/* 241/*
@@ -208,8 +248,9 @@ struct amd_iommu {
208 /* locks the accesses to the hardware */ 248 /* locks the accesses to the hardware */
209 spinlock_t lock; 249 spinlock_t lock;
210 250
211 /* device id of this IOMMU */ 251 /* Pointer to PCI device of this IOMMU */
212 u16 devid; 252 struct pci_dev *dev;
253
213 /* 254 /*
214 * Capability pointer. There could be more than one IOMMU per PCI 255 * Capability pointer. There could be more than one IOMMU per PCI
215 * device function if there are more than one AMD IOMMU capability 256 * device function if there are more than one AMD IOMMU capability
@@ -225,6 +266,9 @@ struct amd_iommu {
225 /* capabilities of that IOMMU read from ACPI */ 266 /* capabilities of that IOMMU read from ACPI */
226 u32 cap; 267 u32 cap;
227 268
269 /* pci domain of this IOMMU */
270 u16 pci_seg;
271
228 /* first device this IOMMU handles. read from PCI */ 272 /* first device this IOMMU handles. read from PCI */
229 u16 first_device; 273 u16 first_device;
230 /* last device this IOMMU handles. read from PCI */ 274 /* last device this IOMMU handles. read from PCI */
@@ -240,9 +284,19 @@ struct amd_iommu {
240 /* size of command buffer */ 284 /* size of command buffer */
241 u32 cmd_buf_size; 285 u32 cmd_buf_size;
242 286
287 /* event buffer virtual address */
288 u8 *evt_buf;
289 /* size of event buffer */
290 u32 evt_buf_size;
291 /* MSI number for event interrupt */
292 u16 evt_msi_num;
293
243 /* if one, we need to send a completion wait command */ 294 /* if one, we need to send a completion wait command */
244 int need_sync; 295 int need_sync;
245 296
297 /* true if interrupts for this IOMMU are already enabled */
298 bool int_enabled;
299
246 /* default dma_ops domain for that IOMMU */ 300 /* default dma_ops domain for that IOMMU */
247 struct dma_ops_domain *default_dom; 301 struct dma_ops_domain *default_dom;
248}; 302};
@@ -322,6 +376,12 @@ extern unsigned long *amd_iommu_pd_alloc_bitmap;
322/* will be 1 if device isolation is enabled */ 376/* will be 1 if device isolation is enabled */
323extern int amd_iommu_isolate; 377extern int amd_iommu_isolate;
324 378
379/*
380 * If true, the addresses will be flushed on unmap time, not when
381 * they are reused
382 */
383extern bool amd_iommu_unmap_flush;
384
325/* takes a PCI device id and prints it out in a readable form */ 385/* takes a PCI device id and prints it out in a readable form */
326static inline void print_devid(u16 devid, int nl) 386static inline void print_devid(u16 devid, int nl)
327{ 387{
diff --git a/include/asm-x86/apic.h b/include/asm-x86/apic.h
index 1311c82b165b..d76a0839abe9 100644
--- a/include/asm-x86/apic.h
+++ b/include/asm-x86/apic.h
@@ -134,9 +134,7 @@ static inline void ack_x2APIC_irq(void)
134static inline void ack_APIC_irq(void) 134static inline void ack_APIC_irq(void)
135{ 135{
136 /* 136 /*
137 * ack_APIC_irq() actually gets compiled as a single instruction: 137 * ack_APIC_irq() actually gets compiled as a single instruction
138 * - a single rmw on Pentium/82489DX
139 * - a single write on P6+ cores (CONFIG_X86_GOOD_APIC)
140 * ... yummie. 138 * ... yummie.
141 */ 139 */
142 140
diff --git a/include/asm-x86/asm.h b/include/asm-x86/asm.h
index 2439ae49e8ac..e1355f44d7c3 100644
--- a/include/asm-x86/asm.h
+++ b/include/asm-x86/asm.h
@@ -20,17 +20,22 @@
20 20
21#define _ASM_PTR __ASM_SEL(.long, .quad) 21#define _ASM_PTR __ASM_SEL(.long, .quad)
22#define _ASM_ALIGN __ASM_SEL(.balign 4, .balign 8) 22#define _ASM_ALIGN __ASM_SEL(.balign 4, .balign 8)
23#define _ASM_MOV_UL __ASM_SIZE(mov)
24 23
24#define _ASM_MOV __ASM_SIZE(mov)
25#define _ASM_INC __ASM_SIZE(inc) 25#define _ASM_INC __ASM_SIZE(inc)
26#define _ASM_DEC __ASM_SIZE(dec) 26#define _ASM_DEC __ASM_SIZE(dec)
27#define _ASM_ADD __ASM_SIZE(add) 27#define _ASM_ADD __ASM_SIZE(add)
28#define _ASM_SUB __ASM_SIZE(sub) 28#define _ASM_SUB __ASM_SIZE(sub)
29#define _ASM_XADD __ASM_SIZE(xadd) 29#define _ASM_XADD __ASM_SIZE(xadd)
30
30#define _ASM_AX __ASM_REG(ax) 31#define _ASM_AX __ASM_REG(ax)
31#define _ASM_BX __ASM_REG(bx) 32#define _ASM_BX __ASM_REG(bx)
32#define _ASM_CX __ASM_REG(cx) 33#define _ASM_CX __ASM_REG(cx)
33#define _ASM_DX __ASM_REG(dx) 34#define _ASM_DX __ASM_REG(dx)
35#define _ASM_SP __ASM_REG(sp)
36#define _ASM_BP __ASM_REG(bp)
37#define _ASM_SI __ASM_REG(si)
38#define _ASM_DI __ASM_REG(di)
34 39
35/* Exception table entry */ 40/* Exception table entry */
36# define _ASM_EXTABLE(from,to) \ 41# define _ASM_EXTABLE(from,to) \
diff --git a/include/asm-x86/bitops.h b/include/asm-x86/bitops.h
index 61989b93b475..451a74762bd4 100644
--- a/include/asm-x86/bitops.h
+++ b/include/asm-x86/bitops.h
@@ -424,16 +424,6 @@ static inline int fls(int x)
424 424
425#undef ADDR 425#undef ADDR
426 426
427static inline void set_bit_string(unsigned long *bitmap,
428 unsigned long i, int len)
429{
430 unsigned long end = i + len;
431 while (i < end) {
432 __set_bit(i, bitmap);
433 i++;
434 }
435}
436
437#ifdef __KERNEL__ 427#ifdef __KERNEL__
438 428
439#include <asm-generic/bitops/sched.h> 429#include <asm-generic/bitops/sched.h>
diff --git a/include/asm-x86/cacheflush.h b/include/asm-x86/cacheflush.h
index 59859cb28a36..68840ef1b35a 100644
--- a/include/asm-x86/cacheflush.h
+++ b/include/asm-x86/cacheflush.h
@@ -24,6 +24,8 @@
24#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ 24#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
25 memcpy((dst), (src), (len)) 25 memcpy((dst), (src), (len))
26 26
27#define PG_non_WB PG_arch_1
28PAGEFLAG(NonWB, non_WB)
27 29
28/* 30/*
29 * The set_memory_* API can be used to change various attributes of a virtual 31 * The set_memory_* API can be used to change various attributes of a virtual
@@ -66,6 +68,9 @@ int set_memory_rw(unsigned long addr, int numpages);
66int set_memory_np(unsigned long addr, int numpages); 68int set_memory_np(unsigned long addr, int numpages);
67int set_memory_4k(unsigned long addr, int numpages); 69int set_memory_4k(unsigned long addr, int numpages);
68 70
71int set_memory_array_uc(unsigned long *addr, int addrinarray);
72int set_memory_array_wb(unsigned long *addr, int addrinarray);
73
69/* 74/*
70 * For legacy compatibility with the old APIs, a few functions 75 * For legacy compatibility with the old APIs, a few functions
71 * are provided that work on a "struct page". 76 * are provided that work on a "struct page".
@@ -96,8 +101,6 @@ int set_pages_rw(struct page *page, int numpages);
96 101
97void clflush_cache_range(void *addr, unsigned int size); 102void clflush_cache_range(void *addr, unsigned int size);
98 103
99void cpa_init(void);
100
101#ifdef CONFIG_DEBUG_RODATA 104#ifdef CONFIG_DEBUG_RODATA
102void mark_rodata_ro(void); 105void mark_rodata_ro(void);
103extern const int rodata_test_data; 106extern const int rodata_test_data;
diff --git a/include/asm-x86/cpufeature.h b/include/asm-x86/cpufeature.h
index 8d45690bef5f..adfeae6586e1 100644
--- a/include/asm-x86/cpufeature.h
+++ b/include/asm-x86/cpufeature.h
@@ -80,6 +80,7 @@
80#define X86_FEATURE_UP (3*32+ 9) /* smp kernel running on up */ 80#define X86_FEATURE_UP (3*32+ 9) /* smp kernel running on up */
81#define X86_FEATURE_FXSAVE_LEAK (3*32+10) /* "" FXSAVE leaks FOP/FIP/FOP */ 81#define X86_FEATURE_FXSAVE_LEAK (3*32+10) /* "" FXSAVE leaks FOP/FIP/FOP */
82#define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */ 82#define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */
83#define X86_FEATURE_NOPL (3*32+20) /* The NOPL (0F 1F) instructions */
83#define X86_FEATURE_PEBS (3*32+12) /* Precise-Event Based Sampling */ 84#define X86_FEATURE_PEBS (3*32+12) /* Precise-Event Based Sampling */
84#define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */ 85#define X86_FEATURE_BTS (3*32+13) /* Branch Trace Store */
85#define X86_FEATURE_SYSCALL32 (3*32+14) /* "" syscall in ia32 userspace */ 86#define X86_FEATURE_SYSCALL32 (3*32+14) /* "" syscall in ia32 userspace */
@@ -89,6 +90,7 @@
89#define X86_FEATURE_LFENCE_RDTSC (3*32+18) /* "" Lfence synchronizes RDTSC */ 90#define X86_FEATURE_LFENCE_RDTSC (3*32+18) /* "" Lfence synchronizes RDTSC */
90#define X86_FEATURE_11AP (3*32+19) /* "" Bad local APIC aka 11AP */ 91#define X86_FEATURE_11AP (3*32+19) /* "" Bad local APIC aka 11AP */
91#define X86_FEATURE_NOPL (3*32+20) /* The NOPL (0F 1F) instructions */ 92#define X86_FEATURE_NOPL (3*32+20) /* The NOPL (0F 1F) instructions */
93#define X86_FEATURE_AMDC1E (3*32+21) /* AMD C1E detected */
92#define X86_FEATURE_XTOPOLOGY (3*32+21) /* cpu topology enum extensions */ 94#define X86_FEATURE_XTOPOLOGY (3*32+21) /* cpu topology enum extensions */
93 95
94/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */ 96/* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
diff --git a/include/asm-x86/dma-mapping.h b/include/asm-x86/dma-mapping.h
index 5d200e78bd81..219c33d6361c 100644
--- a/include/asm-x86/dma-mapping.h
+++ b/include/asm-x86/dma-mapping.h
@@ -9,12 +9,12 @@
9#include <linux/scatterlist.h> 9#include <linux/scatterlist.h>
10#include <asm/io.h> 10#include <asm/io.h>
11#include <asm/swiotlb.h> 11#include <asm/swiotlb.h>
12#include <asm-generic/dma-coherent.h>
12 13
13extern dma_addr_t bad_dma_address; 14extern dma_addr_t bad_dma_address;
14extern int iommu_merge; 15extern int iommu_merge;
15extern struct device fallback_dev; 16extern struct device x86_dma_fallback_dev;
16extern int panic_on_overflow; 17extern int panic_on_overflow;
17extern int force_iommu;
18 18
19struct dma_mapping_ops { 19struct dma_mapping_ops {
20 int (*mapping_error)(struct device *dev, 20 int (*mapping_error)(struct device *dev,
@@ -25,9 +25,6 @@ struct dma_mapping_ops {
25 void *vaddr, dma_addr_t dma_handle); 25 void *vaddr, dma_addr_t dma_handle);
26 dma_addr_t (*map_single)(struct device *hwdev, phys_addr_t ptr, 26 dma_addr_t (*map_single)(struct device *hwdev, phys_addr_t ptr,
27 size_t size, int direction); 27 size_t size, int direction);
28 /* like map_single, but doesn't check the device mask */
29 dma_addr_t (*map_simple)(struct device *hwdev, phys_addr_t ptr,
30 size_t size, int direction);
31 void (*unmap_single)(struct device *dev, dma_addr_t addr, 28 void (*unmap_single)(struct device *dev, dma_addr_t addr,
32 size_t size, int direction); 29 size_t size, int direction);
33 void (*sync_single_for_cpu)(struct device *hwdev, 30 void (*sync_single_for_cpu)(struct device *hwdev,
@@ -68,7 +65,7 @@ static inline struct dma_mapping_ops *get_dma_ops(struct device *dev)
68 return dma_ops; 65 return dma_ops;
69 else 66 else
70 return dev->archdata.dma_ops; 67 return dev->archdata.dma_ops;
71#endif 68#endif /* ASM_X86__DMA_MAPPING_H */
72} 69}
73 70
74/* Make sure we keep the same behaviour */ 71/* Make sure we keep the same behaviour */
@@ -87,17 +84,14 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
87 84
88#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 85#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
89#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 86#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
90 87#define dma_is_consistent(d, h) (1)
91void *dma_alloc_coherent(struct device *dev, size_t size,
92 dma_addr_t *dma_handle, gfp_t flag);
93
94void dma_free_coherent(struct device *dev, size_t size,
95 void *vaddr, dma_addr_t dma_handle);
96
97 88
98extern int dma_supported(struct device *hwdev, u64 mask); 89extern int dma_supported(struct device *hwdev, u64 mask);
99extern int dma_set_mask(struct device *dev, u64 mask); 90extern int dma_set_mask(struct device *dev, u64 mask);
100 91
92extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
93 dma_addr_t *dma_addr, gfp_t flag);
94
101static inline dma_addr_t 95static inline dma_addr_t
102dma_map_single(struct device *hwdev, void *ptr, size_t size, 96dma_map_single(struct device *hwdev, void *ptr, size_t size,
103 int direction) 97 int direction)
@@ -247,7 +241,68 @@ static inline int dma_get_cache_alignment(void)
247 return boot_cpu_data.x86_clflush_size; 241 return boot_cpu_data.x86_clflush_size;
248} 242}
249 243
250#define dma_is_consistent(d, h) (1) 244static inline unsigned long dma_alloc_coherent_mask(struct device *dev,
245 gfp_t gfp)
246{
247 unsigned long dma_mask = 0;
251 248
252#include <asm-generic/dma-coherent.h> 249 dma_mask = dev->coherent_dma_mask;
253#endif /* ASM_X86__DMA_MAPPING_H */ 250 if (!dma_mask)
251 dma_mask = (gfp & GFP_DMA) ? DMA_24BIT_MASK : DMA_32BIT_MASK;
252
253 return dma_mask;
254}
255
256static inline gfp_t dma_alloc_coherent_gfp_flags(struct device *dev, gfp_t gfp)
257{
258#ifdef CONFIG_X86_64
259 unsigned long dma_mask = dma_alloc_coherent_mask(dev, gfp);
260
261 if (dma_mask <= DMA_32BIT_MASK && !(gfp & GFP_DMA))
262 gfp |= GFP_DMA32;
263#endif
264 return gfp;
265}
266
267static inline void *
268dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
269 gfp_t gfp)
270{
271 struct dma_mapping_ops *ops = get_dma_ops(dev);
272 void *memory;
273
274 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
275
276 if (dma_alloc_from_coherent(dev, size, dma_handle, &memory))
277 return memory;
278
279 if (!dev) {
280 dev = &x86_dma_fallback_dev;
281 gfp |= GFP_DMA;
282 }
283
284 if (!is_device_dma_capable(dev))
285 return NULL;
286
287 if (!ops->alloc_coherent)
288 return NULL;
289
290 return ops->alloc_coherent(dev, size, dma_handle,
291 dma_alloc_coherent_gfp_flags(dev, gfp));
292}
293
294static inline void dma_free_coherent(struct device *dev, size_t size,
295 void *vaddr, dma_addr_t bus)
296{
297 struct dma_mapping_ops *ops = get_dma_ops(dev);
298
299 WARN_ON(irqs_disabled()); /* for portability */
300
301 if (dma_release_from_coherent(dev, get_order(size), vaddr))
302 return;
303
304 if (ops->free_coherent)
305 ops->free_coherent(dev, size, vaddr, bus);
306}
307
308#endif
diff --git a/include/asm-x86/elf.h b/include/asm-x86/elf.h
index cd678b2d6a74..5c4745bec906 100644
--- a/include/asm-x86/elf.h
+++ b/include/asm-x86/elf.h
@@ -148,8 +148,9 @@ do { \
148 148
149static inline void start_ia32_thread(struct pt_regs *regs, u32 ip, u32 sp) 149static inline void start_ia32_thread(struct pt_regs *regs, u32 ip, u32 sp)
150{ 150{
151 asm volatile("movl %0,%%fs" :: "r" (0)); 151 loadsegment(fs, 0);
152 asm volatile("movl %0,%%es; movl %0,%%ds" : : "r" (__USER32_DS)); 152 loadsegment(ds, __USER32_DS);
153 loadsegment(es, __USER32_DS);
153 load_gs_index(0); 154 load_gs_index(0);
154 regs->ip = ip; 155 regs->ip = ip;
155 regs->sp = sp; 156 regs->sp = sp;
diff --git a/include/asm-x86/futex.h b/include/asm-x86/futex.h
index 45dc24d84186..06b924ef6fa5 100644
--- a/include/asm-x86/futex.h
+++ b/include/asm-x86/futex.h
@@ -25,7 +25,7 @@
25 asm volatile("1:\tmovl %2, %0\n" \ 25 asm volatile("1:\tmovl %2, %0\n" \
26 "\tmovl\t%0, %3\n" \ 26 "\tmovl\t%0, %3\n" \
27 "\t" insn "\n" \ 27 "\t" insn "\n" \
28 "2:\tlock; cmpxchgl %3, %2\n" \ 28 "2:\t" LOCK_PREFIX "cmpxchgl %3, %2\n" \
29 "\tjnz\t1b\n" \ 29 "\tjnz\t1b\n" \
30 "3:\t.section .fixup,\"ax\"\n" \ 30 "3:\t.section .fixup,\"ax\"\n" \
31 "4:\tmov\t%5, %1\n" \ 31 "4:\tmov\t%5, %1\n" \
@@ -64,7 +64,7 @@ static inline int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
64 __futex_atomic_op1("xchgl %0, %2", ret, oldval, uaddr, oparg); 64 __futex_atomic_op1("xchgl %0, %2", ret, oldval, uaddr, oparg);
65 break; 65 break;
66 case FUTEX_OP_ADD: 66 case FUTEX_OP_ADD:
67 __futex_atomic_op1("lock; xaddl %0, %2", ret, oldval, 67 __futex_atomic_op1(LOCK_PREFIX "xaddl %0, %2", ret, oldval,
68 uaddr, oparg); 68 uaddr, oparg);
69 break; 69 break;
70 case FUTEX_OP_OR: 70 case FUTEX_OP_OR:
@@ -122,7 +122,7 @@ static inline int futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval,
122 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) 122 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
123 return -EFAULT; 123 return -EFAULT;
124 124
125 asm volatile("1:\tlock; cmpxchgl %3, %1\n" 125 asm volatile("1:\t" LOCK_PREFIX "cmpxchgl %3, %1\n"
126 "2:\t.section .fixup, \"ax\"\n" 126 "2:\t.section .fixup, \"ax\"\n"
127 "3:\tmov %2, %0\n" 127 "3:\tmov %2, %0\n"
128 "\tjmp 2b\n" 128 "\tjmp 2b\n"
diff --git a/include/asm-x86/gart.h b/include/asm-x86/gart.h
index 07f445844146..605edb39ef9e 100644
--- a/include/asm-x86/gart.h
+++ b/include/asm-x86/gart.h
@@ -29,6 +29,8 @@ extern int fix_aperture;
29#define AMD64_GARTCACHECTL 0x9c 29#define AMD64_GARTCACHECTL 0x9c
30#define AMD64_GARTEN (1<<0) 30#define AMD64_GARTEN (1<<0)
31 31
32extern int agp_amd64_init(void);
33
32static inline void enable_gart_translation(struct pci_dev *dev, u64 addr) 34static inline void enable_gart_translation(struct pci_dev *dev, u64 addr)
33{ 35{
34 u32 tmp, ctl; 36 u32 tmp, ctl;
@@ -52,15 +54,15 @@ static inline int aperture_valid(u64 aper_base, u32 aper_size, u32 min_size)
52 return 0; 54 return 0;
53 55
54 if (aper_base + aper_size > 0x100000000ULL) { 56 if (aper_base + aper_size > 0x100000000ULL) {
55 printk(KERN_ERR "Aperture beyond 4GB. Ignoring.\n"); 57 printk(KERN_INFO "Aperture beyond 4GB. Ignoring.\n");
56 return 0; 58 return 0;
57 } 59 }
58 if (e820_any_mapped(aper_base, aper_base + aper_size, E820_RAM)) { 60 if (e820_any_mapped(aper_base, aper_base + aper_size, E820_RAM)) {
59 printk(KERN_ERR "Aperture pointing to e820 RAM. Ignoring.\n"); 61 printk(KERN_INFO "Aperture pointing to e820 RAM. Ignoring.\n");
60 return 0; 62 return 0;
61 } 63 }
62 if (aper_size < min_size) { 64 if (aper_size < min_size) {
63 printk(KERN_ERR "Aperture too small (%d MB) than (%d MB)\n", 65 printk(KERN_INFO "Aperture too small (%d MB) than (%d MB)\n",
64 aper_size>>20, min_size>>20); 66 aper_size>>20, min_size>>20);
65 return 0; 67 return 0;
66 } 68 }
diff --git a/include/asm-x86/idle.h b/include/asm-x86/idle.h
index dc9c7944847b..baa3f783d27d 100644
--- a/include/asm-x86/idle.h
+++ b/include/asm-x86/idle.h
@@ -10,4 +10,6 @@ void idle_notifier_register(struct notifier_block *n);
10void enter_idle(void); 10void enter_idle(void);
11void exit_idle(void); 11void exit_idle(void);
12 12
13void c1e_remove_cpu(int cpu);
14
13#endif /* ASM_X86__IDLE_H */ 15#endif /* ASM_X86__IDLE_H */
diff --git a/include/asm-x86/iommu.h b/include/asm-x86/iommu.h
index e86f44148c66..546ad3110fea 100644
--- a/include/asm-x86/iommu.h
+++ b/include/asm-x86/iommu.h
@@ -6,6 +6,7 @@ extern void no_iommu_init(void);
6extern struct dma_mapping_ops nommu_dma_ops; 6extern struct dma_mapping_ops nommu_dma_ops;
7extern int force_iommu, no_iommu; 7extern int force_iommu, no_iommu;
8extern int iommu_detected; 8extern int iommu_detected;
9extern int dmar_disabled;
9 10
10extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len); 11extern unsigned long iommu_num_pages(unsigned long addr, unsigned long len);
11 12
diff --git a/include/asm-x86/kgdb.h b/include/asm-x86/kgdb.h
index 83a7ee228ab1..d283863354de 100644
--- a/include/asm-x86/kgdb.h
+++ b/include/asm-x86/kgdb.h
@@ -39,12 +39,13 @@ enum regnames {
39 GDB_FS, /* 14 */ 39 GDB_FS, /* 14 */
40 GDB_GS, /* 15 */ 40 GDB_GS, /* 15 */
41}; 41};
42#define NUMREGBYTES ((GDB_GS+1)*4)
42#else /* ! CONFIG_X86_32 */ 43#else /* ! CONFIG_X86_32 */
43enum regnames { 44enum regnames64 {
44 GDB_AX, /* 0 */ 45 GDB_AX, /* 0 */
45 GDB_DX, /* 1 */ 46 GDB_BX, /* 1 */
46 GDB_CX, /* 2 */ 47 GDB_CX, /* 2 */
47 GDB_BX, /* 3 */ 48 GDB_DX, /* 3 */
48 GDB_SI, /* 4 */ 49 GDB_SI, /* 4 */
49 GDB_DI, /* 5 */ 50 GDB_DI, /* 5 */
50 GDB_BP, /* 6 */ 51 GDB_BP, /* 6 */
@@ -58,18 +59,15 @@ enum regnames {
58 GDB_R14, /* 14 */ 59 GDB_R14, /* 14 */
59 GDB_R15, /* 15 */ 60 GDB_R15, /* 15 */
60 GDB_PC, /* 16 */ 61 GDB_PC, /* 16 */
61 GDB_PS, /* 17 */
62}; 62};
63#endif /* CONFIG_X86_32 */
64 63
65/* 64enum regnames32 {
66 * Number of bytes of registers: 65 GDB_PS = 34,
67 */ 66 GDB_CS,
68#ifdef CONFIG_X86_32 67 GDB_SS,
69# define NUMREGBYTES 64 68};
70#else 69#define NUMREGBYTES ((GDB_SS+1)*4)
71# define NUMREGBYTES ((GDB_PS+1)*8) 70#endif /* CONFIG_X86_32 */
72#endif
73 71
74static inline void arch_kgdb_breakpoint(void) 72static inline void arch_kgdb_breakpoint(void)
75{ 73{
diff --git a/include/asm-x86/mach-rdc321x/gpio.h b/include/asm-x86/mach-rdc321x/gpio.h
index 6184561980f2..94b6cdf532e2 100644
--- a/include/asm-x86/mach-rdc321x/gpio.h
+++ b/include/asm-x86/mach-rdc321x/gpio.h
@@ -1,6 +1,8 @@
1#ifndef ASM_X86__MACH_RDC321X__GPIO_H 1#ifndef ASM_X86__MACH_RDC321X__GPIO_H
2#define ASM_X86__MACH_RDC321X__GPIO_H 2#define ASM_X86__MACH_RDC321X__GPIO_H
3 3
4#include <linux/kernel.h>
5
4extern int rdc_gpio_get_value(unsigned gpio); 6extern int rdc_gpio_get_value(unsigned gpio);
5extern void rdc_gpio_set_value(unsigned gpio, int value); 7extern void rdc_gpio_set_value(unsigned gpio, int value);
6extern int rdc_gpio_direction_input(unsigned gpio); 8extern int rdc_gpio_direction_input(unsigned gpio);
@@ -18,6 +20,7 @@ static inline int gpio_request(unsigned gpio, const char *label)
18 20
19static inline void gpio_free(unsigned gpio) 21static inline void gpio_free(unsigned gpio)
20{ 22{
23 might_sleep();
21 rdc_gpio_free(gpio); 24 rdc_gpio_free(gpio);
22} 25}
23 26
diff --git a/include/asm-x86/mmu.h b/include/asm-x86/mmu.h
index a30d7a9c8297..9d5aff14334a 100644
--- a/include/asm-x86/mmu.h
+++ b/include/asm-x86/mmu.h
@@ -7,14 +7,9 @@
7/* 7/*
8 * The x86 doesn't have a mmu context, but 8 * The x86 doesn't have a mmu context, but
9 * we put the segment information here. 9 * we put the segment information here.
10 *
11 * cpu_vm_mask is used to optimize ldt flushing.
12 */ 10 */
13typedef struct { 11typedef struct {
14 void *ldt; 12 void *ldt;
15#ifdef CONFIG_X86_64
16 rwlock_t ldtlock;
17#endif
18 int size; 13 int size;
19 struct mutex lock; 14 struct mutex lock;
20 void *vdso; 15 void *vdso;
diff --git a/include/asm-x86/mpspec.h b/include/asm-x86/mpspec.h
index 118da365e371..be2241a818f1 100644
--- a/include/asm-x86/mpspec.h
+++ b/include/asm-x86/mpspec.h
@@ -5,11 +5,12 @@
5 5
6#include <asm/mpspec_def.h> 6#include <asm/mpspec_def.h>
7 7
8extern int apic_version[MAX_APICS];
9
8#ifdef CONFIG_X86_32 10#ifdef CONFIG_X86_32
9#include <mach_mpspec.h> 11#include <mach_mpspec.h>
10 12
11extern unsigned int def_to_bigsmp; 13extern unsigned int def_to_bigsmp;
12extern int apic_version[MAX_APICS];
13extern u8 apicid_2_node[]; 14extern u8 apicid_2_node[];
14extern int pic_mode; 15extern int pic_mode;
15 16
diff --git a/include/asm-x86/nmi.h b/include/asm-x86/nmi.h
index f8b76f383904..d5e715f024dc 100644
--- a/include/asm-x86/nmi.h
+++ b/include/asm-x86/nmi.h
@@ -34,6 +34,7 @@ extern void stop_apic_nmi_watchdog(void *);
34extern void disable_timer_nmi_watchdog(void); 34extern void disable_timer_nmi_watchdog(void);
35extern void enable_timer_nmi_watchdog(void); 35extern void enable_timer_nmi_watchdog(void);
36extern int nmi_watchdog_tick(struct pt_regs *regs, unsigned reason); 36extern int nmi_watchdog_tick(struct pt_regs *regs, unsigned reason);
37extern void cpu_nmi_set_wd_enabled(void);
37 38
38extern atomic_t nmi_active; 39extern atomic_t nmi_active;
39extern unsigned int nmi_watchdog; 40extern unsigned int nmi_watchdog;
diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h
index 79544e6ffb8b..c91574776751 100644
--- a/include/asm-x86/page.h
+++ b/include/asm-x86/page.h
@@ -57,6 +57,7 @@ typedef struct { pgdval_t pgd; } pgd_t;
57typedef struct { pgprotval_t pgprot; } pgprot_t; 57typedef struct { pgprotval_t pgprot; } pgprot_t;
58 58
59extern int page_is_ram(unsigned long pagenr); 59extern int page_is_ram(unsigned long pagenr);
60extern int pagerange_is_ram(unsigned long start, unsigned long end);
60extern int devmem_is_allowed(unsigned long pagenr); 61extern int devmem_is_allowed(unsigned long pagenr);
61extern void map_devmem(unsigned long pfn, unsigned long size, 62extern void map_devmem(unsigned long pfn, unsigned long size,
62 pgprot_t vma_prot); 63 pgprot_t vma_prot);
diff --git a/include/asm-x86/page_32.h b/include/asm-x86/page_32.h
index f32062a821c5..72f7305682c6 100644
--- a/include/asm-x86/page_32.h
+++ b/include/asm-x86/page_32.h
@@ -89,9 +89,6 @@ extern int nx_enabled;
89extern unsigned int __VMALLOC_RESERVE; 89extern unsigned int __VMALLOC_RESERVE;
90extern int sysctl_legacy_va_layout; 90extern int sysctl_legacy_va_layout;
91 91
92#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
93#define MAXMEM (-__PAGE_OFFSET - __VMALLOC_RESERVE)
94
95extern void find_low_pfn_range(void); 92extern void find_low_pfn_range(void);
96extern unsigned long init_memory_mapping(unsigned long start, 93extern unsigned long init_memory_mapping(unsigned long start,
97 unsigned long end); 94 unsigned long end);
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
index cba612c89e06..d7d358a43996 100644
--- a/include/asm-x86/paravirt.h
+++ b/include/asm-x86/paravirt.h
@@ -252,13 +252,13 @@ struct pv_mmu_ops {
252 * Hooks for allocating/releasing pagetable pages when they're 252 * Hooks for allocating/releasing pagetable pages when they're
253 * attached to a pagetable 253 * attached to a pagetable
254 */ 254 */
255 void (*alloc_pte)(struct mm_struct *mm, u32 pfn); 255 void (*alloc_pte)(struct mm_struct *mm, unsigned long pfn);
256 void (*alloc_pmd)(struct mm_struct *mm, u32 pfn); 256 void (*alloc_pmd)(struct mm_struct *mm, unsigned long pfn);
257 void (*alloc_pmd_clone)(u32 pfn, u32 clonepfn, u32 start, u32 count); 257 void (*alloc_pmd_clone)(unsigned long pfn, unsigned long clonepfn, unsigned long start, unsigned long count);
258 void (*alloc_pud)(struct mm_struct *mm, u32 pfn); 258 void (*alloc_pud)(struct mm_struct *mm, unsigned long pfn);
259 void (*release_pte)(u32 pfn); 259 void (*release_pte)(unsigned long pfn);
260 void (*release_pmd)(u32 pfn); 260 void (*release_pmd)(unsigned long pfn);
261 void (*release_pud)(u32 pfn); 261 void (*release_pud)(unsigned long pfn);
262 262
263 /* Pagetable manipulation functions */ 263 /* Pagetable manipulation functions */
264 void (*set_pte)(pte_t *ptep, pte_t pteval); 264 void (*set_pte)(pte_t *ptep, pte_t pteval);
@@ -986,35 +986,35 @@ static inline void paravirt_pgd_free(struct mm_struct *mm, pgd_t *pgd)
986 PVOP_VCALL2(pv_mmu_ops.pgd_free, mm, pgd); 986 PVOP_VCALL2(pv_mmu_ops.pgd_free, mm, pgd);
987} 987}
988 988
989static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned pfn) 989static inline void paravirt_alloc_pte(struct mm_struct *mm, unsigned long pfn)
990{ 990{
991 PVOP_VCALL2(pv_mmu_ops.alloc_pte, mm, pfn); 991 PVOP_VCALL2(pv_mmu_ops.alloc_pte, mm, pfn);
992} 992}
993static inline void paravirt_release_pte(unsigned pfn) 993static inline void paravirt_release_pte(unsigned long pfn)
994{ 994{
995 PVOP_VCALL1(pv_mmu_ops.release_pte, pfn); 995 PVOP_VCALL1(pv_mmu_ops.release_pte, pfn);
996} 996}
997 997
998static inline void paravirt_alloc_pmd(struct mm_struct *mm, unsigned pfn) 998static inline void paravirt_alloc_pmd(struct mm_struct *mm, unsigned long pfn)
999{ 999{
1000 PVOP_VCALL2(pv_mmu_ops.alloc_pmd, mm, pfn); 1000 PVOP_VCALL2(pv_mmu_ops.alloc_pmd, mm, pfn);
1001} 1001}
1002 1002
1003static inline void paravirt_alloc_pmd_clone(unsigned pfn, unsigned clonepfn, 1003static inline void paravirt_alloc_pmd_clone(unsigned long pfn, unsigned long clonepfn,
1004 unsigned start, unsigned count) 1004 unsigned long start, unsigned long count)
1005{ 1005{
1006 PVOP_VCALL4(pv_mmu_ops.alloc_pmd_clone, pfn, clonepfn, start, count); 1006 PVOP_VCALL4(pv_mmu_ops.alloc_pmd_clone, pfn, clonepfn, start, count);
1007} 1007}
1008static inline void paravirt_release_pmd(unsigned pfn) 1008static inline void paravirt_release_pmd(unsigned long pfn)
1009{ 1009{
1010 PVOP_VCALL1(pv_mmu_ops.release_pmd, pfn); 1010 PVOP_VCALL1(pv_mmu_ops.release_pmd, pfn);
1011} 1011}
1012 1012
1013static inline void paravirt_alloc_pud(struct mm_struct *mm, unsigned pfn) 1013static inline void paravirt_alloc_pud(struct mm_struct *mm, unsigned long pfn)
1014{ 1014{
1015 PVOP_VCALL2(pv_mmu_ops.alloc_pud, mm, pfn); 1015 PVOP_VCALL2(pv_mmu_ops.alloc_pud, mm, pfn);
1016} 1016}
1017static inline void paravirt_release_pud(unsigned pfn) 1017static inline void paravirt_release_pud(unsigned long pfn)
1018{ 1018{
1019 PVOP_VCALL1(pv_mmu_ops.release_pud, pfn); 1019 PVOP_VCALL1(pv_mmu_ops.release_pud, pfn);
1020} 1020}
diff --git a/include/asm-x86/pgtable-2level.h b/include/asm-x86/pgtable-2level.h
index 60440b191626..81762081dcd8 100644
--- a/include/asm-x86/pgtable-2level.h
+++ b/include/asm-x86/pgtable-2level.h
@@ -53,9 +53,7 @@ static inline pte_t native_ptep_get_and_clear(pte_t *xp)
53#define native_ptep_get_and_clear(xp) native_local_ptep_get_and_clear(xp) 53#define native_ptep_get_and_clear(xp) native_local_ptep_get_and_clear(xp)
54#endif 54#endif
55 55
56#define pte_page(x) pfn_to_page(pte_pfn(x))
57#define pte_none(x) (!(x).pte_low) 56#define pte_none(x) (!(x).pte_low)
58#define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT)
59 57
60/* 58/*
61 * Bits 0, 6 and 7 are taken, split up the 29 bits of offset 59 * Bits 0, 6 and 7 are taken, split up the 29 bits of offset
diff --git a/include/asm-x86/pgtable-3level.h b/include/asm-x86/pgtable-3level.h
index e713bd5f39a6..75f4276b5ddb 100644
--- a/include/asm-x86/pgtable-3level.h
+++ b/include/asm-x86/pgtable-3level.h
@@ -151,18 +151,11 @@ static inline int pte_same(pte_t a, pte_t b)
151 return a.pte_low == b.pte_low && a.pte_high == b.pte_high; 151 return a.pte_low == b.pte_low && a.pte_high == b.pte_high;
152} 152}
153 153
154#define pte_page(x) pfn_to_page(pte_pfn(x))
155
156static inline int pte_none(pte_t pte) 154static inline int pte_none(pte_t pte)
157{ 155{
158 return !pte.pte_low && !pte.pte_high; 156 return !pte.pte_low && !pte.pte_high;
159} 157}
160 158
161static inline unsigned long pte_pfn(pte_t pte)
162{
163 return (pte_val(pte) & PTE_PFN_MASK) >> PAGE_SHIFT;
164}
165
166/* 159/*
167 * Bits 0, 6 and 7 are taken in the low part of the pte, 160 * Bits 0, 6 and 7 are taken in the low part of the pte,
168 * put the 32 bits of offset into the high part. 161 * put the 32 bits of offset into the high part.
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h
index 57d919a2d79d..ed932453ef26 100644
--- a/include/asm-x86/pgtable.h
+++ b/include/asm-x86/pgtable.h
@@ -19,6 +19,7 @@
19#define _PAGE_BIT_UNUSED3 11 19#define _PAGE_BIT_UNUSED3 11
20#define _PAGE_BIT_PAT_LARGE 12 /* On 2MB or 1GB pages */ 20#define _PAGE_BIT_PAT_LARGE 12 /* On 2MB or 1GB pages */
21#define _PAGE_BIT_SPECIAL _PAGE_BIT_UNUSED1 21#define _PAGE_BIT_SPECIAL _PAGE_BIT_UNUSED1
22#define _PAGE_BIT_CPA_TEST _PAGE_BIT_UNUSED1
22#define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */ 23#define _PAGE_BIT_NX 63 /* No execute: only valid after cpuid check */
23 24
24#define _PAGE_PRESENT (_AT(pteval_t, 1) << _PAGE_BIT_PRESENT) 25#define _PAGE_PRESENT (_AT(pteval_t, 1) << _PAGE_BIT_PRESENT)
@@ -36,6 +37,7 @@
36#define _PAGE_PAT (_AT(pteval_t, 1) << _PAGE_BIT_PAT) 37#define _PAGE_PAT (_AT(pteval_t, 1) << _PAGE_BIT_PAT)
37#define _PAGE_PAT_LARGE (_AT(pteval_t, 1) << _PAGE_BIT_PAT_LARGE) 38#define _PAGE_PAT_LARGE (_AT(pteval_t, 1) << _PAGE_BIT_PAT_LARGE)
38#define _PAGE_SPECIAL (_AT(pteval_t, 1) << _PAGE_BIT_SPECIAL) 39#define _PAGE_SPECIAL (_AT(pteval_t, 1) << _PAGE_BIT_SPECIAL)
40#define _PAGE_CPA_TEST (_AT(pteval_t, 1) << _PAGE_BIT_CPA_TEST)
39#define __HAVE_ARCH_PTE_SPECIAL 41#define __HAVE_ARCH_PTE_SPECIAL
40 42
41#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) 43#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
@@ -130,6 +132,17 @@
130#define __S110 PAGE_SHARED_EXEC 132#define __S110 PAGE_SHARED_EXEC
131#define __S111 PAGE_SHARED_EXEC 133#define __S111 PAGE_SHARED_EXEC
132 134
135/*
136 * early identity mapping pte attrib macros.
137 */
138#ifdef CONFIG_X86_64
139#define __PAGE_KERNEL_IDENT_LARGE_EXEC __PAGE_KERNEL_LARGE_EXEC
140#else
141#define PTE_IDENT_ATTR 0x003 /* PRESENT+RW */
142#define PDE_IDENT_ATTR 0x063 /* PRESENT+RW+DIRTY+ACCESSED */
143#define PGD_IDENT_ATTR 0x001 /* PRESENT (no other attributes) */
144#endif
145
133#ifndef __ASSEMBLY__ 146#ifndef __ASSEMBLY__
134 147
135/* 148/*
@@ -186,6 +199,13 @@ static inline int pte_special(pte_t pte)
186 return pte_val(pte) & _PAGE_SPECIAL; 199 return pte_val(pte) & _PAGE_SPECIAL;
187} 200}
188 201
202static inline unsigned long pte_pfn(pte_t pte)
203{
204 return (pte_val(pte) & PTE_PFN_MASK) >> PAGE_SHIFT;
205}
206
207#define pte_page(pte) pfn_to_page(pte_pfn(pte))
208
189static inline int pmd_large(pmd_t pte) 209static inline int pmd_large(pmd_t pte)
190{ 210{
191 return (pmd_val(pte) & (_PAGE_PSE | _PAGE_PRESENT)) == 211 return (pmd_val(pte) & (_PAGE_PSE | _PAGE_PRESENT)) ==
diff --git a/include/asm-x86/pgtable_32.h b/include/asm-x86/pgtable_32.h
index 45c8235400fe..8de702dc7d62 100644
--- a/include/asm-x86/pgtable_32.h
+++ b/include/asm-x86/pgtable_32.h
@@ -57,8 +57,7 @@ extern void set_pmd_pfn(unsigned long, unsigned long, pgprot_t);
57 * area for the same reason. ;) 57 * area for the same reason. ;)
58 */ 58 */
59#define VMALLOC_OFFSET (8 * 1024 * 1024) 59#define VMALLOC_OFFSET (8 * 1024 * 1024)
60#define VMALLOC_START (((unsigned long)high_memory + 2 * VMALLOC_OFFSET - 1) \ 60#define VMALLOC_START ((unsigned long)high_memory + VMALLOC_OFFSET)
61 & ~(VMALLOC_OFFSET - 1))
62#ifdef CONFIG_X86_PAE 61#ifdef CONFIG_X86_PAE
63#define LAST_PKMAP 512 62#define LAST_PKMAP 512
64#else 63#else
@@ -74,6 +73,8 @@ extern void set_pmd_pfn(unsigned long, unsigned long, pgprot_t);
74# define VMALLOC_END (FIXADDR_START - 2 * PAGE_SIZE) 73# define VMALLOC_END (FIXADDR_START - 2 * PAGE_SIZE)
75#endif 74#endif
76 75
76#define MAXMEM (VMALLOC_END - PAGE_OFFSET - __VMALLOC_RESERVE)
77
77/* 78/*
78 * Define this if things work differently on an i386 and an i486: 79 * Define this if things work differently on an i386 and an i486:
79 * it will (on an i486) warn about kernel memory accesses that are 80 * it will (on an i486) warn about kernel memory accesses that are
diff --git a/include/asm-x86/pgtable_64.h b/include/asm-x86/pgtable_64.h
index e3dcf7a08a0b..fde9770e53d1 100644
--- a/include/asm-x86/pgtable_64.h
+++ b/include/asm-x86/pgtable_64.h
@@ -175,8 +175,6 @@ static inline int pmd_bad(pmd_t pmd)
175#define pte_present(x) (pte_val((x)) & (_PAGE_PRESENT | _PAGE_PROTNONE)) 175#define pte_present(x) (pte_val((x)) & (_PAGE_PRESENT | _PAGE_PROTNONE))
176 176
177#define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT)) /* FIXME: is this right? */ 177#define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT)) /* FIXME: is this right? */
178#define pte_page(x) pfn_to_page(pte_pfn((x)))
179#define pte_pfn(x) ((pte_val((x)) & __PHYSICAL_MASK) >> PAGE_SHIFT)
180 178
181/* 179/*
182 * Macro to mark a page protection value as "uncacheable". 180 * Macro to mark a page protection value as "uncacheable".
diff --git a/include/asm-x86/ptrace.h b/include/asm-x86/ptrace.h
index 33a034be8b5c..d64a61097165 100644
--- a/include/asm-x86/ptrace.h
+++ b/include/asm-x86/ptrace.h
@@ -250,6 +250,11 @@ static inline unsigned long frame_pointer(struct pt_regs *regs)
250 return regs->bp; 250 return regs->bp;
251} 251}
252 252
253static inline unsigned long user_stack_pointer(struct pt_regs *regs)
254{
255 return regs->sp;
256}
257
253/* 258/*
254 * These are defined as per linux/ptrace.h, which see. 259 * These are defined as per linux/ptrace.h, which see.
255 */ 260 */
diff --git a/include/asm-x86/resume-trace.h b/include/asm-x86/resume-trace.h
index 519a8ecbfc95..e39376d7de50 100644
--- a/include/asm-x86/resume-trace.h
+++ b/include/asm-x86/resume-trace.h
@@ -7,7 +7,7 @@
7do { \ 7do { \
8 if (pm_trace_enabled) { \ 8 if (pm_trace_enabled) { \
9 const void *tracedata; \ 9 const void *tracedata; \
10 asm volatile(_ASM_MOV_UL " $1f,%0\n" \ 10 asm volatile(_ASM_MOV " $1f,%0\n" \
11 ".section .tracedata,\"a\"\n" \ 11 ".section .tracedata,\"a\"\n" \
12 "1:\t.word %c1\n\t" \ 12 "1:\t.word %c1\n\t" \
13 _ASM_PTR " %c2\n" \ 13 _ASM_PTR " %c2\n" \
diff --git a/include/asm-x86/spinlock.h b/include/asm-x86/spinlock.h
index 5d08fa280fdf..93adae338ac6 100644
--- a/include/asm-x86/spinlock.h
+++ b/include/asm-x86/spinlock.h
@@ -97,7 +97,7 @@ static __always_inline int __ticket_spin_trylock(raw_spinlock_t *lock)
97 "jne 1f\n\t" 97 "jne 1f\n\t"
98 "movw %w0,%w1\n\t" 98 "movw %w0,%w1\n\t"
99 "incb %h1\n\t" 99 "incb %h1\n\t"
100 "lock ; cmpxchgw %w1,%2\n\t" 100 LOCK_PREFIX "cmpxchgw %w1,%2\n\t"
101 "1:" 101 "1:"
102 "sete %b1\n\t" 102 "sete %b1\n\t"
103 "movzbl %b1,%0\n\t" 103 "movzbl %b1,%0\n\t"
@@ -135,7 +135,7 @@ static __always_inline void __ticket_spin_lock(raw_spinlock_t *lock)
135 int inc = 0x00010000; 135 int inc = 0x00010000;
136 int tmp; 136 int tmp;
137 137
138 asm volatile("lock ; xaddl %0, %1\n" 138 asm volatile(LOCK_PREFIX "xaddl %0, %1\n"
139 "movzwl %w0, %2\n\t" 139 "movzwl %w0, %2\n\t"
140 "shrl $16, %0\n\t" 140 "shrl $16, %0\n\t"
141 "1:\t" 141 "1:\t"
@@ -162,7 +162,7 @@ static __always_inline int __ticket_spin_trylock(raw_spinlock_t *lock)
162 "cmpl %0,%1\n\t" 162 "cmpl %0,%1\n\t"
163 "jne 1f\n\t" 163 "jne 1f\n\t"
164 "addl $0x00010000, %1\n\t" 164 "addl $0x00010000, %1\n\t"
165 "lock ; cmpxchgl %1,%2\n\t" 165 LOCK_PREFIX "cmpxchgl %1,%2\n\t"
166 "1:" 166 "1:"
167 "sete %b1\n\t" 167 "sete %b1\n\t"
168 "movzbl %b1,%0\n\t" 168 "movzbl %b1,%0\n\t"
diff --git a/include/asm-x86/syscall.h b/include/asm-x86/syscall.h
new file mode 100644
index 000000000000..04c47dc5597c
--- /dev/null
+++ b/include/asm-x86/syscall.h
@@ -0,0 +1,211 @@
1/*
2 * Access to user system call parameters and results
3 *
4 * Copyright (C) 2008 Red Hat, Inc. All rights reserved.
5 *
6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions
8 * of the GNU General Public License v.2.
9 *
10 * See asm-generic/syscall.h for descriptions of what we must do here.
11 */
12
13#ifndef _ASM_SYSCALL_H
14#define _ASM_SYSCALL_H 1
15
16#include <linux/sched.h>
17#include <linux/err.h>
18
19static inline long syscall_get_nr(struct task_struct *task,
20 struct pt_regs *regs)
21{
22 /*
23 * We always sign-extend a -1 value being set here,
24 * so this is always either -1L or a syscall number.
25 */
26 return regs->orig_ax;
27}
28
29static inline void syscall_rollback(struct task_struct *task,
30 struct pt_regs *regs)
31{
32 regs->ax = regs->orig_ax;
33}
34
35static inline long syscall_get_error(struct task_struct *task,
36 struct pt_regs *regs)
37{
38 unsigned long error = regs->ax;
39#ifdef CONFIG_IA32_EMULATION
40 /*
41 * TS_COMPAT is set for 32-bit syscall entries and then
42 * remains set until we return to user mode.
43 */
44 if (task_thread_info(task)->status & TS_COMPAT)
45 /*
46 * Sign-extend the value so (int)-EFOO becomes (long)-EFOO
47 * and will match correctly in comparisons.
48 */
49 error = (long) (int) error;
50#endif
51 return IS_ERR_VALUE(error) ? error : 0;
52}
53
54static inline long syscall_get_return_value(struct task_struct *task,
55 struct pt_regs *regs)
56{
57 return regs->ax;
58}
59
60static inline void syscall_set_return_value(struct task_struct *task,
61 struct pt_regs *regs,
62 int error, long val)
63{
64 regs->ax = (long) error ?: val;
65}
66
67#ifdef CONFIG_X86_32
68
69static inline void syscall_get_arguments(struct task_struct *task,
70 struct pt_regs *regs,
71 unsigned int i, unsigned int n,
72 unsigned long *args)
73{
74 BUG_ON(i + n > 6);
75 memcpy(args, &regs->bx + i, n * sizeof(args[0]));
76}
77
78static inline void syscall_set_arguments(struct task_struct *task,
79 struct pt_regs *regs,
80 unsigned int i, unsigned int n,
81 const unsigned long *args)
82{
83 BUG_ON(i + n > 6);
84 memcpy(&regs->bx + i, args, n * sizeof(args[0]));
85}
86
87#else /* CONFIG_X86_64 */
88
89static inline void syscall_get_arguments(struct task_struct *task,
90 struct pt_regs *regs,
91 unsigned int i, unsigned int n,
92 unsigned long *args)
93{
94# ifdef CONFIG_IA32_EMULATION
95 if (task_thread_info(task)->status & TS_COMPAT)
96 switch (i + n) {
97 case 6:
98 if (!n--) break;
99 *args++ = regs->bp;
100 case 5:
101 if (!n--) break;
102 *args++ = regs->di;
103 case 4:
104 if (!n--) break;
105 *args++ = regs->si;
106 case 3:
107 if (!n--) break;
108 *args++ = regs->dx;
109 case 2:
110 if (!n--) break;
111 *args++ = regs->cx;
112 case 1:
113 if (!n--) break;
114 *args++ = regs->bx;
115 case 0:
116 if (!n--) break;
117 default:
118 BUG();
119 break;
120 }
121 else
122# endif
123 switch (i + n) {
124 case 6:
125 if (!n--) break;
126 *args++ = regs->r9;
127 case 5:
128 if (!n--) break;
129 *args++ = regs->r8;
130 case 4:
131 if (!n--) break;
132 *args++ = regs->r10;
133 case 3:
134 if (!n--) break;
135 *args++ = regs->dx;
136 case 2:
137 if (!n--) break;
138 *args++ = regs->si;
139 case 1:
140 if (!n--) break;
141 *args++ = regs->di;
142 case 0:
143 if (!n--) break;
144 default:
145 BUG();
146 break;
147 }
148}
149
150static inline void syscall_set_arguments(struct task_struct *task,
151 struct pt_regs *regs,
152 unsigned int i, unsigned int n,
153 const unsigned long *args)
154{
155# ifdef CONFIG_IA32_EMULATION
156 if (task_thread_info(task)->status & TS_COMPAT)
157 switch (i + n) {
158 case 6:
159 if (!n--) break;
160 regs->bp = *args++;
161 case 5:
162 if (!n--) break;
163 regs->di = *args++;
164 case 4:
165 if (!n--) break;
166 regs->si = *args++;
167 case 3:
168 if (!n--) break;
169 regs->dx = *args++;
170 case 2:
171 if (!n--) break;
172 regs->cx = *args++;
173 case 1:
174 if (!n--) break;
175 regs->bx = *args++;
176 case 0:
177 if (!n--) break;
178 default:
179 BUG();
180 }
181 else
182# endif
183 switch (i + n) {
184 case 6:
185 if (!n--) break;
186 regs->r9 = *args++;
187 case 5:
188 if (!n--) break;
189 regs->r8 = *args++;
190 case 4:
191 if (!n--) break;
192 regs->r10 = *args++;
193 case 3:
194 if (!n--) break;
195 regs->dx = *args++;
196 case 2:
197 if (!n--) break;
198 regs->si = *args++;
199 case 1:
200 if (!n--) break;
201 regs->di = *args++;
202 case 0:
203 if (!n--) break;
204 default:
205 BUG();
206 }
207}
208
209#endif /* CONFIG_X86_32 */
210
211#endif /* _ASM_SYSCALL_H */
diff --git a/include/asm-x86/thread_info.h b/include/asm-x86/thread_info.h
index 30586f2ee558..3f4e52bb77f5 100644
--- a/include/asm-x86/thread_info.h
+++ b/include/asm-x86/thread_info.h
@@ -71,6 +71,7 @@ struct thread_info {
71 * Warning: layout of LSW is hardcoded in entry.S 71 * Warning: layout of LSW is hardcoded in entry.S
72 */ 72 */
73#define TIF_SYSCALL_TRACE 0 /* syscall trace active */ 73#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
74#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
74#define TIF_SIGPENDING 2 /* signal pending */ 75#define TIF_SIGPENDING 2 /* signal pending */
75#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 76#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
76#define TIF_SINGLESTEP 4 /* reenable singlestep on user return*/ 77#define TIF_SINGLESTEP 4 /* reenable singlestep on user return*/
@@ -93,6 +94,7 @@ struct thread_info {
93#define TIF_BTS_TRACE_TS 27 /* record scheduling event timestamps */ 94#define TIF_BTS_TRACE_TS 27 /* record scheduling event timestamps */
94 95
95#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 96#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
97#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
96#define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 98#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
97#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) 99#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
98#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 100#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
@@ -133,7 +135,7 @@ struct thread_info {
133 135
134/* Only used for 64 bit */ 136/* Only used for 64 bit */
135#define _TIF_DO_NOTIFY_MASK \ 137#define _TIF_DO_NOTIFY_MASK \
136 (_TIF_SIGPENDING|_TIF_MCE_NOTIFY) 138 (_TIF_SIGPENDING|_TIF_MCE_NOTIFY|_TIF_NOTIFY_RESUME)
137 139
138/* flags to check in __switch_to() */ 140/* flags to check in __switch_to() */
139#define _TIF_WORK_CTXSW \ 141#define _TIF_WORK_CTXSW \
diff --git a/include/asm-x86/uaccess_64.h b/include/asm-x86/uaccess_64.h
index 5cfd2951c9e7..c96c1f5d07a2 100644
--- a/include/asm-x86/uaccess_64.h
+++ b/include/asm-x86/uaccess_64.h
@@ -7,6 +7,7 @@
7#include <linux/compiler.h> 7#include <linux/compiler.h>
8#include <linux/errno.h> 8#include <linux/errno.h>
9#include <linux/prefetch.h> 9#include <linux/prefetch.h>
10#include <linux/lockdep.h>
10#include <asm/page.h> 11#include <asm/page.h>
11 12
12/* 13/*
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 1ce19c1ef0e9..a26ebd25bac1 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -667,6 +667,15 @@ static inline int ata_id_has_dword_io(const u16 *id)
667 return 0; 667 return 0;
668} 668}
669 669
670static inline int ata_id_has_unload(const u16 *id)
671{
672 if (ata_id_major_version(id) >= 7 &&
673 (id[ATA_ID_CFSSE] & 0xC000) == 0x4000 &&
674 id[ATA_ID_CFSSE] & (1 << 13))
675 return 1;
676 return 0;
677}
678
670static inline int ata_id_current_chs_valid(const u16 *id) 679static inline int ata_id_current_chs_valid(const u16 *id)
671{ 680{
672 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command 681 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
@@ -745,7 +754,7 @@ static inline int ata_ok(u8 status)
745static inline int lba_28_ok(u64 block, u32 n_block) 754static inline int lba_28_ok(u64 block, u32 n_block)
746{ 755{
747 /* check the ending block number */ 756 /* check the ending block number */
748 return ((block + n_block - 1) < ((u64)1 << 28)) && (n_block <= 256); 757 return ((block + n_block) < ((u64)1 << 28)) && (n_block <= 256);
749} 758}
750 759
751static inline int lba_48_ok(u64 block, u32 n_block) 760static inline int lba_48_ok(u64 block, u32 n_block)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 44710d7e7bff..53ea933cf60b 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -843,8 +843,6 @@ extern int blkdev_issue_flush(struct block_device *, sector_t *);
843*/ 843*/
844extern int blk_verify_command(struct blk_cmd_filter *filter, 844extern int blk_verify_command(struct blk_cmd_filter *filter,
845 unsigned char *cmd, int has_write_perm); 845 unsigned char *cmd, int has_write_perm);
846extern int blk_register_filter(struct gendisk *disk);
847extern void blk_unregister_filter(struct gendisk *disk);
848extern void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter); 846extern void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter);
849 847
850#define MAX_PHYS_SEGMENTS 128 848#define MAX_PHYS_SEGMENTS 128
diff --git a/arch/arm/include/asm/cnt32_to_63.h b/include/linux/cnt32_to_63.h
index 480c873fa746..8c0f9505b48c 100644
--- a/arch/arm/include/asm/cnt32_to_63.h
+++ b/include/linux/cnt32_to_63.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * include/asm/cnt32_to_63.h -- extend a 32-bit counter to 63 bits 2 * Extend a 32-bit counter to 63 bits
3 * 3 *
4 * Author: Nicolas Pitre 4 * Author: Nicolas Pitre
5 * Created: December 3, 2006 5 * Created: December 3, 2006
@@ -10,15 +10,30 @@
10 * as published by the Free Software Foundation. 10 * as published by the Free Software Foundation.
11 */ 11 */
12 12
13#ifndef __INCLUDE_CNT32_TO_63_H__ 13#ifndef __LINUX_CNT32_TO_63_H__
14#define __INCLUDE_CNT32_TO_63_H__ 14#define __LINUX_CNT32_TO_63_H__
15 15
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17#include <asm/types.h> 17#include <linux/types.h>
18#include <asm/byteorder.h> 18#include <asm/byteorder.h>
19 19
20/* 20/* this is used only to give gcc a clue about good code generation */
21 * Prototype: u64 cnt32_to_63(u32 cnt) 21union cnt32_to_63 {
22 struct {
23#if defined(__LITTLE_ENDIAN)
24 u32 lo, hi;
25#elif defined(__BIG_ENDIAN)
26 u32 hi, lo;
27#endif
28 };
29 u64 val;
30};
31
32
33/**
34 * cnt32_to_63 - Expand a 32-bit counter to a 63-bit counter
35 * @cnt_lo: The low part of the counter
36 *
22 * Many hardware clock counters are only 32 bits wide and therefore have 37 * Many hardware clock counters are only 32 bits wide and therefore have
23 * a relatively short period making wrap-arounds rather frequent. This 38 * a relatively short period making wrap-arounds rather frequent. This
24 * is a problem when implementing sched_clock() for example, where a 64-bit 39 * is a problem when implementing sched_clock() for example, where a 64-bit
@@ -51,26 +66,13 @@
51 * clear-bit instruction. Otherwise caller must remember to clear the top 66 * clear-bit instruction. Otherwise caller must remember to clear the top
52 * bit explicitly. 67 * bit explicitly.
53 */ 68 */
54
55/* this is used only to give gcc a clue about good code generation */
56typedef union {
57 struct {
58#if defined(__LITTLE_ENDIAN)
59 u32 lo, hi;
60#elif defined(__BIG_ENDIAN)
61 u32 hi, lo;
62#endif
63 };
64 u64 val;
65} cnt32_to_63_t;
66
67#define cnt32_to_63(cnt_lo) \ 69#define cnt32_to_63(cnt_lo) \
68({ \ 70({ \
69 static volatile u32 __m_cnt_hi = 0; \ 71 static volatile u32 __m_cnt_hi; \
70 cnt32_to_63_t __x; \ 72 union cnt32_to_63 __x; \
71 __x.hi = __m_cnt_hi; \ 73 __x.hi = __m_cnt_hi; \
72 __x.lo = (cnt_lo); \ 74 __x.lo = (cnt_lo); \
73 if (unlikely((s32)(__x.hi ^ __x.lo) < 0)) \ 75 if (unlikely((s32)(__x.hi ^ __x.lo) < 0)) \
74 __m_cnt_hi = __x.hi = (__x.hi ^ 0x80000000) + (__x.hi >> 31); \ 76 __m_cnt_hi = __x.hi = (__x.hi ^ 0x80000000) + (__x.hi >> 31); \
75 __x.val; \ 77 __x.val; \
76}) 78})
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 952e0f857ac9..ba9114ec5d3a 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -48,6 +48,11 @@ static inline int is_device_dma_capable(struct device *dev)
48 return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE; 48 return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE;
49} 49}
50 50
51static inline int is_buffer_dma_capable(u64 mask, dma_addr_t addr, size_t size)
52{
53 return addr + size <= mask;
54}
55
51#ifdef CONFIG_HAS_DMA 56#ifdef CONFIG_HAS_DMA
52#include <asm/dma-mapping.h> 57#include <asm/dma-mapping.h>
53#else 58#else
@@ -58,6 +63,13 @@ static inline int is_device_dma_capable(struct device *dev)
58#define dma_sync_single dma_sync_single_for_cpu 63#define dma_sync_single dma_sync_single_for_cpu
59#define dma_sync_sg dma_sync_sg_for_cpu 64#define dma_sync_sg dma_sync_sg_for_cpu
60 65
66static inline u64 dma_get_mask(struct device *dev)
67{
68 if (dev && dev->dma_mask && *dev->dma_mask)
69 return *dev->dma_mask;
70 return DMA_32BIT_MASK;
71}
72
61extern u64 dma_get_required_mask(struct device *dev); 73extern u64 dma_get_required_mask(struct device *dev);
62 74
63static inline unsigned int dma_get_max_seg_size(struct device *dev) 75static inline unsigned int dma_get_max_seg_size(struct device *dev)
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 6d93dce61cbb..2f245fe63bda 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -47,14 +47,22 @@ enum hrtimer_restart {
47 * HRTIMER_CB_IRQSAFE: Callback may run in hardirq context 47 * HRTIMER_CB_IRQSAFE: Callback may run in hardirq context
48 * HRTIMER_CB_IRQSAFE_NO_RESTART: Callback may run in hardirq context and 48 * HRTIMER_CB_IRQSAFE_NO_RESTART: Callback may run in hardirq context and
49 * does not restart the timer 49 * does not restart the timer
50 * HRTIMER_CB_IRQSAFE_NO_SOFTIRQ: Callback must run in hardirq context 50 * HRTIMER_CB_IRQSAFE_PERCPU: Callback must run in hardirq context
51 * Special mode for tick emultation 51 * Special mode for tick emulation and
52 * scheduler timer. Such timers are per
53 * cpu and not allowed to be migrated on
54 * cpu unplug.
55 * HRTIMER_CB_IRQSAFE_UNLOCKED: Callback should run in hardirq context
56 * with timer->base lock unlocked
57 * used for timers which call wakeup to
58 * avoid lock order problems with rq->lock
52 */ 59 */
53enum hrtimer_cb_mode { 60enum hrtimer_cb_mode {
54 HRTIMER_CB_SOFTIRQ, 61 HRTIMER_CB_SOFTIRQ,
55 HRTIMER_CB_IRQSAFE, 62 HRTIMER_CB_IRQSAFE,
56 HRTIMER_CB_IRQSAFE_NO_RESTART, 63 HRTIMER_CB_IRQSAFE_NO_RESTART,
57 HRTIMER_CB_IRQSAFE_NO_SOFTIRQ, 64 HRTIMER_CB_IRQSAFE_PERCPU,
65 HRTIMER_CB_IRQSAFE_UNLOCKED,
58}; 66};
59 67
60/* 68/*
@@ -67,9 +75,10 @@ enum hrtimer_cb_mode {
67 * 0x02 callback function running 75 * 0x02 callback function running
68 * 0x04 callback pending (high resolution mode) 76 * 0x04 callback pending (high resolution mode)
69 * 77 *
70 * Special case: 78 * Special cases:
71 * 0x03 callback function running and enqueued 79 * 0x03 callback function running and enqueued
72 * (was requeued on another CPU) 80 * (was requeued on another CPU)
81 * 0x09 timer was migrated on CPU hotunplug
73 * The "callback function running and enqueued" status is only possible on 82 * The "callback function running and enqueued" status is only possible on
74 * SMP. It happens for example when a posix timer expired and the callback 83 * SMP. It happens for example when a posix timer expired and the callback
75 * queued a signal. Between dropping the lock which protects the posix timer 84 * queued a signal. Between dropping the lock which protects the posix timer
@@ -87,6 +96,7 @@ enum hrtimer_cb_mode {
87#define HRTIMER_STATE_ENQUEUED 0x01 96#define HRTIMER_STATE_ENQUEUED 0x01
88#define HRTIMER_STATE_CALLBACK 0x02 97#define HRTIMER_STATE_CALLBACK 0x02
89#define HRTIMER_STATE_PENDING 0x04 98#define HRTIMER_STATE_PENDING 0x04
99#define HRTIMER_STATE_MIGRATE 0x08
90 100
91/** 101/**
92 * struct hrtimer - the basic hrtimer structure 102 * struct hrtimer - the basic hrtimer structure
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 1524829f73f2..6514db8fd2e4 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -366,7 +366,9 @@ enum {
366 /* Currently on a filemark */ 366 /* Currently on a filemark */
367 IDE_AFLAG_FILEMARK = (1 << 25), 367 IDE_AFLAG_FILEMARK = (1 << 25),
368 /* 0 = no tape is loaded, so we don't rewind after ejecting */ 368 /* 0 = no tape is loaded, so we don't rewind after ejecting */
369 IDE_AFLAG_MEDIUM_PRESENT = (1 << 26) 369 IDE_AFLAG_MEDIUM_PRESENT = (1 << 26),
370
371 IDE_AFLAG_NO_AUTOCLOSE = (1 << 27),
370}; 372};
371 373
372struct ide_drive_s { 374struct ide_drive_s {
diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h
index c975caf75385..a6d0586e2bf7 100644
--- a/include/linux/iommu-helper.h
+++ b/include/linux/iommu-helper.h
@@ -1,6 +1,20 @@
1#ifndef _LINUX_IOMMU_HELPER_H
2#define _LINUX_IOMMU_HELPER_H
3
4static inline unsigned long iommu_device_max_index(unsigned long size,
5 unsigned long offset,
6 u64 dma_mask)
7{
8 if (size + offset > dma_mask)
9 return dma_mask - offset + 1;
10 else
11 return size;
12}
13
1extern int iommu_is_span_boundary(unsigned int index, unsigned int nr, 14extern int iommu_is_span_boundary(unsigned int index, unsigned int nr,
2 unsigned long shift, 15 unsigned long shift,
3 unsigned long boundary_size); 16 unsigned long boundary_size);
17extern void iommu_area_reserve(unsigned long *map, unsigned long i, int len);
4extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, 18extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
5 unsigned long start, unsigned int nr, 19 unsigned long start, unsigned int nr,
6 unsigned long shift, 20 unsigned long shift,
@@ -8,3 +22,5 @@ extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
8 unsigned long align_mask); 22 unsigned long align_mask);
9extern void iommu_area_free(unsigned long *map, unsigned long start, 23extern void iommu_area_free(unsigned long *map, unsigned long start,
10 unsigned int nr); 24 unsigned int nr);
25
26#endif
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index fded376b94e3..ee9bcc6f32b6 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -162,9 +162,9 @@ extern struct resource * __devm_request_region(struct device *dev,
162 struct resource *parent, resource_size_t start, 162 struct resource *parent, resource_size_t start,
163 resource_size_t n, const char *name); 163 resource_size_t n, const char *name);
164 164
165#define devm_release_region(start,n) \ 165#define devm_release_region(dev, start, n) \
166 __devm_release_region(dev, &ioport_resource, (start), (n)) 166 __devm_release_region(dev, &ioport_resource, (start), (n))
167#define devm_release_mem_region(start,n) \ 167#define devm_release_mem_region(dev, start, n) \
168 __devm_release_region(dev, &iomem_resource, (start), (n)) 168 __devm_release_region(dev, &iomem_resource, (start), (n))
169 169
170extern void __devm_release_region(struct device *dev, struct resource *parent, 170extern void __devm_release_region(struct device *dev, struct resource *parent,
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 225bfc5bd9ec..947cf84e555d 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -146,6 +146,7 @@ enum {
146 ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */ 146 ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */
147 ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */ 147 ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */
148 ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */ 148 ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */
149 ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */
149 ATA_DFLAG_INIT_MASK = (1 << 24) - 1, 150 ATA_DFLAG_INIT_MASK = (1 << 24) - 1,
150 151
151 ATA_DFLAG_DETACH = (1 << 24), 152 ATA_DFLAG_DETACH = (1 << 24),
@@ -244,6 +245,7 @@ enum {
244 ATA_TMOUT_BOOT = 30000, /* heuristic */ 245 ATA_TMOUT_BOOT = 30000, /* heuristic */
245 ATA_TMOUT_BOOT_QUICK = 7000, /* heuristic */ 246 ATA_TMOUT_BOOT_QUICK = 7000, /* heuristic */
246 ATA_TMOUT_INTERNAL_QUICK = 5000, 247 ATA_TMOUT_INTERNAL_QUICK = 5000,
248 ATA_TMOUT_MAX_PARK = 30000,
247 249
248 /* FIXME: GoVault needs 2s but we can't afford that without 250 /* FIXME: GoVault needs 2s but we can't afford that without
249 * parallel probing. 800ms is enough for iVDR disk 251 * parallel probing. 800ms is enough for iVDR disk
@@ -319,8 +321,11 @@ enum {
319 ATA_EH_RESET = ATA_EH_SOFTRESET | ATA_EH_HARDRESET, 321 ATA_EH_RESET = ATA_EH_SOFTRESET | ATA_EH_HARDRESET,
320 ATA_EH_ENABLE_LINK = (1 << 3), 322 ATA_EH_ENABLE_LINK = (1 << 3),
321 ATA_EH_LPM = (1 << 4), /* link power management action */ 323 ATA_EH_LPM = (1 << 4), /* link power management action */
324 ATA_EH_PARK = (1 << 5), /* unload heads and stop I/O */
322 325
323 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE, 326 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE | ATA_EH_PARK,
327 ATA_EH_ALL_ACTIONS = ATA_EH_REVALIDATE | ATA_EH_RESET |
328 ATA_EH_ENABLE_LINK | ATA_EH_LPM,
324 329
325 /* ata_eh_info->flags */ 330 /* ata_eh_info->flags */
326 ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */ 331 ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */
@@ -452,6 +457,7 @@ enum link_pm {
452 MEDIUM_POWER, 457 MEDIUM_POWER,
453}; 458};
454extern struct device_attribute dev_attr_link_power_management_policy; 459extern struct device_attribute dev_attr_link_power_management_policy;
460extern struct device_attribute dev_attr_unload_heads;
455extern struct device_attribute dev_attr_em_message_type; 461extern struct device_attribute dev_attr_em_message_type;
456extern struct device_attribute dev_attr_em_message; 462extern struct device_attribute dev_attr_em_message;
457extern struct device_attribute dev_attr_sw_activity; 463extern struct device_attribute dev_attr_sw_activity;
@@ -554,8 +560,8 @@ struct ata_ering {
554struct ata_device { 560struct ata_device {
555 struct ata_link *link; 561 struct ata_link *link;
556 unsigned int devno; /* 0 or 1 */ 562 unsigned int devno; /* 0 or 1 */
557 unsigned long flags; /* ATA_DFLAG_xxx */
558 unsigned int horkage; /* List of broken features */ 563 unsigned int horkage; /* List of broken features */
564 unsigned long flags; /* ATA_DFLAG_xxx */
559 struct scsi_device *sdev; /* attached SCSI device */ 565 struct scsi_device *sdev; /* attached SCSI device */
560#ifdef CONFIG_ATA_ACPI 566#ifdef CONFIG_ATA_ACPI
561 acpi_handle acpi_handle; 567 acpi_handle acpi_handle;
@@ -564,6 +570,7 @@ struct ata_device {
564 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */ 570 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */
565 u64 n_sectors; /* size of device, if ATA */ 571 u64 n_sectors; /* size of device, if ATA */
566 unsigned int class; /* ATA_DEV_xxx */ 572 unsigned int class; /* ATA_DEV_xxx */
573 unsigned long unpark_deadline;
567 574
568 u8 pio_mode; 575 u8 pio_mode;
569 u8 dma_mode; 576 u8 dma_mode;
@@ -621,6 +628,7 @@ struct ata_eh_context {
621 [ATA_EH_CMD_TIMEOUT_TABLE_SIZE]; 628 [ATA_EH_CMD_TIMEOUT_TABLE_SIZE];
622 unsigned int classes[ATA_MAX_DEVICES]; 629 unsigned int classes[ATA_MAX_DEVICES];
623 unsigned int did_probe_mask; 630 unsigned int did_probe_mask;
631 unsigned int unloaded_mask;
624 unsigned int saved_ncq_enabled; 632 unsigned int saved_ncq_enabled;
625 u8 saved_xfer_mode[ATA_MAX_DEVICES]; 633 u8 saved_xfer_mode[ATA_MAX_DEVICES];
626 /* timestamp for the last reset attempt or success */ 634 /* timestamp for the last reset attempt or success */
@@ -688,7 +696,8 @@ struct ata_port {
688 unsigned int qc_active; 696 unsigned int qc_active;
689 int nr_active_links; /* #links with active qcs */ 697 int nr_active_links; /* #links with active qcs */
690 698
691 struct ata_link link; /* host default link */ 699 struct ata_link link; /* host default link */
700 struct ata_link *slave_link; /* see ata_slave_link_init() */
692 701
693 int nr_pmp_links; /* nr of available PMP links */ 702 int nr_pmp_links; /* nr of available PMP links */
694 struct ata_link *pmp_link; /* array of PMP links */ 703 struct ata_link *pmp_link; /* array of PMP links */
@@ -709,6 +718,7 @@ struct ata_port {
709 struct list_head eh_done_q; 718 struct list_head eh_done_q;
710 wait_queue_head_t eh_wait_q; 719 wait_queue_head_t eh_wait_q;
711 int eh_tries; 720 int eh_tries;
721 struct completion park_req_pending;
712 722
713 pm_message_t pm_mesg; 723 pm_message_t pm_mesg;
714 int *pm_result; 724 int *pm_result;
@@ -772,8 +782,8 @@ struct ata_port_operations {
772 /* 782 /*
773 * Optional features 783 * Optional features
774 */ 784 */
775 int (*scr_read)(struct ata_port *ap, unsigned int sc_reg, u32 *val); 785 int (*scr_read)(struct ata_link *link, unsigned int sc_reg, u32 *val);
776 int (*scr_write)(struct ata_port *ap, unsigned int sc_reg, u32 val); 786 int (*scr_write)(struct ata_link *link, unsigned int sc_reg, u32 val);
777 void (*pmp_attach)(struct ata_port *ap); 787 void (*pmp_attach)(struct ata_port *ap);
778 void (*pmp_detach)(struct ata_port *ap); 788 void (*pmp_detach)(struct ata_port *ap);
779 int (*enable_pm)(struct ata_port *ap, enum link_pm policy); 789 int (*enable_pm)(struct ata_port *ap, enum link_pm policy);
@@ -895,6 +905,7 @@ extern void ata_port_disable(struct ata_port *);
895extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); 905extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);
896extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, 906extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,
897 const struct ata_port_info * const * ppi, int n_ports); 907 const struct ata_port_info * const * ppi, int n_ports);
908extern int ata_slave_link_init(struct ata_port *ap);
898extern int ata_host_start(struct ata_host *host); 909extern int ata_host_start(struct ata_host *host);
899extern int ata_host_register(struct ata_host *host, 910extern int ata_host_register(struct ata_host *host,
900 struct scsi_host_template *sht); 911 struct scsi_host_template *sht);
@@ -920,8 +931,8 @@ extern int sata_scr_valid(struct ata_link *link);
920extern int sata_scr_read(struct ata_link *link, int reg, u32 *val); 931extern int sata_scr_read(struct ata_link *link, int reg, u32 *val);
921extern int sata_scr_write(struct ata_link *link, int reg, u32 val); 932extern int sata_scr_write(struct ata_link *link, int reg, u32 val);
922extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val); 933extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val);
923extern int ata_link_online(struct ata_link *link); 934extern bool ata_link_online(struct ata_link *link);
924extern int ata_link_offline(struct ata_link *link); 935extern bool ata_link_offline(struct ata_link *link);
925#ifdef CONFIG_PM 936#ifdef CONFIG_PM
926extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); 937extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg);
927extern void ata_host_resume(struct ata_host *host); 938extern void ata_host_resume(struct ata_host *host);
@@ -1098,6 +1109,7 @@ extern void ata_std_error_handler(struct ata_port *ap);
1098 */ 1109 */
1099extern const struct ata_port_operations ata_base_port_ops; 1110extern const struct ata_port_operations ata_base_port_ops;
1100extern const struct ata_port_operations sata_port_ops; 1111extern const struct ata_port_operations sata_port_ops;
1112extern struct device_attribute *ata_common_sdev_attrs[];
1101 1113
1102#define ATA_BASE_SHT(drv_name) \ 1114#define ATA_BASE_SHT(drv_name) \
1103 .module = THIS_MODULE, \ 1115 .module = THIS_MODULE, \
@@ -1112,7 +1124,8 @@ extern const struct ata_port_operations sata_port_ops;
1112 .proc_name = drv_name, \ 1124 .proc_name = drv_name, \
1113 .slave_configure = ata_scsi_slave_config, \ 1125 .slave_configure = ata_scsi_slave_config, \
1114 .slave_destroy = ata_scsi_slave_destroy, \ 1126 .slave_destroy = ata_scsi_slave_destroy, \
1115 .bios_param = ata_std_bios_param 1127 .bios_param = ata_std_bios_param, \
1128 .sdev_attrs = ata_common_sdev_attrs
1116 1129
1117#define ATA_NCQ_SHT(drv_name) \ 1130#define ATA_NCQ_SHT(drv_name) \
1118 ATA_BASE_SHT(drv_name), \ 1131 ATA_BASE_SHT(drv_name), \
@@ -1134,7 +1147,7 @@ static inline bool sata_pmp_attached(struct ata_port *ap)
1134 1147
1135static inline int ata_is_host_link(const struct ata_link *link) 1148static inline int ata_is_host_link(const struct ata_link *link)
1136{ 1149{
1137 return link == &link->ap->link; 1150 return link == &link->ap->link || link == link->ap->slave_link;
1138} 1151}
1139#else /* CONFIG_SATA_PMP */ 1152#else /* CONFIG_SATA_PMP */
1140static inline bool sata_pmp_supported(struct ata_port *ap) 1153static inline bool sata_pmp_supported(struct ata_port *ap)
@@ -1167,7 +1180,7 @@ static inline int sata_srst_pmp(struct ata_link *link)
1167 printk("%sata%u: "fmt, lv, (ap)->print_id , ##args) 1180 printk("%sata%u: "fmt, lv, (ap)->print_id , ##args)
1168 1181
1169#define ata_link_printk(link, lv, fmt, args...) do { \ 1182#define ata_link_printk(link, lv, fmt, args...) do { \
1170 if (sata_pmp_attached((link)->ap)) \ 1183 if (sata_pmp_attached((link)->ap) || (link)->ap->slave_link) \
1171 printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \ 1184 printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \
1172 (link)->pmp , ##args); \ 1185 (link)->pmp , ##args); \
1173 else \ 1186 else \
@@ -1265,34 +1278,17 @@ static inline int ata_link_active(struct ata_link *link)
1265 return ata_tag_valid(link->active_tag) || link->sactive; 1278 return ata_tag_valid(link->active_tag) || link->sactive;
1266} 1279}
1267 1280
1268static inline struct ata_link *ata_port_first_link(struct ata_port *ap) 1281extern struct ata_link *__ata_port_next_link(struct ata_port *ap,
1269{ 1282 struct ata_link *link,
1270 if (sata_pmp_attached(ap)) 1283 bool dev_only);
1271 return ap->pmp_link;
1272 return &ap->link;
1273}
1274
1275static inline struct ata_link *ata_port_next_link(struct ata_link *link)
1276{
1277 struct ata_port *ap = link->ap;
1278
1279 if (ata_is_host_link(link)) {
1280 if (!sata_pmp_attached(ap))
1281 return NULL;
1282 return ap->pmp_link;
1283 }
1284
1285 if (++link < ap->nr_pmp_links + ap->pmp_link)
1286 return link;
1287 return NULL;
1288}
1289 1284
1290#define __ata_port_for_each_link(lk, ap) \ 1285#define __ata_port_for_each_link(link, ap) \
1291 for ((lk) = &(ap)->link; (lk); (lk) = ata_port_next_link(lk)) 1286 for ((link) = __ata_port_next_link((ap), NULL, false); (link); \
1287 (link) = __ata_port_next_link((ap), (link), false))
1292 1288
1293#define ata_port_for_each_link(link, ap) \ 1289#define ata_port_for_each_link(link, ap) \
1294 for ((link) = ata_port_first_link(ap); (link); \ 1290 for ((link) = __ata_port_next_link((ap), NULL, true); (link); \
1295 (link) = ata_port_next_link(link)) 1291 (link) = __ata_port_next_link((ap), (link), true))
1296 1292
1297#define ata_link_for_each_dev(dev, link) \ 1293#define ata_link_for_each_dev(dev, link) \
1298 for ((dev) = (link)->device; \ 1294 for ((dev) = (link)->device; \
diff --git a/include/linux/memstick.h b/include/linux/memstick.h
index a9f998a3f48b..d0c37e682234 100644
--- a/include/linux/memstick.h
+++ b/include/linux/memstick.h
@@ -21,30 +21,30 @@
21struct ms_status_register { 21struct ms_status_register {
22 unsigned char reserved; 22 unsigned char reserved;
23 unsigned char interrupt; 23 unsigned char interrupt;
24#define MEMSTICK_INT_CMDNAK 0x0001 24#define MEMSTICK_INT_CMDNAK 0x01
25#define MEMSTICK_INT_IOREQ 0x0008 25#define MEMSTICK_INT_IOREQ 0x08
26#define MEMSTICK_INT_IOBREQ 0x0010 26#define MEMSTICK_INT_IOBREQ 0x10
27#define MEMSTICK_INT_BREQ 0x0020 27#define MEMSTICK_INT_BREQ 0x20
28#define MEMSTICK_INT_ERR 0x0040 28#define MEMSTICK_INT_ERR 0x40
29#define MEMSTICK_INT_CED 0x0080 29#define MEMSTICK_INT_CED 0x80
30 30
31 unsigned char status0; 31 unsigned char status0;
32#define MEMSTICK_STATUS0_WP 0x0001 32#define MEMSTICK_STATUS0_WP 0x01
33#define MEMSTICK_STATUS0_SL 0x0002 33#define MEMSTICK_STATUS0_SL 0x02
34#define MEMSTICK_STATUS0_BF 0x0010 34#define MEMSTICK_STATUS0_BF 0x10
35#define MEMSTICK_STATUS0_BE 0x0020 35#define MEMSTICK_STATUS0_BE 0x20
36#define MEMSTICK_STATUS0_FB0 0x0040 36#define MEMSTICK_STATUS0_FB0 0x40
37#define MEMSTICK_STATUS0_MB 0x0080 37#define MEMSTICK_STATUS0_MB 0x80
38 38
39 unsigned char status1; 39 unsigned char status1;
40#define MEMSTICK_STATUS1_UCFG 0x0001 40#define MEMSTICK_STATUS1_UCFG 0x01
41#define MEMSTICK_STATUS1_FGER 0x0002 41#define MEMSTICK_STATUS1_FGER 0x02
42#define MEMSTICK_STATUS1_UCEX 0x0004 42#define MEMSTICK_STATUS1_UCEX 0x04
43#define MEMSTICK_STATUS1_EXER 0x0008 43#define MEMSTICK_STATUS1_EXER 0x08
44#define MEMSTICK_STATUS1_UCDT 0x0010 44#define MEMSTICK_STATUS1_UCDT 0x10
45#define MEMSTICK_STATUS1_DTER 0x0020 45#define MEMSTICK_STATUS1_DTER 0x20
46#define MEMSTICK_STATUS1_FBI 0x0040 46#define MEMSTICK_STATUS1_FB1 0x40
47#define MEMSTICK_STATUS1_MB 0x0080 47#define MEMSTICK_STATUS1_MB 0x80
48} __attribute__((packed)); 48} __attribute__((packed));
49 49
50struct ms_id_register { 50struct ms_id_register {
@@ -56,32 +56,32 @@ struct ms_id_register {
56 56
57struct ms_param_register { 57struct ms_param_register {
58 unsigned char system; 58 unsigned char system;
59#define MEMSTICK_SYS_ATEN 0xc0
60#define MEMSTICK_SYS_BAMD 0x80
61#define MEMSTICK_SYS_PAM 0x08 59#define MEMSTICK_SYS_PAM 0x08
60#define MEMSTICK_SYS_BAMD 0x80
62 61
63 unsigned char block_address_msb; 62 unsigned char block_address_msb;
64 unsigned short block_address; 63 unsigned short block_address;
65 unsigned char cp; 64 unsigned char cp;
66#define MEMSTICK_CP_BLOCK 0x0000 65#define MEMSTICK_CP_BLOCK 0x00
67#define MEMSTICK_CP_PAGE 0x0020 66#define MEMSTICK_CP_PAGE 0x20
68#define MEMSTICK_CP_EXTRA 0x0040 67#define MEMSTICK_CP_EXTRA 0x40
69#define MEMSTICK_CP_OVERWRITE 0x0080 68#define MEMSTICK_CP_OVERWRITE 0x80
70 69
71 unsigned char page_address; 70 unsigned char page_address;
72} __attribute__((packed)); 71} __attribute__((packed));
73 72
74struct ms_extra_data_register { 73struct ms_extra_data_register {
75 unsigned char overwrite_flag; 74 unsigned char overwrite_flag;
76#define MEMSTICK_OVERWRITE_UPDATA 0x0010 75#define MEMSTICK_OVERWRITE_UDST 0x10
77#define MEMSTICK_OVERWRITE_PAGE 0x0060 76#define MEMSTICK_OVERWRITE_PGST1 0x20
78#define MEMSTICK_OVERWRITE_BLOCK 0x0080 77#define MEMSTICK_OVERWRITE_PGST0 0x40
78#define MEMSTICK_OVERWRITE_BKST 0x80
79 79
80 unsigned char management_flag; 80 unsigned char management_flag;
81#define MEMSTICK_MANAGEMENT_SYSTEM 0x0004 81#define MEMSTICK_MANAGEMENT_SYSFLG 0x04
82#define MEMSTICK_MANAGEMENT_TRANS_TABLE 0x0008 82#define MEMSTICK_MANAGEMENT_ATFLG 0x08
83#define MEMSTICK_MANAGEMENT_COPY 0x0010 83#define MEMSTICK_MANAGEMENT_SCMS1 0x10
84#define MEMSTICK_MANAGEMENT_ACCESS 0x0020 84#define MEMSTICK_MANAGEMENT_SCMS0 0x20
85 85
86 unsigned short logical_address; 86 unsigned short logical_address;
87} __attribute__((packed)); 87} __attribute__((packed));
@@ -96,9 +96,9 @@ struct ms_register {
96 96
97struct mspro_param_register { 97struct mspro_param_register {
98 unsigned char system; 98 unsigned char system;
99#define MEMSTICK_SYS_SERIAL 0x80
100#define MEMSTICK_SYS_PAR4 0x00 99#define MEMSTICK_SYS_PAR4 0x00
101#define MEMSTICK_SYS_PAR8 0x40 100#define MEMSTICK_SYS_PAR8 0x40
101#define MEMSTICK_SYS_SERIAL 0x80
102 102
103 unsigned short data_count; 103 unsigned short data_count;
104 unsigned int data_address; 104 unsigned int data_address;
@@ -147,7 +147,7 @@ struct ms_register_addr {
147 unsigned char w_length; 147 unsigned char w_length;
148} __attribute__((packed)); 148} __attribute__((packed));
149 149
150enum { 150enum memstick_tpc {
151 MS_TPC_READ_MG_STATUS = 0x01, 151 MS_TPC_READ_MG_STATUS = 0x01,
152 MS_TPC_READ_LONG_DATA = 0x02, 152 MS_TPC_READ_LONG_DATA = 0x02,
153 MS_TPC_READ_SHORT_DATA = 0x03, 153 MS_TPC_READ_SHORT_DATA = 0x03,
@@ -167,7 +167,7 @@ enum {
167 MS_TPC_SET_CMD = 0x0e 167 MS_TPC_SET_CMD = 0x0e
168}; 168};
169 169
170enum { 170enum memstick_command {
171 MS_CMD_BLOCK_END = 0x33, 171 MS_CMD_BLOCK_END = 0x33,
172 MS_CMD_RESET = 0x3c, 172 MS_CMD_RESET = 0x3c,
173 MS_CMD_BLOCK_WRITE = 0x55, 173 MS_CMD_BLOCK_WRITE = 0x55,
@@ -201,8 +201,6 @@ enum {
201 201
202/*** Driver structures and functions ***/ 202/*** Driver structures and functions ***/
203 203
204#define MEMSTICK_PART_SHIFT 3
205
206enum memstick_param { MEMSTICK_POWER = 1, MEMSTICK_INTERFACE }; 204enum memstick_param { MEMSTICK_POWER = 1, MEMSTICK_INTERFACE };
207 205
208#define MEMSTICK_POWER_OFF 0 206#define MEMSTICK_POWER_OFF 0
@@ -215,24 +213,27 @@ enum memstick_param { MEMSTICK_POWER = 1, MEMSTICK_INTERFACE };
215struct memstick_host; 213struct memstick_host;
216struct memstick_driver; 214struct memstick_driver;
217 215
216struct memstick_device_id {
217 unsigned char match_flags;
218#define MEMSTICK_MATCH_ALL 0x01 218#define MEMSTICK_MATCH_ALL 0x01
219 219
220 unsigned char type;
220#define MEMSTICK_TYPE_LEGACY 0xff 221#define MEMSTICK_TYPE_LEGACY 0xff
221#define MEMSTICK_TYPE_DUO 0x00 222#define MEMSTICK_TYPE_DUO 0x00
222#define MEMSTICK_TYPE_PRO 0x01 223#define MEMSTICK_TYPE_PRO 0x01
223 224
225 unsigned char category;
224#define MEMSTICK_CATEGORY_STORAGE 0xff 226#define MEMSTICK_CATEGORY_STORAGE 0xff
225#define MEMSTICK_CATEGORY_STORAGE_DUO 0x00 227#define MEMSTICK_CATEGORY_STORAGE_DUO 0x00
228#define MEMSTICK_CATEGORY_IO 0x01
229#define MEMSTICK_CATEGORY_IO_PRO 0x10
226 230
227#define MEMSTICK_CLASS_GENERIC 0xff
228#define MEMSTICK_CLASS_GENERIC_DUO 0x00
229
230
231struct memstick_device_id {
232 unsigned char match_flags;
233 unsigned char type;
234 unsigned char category;
235 unsigned char class; 231 unsigned char class;
232#define MEMSTICK_CLASS_FLASH 0xff
233#define MEMSTICK_CLASS_DUO 0x00
234#define MEMSTICK_CLASS_ROM 0x01
235#define MEMSTICK_CLASS_RO 0x02
236#define MEMSTICK_CLASS_WP 0x03
236}; 237};
237 238
238struct memstick_request { 239struct memstick_request {
@@ -319,9 +320,9 @@ void memstick_suspend_host(struct memstick_host *host);
319void memstick_resume_host(struct memstick_host *host); 320void memstick_resume_host(struct memstick_host *host);
320 321
321void memstick_init_req_sg(struct memstick_request *mrq, unsigned char tpc, 322void memstick_init_req_sg(struct memstick_request *mrq, unsigned char tpc,
322 struct scatterlist *sg); 323 const struct scatterlist *sg);
323void memstick_init_req(struct memstick_request *mrq, unsigned char tpc, 324void memstick_init_req(struct memstick_request *mrq, unsigned char tpc,
324 void *buf, size_t length); 325 const void *buf, size_t length);
325int memstick_next_req(struct memstick_host *host, 326int memstick_next_req(struct memstick_host *host,
326 struct memstick_request **mrq); 327 struct memstick_request **mrq);
327void memstick_new_req(struct memstick_host *host); 328void memstick_new_req(struct memstick_host *host);
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 655ea0d1ee14..b2f944468313 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -141,6 +141,10 @@ enum {
141 MLX4_STAT_RATE_OFFSET = 5 141 MLX4_STAT_RATE_OFFSET = 5
142}; 142};
143 143
144enum {
145 MLX4_MTT_FLAG_PRESENT = 1
146};
147
144static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) 148static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor)
145{ 149{
146 return (major << 32) | (minor << 16) | subminor; 150 return (major << 32) | (minor << 16) | subminor;
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 443bc7cd8c62..428328a05fa1 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -751,8 +751,9 @@ static inline int zonelist_node_idx(struct zoneref *zoneref)
751 * 751 *
752 * This function returns the next zone at or below a given zone index that is 752 * This function returns the next zone at or below a given zone index that is
753 * within the allowed nodemask using a cursor as the starting point for the 753 * within the allowed nodemask using a cursor as the starting point for the
754 * search. The zoneref returned is a cursor that is used as the next starting 754 * search. The zoneref returned is a cursor that represents the current zone
755 * point for future calls to next_zones_zonelist(). 755 * being examined. It should be advanced by one before calling
756 * next_zones_zonelist again.
756 */ 757 */
757struct zoneref *next_zones_zonelist(struct zoneref *z, 758struct zoneref *next_zones_zonelist(struct zoneref *z,
758 enum zone_type highest_zoneidx, 759 enum zone_type highest_zoneidx,
@@ -768,9 +769,8 @@ struct zoneref *next_zones_zonelist(struct zoneref *z,
768 * 769 *
769 * This function returns the first zone at or below a given zone index that is 770 * This function returns the first zone at or below a given zone index that is
770 * within the allowed nodemask. The zoneref returned is a cursor that can be 771 * within the allowed nodemask. The zoneref returned is a cursor that can be
771 * used to iterate the zonelist with next_zones_zonelist. The cursor should 772 * used to iterate the zonelist with next_zones_zonelist by advancing it by
772 * not be used by the caller as it does not match the value of the zone 773 * one before calling.
773 * returned.
774 */ 774 */
775static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist, 775static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,
776 enum zone_type highest_zoneidx, 776 enum zone_type highest_zoneidx,
@@ -795,7 +795,7 @@ static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,
795#define for_each_zone_zonelist_nodemask(zone, z, zlist, highidx, nodemask) \ 795#define for_each_zone_zonelist_nodemask(zone, z, zlist, highidx, nodemask) \
796 for (z = first_zones_zonelist(zlist, highidx, nodemask, &zone); \ 796 for (z = first_zones_zonelist(zlist, highidx, nodemask, &zone); \
797 zone; \ 797 zone; \
798 z = next_zones_zonelist(z, highidx, nodemask, &zone)) \ 798 z = next_zones_zonelist(++z, highidx, nodemask, &zone)) \
799 799
800/** 800/**
801 * for_each_zone_zonelist - helper macro to iterate over valid zones in a zonelist at or below a given zone index 801 * for_each_zone_zonelist - helper macro to iterate over valid zones in a zonelist at or below a given zone index
diff --git a/include/linux/pci.h b/include/linux/pci.h
index c0e14008a3c2..98dc6243a706 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -534,7 +534,7 @@ extern void pci_sort_breadthfirst(void);
534#ifdef CONFIG_PCI_LEGACY 534#ifdef CONFIG_PCI_LEGACY
535struct pci_dev __deprecated *pci_find_device(unsigned int vendor, 535struct pci_dev __deprecated *pci_find_device(unsigned int vendor,
536 unsigned int device, 536 unsigned int device,
537 const struct pci_dev *from); 537 struct pci_dev *from);
538struct pci_dev __deprecated *pci_find_slot(unsigned int bus, 538struct pci_dev __deprecated *pci_find_slot(unsigned int bus,
539 unsigned int devfn); 539 unsigned int devfn);
540#endif /* CONFIG_PCI_LEGACY */ 540#endif /* CONFIG_PCI_LEGACY */
@@ -550,7 +550,7 @@ struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
550 struct pci_dev *from); 550 struct pci_dev *from);
551struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, 551struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
552 unsigned int ss_vendor, unsigned int ss_device, 552 unsigned int ss_vendor, unsigned int ss_device,
553 const struct pci_dev *from); 553 struct pci_dev *from);
554struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); 554struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn);
555struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); 555struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn);
556struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); 556struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from);
@@ -816,7 +816,7 @@ _PCI_NOP_ALL(write,)
816 816
817static inline struct pci_dev *pci_find_device(unsigned int vendor, 817static inline struct pci_dev *pci_find_device(unsigned int vendor,
818 unsigned int device, 818 unsigned int device,
819 const struct pci_dev *from) 819 struct pci_dev *from)
820{ 820{
821 return NULL; 821 return NULL;
822} 822}
@@ -838,7 +838,7 @@ static inline struct pci_dev *pci_get_subsys(unsigned int vendor,
838 unsigned int device, 838 unsigned int device,
839 unsigned int ss_vendor, 839 unsigned int ss_vendor,
840 unsigned int ss_device, 840 unsigned int ss_device,
841 const struct pci_dev *from) 841 struct pci_dev *from)
842{ 842{
843 return NULL; 843 return NULL;
844} 844}
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index f1624b396754..c114103af987 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -497,6 +497,16 @@
497#define PCI_DEVICE_ID_AMD_K8_NB_ADDRMAP 0x1101 497#define PCI_DEVICE_ID_AMD_K8_NB_ADDRMAP 0x1101
498#define PCI_DEVICE_ID_AMD_K8_NB_MEMCTL 0x1102 498#define PCI_DEVICE_ID_AMD_K8_NB_MEMCTL 0x1102
499#define PCI_DEVICE_ID_AMD_K8_NB_MISC 0x1103 499#define PCI_DEVICE_ID_AMD_K8_NB_MISC 0x1103
500#define PCI_DEVICE_ID_AMD_10H_NB_HT 0x1200
501#define PCI_DEVICE_ID_AMD_10H_NB_MAP 0x1201
502#define PCI_DEVICE_ID_AMD_10H_NB_DRAM 0x1202
503#define PCI_DEVICE_ID_AMD_10H_NB_MISC 0x1203
504#define PCI_DEVICE_ID_AMD_10H_NB_LINK 0x1204
505#define PCI_DEVICE_ID_AMD_11H_NB_HT 0x1300
506#define PCI_DEVICE_ID_AMD_11H_NB_MAP 0x1301
507#define PCI_DEVICE_ID_AMD_11H_NB_DRAM 0x1302
508#define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303
509#define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304
500#define PCI_DEVICE_ID_AMD_LANCE 0x2000 510#define PCI_DEVICE_ID_AMD_LANCE 0x2000
501#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 511#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
502#define PCI_DEVICE_ID_AMD_SCSI 0x2020 512#define PCI_DEVICE_ID_AMD_SCSI 0x2020
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 1ce54b63085d..be764e514e35 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -21,7 +21,14 @@ struct pnp_dev;
21/* 21/*
22 * Resource Management 22 * Resource Management
23 */ 23 */
24#ifdef CONFIG_PNP
24struct resource *pnp_get_resource(struct pnp_dev *, unsigned int, unsigned int); 25struct resource *pnp_get_resource(struct pnp_dev *, unsigned int, unsigned int);
26#else
27static inline struct resource *pnp_get_resource(struct pnp_dev *dev, unsigned int type, unsigned int num)
28{
29 return NULL;
30}
31#endif
25 32
26static inline int pnp_resource_valid(struct resource *res) 33static inline int pnp_resource_valid(struct resource *res)
27{ 34{
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index b160fb18e8d6..37aaf2b39863 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -6,6 +6,7 @@ extern int ramfs_get_sb(struct file_system_type *fs_type,
6 int flags, const char *dev_name, void *data, struct vfsmount *mnt); 6 int flags, const char *dev_name, void *data, struct vfsmount *mnt);
7 7
8#ifndef CONFIG_MMU 8#ifndef CONFIG_MMU
9extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize);
9extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file, 10extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
10 unsigned long addr, 11 unsigned long addr,
11 unsigned long len, 12 unsigned long len,
diff --git a/include/linux/smb.h b/include/linux/smb.h
index caa43b2370cb..82fefddc5987 100644
--- a/include/linux/smb.h
+++ b/include/linux/smb.h
@@ -11,7 +11,9 @@
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/magic.h> 13#include <linux/magic.h>
14#ifdef __KERNEL__
14#include <linux/time.h> 15#include <linux/time.h>
16#endif
15 17
16enum smb_protocol { 18enum smb_protocol {
17 SMB_PROTOCOL_NONE, 19 SMB_PROTOCOL_NONE,
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
index 5da9794b2d78..b106fd8e0d5c 100644
--- a/include/linux/stacktrace.h
+++ b/include/linux/stacktrace.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_STACKTRACE_H 1#ifndef __LINUX_STACKTRACE_H
2#define __LINUX_STACKTRACE_H 2#define __LINUX_STACKTRACE_H
3 3
4struct task_struct;
5
4#ifdef CONFIG_STACKTRACE 6#ifdef CONFIG_STACKTRACE
5struct stack_trace { 7struct stack_trace {
6 unsigned int nr_entries, max_entries; 8 unsigned int nr_entries, max_entries;
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index b3d3e27c6299..c3626c0ba9d3 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -596,4 +596,5 @@ int p9_idpool_check(int id, struct p9_idpool *p);
596int p9_error_init(void); 596int p9_error_init(void);
597int p9_errstr2errno(char *, int); 597int p9_errstr2errno(char *, int);
598int p9_trans_fd_init(void); 598int p9_trans_fd_init(void);
599void p9_trans_fd_exit(void);
599#endif /* NET_9P_H */ 600#endif /* NET_9P_H */
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h
index 0db3a4038dc0..3ca737120a90 100644
--- a/include/net/9p/transport.h
+++ b/include/net/9p/transport.h
@@ -26,6 +26,8 @@
26#ifndef NET_9P_TRANSPORT_H 26#ifndef NET_9P_TRANSPORT_H
27#define NET_9P_TRANSPORT_H 27#define NET_9P_TRANSPORT_H
28 28
29#include <linux/module.h>
30
29/** 31/**
30 * enum p9_trans_status - different states of underlying transports 32 * enum p9_trans_status - different states of underlying transports
31 * @Connected: transport is connected and healthy 33 * @Connected: transport is connected and healthy
@@ -91,9 +93,12 @@ struct p9_trans_module {
91 int maxsize; /* max message size of transport */ 93 int maxsize; /* max message size of transport */
92 int def; /* this transport should be default */ 94 int def; /* this transport should be default */
93 struct p9_trans * (*create)(const char *, char *, int, unsigned char); 95 struct p9_trans * (*create)(const char *, char *, int, unsigned char);
96 struct module *owner;
94}; 97};
95 98
96void v9fs_register_trans(struct p9_trans_module *m); 99void v9fs_register_trans(struct p9_trans_module *m);
97struct p9_trans_module *v9fs_match_trans(const substring_t *name); 100void v9fs_unregister_trans(struct p9_trans_module *m);
98struct p9_trans_module *v9fs_default_trans(void); 101struct p9_trans_module *v9fs_get_trans_by_name(const substring_t *name);
102struct p9_trans_module *v9fs_get_default_trans(void);
103void v9fs_put_trans(struct p9_trans_module *m);
99#endif /* NET_9P_TRANSPORT_H */ 104#endif /* NET_9P_TRANSPORT_H */
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 18024b8cecb8..208fe5a38546 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -702,7 +702,7 @@ static inline int nla_len(const struct nlattr *nla)
702 */ 702 */
703static inline int nla_ok(const struct nlattr *nla, int remaining) 703static inline int nla_ok(const struct nlattr *nla, int remaining)
704{ 704{
705 return remaining >= sizeof(*nla) && 705 return remaining >= (int) sizeof(*nla) &&
706 nla->nla_len >= sizeof(*nla) && 706 nla->nla_len >= sizeof(*nla) &&
707 nla->nla_len <= remaining; 707 nla->nla_len <= remaining;
708} 708}
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index 24811732bdb2..029a54a02396 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -227,6 +227,9 @@ struct sctp_chunk *sctp_make_abort_violation(const struct sctp_association *,
227 const struct sctp_chunk *, 227 const struct sctp_chunk *,
228 const __u8 *, 228 const __u8 *,
229 const size_t ); 229 const size_t );
230struct sctp_chunk *sctp_make_violation_paramlen(const struct sctp_association *,
231 const struct sctp_chunk *,
232 struct sctp_paramhdr *);
230struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *, 233struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *,
231 const struct sctp_transport *, 234 const struct sctp_transport *,
232 const void *payload, 235 const void *payload,
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 5c40cc537d4c..192f8716aa9e 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -309,6 +309,20 @@ struct scsi_lun {
309}; 309};
310 310
311/* 311/*
312 * The Well Known LUNS (SAM-3) in our int representation of a LUN
313 */
314#define SCSI_W_LUN_BASE 0xc100
315#define SCSI_W_LUN_REPORT_LUNS (SCSI_W_LUN_BASE + 1)
316#define SCSI_W_LUN_ACCESS_CONTROL (SCSI_W_LUN_BASE + 2)
317#define SCSI_W_LUN_TARGET_LOG_PAGE (SCSI_W_LUN_BASE + 3)
318
319static inline int scsi_is_wlun(unsigned int lun)
320{
321 return (lun & 0xff00) == SCSI_W_LUN_BASE;
322}
323
324
325/*
312 * MESSAGE CODES 326 * MESSAGE CODES
313 */ 327 */
314 328
diff --git a/init/main.c b/init/main.c
index f6f7042331dc..3820323c4c84 100644
--- a/init/main.c
+++ b/init/main.c
@@ -708,7 +708,7 @@ int do_one_initcall(initcall_t fn)
708 int result; 708 int result;
709 709
710 if (initcall_debug) { 710 if (initcall_debug) {
711 print_fn_descriptor_symbol("calling %s\n", fn); 711 printk("calling %pF\n", fn);
712 t0 = ktime_get(); 712 t0 = ktime_get();
713 } 713 }
714 714
@@ -718,8 +718,8 @@ int do_one_initcall(initcall_t fn)
718 t1 = ktime_get(); 718 t1 = ktime_get();
719 delta = ktime_sub(t1, t0); 719 delta = ktime_sub(t1, t0);
720 720
721 print_fn_descriptor_symbol("initcall %s", fn); 721 printk("initcall %pF returned %d after %Ld msecs\n",
722 printk(" returned %d after %Ld msecs\n", result, 722 fn, result,
723 (unsigned long long) delta.tv64 >> 20); 723 (unsigned long long) delta.tv64 >> 20);
724 } 724 }
725 725
@@ -737,8 +737,7 @@ int do_one_initcall(initcall_t fn)
737 local_irq_enable(); 737 local_irq_enable();
738 } 738 }
739 if (msgbuf[0]) { 739 if (msgbuf[0]) {
740 print_fn_descriptor_symbol(KERN_WARNING "initcall %s", fn); 740 printk("initcall %pF returned with %s\n", fn, msgbuf);
741 printk(" returned with %s\n", msgbuf);
742 } 741 }
743 742
744 return result; 743 return result;
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 13932abde159..a0123d75ec9a 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -2738,14 +2738,15 @@ void cgroup_fork_callbacks(struct task_struct *child)
2738 */ 2738 */
2739void cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new) 2739void cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new)
2740{ 2740{
2741 struct cgroup *oldcgrp, *newcgrp; 2741 struct cgroup *oldcgrp, *newcgrp = NULL;
2742 2742
2743 if (need_mm_owner_callback) { 2743 if (need_mm_owner_callback) {
2744 int i; 2744 int i;
2745 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { 2745 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
2746 struct cgroup_subsys *ss = subsys[i]; 2746 struct cgroup_subsys *ss = subsys[i];
2747 oldcgrp = task_cgroup(old, ss->subsys_id); 2747 oldcgrp = task_cgroup(old, ss->subsys_id);
2748 newcgrp = task_cgroup(new, ss->subsys_id); 2748 if (new)
2749 newcgrp = task_cgroup(new, ss->subsys_id);
2749 if (oldcgrp == newcgrp) 2750 if (oldcgrp == newcgrp)
2750 continue; 2751 continue;
2751 if (ss->mm_owner_changed) 2752 if (ss->mm_owner_changed)
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index f227bc172690..827cd9adccb2 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -843,37 +843,25 @@ static void cpuset_change_cpumask(struct task_struct *tsk,
843/** 843/**
844 * update_tasks_cpumask - Update the cpumasks of tasks in the cpuset. 844 * update_tasks_cpumask - Update the cpumasks of tasks in the cpuset.
845 * @cs: the cpuset in which each task's cpus_allowed mask needs to be changed 845 * @cs: the cpuset in which each task's cpus_allowed mask needs to be changed
846 * @heap: if NULL, defer allocating heap memory to cgroup_scan_tasks()
846 * 847 *
847 * Called with cgroup_mutex held 848 * Called with cgroup_mutex held
848 * 849 *
849 * The cgroup_scan_tasks() function will scan all the tasks in a cgroup, 850 * The cgroup_scan_tasks() function will scan all the tasks in a cgroup,
850 * calling callback functions for each. 851 * calling callback functions for each.
851 * 852 *
852 * Return 0 if successful, -errno if not. 853 * No return value. It's guaranteed that cgroup_scan_tasks() always returns 0
854 * if @heap != NULL.
853 */ 855 */
854static int update_tasks_cpumask(struct cpuset *cs) 856static void update_tasks_cpumask(struct cpuset *cs, struct ptr_heap *heap)
855{ 857{
856 struct cgroup_scanner scan; 858 struct cgroup_scanner scan;
857 struct ptr_heap heap;
858 int retval;
859
860 /*
861 * cgroup_scan_tasks() will initialize heap->gt for us.
862 * heap_init() is still needed here for we should not change
863 * cs->cpus_allowed when heap_init() fails.
864 */
865 retval = heap_init(&heap, PAGE_SIZE, GFP_KERNEL, NULL);
866 if (retval)
867 return retval;
868 859
869 scan.cg = cs->css.cgroup; 860 scan.cg = cs->css.cgroup;
870 scan.test_task = cpuset_test_cpumask; 861 scan.test_task = cpuset_test_cpumask;
871 scan.process_task = cpuset_change_cpumask; 862 scan.process_task = cpuset_change_cpumask;
872 scan.heap = &heap; 863 scan.heap = heap;
873 retval = cgroup_scan_tasks(&scan); 864 cgroup_scan_tasks(&scan);
874
875 heap_free(&heap);
876 return retval;
877} 865}
878 866
879/** 867/**
@@ -883,6 +871,7 @@ static int update_tasks_cpumask(struct cpuset *cs)
883 */ 871 */
884static int update_cpumask(struct cpuset *cs, const char *buf) 872static int update_cpumask(struct cpuset *cs, const char *buf)
885{ 873{
874 struct ptr_heap heap;
886 struct cpuset trialcs; 875 struct cpuset trialcs;
887 int retval; 876 int retval;
888 int is_load_balanced; 877 int is_load_balanced;
@@ -917,6 +906,10 @@ static int update_cpumask(struct cpuset *cs, const char *buf)
917 if (cpus_equal(cs->cpus_allowed, trialcs.cpus_allowed)) 906 if (cpus_equal(cs->cpus_allowed, trialcs.cpus_allowed))
918 return 0; 907 return 0;
919 908
909 retval = heap_init(&heap, PAGE_SIZE, GFP_KERNEL, NULL);
910 if (retval)
911 return retval;
912
920 is_load_balanced = is_sched_load_balance(&trialcs); 913 is_load_balanced = is_sched_load_balance(&trialcs);
921 914
922 mutex_lock(&callback_mutex); 915 mutex_lock(&callback_mutex);
@@ -927,9 +920,9 @@ static int update_cpumask(struct cpuset *cs, const char *buf)
927 * Scan tasks in the cpuset, and update the cpumasks of any 920 * Scan tasks in the cpuset, and update the cpumasks of any
928 * that need an update. 921 * that need an update.
929 */ 922 */
930 retval = update_tasks_cpumask(cs); 923 update_tasks_cpumask(cs, &heap);
931 if (retval < 0) 924
932 return retval; 925 heap_free(&heap);
933 926
934 if (is_load_balanced) 927 if (is_load_balanced)
935 async_rebuild_sched_domains(); 928 async_rebuild_sched_domains();
@@ -1965,7 +1958,7 @@ static void scan_for_empty_cpusets(const struct cpuset *root)
1965 nodes_empty(cp->mems_allowed)) 1958 nodes_empty(cp->mems_allowed))
1966 remove_tasks_in_empty_cpuset(cp); 1959 remove_tasks_in_empty_cpuset(cp);
1967 else { 1960 else {
1968 update_tasks_cpumask(cp); 1961 update_tasks_cpumask(cp, NULL);
1969 update_tasks_nodemask(cp, &oldmems); 1962 update_tasks_nodemask(cp, &oldmems);
1970 } 1963 }
1971 } 1964 }
diff --git a/kernel/dma-coherent.c b/kernel/dma-coherent.c
index c1d4d5b4c61c..f013a0c2e111 100644
--- a/kernel/dma-coherent.c
+++ b/kernel/dma-coherent.c
@@ -124,6 +124,7 @@ int dma_alloc_from_coherent(struct device *dev, ssize_t size,
124 } 124 }
125 return (mem != NULL); 125 return (mem != NULL);
126} 126}
127EXPORT_SYMBOL(dma_alloc_from_coherent);
127 128
128/** 129/**
129 * dma_release_from_coherent() - try to free the memory allocated from per-device coherent memory pool 130 * dma_release_from_coherent() - try to free the memory allocated from per-device coherent memory pool
@@ -151,3 +152,4 @@ int dma_release_from_coherent(struct device *dev, int order, void *vaddr)
151 } 152 }
152 return 0; 153 return 0;
153} 154}
155EXPORT_SYMBOL(dma_release_from_coherent);
diff --git a/kernel/exit.c b/kernel/exit.c
index 16395644a98f..85a83c831856 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -583,8 +583,6 @@ mm_need_new_owner(struct mm_struct *mm, struct task_struct *p)
583 * If there are other users of the mm and the owner (us) is exiting 583 * If there are other users of the mm and the owner (us) is exiting
584 * we need to find a new owner to take on the responsibility. 584 * we need to find a new owner to take on the responsibility.
585 */ 585 */
586 if (!mm)
587 return 0;
588 if (atomic_read(&mm->mm_users) <= 1) 586 if (atomic_read(&mm->mm_users) <= 1)
589 return 0; 587 return 0;
590 if (mm->owner != p) 588 if (mm->owner != p)
@@ -627,6 +625,16 @@ retry:
627 } while_each_thread(g, c); 625 } while_each_thread(g, c);
628 626
629 read_unlock(&tasklist_lock); 627 read_unlock(&tasklist_lock);
628 /*
629 * We found no owner yet mm_users > 1: this implies that we are
630 * most likely racing with swapoff (try_to_unuse()) or /proc or
631 * ptrace or page migration (get_task_mm()). Mark owner as NULL,
632 * so that subsystems can understand the callback and take action.
633 */
634 down_write(&mm->mmap_sem);
635 cgroup_mm_owner_callbacks(mm->owner, NULL);
636 mm->owner = NULL;
637 up_write(&mm->mmap_sem);
630 return; 638 return;
631 639
632assign_new_owner: 640assign_new_owner:
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index b8e4dce80a74..cdec83e722fa 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -672,13 +672,14 @@ static inline int hrtimer_enqueue_reprogram(struct hrtimer *timer,
672 */ 672 */
673 BUG_ON(timer->function(timer) != HRTIMER_NORESTART); 673 BUG_ON(timer->function(timer) != HRTIMER_NORESTART);
674 return 1; 674 return 1;
675 case HRTIMER_CB_IRQSAFE_NO_SOFTIRQ: 675 case HRTIMER_CB_IRQSAFE_PERCPU:
676 case HRTIMER_CB_IRQSAFE_UNLOCKED:
676 /* 677 /*
677 * This is solely for the sched tick emulation with 678 * This is solely for the sched tick emulation with
678 * dynamic tick support to ensure that we do not 679 * dynamic tick support to ensure that we do not
679 * restart the tick right on the edge and end up with 680 * restart the tick right on the edge and end up with
680 * the tick timer in the softirq ! The calling site 681 * the tick timer in the softirq ! The calling site
681 * takes care of this. 682 * takes care of this. Also used for hrtimer sleeper !
682 */ 683 */
683 debug_hrtimer_deactivate(timer); 684 debug_hrtimer_deactivate(timer);
684 return 1; 685 return 1;
@@ -1245,7 +1246,8 @@ static void __run_hrtimer(struct hrtimer *timer)
1245 timer_stats_account_hrtimer(timer); 1246 timer_stats_account_hrtimer(timer);
1246 1247
1247 fn = timer->function; 1248 fn = timer->function;
1248 if (timer->cb_mode == HRTIMER_CB_IRQSAFE_NO_SOFTIRQ) { 1249 if (timer->cb_mode == HRTIMER_CB_IRQSAFE_PERCPU ||
1250 timer->cb_mode == HRTIMER_CB_IRQSAFE_UNLOCKED) {
1249 /* 1251 /*
1250 * Used for scheduler timers, avoid lock inversion with 1252 * Used for scheduler timers, avoid lock inversion with
1251 * rq->lock and tasklist_lock. 1253 * rq->lock and tasklist_lock.
@@ -1452,7 +1454,7 @@ void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, struct task_struct *task)
1452 sl->timer.function = hrtimer_wakeup; 1454 sl->timer.function = hrtimer_wakeup;
1453 sl->task = task; 1455 sl->task = task;
1454#ifdef CONFIG_HIGH_RES_TIMERS 1456#ifdef CONFIG_HIGH_RES_TIMERS
1455 sl->timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ; 1457 sl->timer.cb_mode = HRTIMER_CB_IRQSAFE_UNLOCKED;
1456#endif 1458#endif
1457} 1459}
1458 1460
@@ -1591,29 +1593,95 @@ static void __cpuinit init_hrtimers_cpu(int cpu)
1591 1593
1592#ifdef CONFIG_HOTPLUG_CPU 1594#ifdef CONFIG_HOTPLUG_CPU
1593 1595
1594static void migrate_hrtimer_list(struct hrtimer_clock_base *old_base, 1596static int migrate_hrtimer_list(struct hrtimer_clock_base *old_base,
1595 struct hrtimer_clock_base *new_base) 1597 struct hrtimer_clock_base *new_base, int dcpu)
1596{ 1598{
1597 struct hrtimer *timer; 1599 struct hrtimer *timer;
1598 struct rb_node *node; 1600 struct rb_node *node;
1601 int raise = 0;
1599 1602
1600 while ((node = rb_first(&old_base->active))) { 1603 while ((node = rb_first(&old_base->active))) {
1601 timer = rb_entry(node, struct hrtimer, node); 1604 timer = rb_entry(node, struct hrtimer, node);
1602 BUG_ON(hrtimer_callback_running(timer)); 1605 BUG_ON(hrtimer_callback_running(timer));
1603 debug_hrtimer_deactivate(timer); 1606 debug_hrtimer_deactivate(timer);
1604 __remove_hrtimer(timer, old_base, HRTIMER_STATE_INACTIVE, 0); 1607
1608 /*
1609 * Should not happen. Per CPU timers should be
1610 * canceled _before_ the migration code is called
1611 */
1612 if (timer->cb_mode == HRTIMER_CB_IRQSAFE_PERCPU) {
1613 __remove_hrtimer(timer, old_base,
1614 HRTIMER_STATE_INACTIVE, 0);
1615 WARN(1, "hrtimer (%p %p)active but cpu %d dead\n",
1616 timer, timer->function, dcpu);
1617 continue;
1618 }
1619
1620 /*
1621 * Mark it as STATE_MIGRATE not INACTIVE otherwise the
1622 * timer could be seen as !active and just vanish away
1623 * under us on another CPU
1624 */
1625 __remove_hrtimer(timer, old_base, HRTIMER_STATE_MIGRATE, 0);
1605 timer->base = new_base; 1626 timer->base = new_base;
1606 /* 1627 /*
1607 * Enqueue the timer. Allow reprogramming of the event device 1628 * Enqueue the timer. Allow reprogramming of the event device
1608 */ 1629 */
1609 enqueue_hrtimer(timer, new_base, 1); 1630 enqueue_hrtimer(timer, new_base, 1);
1631
1632#ifdef CONFIG_HIGH_RES_TIMERS
1633 /*
1634 * Happens with high res enabled when the timer was
1635 * already expired and the callback mode is
1636 * HRTIMER_CB_IRQSAFE_UNLOCKED (hrtimer_sleeper). The
1637 * enqueue code does not move them to the soft irq
1638 * pending list for performance/latency reasons, but
1639 * in the migration state, we need to do that
1640 * otherwise we end up with a stale timer.
1641 */
1642 if (timer->state == HRTIMER_STATE_MIGRATE) {
1643 timer->state = HRTIMER_STATE_PENDING;
1644 list_add_tail(&timer->cb_entry,
1645 &new_base->cpu_base->cb_pending);
1646 raise = 1;
1647 }
1648#endif
1649 /* Clear the migration state bit */
1650 timer->state &= ~HRTIMER_STATE_MIGRATE;
1651 }
1652 return raise;
1653}
1654
1655#ifdef CONFIG_HIGH_RES_TIMERS
1656static int migrate_hrtimer_pending(struct hrtimer_cpu_base *old_base,
1657 struct hrtimer_cpu_base *new_base)
1658{
1659 struct hrtimer *timer;
1660 int raise = 0;
1661
1662 while (!list_empty(&old_base->cb_pending)) {
1663 timer = list_entry(old_base->cb_pending.next,
1664 struct hrtimer, cb_entry);
1665
1666 __remove_hrtimer(timer, timer->base, HRTIMER_STATE_PENDING, 0);
1667 timer->base = &new_base->clock_base[timer->base->index];
1668 list_add_tail(&timer->cb_entry, &new_base->cb_pending);
1669 raise = 1;
1610 } 1670 }
1671 return raise;
1672}
1673#else
1674static int migrate_hrtimer_pending(struct hrtimer_cpu_base *old_base,
1675 struct hrtimer_cpu_base *new_base)
1676{
1677 return 0;
1611} 1678}
1679#endif
1612 1680
1613static void migrate_hrtimers(int cpu) 1681static void migrate_hrtimers(int cpu)
1614{ 1682{
1615 struct hrtimer_cpu_base *old_base, *new_base; 1683 struct hrtimer_cpu_base *old_base, *new_base;
1616 int i; 1684 int i, raise = 0;
1617 1685
1618 BUG_ON(cpu_online(cpu)); 1686 BUG_ON(cpu_online(cpu));
1619 old_base = &per_cpu(hrtimer_bases, cpu); 1687 old_base = &per_cpu(hrtimer_bases, cpu);
@@ -1626,14 +1694,21 @@ static void migrate_hrtimers(int cpu)
1626 spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING); 1694 spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING);
1627 1695
1628 for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) { 1696 for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) {
1629 migrate_hrtimer_list(&old_base->clock_base[i], 1697 if (migrate_hrtimer_list(&old_base->clock_base[i],
1630 &new_base->clock_base[i]); 1698 &new_base->clock_base[i], cpu))
1699 raise = 1;
1631 } 1700 }
1632 1701
1702 if (migrate_hrtimer_pending(old_base, new_base))
1703 raise = 1;
1704
1633 spin_unlock(&old_base->lock); 1705 spin_unlock(&old_base->lock);
1634 spin_unlock(&new_base->lock); 1706 spin_unlock(&new_base->lock);
1635 local_irq_enable(); 1707 local_irq_enable();
1636 put_cpu_var(hrtimer_bases); 1708 put_cpu_var(hrtimer_bases);
1709
1710 if (raise)
1711 hrtimer_raise_softirq();
1637} 1712}
1638#endif /* CONFIG_HOTPLUG_CPU */ 1713#endif /* CONFIG_HOTPLUG_CPU */
1639 1714
diff --git a/kernel/kexec.c b/kernel/kexec.c
index 59f3f0df35d4..aef265325cd3 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -753,8 +753,14 @@ static struct page *kimage_alloc_page(struct kimage *image,
753 *old = addr | (*old & ~PAGE_MASK); 753 *old = addr | (*old & ~PAGE_MASK);
754 754
755 /* The old page I have found cannot be a 755 /* The old page I have found cannot be a
756 * destination page, so return it. 756 * destination page, so return it if it's
757 * gfp_flags honor the ones passed in.
757 */ 758 */
759 if (!(gfp_mask & __GFP_HIGHMEM) &&
760 PageHighMem(old_page)) {
761 kimage_free_pages(old_page);
762 continue;
763 }
758 addr = old_addr; 764 addr = old_addr;
759 page = old_page; 765 page = old_page;
760 break; 766 break;
diff --git a/kernel/kgdb.c b/kernel/kgdb.c
index eaa21fc9ad1d..e4dcfb2272a4 100644
--- a/kernel/kgdb.c
+++ b/kernel/kgdb.c
@@ -488,7 +488,7 @@ static int write_mem_msg(int binary)
488 if (err) 488 if (err)
489 return err; 489 return err;
490 if (CACHE_FLUSH_IS_SAFE) 490 if (CACHE_FLUSH_IS_SAFE)
491 flush_icache_range(addr, addr + length + 1); 491 flush_icache_range(addr, addr + length);
492 return 0; 492 return 0;
493 } 493 }
494 494
@@ -590,6 +590,7 @@ static void kgdb_wait(struct pt_regs *regs)
590 590
591 /* Signal the primary CPU that we are done: */ 591 /* Signal the primary CPU that we are done: */
592 atomic_set(&cpu_in_kgdb[cpu], 0); 592 atomic_set(&cpu_in_kgdb[cpu], 0);
593 touch_softlockup_watchdog();
593 clocksource_touch_watchdog(); 594 clocksource_touch_watchdog();
594 local_irq_restore(flags); 595 local_irq_restore(flags);
595} 596}
@@ -1432,6 +1433,7 @@ acquirelock:
1432 atomic_read(&kgdb_cpu_doing_single_step) != cpu) { 1433 atomic_read(&kgdb_cpu_doing_single_step) != cpu) {
1433 1434
1434 atomic_set(&kgdb_active, -1); 1435 atomic_set(&kgdb_active, -1);
1436 touch_softlockup_watchdog();
1435 clocksource_touch_watchdog(); 1437 clocksource_touch_watchdog();
1436 local_irq_restore(flags); 1438 local_irq_restore(flags);
1437 1439
@@ -1462,7 +1464,7 @@ acquirelock:
1462 * Get the passive CPU lock which will hold all the non-primary 1464 * Get the passive CPU lock which will hold all the non-primary
1463 * CPU in a spin state while the debugger is active 1465 * CPU in a spin state while the debugger is active
1464 */ 1466 */
1465 if (!kgdb_single_step || !kgdb_contthread) { 1467 if (!kgdb_single_step) {
1466 for (i = 0; i < NR_CPUS; i++) 1468 for (i = 0; i < NR_CPUS; i++)
1467 atomic_set(&passive_cpu_wait[i], 1); 1469 atomic_set(&passive_cpu_wait[i], 1);
1468 } 1470 }
@@ -1475,7 +1477,7 @@ acquirelock:
1475 1477
1476#ifdef CONFIG_SMP 1478#ifdef CONFIG_SMP
1477 /* Signal the other CPUs to enter kgdb_wait() */ 1479 /* Signal the other CPUs to enter kgdb_wait() */
1478 if ((!kgdb_single_step || !kgdb_contthread) && kgdb_do_roundup) 1480 if ((!kgdb_single_step) && kgdb_do_roundup)
1479 kgdb_roundup_cpus(flags); 1481 kgdb_roundup_cpus(flags);
1480#endif 1482#endif
1481 1483
@@ -1494,7 +1496,7 @@ acquirelock:
1494 kgdb_post_primary_code(ks->linux_regs, ks->ex_vector, ks->err_code); 1496 kgdb_post_primary_code(ks->linux_regs, ks->ex_vector, ks->err_code);
1495 kgdb_deactivate_sw_breakpoints(); 1497 kgdb_deactivate_sw_breakpoints();
1496 kgdb_single_step = 0; 1498 kgdb_single_step = 0;
1497 kgdb_contthread = NULL; 1499 kgdb_contthread = current;
1498 exception_level = 0; 1500 exception_level = 0;
1499 1501
1500 /* Talk to debugger with gdbserial protocol */ 1502 /* Talk to debugger with gdbserial protocol */
@@ -1508,7 +1510,7 @@ acquirelock:
1508 kgdb_info[ks->cpu].task = NULL; 1510 kgdb_info[ks->cpu].task = NULL;
1509 atomic_set(&cpu_in_kgdb[ks->cpu], 0); 1511 atomic_set(&cpu_in_kgdb[ks->cpu], 0);
1510 1512
1511 if (!kgdb_single_step || !kgdb_contthread) { 1513 if (!kgdb_single_step) {
1512 for (i = NR_CPUS-1; i >= 0; i--) 1514 for (i = NR_CPUS-1; i >= 0; i--)
1513 atomic_set(&passive_cpu_wait[i], 0); 1515 atomic_set(&passive_cpu_wait[i], 0);
1514 /* 1516 /*
@@ -1524,6 +1526,7 @@ acquirelock:
1524kgdb_restore: 1526kgdb_restore:
1525 /* Free kgdb_active */ 1527 /* Free kgdb_active */
1526 atomic_set(&kgdb_active, -1); 1528 atomic_set(&kgdb_active, -1);
1529 touch_softlockup_watchdog();
1527 clocksource_touch_watchdog(); 1530 clocksource_touch_watchdog();
1528 local_irq_restore(flags); 1531 local_irq_restore(flags);
1529 1532
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index e36d5798cbff..5131e5471169 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -441,7 +441,7 @@ static struct k_itimer * alloc_posix_timer(void)
441 return tmr; 441 return tmr;
442 if (unlikely(!(tmr->sigq = sigqueue_alloc()))) { 442 if (unlikely(!(tmr->sigq = sigqueue_alloc()))) {
443 kmem_cache_free(posix_timers_cache, tmr); 443 kmem_cache_free(posix_timers_cache, tmr);
444 tmr = NULL; 444 return NULL;
445 } 445 }
446 memset(&tmr->sigq->info, 0, sizeof(siginfo_t)); 446 memset(&tmr->sigq->info, 0, sizeof(siginfo_t));
447 return tmr; 447 return tmr;
diff --git a/kernel/sched.c b/kernel/sched.c
index cc1f81b50b82..ad1962dc0aa2 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -201,7 +201,7 @@ void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 period, u64 runtime)
201 hrtimer_init(&rt_b->rt_period_timer, 201 hrtimer_init(&rt_b->rt_period_timer,
202 CLOCK_MONOTONIC, HRTIMER_MODE_REL); 202 CLOCK_MONOTONIC, HRTIMER_MODE_REL);
203 rt_b->rt_period_timer.function = sched_rt_period_timer; 203 rt_b->rt_period_timer.function = sched_rt_period_timer;
204 rt_b->rt_period_timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ; 204 rt_b->rt_period_timer.cb_mode = HRTIMER_CB_IRQSAFE_UNLOCKED;
205} 205}
206 206
207static void start_rt_bandwidth(struct rt_bandwidth *rt_b) 207static void start_rt_bandwidth(struct rt_bandwidth *rt_b)
@@ -1087,7 +1087,7 @@ hotplug_hrtick(struct notifier_block *nfb, unsigned long action, void *hcpu)
1087 return NOTIFY_DONE; 1087 return NOTIFY_DONE;
1088} 1088}
1089 1089
1090static void init_hrtick(void) 1090static __init void init_hrtick(void)
1091{ 1091{
1092 hotcpu_notifier(hotplug_hrtick, 0); 1092 hotcpu_notifier(hotplug_hrtick, 0);
1093} 1093}
@@ -1119,7 +1119,7 @@ static void init_rq_hrtick(struct rq *rq)
1119 1119
1120 hrtimer_init(&rq->hrtick_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 1120 hrtimer_init(&rq->hrtick_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
1121 rq->hrtick_timer.function = hrtick; 1121 rq->hrtick_timer.function = hrtick;
1122 rq->hrtick_timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ; 1122 rq->hrtick_timer.cb_mode = HRTIMER_CB_IRQSAFE_PERCPU;
1123} 1123}
1124#else 1124#else
1125static inline void hrtick_clear(struct rq *rq) 1125static inline void hrtick_clear(struct rq *rq)
@@ -8909,6 +8909,9 @@ static int sched_rt_global_constraints(void)
8909 u64 rt_runtime, rt_period; 8909 u64 rt_runtime, rt_period;
8910 int ret = 0; 8910 int ret = 0;
8911 8911
8912 if (sysctl_sched_rt_period <= 0)
8913 return -EINVAL;
8914
8912 rt_period = ktime_to_ns(tg->rt_bandwidth.rt_period); 8915 rt_period = ktime_to_ns(tg->rt_bandwidth.rt_period);
8913 rt_runtime = tg->rt_bandwidth.rt_runtime; 8916 rt_runtime = tg->rt_bandwidth.rt_runtime;
8914 8917
@@ -8925,6 +8928,9 @@ static int sched_rt_global_constraints(void)
8925 unsigned long flags; 8928 unsigned long flags;
8926 int i; 8929 int i;
8927 8930
8931 if (sysctl_sched_rt_period <= 0)
8932 return -EINVAL;
8933
8928 spin_lock_irqsave(&def_rt_bandwidth.rt_runtime_lock, flags); 8934 spin_lock_irqsave(&def_rt_bandwidth.rt_runtime_lock, flags);
8929 for_each_possible_cpu(i) { 8935 for_each_possible_cpu(i) {
8930 struct rt_rq *rt_rq = &cpu_rq(i)->rt; 8936 struct rt_rq *rt_rq = &cpu_rq(i)->rt;
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 552310798dad..1113157b2058 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -350,6 +350,7 @@ static void __enable_runtime(struct rq *rq)
350 spin_lock(&rt_rq->rt_runtime_lock); 350 spin_lock(&rt_rq->rt_runtime_lock);
351 rt_rq->rt_runtime = rt_b->rt_runtime; 351 rt_rq->rt_runtime = rt_b->rt_runtime;
352 rt_rq->rt_time = 0; 352 rt_rq->rt_time = 0;
353 rt_rq->rt_throttled = 0;
353 spin_unlock(&rt_rq->rt_runtime_lock); 354 spin_unlock(&rt_rq->rt_runtime_lock);
354 spin_unlock(&rt_b->rt_runtime_lock); 355 spin_unlock(&rt_b->rt_runtime_lock);
355 } 356 }
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 1876b526c778..f8d968063cea 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -72,6 +72,16 @@ void clockevents_set_mode(struct clock_event_device *dev,
72} 72}
73 73
74/** 74/**
75 * clockevents_shutdown - shutdown the device and clear next_event
76 * @dev: device to shutdown
77 */
78void clockevents_shutdown(struct clock_event_device *dev)
79{
80 clockevents_set_mode(dev, CLOCK_EVT_MODE_SHUTDOWN);
81 dev->next_event.tv64 = KTIME_MAX;
82}
83
84/**
75 * clockevents_program_event - Reprogram the clock event device. 85 * clockevents_program_event - Reprogram the clock event device.
76 * @expires: absolute expiry time (monotonic clock) 86 * @expires: absolute expiry time (monotonic clock)
77 * 87 *
@@ -206,7 +216,7 @@ void clockevents_exchange_device(struct clock_event_device *old,
206 216
207 if (new) { 217 if (new) {
208 BUG_ON(new->mode != CLOCK_EVT_MODE_UNUSED); 218 BUG_ON(new->mode != CLOCK_EVT_MODE_UNUSED);
209 clockevents_set_mode(new, CLOCK_EVT_MODE_SHUTDOWN); 219 clockevents_shutdown(new);
210 } 220 }
211 local_irq_restore(flags); 221 local_irq_restore(flags);
212} 222}
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 2f5a38294bf9..cb01cd8f919b 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -235,9 +235,9 @@ static void tick_do_broadcast_on_off(void *why)
235 case CLOCK_EVT_NOTIFY_BROADCAST_FORCE: 235 case CLOCK_EVT_NOTIFY_BROADCAST_FORCE:
236 if (!cpu_isset(cpu, tick_broadcast_mask)) { 236 if (!cpu_isset(cpu, tick_broadcast_mask)) {
237 cpu_set(cpu, tick_broadcast_mask); 237 cpu_set(cpu, tick_broadcast_mask);
238 if (td->mode == TICKDEV_MODE_PERIODIC) 238 if (tick_broadcast_device.mode ==
239 clockevents_set_mode(dev, 239 TICKDEV_MODE_PERIODIC)
240 CLOCK_EVT_MODE_SHUTDOWN); 240 clockevents_shutdown(dev);
241 } 241 }
242 if (*reason == CLOCK_EVT_NOTIFY_BROADCAST_FORCE) 242 if (*reason == CLOCK_EVT_NOTIFY_BROADCAST_FORCE)
243 tick_broadcast_force = 1; 243 tick_broadcast_force = 1;
@@ -246,7 +246,8 @@ static void tick_do_broadcast_on_off(void *why)
246 if (!tick_broadcast_force && 246 if (!tick_broadcast_force &&
247 cpu_isset(cpu, tick_broadcast_mask)) { 247 cpu_isset(cpu, tick_broadcast_mask)) {
248 cpu_clear(cpu, tick_broadcast_mask); 248 cpu_clear(cpu, tick_broadcast_mask);
249 if (td->mode == TICKDEV_MODE_PERIODIC) 249 if (tick_broadcast_device.mode ==
250 TICKDEV_MODE_PERIODIC)
250 tick_setup_periodic(dev, 0); 251 tick_setup_periodic(dev, 0);
251 } 252 }
252 break; 253 break;
@@ -254,7 +255,7 @@ static void tick_do_broadcast_on_off(void *why)
254 255
255 if (cpus_empty(tick_broadcast_mask)) { 256 if (cpus_empty(tick_broadcast_mask)) {
256 if (!bc_stopped) 257 if (!bc_stopped)
257 clockevents_set_mode(bc, CLOCK_EVT_MODE_SHUTDOWN); 258 clockevents_shutdown(bc);
258 } else if (bc_stopped) { 259 } else if (bc_stopped) {
259 if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) 260 if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC)
260 tick_broadcast_start_periodic(bc); 261 tick_broadcast_start_periodic(bc);
@@ -306,7 +307,7 @@ void tick_shutdown_broadcast(unsigned int *cpup)
306 307
307 if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) { 308 if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) {
308 if (bc && cpus_empty(tick_broadcast_mask)) 309 if (bc && cpus_empty(tick_broadcast_mask))
309 clockevents_set_mode(bc, CLOCK_EVT_MODE_SHUTDOWN); 310 clockevents_shutdown(bc);
310 } 311 }
311 312
312 spin_unlock_irqrestore(&tick_broadcast_lock, flags); 313 spin_unlock_irqrestore(&tick_broadcast_lock, flags);
@@ -321,7 +322,7 @@ void tick_suspend_broadcast(void)
321 322
322 bc = tick_broadcast_device.evtdev; 323 bc = tick_broadcast_device.evtdev;
323 if (bc) 324 if (bc)
324 clockevents_set_mode(bc, CLOCK_EVT_MODE_SHUTDOWN); 325 clockevents_shutdown(bc);
325 326
326 spin_unlock_irqrestore(&tick_broadcast_lock, flags); 327 spin_unlock_irqrestore(&tick_broadcast_lock, flags);
327} 328}
@@ -576,4 +577,12 @@ void tick_shutdown_broadcast_oneshot(unsigned int *cpup)
576 spin_unlock_irqrestore(&tick_broadcast_lock, flags); 577 spin_unlock_irqrestore(&tick_broadcast_lock, flags);
577} 578}
578 579
580/*
581 * Check, whether the broadcast device is in one shot mode
582 */
583int tick_broadcast_oneshot_active(void)
584{
585 return tick_broadcast_device.mode == TICKDEV_MODE_ONESHOT;
586}
587
579#endif 588#endif
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
index c4777193d567..df12434b43ca 100644
--- a/kernel/time/tick-common.c
+++ b/kernel/time/tick-common.c
@@ -33,7 +33,7 @@ DEFINE_PER_CPU(struct tick_device, tick_cpu_device);
33 */ 33 */
34ktime_t tick_next_period; 34ktime_t tick_next_period;
35ktime_t tick_period; 35ktime_t tick_period;
36int tick_do_timer_cpu __read_mostly = -1; 36int tick_do_timer_cpu __read_mostly = TICK_DO_TIMER_BOOT;
37DEFINE_SPINLOCK(tick_device_lock); 37DEFINE_SPINLOCK(tick_device_lock);
38 38
39/* 39/*
@@ -109,7 +109,8 @@ void tick_setup_periodic(struct clock_event_device *dev, int broadcast)
109 if (!tick_device_is_functional(dev)) 109 if (!tick_device_is_functional(dev))
110 return; 110 return;
111 111
112 if (dev->features & CLOCK_EVT_FEAT_PERIODIC) { 112 if ((dev->features & CLOCK_EVT_FEAT_PERIODIC) &&
113 !tick_broadcast_oneshot_active()) {
113 clockevents_set_mode(dev, CLOCK_EVT_MODE_PERIODIC); 114 clockevents_set_mode(dev, CLOCK_EVT_MODE_PERIODIC);
114 } else { 115 } else {
115 unsigned long seq; 116 unsigned long seq;
@@ -148,7 +149,7 @@ static void tick_setup_device(struct tick_device *td,
148 * If no cpu took the do_timer update, assign it to 149 * If no cpu took the do_timer update, assign it to
149 * this cpu: 150 * this cpu:
150 */ 151 */
151 if (tick_do_timer_cpu == -1) { 152 if (tick_do_timer_cpu == TICK_DO_TIMER_BOOT) {
152 tick_do_timer_cpu = cpu; 153 tick_do_timer_cpu = cpu;
153 tick_next_period = ktime_get(); 154 tick_next_period = ktime_get();
154 tick_period = ktime_set(0, NSEC_PER_SEC / HZ); 155 tick_period = ktime_set(0, NSEC_PER_SEC / HZ);
@@ -249,7 +250,7 @@ static int tick_check_new_device(struct clock_event_device *newdev)
249 * not give it back to the clockevents layer ! 250 * not give it back to the clockevents layer !
250 */ 251 */
251 if (tick_is_broadcast_device(curdev)) { 252 if (tick_is_broadcast_device(curdev)) {
252 clockevents_set_mode(curdev, CLOCK_EVT_MODE_SHUTDOWN); 253 clockevents_shutdown(curdev);
253 curdev = NULL; 254 curdev = NULL;
254 } 255 }
255 clockevents_exchange_device(curdev, newdev); 256 clockevents_exchange_device(curdev, newdev);
@@ -300,7 +301,8 @@ static void tick_shutdown(unsigned int *cpup)
300 if (*cpup == tick_do_timer_cpu) { 301 if (*cpup == tick_do_timer_cpu) {
301 int cpu = first_cpu(cpu_online_map); 302 int cpu = first_cpu(cpu_online_map);
302 303
303 tick_do_timer_cpu = (cpu != NR_CPUS) ? cpu : -1; 304 tick_do_timer_cpu = (cpu != NR_CPUS) ? cpu :
305 TICK_DO_TIMER_NONE;
304 } 306 }
305 spin_unlock_irqrestore(&tick_device_lock, flags); 307 spin_unlock_irqrestore(&tick_device_lock, flags);
306} 308}
@@ -311,7 +313,7 @@ static void tick_suspend(void)
311 unsigned long flags; 313 unsigned long flags;
312 314
313 spin_lock_irqsave(&tick_device_lock, flags); 315 spin_lock_irqsave(&tick_device_lock, flags);
314 clockevents_set_mode(td->evtdev, CLOCK_EVT_MODE_SHUTDOWN); 316 clockevents_shutdown(td->evtdev);
315 spin_unlock_irqrestore(&tick_device_lock, flags); 317 spin_unlock_irqrestore(&tick_device_lock, flags);
316} 318}
317 319
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h
index 0ffc2918ea6f..469248782c23 100644
--- a/kernel/time/tick-internal.h
+++ b/kernel/time/tick-internal.h
@@ -1,6 +1,10 @@
1/* 1/*
2 * tick internal variable and functions used by low/high res code 2 * tick internal variable and functions used by low/high res code
3 */ 3 */
4
5#define TICK_DO_TIMER_NONE -1
6#define TICK_DO_TIMER_BOOT -2
7
4DECLARE_PER_CPU(struct tick_device, tick_cpu_device); 8DECLARE_PER_CPU(struct tick_device, tick_cpu_device);
5extern spinlock_t tick_device_lock; 9extern spinlock_t tick_device_lock;
6extern ktime_t tick_next_period; 10extern ktime_t tick_next_period;
@@ -10,6 +14,8 @@ extern int tick_do_timer_cpu __read_mostly;
10extern void tick_setup_periodic(struct clock_event_device *dev, int broadcast); 14extern void tick_setup_periodic(struct clock_event_device *dev, int broadcast);
11extern void tick_handle_periodic(struct clock_event_device *dev); 15extern void tick_handle_periodic(struct clock_event_device *dev);
12 16
17extern void clockevents_shutdown(struct clock_event_device *dev);
18
13/* 19/*
14 * NO_HZ / high resolution timer shared code 20 * NO_HZ / high resolution timer shared code
15 */ 21 */
@@ -29,6 +35,7 @@ extern void tick_broadcast_oneshot_control(unsigned long reason);
29extern void tick_broadcast_switch_to_oneshot(void); 35extern void tick_broadcast_switch_to_oneshot(void);
30extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup); 36extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup);
31extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc); 37extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc);
38extern int tick_broadcast_oneshot_active(void);
32# else /* BROADCAST */ 39# else /* BROADCAST */
33static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) 40static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
34{ 41{
@@ -37,6 +44,7 @@ static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc)
37static inline void tick_broadcast_oneshot_control(unsigned long reason) { } 44static inline void tick_broadcast_oneshot_control(unsigned long reason) { }
38static inline void tick_broadcast_switch_to_oneshot(void) { } 45static inline void tick_broadcast_switch_to_oneshot(void) { }
39static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } 46static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { }
47static inline int tick_broadcast_oneshot_active(void) { return 0; }
40# endif /* !BROADCAST */ 48# endif /* !BROADCAST */
41 49
42#else /* !ONESHOT */ 50#else /* !ONESHOT */
@@ -66,6 +74,7 @@ static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc)
66{ 74{
67 return 0; 75 return 0;
68} 76}
77static inline int tick_broadcast_oneshot_active(void) { return 0; }
69#endif /* !TICK_ONESHOT */ 78#endif /* !TICK_ONESHOT */
70 79
71/* 80/*
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index a87b0468568b..cb02324bdb88 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -75,6 +75,9 @@ static void tick_do_update_jiffies64(ktime_t now)
75 incr * ticks); 75 incr * ticks);
76 } 76 }
77 do_timer(++ticks); 77 do_timer(++ticks);
78
79 /* Keep the tick_next_period variable up to date */
80 tick_next_period = ktime_add(last_jiffies_update, tick_period);
78 } 81 }
79 write_sequnlock(&xtime_lock); 82 write_sequnlock(&xtime_lock);
80} 83}
@@ -221,7 +224,7 @@ void tick_nohz_stop_sched_tick(int inidle)
221 */ 224 */
222 if (unlikely(!cpu_online(cpu))) { 225 if (unlikely(!cpu_online(cpu))) {
223 if (cpu == tick_do_timer_cpu) 226 if (cpu == tick_do_timer_cpu)
224 tick_do_timer_cpu = -1; 227 tick_do_timer_cpu = TICK_DO_TIMER_NONE;
225 } 228 }
226 229
227 if (unlikely(ts->nohz_mode == NOHZ_MODE_INACTIVE)) 230 if (unlikely(ts->nohz_mode == NOHZ_MODE_INACTIVE))
@@ -303,7 +306,7 @@ void tick_nohz_stop_sched_tick(int inidle)
303 * invoked. 306 * invoked.
304 */ 307 */
305 if (cpu == tick_do_timer_cpu) 308 if (cpu == tick_do_timer_cpu)
306 tick_do_timer_cpu = -1; 309 tick_do_timer_cpu = TICK_DO_TIMER_NONE;
307 310
308 ts->idle_sleeps++; 311 ts->idle_sleeps++;
309 312
@@ -468,7 +471,7 @@ static void tick_nohz_handler(struct clock_event_device *dev)
468 * this duty, then the jiffies update is still serialized by 471 * this duty, then the jiffies update is still serialized by
469 * xtime_lock. 472 * xtime_lock.
470 */ 473 */
471 if (unlikely(tick_do_timer_cpu == -1)) 474 if (unlikely(tick_do_timer_cpu == TICK_DO_TIMER_NONE))
472 tick_do_timer_cpu = cpu; 475 tick_do_timer_cpu = cpu;
473 476
474 /* Check, if the jiffies need an update */ 477 /* Check, if the jiffies need an update */
@@ -570,7 +573,7 @@ static enum hrtimer_restart tick_sched_timer(struct hrtimer *timer)
570 * this duty, then the jiffies update is still serialized by 573 * this duty, then the jiffies update is still serialized by
571 * xtime_lock. 574 * xtime_lock.
572 */ 575 */
573 if (unlikely(tick_do_timer_cpu == -1)) 576 if (unlikely(tick_do_timer_cpu == TICK_DO_TIMER_NONE))
574 tick_do_timer_cpu = cpu; 577 tick_do_timer_cpu = cpu;
575#endif 578#endif
576 579
@@ -622,7 +625,7 @@ void tick_setup_sched_timer(void)
622 */ 625 */
623 hrtimer_init(&ts->sched_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); 626 hrtimer_init(&ts->sched_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
624 ts->sched_timer.function = tick_sched_timer; 627 ts->sched_timer.function = tick_sched_timer;
625 ts->sched_timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ; 628 ts->sched_timer.cb_mode = HRTIMER_CB_IRQSAFE_PERCPU;
626 629
627 /* Get the next period (per cpu) */ 630 /* Get the next period (per cpu) */
628 ts->sched_timer.expires = tick_init_jiffy_update(); 631 ts->sched_timer.expires = tick_init_jiffy_update();
diff --git a/kernel/trace/trace_sysprof.c b/kernel/trace/trace_sysprof.c
index bb948e52ce20..db58fb66a135 100644
--- a/kernel/trace/trace_sysprof.c
+++ b/kernel/trace/trace_sysprof.c
@@ -202,7 +202,7 @@ static void start_stack_timer(int cpu)
202 202
203 hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 203 hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
204 hrtimer->function = stack_trace_timer_fn; 204 hrtimer->function = stack_trace_timer_fn;
205 hrtimer->cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ; 205 hrtimer->cb_mode = HRTIMER_CB_IRQSAFE_PERCPU;
206 206
207 hrtimer_start(hrtimer, ns_to_ktime(sample_period), HRTIMER_MODE_REL); 207 hrtimer_start(hrtimer, ns_to_ktime(sample_period), HRTIMER_MODE_REL);
208} 208}
diff --git a/lib/iommu-helper.c b/lib/iommu-helper.c
index a3b8d4c3f77a..5d90074dca75 100644
--- a/lib/iommu-helper.c
+++ b/lib/iommu-helper.c
@@ -30,8 +30,7 @@ again:
30 return index; 30 return index;
31} 31}
32 32
33static inline void set_bit_area(unsigned long *map, unsigned long i, 33void iommu_area_reserve(unsigned long *map, unsigned long i, int len)
34 int len)
35{ 34{
36 unsigned long end = i + len; 35 unsigned long end = i + len;
37 while (i < end) { 36 while (i < end) {
@@ -64,7 +63,7 @@ again:
64 start = index + 1; 63 start = index + 1;
65 goto again; 64 goto again;
66 } 65 }
67 set_bit_area(map, index, nr); 66 iommu_area_reserve(map, index, nr);
68 } 67 }
69 return index; 68 return index;
70} 69}
diff --git a/lib/scatterlist.c b/lib/scatterlist.c
index 876ba6d5b670..8d2688ff1352 100644
--- a/lib/scatterlist.c
+++ b/lib/scatterlist.c
@@ -422,9 +422,12 @@ static size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents,
422{ 422{
423 unsigned int offset = 0; 423 unsigned int offset = 0;
424 struct sg_mapping_iter miter; 424 struct sg_mapping_iter miter;
425 unsigned long flags;
425 426
426 sg_miter_start(&miter, sgl, nents, SG_MITER_ATOMIC); 427 sg_miter_start(&miter, sgl, nents, SG_MITER_ATOMIC);
427 428
429 local_irq_save(flags);
430
428 while (sg_miter_next(&miter) && offset < buflen) { 431 while (sg_miter_next(&miter) && offset < buflen) {
429 unsigned int len; 432 unsigned int len;
430 433
@@ -442,6 +445,7 @@ static size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents,
442 445
443 sg_miter_stop(&miter); 446 sg_miter_stop(&miter);
444 447
448 local_irq_restore(flags);
445 return offset; 449 return offset;
446} 450}
447 451
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index 977edbdbc1de..f8eebd489149 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -274,13 +274,14 @@ cleanup1:
274} 274}
275 275
276static int 276static int
277address_needs_mapping(struct device *hwdev, dma_addr_t addr) 277address_needs_mapping(struct device *hwdev, dma_addr_t addr, size_t size)
278{ 278{
279 dma_addr_t mask = 0xffffffff; 279 return !is_buffer_dma_capable(dma_get_mask(hwdev), addr, size);
280 /* If the device has a mask, use it, otherwise default to 32 bits */ 280}
281 if (hwdev && hwdev->dma_mask) 281
282 mask = *hwdev->dma_mask; 282static int is_swiotlb_buffer(char *addr)
283 return (addr & ~mask) != 0; 283{
284 return addr >= io_tlb_start && addr < io_tlb_end;
284} 285}
285 286
286/* 287/*
@@ -467,15 +468,8 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size,
467 void *ret; 468 void *ret;
468 int order = get_order(size); 469 int order = get_order(size);
469 470
470 /*
471 * XXX fix me: the DMA API should pass us an explicit DMA mask
472 * instead, or use ZONE_DMA32 (ia64 overloads ZONE_DMA to be a ~32
473 * bit range instead of a 16MB one).
474 */
475 flags |= GFP_DMA;
476
477 ret = (void *)__get_free_pages(flags, order); 471 ret = (void *)__get_free_pages(flags, order);
478 if (ret && address_needs_mapping(hwdev, virt_to_bus(ret))) { 472 if (ret && address_needs_mapping(hwdev, virt_to_bus(ret), size)) {
479 /* 473 /*
480 * The allocated memory isn't reachable by the device. 474 * The allocated memory isn't reachable by the device.
481 * Fall back on swiotlb_map_single(). 475 * Fall back on swiotlb_map_single().
@@ -490,19 +484,16 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size,
490 * swiotlb_map_single(), which will grab memory from 484 * swiotlb_map_single(), which will grab memory from
491 * the lowest available address range. 485 * the lowest available address range.
492 */ 486 */
493 dma_addr_t handle; 487 ret = map_single(hwdev, NULL, size, DMA_FROM_DEVICE);
494 handle = swiotlb_map_single(NULL, NULL, size, DMA_FROM_DEVICE); 488 if (!ret)
495 if (swiotlb_dma_mapping_error(hwdev, handle))
496 return NULL; 489 return NULL;
497
498 ret = bus_to_virt(handle);
499 } 490 }
500 491
501 memset(ret, 0, size); 492 memset(ret, 0, size);
502 dev_addr = virt_to_bus(ret); 493 dev_addr = virt_to_bus(ret);
503 494
504 /* Confirm address can be DMA'd by device */ 495 /* Confirm address can be DMA'd by device */
505 if (address_needs_mapping(hwdev, dev_addr)) { 496 if (address_needs_mapping(hwdev, dev_addr, size)) {
506 printk("hwdev DMA mask = 0x%016Lx, dev_addr = 0x%016Lx\n", 497 printk("hwdev DMA mask = 0x%016Lx, dev_addr = 0x%016Lx\n",
507 (unsigned long long)*hwdev->dma_mask, 498 (unsigned long long)*hwdev->dma_mask,
508 (unsigned long long)dev_addr); 499 (unsigned long long)dev_addr);
@@ -518,12 +509,11 @@ swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr,
518 dma_addr_t dma_handle) 509 dma_addr_t dma_handle)
519{ 510{
520 WARN_ON(irqs_disabled()); 511 WARN_ON(irqs_disabled());
521 if (!(vaddr >= (void *)io_tlb_start 512 if (!is_swiotlb_buffer(vaddr))
522 && vaddr < (void *)io_tlb_end))
523 free_pages((unsigned long) vaddr, get_order(size)); 513 free_pages((unsigned long) vaddr, get_order(size));
524 else 514 else
525 /* DMA_TO_DEVICE to avoid memcpy in unmap_single */ 515 /* DMA_TO_DEVICE to avoid memcpy in unmap_single */
526 swiotlb_unmap_single (hwdev, dma_handle, size, DMA_TO_DEVICE); 516 unmap_single(hwdev, vaddr, size, DMA_TO_DEVICE);
527} 517}
528 518
529static void 519static void
@@ -567,7 +557,7 @@ swiotlb_map_single_attrs(struct device *hwdev, void *ptr, size_t size,
567 * we can safely return the device addr and not worry about bounce 557 * we can safely return the device addr and not worry about bounce
568 * buffering it. 558 * buffering it.
569 */ 559 */
570 if (!address_needs_mapping(hwdev, dev_addr) && !swiotlb_force) 560 if (!address_needs_mapping(hwdev, dev_addr, size) && !swiotlb_force)
571 return dev_addr; 561 return dev_addr;
572 562
573 /* 563 /*
@@ -584,7 +574,7 @@ swiotlb_map_single_attrs(struct device *hwdev, void *ptr, size_t size,
584 /* 574 /*
585 * Ensure that the address returned is DMA'ble 575 * Ensure that the address returned is DMA'ble
586 */ 576 */
587 if (address_needs_mapping(hwdev, dev_addr)) 577 if (address_needs_mapping(hwdev, dev_addr, size))
588 panic("map_single: bounce buffer is not DMA'ble"); 578 panic("map_single: bounce buffer is not DMA'ble");
589 579
590 return dev_addr; 580 return dev_addr;
@@ -612,7 +602,7 @@ swiotlb_unmap_single_attrs(struct device *hwdev, dma_addr_t dev_addr,
612 char *dma_addr = bus_to_virt(dev_addr); 602 char *dma_addr = bus_to_virt(dev_addr);
613 603
614 BUG_ON(dir == DMA_NONE); 604 BUG_ON(dir == DMA_NONE);
615 if (dma_addr >= io_tlb_start && dma_addr < io_tlb_end) 605 if (is_swiotlb_buffer(dma_addr))
616 unmap_single(hwdev, dma_addr, size, dir); 606 unmap_single(hwdev, dma_addr, size, dir);
617 else if (dir == DMA_FROM_DEVICE) 607 else if (dir == DMA_FROM_DEVICE)
618 dma_mark_clean(dma_addr, size); 608 dma_mark_clean(dma_addr, size);
@@ -642,7 +632,7 @@ swiotlb_sync_single(struct device *hwdev, dma_addr_t dev_addr,
642 char *dma_addr = bus_to_virt(dev_addr); 632 char *dma_addr = bus_to_virt(dev_addr);
643 633
644 BUG_ON(dir == DMA_NONE); 634 BUG_ON(dir == DMA_NONE);
645 if (dma_addr >= io_tlb_start && dma_addr < io_tlb_end) 635 if (is_swiotlb_buffer(dma_addr))
646 sync_single(hwdev, dma_addr, size, dir, target); 636 sync_single(hwdev, dma_addr, size, dir, target);
647 else if (dir == DMA_FROM_DEVICE) 637 else if (dir == DMA_FROM_DEVICE)
648 dma_mark_clean(dma_addr, size); 638 dma_mark_clean(dma_addr, size);
@@ -673,7 +663,7 @@ swiotlb_sync_single_range(struct device *hwdev, dma_addr_t dev_addr,
673 char *dma_addr = bus_to_virt(dev_addr) + offset; 663 char *dma_addr = bus_to_virt(dev_addr) + offset;
674 664
675 BUG_ON(dir == DMA_NONE); 665 BUG_ON(dir == DMA_NONE);
676 if (dma_addr >= io_tlb_start && dma_addr < io_tlb_end) 666 if (is_swiotlb_buffer(dma_addr))
677 sync_single(hwdev, dma_addr, size, dir, target); 667 sync_single(hwdev, dma_addr, size, dir, target);
678 else if (dir == DMA_FROM_DEVICE) 668 else if (dir == DMA_FROM_DEVICE)
679 dma_mark_clean(dma_addr, size); 669 dma_mark_clean(dma_addr, size);
@@ -727,7 +717,8 @@ swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems,
727 for_each_sg(sgl, sg, nelems, i) { 717 for_each_sg(sgl, sg, nelems, i) {
728 addr = SG_ENT_VIRT_ADDRESS(sg); 718 addr = SG_ENT_VIRT_ADDRESS(sg);
729 dev_addr = virt_to_bus(addr); 719 dev_addr = virt_to_bus(addr);
730 if (swiotlb_force || address_needs_mapping(hwdev, dev_addr)) { 720 if (swiotlb_force ||
721 address_needs_mapping(hwdev, dev_addr, sg->length)) {
731 void *map = map_single(hwdev, addr, sg->length, dir); 722 void *map = map_single(hwdev, addr, sg->length, dir);
732 if (!map) { 723 if (!map) {
733 /* Don't panic here, we expect map_sg users 724 /* Don't panic here, we expect map_sg users
diff --git a/mm/highmem.c b/mm/highmem.c
index e16e1523b688..b36b83b920ff 100644
--- a/mm/highmem.c
+++ b/mm/highmem.c
@@ -70,6 +70,7 @@ static DECLARE_WAIT_QUEUE_HEAD(pkmap_map_wait);
70static void flush_all_zero_pkmaps(void) 70static void flush_all_zero_pkmaps(void)
71{ 71{
72 int i; 72 int i;
73 int need_flush = 0;
73 74
74 flush_cache_kmaps(); 75 flush_cache_kmaps();
75 76
@@ -101,8 +102,10 @@ static void flush_all_zero_pkmaps(void)
101 &pkmap_page_table[i]); 102 &pkmap_page_table[i]);
102 103
103 set_page_address(page, NULL); 104 set_page_address(page, NULL);
105 need_flush = 1;
104 } 106 }
105 flush_tlb_kernel_range(PKMAP_ADDR(0), PKMAP_ADDR(LAST_PKMAP)); 107 if (need_flush)
108 flush_tlb_kernel_range(PKMAP_ADDR(0), PKMAP_ADDR(LAST_PKMAP));
106} 109}
107 110
108/** 111/**
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 0f1f7a7374ba..36896f3eb7f5 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -250,6 +250,14 @@ static struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont)
250 250
251struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p) 251struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p)
252{ 252{
253 /*
254 * mm_update_next_owner() may clear mm->owner to NULL
255 * if it races with swapoff, page migration, etc.
256 * So this can be called with p == NULL.
257 */
258 if (unlikely(!p))
259 return NULL;
260
253 return container_of(task_subsys_state(p, mem_cgroup_subsys_id), 261 return container_of(task_subsys_state(p, mem_cgroup_subsys_id),
254 struct mem_cgroup, css); 262 struct mem_cgroup, css);
255} 263}
@@ -549,6 +557,11 @@ static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm,
549 if (likely(!memcg)) { 557 if (likely(!memcg)) {
550 rcu_read_lock(); 558 rcu_read_lock();
551 mem = mem_cgroup_from_task(rcu_dereference(mm->owner)); 559 mem = mem_cgroup_from_task(rcu_dereference(mm->owner));
560 if (unlikely(!mem)) {
561 rcu_read_unlock();
562 kmem_cache_free(page_cgroup_cache, pc);
563 return 0;
564 }
552 /* 565 /*
553 * For every charge from the cgroup, increment reference count 566 * For every charge from the cgroup, increment reference count
554 */ 567 */
@@ -801,11 +814,16 @@ int mem_cgroup_shrink_usage(struct mm_struct *mm, gfp_t gfp_mask)
801 814
802 rcu_read_lock(); 815 rcu_read_lock();
803 mem = mem_cgroup_from_task(rcu_dereference(mm->owner)); 816 mem = mem_cgroup_from_task(rcu_dereference(mm->owner));
817 if (unlikely(!mem)) {
818 rcu_read_unlock();
819 return 0;
820 }
804 css_get(&mem->css); 821 css_get(&mem->css);
805 rcu_read_unlock(); 822 rcu_read_unlock();
806 823
807 do { 824 do {
808 progress = try_to_free_mem_cgroup_pages(mem, gfp_mask); 825 progress = try_to_free_mem_cgroup_pages(mem, gfp_mask);
826 progress += res_counter_check_under_limit(&mem->res);
809 } while (!progress && --retry); 827 } while (!progress && --retry);
810 828
811 css_put(&mem->css); 829 css_put(&mem->css);
diff --git a/mm/mmzone.c b/mm/mmzone.c
index 486ed595ee6f..16ce8b955dcf 100644
--- a/mm/mmzone.c
+++ b/mm/mmzone.c
@@ -69,6 +69,6 @@ struct zoneref *next_zones_zonelist(struct zoneref *z,
69 (z->zone && !zref_in_nodemask(z, nodes))) 69 (z->zone && !zref_in_nodemask(z, nodes)))
70 z++; 70 z++;
71 71
72 *zone = zonelist_zone(z++); 72 *zone = zonelist_zone(z);
73 return z; 73 return z;
74} 74}
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e293c58bea58..27b8681139fd 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -268,13 +268,14 @@ void prep_compound_page(struct page *page, unsigned long order)
268{ 268{
269 int i; 269 int i;
270 int nr_pages = 1 << order; 270 int nr_pages = 1 << order;
271 struct page *p = page + 1;
271 272
272 set_compound_page_dtor(page, free_compound_page); 273 set_compound_page_dtor(page, free_compound_page);
273 set_compound_order(page, order); 274 set_compound_order(page, order);
274 __SetPageHead(page); 275 __SetPageHead(page);
275 for (i = 1; i < nr_pages; i++) { 276 for (i = 1; i < nr_pages; i++, p++) {
276 struct page *p = page + i; 277 if (unlikely((i & (MAX_ORDER_NR_PAGES - 1)) == 0))
277 278 p = pfn_to_page(page_to_pfn(page) + i);
278 __SetPageTail(p); 279 __SetPageTail(p);
279 p->first_page = page; 280 p->first_page = page;
280 } 281 }
@@ -284,6 +285,7 @@ static void destroy_compound_page(struct page *page, unsigned long order)
284{ 285{
285 int i; 286 int i;
286 int nr_pages = 1 << order; 287 int nr_pages = 1 << order;
288 struct page *p = page + 1;
287 289
288 if (unlikely(compound_order(page) != order)) 290 if (unlikely(compound_order(page) != order))
289 bad_page(page); 291 bad_page(page);
@@ -291,8 +293,9 @@ static void destroy_compound_page(struct page *page, unsigned long order)
291 if (unlikely(!PageHead(page))) 293 if (unlikely(!PageHead(page)))
292 bad_page(page); 294 bad_page(page);
293 __ClearPageHead(page); 295 __ClearPageHead(page);
294 for (i = 1; i < nr_pages; i++) { 296 for (i = 1; i < nr_pages; i++, p++) {
295 struct page *p = page + i; 297 if (unlikely((i & (MAX_ORDER_NR_PAGES - 1)) == 0))
298 p = pfn_to_page(page_to_pfn(page) + i);
296 299
297 if (unlikely(!PageTail(p) | 300 if (unlikely(!PageTail(p) |
298 (p->first_page != page))) 301 (p->first_page != page)))
diff --git a/mm/page_isolation.c b/mm/page_isolation.c
index c69f84fe038d..b70a7fec1ff6 100644
--- a/mm/page_isolation.c
+++ b/mm/page_isolation.c
@@ -114,8 +114,10 @@ __test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn)
114 114
115int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn) 115int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn)
116{ 116{
117 unsigned long pfn; 117 unsigned long pfn, flags;
118 struct page *page; 118 struct page *page;
119 struct zone *zone;
120 int ret;
119 121
120 pfn = start_pfn; 122 pfn = start_pfn;
121 /* 123 /*
@@ -131,7 +133,9 @@ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn)
131 if (pfn < end_pfn) 133 if (pfn < end_pfn)
132 return -EBUSY; 134 return -EBUSY;
133 /* Check all pages are free or Marked as ISOLATED */ 135 /* Check all pages are free or Marked as ISOLATED */
134 if (__test_page_isolated_in_pageblock(start_pfn, end_pfn)) 136 zone = page_zone(pfn_to_page(pfn));
135 return 0; 137 spin_lock_irqsave(&zone->lock, flags);
136 return -EBUSY; 138 ret = __test_page_isolated_in_pageblock(start_pfn, end_pfn);
139 spin_unlock_irqrestore(&zone->lock, flags);
140 return ret ? 0 : -EBUSY;
137} 141}
diff --git a/mm/slob.c b/mm/slob.c
index 4c82dd41f32e..cb675d126791 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -514,9 +514,11 @@ size_t ksize(const void *block)
514 return 0; 514 return 0;
515 515
516 sp = (struct slob_page *)virt_to_page(block); 516 sp = (struct slob_page *)virt_to_page(block);
517 if (slob_page(sp)) 517 if (slob_page(sp)) {
518 return ((slob_t *)block - 1)->units + SLOB_UNIT; 518 int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
519 else 519 unsigned int *m = (unsigned int *)(block - align);
520 return SLOB_UNITS(*m) * SLOB_UNIT;
521 } else
520 return sp->page.private; 522 return sp->page.private;
521} 523}
522 524
diff --git a/mm/slub.c b/mm/slub.c
index fb486d5540f8..0c83e6afe7b2 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1932,6 +1932,7 @@ init_kmem_cache_node(struct kmem_cache_node *n, struct kmem_cache *s)
1932 INIT_LIST_HEAD(&n->partial); 1932 INIT_LIST_HEAD(&n->partial);
1933#ifdef CONFIG_SLUB_DEBUG 1933#ifdef CONFIG_SLUB_DEBUG
1934 atomic_long_set(&n->nr_slabs, 0); 1934 atomic_long_set(&n->nr_slabs, 0);
1935 atomic_long_set(&n->total_objects, 0);
1935 INIT_LIST_HEAD(&n->full); 1936 INIT_LIST_HEAD(&n->full);
1936#endif 1937#endif
1937} 1938}
diff --git a/mm/tiny-shmem.c b/mm/tiny-shmem.c
index ae532f501943..8d7a27a6335c 100644
--- a/mm/tiny-shmem.c
+++ b/mm/tiny-shmem.c
@@ -65,31 +65,31 @@ struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags)
65 if (!dentry) 65 if (!dentry)
66 goto put_memory; 66 goto put_memory;
67 67
68 error = -ENFILE;
69 file = get_empty_filp();
70 if (!file)
71 goto put_dentry;
72
68 error = -ENOSPC; 73 error = -ENOSPC;
69 inode = ramfs_get_inode(root->d_sb, S_IFREG | S_IRWXUGO, 0); 74 inode = ramfs_get_inode(root->d_sb, S_IFREG | S_IRWXUGO, 0);
70 if (!inode) 75 if (!inode)
71 goto put_dentry; 76 goto close_file;
72 77
73 d_instantiate(dentry, inode); 78 d_instantiate(dentry, inode);
74 error = -ENFILE; 79 inode->i_size = size;
75 file = alloc_file(shm_mnt, dentry, FMODE_WRITE | FMODE_READ,
76 &ramfs_file_operations);
77 if (!file)
78 goto put_dentry;
79
80 inode->i_nlink = 0; /* It is unlinked */ 80 inode->i_nlink = 0; /* It is unlinked */
81 init_file(file, shm_mnt, dentry, FMODE_WRITE | FMODE_READ,
82 &ramfs_file_operations);
81 83
82 /* notify everyone as to the change of file size */ 84#ifndef CONFIG_MMU
83 error = do_truncate(dentry, size, 0, file); 85 error = ramfs_nommu_expand_for_mapping(inode, size);
84 if (error < 0) 86 if (error)
85 goto close_file; 87 goto close_file;
86 88#endif
87 return file; 89 return file;
88 90
89close_file: 91close_file:
90 put_filp(file); 92 put_filp(file);
91 return ERR_PTR(error);
92
93put_dentry: 93put_dentry:
94 dput(dentry); 94 dput(dentry);
95put_memory: 95put_memory:
diff --git a/net/9p/client.c b/net/9p/client.c
index 2ffe40cf2f01..10e320307ec0 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -75,7 +75,6 @@ static int parse_opts(char *opts, struct p9_client *clnt)
75 int option; 75 int option;
76 int ret = 0; 76 int ret = 0;
77 77
78 clnt->trans_mod = v9fs_default_trans();
79 clnt->dotu = 1; 78 clnt->dotu = 1;
80 clnt->msize = 8192; 79 clnt->msize = 8192;
81 80
@@ -108,7 +107,7 @@ static int parse_opts(char *opts, struct p9_client *clnt)
108 clnt->msize = option; 107 clnt->msize = option;
109 break; 108 break;
110 case Opt_trans: 109 case Opt_trans:
111 clnt->trans_mod = v9fs_match_trans(&args[0]); 110 clnt->trans_mod = v9fs_get_trans_by_name(&args[0]);
112 break; 111 break;
113 case Opt_legacy: 112 case Opt_legacy:
114 clnt->dotu = 0; 113 clnt->dotu = 0;
@@ -117,6 +116,10 @@ static int parse_opts(char *opts, struct p9_client *clnt)
117 continue; 116 continue;
118 } 117 }
119 } 118 }
119
120 if (!clnt->trans_mod)
121 clnt->trans_mod = v9fs_get_default_trans();
122
120 kfree(options); 123 kfree(options);
121 return ret; 124 return ret;
122} 125}
@@ -150,6 +153,7 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
150 if (!clnt) 153 if (!clnt)
151 return ERR_PTR(-ENOMEM); 154 return ERR_PTR(-ENOMEM);
152 155
156 clnt->trans_mod = NULL;
153 clnt->trans = NULL; 157 clnt->trans = NULL;
154 spin_lock_init(&clnt->lock); 158 spin_lock_init(&clnt->lock);
155 INIT_LIST_HEAD(&clnt->fidlist); 159 INIT_LIST_HEAD(&clnt->fidlist);
@@ -235,6 +239,8 @@ void p9_client_destroy(struct p9_client *clnt)
235 clnt->trans = NULL; 239 clnt->trans = NULL;
236 } 240 }
237 241
242 v9fs_put_trans(clnt->trans_mod);
243
238 list_for_each_entry_safe(fid, fidptr, &clnt->fidlist, flist) 244 list_for_each_entry_safe(fid, fidptr, &clnt->fidlist, flist)
239 p9_fid_destroy(fid); 245 p9_fid_destroy(fid);
240 246
diff --git a/net/9p/conv.c b/net/9p/conv.c
index 44547201f5bc..5ad3a3bd73b2 100644
--- a/net/9p/conv.c
+++ b/net/9p/conv.c
@@ -451,8 +451,10 @@ p9_put_data(struct cbuf *bufp, const char *data, int count,
451 unsigned char **pdata) 451 unsigned char **pdata)
452{ 452{
453 *pdata = buf_alloc(bufp, count); 453 *pdata = buf_alloc(bufp, count);
454 if (*pdata == NULL)
455 return -ENOMEM;
454 memmove(*pdata, data, count); 456 memmove(*pdata, data, count);
455 return count; 457 return 0;
456} 458}
457 459
458static int 460static int
@@ -460,6 +462,8 @@ p9_put_user_data(struct cbuf *bufp, const char __user *data, int count,
460 unsigned char **pdata) 462 unsigned char **pdata)
461{ 463{
462 *pdata = buf_alloc(bufp, count); 464 *pdata = buf_alloc(bufp, count);
465 if (*pdata == NULL)
466 return -ENOMEM;
463 return copy_from_user(*pdata, data, count); 467 return copy_from_user(*pdata, data, count);
464} 468}
465 469
diff --git a/net/9p/mod.c b/net/9p/mod.c
index bdee1fb7cc62..1084feb24cb0 100644
--- a/net/9p/mod.c
+++ b/net/9p/mod.c
@@ -31,6 +31,7 @@
31#include <linux/parser.h> 31#include <linux/parser.h>
32#include <net/9p/transport.h> 32#include <net/9p/transport.h>
33#include <linux/list.h> 33#include <linux/list.h>
34#include <linux/spinlock.h>
34 35
35#ifdef CONFIG_NET_9P_DEBUG 36#ifdef CONFIG_NET_9P_DEBUG
36unsigned int p9_debug_level = 0; /* feature-rific global debug level */ 37unsigned int p9_debug_level = 0; /* feature-rific global debug level */
@@ -44,8 +45,8 @@ MODULE_PARM_DESC(debug, "9P debugging level");
44 * 45 *
45 */ 46 */
46 47
48static DEFINE_SPINLOCK(v9fs_trans_lock);
47static LIST_HEAD(v9fs_trans_list); 49static LIST_HEAD(v9fs_trans_list);
48static struct p9_trans_module *v9fs_default_transport;
49 50
50/** 51/**
51 * v9fs_register_trans - register a new transport with 9p 52 * v9fs_register_trans - register a new transport with 9p
@@ -54,48 +55,87 @@ static struct p9_trans_module *v9fs_default_transport;
54 */ 55 */
55void v9fs_register_trans(struct p9_trans_module *m) 56void v9fs_register_trans(struct p9_trans_module *m)
56{ 57{
58 spin_lock(&v9fs_trans_lock);
57 list_add_tail(&m->list, &v9fs_trans_list); 59 list_add_tail(&m->list, &v9fs_trans_list);
58 if (m->def) 60 spin_unlock(&v9fs_trans_lock);
59 v9fs_default_transport = m;
60} 61}
61EXPORT_SYMBOL(v9fs_register_trans); 62EXPORT_SYMBOL(v9fs_register_trans);
62 63
63/** 64/**
64 * v9fs_match_trans - match transport versus registered transports 65 * v9fs_unregister_trans - unregister a 9p transport
66 * @m: the transport to remove
67 *
68 */
69void v9fs_unregister_trans(struct p9_trans_module *m)
70{
71 spin_lock(&v9fs_trans_lock);
72 list_del_init(&m->list);
73 spin_unlock(&v9fs_trans_lock);
74}
75EXPORT_SYMBOL(v9fs_unregister_trans);
76
77/**
78 * v9fs_get_trans_by_name - get transport with the matching name
65 * @name: string identifying transport 79 * @name: string identifying transport
66 * 80 *
67 */ 81 */
68struct p9_trans_module *v9fs_match_trans(const substring_t *name) 82struct p9_trans_module *v9fs_get_trans_by_name(const substring_t *name)
69{ 83{
70 struct list_head *p; 84 struct p9_trans_module *t, *found = NULL;
71 struct p9_trans_module *t = NULL; 85
72 86 spin_lock(&v9fs_trans_lock);
73 list_for_each(p, &v9fs_trans_list) { 87
74 t = list_entry(p, struct p9_trans_module, list); 88 list_for_each_entry(t, &v9fs_trans_list, list)
75 if (strncmp(t->name, name->from, name->to-name->from) == 0) 89 if (strncmp(t->name, name->from, name->to-name->from) == 0 &&
76 return t; 90 try_module_get(t->owner)) {
77 } 91 found = t;
78 return NULL; 92 break;
93 }
94
95 spin_unlock(&v9fs_trans_lock);
96 return found;
79} 97}
80EXPORT_SYMBOL(v9fs_match_trans); 98EXPORT_SYMBOL(v9fs_get_trans_by_name);
81 99
82/** 100/**
83 * v9fs_default_trans - returns pointer to default transport 101 * v9fs_get_default_trans - get the default transport
84 * 102 *
85 */ 103 */
86 104
87struct p9_trans_module *v9fs_default_trans(void) 105struct p9_trans_module *v9fs_get_default_trans(void)
88{ 106{
89 if (v9fs_default_transport) 107 struct p9_trans_module *t, *found = NULL;
90 return v9fs_default_transport; 108
91 else if (!list_empty(&v9fs_trans_list)) 109 spin_lock(&v9fs_trans_lock);
92 return list_first_entry(&v9fs_trans_list, 110
93 struct p9_trans_module, list); 111 list_for_each_entry(t, &v9fs_trans_list, list)
94 else 112 if (t->def && try_module_get(t->owner)) {
95 return NULL; 113 found = t;
114 break;
115 }
116
117 if (!found)
118 list_for_each_entry(t, &v9fs_trans_list, list)
119 if (try_module_get(t->owner)) {
120 found = t;
121 break;
122 }
123
124 spin_unlock(&v9fs_trans_lock);
125 return found;
96} 126}
97EXPORT_SYMBOL(v9fs_default_trans); 127EXPORT_SYMBOL(v9fs_get_default_trans);
98 128
129/**
130 * v9fs_put_trans - put trans
131 * @m: transport to put
132 *
133 */
134void v9fs_put_trans(struct p9_trans_module *m)
135{
136 if (m)
137 module_put(m->owner);
138}
99 139
100/** 140/**
101 * v9fs_init - Initialize module 141 * v9fs_init - Initialize module
@@ -120,6 +160,8 @@ static int __init init_p9(void)
120static void __exit exit_p9(void) 160static void __exit exit_p9(void)
121{ 161{
122 printk(KERN_INFO "Unloading 9P2000 support\n"); 162 printk(KERN_INFO "Unloading 9P2000 support\n");
163
164 p9_trans_fd_exit();
123} 165}
124 166
125module_init(init_p9) 167module_init(init_p9)
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index cdf137af7adc..d652baf5ff91 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -151,7 +151,6 @@ struct p9_mux_poll_task {
151 * @trans: reference to transport instance for this connection 151 * @trans: reference to transport instance for this connection
152 * @tagpool: id accounting for transactions 152 * @tagpool: id accounting for transactions
153 * @err: error state 153 * @err: error state
154 * @equeue: event wait_q (?)
155 * @req_list: accounting for requests which have been sent 154 * @req_list: accounting for requests which have been sent
156 * @unsent_req_list: accounting for requests that haven't been sent 155 * @unsent_req_list: accounting for requests that haven't been sent
157 * @rcall: current response &p9_fcall structure 156 * @rcall: current response &p9_fcall structure
@@ -178,7 +177,6 @@ struct p9_conn {
178 struct p9_trans *trans; 177 struct p9_trans *trans;
179 struct p9_idpool *tagpool; 178 struct p9_idpool *tagpool;
180 int err; 179 int err;
181 wait_queue_head_t equeue;
182 struct list_head req_list; 180 struct list_head req_list;
183 struct list_head unsent_req_list; 181 struct list_head unsent_req_list;
184 struct p9_fcall *rcall; 182 struct p9_fcall *rcall;
@@ -240,22 +238,6 @@ static int p9_conn_rpcnb(struct p9_conn *m, struct p9_fcall *tc,
240 238
241static void p9_conn_cancel(struct p9_conn *m, int err); 239static void p9_conn_cancel(struct p9_conn *m, int err);
242 240
243static int p9_mux_global_init(void)
244{
245 int i;
246
247 for (i = 0; i < ARRAY_SIZE(p9_mux_poll_tasks); i++)
248 p9_mux_poll_tasks[i].task = NULL;
249
250 p9_mux_wq = create_workqueue("v9fs");
251 if (!p9_mux_wq) {
252 printk(KERN_WARNING "v9fs: mux: creating workqueue failed\n");
253 return -ENOMEM;
254 }
255
256 return 0;
257}
258
259static u16 p9_mux_get_tag(struct p9_conn *m) 241static u16 p9_mux_get_tag(struct p9_conn *m)
260{ 242{
261 int tag; 243 int tag;
@@ -409,11 +391,11 @@ static void p9_mux_poll_stop(struct p9_conn *m)
409static struct p9_conn *p9_conn_create(struct p9_trans *trans) 391static struct p9_conn *p9_conn_create(struct p9_trans *trans)
410{ 392{
411 int i, n; 393 int i, n;
412 struct p9_conn *m, *mtmp; 394 struct p9_conn *m;
413 395
414 P9_DPRINTK(P9_DEBUG_MUX, "transport %p msize %d\n", trans, 396 P9_DPRINTK(P9_DEBUG_MUX, "transport %p msize %d\n", trans,
415 trans->msize); 397 trans->msize);
416 m = kmalloc(sizeof(struct p9_conn), GFP_KERNEL); 398 m = kzalloc(sizeof(struct p9_conn), GFP_KERNEL);
417 if (!m) 399 if (!m)
418 return ERR_PTR(-ENOMEM); 400 return ERR_PTR(-ENOMEM);
419 401
@@ -424,25 +406,14 @@ static struct p9_conn *p9_conn_create(struct p9_trans *trans)
424 m->trans = trans; 406 m->trans = trans;
425 m->tagpool = p9_idpool_create(); 407 m->tagpool = p9_idpool_create();
426 if (IS_ERR(m->tagpool)) { 408 if (IS_ERR(m->tagpool)) {
427 mtmp = ERR_PTR(-ENOMEM);
428 kfree(m); 409 kfree(m);
429 return mtmp; 410 return ERR_PTR(-ENOMEM);
430 } 411 }
431 412
432 m->err = 0;
433 init_waitqueue_head(&m->equeue);
434 INIT_LIST_HEAD(&m->req_list); 413 INIT_LIST_HEAD(&m->req_list);
435 INIT_LIST_HEAD(&m->unsent_req_list); 414 INIT_LIST_HEAD(&m->unsent_req_list);
436 m->rcall = NULL;
437 m->rpos = 0;
438 m->rbuf = NULL;
439 m->wpos = m->wsize = 0;
440 m->wbuf = NULL;
441 INIT_WORK(&m->rq, p9_read_work); 415 INIT_WORK(&m->rq, p9_read_work);
442 INIT_WORK(&m->wq, p9_write_work); 416 INIT_WORK(&m->wq, p9_write_work);
443 m->wsched = 0;
444 memset(&m->poll_waddr, 0, sizeof(m->poll_waddr));
445 m->poll_task = NULL;
446 n = p9_mux_poll_start(m); 417 n = p9_mux_poll_start(m);
447 if (n) { 418 if (n) {
448 kfree(m); 419 kfree(m);
@@ -463,10 +434,8 @@ static struct p9_conn *p9_conn_create(struct p9_trans *trans)
463 for (i = 0; i < ARRAY_SIZE(m->poll_waddr); i++) { 434 for (i = 0; i < ARRAY_SIZE(m->poll_waddr); i++) {
464 if (IS_ERR(m->poll_waddr[i])) { 435 if (IS_ERR(m->poll_waddr[i])) {
465 p9_mux_poll_stop(m); 436 p9_mux_poll_stop(m);
466 mtmp = (void *)m->poll_waddr; /* the error code */
467 kfree(m); 437 kfree(m);
468 m = mtmp; 438 return (void *)m->poll_waddr; /* the error code */
469 break;
470 } 439 }
471 } 440 }
472 441
@@ -483,18 +452,13 @@ static void p9_conn_destroy(struct p9_conn *m)
483{ 452{
484 P9_DPRINTK(P9_DEBUG_MUX, "mux %p prev %p next %p\n", m, 453 P9_DPRINTK(P9_DEBUG_MUX, "mux %p prev %p next %p\n", m,
485 m->mux_list.prev, m->mux_list.next); 454 m->mux_list.prev, m->mux_list.next);
486 p9_conn_cancel(m, -ECONNRESET);
487
488 if (!list_empty(&m->req_list)) {
489 /* wait until all processes waiting on this session exit */
490 P9_DPRINTK(P9_DEBUG_MUX,
491 "mux %p waiting for empty request queue\n", m);
492 wait_event_timeout(m->equeue, (list_empty(&m->req_list)), 5000);
493 P9_DPRINTK(P9_DEBUG_MUX, "mux %p request queue empty: %d\n", m,
494 list_empty(&m->req_list));
495 }
496 455
497 p9_mux_poll_stop(m); 456 p9_mux_poll_stop(m);
457 cancel_work_sync(&m->rq);
458 cancel_work_sync(&m->wq);
459
460 p9_conn_cancel(m, -ECONNRESET);
461
498 m->trans = NULL; 462 m->trans = NULL;
499 p9_idpool_destroy(m->tagpool); 463 p9_idpool_destroy(m->tagpool);
500 kfree(m); 464 kfree(m);
@@ -840,8 +804,6 @@ static void p9_read_work(struct work_struct *work)
840 (*req->cb) (req, req->cba); 804 (*req->cb) (req, req->cba);
841 else 805 else
842 kfree(req->rcall); 806 kfree(req->rcall);
843
844 wake_up(&m->equeue);
845 } 807 }
846 } else { 808 } else {
847 if (err >= 0 && rcall->id != P9_RFLUSH) 809 if (err >= 0 && rcall->id != P9_RFLUSH)
@@ -908,8 +870,10 @@ static struct p9_req *p9_send_request(struct p9_conn *m,
908 else 870 else
909 n = p9_mux_get_tag(m); 871 n = p9_mux_get_tag(m);
910 872
911 if (n < 0) 873 if (n < 0) {
874 kfree(req);
912 return ERR_PTR(-ENOMEM); 875 return ERR_PTR(-ENOMEM);
876 }
913 877
914 p9_set_tag(tc, n); 878 p9_set_tag(tc, n);
915 879
@@ -984,8 +948,6 @@ static void p9_mux_flush_cb(struct p9_req *freq, void *a)
984 (*req->cb) (req, req->cba); 948 (*req->cb) (req, req->cba);
985 else 949 else
986 kfree(req->rcall); 950 kfree(req->rcall);
987
988 wake_up(&m->equeue);
989 } 951 }
990 952
991 kfree(freq->tcall); 953 kfree(freq->tcall);
@@ -1191,8 +1153,6 @@ void p9_conn_cancel(struct p9_conn *m, int err)
1191 else 1153 else
1192 kfree(req->rcall); 1154 kfree(req->rcall);
1193 } 1155 }
1194
1195 wake_up(&m->equeue);
1196} 1156}
1197 1157
1198/** 1158/**
@@ -1370,7 +1330,6 @@ p9_fd_poll(struct p9_trans *trans, struct poll_table_struct *pt)
1370{ 1330{
1371 int ret, n; 1331 int ret, n;
1372 struct p9_trans_fd *ts = NULL; 1332 struct p9_trans_fd *ts = NULL;
1373 mm_segment_t oldfs;
1374 1333
1375 if (trans && trans->status == Connected) 1334 if (trans && trans->status == Connected)
1376 ts = trans->priv; 1335 ts = trans->priv;
@@ -1384,24 +1343,17 @@ p9_fd_poll(struct p9_trans *trans, struct poll_table_struct *pt)
1384 if (!ts->wr->f_op || !ts->wr->f_op->poll) 1343 if (!ts->wr->f_op || !ts->wr->f_op->poll)
1385 return -EIO; 1344 return -EIO;
1386 1345
1387 oldfs = get_fs();
1388 set_fs(get_ds());
1389
1390 ret = ts->rd->f_op->poll(ts->rd, pt); 1346 ret = ts->rd->f_op->poll(ts->rd, pt);
1391 if (ret < 0) 1347 if (ret < 0)
1392 goto end; 1348 return ret;
1393 1349
1394 if (ts->rd != ts->wr) { 1350 if (ts->rd != ts->wr) {
1395 n = ts->wr->f_op->poll(ts->wr, pt); 1351 n = ts->wr->f_op->poll(ts->wr, pt);
1396 if (n < 0) { 1352 if (n < 0)
1397 ret = n; 1353 return n;
1398 goto end;
1399 }
1400 ret = (ret & ~POLLOUT) | (n & ~POLLIN); 1354 ret = (ret & ~POLLOUT) | (n & ~POLLIN);
1401 } 1355 }
1402 1356
1403end:
1404 set_fs(oldfs);
1405 return ret; 1357 return ret;
1406} 1358}
1407 1359
@@ -1629,6 +1581,7 @@ static struct p9_trans_module p9_tcp_trans = {
1629 .maxsize = MAX_SOCK_BUF, 1581 .maxsize = MAX_SOCK_BUF,
1630 .def = 1, 1582 .def = 1,
1631 .create = p9_trans_create_tcp, 1583 .create = p9_trans_create_tcp,
1584 .owner = THIS_MODULE,
1632}; 1585};
1633 1586
1634static struct p9_trans_module p9_unix_trans = { 1587static struct p9_trans_module p9_unix_trans = {
@@ -1636,6 +1589,7 @@ static struct p9_trans_module p9_unix_trans = {
1636 .maxsize = MAX_SOCK_BUF, 1589 .maxsize = MAX_SOCK_BUF,
1637 .def = 0, 1590 .def = 0,
1638 .create = p9_trans_create_unix, 1591 .create = p9_trans_create_unix,
1592 .owner = THIS_MODULE,
1639}; 1593};
1640 1594
1641static struct p9_trans_module p9_fd_trans = { 1595static struct p9_trans_module p9_fd_trans = {
@@ -1643,14 +1597,20 @@ static struct p9_trans_module p9_fd_trans = {
1643 .maxsize = MAX_SOCK_BUF, 1597 .maxsize = MAX_SOCK_BUF,
1644 .def = 0, 1598 .def = 0,
1645 .create = p9_trans_create_fd, 1599 .create = p9_trans_create_fd,
1600 .owner = THIS_MODULE,
1646}; 1601};
1647 1602
1648int p9_trans_fd_init(void) 1603int p9_trans_fd_init(void)
1649{ 1604{
1650 int ret = p9_mux_global_init(); 1605 int i;
1651 if (ret) { 1606
1652 printk(KERN_WARNING "9p: starting mux failed\n"); 1607 for (i = 0; i < ARRAY_SIZE(p9_mux_poll_tasks); i++)
1653 return ret; 1608 p9_mux_poll_tasks[i].task = NULL;
1609
1610 p9_mux_wq = create_workqueue("v9fs");
1611 if (!p9_mux_wq) {
1612 printk(KERN_WARNING "v9fs: mux: creating workqueue failed\n");
1613 return -ENOMEM;
1654 } 1614 }
1655 1615
1656 v9fs_register_trans(&p9_tcp_trans); 1616 v9fs_register_trans(&p9_tcp_trans);
@@ -1659,4 +1619,12 @@ int p9_trans_fd_init(void)
1659 1619
1660 return 0; 1620 return 0;
1661} 1621}
1662EXPORT_SYMBOL(p9_trans_fd_init); 1622
1623void p9_trans_fd_exit(void)
1624{
1625 v9fs_unregister_trans(&p9_tcp_trans);
1626 v9fs_unregister_trans(&p9_unix_trans);
1627 v9fs_unregister_trans(&p9_fd_trans);
1628
1629 destroy_workqueue(p9_mux_wq);
1630}
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index 42adc052b149..94912e077a55 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -528,6 +528,7 @@ static struct p9_trans_module p9_virtio_trans = {
528 .create = p9_virtio_create, 528 .create = p9_virtio_create,
529 .maxsize = PAGE_SIZE*16, 529 .maxsize = PAGE_SIZE*16,
530 .def = 0, 530 .def = 0,
531 .owner = THIS_MODULE,
531}; 532};
532 533
533/* The standard init function */ 534/* The standard init function */
@@ -545,6 +546,7 @@ static int __init p9_virtio_init(void)
545static void __exit p9_virtio_cleanup(void) 546static void __exit p9_virtio_cleanup(void)
546{ 547{
547 unregister_virtio_driver(&p9_virtio_drv); 548 unregister_virtio_driver(&p9_virtio_drv);
549 v9fs_unregister_trans(&p9_virtio_trans);
548} 550}
549 551
550module_init(p9_virtio_init); 552module_init(p9_virtio_init);
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 01c83e2a4c19..28c71574a781 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -317,6 +317,9 @@ void ax25_destroy_socket(ax25_cb *ax25)
317 /* Queue the unaccepted socket for death */ 317 /* Queue the unaccepted socket for death */
318 sock_orphan(skb->sk); 318 sock_orphan(skb->sk);
319 319
320 /* 9A4GL: hack to release unaccepted sockets */
321 skb->sk->sk_state = TCP_LISTEN;
322
320 ax25_start_heartbeat(sax25); 323 ax25_start_heartbeat(sax25);
321 sax25->state = AX25_STATE_0; 324 sax25->state = AX25_STATE_0;
322 } 325 }
diff --git a/net/ax25/ax25_std_timer.c b/net/ax25/ax25_std_timer.c
index cdc7e751ef36..96e4b9273250 100644
--- a/net/ax25/ax25_std_timer.c
+++ b/net/ax25/ax25_std_timer.c
@@ -39,9 +39,11 @@ void ax25_std_heartbeat_expiry(ax25_cb *ax25)
39 39
40 switch (ax25->state) { 40 switch (ax25->state) {
41 case AX25_STATE_0: 41 case AX25_STATE_0:
42 if (!sk || 42 /* Magic here: If we listen() and a new link dies before it
43 sock_flag(sk, SOCK_DESTROY) || 43 is accepted() it isn't 'dead' so doesn't get removed. */
44 sock_flag(sk, SOCK_DEAD)) { 44 if (!sk || sock_flag(sk, SOCK_DESTROY) ||
45 (sk->sk_state == TCP_LISTEN &&
46 sock_flag(sk, SOCK_DEAD))) {
45 if (sk) { 47 if (sk) {
46 sock_hold(sk); 48 sock_hold(sk);
47 ax25_destroy_socket(ax25); 49 ax25_destroy_socket(ax25);
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index f5b21cb93699..278a3ace14f6 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -164,6 +164,9 @@ static inline int hci_request(struct hci_dev *hdev, void (*req)(struct hci_dev *
164{ 164{
165 int ret; 165 int ret;
166 166
167 if (!test_bit(HCI_UP, &hdev->flags))
168 return -ENETDOWN;
169
167 /* Serialize all requests */ 170 /* Serialize all requests */
168 hci_req_lock(hdev); 171 hci_req_lock(hdev);
169 ret = __hci_request(hdev, req, opt, timeout); 172 ret = __hci_request(hdev, req, opt, timeout);
diff --git a/net/core/dev.c b/net/core/dev.c
index e719ed29310f..0ae08d3f57e7 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -122,6 +122,7 @@
122#include <linux/if_arp.h> 122#include <linux/if_arp.h>
123#include <linux/if_vlan.h> 123#include <linux/if_vlan.h>
124#include <linux/ip.h> 124#include <linux/ip.h>
125#include <net/ip.h>
125#include <linux/ipv6.h> 126#include <linux/ipv6.h>
126#include <linux/in.h> 127#include <linux/in.h>
127#include <linux/jhash.h> 128#include <linux/jhash.h>
@@ -1667,7 +1668,7 @@ static u16 simple_tx_hash(struct net_device *dev, struct sk_buff *skb)
1667{ 1668{
1668 u32 addr1, addr2, ports; 1669 u32 addr1, addr2, ports;
1669 u32 hash, ihl; 1670 u32 hash, ihl;
1670 u8 ip_proto; 1671 u8 ip_proto = 0;
1671 1672
1672 if (unlikely(!simple_tx_hashrnd_initialized)) { 1673 if (unlikely(!simple_tx_hashrnd_initialized)) {
1673 get_random_bytes(&simple_tx_hashrnd, 4); 1674 get_random_bytes(&simple_tx_hashrnd, 4);
@@ -1676,7 +1677,8 @@ static u16 simple_tx_hash(struct net_device *dev, struct sk_buff *skb)
1676 1677
1677 switch (skb->protocol) { 1678 switch (skb->protocol) {
1678 case __constant_htons(ETH_P_IP): 1679 case __constant_htons(ETH_P_IP):
1679 ip_proto = ip_hdr(skb)->protocol; 1680 if (!(ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)))
1681 ip_proto = ip_hdr(skb)->protocol;
1680 addr1 = ip_hdr(skb)->saddr; 1682 addr1 = ip_hdr(skb)->saddr;
1681 addr2 = ip_hdr(skb)->daddr; 1683 addr2 = ip_hdr(skb)->daddr;
1682 ihl = ip_hdr(skb)->ihl; 1684 ihl = ip_hdr(skb)->ihl;
@@ -2916,6 +2918,12 @@ int netdev_set_master(struct net_device *slave, struct net_device *master)
2916 return 0; 2918 return 0;
2917} 2919}
2918 2920
2921static void dev_change_rx_flags(struct net_device *dev, int flags)
2922{
2923 if (dev->flags & IFF_UP && dev->change_rx_flags)
2924 dev->change_rx_flags(dev, flags);
2925}
2926
2919static int __dev_set_promiscuity(struct net_device *dev, int inc) 2927static int __dev_set_promiscuity(struct net_device *dev, int inc)
2920{ 2928{
2921 unsigned short old_flags = dev->flags; 2929 unsigned short old_flags = dev->flags;
@@ -2953,8 +2961,7 @@ static int __dev_set_promiscuity(struct net_device *dev, int inc)
2953 current->uid, current->gid, 2961 current->uid, current->gid,
2954 audit_get_sessionid(current)); 2962 audit_get_sessionid(current));
2955 2963
2956 if (dev->change_rx_flags) 2964 dev_change_rx_flags(dev, IFF_PROMISC);
2957 dev->change_rx_flags(dev, IFF_PROMISC);
2958 } 2965 }
2959 return 0; 2966 return 0;
2960} 2967}
@@ -3020,8 +3027,7 @@ int dev_set_allmulti(struct net_device *dev, int inc)
3020 } 3027 }
3021 } 3028 }
3022 if (dev->flags ^ old_flags) { 3029 if (dev->flags ^ old_flags) {
3023 if (dev->change_rx_flags) 3030 dev_change_rx_flags(dev, IFF_ALLMULTI);
3024 dev->change_rx_flags(dev, IFF_ALLMULTI);
3025 dev_set_rx_mode(dev); 3031 dev_set_rx_mode(dev);
3026 } 3032 }
3027 return 0; 3033 return 0;
@@ -3345,8 +3351,8 @@ int dev_change_flags(struct net_device *dev, unsigned flags)
3345 * Load in the correct multicast list now the flags have changed. 3351 * Load in the correct multicast list now the flags have changed.
3346 */ 3352 */
3347 3353
3348 if (dev->change_rx_flags && (old_flags ^ flags) & IFF_MULTICAST) 3354 if ((old_flags ^ flags) & IFF_MULTICAST)
3349 dev->change_rx_flags(dev, IFF_MULTICAST); 3355 dev_change_rx_flags(dev, IFF_MULTICAST);
3350 3356
3351 dev_set_rx_mode(dev); 3357 dev_set_rx_mode(dev);
3352 3358
@@ -3806,14 +3812,11 @@ static int dev_new_index(struct net *net)
3806} 3812}
3807 3813
3808/* Delayed registration/unregisteration */ 3814/* Delayed registration/unregisteration */
3809static DEFINE_SPINLOCK(net_todo_list_lock);
3810static LIST_HEAD(net_todo_list); 3815static LIST_HEAD(net_todo_list);
3811 3816
3812static void net_set_todo(struct net_device *dev) 3817static void net_set_todo(struct net_device *dev)
3813{ 3818{
3814 spin_lock(&net_todo_list_lock);
3815 list_add_tail(&dev->todo_list, &net_todo_list); 3819 list_add_tail(&dev->todo_list, &net_todo_list);
3816 spin_unlock(&net_todo_list_lock);
3817} 3820}
3818 3821
3819static void rollback_registered(struct net_device *dev) 3822static void rollback_registered(struct net_device *dev)
@@ -4140,33 +4143,24 @@ static void netdev_wait_allrefs(struct net_device *dev)
4140 * free_netdev(y1); 4143 * free_netdev(y1);
4141 * free_netdev(y2); 4144 * free_netdev(y2);
4142 * 4145 *
4143 * We are invoked by rtnl_unlock() after it drops the semaphore. 4146 * We are invoked by rtnl_unlock().
4144 * This allows us to deal with problems: 4147 * This allows us to deal with problems:
4145 * 1) We can delete sysfs objects which invoke hotplug 4148 * 1) We can delete sysfs objects which invoke hotplug
4146 * without deadlocking with linkwatch via keventd. 4149 * without deadlocking with linkwatch via keventd.
4147 * 2) Since we run with the RTNL semaphore not held, we can sleep 4150 * 2) Since we run with the RTNL semaphore not held, we can sleep
4148 * safely in order to wait for the netdev refcnt to drop to zero. 4151 * safely in order to wait for the netdev refcnt to drop to zero.
4152 *
4153 * We must not return until all unregister events added during
4154 * the interval the lock was held have been completed.
4149 */ 4155 */
4150static DEFINE_MUTEX(net_todo_run_mutex);
4151void netdev_run_todo(void) 4156void netdev_run_todo(void)
4152{ 4157{
4153 struct list_head list; 4158 struct list_head list;
4154 4159
4155 /* Need to guard against multiple cpu's getting out of order. */
4156 mutex_lock(&net_todo_run_mutex);
4157
4158 /* Not safe to do outside the semaphore. We must not return
4159 * until all unregister events invoked by the local processor
4160 * have been completed (either by this todo run, or one on
4161 * another cpu).
4162 */
4163 if (list_empty(&net_todo_list))
4164 goto out;
4165
4166 /* Snapshot list, allow later requests */ 4160 /* Snapshot list, allow later requests */
4167 spin_lock(&net_todo_list_lock);
4168 list_replace_init(&net_todo_list, &list); 4161 list_replace_init(&net_todo_list, &list);
4169 spin_unlock(&net_todo_list_lock); 4162
4163 __rtnl_unlock();
4170 4164
4171 while (!list_empty(&list)) { 4165 while (!list_empty(&list)) {
4172 struct net_device *dev 4166 struct net_device *dev
@@ -4198,9 +4192,6 @@ void netdev_run_todo(void)
4198 /* Free network device */ 4192 /* Free network device */
4199 kobject_put(&dev->dev.kobj); 4193 kobject_put(&dev->dev.kobj);
4200 } 4194 }
4201
4202out:
4203 mutex_unlock(&net_todo_run_mutex);
4204} 4195}
4205 4196
4206static struct net_device_stats *internal_stats(struct net_device *dev) 4197static struct net_device_stats *internal_stats(struct net_device *dev)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 71edb8b36341..d6381c2a4693 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -73,7 +73,7 @@ void __rtnl_unlock(void)
73 73
74void rtnl_unlock(void) 74void rtnl_unlock(void)
75{ 75{
76 mutex_unlock(&rtnl_mutex); 76 /* This fellow will unlock it for us. */
77 netdev_run_todo(); 77 netdev_run_todo();
78} 78}
79 79
diff --git a/net/ipv4/tcp_hybla.c b/net/ipv4/tcp_hybla.c
index bfcbd148a89d..c209e054a634 100644
--- a/net/ipv4/tcp_hybla.c
+++ b/net/ipv4/tcp_hybla.c
@@ -150,7 +150,11 @@ static void hybla_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
150 ca->snd_cwnd_cents -= 128; 150 ca->snd_cwnd_cents -= 128;
151 tp->snd_cwnd_cnt = 0; 151 tp->snd_cwnd_cnt = 0;
152 } 152 }
153 153 /* check when cwnd has not been incremented for a while */
154 if (increment == 0 && odd == 0 && tp->snd_cwnd_cnt >= tp->snd_cwnd) {
155 tp->snd_cwnd++;
156 tp->snd_cwnd_cnt = 0;
157 }
154 /* clamp down slowstart cwnd to ssthresh value. */ 158 /* clamp down slowstart cwnd to ssthresh value. */
155 if (is_slowstart) 159 if (is_slowstart)
156 tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh); 160 tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh);
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 67ccce2a96bd..7abc6b80d47d 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4879,7 +4879,8 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
4879 goto no_ack; 4879 goto no_ack;
4880 } 4880 }
4881 4881
4882 __tcp_ack_snd_check(sk, 0); 4882 if (!copied_early || tp->rcv_nxt != tp->rcv_wup)
4883 __tcp_ack_snd_check(sk, 0);
4883no_ack: 4884no_ack:
4884#ifdef CONFIG_NET_DMA 4885#ifdef CONFIG_NET_DMA
4885 if (copied_early) 4886 if (copied_early)
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 1b4fee20fc93..011478e46c40 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -618,7 +618,7 @@ static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, u32 ack,
618 ]; 618 ];
619 } rep; 619 } rep;
620 struct ip_reply_arg arg; 620 struct ip_reply_arg arg;
621 struct net *net = dev_net(skb->dev); 621 struct net *net = dev_net(skb->dst->dev);
622 622
623 memset(&rep.th, 0, sizeof(struct tcphdr)); 623 memset(&rep.th, 0, sizeof(struct tcphdr));
624 memset(&arg, 0, sizeof(arg)); 624 memset(&arg, 0, sizeof(arg));
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 8e42fbbd5761..57e26fa66185 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -951,6 +951,27 @@ int udp_disconnect(struct sock *sk, int flags)
951 return 0; 951 return 0;
952} 952}
953 953
954static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
955{
956 int is_udplite = IS_UDPLITE(sk);
957 int rc;
958
959 if ((rc = sock_queue_rcv_skb(sk, skb)) < 0) {
960 /* Note that an ENOMEM error is charged twice */
961 if (rc == -ENOMEM)
962 UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_RCVBUFERRORS,
963 is_udplite);
964 goto drop;
965 }
966
967 return 0;
968
969drop:
970 UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
971 kfree_skb(skb);
972 return -1;
973}
974
954/* returns: 975/* returns:
955 * -1: error 976 * -1: error
956 * 0: success 977 * 0: success
@@ -989,9 +1010,7 @@ int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
989 up->encap_rcv != NULL) { 1010 up->encap_rcv != NULL) {
990 int ret; 1011 int ret;
991 1012
992 bh_unlock_sock(sk);
993 ret = (*up->encap_rcv)(sk, skb); 1013 ret = (*up->encap_rcv)(sk, skb);
994 bh_lock_sock(sk);
995 if (ret <= 0) { 1014 if (ret <= 0) {
996 UDP_INC_STATS_BH(sock_net(sk), 1015 UDP_INC_STATS_BH(sock_net(sk),
997 UDP_MIB_INDATAGRAMS, 1016 UDP_MIB_INDATAGRAMS,
@@ -1044,17 +1063,16 @@ int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
1044 goto drop; 1063 goto drop;
1045 } 1064 }
1046 1065
1047 if ((rc = sock_queue_rcv_skb(sk,skb)) < 0) { 1066 rc = 0;
1048 /* Note that an ENOMEM error is charged twice */
1049 if (rc == -ENOMEM) {
1050 UDP_INC_STATS_BH(sock_net(sk),
1051 UDP_MIB_RCVBUFERRORS, is_udplite);
1052 atomic_inc(&sk->sk_drops);
1053 }
1054 goto drop;
1055 }
1056 1067
1057 return 0; 1068 bh_lock_sock(sk);
1069 if (!sock_owned_by_user(sk))
1070 rc = __udp_queue_rcv_skb(sk, skb);
1071 else
1072 sk_add_backlog(sk, skb);
1073 bh_unlock_sock(sk);
1074
1075 return rc;
1058 1076
1059drop: 1077drop:
1060 UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, is_udplite); 1078 UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
@@ -1092,15 +1110,7 @@ static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
1092 skb1 = skb_clone(skb, GFP_ATOMIC); 1110 skb1 = skb_clone(skb, GFP_ATOMIC);
1093 1111
1094 if (skb1) { 1112 if (skb1) {
1095 int ret = 0; 1113 int ret = udp_queue_rcv_skb(sk, skb1);
1096
1097 bh_lock_sock(sk);
1098 if (!sock_owned_by_user(sk))
1099 ret = udp_queue_rcv_skb(sk, skb1);
1100 else
1101 sk_add_backlog(sk, skb1);
1102 bh_unlock_sock(sk);
1103
1104 if (ret > 0) 1114 if (ret > 0)
1105 /* we should probably re-process instead 1115 /* we should probably re-process instead
1106 * of dropping packets here. */ 1116 * of dropping packets here. */
@@ -1195,13 +1205,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
1195 uh->dest, inet_iif(skb), udptable); 1205 uh->dest, inet_iif(skb), udptable);
1196 1206
1197 if (sk != NULL) { 1207 if (sk != NULL) {
1198 int ret = 0; 1208 int ret = udp_queue_rcv_skb(sk, skb);
1199 bh_lock_sock(sk);
1200 if (!sock_owned_by_user(sk))
1201 ret = udp_queue_rcv_skb(sk, skb);
1202 else
1203 sk_add_backlog(sk, skb);
1204 bh_unlock_sock(sk);
1205 sock_put(sk); 1209 sock_put(sk);
1206 1210
1207 /* a return value > 0 means to resubmit the input, but 1211 /* a return value > 0 means to resubmit the input, but
@@ -1494,7 +1498,7 @@ struct proto udp_prot = {
1494 .sendmsg = udp_sendmsg, 1498 .sendmsg = udp_sendmsg,
1495 .recvmsg = udp_recvmsg, 1499 .recvmsg = udp_recvmsg,
1496 .sendpage = udp_sendpage, 1500 .sendpage = udp_sendpage,
1497 .backlog_rcv = udp_queue_rcv_skb, 1501 .backlog_rcv = __udp_queue_rcv_skb,
1498 .hash = udp_lib_hash, 1502 .hash = udp_lib_hash,
1499 .unhash = udp_lib_unhash, 1503 .unhash = udp_lib_unhash,
1500 .get_port = udp_v4_get_port, 1504 .get_port = udp_v4_get_port,
diff --git a/net/ipv6/netfilter/ip6t_hbh.c b/net/ipv6/netfilter/ip6t_hbh.c
index 62e39ace0588..26654b26d7fa 100644
--- a/net/ipv6/netfilter/ip6t_hbh.c
+++ b/net/ipv6/netfilter/ip6t_hbh.c
@@ -97,8 +97,6 @@ hbh_mt6(const struct sk_buff *skb, const struct net_device *in,
97 hdrlen -= 2; 97 hdrlen -= 2;
98 if (!(optinfo->flags & IP6T_OPTS_OPTS)) { 98 if (!(optinfo->flags & IP6T_OPTS_OPTS)) {
99 return ret; 99 return ret;
100 } else if (optinfo->flags & IP6T_OPTS_NSTRICT) {
101 pr_debug("Not strict - not implemented");
102 } else { 100 } else {
103 pr_debug("Strict "); 101 pr_debug("Strict ");
104 pr_debug("#%d ", optinfo->optsnr); 102 pr_debug("#%d ", optinfo->optsnr);
@@ -177,6 +175,12 @@ hbh_mt6_check(const char *tablename, const void *entry,
177 pr_debug("ip6t_opts: unknown flags %X\n", optsinfo->invflags); 175 pr_debug("ip6t_opts: unknown flags %X\n", optsinfo->invflags);
178 return false; 176 return false;
179 } 177 }
178
179 if (optsinfo->flags & IP6T_OPTS_NSTRICT) {
180 pr_debug("ip6t_opts: Not strict - not implemented");
181 return false;
182 }
183
180 return true; 184 return true;
181} 185}
182 186
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 9af6115f0f50..63442a1e741c 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2688,6 +2688,8 @@ int __init ip6_route_init(void)
2688 if (ret) 2688 if (ret)
2689 goto out_kmem_cache; 2689 goto out_kmem_cache;
2690 2690
2691 ip6_dst_blackhole_ops.kmem_cachep = ip6_dst_ops_template.kmem_cachep;
2692
2691 /* Registering of the loopback is done before this portion of code, 2693 /* Registering of the loopback is done before this portion of code,
2692 * the loopback reference in rt6_info will not be taken, do it 2694 * the loopback reference in rt6_info will not be taken, do it
2693 * manually for init_net */ 2695 * manually for init_net */
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index b585c850a89a..10e22fd48222 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1050,7 +1050,7 @@ static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32
1050 struct tcphdr *th = tcp_hdr(skb), *t1; 1050 struct tcphdr *th = tcp_hdr(skb), *t1;
1051 struct sk_buff *buff; 1051 struct sk_buff *buff;
1052 struct flowi fl; 1052 struct flowi fl;
1053 struct net *net = dev_net(skb->dev); 1053 struct net *net = dev_net(skb->dst->dev);
1054 struct sock *ctl_sk = net->ipv6.tcp_sk; 1054 struct sock *ctl_sk = net->ipv6.tcp_sk;
1055 unsigned int tot_len = sizeof(struct tcphdr); 1055 unsigned int tot_len = sizeof(struct tcphdr);
1056 __be32 *topt; 1056 __be32 *topt;
diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c
index 705959b31e24..d7b54b5bfa69 100644
--- a/net/iucv/iucv.c
+++ b/net/iucv/iucv.c
@@ -524,7 +524,6 @@ static int iucv_enable(void)
524 get_online_cpus(); 524 get_online_cpus();
525 for_each_online_cpu(cpu) 525 for_each_online_cpu(cpu)
526 smp_call_function_single(cpu, iucv_declare_cpu, NULL, 1); 526 smp_call_function_single(cpu, iucv_declare_cpu, NULL, 1);
527 preempt_enable();
528 if (cpus_empty(iucv_buffer_cpumask)) 527 if (cpus_empty(iucv_buffer_cpumask))
529 /* No cpu could declare an iucv buffer. */ 528 /* No cpu could declare an iucv buffer. */
530 goto out_path; 529 goto out_path;
@@ -547,7 +546,9 @@ out:
547 */ 546 */
548static void iucv_disable(void) 547static void iucv_disable(void)
549{ 548{
549 get_online_cpus();
550 on_each_cpu(iucv_retrieve_cpu, NULL, 1); 550 on_each_cpu(iucv_retrieve_cpu, NULL, 1);
551 put_online_cpus();
551 kfree(iucv_path_table); 552 kfree(iucv_path_table);
552} 553}
553 554
diff --git a/net/key/af_key.c b/net/key/af_key.c
index d628df97e02e..b7f5a1c353ee 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -73,22 +73,18 @@ static int pfkey_can_dump(struct sock *sk)
73 return 0; 73 return 0;
74} 74}
75 75
76static int pfkey_do_dump(struct pfkey_sock *pfk) 76static void pfkey_terminate_dump(struct pfkey_sock *pfk)
77{ 77{
78 int rc; 78 if (pfk->dump.dump) {
79 79 pfk->dump.done(pfk);
80 rc = pfk->dump.dump(pfk); 80 pfk->dump.dump = NULL;
81 if (rc == -ENOBUFS) 81 pfk->dump.done = NULL;
82 return 0; 82 }
83
84 pfk->dump.done(pfk);
85 pfk->dump.dump = NULL;
86 pfk->dump.done = NULL;
87 return rc;
88} 83}
89 84
90static void pfkey_sock_destruct(struct sock *sk) 85static void pfkey_sock_destruct(struct sock *sk)
91{ 86{
87 pfkey_terminate_dump(pfkey_sk(sk));
92 skb_queue_purge(&sk->sk_receive_queue); 88 skb_queue_purge(&sk->sk_receive_queue);
93 89
94 if (!sock_flag(sk, SOCK_DEAD)) { 90 if (!sock_flag(sk, SOCK_DEAD)) {
@@ -310,6 +306,18 @@ static int pfkey_broadcast(struct sk_buff *skb, gfp_t allocation,
310 return err; 306 return err;
311} 307}
312 308
309static int pfkey_do_dump(struct pfkey_sock *pfk)
310{
311 int rc;
312
313 rc = pfk->dump.dump(pfk);
314 if (rc == -ENOBUFS)
315 return 0;
316
317 pfkey_terminate_dump(pfk);
318 return rc;
319}
320
313static inline void pfkey_hdr_dup(struct sadb_msg *new, struct sadb_msg *orig) 321static inline void pfkey_hdr_dup(struct sadb_msg *new, struct sadb_msg *orig)
314{ 322{
315 *new = *orig; 323 *new = *orig;
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 532e4faa29f7..9f1ea4a27b35 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -525,6 +525,7 @@ static int nr_release(struct socket *sock)
525 if (sk == NULL) return 0; 525 if (sk == NULL) return 0;
526 526
527 sock_hold(sk); 527 sock_hold(sk);
528 sock_orphan(sk);
528 lock_sock(sk); 529 lock_sock(sk);
529 nr = nr_sk(sk); 530 nr = nr_sk(sk);
530 531
@@ -548,7 +549,6 @@ static int nr_release(struct socket *sock)
548 sk->sk_state = TCP_CLOSE; 549 sk->sk_state = TCP_CLOSE;
549 sk->sk_shutdown |= SEND_SHUTDOWN; 550 sk->sk_shutdown |= SEND_SHUTDOWN;
550 sk->sk_state_change(sk); 551 sk->sk_state_change(sk);
551 sock_orphan(sk);
552 sock_set_flag(sk, SOCK_DESTROY); 552 sock_set_flag(sk, SOCK_DESTROY);
553 break; 553 break;
554 554
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 9634091ee2f0..ec0a0839ce51 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -215,10 +215,9 @@ static void dev_watchdog(unsigned long arg)
215 time_after(jiffies, (dev->trans_start + 215 time_after(jiffies, (dev->trans_start +
216 dev->watchdog_timeo))) { 216 dev->watchdog_timeo))) {
217 char drivername[64]; 217 char drivername[64];
218 printk(KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit timed out\n", 218 WARN_ONCE(1, KERN_INFO "NETDEV WATCHDOG: %s (%s): transmit timed out\n",
219 dev->name, netdev_drivername(dev, drivername, 64)); 219 dev->name, netdev_drivername(dev, drivername, 64));
220 dev->tx_timeout(dev); 220 dev->tx_timeout(dev);
221 WARN_ON_ONCE(1);
222 } 221 }
223 if (!mod_timer(&dev->watchdog_timer, 222 if (!mod_timer(&dev->watchdog_timer,
224 round_jiffies(jiffies + 223 round_jiffies(jiffies +
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 8472b8b349c4..abd51cef2413 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -599,11 +599,12 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
599 /* Check to see if this is a duplicate. */ 599 /* Check to see if this is a duplicate. */
600 peer = sctp_assoc_lookup_paddr(asoc, addr); 600 peer = sctp_assoc_lookup_paddr(asoc, addr);
601 if (peer) { 601 if (peer) {
602 /* An UNKNOWN state is only set on transports added by
603 * user in sctp_connectx() call. Such transports should be
604 * considered CONFIRMED per RFC 4960, Section 5.4.
605 */
602 if (peer->state == SCTP_UNKNOWN) { 606 if (peer->state == SCTP_UNKNOWN) {
603 if (peer_state == SCTP_ACTIVE) 607 peer->state = SCTP_ACTIVE;
604 peer->state = SCTP_ACTIVE;
605 if (peer_state == SCTP_UNCONFIRMED)
606 peer->state = SCTP_UNCONFIRMED;
607 } 608 }
608 return peer; 609 return peer;
609 } 610 }
diff --git a/net/sctp/output.c b/net/sctp/output.c
index 0dc4a7dfb234..225c7123c41f 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -533,7 +533,8 @@ int sctp_packet_transmit(struct sctp_packet *packet)
533 if (!(dst->dev->features & NETIF_F_NO_CSUM)) { 533 if (!(dst->dev->features & NETIF_F_NO_CSUM)) {
534 crc32 = sctp_start_cksum((__u8 *)sh, cksum_buf_len); 534 crc32 = sctp_start_cksum((__u8 *)sh, cksum_buf_len);
535 crc32 = sctp_end_cksum(crc32); 535 crc32 = sctp_end_cksum(crc32);
536 } 536 } else
537 nskb->ip_summed = CHECKSUM_UNNECESSARY;
537 538
538 /* 3) Put the resultant value into the checksum field in the 539 /* 3) Put the resultant value into the checksum field in the
539 * common header, and leave the rest of the bits unchanged. 540 * common header, and leave the rest of the bits unchanged.
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index e8ca4e54981f..d68869f966c3 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -1012,6 +1012,29 @@ end:
1012 return retval; 1012 return retval;
1013} 1013}
1014 1014
1015struct sctp_chunk *sctp_make_violation_paramlen(
1016 const struct sctp_association *asoc,
1017 const struct sctp_chunk *chunk,
1018 struct sctp_paramhdr *param)
1019{
1020 struct sctp_chunk *retval;
1021 static const char error[] = "The following parameter had invalid length:";
1022 size_t payload_len = sizeof(error) + sizeof(sctp_errhdr_t) +
1023 sizeof(sctp_paramhdr_t);
1024
1025 retval = sctp_make_abort(asoc, chunk, payload_len);
1026 if (!retval)
1027 goto nodata;
1028
1029 sctp_init_cause(retval, SCTP_ERROR_PROTO_VIOLATION,
1030 sizeof(error) + sizeof(sctp_paramhdr_t));
1031 sctp_addto_chunk(retval, sizeof(error), error);
1032 sctp_addto_param(retval, sizeof(sctp_paramhdr_t), param);
1033
1034nodata:
1035 return retval;
1036}
1037
1015/* Make a HEARTBEAT chunk. */ 1038/* Make a HEARTBEAT chunk. */
1016struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *asoc, 1039struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *asoc,
1017 const struct sctp_transport *transport, 1040 const struct sctp_transport *transport,
@@ -1782,11 +1805,6 @@ static int sctp_process_inv_paramlength(const struct sctp_association *asoc,
1782 const struct sctp_chunk *chunk, 1805 const struct sctp_chunk *chunk,
1783 struct sctp_chunk **errp) 1806 struct sctp_chunk **errp)
1784{ 1807{
1785 static const char error[] = "The following parameter had invalid length:";
1786 size_t payload_len = WORD_ROUND(sizeof(error)) +
1787 sizeof(sctp_paramhdr_t);
1788
1789
1790 /* This is a fatal error. Any accumulated non-fatal errors are 1808 /* This is a fatal error. Any accumulated non-fatal errors are
1791 * not reported. 1809 * not reported.
1792 */ 1810 */
@@ -1794,14 +1812,7 @@ static int sctp_process_inv_paramlength(const struct sctp_association *asoc,
1794 sctp_chunk_free(*errp); 1812 sctp_chunk_free(*errp);
1795 1813
1796 /* Create an error chunk and fill it in with our payload. */ 1814 /* Create an error chunk and fill it in with our payload. */
1797 *errp = sctp_make_op_error_space(asoc, chunk, payload_len); 1815 *errp = sctp_make_violation_paramlen(asoc, chunk, param);
1798
1799 if (*errp) {
1800 sctp_init_cause(*errp, SCTP_ERROR_PROTO_VIOLATION,
1801 sizeof(error) + sizeof(sctp_paramhdr_t));
1802 sctp_addto_chunk(*errp, sizeof(error), error);
1803 sctp_addto_param(*errp, sizeof(sctp_paramhdr_t), param);
1804 }
1805 1816
1806 return 0; 1817 return 0;
1807} 1818}
@@ -1886,11 +1897,13 @@ static void sctp_process_ext_param(struct sctp_association *asoc,
1886 /* if the peer reports AUTH, assume that he 1897 /* if the peer reports AUTH, assume that he
1887 * supports AUTH. 1898 * supports AUTH.
1888 */ 1899 */
1889 asoc->peer.auth_capable = 1; 1900 if (sctp_auth_enable)
1901 asoc->peer.auth_capable = 1;
1890 break; 1902 break;
1891 case SCTP_CID_ASCONF: 1903 case SCTP_CID_ASCONF:
1892 case SCTP_CID_ASCONF_ACK: 1904 case SCTP_CID_ASCONF_ACK:
1893 asoc->peer.asconf_capable = 1; 1905 if (sctp_addip_enable)
1906 asoc->peer.asconf_capable = 1;
1894 break; 1907 break;
1895 default: 1908 default:
1896 break; 1909 break;
@@ -2319,12 +2332,10 @@ clean_up:
2319 /* Release the transport structures. */ 2332 /* Release the transport structures. */
2320 list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) { 2333 list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
2321 transport = list_entry(pos, struct sctp_transport, transports); 2334 transport = list_entry(pos, struct sctp_transport, transports);
2322 list_del_init(pos); 2335 if (transport->state != SCTP_ACTIVE)
2323 sctp_transport_free(transport); 2336 sctp_assoc_rm_peer(asoc, transport);
2324 } 2337 }
2325 2338
2326 asoc->peer.transport_count = 0;
2327
2328nomem: 2339nomem:
2329 return 0; 2340 return 0;
2330} 2341}
@@ -2460,6 +2471,9 @@ do_addr_param:
2460 break; 2471 break;
2461 2472
2462 case SCTP_PARAM_SET_PRIMARY: 2473 case SCTP_PARAM_SET_PRIMARY:
2474 if (!sctp_addip_enable)
2475 goto fall_through;
2476
2463 addr_param = param.v + sizeof(sctp_addip_param_t); 2477 addr_param = param.v + sizeof(sctp_addip_param_t);
2464 2478
2465 af = sctp_get_af_specific(param_type2af(param.p->type)); 2479 af = sctp_get_af_specific(param_type2af(param.p->type));
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 8848d329aa2c..7c622af2ce55 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -119,7 +119,7 @@ static sctp_disposition_t sctp_sf_violation_paramlen(
119 const struct sctp_endpoint *ep, 119 const struct sctp_endpoint *ep,
120 const struct sctp_association *asoc, 120 const struct sctp_association *asoc,
121 const sctp_subtype_t type, 121 const sctp_subtype_t type,
122 void *arg, 122 void *arg, void *ext,
123 sctp_cmd_seq_t *commands); 123 sctp_cmd_seq_t *commands);
124 124
125static sctp_disposition_t sctp_sf_violation_ctsn( 125static sctp_disposition_t sctp_sf_violation_ctsn(
@@ -3425,7 +3425,7 @@ sctp_disposition_t sctp_sf_do_asconf(const struct sctp_endpoint *ep,
3425 addr_param = (union sctp_addr_param *)hdr->params; 3425 addr_param = (union sctp_addr_param *)hdr->params;
3426 length = ntohs(addr_param->p.length); 3426 length = ntohs(addr_param->p.length);
3427 if (length < sizeof(sctp_paramhdr_t)) 3427 if (length < sizeof(sctp_paramhdr_t))
3428 return sctp_sf_violation_paramlen(ep, asoc, type, 3428 return sctp_sf_violation_paramlen(ep, asoc, type, arg,
3429 (void *)addr_param, commands); 3429 (void *)addr_param, commands);
3430 3430
3431 /* Verify the ASCONF chunk before processing it. */ 3431 /* Verify the ASCONF chunk before processing it. */
@@ -3433,8 +3433,8 @@ sctp_disposition_t sctp_sf_do_asconf(const struct sctp_endpoint *ep,
3433 (sctp_paramhdr_t *)((void *)addr_param + length), 3433 (sctp_paramhdr_t *)((void *)addr_param + length),
3434 (void *)chunk->chunk_end, 3434 (void *)chunk->chunk_end,
3435 &err_param)) 3435 &err_param))
3436 return sctp_sf_violation_paramlen(ep, asoc, type, 3436 return sctp_sf_violation_paramlen(ep, asoc, type, arg,
3437 (void *)&err_param, commands); 3437 (void *)err_param, commands);
3438 3438
3439 /* ADDIP 5.2 E1) Compare the value of the serial number to the value 3439 /* ADDIP 5.2 E1) Compare the value of the serial number to the value
3440 * the endpoint stored in a new association variable 3440 * the endpoint stored in a new association variable
@@ -3542,8 +3542,8 @@ sctp_disposition_t sctp_sf_do_asconf_ack(const struct sctp_endpoint *ep,
3542 (sctp_paramhdr_t *)addip_hdr->params, 3542 (sctp_paramhdr_t *)addip_hdr->params,
3543 (void *)asconf_ack->chunk_end, 3543 (void *)asconf_ack->chunk_end,
3544 &err_param)) 3544 &err_param))
3545 return sctp_sf_violation_paramlen(ep, asoc, type, 3545 return sctp_sf_violation_paramlen(ep, asoc, type, arg,
3546 (void *)&err_param, commands); 3546 (void *)err_param, commands);
3547 3547
3548 if (last_asconf) { 3548 if (last_asconf) {
3549 addip_hdr = (sctp_addiphdr_t *)last_asconf->subh.addip_hdr; 3549 addip_hdr = (sctp_addiphdr_t *)last_asconf->subh.addip_hdr;
@@ -4240,12 +4240,38 @@ static sctp_disposition_t sctp_sf_violation_paramlen(
4240 const struct sctp_endpoint *ep, 4240 const struct sctp_endpoint *ep,
4241 const struct sctp_association *asoc, 4241 const struct sctp_association *asoc,
4242 const sctp_subtype_t type, 4242 const sctp_subtype_t type,
4243 void *arg, 4243 void *arg, void *ext,
4244 sctp_cmd_seq_t *commands) { 4244 sctp_cmd_seq_t *commands)
4245 static const char err_str[] = "The following parameter had invalid length:"; 4245{
4246 struct sctp_chunk *chunk = arg;
4247 struct sctp_paramhdr *param = ext;
4248 struct sctp_chunk *abort = NULL;
4246 4249
4247 return sctp_sf_abort_violation(ep, asoc, arg, commands, err_str, 4250 if (sctp_auth_recv_cid(SCTP_CID_ABORT, asoc))
4248 sizeof(err_str)); 4251 goto discard;
4252
4253 /* Make the abort chunk. */
4254 abort = sctp_make_violation_paramlen(asoc, chunk, param);
4255 if (!abort)
4256 goto nomem;
4257
4258 sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));
4259 SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
4260
4261 sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR,
4262 SCTP_ERROR(ECONNABORTED));
4263 sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
4264 SCTP_PERR(SCTP_ERROR_PROTO_VIOLATION));
4265 SCTP_DEC_STATS(SCTP_MIB_CURRESTAB);
4266
4267discard:
4268 sctp_sf_pdiscard(ep, asoc, SCTP_ST_CHUNK(0), arg, commands);
4269
4270 SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
4271
4272 return SCTP_DISPOSITION_ABORT;
4273nomem:
4274 return SCTP_DISPOSITION_NOMEM;
4249} 4275}
4250 4276
4251/* Handle a protocol violation when the peer trying to advance the 4277/* Handle a protocol violation when the peer trying to advance the
diff --git a/net/socket.c b/net/socket.c
index 8ef8ba81b9e2..3e8d4e35c08f 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1511,6 +1511,7 @@ out_fd:
1511 goto out_put; 1511 goto out_put;
1512} 1512}
1513 1513
1514#if 0
1514#ifdef HAVE_SET_RESTORE_SIGMASK 1515#ifdef HAVE_SET_RESTORE_SIGMASK
1515asmlinkage long sys_paccept(int fd, struct sockaddr __user *upeer_sockaddr, 1516asmlinkage long sys_paccept(int fd, struct sockaddr __user *upeer_sockaddr,
1516 int __user *upeer_addrlen, 1517 int __user *upeer_addrlen,
@@ -1564,6 +1565,7 @@ asmlinkage long sys_paccept(int fd, struct sockaddr __user *upeer_sockaddr,
1564 return do_accept(fd, upeer_sockaddr, upeer_addrlen, flags); 1565 return do_accept(fd, upeer_sockaddr, upeer_addrlen, flags);
1565} 1566}
1566#endif 1567#endif
1568#endif
1567 1569
1568asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, 1570asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr,
1569 int __user *upeer_addrlen) 1571 int __user *upeer_addrlen)
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index ac25b4c0e982..dc50f1e71f76 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -27,10 +27,14 @@ static int xfrm_state_check_space(struct xfrm_state *x, struct sk_buff *skb)
27 - skb_headroom(skb); 27 - skb_headroom(skb);
28 int ntail = dst->dev->needed_tailroom - skb_tailroom(skb); 28 int ntail = dst->dev->needed_tailroom - skb_tailroom(skb);
29 29
30 if (nhead > 0 || ntail > 0) 30 if (nhead <= 0) {
31 return pskb_expand_head(skb, nhead, ntail, GFP_ATOMIC); 31 if (ntail <= 0)
32 32 return 0;
33 return 0; 33 nhead = 0;
34 } else if (ntail < 0)
35 ntail = 0;
36
37 return pskb_expand_head(skb, nhead, ntail, GFP_ATOMIC);
34} 38}
35 39
36static int xfrm_output_one(struct sk_buff *skb, int err) 40static int xfrm_output_one(struct sk_buff *skb, int err)
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 36b5eedcdc75..3e1057f885c6 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -32,6 +32,7 @@ char *defconfig_file;
32 32
33static int indent = 1; 33static int indent = 1;
34static int valid_stdin = 1; 34static int valid_stdin = 1;
35static int sync_kconfig;
35static int conf_cnt; 36static int conf_cnt;
36static char line[128]; 37static char line[128];
37static struct menu *rootEntry; 38static struct menu *rootEntry;
@@ -65,7 +66,7 @@ static void strip(char *str)
65 66
66static void check_stdin(void) 67static void check_stdin(void)
67{ 68{
68 if (!valid_stdin && input_mode == ask_silent) { 69 if (!valid_stdin) {
69 printf(_("aborted!\n\n")); 70 printf(_("aborted!\n\n"));
70 printf(_("Console input/output is redirected. ")); 71 printf(_("Console input/output is redirected. "));
71 printf(_("Run 'make oldconfig' to update configuration.\n\n")); 72 printf(_("Run 'make oldconfig' to update configuration.\n\n"));
@@ -427,43 +428,6 @@ static void check_conf(struct menu *menu)
427 check_conf(child); 428 check_conf(child);
428} 429}
429 430
430static void conf_do_update(void)
431{
432 /* Update until a loop caused no more changes */
433 do {
434 conf_cnt = 0;
435 check_conf(&rootmenu);
436 } while (conf_cnt);
437}
438
439static int conf_silent_update(void)
440{
441 const char *name;
442
443 if (conf_get_changed()) {
444 name = getenv("KCONFIG_NOSILENTUPDATE");
445 if (name && *name) {
446 fprintf(stderr,
447 _("\n*** Kernel configuration requires explicit update.\n\n"));
448 return 1;
449 }
450 conf_do_update();
451 }
452 return 0;
453}
454
455static int conf_update(void)
456{
457 rootEntry = &rootmenu;
458 conf(&rootmenu);
459 if (input_mode == ask_all) {
460 input_mode = ask_silent;
461 valid_stdin = 1;
462 }
463 conf_do_update();
464 return 0;
465}
466
467int main(int ac, char **av) 431int main(int ac, char **av)
468{ 432{
469 int opt; 433 int opt;
@@ -477,11 +441,11 @@ int main(int ac, char **av)
477 while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) { 441 while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) {
478 switch (opt) { 442 switch (opt) {
479 case 'o': 443 case 'o':
480 input_mode = ask_new; 444 input_mode = ask_silent;
481 break; 445 break;
482 case 's': 446 case 's':
483 input_mode = ask_silent; 447 input_mode = ask_silent;
484 valid_stdin = isatty(0) && isatty(1) && isatty(2); 448 sync_kconfig = 1;
485 break; 449 break;
486 case 'd': 450 case 'd':
487 input_mode = set_default; 451 input_mode = set_default;
@@ -519,6 +483,19 @@ int main(int ac, char **av)
519 name = av[optind]; 483 name = av[optind];
520 conf_parse(name); 484 conf_parse(name);
521 //zconfdump(stdout); 485 //zconfdump(stdout);
486 if (sync_kconfig) {
487 if (stat(".config", &tmpstat)) {
488 fprintf(stderr, _("***\n"
489 "*** You have not yet configured your kernel!\n"
490 "*** (missing kernel .config file)\n"
491 "***\n"
492 "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
493 "*** \"make menuconfig\" or \"make xconfig\").\n"
494 "***\n"));
495 exit(1);
496 }
497 }
498
522 switch (input_mode) { 499 switch (input_mode) {
523 case set_default: 500 case set_default:
524 if (!defconfig_file) 501 if (!defconfig_file)
@@ -531,16 +508,6 @@ int main(int ac, char **av)
531 } 508 }
532 break; 509 break;
533 case ask_silent: 510 case ask_silent:
534 if (stat(".config", &tmpstat)) {
535 printf(_("***\n"
536 "*** You have not yet configured your kernel!\n"
537 "*** (missing kernel .config file)\n"
538 "***\n"
539 "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
540 "*** \"make menuconfig\" or \"make xconfig\").\n"
541 "***\n"));
542 exit(1);
543 }
544 case ask_all: 511 case ask_all:
545 case ask_new: 512 case ask_new:
546 conf_read(NULL); 513 conf_read(NULL);
@@ -569,6 +536,19 @@ int main(int ac, char **av)
569 default: 536 default:
570 break; 537 break;
571 } 538 }
539
540 if (sync_kconfig) {
541 if (conf_get_changed()) {
542 name = getenv("KCONFIG_NOSILENTUPDATE");
543 if (name && *name) {
544 fprintf(stderr,
545 _("\n*** Kernel configuration requires explicit update.\n\n"));
546 return 1;
547 }
548 }
549 valid_stdin = isatty(0) && isatty(1) && isatty(2);
550 }
551
572 switch (input_mode) { 552 switch (input_mode) {
573 case set_no: 553 case set_no:
574 conf_set_all_new_symbols(def_no); 554 conf_set_all_new_symbols(def_no);
@@ -585,27 +565,38 @@ int main(int ac, char **av)
585 case set_default: 565 case set_default:
586 conf_set_all_new_symbols(def_default); 566 conf_set_all_new_symbols(def_default);
587 break; 567 break;
588 case ask_silent:
589 case ask_new: 568 case ask_new:
590 if (conf_silent_update())
591 exit(1);
592 break;
593 case ask_all: 569 case ask_all:
594 if (conf_update()) 570 rootEntry = &rootmenu;
595 exit(1); 571 conf(&rootmenu);
572 input_mode = ask_silent;
573 /* fall through */
574 case ask_silent:
575 /* Update until a loop caused no more changes */
576 do {
577 conf_cnt = 0;
578 check_conf(&rootmenu);
579 } while (conf_cnt);
596 break; 580 break;
597 } 581 }
598 582
599 if (conf_write(NULL)) { 583 if (sync_kconfig) {
600 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 584 /* silentoldconfig is used during the build so we shall update autoconf.
601 exit(1); 585 * All other commands are only used to generate a config.
602 } 586 */
603 /* ask_silent is used during the build so we shall update autoconf. 587 if (conf_get_changed() && conf_write(NULL)) {
604 * All other commands are only used to generate a config. 588 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
605 */ 589 exit(1);
606 if (input_mode == ask_silent && conf_write_autoconf()) { 590 }
607 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 591 if (conf_write_autoconf()) {
608 return 1; 592 fprintf(stderr, _("\n*** Error during update of the kernel configuration.\n\n"));
593 return 1;
594 }
595 } else {
596 if (conf_write(NULL)) {
597 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
598 exit(1);
599 }
609 } 600 }
610 return 0; 601 return 0;
611} 602}
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index df6a188b9930..b91cf241a539 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -222,8 +222,10 @@ load:
222 continue; 222 continue;
223 if (def == S_DEF_USER) { 223 if (def == S_DEF_USER) {
224 sym = sym_find(line + 9); 224 sym = sym_find(line + 9);
225 if (!sym) 225 if (!sym) {
226 sym_add_change_count(1);
226 break; 227 break;
228 }
227 } else { 229 } else {
228 sym = sym_lookup(line + 9, 0); 230 sym = sym_lookup(line + 9, 0);
229 if (sym->type == S_UNKNOWN) 231 if (sym->type == S_UNKNOWN)
@@ -259,8 +261,10 @@ load:
259 } 261 }
260 if (def == S_DEF_USER) { 262 if (def == S_DEF_USER) {
261 sym = sym_find(line + 7); 263 sym = sym_find(line + 7);
262 if (!sym) 264 if (!sym) {
265 sym_add_change_count(1);
263 break; 266 break;
267 }
264 } else { 268 } else {
265 sym = sym_lookup(line + 7, 0); 269 sym = sym_lookup(line + 7, 0);
266 if (sym->type == S_UNKNOWN) 270 if (sym->type == S_UNKNOWN)
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index ff787e6ff8ed..44ee94d2ab76 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -781,6 +781,7 @@ sub output_struct_xml(%) {
781 print " <refsect1>\n"; 781 print " <refsect1>\n";
782 print " <title>Members</title>\n"; 782 print " <title>Members</title>\n";
783 783
784 if ($#{$args{'parameterlist'}} >= 0) {
784 print " <variablelist>\n"; 785 print " <variablelist>\n";
785 foreach $parameter (@{$args{'parameterlist'}}) { 786 foreach $parameter (@{$args{'parameterlist'}}) {
786 ($parameter =~ /^#/) && next; 787 ($parameter =~ /^#/) && next;
@@ -798,6 +799,9 @@ sub output_struct_xml(%) {
798 print " </varlistentry>\n"; 799 print " </varlistentry>\n";
799 } 800 }
800 print " </variablelist>\n"; 801 print " </variablelist>\n";
802 } else {
803 print " <para>\n None\n </para>\n";
804 }
801 print " </refsect1>\n"; 805 print " </refsect1>\n";
802 806
803 output_section_xml(@_); 807 output_section_xml(@_);
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 418cd7dbbc93..8e0de6a5e18a 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -1986,11 +1986,13 @@ static void read_markers(const char *fname)
1986 1986
1987 mod = find_module(modname); 1987 mod = find_module(modname);
1988 if (!mod) { 1988 if (!mod) {
1989 if (is_vmlinux(modname))
1990 have_vmlinux = 1;
1991 mod = new_module(NOFAIL(strdup(modname))); 1989 mod = new_module(NOFAIL(strdup(modname)));
1992 mod->skip = 1; 1990 mod->skip = 1;
1993 } 1991 }
1992 if (is_vmlinux(modname)) {
1993 have_vmlinux = 1;
1994 mod->skip = 0;
1995 }
1994 1996
1995 if (!mod->skip) 1997 if (!mod->skip)
1996 add_marker(mod, marker, fmt); 1998 add_marker(mod, marker, fmt);
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index d11a8154500f..8551952ef329 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -2737,6 +2737,7 @@ int security_netlbl_secattr_to_sid(struct netlbl_lsm_secattr *secattr,
2737 if (ctx == NULL) 2737 if (ctx == NULL)
2738 goto netlbl_secattr_to_sid_return; 2738 goto netlbl_secattr_to_sid_return;
2739 2739
2740 context_init(&ctx_new);
2740 ctx_new.user = ctx->user; 2741 ctx_new.user = ctx->user;
2741 ctx_new.role = ctx->role; 2742 ctx_new.role = ctx->role;
2742 ctx_new.type = ctx->type; 2743 ctx_new.type = ctx->type;
@@ -2745,13 +2746,9 @@ int security_netlbl_secattr_to_sid(struct netlbl_lsm_secattr *secattr,
2745 if (ebitmap_netlbl_import(&ctx_new.range.level[0].cat, 2746 if (ebitmap_netlbl_import(&ctx_new.range.level[0].cat,
2746 secattr->attr.mls.cat) != 0) 2747 secattr->attr.mls.cat) != 0)
2747 goto netlbl_secattr_to_sid_return; 2748 goto netlbl_secattr_to_sid_return;
2748 ctx_new.range.level[1].cat.highbit = 2749 memcpy(&ctx_new.range.level[1].cat,
2749 ctx_new.range.level[0].cat.highbit; 2750 &ctx_new.range.level[0].cat,
2750 ctx_new.range.level[1].cat.node = 2751 sizeof(ctx_new.range.level[0].cat));
2751 ctx_new.range.level[0].cat.node;
2752 } else {
2753 ebitmap_init(&ctx_new.range.level[0].cat);
2754 ebitmap_init(&ctx_new.range.level[1].cat);
2755 } 2752 }
2756 if (mls_context_isvalid(&policydb, &ctx_new) != 1) 2753 if (mls_context_isvalid(&policydb, &ctx_new) != 1)
2757 goto netlbl_secattr_to_sid_return_cleanup; 2754 goto netlbl_secattr_to_sid_return_cleanup;
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 9dd9bc73fe1d..ece25c718e95 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -781,7 +781,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
781 return -ENODEV; 781 return -ENODEV;
782 782
783 card = pcm->card; 783 card = pcm->card;
784 down_read(&card->controls_rwsem); 784 read_lock(&card->ctl_files_rwlock);
785 list_for_each_entry(kctl, &card->ctl_files, list) { 785 list_for_each_entry(kctl, &card->ctl_files, list) {
786 if (kctl->pid == current->pid) { 786 if (kctl->pid == current->pid) {
787 prefer_subdevice = kctl->prefer_pcm_subdevice; 787 prefer_subdevice = kctl->prefer_pcm_subdevice;
@@ -789,7 +789,7 @@ int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
789 break; 789 break;
790 } 790 }
791 } 791 }
792 up_read(&card->controls_rwsem); 792 read_unlock(&card->ctl_files_rwlock);
793 793
794 switch (stream) { 794 switch (stream) {
795 case SNDRV_PCM_STREAM_PLAYBACK: 795 case SNDRV_PCM_STREAM_PLAYBACK:
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index c49b9d9e303c..c487025d3457 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1546,16 +1546,10 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream)
1546 card = substream->pcm->card; 1546 card = substream->pcm->card;
1547 1547
1548 if (runtime->status->state == SNDRV_PCM_STATE_OPEN || 1548 if (runtime->status->state == SNDRV_PCM_STATE_OPEN ||
1549 runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) 1549 runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED ||
1550 runtime->status->state == SNDRV_PCM_STATE_SUSPENDED)
1550 return -EBADFD; 1551 return -EBADFD;
1551 1552
1552 snd_power_lock(card);
1553 if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) {
1554 result = snd_power_wait(card, SNDRV_CTL_POWER_D0);
1555 if (result < 0)
1556 goto _unlock;
1557 }
1558
1559 snd_pcm_stream_lock_irq(substream); 1553 snd_pcm_stream_lock_irq(substream);
1560 /* resume pause */ 1554 /* resume pause */
1561 if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) 1555 if (runtime->status->state == SNDRV_PCM_STATE_PAUSED)
@@ -1564,8 +1558,7 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream)
1564 snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP); 1558 snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP);
1565 /* runtime->control->appl_ptr = runtime->status->hw_ptr; */ 1559 /* runtime->control->appl_ptr = runtime->status->hw_ptr; */
1566 snd_pcm_stream_unlock_irq(substream); 1560 snd_pcm_stream_unlock_irq(substream);
1567 _unlock: 1561
1568 snd_power_unlock(card);
1569 return result; 1562 return result;
1570} 1563}
1571 1564
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index f7ea7287c59c..b917a9f981c7 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -418,7 +418,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
418 mutex_lock(&rmidi->open_mutex); 418 mutex_lock(&rmidi->open_mutex);
419 while (1) { 419 while (1) {
420 subdevice = -1; 420 subdevice = -1;
421 down_read(&card->controls_rwsem); 421 read_lock(&card->ctl_files_rwlock);
422 list_for_each_entry(kctl, &card->ctl_files, list) { 422 list_for_each_entry(kctl, &card->ctl_files, list) {
423 if (kctl->pid == current->pid) { 423 if (kctl->pid == current->pid) {
424 subdevice = kctl->prefer_rawmidi_subdevice; 424 subdevice = kctl->prefer_rawmidi_subdevice;
@@ -426,7 +426,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file)
426 break; 426 break;
427 } 427 }
428 } 428 }
429 up_read(&card->controls_rwsem); 429 read_unlock(&card->ctl_files_rwlock);
430 err = snd_rawmidi_kernel_open(rmidi->card, rmidi->device, 430 err = snd_rawmidi_kernel_open(rmidi->card, rmidi->device,
431 subdevice, fflags, rawmidi_file); 431 subdevice, fflags, rawmidi_file);
432 if (err >= 0) 432 if (err >= 0)
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index ad994fcab725..f3da621f25c5 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -1683,8 +1683,8 @@ static struct snd_pci_quirk stac927x_cfg_tbl[] = {
1683 /* Dell 3 stack systems with verb table in BIOS */ 1683 /* Dell 3 stack systems with verb table in BIOS */
1684 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS), 1684 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
1685 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS), 1685 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS),
1686 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell ", STAC_DELL_BIOS),
1687 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS), 1686 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS),
1687 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_3ST),
1688 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS), 1688 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS),
1689 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS), 1689 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS),
1690 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS), 1690 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS),
diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c
index 566a6d0daf4a..106c48225bba 100644
--- a/sound/ppc/awacs.c
+++ b/sound/ppc/awacs.c
@@ -621,6 +621,13 @@ static struct snd_kcontrol_new snd_pmac_screamer_mixers_imac[] __initdata = {
621 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), 621 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
622}; 622};
623 623
624static struct snd_kcontrol_new snd_pmac_screamer_mixers_g4agp[] __initdata = {
625 AWACS_VOLUME("Line out Playback Volume", 2, 6, 1),
626 AWACS_VOLUME("Master Playback Volume", 5, 6, 1),
627 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
628 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0),
629};
630
624static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac7500[] __initdata = { 631static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac7500[] __initdata = {
625 AWACS_VOLUME("Line out Playback Volume", 2, 6, 1), 632 AWACS_VOLUME("Line out Playback Volume", 2, 6, 1),
626 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), 633 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
@@ -688,7 +695,10 @@ static struct snd_kcontrol_new snd_pmac_awacs_speaker_vol[] __initdata = {
688static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw __initdata = 695static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw __initdata =
689AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1); 696AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1);
690 697
691static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac __initdata = 698static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac1 __initdata =
699AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 1);
700
701static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac2 __initdata =
692AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 0); 702AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 0);
693 703
694 704
@@ -765,11 +775,12 @@ static void snd_pmac_awacs_resume(struct snd_pmac *chip)
765 775
766#define IS_PM7500 (machine_is_compatible("AAPL,7500")) 776#define IS_PM7500 (machine_is_compatible("AAPL,7500"))
767#define IS_BEIGE (machine_is_compatible("AAPL,Gossamer")) 777#define IS_BEIGE (machine_is_compatible("AAPL,Gossamer"))
768#define IS_IMAC (machine_is_compatible("PowerMac2,1") \ 778#define IS_IMAC1 (machine_is_compatible("PowerMac2,1"))
769 || machine_is_compatible("PowerMac2,2") \ 779#define IS_IMAC2 (machine_is_compatible("PowerMac2,2") \
770 || machine_is_compatible("PowerMac4,1")) 780 || machine_is_compatible("PowerMac4,1"))
781#define IS_G4AGP (machine_is_compatible("PowerMac3,1"))
771 782
772static int imac; 783static int imac1, imac2;
773 784
774#ifdef PMAC_SUPPORT_AUTOMUTE 785#ifdef PMAC_SUPPORT_AUTOMUTE
775/* 786/*
@@ -815,13 +826,18 @@ static void snd_pmac_awacs_update_automute(struct snd_pmac *chip, int do_notify)
815 { 826 {
816 int reg = chip->awacs_reg[1] 827 int reg = chip->awacs_reg[1]
817 | (MASK_HDMUTE | MASK_SPKMUTE); 828 | (MASK_HDMUTE | MASK_SPKMUTE);
818 if (imac) { 829 if (imac1) {
830 reg &= ~MASK_SPKMUTE;
831 reg |= MASK_PAROUT1;
832 } else if (imac2) {
819 reg &= ~MASK_SPKMUTE; 833 reg &= ~MASK_SPKMUTE;
820 reg &= ~MASK_PAROUT1; 834 reg &= ~MASK_PAROUT1;
821 } 835 }
822 if (snd_pmac_awacs_detect_headphone(chip)) 836 if (snd_pmac_awacs_detect_headphone(chip))
823 reg &= ~MASK_HDMUTE; 837 reg &= ~MASK_HDMUTE;
824 else if (imac) 838 else if (imac1)
839 reg &= ~MASK_PAROUT1;
840 else if (imac2)
825 reg |= MASK_PAROUT1; 841 reg |= MASK_PAROUT1;
826 else 842 else
827 reg &= ~MASK_SPKMUTE; 843 reg &= ~MASK_SPKMUTE;
@@ -850,9 +866,13 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
850{ 866{
851 int pm7500 = IS_PM7500; 867 int pm7500 = IS_PM7500;
852 int beige = IS_BEIGE; 868 int beige = IS_BEIGE;
869 int g4agp = IS_G4AGP;
870 int imac;
853 int err, vol; 871 int err, vol;
854 872
855 imac = IS_IMAC; 873 imac1 = IS_IMAC1;
874 imac2 = IS_IMAC2;
875 imac = imac1 || imac2;
856 /* looks like MASK_GAINLINE triggers something, so we set here 876 /* looks like MASK_GAINLINE triggers something, so we set here
857 * as start-up 877 * as start-up
858 */ 878 */
@@ -939,7 +959,7 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
939 snd_pmac_awacs_mixers); 959 snd_pmac_awacs_mixers);
940 if (err < 0) 960 if (err < 0)
941 return err; 961 return err;
942 if (beige) 962 if (beige || g4agp)
943 ; 963 ;
944 else if (chip->model == PMAC_SCREAMER) 964 else if (chip->model == PMAC_SCREAMER)
945 err = build_mixers(chip, ARRAY_SIZE(snd_pmac_screamer_mixers2), 965 err = build_mixers(chip, ARRAY_SIZE(snd_pmac_screamer_mixers2),
@@ -961,13 +981,17 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
961 err = build_mixers(chip, 981 err = build_mixers(chip,
962 ARRAY_SIZE(snd_pmac_screamer_mixers_imac), 982 ARRAY_SIZE(snd_pmac_screamer_mixers_imac),
963 snd_pmac_screamer_mixers_imac); 983 snd_pmac_screamer_mixers_imac);
984 else if (g4agp)
985 err = build_mixers(chip,
986 ARRAY_SIZE(snd_pmac_screamer_mixers_g4agp),
987 snd_pmac_screamer_mixers_g4agp);
964 else 988 else
965 err = build_mixers(chip, 989 err = build_mixers(chip,
966 ARRAY_SIZE(snd_pmac_awacs_mixers_pmac), 990 ARRAY_SIZE(snd_pmac_awacs_mixers_pmac),
967 snd_pmac_awacs_mixers_pmac); 991 snd_pmac_awacs_mixers_pmac);
968 if (err < 0) 992 if (err < 0)
969 return err; 993 return err;
970 chip->master_sw_ctl = snd_ctl_new1((pm7500 || imac) 994 chip->master_sw_ctl = snd_ctl_new1((pm7500 || imac || g4agp)
971 ? &snd_pmac_awacs_master_sw_imac 995 ? &snd_pmac_awacs_master_sw_imac
972 : &snd_pmac_awacs_master_sw, chip); 996 : &snd_pmac_awacs_master_sw, chip);
973 err = snd_ctl_add(chip->card, chip->master_sw_ctl); 997 err = snd_ctl_add(chip->card, chip->master_sw_ctl);
@@ -1004,15 +1028,17 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
1004 snd_pmac_awacs_speaker_vol); 1028 snd_pmac_awacs_speaker_vol);
1005 if (err < 0) 1029 if (err < 0)
1006 return err; 1030 return err;
1007 chip->speaker_sw_ctl = snd_ctl_new1(imac 1031 chip->speaker_sw_ctl = snd_ctl_new1(imac1
1008 ? &snd_pmac_awacs_speaker_sw_imac 1032 ? &snd_pmac_awacs_speaker_sw_imac1
1033 : imac2
1034 ? &snd_pmac_awacs_speaker_sw_imac2
1009 : &snd_pmac_awacs_speaker_sw, chip); 1035 : &snd_pmac_awacs_speaker_sw, chip);
1010 err = snd_ctl_add(chip->card, chip->speaker_sw_ctl); 1036 err = snd_ctl_add(chip->card, chip->speaker_sw_ctl);
1011 if (err < 0) 1037 if (err < 0)
1012 return err; 1038 return err;
1013 } 1039 }
1014 1040
1015 if (beige) 1041 if (beige || g4agp)
1016 err = build_mixers(chip, 1042 err = build_mixers(chip,
1017 ARRAY_SIZE(snd_pmac_screamer_mic_boost_beige), 1043 ARRAY_SIZE(snd_pmac_screamer_mic_boost_beige),
1018 snd_pmac_screamer_mic_boost_beige); 1044 snd_pmac_screamer_mic_boost_beige);
diff --git a/sound/soc/at32/at32-pcm.c b/sound/soc/at32/at32-pcm.c
index 435f1daf177c..c83584f989a9 100644
--- a/sound/soc/at32/at32-pcm.c
+++ b/sound/soc/at32/at32-pcm.c
@@ -434,7 +434,8 @@ static int at32_pcm_suspend(struct platform_device *pdev,
434 params = prtd->params; 434 params = prtd->params;
435 435
436 /* Disable the PDC and save the PDC registers */ 436 /* Disable the PDC and save the PDC registers */
437 ssc_writex(params->ssc->regs, PDC_PTCR, params->mask->pdc_disable); 437 ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR,
438 params->mask->pdc_disable);
438 439
439 prtd->pdc_xpr_save = ssc_readx(params->ssc->regs, params->pdc->xpr); 440 prtd->pdc_xpr_save = ssc_readx(params->ssc->regs, params->pdc->xpr);
440 prtd->pdc_xcr_save = ssc_readx(params->ssc->regs, params->pdc->xcr); 441 prtd->pdc_xcr_save = ssc_readx(params->ssc->regs, params->pdc->xcr);
@@ -464,7 +465,7 @@ static int at32_pcm_resume(struct platform_device *pdev,
464 ssc_writex(params->ssc->regs, params->pdc->xnpr, prtd->pdc_xnpr_save); 465 ssc_writex(params->ssc->regs, params->pdc->xnpr, prtd->pdc_xnpr_save);
465 ssc_writex(params->ssc->regs, params->pdc->xncr, prtd->pdc_xncr_save); 466 ssc_writex(params->ssc->regs, params->pdc->xncr, prtd->pdc_xncr_save);
466 467
467 ssc_writex(params->ssc->regs, PDC_PTCR, params->mask->pdc_enable); 468 ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR, params->mask->pdc_enable);
468 return 0; 469 return 0;
469} 470}
470#else /* CONFIG_PM */ 471#else /* CONFIG_PM */
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c
index 9deb8c74fdfd..0bbd94501d7e 100644
--- a/sound/soc/codecs/cs4270.c
+++ b/sound/soc/codecs/cs4270.c
@@ -490,34 +490,7 @@ static int cs4270_mute(struct snd_soc_dai *dai, int mute)
490 490
491#endif 491#endif
492 492
493static int cs4270_i2c_probe(struct i2c_adapter *adap, int addr, int kind); 493static int cs4270_i2c_probe(struct i2c_client *, const struct i2c_device_id *);
494
495/*
496 * Notify the driver that a new I2C bus has been found.
497 *
498 * This function is called for each I2C bus in the system. The function
499 * then asks the I2C subsystem to probe that bus at the addresses on which
500 * our device (the CS4270) could exist. If a device is found at one of
501 * those addresses, then our probe function (cs4270_i2c_probe) is called.
502 */
503static int cs4270_i2c_attach(struct i2c_adapter *adapter)
504{
505 return i2c_probe(adapter, &addr_data, cs4270_i2c_probe);
506}
507
508static int cs4270_i2c_detach(struct i2c_client *client)
509{
510 struct snd_soc_codec *codec = i2c_get_clientdata(client);
511
512 i2c_detach_client(client);
513 codec->control_data = NULL;
514
515 kfree(codec->reg_cache);
516 codec->reg_cache = NULL;
517
518 kfree(client);
519 return 0;
520}
521 494
522/* A list of non-DAPM controls that the CS4270 supports */ 495/* A list of non-DAPM controls that the CS4270 supports */
523static const struct snd_kcontrol_new cs4270_snd_controls[] = { 496static const struct snd_kcontrol_new cs4270_snd_controls[] = {
@@ -525,14 +498,19 @@ static const struct snd_kcontrol_new cs4270_snd_controls[] = {
525 CS4270_VOLA, CS4270_VOLB, 0, 0xFF, 1) 498 CS4270_VOLA, CS4270_VOLB, 0, 0xFF, 1)
526}; 499};
527 500
501static const struct i2c_device_id cs4270_id[] = {
502 {"cs4270", 0},
503 {}
504};
505MODULE_DEVICE_TABLE(i2c, cs4270_id);
506
528static struct i2c_driver cs4270_i2c_driver = { 507static struct i2c_driver cs4270_i2c_driver = {
529 .driver = { 508 .driver = {
530 .name = "CS4270 I2C", 509 .name = "CS4270 I2C",
531 .owner = THIS_MODULE, 510 .owner = THIS_MODULE,
532 }, 511 },
533 .id = I2C_DRIVERID_CS4270, 512 .id_table = cs4270_id,
534 .attach_adapter = cs4270_i2c_attach, 513 .probe = cs4270_i2c_probe,
535 .detach_client = cs4270_i2c_detach,
536}; 514};
537 515
538/* 516/*
@@ -561,11 +539,11 @@ static struct snd_soc_device *cs4270_socdev;
561 * Note: snd_soc_new_pcms() must be called before this function can be called, 539 * Note: snd_soc_new_pcms() must be called before this function can be called,
562 * because of snd_ctl_add(). 540 * because of snd_ctl_add().
563 */ 541 */
564static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind) 542static int cs4270_i2c_probe(struct i2c_client *i2c_client,
543 const struct i2c_device_id *id)
565{ 544{
566 struct snd_soc_device *socdev = cs4270_socdev; 545 struct snd_soc_device *socdev = cs4270_socdev;
567 struct snd_soc_codec *codec = socdev->codec; 546 struct snd_soc_codec *codec = socdev->codec;
568 struct i2c_client *i2c_client = NULL;
569 int i; 547 int i;
570 int ret = 0; 548 int ret = 0;
571 549
@@ -578,12 +556,6 @@ static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind)
578 556
579 /* Note: codec_dai->codec is NULL here */ 557 /* Note: codec_dai->codec is NULL here */
580 558
581 i2c_client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
582 if (!i2c_client) {
583 printk(KERN_ERR "cs4270: could not allocate I2C client\n");
584 return -ENOMEM;
585 }
586
587 codec->reg_cache = kzalloc(CS4270_NUMREGS, GFP_KERNEL); 559 codec->reg_cache = kzalloc(CS4270_NUMREGS, GFP_KERNEL);
588 if (!codec->reg_cache) { 560 if (!codec->reg_cache) {
589 printk(KERN_ERR "cs4270: could not allocate register cache\n"); 561 printk(KERN_ERR "cs4270: could not allocate register cache\n");
@@ -591,13 +563,6 @@ static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind)
591 goto error; 563 goto error;
592 } 564 }
593 565
594 i2c_set_clientdata(i2c_client, codec);
595 strcpy(i2c_client->name, "CS4270");
596
597 i2c_client->driver = &cs4270_i2c_driver;
598 i2c_client->adapter = adapter;
599 i2c_client->addr = addr;
600
601 /* Verify that we have a CS4270 */ 566 /* Verify that we have a CS4270 */
602 567
603 ret = i2c_smbus_read_byte_data(i2c_client, CS4270_CHIPID); 568 ret = i2c_smbus_read_byte_data(i2c_client, CS4270_CHIPID);
@@ -612,18 +577,10 @@ static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind)
612 goto error; 577 goto error;
613 } 578 }
614 579
615 printk(KERN_INFO "cs4270: found device at I2C address %X\n", addr); 580 printk(KERN_INFO "cs4270: found device at I2C address %X\n",
581 i2c_client->addr);
616 printk(KERN_INFO "cs4270: hardware revision %X\n", ret & 0xF); 582 printk(KERN_INFO "cs4270: hardware revision %X\n", ret & 0xF);
617 583
618 /* Tell the I2C layer a new client has arrived */
619
620 ret = i2c_attach_client(i2c_client);
621 if (ret) {
622 printk(KERN_ERR "cs4270: could not attach codec, "
623 "I2C address %x, error code %i\n", addr, ret);
624 goto error;
625 }
626
627 codec->control_data = i2c_client; 584 codec->control_data = i2c_client;
628 codec->read = cs4270_read_reg_cache; 585 codec->read = cs4270_read_reg_cache;
629 codec->write = cs4270_i2c_write; 586 codec->write = cs4270_i2c_write;
@@ -648,20 +605,17 @@ static int cs4270_i2c_probe(struct i2c_adapter *adapter, int addr, int kind)
648 goto error; 605 goto error;
649 } 606 }
650 607
608 i2c_set_clientdata(i2c_client, codec);
609
651 return 0; 610 return 0;
652 611
653error: 612error:
654 if (codec->control_data) { 613 codec->control_data = NULL;
655 i2c_detach_client(i2c_client);
656 codec->control_data = NULL;
657 }
658 614
659 kfree(codec->reg_cache); 615 kfree(codec->reg_cache);
660 codec->reg_cache = NULL; 616 codec->reg_cache = NULL;
661 codec->reg_cache_size = 0; 617 codec->reg_cache_size = 0;
662 618
663 kfree(i2c_client);
664
665 return ret; 619 return ret;
666} 620}
667 621
@@ -727,7 +681,7 @@ static int cs4270_probe(struct platform_device *pdev)
727 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); 681 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
728 if (ret < 0) { 682 if (ret < 0) {
729 printk(KERN_ERR "cs4270: failed to create PCMs\n"); 683 printk(KERN_ERR "cs4270: failed to create PCMs\n");
730 return ret; 684 goto error_free_codec;
731 } 685 }
732 686
733#ifdef USE_I2C 687#ifdef USE_I2C
@@ -736,8 +690,7 @@ static int cs4270_probe(struct platform_device *pdev)
736 ret = i2c_add_driver(&cs4270_i2c_driver); 690 ret = i2c_add_driver(&cs4270_i2c_driver);
737 if (ret) { 691 if (ret) {
738 printk(KERN_ERR "cs4270: failed to attach driver"); 692 printk(KERN_ERR "cs4270: failed to attach driver");
739 snd_soc_free_pcms(socdev); 693 goto error_free_pcms;
740 return ret;
741 } 694 }
742 695
743 /* Did we find a CS4270 on the I2C bus? */ 696 /* Did we find a CS4270 on the I2C bus? */
@@ -759,10 +712,23 @@ static int cs4270_probe(struct platform_device *pdev)
759 ret = snd_soc_register_card(socdev); 712 ret = snd_soc_register_card(socdev);
760 if (ret < 0) { 713 if (ret < 0) {
761 printk(KERN_ERR "cs4270: failed to register card\n"); 714 printk(KERN_ERR "cs4270: failed to register card\n");
762 snd_soc_free_pcms(socdev); 715 goto error_del_driver;
763 return ret;
764 } 716 }
765 717
718 return 0;
719
720error_del_driver:
721#ifdef USE_I2C
722 i2c_del_driver(&cs4270_i2c_driver);
723
724error_free_pcms:
725#endif
726 snd_soc_free_pcms(socdev);
727
728error_free_codec:
729 kfree(socdev->codec);
730 socdev->codec = NULL;
731
766 return ret; 732 return ret;
767} 733}
768 734
@@ -773,8 +739,7 @@ static int cs4270_remove(struct platform_device *pdev)
773 snd_soc_free_pcms(socdev); 739 snd_soc_free_pcms(socdev);
774 740
775#ifdef USE_I2C 741#ifdef USE_I2C
776 if (socdev->codec->control_data) 742 i2c_del_driver(&cs4270_i2c_driver);
777 i2c_del_driver(&cs4270_i2c_driver);
778#endif 743#endif
779 744
780 kfree(socdev->codec); 745 kfree(socdev->codec);
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index 5761164fe16d..e873414840c8 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -583,7 +583,7 @@ static const struct snd_soc_dapm_route audio_map[] = {
583 583
584 /* out 4 */ 584 /* out 4 */
585 {"Out4 Mux", "VREF", "VREF"}, 585 {"Out4 Mux", "VREF", "VREF"},
586 {"Out4 Mux", "Capture ST", "Capture ST Mixer"}, 586 {"Out4 Mux", "Capture ST", "Playback Mixer"},
587 {"Out4 Mux", "LOUT2", "LOUT2"}, 587 {"Out4 Mux", "LOUT2", "LOUT2"},
588 {"Out 4", NULL, "Out4 Mux"}, 588 {"Out 4", NULL, "Out4 Mux"},
589 {"OUT4", NULL, "Out 4"}, 589 {"OUT4", NULL, "Out 4"},
@@ -607,7 +607,7 @@ static const struct snd_soc_dapm_route audio_map[] = {
607 /* Capture Right Mux */ 607 /* Capture Right Mux */
608 {"Capture Right Mux", "PGA", "Right Capture Volume"}, 608 {"Capture Right Mux", "PGA", "Right Capture Volume"},
609 {"Capture Right Mux", "Line or RXP-RXN", "Line Right Mux"}, 609 {"Capture Right Mux", "Line or RXP-RXN", "Line Right Mux"},
610 {"Capture Right Mux", "Sidetone", "Capture ST Mixer"}, 610 {"Capture Right Mux", "Sidetone", "Playback Mixer"},
611 611
612 /* Mono Capture mixer-mux */ 612 /* Mono Capture mixer-mux */
613 {"Capture Right Mixer", "Stereo", "Capture Right Mux"}, 613 {"Capture Right Mixer", "Stereo", "Capture Right Mux"},